Files
molecular_frontend/public/index.html

5976 lines
1.8 MiB
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- index.html -->
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
background: none;
background-color: var(--mantine-color-secondary);
}
body {
font-family:
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
sans-serif;
}
</style>
<script type="module" crossorigin>var MI=Object.create,cx=Object.defineProperty,wI=Object.getOwnPropertyDescriptor,AI=Object.getOwnPropertyNames,EI=Object.getPrototypeOf,TI=Object.prototype.hasOwnProperty,ha=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),CI=(e,t)=>{let n={};for(var i in e)cx(n,i,{get:e[i],enumerable:!0});return t||cx(n,Symbol.toStringTag,{value:"Module"}),n},RI=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(var r=AI(t),s=0,a=r.length,c;s<a;s++)c=r[s],!TI.call(e,c)&&c!==n&&cx(e,c,{get:(u=>t[u]).bind(null,c),enumerable:!(i=wI(t,c))||i.enumerable});return e},yx=(e,t,n)=>(n=e!=null?MI(EI(e)):{},RI(t||!e||!e.__esModule?cx(n,"default",{value:e,enumerable:!0}):n,e));(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.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 n(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=n(r);fetch(r.href,s)}})();var LI=ha((e=>{function t($,j){var J=$.length;$.push(j);e:for(;0<J;){var xe=J-1>>>1,de=$[xe];if(0<r(de,j))$[xe]=j,$[J]=de,J=xe;else break e}}function n($){return $.length===0?null:$[0]}function i($){if($.length===0)return null;var j=$[0],J=$.pop();if(J!==j){$[0]=J;e:for(var xe=0,de=$.length,fe=de>>>1;xe<fe;){var F=2*(xe+1)-1,re=$[F],ue=F+1,_e=$[ue];if(0>r(re,J))ue<de&&0>r(_e,re)?($[xe]=_e,$[ue]=J,xe=ue):($[xe]=re,$[F]=J,xe=F);else if(ue<de&&0>r(_e,J))$[xe]=_e,$[ue]=J,xe=ue;else break e}}return j}function r($,j){var J=$.sortIndex-j.sortIndex;return J!==0?J:$.id-j.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var a=Date,c=a.now();e.unstable_now=function(){return a.now()-c}}var u=[],d=[],p=1,g=null,v=3,y=!1,S=!1,E=!1,w=!1,b=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function C($){for(var j=n(d);j!==null;){if(j.callback===null)i(d);else if(j.startTime<=$)i(d),j.sortIndex=j.expirationTime,t(u,j);else break;j=n(d)}}function P($){if(E=!1,C($),!S)if(n(u)!==null)S=!0,O||(O=!0,oe());else{var j=n(d);j!==null&&X(P,j.startTime-$)}}var O=!1,B=-1,U=5,I=-1;function z(){return w?!0:!(e.unstable_now()-I<U)}function te(){if(w=!1,O){var $=e.unstable_now();I=$;var j=!0;try{e:{S=!1,E&&(E=!1,T(B),B=-1),y=!0;var J=v;try{t:{for(C($),g=n(u);g!==null&&!(g.expirationTime>$&&z());){var xe=g.callback;if(typeof xe=="function"){g.callback=null,v=g.priorityLevel;var de=xe(g.expirationTime<=$);if($=e.unstable_now(),typeof de=="function"){g.callback=de,C($),j=!0;break t}g===n(u)&&i(u),C($)}else i(u);g=n(u)}if(g!==null)j=!0;else{var fe=n(d);fe!==null&&X(P,fe.startTime-$),j=!1}}break e}finally{g=null,v=J,y=!1}j=void 0}}finally{j?oe():O=!1}}}var oe;if(typeof L=="function")oe=function(){L(te)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,k=ee.port2;ee.port1.onmessage=te,oe=function(){k.postMessage(null)}}else oe=function(){b(te,0)};function X($,j){B=b(function(){$(e.unstable_now())},j)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function($){$.callback=null},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function($){switch(v){case 1:case 2:case 3:var j=3;break;default:j=v}var J=v;v=j;try{return $()}finally{v=J}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function($,j){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var J=v;v=$;try{return j()}finally{v=J}},e.unstable_scheduleCallback=function($,j,J){var xe=e.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?xe+J:xe):J=xe,$){case 1:var de=-1;break;case 2:de=250;break;case 5:de=1073741823;break;case 4:de=1e4;break;default:de=5e3}return de=J+de,$={id:p++,callback:j,priorityLevel:$,startTime:J,expirationTime:de,sortIndex:-1},J>xe?($.sortIndex=J,t(d,$),n(u)===null&&$===n(d)&&(E?(T(B),B=-1):E=!0,X(P,J-xe))):($.sortIndex=de,t(u,$),S||y||(S=!0,O||(O=!0,oe()))),$},e.unstable_shouldYield=z,e.unstable_wrapCallback=function($){var j=v;return function(){var J=v;v=j;try{return $.apply(this,arguments)}finally{v=J}}}})),PI=ha(((e,t)=>{t.exports=LI()})),NI=ha((e=>{var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),y=Symbol.iterator;function S(F){return F===null||typeof F!="object"?null:(F=y&&F[y]||F["@@iterator"],typeof F=="function"?F:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,b={};function T(F,re,ue){this.props=F,this.context=re,this.refs=b,this.updater=ue||E}T.prototype.isReactComponent={},T.prototype.setState=function(F,re){if(typeof F!="object"&&typeof F!="function"&&F!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,F,re,"setState")},T.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function L(){}L.prototype=T.prototype;function C(F,re,ue){this.props=F,this.context=re,this.refs=b,this.updater=ue||E}var P=C.prototype=new L;P.constructor=C,w(P,T.prototype),P.isPureReactComponent=!0;var O=Array.isArray;function B(){}var U={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function z(F,re,ue){var _e=ue.ref;return{$$typeof:t,type:F,key:re,ref:_e!==void 0?_e:null,props:ue}}function te(F,re){return z(F.type,re,F.props)}function oe(F){return typeof F=="object"&&F!==null&&F.$$typeof===t}function ee(F){var re={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(ue){return re[ue]})}var k=/\/+/g;function X(F,re){return typeof F=="object"&&F!==null&&F.key!=null?ee(""+F.key):re.toString(36)}function $(F){switch(F.status){case"fulfilled":return F.value;case"rejected":throw F.reason;default:switch(typeof F.status=="string"?F.then(B,B):(F.status="pending",F.then(function(re){F.status==="pending"&&(F.status="fulfilled",F.value=re)},function(re){F.status==="pending"&&(F.status="rejected",F.reason=re)})),F.status){case"fulfilled":return F.value;case"rejected":throw F.reason}}throw F}function j(F,re,ue,_e,Le){var Fe=typeof F;(Fe==="undefined"||Fe==="boolean")&&(F=null);var Xe=!1;if(F===null)Xe=!0;else switch(Fe){case"bigint":case"string":case"number":Xe=!0;break;case"object":switch(F.$$typeof){case t:case n:Xe=!0;break;case g:return Xe=F._init,j(Xe(F._payload),re,ue,_e,Le)}}if(Xe)return Le=Le(F),Xe=_e===""?"."+X(F,0):_e,O(Le)?(ue="",Xe!=null&&(ue=Xe.replace(k,"$&/")+"/"),j(Le,re,ue,"",function(ne){return ne})):Le!=null&&(oe(Le)&&(Le=te(Le,ue+(Le.key==null||F&&F.key===Le.key?"":(""+Le.key).replace(k,"$&/")+"/")+Xe)),re.push(Le)),1;Xe=0;var lt=_e===""?".":_e+":";if(O(F))for(var mt=0;mt<F.length;mt++)_e=F[mt],Fe=lt+X(_e,mt),Xe+=j(_e,re,ue,Fe,Le);else if(mt=S(F),typeof mt=="function")for(F=mt.call(F),mt=0;!(_e=F.next()).done;)_e=_e.value,Fe=lt+X(_e,mt++),Xe+=j(_e,re,ue,Fe,Le);else if(Fe==="object"){if(typeof F.then=="function")return j($(F),re,ue,_e,Le);throw re=String(F),Error("Objects are not valid as a React child (found: "+(re==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":re)+"). If you meant to render a collection of children, use an array instead.")}return Xe}function J(F,re,ue){if(F==null)return F;var _e=[],Le=0;return j(F,_e,"","",function(Fe){return re.call(ue,Fe,Le++)}),_e}function xe(F){if(F._status===-1){var re=F._result;re=re(),re.then(function(ue){(F._status===0||F._status===-1)&&(F._status=1,F._result=ue)},function(ue){(F._status===0||F._status===-1)&&(F._status=2,F._result=ue)}),F._status===-1&&(F._status=0,F._result=re)}if(F._status===1)return F._result.default;throw F._result}var de=typeof reportError=="function"?reportError:function(F){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var re=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof F=="object"&&F!==null&&typeof F.message=="string"?String(F.message):String(F),error:F});if(!window.dispatchEvent(re))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",F);return}console.error(F)},fe={map:J,forEach:function(F,re,ue){J(F,function(){re.apply(this,arguments)},ue)},count:function(F){var re=0;return J(F,function(){re++}),re},toArray:function(F){return J(F,function(re){return re})||[]},only:function(F){if(!oe(F))throw Error("React.Children.only expected to receive a single React element child.");return F}};e.Activity=v,e.Children=fe,e.Component=T,e.Fragment=i,e.Profiler=s,e.PureComponent=C,e.StrictMode=r,e.Suspense=d,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=U,e.__COMPILER_RUNTIME={__proto__:null,c:function(F){return U.H.useMemoCache(F)}},e.cache=function(F){return function(){return F.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(F,re,ue){if(F==null)throw Error("The argument must be a React element, but you passed "+F+".");var _e=w({},F.props),Le=F.key;if(re!=null)for(Fe in re.key!==void 0&&(Le=""+re.key),re)!I.call(re,Fe)||Fe==="key"||Fe==="__self"||Fe==="__source"||Fe==="ref"&&re.ref===void 0||(_e[Fe]=re[Fe]);var Fe=arguments.length-2;if(Fe===1)_e.children=ue;else if(1<Fe){for(var Xe=Array(Fe),lt=0;lt<Fe;lt++)Xe[lt]=arguments[lt+2];_e.children=Xe}return z(F.type,Le,_e)},e.createContext=function(F){return F={$$typeof:c,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null},F.Provider=F,F.Consumer={$$typeof:a,_context:F},F},e.createElement=function(F,re,ue){var _e,Le={},Fe=null;if(re!=null)for(_e in re.key!==void 0&&(Fe=""+re.key),re)I.call(re,_e)&&_e!=="key"&&_e!=="__self"&&_e!=="__source"&&(Le[_e]=re[_e]);var Xe=arguments.length-2;if(Xe===1)Le.children=ue;else if(1<Xe){for(var lt=Array(Xe),mt=0;mt<Xe;mt++)lt[mt]=arguments[mt+2];Le.children=lt}if(F&&F.defaultProps)for(_e in Xe=F.defaultProps,Xe)Le[_e]===void 0&&(Le[_e]=Xe[_e]);return z(F,Fe,Le)},e.createRef=function(){return{current:null}},e.forwardRef=function(F){return{$$typeof:u,render:F}},e.isValidElement=oe,e.lazy=function(F){return{$$typeof:g,_payload:{_status:-1,_result:F},_init:xe}},e.memo=function(F,re){return{$$typeof:p,type:F,compare:re===void 0?null:re}},e.startTransition=function(F){var re=U.T,ue={};U.T=ue;try{var _e=F(),Le=U.S;Le!==null&&Le(ue,_e),typeof _e=="object"&&_e!==null&&typeof _e.then=="function"&&_e.then(B,de)}catch(Fe){de(Fe)}finally{re!==null&&ue.types!==null&&(re.types=ue.types),U.T=re}},e.unstable_useCacheRefresh=function(){return U.H.useCacheRefresh()},e.use=function(F){return U.H.use(F)},e.useActionState=function(F,re,ue){return U.H.useActionState(F,re,ue)},e.useCallback=function(F,re){return U.H.useCallback(F,re)},e.useContext=function(F){return U.H.useContext(F)},e.useDebugValue=function(){},e.useDeferredValue=function(F,re){return U.H.useDeferredValue(F,re)},e.useEffect=function(F,re){return U.H.useEffect(F,re)},e.useEffectEvent=function(F){return U.H.useEffectEvent(F)},e.useId=function(){return U.H.useId()},e.useImperativeHandle=function(F,re,ue){return U.H.useImperativeHandle(F,re,ue)},e.useInsertionEffect=function(F,re){return U.H.useInsertionEffect(F,re)},e.useLayoutEffect=function(F,re){return U.H.useLayoutEffect(F,re)},e.useMemo=function(F,re){return U.H.useMemo(F,re)},e.useOptimistic=function(F,re){return U.H.useOptimistic(F,re)},e.useReducer=function(F,re,ue){return U.H.useReducer(F,re,ue)},e.useRef=function(F){return U.H.useRef(F)},e.useState=function(F){return U.H.useState(F)},e.useSyncExternalStore=function(F,re,ue){return U.H.useSyncExternalStore(F,re,ue)},e.useTransition=function(){return U.H.useTransition()},e.version="19.2.5"})),bM=ha(((e,t)=>{t.exports=NI()})),II=ha((e=>{var t=bM();function n(d){var p="https://react.dev/errors/"+d;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)p+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+d+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var r={d:{f:i,r:function(){throw Error(n(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},s=Symbol.for("react.portal");function a(d,p,g){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:v==null?null:""+v,children:d,containerInfo:p,implementation:g}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(d,p){if(d==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,e.createPortal=function(d,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(n(299));return a(d,p,null,g)},e.flushSync=function(d){var p=c.T,g=r.p;try{if(c.T=null,r.p=2,d)return d()}finally{c.T=p,r.p=g,r.d.f()}},e.preconnect=function(d,p){typeof d=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,r.d.C(d,p))},e.prefetchDNS=function(d){typeof d=="string"&&r.d.D(d)},e.preinit=function(d,p){if(typeof d=="string"&&p&&typeof p.as=="string"){var g=p.as,v=u(g,p.crossOrigin),y=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;g==="style"?r.d.S(d,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:y,fetchPriority:S}):g==="script"&&r.d.X(d,{crossOrigin:v,integrity:y,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},e.preinitModule=function(d,p){if(typeof d=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var g=u(p.as,p.crossOrigin);r.d.M(d,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p??r.d.M(d)},e.preload=function(d,p){if(typeof d=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var g=p.as,v=u(g,p.crossOrigin);r.d.L(d,g,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},e.preloadModule=function(d,p){if(typeof d=="string")if(p){var g=u(p.as,p.crossOrigin);r.d.m(d,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else r.d.m(d)},e.requestFormReset=function(d){r.d.r(d)},e.unstable_batchedUpdates=function(d,p){return d(p)},e.useFormState=function(d,p,g){return c.H.useFormState(d,p,g)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version="19.2.5"})),l3=ha(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}n(),t.exports=II()})),OI=ha((e=>{var t=PI(),n=bM(),i=l3();function r(o){var l="https://react.dev/errors/"+o;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)l+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+o+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function a(o){var l=o,h=o;if(o.alternate)for(;l.return;)l=l.return;else{o=l;do l=o,(l.flags&4098)!==0&&(h=l.return),o=l.return;while(o)}return l.tag===3?h:null}function c(o){if(o.tag===13){var l=o.memoizedState;if(l===null&&(o=o.alternate,o!==null&&(l=o.memoizedState)),l!==null)return l.dehydrated}return null}function u(o){if(o.tag===31){var l=o.memoizedState;if(l===null&&(o=o.alternate,o!==null&&(l=o.memoizedState)),l!==null)return l.dehydrated}return null}function d(o){if(a(o)!==o)throw Error(r(188))}function p(o){var l=o.alternate;if(!l){if(l=a(o),l===null)throw Error(r(188));return l!==o?null:o}for(var h=o,m=l;;){var x=h.return;if(x===null)break;var A=x.alternate;if(A===null){if(m=x.return,m!==null){h=m;continue}break}if(x.child===A.child){for(A=x.child;A;){if(A===h)return d(x),o;if(A===m)return d(x),l;A=A.sibling}throw Error(r(188))}if(h.return!==m.return)h=x,m=A;else{for(var D=!1,W=x.child;W;){if(W===h){D=!0,h=x,m=A;break}if(W===m){D=!0,m=x,h=A;break}W=W.sibling}if(!D){for(W=A.child;W;){if(W===h){D=!0,h=A,m=x;break}if(W===m){D=!0,m=A,h=x;break}W=W.sibling}if(!D)throw Error(r(189))}}if(h.alternate!==m)throw Error(r(190))}if(h.tag!==3)throw Error(r(188));return h.stateNode.current===h?o:l}function g(o){var l=o.tag;if(l===5||l===26||l===27||l===6)return o;for(o=o.child;o!==null;){if(l=g(o),l!==null)return l;o=o.sibling}return null}var v=Object.assign,y=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),C=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),z=Symbol.for("react.activity"),te=Symbol.for("react.memo_cache_sentinel"),oe=Symbol.iterator;function ee(o){return o===null||typeof o!="object"?null:(o=oe&&o[oe]||o["@@iterator"],typeof o=="function"?o:null)}var k=Symbol.for("react.client.reference");function X(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===k?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case w:return"Fragment";case T:return"Profiler";case b:return"StrictMode";case O:return"Suspense";case B:return"SuspenseList";case z:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case E:return"Portal";case C:return o.displayName||"Context";case L:return(o._context.displayName||"Context")+".Consumer";case P:var l=o.render;return o=o.displayName,o||(o=l.displayName||l.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case U:return l=o.displayName||null,l!==null?l:X(o.type)||"Memo";case I:l=o._payload,o=o._init;try{return X(o(l))}catch{}}return null}var $=Array.isArray,j=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,xe={pending:!1,data:null,method:null,action:null},de=[],fe=-1;function F(o){return{current:o}}function re(o){0>fe||(o.current=de[fe],de[fe]=null,fe--)}function ue(o,l){fe++,de[fe]=o.current,o.current=l}var _e=F(null),Le=F(null),Fe=F(null),Xe=F(null);function lt(o,l){switch(ue(Fe,l),ue(Le,o),ue(_e,null),l.nodeType){case 9:case 11:o=(o=l.documentElement)&&(o=o.namespaceURI)?_v(o):0;break;default:if(o=l.tagName,l=l.namespaceURI)l=_v(l),o=vv(l,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}re(_e),ue(_e,o)}function mt(){re(_e),re(Le),re(Fe)}function ne(o){o.memoizedState!==null&&ue(Xe,o);var l=_e.current,h=vv(l,o.type);l!==h&&(ue(Le,o),ue(_e,h))}function Be(o){Le.current===o&&(re(_e),re(Le)),Xe.current===o&&(re(Xe),Lh._currentValue=xe)}var Ne,ve;function ye(o){if(Ne===void 0)try{throw Error()}catch(h){var l=h.stack.trim().match(/\n( *(at )?)/);Ne=l&&l[1]||"",ve=-1<h.stack.indexOf(`
at`)?" (<anonymous>)":-1<h.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Ne+o+ve}var et=!1;function tt(o,l){if(!o||et)return"";et=!0;var h=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(l){var ot=function(){throw Error()};if(Object.defineProperty(ot.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ot,[])}catch(Ye){var ze=Ye}Reflect.construct(o,[],ot)}else{try{ot.call()}catch(Ye){ze=Ye}o.call(ot.prototype)}}else{try{throw Error()}catch(Ye){ze=Ye}(ot=o())&&typeof ot.catch=="function"&&ot.catch(function(){})}}catch(Ye){if(Ye&&ze&&typeof Ye.stack=="string")return[Ye.stack,ze.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var A=m.DetermineComponentFrameRoot(),D=A[0],W=A[1];if(D&&W){var he=D.split(`
`),Oe=W.split(`
`);for(x=m=0;m<he.length&&!he[m].includes("DetermineComponentFrameRoot");)m++;for(;x<Oe.length&&!Oe[x].includes("DetermineComponentFrameRoot");)x++;if(m===he.length||x===Oe.length)for(m=he.length-1,x=Oe.length-1;1<=m&&0<=x&&he[m]!==Oe[x];)x--;for(;1<=m&&0<=x;m--,x--)if(he[m]!==Oe[x]){if(m!==1||x!==1)do if(m--,x--,0>x||he[m]!==Oe[x]){var Je=`
`+he[m].replace(" at new "," at ");return o.displayName&&Je.includes("<anonymous>")&&(Je=Je.replace("<anonymous>",o.displayName)),Je}while(1<=m&&0<=x);break}}}finally{et=!1,Error.prepareStackTrace=h}return(h=o?o.displayName||o.name:"")?ye(h):""}function _t(o,l){switch(o.tag){case 26:case 27:case 5:return ye(o.type);case 16:return ye("Lazy");case 13:return o.child!==l&&l!==null?ye("Suspense Fallback"):ye("Suspense");case 19:return ye("SuspenseList");case 0:case 15:return tt(o.type,!1);case 11:return tt(o.type.render,!1);case 1:return tt(o.type,!0);case 31:return ye("Activity");default:return""}}function St(o){try{var l="",h=null;do l+=_t(o,h),h=o,o=o.return;while(o);return l}catch(m){return`
Error generating stack: `+m.message+`
`+m.stack}}var Mt=Object.prototype.hasOwnProperty,Bt=t.unstable_scheduleCallback,Ft=t.unstable_cancelCallback,ie=t.unstable_shouldYield,Z=t.unstable_requestPaint,Ve=t.unstable_now,ut=t.unstable_getCurrentPriorityLevel,gt=t.unstable_ImmediatePriority,dt=t.unstable_UserBlockingPriority,G=t.unstable_NormalPriority,q=t.unstable_LowPriority,Y=t.unstable_IdlePriority,pe=t.log,Me=t.unstable_setDisableYieldValue,De=null,Ee=null;function je(o){if(typeof pe=="function"&&Me(o),Ee&&typeof Ee.setStrictMode=="function")try{Ee.setStrictMode(De,o)}catch{}}var nt=Math.clz32?Math.clz32:Ze,ft=Math.log,se=Math.LN2;function Ze(o){return o>>>=0,o===0?32:31-(ft(o)/se|0)|0}var Se=256,Ke=262144,le=4194304;function At(o){var l=o&42;if(l!==0)return l;switch(o&-o){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function be(o,l,h){var m=o.pendingLanes;if(m===0)return 0;var x=0,A=o.suspendedLanes,D=o.pingedLanes;o=o.warmLanes;var W=m&134217727;return W!==0?(m=W&~A,m!==0?x=At(m):(D&=W,D!==0?x=At(D):h||(h=W&~o,h!==0&&(x=At(h))))):(W=m&~A,W!==0?x=At(W):D!==0?x=At(D):h||(h=m&~o,h!==0&&(x=At(h)))),x===0?0:l!==0&&l!==x&&(l&A)===0&&(A=x&-x,h=l&-l,A>=h||A===32&&(h&4194048)!==0)?l:x}function Yt(o,l){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&l)===0}function ke(o,l){switch(o){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32: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 l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Nt(){var o=le;return le<<=1,(le&62914560)===0&&(le=4194304),o}function hn(o){for(var l=[],h=0;31>h;h++)l.push(o);return l}function Gn(o,l){o.pendingLanes|=l,l!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function Di(o,l,h,m,x,A){var D=o.pendingLanes;o.pendingLanes=h,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=h,o.entangledLanes&=h,o.errorRecoveryDisabledLanes&=h,o.shellSuspendCounter=0;var W=o.entanglements,he=o.expirationTimes,Oe=o.hiddenUpdates;for(h=D&~h;0<h;){var Je=31-nt(h),ot=1<<Je;W[Je]=0,he[Je]=-1;var ze=Oe[Je];if(ze!==null)for(Oe[Je]=null,Je=0;Je<ze.length;Je++){var Ye=ze[Je];Ye!==null&&(Ye.lane&=-536870913)}h&=~ot}m!==0&&Gi(o,m,0),A!==0&&x===0&&o.tag!==0&&(o.suspendedLanes|=A&~(D&~l))}function Gi(o,l,h){o.pendingLanes|=l,o.suspendedLanes&=~l;var m=31-nt(l);o.entangledLanes|=l,o.entanglements[m]=o.entanglements[m]|1073741824|h&261930}function Ci(o,l){var h=o.entangledLanes|=l;for(o=o.entanglements;h;){var m=31-nt(h),x=1<<m;x&l|o[m]&l&&(o[m]|=l),h&=~x}}function bn(o,l){var h=l&-l;return h=(h&42)!==0?1:mi(h),(h&(o.suspendedLanes|l))!==0?0:h}function mi(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;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:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function Xr(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function Ls(){var o=J.p;return o!==0?o:(o=window.event,o===void 0?32:Nv(o.type))}function Ps(o,l){var h=J.p;try{return J.p=o,l()}finally{J.p=h}}var fr=Math.random().toString(36).slice(2),K="__reactFiber$"+fr,Re="__reactProps$"+fr,$e="__reactContainer$"+fr,Ae="__reactEvents$"+fr,qe="__reactListeners$"+fr,xt="__reactHandles$"+fr,Dt="__reactResources$"+fr,Rt="__reactMarker$"+fr;function Vt(o){delete o[K],delete o[Re],delete o[Ae],delete o[qe],delete o[xt]}function jt(o){var l=o[K];if(l)return l;for(var h=o.parentNode;h;){if(l=h[$e]||h[K]){if(h=l.alternate,l.child!==null||h!==null&&h.child!==null)for(o=wv(o);o!==null;){if(h=o[K])return h;o=wv(o)}return l}o=h,h=o.parentNode}return null}function zt(o){if(o=o[K]||o[$e]){var l=o.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return o}return null}function It(o){var l=o.tag;if(l===5||l===26||l===27||l===6)return o.stateNode;throw Error(r(33))}function yn(o){var l=o[Dt];return l||(l=o[Dt]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Kt(o){o[Rt]=!0}var Ri=new Set,Hi={};function On(o,l){tn(o,l),tn(o+"Capture",l)}function tn(o,l){for(Hi[o]=l,o=0;o<l.length;o++)Ri.add(l[o])}var Lu=RegExp("^[: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]*$"),gi={},Ns={};function Pu(o){return Mt.call(Ns,o)?!0:Mt.call(gi,o)?!1:Lu.test(o)?Ns[o]=!0:(gi[o]=!0,!1)}function Is(o,l,h){if(Pu(l))if(h===null)o.removeAttribute(l);else{switch(typeof h){case"undefined":case"function":case"symbol":o.removeAttribute(l);return;case"boolean":var m=l.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){o.removeAttribute(l);return}}o.setAttribute(l,""+h)}}function no(o,l,h){if(h===null)o.removeAttribute(l);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(l);return}o.setAttribute(l,""+h)}}function Xn(o,l,h,m){if(m===null)o.removeAttribute(h);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(h);return}o.setAttributeNS(l,h,""+m)}}function _i(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Eo(o){var l=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function ir(o,l,h){var m=Object.getOwnPropertyDescriptor(o.constructor.prototype,l);if(!o.hasOwnProperty(l)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var x=m.get,A=m.set;return Object.defineProperty(o,l,{configurable:!0,get:function(){return x.call(this)},set:function(D){h=""+D,A.call(this,D)}}),Object.defineProperty(o,l,{enumerable:m.enumerable}),{getValue:function(){return h},setValue:function(D){h=""+D},stopTracking:function(){o._valueTracker=null,delete o[l]}}}}function el(o){if(!o._valueTracker){var l=Eo(o)?"checked":"value";o._valueTracker=ir(o,l,""+o[l])}}function Nu(o){if(!o)return!1;var l=o._valueTracker;if(!l)return!0;var h=l.getValue(),m="";return o&&(m=Eo(o)?o.checked?"true":"false":o.value),o=m,o!==h?(l.setValue(o),!0):!1}function _a(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var dm=/[\n"\\]/g;function hs(o){return o.replace(dm,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function Rf(o,l,h,m,x,A,D,W){o.name="",D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?o.type=D:o.removeAttribute("type"),l!=null?D==="number"?(l===0&&o.value===""||o.value!=l)&&(o.value=""+_i(l)):o.value!==""+_i(l)&&(o.value=""+_i(l)):D!=="submit"&&D!=="reset"||o.removeAttribute("value"),l!=null?Iu(o,D,_i(l)):h!=null?Iu(o,D,_i(h)):m!=null&&o.removeAttribute("value"),x==null&&A!=null&&(o.defaultChecked=!!A),x!=null&&(o.checked=x&&typeof x!="function"&&typeof x!="symbol"),W!=null&&typeof W!="function"&&typeof W!="symbol"&&typeof W!="boolean"?o.name=""+_i(W):o.removeAttribute("name")}function Lf(o,l,h,m,x,A,D,W){if(A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(o.type=A),l!=null||h!=null){if(!(A!=="submit"&&A!=="reset"||l!=null)){el(o);return}h=h!=null?""+_i(h):"",l=l!=null?""+_i(l):h,W||l===o.value||(o.value=l),o.defaultValue=l}m=m??x,m=typeof m!="function"&&typeof m!="symbol"&&!!m,o.checked=W?o.checked:!!m,o.defaultChecked=!!m,D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(o.name=D),el(o)}function Iu(o,l,h){l==="number"&&_a(o.ownerDocument)===o||o.defaultValue===""+h||(o.defaultValue=""+h)}function Os(o,l,h,m){if(o=o.options,l){l={};for(var x=0;x<h.length;x++)l["$"+h[x]]=!0;for(h=0;h<o.length;h++)x=l.hasOwnProperty("$"+o[h].value),o[h].selected!==x&&(o[h].selected=x),x&&m&&(o[h].defaultSelected=!0)}else{for(h=""+_i(h),l=null,x=0;x<o.length;x++){if(o[x].value===h){o[x].selected=!0,m&&(o[x].defaultSelected=!0);return}l!==null||o[x].disabled||(l=o[x])}l!==null&&(l.selected=!0)}}function pm(o,l,h){if(l!=null&&(l=""+_i(l),l!==o.value&&(o.value=l),h==null)){o.defaultValue!==l&&(o.defaultValue=l);return}o.defaultValue=h!=null?""+_i(h):""}function mm(o,l,h,m){if(l==null){if(m!=null){if(h!=null)throw Error(r(92));if($(m)){if(1<m.length)throw Error(r(93));m=m[0]}h=m}h??="",l=h}h=_i(l),o.defaultValue=h,m=o.textContent,m===h&&m!==""&&m!==null&&(o.value=m),el(o)}function rc(o,l){if(l){var h=o.firstChild;if(h&&h===o.lastChild&&h.nodeType===3){h.nodeValue=l;return}}o.textContent=l}var U0=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function gm(o,l,h){var m=l.indexOf("--")===0;h==null||typeof h=="boolean"||h===""?m?o.setProperty(l,""):l==="float"?o.cssFloat="":o[l]="":m?o.setProperty(l,h):typeof h!="number"||h===0||U0.has(l)?l==="float"?o.cssFloat=h:o[l]=(""+h).trim():o[l]=h+"px"}function _m(o,l,h){if(l!=null&&typeof l!="object")throw Error(r(62));if(o=o.style,h!=null){for(var m in h)!h.hasOwnProperty(m)||l!=null&&l.hasOwnProperty(m)||(m.indexOf("--")===0?o.setProperty(m,""):m==="float"?o.cssFloat="":o[m]="");for(var x in l)m=l[x],l.hasOwnProperty(x)&&h[x]!==m&&gm(o,x,m)}else for(var A in l)l.hasOwnProperty(A)&&gm(o,A,l[A])}function Pf(o){if(o.indexOf("-")===-1)return!1;switch(o){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 wS=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),AS=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Nf(o){return AS.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function io(){}var vm=null;function ym(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var sc=null,oc=null;function If(o){var l=zt(o);if(l&&(o=l.stateNode)){var h=o[Re]||null;e:switch(o=l.stateNode,l.type){case"input":if(Rf(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name),l=h.name,h.type==="radio"&&l!=null){for(h=o;h.parentNode;)h=h.parentNode;for(h=h.querySelectorAll('input[name="'+hs(""+l)+'"][type="radio"]'),l=0;l<h.length;l++){var m=h[l];if(m!==o&&m.form===o.form){var x=m[Re]||null;if(!x)throw Error(r(90));Rf(m,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(l=0;l<h.length;l++)m=h[l],m.form===o.form&&Nu(m)}break e;case"textarea":pm(o,h.value,h.defaultValue);break e;case"select":l=h.value,l!=null&&Os(o,!!h.multiple,l,!1)}}}var xm=!1;function B0(o,l,h){if(xm)return o(l,h);xm=!0;try{return o(l)}finally{if(xm=!1,(sc!==null||oc!==null)&&(Rd(),sc&&(l=sc,o=oc,oc=sc=null,If(l),o)))for(l=0;l<o.length;l++)If(o[l])}}function Ou(o,l){var h=o.stateNode;if(h===null)return null;var m=h[Re]||null;if(m===null)return null;h=m[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(o=o.type,m=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!m;break e;default:o=!1}if(o)return null;if(h&&typeof h!="function")throw Error(r(231,l,typeof h));return h}var To=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Sm=!1;if(To)try{var Pn={};Object.defineProperty(Pn,"passive",{get:function(){Sm=!0}}),window.addEventListener("test",Pn,Pn),window.removeEventListener("test",Pn,Pn)}catch{Sm=!1}var xn=null,bm=null,Of=null;function V0(){if(Of)return Of;var o,l=bm,h=l.length,m,x="value"in xn?xn.value:xn.textContent,A=x.length;for(o=0;o<h&&l[o]===x[o];o++);var D=h-o;for(m=1;m<=D&&l[h-m]===x[A-m];m++);return Of=x.slice(o,1<m?1-m:void 0)}function Df(o){var l=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&l===13&&(o=13)):o=l,o===10&&(o=13),32<=o||o===13?o:0}function zf(){return!0}function F0(){return!1}function dr(o){function l(h,m,x,A,D){this._reactName=h,this._targetInst=x,this.type=m,this.nativeEvent=A,this.target=D,this.currentTarget=null;for(var W in o)o.hasOwnProperty(W)&&(h=o[W],this[W]=h?h(A):A[W]);return this.isDefaultPrevented=(A.defaultPrevented!=null?A.defaultPrevented:A.returnValue===!1)?zf:F0,this.isPropagationStopped=F0,this}return v(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var h=this.nativeEvent;h&&(h.preventDefault?h.preventDefault():typeof h.returnValue!="unknown"&&(h.returnValue=!1),this.isDefaultPrevented=zf)},stopPropagation:function(){var h=this.nativeEvent;h&&(h.stopPropagation?h.stopPropagation():typeof h.cancelBubble!="unknown"&&(h.cancelBubble=!0),this.isPropagationStopped=zf)},persist:function(){},isPersistent:zf}),l}var tl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vi=dr(tl),nl=v({},tl,{view:0,detail:0}),il=dr(nl),Uf,Du,rr,zu=v({},nl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ro,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==rr&&(rr&&o.type==="mousemove"?(Uf=o.screenX-rr.screenX,Du=o.screenY-rr.screenY):Du=Uf=0,rr=o),Uf)},movementY:function(o){return"movementY"in o?o.movementY:Du}}),Mm=dr(zu),k0=dr(v({},zu,{dataTransfer:0})),Bf=dr(v({},nl,{relatedTarget:0})),G0=dr(v({},tl,{animationName:0,elapsedTime:0,pseudoElement:0})),H0=dr(v({},tl,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}})),Rr=dr(v({},tl,{data:0})),ES={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},jr={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"},TS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function W0(o){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(o):(o=TS[o])?!!l[o]:!1}function ro(){return W0}var Vf=dr(v({},nl,{key:function(o){if(o.key){var l=ES[o.key]||o.key;if(l!=="Unidentified")return l}return o.type==="keypress"?(o=Df(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?jr[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ro,charCode:function(o){return o.type==="keypress"?Df(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Df(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}})),Ff=dr(v({},zu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Qn=dr(v({},nl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ro})),va=dr(v({},tl,{propertyName:0,elapsedTime:0,pseudoElement:0})),wm=dr(v({},zu,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0})),CS=dr(v({},tl,{newState:0,oldState:0})),Am=[9,13,27,32],Em=To&&"CompositionEvent"in window,Uu=null;To&&"documentMode"in document&&(Uu=document.documentMode);var RS=To&&"TextEvent"in window&&!Uu,Tm=To&&(!Em||Uu&&8<Uu&&11>=Uu),Bu=" ",rl=!1;function X0(o,l){switch(o){case"keyup":return Am.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cm(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var sl=!1;function Rm(o,l){switch(o){case"compositionend":return Cm(l);case"keypress":return l.which!==32?null:(rl=!0,Bu);case"textInput":return o=l.data,o===Bu&&rl?null:o;default:return null}}function Lm(o,l){if(sl)return o==="compositionend"||!Em&&X0(o,l)?(o=V0(),Of=bm=xn=null,sl=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return Tm&&l.locale!=="ko"?null:l.data;default:return null}}var j0={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 Y0(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l==="input"?!!j0[o.type]:l==="textarea"}function kf(o,l,h,m){sc?oc?oc.push(m):oc=[m]:sc=m,l=Vs(l,"onChange"),0<l.length&&(h=new vi("onChange","change",null,h,m),o.push({event:h,listeners:l}))}var ol=null,Vu=null;function q0(o){dv(o,0)}function sr(o){if(Nu(It(o)))return o}function Gf(o,l){if(o==="change")return l}var ac=!1;if(To){var Hf;if(To){var Wf="oninput"in document;if(!Wf){var $0=document.createElement("div");$0.setAttribute("oninput","return;"),Wf=typeof $0.oninput=="function"}Hf=Wf}else Hf=!1;ac=Hf&&(!document.documentMode||9<document.documentMode)}function Z0(){ol&&(ol.detachEvent("onpropertychange",K0),Vu=ol=null)}function K0(o){if(o.propertyName==="value"&&sr(Vu)){var l=[];kf(l,Vu,o,ym(o)),B0(q0,l)}}function LS(o,l,h){o==="focusin"?(Z0(),ol=l,Vu=h,ol.attachEvent("onpropertychange",K0)):o==="focusout"&&Z0()}function PS(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return sr(Vu)}function lc(o,l){if(o==="click")return sr(l)}function NS(o,l){if(o==="input"||o==="change")return sr(l)}function IS(o,l){return o===l&&(o!==0||1/o===1/l)||o!==o&&l!==l}var pr=typeof Object.is=="function"?Object.is:IS;function cc(o,l){if(pr(o,l))return!0;if(typeof o!="object"||o===null||typeof l!="object"||l===null)return!1;var h=Object.keys(o),m=Object.keys(l);if(h.length!==m.length)return!1;for(m=0;m<h.length;m++){var x=h[m];if(!Mt.call(l,x)||!pr(o[x],l[x]))return!1}return!0}function Co(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function Fu(o,l){var h=Co(o);o=0;for(var m;h;){if(h.nodeType===3){if(m=o+h.textContent.length,o<=l&&m>=l)return{node:h,offset:l-o};o=m}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=Co(h)}}function Q0(o,l){return o&&l?o===l?!0:o&&o.nodeType===3?!1:l&&l.nodeType===3?Q0(o,l.parentNode):"contains"in o?o.contains(l):o.compareDocumentPosition?!!(o.compareDocumentPosition(l)&16):!1:!1}function J0(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var l=_a(o.document);l instanceof o.HTMLIFrameElement;){try{var h=typeof l.contentWindow.location.href=="string"}catch{h=!1}if(h)o=l.contentWindow;else break;l=_a(o.document)}return l}function Pm(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l&&(l==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||l==="textarea"||o.contentEditable==="true")}var uc=To&&"documentMode"in document&&11>=document.documentMode,or=null,Xf=null,ku=null,Nm=!1;function e_(o,l,h){var m=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Nm||or==null||or!==_a(m)||(m=or,"selectionStart"in m&&Pm(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),ku&&cc(ku,m)||(ku=m,m=Vs(Xf,"onSelect"),0<m.length&&(l=new vi("onSelect","select",null,l,h),o.push({event:l,listeners:m}),l.target=or)))}function al(o,l){var h={};return h[o.toLowerCase()]=l.toLowerCase(),h["Webkit"+o]="webkit"+l,h["Moz"+o]="moz"+l,h}var Yr={animationend:al("Animation","AnimationEnd"),animationiteration:al("Animation","AnimationIteration"),animationstart:al("Animation","AnimationStart"),transitionrun:al("Transition","TransitionRun"),transitionstart:al("Transition","TransitionStart"),transitioncancel:al("Transition","TransitionCancel"),transitionend:al("Transition","TransitionEnd")},we={},Qe={};To&&(Qe=document.createElement("div").style,"AnimationEvent"in window||(delete Yr.animationend.animation,delete Yr.animationiteration.animation,delete Yr.animationstart.animation),"TransitionEvent"in window||delete Yr.transitionend.transition);function He(o){if(we[o])return we[o];if(!Yr[o])return o;var l=Yr[o],h;for(h in l)if(l.hasOwnProperty(h)&&h in Qe)return we[o]=l[h];return o}var wt=He("animationend"),qt=He("animationiteration"),Mn=He("animationstart"),Li=He("transitionrun"),Un=He("transitionstart"),Im=He("transitioncancel"),t_=He("transitionend"),qr=new Map,hc="abort auxClick beforeToggle 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(" ");hc.push("scrollEnd");function Ds(o,l){qr.set(o,l),On(l,[o])}var Ro=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},mr=[],Lo=0,wn=0;function jf(){for(var o=Lo,l=wn=Lo=0;l<o;){var h=mr[l];mr[l++]=null;var m=mr[l];mr[l++]=null;var x=mr[l];mr[l++]=null;var A=mr[l];if(mr[l++]=null,m!==null&&x!==null){var D=m.pending;D===null?x.next=x:(x.next=D.next,D.next=x),m.pending=x}A!==0&&n_(h,x,A)}}function Gu(o,l,h,m){mr[Lo++]=o,mr[Lo++]=l,mr[Lo++]=h,mr[Lo++]=m,wn|=m,o.lanes|=m,o=o.alternate,o!==null&&(o.lanes|=m)}function fc(o,l,h,m){return Gu(o,l,h,m),Yf(o)}function ll(o,l){return Gu(o,null,null,l),Yf(o)}function n_(o,l,h){o.lanes|=h;var m=o.alternate;m!==null&&(m.lanes|=h);for(var x=!1,A=o.return;A!==null;)A.childLanes|=h,m=A.alternate,m!==null&&(m.childLanes|=h),A.tag===22&&(o=A.stateNode,o===null||o._visibility&1||(x=!0)),o=A,A=A.return;return o.tag===3?(A=o.stateNode,x&&l!==null&&(x=31-nt(h),o=A.hiddenUpdates,m=o[x],m===null?o[x]=[l]:m.push(l),l.lane=h|536870912),A):null}function Yf(o){if(50<bh)throw bh=0,Dg=null,Error(r(185));for(var l=o.return;l!==null;)o=l,l=o.return;return o.tag===3?o.stateNode:null}var Po={};function ya(o,l,h,m){this.tag=o,this.key=h,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ar(o,l,h,m){return new ya(o,l,h,m)}function qf(o){return o=o.prototype,!(!o||!o.isReactComponent)}function fs(o,l){var h=o.alternate;return h===null?(h=ar(o.tag,l,o.key,o.mode),h.elementType=o.elementType,h.type=o.type,h.stateNode=o.stateNode,h.alternate=o,o.alternate=h):(h.pendingProps=l,h.type=o.type,h.flags=0,h.subtreeFlags=0,h.deletions=null),h.flags=o.flags&65011712,h.childLanes=o.childLanes,h.lanes=o.lanes,h.child=o.child,h.memoizedProps=o.memoizedProps,h.memoizedState=o.memoizedState,h.updateQueue=o.updateQueue,l=o.dependencies,h.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},h.sibling=o.sibling,h.index=o.index,h.ref=o.ref,h.refCleanup=o.refCleanup,h}function Om(o,l){o.flags&=65011714;var h=o.alternate;return h===null?(o.childLanes=0,o.lanes=l,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=h.childLanes,o.lanes=h.lanes,o.child=h.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=h.memoizedProps,o.memoizedState=h.memoizedState,o.updateQueue=h.updateQueue,o.type=h.type,l=h.dependencies,o.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),o}function Hu(o,l,h,m,x,A){var D=0;if(m=o,typeof o=="function")qf(o)&&(D=1);else if(typeof o=="string")D=fb(o,h,_e.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case z:return o=ar(31,h,l,x),o.elementType=z,o.lanes=A,o;case w:return so(h.children,x,A,l);case b:D=8,x|=24;break;case T:return o=ar(12,h,l,x|2),o.elementType=T,o.lanes=A,o;case O:return o=ar(13,h,l,x),o.elementType=O,o.lanes=A,o;case B:return o=ar(19,h,l,x),o.elementType=B,o.lanes=A,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case C:D=10;break e;case L:D=9;break e;case P:D=11;break e;case U:D=14;break e;case I:D=16,m=null;break e}D=29,h=Error(r(130,o===null?"null":typeof o,"")),m=null}return l=ar(D,h,l,x),l.elementType=o,l.type=m,l.lanes=A,l}function so(o,l,h,m){return o=ar(7,o,m,l),o.lanes=h,o}function $f(o,l,h){return o=ar(6,o,null,l),o.lanes=h,o}function dc(o){var l=ar(18,null,null,0);return l.stateNode=o,l}function No(o,l,h){return l=ar(4,o.children!==null?o.children:[],o.key,l),l.lanes=h,l.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},l}var Wu=new WeakMap;function ds(o,l){if(typeof o=="object"&&o!==null){var h=Wu.get(o);return h!==void 0?h:(l={value:o,source:l,stack:St(l)},Wu.set(o,l),l)}return{value:o,source:l,stack:St(l)}}var pc=[],mc=0,cl=null,xa=0,Lr=[],ps=0,Io=null,oo=1,ao="";function Bn(o,l){pc[mc++]=xa,pc[mc++]=cl,cl=o,xa=l}function Wi(o,l,h){Lr[ps++]=oo,Lr[ps++]=ao,Lr[ps++]=Io,Io=o;var m=oo;o=ao;var x=32-nt(m)-1;m&=~(1<<x),h+=1;var A=32-nt(l)+x;if(30<A){var D=x-x%5;A=(m&(1<<D)-1).toString(32),m>>=D,x-=D,oo=1<<32-nt(l)+x|h<<x|m,ao=A+o}else oo=1<<A|h<<x|m,ao=o}function Dm(o){o.return!==null&&(Bn(o,1),Wi(o,1,0))}function zm(o){for(;o===cl;)cl=pc[--mc],pc[mc]=null,xa=pc[--mc],pc[mc]=null;for(;o===Io;)Io=Lr[--ps],Lr[ps]=null,ao=Lr[--ps],Lr[ps]=null,oo=Lr[--ps],Lr[ps]=null}function Um(o,l){Lr[ps++]=oo,Lr[ps++]=ao,Lr[ps++]=Io,oo=l.id,ao=l.overflow,Io=o}var Xi=null,Vn=null,on=!1,lo=null,ji=!1,ul=Error(r(519));function ms(o){throw ju(ds(Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML","")),o)),ul}function Xu(o){var l=o.stateNode,h=o.type,m=o.memoizedProps;switch(l[K]=o,l[Re]=m,h){case"dialog":dn("cancel",l),dn("close",l);break;case"iframe":case"object":case"embed":dn("load",l);break;case"video":case"audio":for(h=0;h<wh.length;h++)dn(wh[h],l);break;case"source":dn("error",l);break;case"img":case"image":case"link":dn("error",l),dn("load",l);break;case"details":dn("toggle",l);break;case"input":dn("invalid",l),Lf(l,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":dn("invalid",l);break;case"textarea":dn("invalid",l),mm(l,m.value,m.defaultValue,m.children)}h=m.children,typeof h!="string"&&typeof h!="number"&&typeof h!="bigint"||l.textContent===""+h||m.suppressHydrationWarning===!0||zd(l.textContent,h)?(m.popover!=null&&(dn("beforetoggle",l),dn("toggle",l)),m.onScroll!=null&&dn("scroll",l),m.onScrollEnd!=null&&dn("scrollend",l),m.onClick!=null&&(l.onclick=io),l=!0):l=!1,l||ms(o,!0)}function hl(o){for(Xi=o.return;Xi;)switch(Xi.tag){case 5:case 31:case 13:ji=!1;return;case 27:case 3:ji=!0;return;default:Xi=Xi.return}}function gc(o){if(o!==Xi)return!1;if(!on)return hl(o),on=!0,!1;var l=o.tag,h;if((h=l!==3&&l!==27)&&((h=l===5)&&(h=o.type,h=!(h!=="form"&&h!=="button")||Yg(o.type,o.memoizedProps)),h=!h),h&&Vn&&ms(o),hl(o),l===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Vn=Kg(o)}else if(l===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Vn=Kg(o)}else l===27?(l=Vn,Ai(o.type)?(o=Vr,Vr=null,Vn=o):Vn=l):Vn=Xi?es(o.stateNode.nextSibling):null;return!0}function fl(){Vn=Xi=null,on=!1}function Bm(){var o=lo;return o!==null&&(yr===null?yr=o:yr.push.apply(yr,o),lo=null),o}function ju(o){lo===null?lo=[o]:lo.push(o)}var Vm=F(null),co=null,$r=null;function Oo(o,l,h){ue(Vm,l._currentValue),l._currentValue=h}function H(o){o._currentValue=Vm.current,re(Vm)}function Sa(o,l,h){for(;o!==null;){var m=o.alternate;if((o.childLanes&l)!==l?(o.childLanes|=l,m!==null&&(m.childLanes|=l)):m!==null&&(m.childLanes&l)!==l&&(m.childLanes|=l),o===h)break;o=o.return}}function _c(o,l,h,m){var x=o.child;for(x!==null&&(x.return=o);x!==null;){var A=x.dependencies;if(A!==null){var D=x.child;A=A.firstContext;e:for(;A!==null;){var W=A;A=x;for(var he=0;he<l.length;he++)if(W.context===l[he]){A.lanes|=h,W=A.alternate,W!==null&&(W.lanes|=h),Sa(A.return,h,o),m||(D=null);break e}A=W.next}}else if(x.tag===18){if(D=x.return,D===null)throw Error(r(341));D.lanes|=h,A=D.alternate,A!==null&&(A.lanes|=h),Sa(D,h,o),D=null}else D=x.child;if(D!==null)D.return=x;else for(D=x;D!==null;){if(D===o){D=null;break}if(x=D.sibling,x!==null){x.return=D.return,D=x;break}D=D.return}x=D}}function Yi(o,l,h,m){o=null;for(var x=l,A=!1;x!==null;){if(!A){if((x.flags&524288)!==0)A=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var D=x.alternate;if(D===null)throw Error(r(387));if(D=D.memoizedProps,D!==null){var W=x.type;pr(x.pendingProps.value,D.value)||(o!==null?o.push(W):o=[W])}}else if(x===Xe.current){if(D=x.alternate,D===null)throw Error(r(387));D.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(o!==null?o.push(Lh):o=[Lh])}x=x.return}o!==null&&_c(l,o,h,m),l.flags|=262144}function an(o){for(o=o.firstContext;o!==null;){if(!pr(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function dl(o){co=o,$r=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function qi(o){return ba(co,o)}function Zf(o,l){return co===null&&dl(o),ba(o,l)}function ba(o,l){var h=l._currentValue;if(l={context:l,memoizedValue:h,next:null},$r===null){if(o===null)throw Error(r(308));$r=l,o.dependencies={lanes:0,firstContext:l},o.flags|=524288}else $r=$r.next=l;return h}var OS=typeof AbortController<"u"?AbortController:function(){var o=[],l=this.signal={aborted:!1,addEventListener:function(h,m){o.push(m)}};this.abort=function(){l.aborted=!0,o.forEach(function(h){return h()})}},DS=t.unstable_scheduleCallback,zS=t.unstable_NormalPriority,wi={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Fm(){return{controller:new OS,data:new Map,refCount:0}}function Zr(o){o.refCount--,o.refCount===0&&DS(zS,function(){o.controller.abort()})}var Yu=null,km=0,vc=0,yc=null;function US(o,l){if(Yu===null){var h=Yu=[];km=0,vc=Hg(),yc={status:"pending",value:void 0,then:function(m){h.push(m)}}}return km++,l.then(uo,uo),l}function uo(){if(--km===0&&Yu!==null){yc!==null&&(yc.status="fulfilled");var o=Yu;Yu=null,vc=0,yc=null;for(var l=0;l<o.length;l++)(0,o[l])()}}function BS(o,l){var h=[],m={status:"pending",value:null,reason:null,then:function(x){h.push(x)}};return o.then(function(){m.status="fulfilled",m.value=l;for(var x=0;x<h.length;x++)(0,h[x])(l)},function(x){for(m.status="rejected",m.reason=x,x=0;x<h.length;x++)(0,h[x])(void 0)}),m}var i_=j.S;j.S=function(o,l){k_=Ve(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&US(o,l),i_!==null&&i_(o,l)};var pl=F(null);function Gm(){var o=pl.current;return o!==null?o:Fn.pooledCache}function Kf(o,l){l===null?ue(pl,pl.current):ue(pl,l.pool)}function Ma(){var o=Gm();return o===null?null:{parent:wi._currentValue,pool:o}}var xc=Error(r(460)),Hm=Error(r(474)),Pr=Error(r(542)),Qf={then:function(){}};function r_(o){return o=o.status,o==="fulfilled"||o==="rejected"}function s_(o,l,h){switch(h=o[h],h===void 0?o.push(l):h!==l&&(l.then(io,io),l=h),l.status){case"fulfilled":return l.value;case"rejected":throw o=l.reason,Xm(o),o;default:if(typeof l.status=="string")l.then(io,io);else{if(o=Fn,o!==null&&100<o.shellSuspendCounter)throw Error(r(482));o=l,o.status="pending",o.then(function(m){if(l.status==="pending"){var x=l;x.status="fulfilled",x.value=m}},function(m){if(l.status==="pending"){var x=l;x.status="rejected",x.reason=m}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw o=l.reason,Xm(o),o}throw gl=l,xc}}function ml(o){try{var l=o._init;return l(o._payload)}catch(h){throw h!==null&&typeof h=="object"&&typeof h.then=="function"?(gl=h,xc):h}}var gl=null;function Wm(){if(gl===null)throw Error(r(459));var o=gl;return gl=null,o}function Xm(o){if(o===xc||o===Pr)throw Error(r(483))}var Sc=null,qu=0;function bc(o){var l=qu;return qu+=1,Sc===null&&(Sc=[]),s_(Sc,o,l)}function Do(o,l){l=l.props.ref,o.ref=l!==void 0?l:null}function _l(o,l){throw l.$$typeof===y?Error(r(525)):(o=Object.prototype.toString.call(l),Error(r(31,o==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":o)))}function o_(o){function l(Te,ge){if(o){var Ie=Te.deletions;Ie===null?(Te.deletions=[ge],Te.flags|=16):Ie.push(ge)}}function h(Te,ge){if(!o)return null;for(;ge!==null;)l(Te,ge),ge=ge.sibling;return null}function m(Te){for(var ge=new Map;Te!==null;)Te.key!==null?ge.set(Te.key,Te):ge.set(Te.index,Te),Te=Te.sibling;return ge}function x(Te,ge){return Te=fs(Te,ge),Te.index=0,Te.sibling=null,Te}function A(Te,ge,Ie){return Te.index=Ie,o?(Ie=Te.alternate,Ie!==null?(Ie=Ie.index,Ie<ge?(Te.flags|=67108866,ge):Ie):(Te.flags|=67108866,ge)):(Te.flags|=1048576,ge)}function D(Te){return o&&Te.alternate===null&&(Te.flags|=67108866),Te}function W(Te,ge,Ie,it){return ge===null||ge.tag!==6?(ge=$f(Ie,Te.mode,it),ge.return=Te,ge):(ge=x(ge,Ie),ge.return=Te,ge)}function he(Te,ge,Ie,it){var Ut=Ie.type;return Ut===w?Je(Te,ge,Ie.props.children,it,Ie.key):ge!==null&&(ge.elementType===Ut||typeof Ut=="object"&&Ut!==null&&Ut.$$typeof===I&&ml(Ut)===ge.type)?(ge=x(ge,Ie.props),Do(ge,Ie),ge.return=Te,ge):(ge=Hu(Ie.type,Ie.key,Ie.props,null,Te.mode,it),Do(ge,Ie),ge.return=Te,ge)}function Oe(Te,ge,Ie,it){return ge===null||ge.tag!==4||ge.stateNode.containerInfo!==Ie.containerInfo||ge.stateNode.implementation!==Ie.implementation?(ge=No(Ie,Te.mode,it),ge.return=Te,ge):(ge=x(ge,Ie.children||[]),ge.return=Te,ge)}function Je(Te,ge,Ie,it,Ut){return ge===null||ge.tag!==7?(ge=so(Ie,Te.mode,it,Ut),ge.return=Te,ge):(ge=x(ge,Ie),ge.return=Te,ge)}function ot(Te,ge,Ie){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return ge=$f(""+ge,Te.mode,Ie),ge.return=Te,ge;if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case S:return Ie=Hu(ge.type,ge.key,ge.props,null,Te.mode,Ie),Do(Ie,ge),Ie.return=Te,Ie;case E:return ge=No(ge,Te.mode,Ie),ge.return=Te,ge;case I:return ge=ml(ge),ot(Te,ge,Ie)}if($(ge)||ee(ge))return ge=so(ge,Te.mode,Ie,null),ge.return=Te,ge;if(typeof ge.then=="function")return ot(Te,bc(ge),Ie);if(ge.$$typeof===C)return ot(Te,Zf(Te,ge),Ie);_l(Te,ge)}return null}function ze(Te,ge,Ie,it){var Ut=ge!==null?ge.key:null;if(typeof Ie=="string"&&Ie!==""||typeof Ie=="number"||typeof Ie=="bigint")return Ut!==null?null:W(Te,ge,""+Ie,it);if(typeof Ie=="object"&&Ie!==null){switch(Ie.$$typeof){case S:return Ie.key===Ut?he(Te,ge,Ie,it):null;case E:return Ie.key===Ut?Oe(Te,ge,Ie,it):null;case I:return Ie=ml(Ie),ze(Te,ge,Ie,it)}if($(Ie)||ee(Ie))return Ut!==null?null:Je(Te,ge,Ie,it,null);if(typeof Ie.then=="function")return ze(Te,ge,bc(Ie),it);if(Ie.$$typeof===C)return ze(Te,ge,Zf(Te,Ie),it);_l(Te,Ie)}return null}function Ye(Te,ge,Ie,it,Ut){if(typeof it=="string"&&it!==""||typeof it=="number"||typeof it=="bigint")return Te=Te.get(Ie)||null,W(ge,Te,""+it,Ut);if(typeof it=="object"&&it!==null){switch(it.$$typeof){case S:return Te=Te.get(it.key===null?Ie:it.key)||null,he(ge,Te,it,Ut);case E:return Te=Te.get(it.key===null?Ie:it.key)||null,Oe(ge,Te,it,Ut);case I:return it=ml(it),Ye(Te,ge,Ie,it,Ut)}if($(it)||ee(it))return Te=Te.get(Ie)||null,Je(ge,Te,it,Ut,null);if(typeof it.then=="function")return Ye(Te,ge,Ie,bc(it),Ut);if(it.$$typeof===C)return Ye(Te,ge,Ie,Zf(ge,it),Ut);_l(ge,it)}return null}function Ct(Te,ge,Ie,it){for(var Ut=null,An=null,Lt=ge,rn=ge=0,gn=null;Lt!==null&&rn<Ie.length;rn++){Lt.index>rn?(gn=Lt,Lt=null):gn=Lt.sibling;var En=ze(Te,Lt,Ie[rn],it);if(En===null){Lt===null&&(Lt=gn);break}o&&Lt&&En.alternate===null&&l(Te,Lt),ge=A(En,ge,rn),An===null?Ut=En:An.sibling=En,An=En,Lt=gn}if(rn===Ie.length)return h(Te,Lt),on&&Bn(Te,rn),Ut;if(Lt===null){for(;rn<Ie.length;rn++)Lt=ot(Te,Ie[rn],it),Lt!==null&&(ge=A(Lt,ge,rn),An===null?Ut=Lt:An.sibling=Lt,An=Lt);return on&&Bn(Te,rn),Ut}for(Lt=m(Lt);rn<Ie.length;rn++)gn=Ye(Lt,Te,rn,Ie[rn],it),gn!==null&&(o&&gn.alternate!==null&&Lt.delete(gn.key===null?rn:gn.key),ge=A(gn,ge,rn),An===null?Ut=gn:An.sibling=gn,An=gn);return o&&Lt.forEach(function(Va){return l(Te,Va)}),on&&Bn(Te,rn),Ut}function Gt(Te,ge,Ie,it){if(Ie==null)throw Error(r(151));for(var Ut=null,An=null,Lt=ge,rn=ge=0,gn=null,En=Ie.next();Lt!==null&&!En.done;rn++,En=Ie.next()){Lt.index>rn?(gn=Lt,Lt=null):gn=Lt.sibling;var Va=ze(Te,Lt,En.value,it);if(Va===null){Lt===null&&(Lt=gn);break}o&&Lt&&Va.alternate===null&&l(Te,Lt),ge=A(Va,ge,rn),An===null?Ut=Va:An.sibling=Va,An=Va,Lt=gn}if(En.done)return h(Te,Lt),on&&Bn(Te,rn),Ut;if(Lt===null){for(;!En.done;rn++,En=Ie.next())En=ot(Te,En.value,it),En!==null&&(ge=A(En,ge,rn),An===null?Ut=En:An.sibling=En,An=En);return on&&Bn(Te,rn),Ut}for(Lt=m(Lt);!En.done;rn++,En=Ie.next())En=Ye(Lt,Te,rn,En.value,it),En!==null&&(o&&En.alternate!==null&&Lt.delete(En.key===null?rn:En.key),ge=A(En,ge,rn),An===null?Ut=En:An.sibling=En,An=En);return o&&Lt.forEach(function(wb){return l(Te,wb)}),on&&Bn(Te,rn),Ut}function In(Te,ge,Ie,it){if(typeof Ie=="object"&&Ie!==null&&Ie.type===w&&Ie.key===null&&(Ie=Ie.props.children),typeof Ie=="object"&&Ie!==null){switch(Ie.$$typeof){case S:e:{for(var Ut=Ie.key;ge!==null;){if(ge.key===Ut){if(Ut=Ie.type,Ut===w){if(ge.tag===7){h(Te,ge.sibling),it=x(ge,Ie.props.children),it.return=Te,Te=it;break e}}else if(ge.elementType===Ut||typeof Ut=="object"&&Ut!==null&&Ut.$$typeof===I&&ml(Ut)===ge.type){h(Te,ge.sibling),it=x(ge,Ie.props),Do(it,Ie),it.return=Te,Te=it;break e}h(Te,ge);break}else l(Te,ge);ge=ge.sibling}Ie.type===w?(it=so(Ie.props.children,Te.mode,it,Ie.key),it.return=Te,Te=it):(it=Hu(Ie.type,Ie.key,Ie.props,null,Te.mode,it),Do(it,Ie),it.return=Te,Te=it)}return D(Te);case E:e:{for(Ut=Ie.key;ge!==null;){if(ge.key===Ut)if(ge.tag===4&&ge.stateNode.containerInfo===Ie.containerInfo&&ge.stateNode.implementation===Ie.implementation){h(Te,ge.sibling),it=x(ge,Ie.children||[]),it.return=Te,Te=it;break e}else{h(Te,ge);break}else l(Te,ge);ge=ge.sibling}it=No(Ie,Te.mode,it),it.return=Te,Te=it}return D(Te);case I:return Ie=ml(Ie),In(Te,ge,Ie,it)}if($(Ie))return Ct(Te,ge,Ie,it);if(ee(Ie)){if(Ut=ee(Ie),typeof Ut!="function")throw Error(r(150));return Ie=Ut.call(Ie),Gt(Te,ge,Ie,it)}if(typeof Ie.then=="function")return In(Te,ge,bc(Ie),it);if(Ie.$$typeof===C)return In(Te,ge,Zf(Te,Ie),it);_l(Te,Ie)}return typeof Ie=="string"&&Ie!==""||typeof Ie=="number"||typeof Ie=="bigint"?(Ie=""+Ie,ge!==null&&ge.tag===6?(h(Te,ge.sibling),it=x(ge,Ie),it.return=Te,Te=it):(h(Te,ge),it=$f(Ie,Te.mode,it),it.return=Te,Te=it),D(Te)):h(Te,ge)}return function(Te,ge,Ie,it){try{qu=0;var Ut=In(Te,ge,Ie,it);return Sc=null,Ut}catch(Lt){if(Lt===xc||Lt===Pr)throw Lt;var An=ar(29,Lt,null,Te.mode);return An.lanes=it,An.return=Te,An}}}var wa=o_(!0),a_=o_(!1),$i=!1;function $u(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function zo(o,l){o=o.updateQueue,l.updateQueue===o&&(l.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function zi(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function vl(o,l,h){var m=o.updateQueue;if(m===null)return null;if(m=m.shared,(Tn&2)!==0){var x=m.pending;return x===null?l.next=l:(l.next=x.next,x.next=l),m.pending=l,l=Yf(o),n_(o,null,h),l}return Gu(o,m,l,h),Yf(o)}function Mc(o,l,h){if(l=l.updateQueue,l!==null&&(l=l.shared,(h&4194048)!==0)){var m=l.lanes;m&=o.pendingLanes,h|=m,l.lanes=h,Ci(o,h)}}function Jf(o,l){var h=o.updateQueue,m=o.alternate;if(m!==null&&(m=m.updateQueue,h===m)){var x=null,A=null;if(h=h.firstBaseUpdate,h!==null){do{var D={lane:h.lane,tag:h.tag,payload:h.payload,callback:null,next:null};A===null?x=A=D:A=A.next=D,h=h.next}while(h!==null);A===null?x=A=l:A=A.next=l}else x=A=l;h={baseState:m.baseState,firstBaseUpdate:x,lastBaseUpdate:A,shared:m.shared,callbacks:m.callbacks},o.updateQueue=h;return}o=h.lastBaseUpdate,o===null?h.firstBaseUpdate=l:o.next=l,h.lastBaseUpdate=l}var yl=!1;function gs(){if(yl){var o=yc;if(o!==null)throw o}}function wc(o,l,h,m){yl=!1;var x=o.updateQueue;$i=!1;var A=x.firstBaseUpdate,D=x.lastBaseUpdate,W=x.shared.pending;if(W!==null){x.shared.pending=null;var he=W,Oe=he.next;he.next=null,D===null?A=Oe:D.next=Oe,D=he;var Je=o.alternate;Je!==null&&(Je=Je.updateQueue,W=Je.lastBaseUpdate,W!==D&&(W===null?Je.firstBaseUpdate=Oe:W.next=Oe,Je.lastBaseUpdate=he))}if(A!==null){var ot=x.baseState;D=0,Je=Oe=he=null,W=A;do{var ze=W.lane&-536870913,Ye=ze!==W.lane;if(Ye?(mn&ze)===ze:(m&ze)===ze){ze!==0&&ze===vc&&(yl=!0),Je!==null&&(Je=Je.next={lane:0,tag:W.tag,payload:W.payload,callback:null,next:null});e:{var Ct=o,Gt=W;ze=l;var In=h;switch(Gt.tag){case 1:if(Ct=Gt.payload,typeof Ct=="function"){ot=Ct.call(In,ot,ze);break e}ot=Ct;break e;case 3:Ct.flags=Ct.flags&-65537|128;case 0:if(Ct=Gt.payload,ze=typeof Ct=="function"?Ct.call(In,ot,ze):Ct,ze==null)break e;ot=v({},ot,ze);break e;case 2:$i=!0}}ze=W.callback,ze!==null&&(o.flags|=64,Ye&&(o.flags|=8192),Ye=x.callbacks,Ye===null?x.callbacks=[ze]:Ye.push(ze))}else Ye={lane:ze,tag:W.tag,payload:W.payload,callback:W.callback,next:null},Je===null?(Oe=Je=Ye,he=ot):Je=Je.next=Ye,D|=ze;if(W=W.next,W===null){if(W=x.shared.pending,W===null)break;Ye=W,W=Ye.next,Ye.next=null,x.lastBaseUpdate=Ye,x.shared.pending=null}}while(!0);Je===null&&(he=ot),x.baseState=he,x.firstBaseUpdate=Oe,x.lastBaseUpdate=Je,A===null&&(x.shared.lanes=0),Ra|=D,o.lanes=D,o.memoizedState=ot}}function l_(o,l){if(typeof o!="function")throw Error(r(191,o));o.call(l)}function Zu(o,l){var h=o.callbacks;if(h!==null)for(o.callbacks=null,o=0;o<h.length;o++)l_(h[o],l)}var Ac=F(null),Ku=F(0);function Ui(o,l){o=Zo,ue(Ku,o),ue(Ac,l),Zo=o|l.baseLanes}function Qu(){ue(Ku,Zo),ue(Ac,Ac.current)}function ed(){Zo=Ku.current,re(Ac),re(Ku)}var li=F(null),Nr=null;function zs(o){var l=o.alternate;ue(yi,yi.current&1),ue(li,o),Nr===null&&(l===null||Ac.current!==null||l.memoizedState!==null)&&(Nr=o)}function Uo(o){ue(yi,yi.current),ue(li,o),Nr===null&&(Nr=o)}function jm(o){o.tag===22?(ue(yi,yi.current),ue(li,o),Nr===null&&(Nr=o)):ci(o)}function ci(){ue(yi,yi.current),ue(li,li.current)}function gr(o){re(li),Nr===o&&(Nr=null),re(yi)}var yi=F(0);function td(o){for(var l=o;l!==null;){if(l.tag===13){var h=l.memoizedState;if(h!==null&&(h=h.dehydrated,h===null||kd(h)||ks(h)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var Bo=0,Qt=null,Dn=null,Jn=null,Ju=!1,Ec=!1,xl=!1,Aa=0,eh=0,Tc=null,Ym=0;function ii(){throw Error(r(321))}function qm(o,l){if(l===null)return!1;for(var h=0;h<l.length&&h<o.length;h++)if(!pr(o[h],l[h]))return!1;return!0}function $m(o,l,h,m,x,A){return Bo=A,Qt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,j.H=o===null||o.memoizedState===null?mg:ud,xl=!1,A=h(m,x),xl=!1,Ec&&(A=Zm(l,h,m,x)),c_(o),A}function c_(o){j.H=fh;var l=Dn!==null&&Dn.next!==null;if(Bo=0,Jn=Dn=Qt=null,Ju=!1,eh=0,Tc=null,l)throw Error(r(300));o===null||xi||(o=o.dependencies,o!==null&&an(o)&&(xi=!0))}function Zm(o,l,h,m){Qt=o;var x=0;do{if(Ec&&(Tc=null),eh=0,Ec=!1,25<=x)throw Error(r(301));if(x+=1,Jn=Dn=null,o.updateQueue!=null){var A=o.updateQueue;A.lastEffect=null,A.events=null,A.stores=null,A.memoCache!=null&&(A.memoCache.index=0)}j.H=dh,A=l(h,m)}while(Ec);return A}function Km(){var o=j.H,l=o.useState()[0];return l=typeof l.then=="function"?nh(l):l,o=o.useState()[0],(Dn!==null?Dn.memoizedState:null)!==o&&(Qt.flags|=1024),l}function Qm(){var o=Aa!==0;return Aa=0,o}function th(o,l,h){l.updateQueue=o.updateQueue,l.flags&=-2053,o.lanes&=~h}function nd(o){if(Ju){for(o=o.memoizedState;o!==null;){var l=o.queue;l!==null&&(l.pending=null),o=o.next}Ju=!1}Bo=0,Jn=Dn=Qt=null,Ec=!1,eh=Aa=0,Tc=null}function lr(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Jn===null?Qt.memoizedState=Jn=o:Jn=Jn.next=o,Jn}function ui(){if(Dn===null){var o=Qt.alternate;o=o!==null?o.memoizedState:null}else o=Dn.next;var l=Jn===null?Qt.memoizedState:Jn.next;if(l!==null)Jn=l,Dn=o;else{if(o===null)throw Qt.alternate===null?Error(r(467)):Error(r(310));Dn=o,o={memoizedState:Dn.memoizedState,baseState:Dn.baseState,baseQueue:Dn.baseQueue,queue:Dn.queue,next:null},Jn===null?Qt.memoizedState=Jn=o:Jn=Jn.next=o}return Jn}function Sl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function nh(o){var l=eh;return eh+=1,Tc===null&&(Tc=[]),o=s_(Tc,o,l),l=Qt,(Jn===null?l.memoizedState:Jn.next)===null&&(l=l.alternate,j.H=l===null||l.memoizedState===null?mg:ud),o}function ih(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return nh(o);if(o.$$typeof===C)return qi(o)}throw Error(r(438,String(o)))}function id(o){var l=null,h=Qt.updateQueue;if(h!==null&&(l=h.memoCache),l==null){var m=Qt.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(l={data:m.data.map(function(x){return x.slice()}),index:0})))}if(l??={data:[],index:0},h===null&&(h=Sl(),Qt.updateQueue=h),h.memoCache=l,h=l.data[l.index],h===void 0)for(h=l.data[l.index]=Array(o),m=0;m<o;m++)h[m]=te;return l.index++,h}function Vo(o,l){return typeof l=="function"?l(o):l}function rh(o){return Jm(ui(),Dn,o)}function Jm(o,l,h){var m=o.queue;if(m===null)throw Error(r(311));m.lastRenderedReducer=h;var x=o.baseQueue,A=m.pending;if(A!==null){if(x!==null){var D=x.next;x.next=A.next,A.next=D}l.baseQueue=x=A,m.pending=null}if(A=o.baseState,x===null)o.memoizedState=A;else{l=x.next;var W=D=null,he=null,Oe=l,Je=!1;do{var ot=Oe.lane&-536870913;if(ot!==Oe.lane?(mn&ot)===ot:(Bo&ot)===ot){var ze=Oe.revertLane;if(ze===0)he!==null&&(he=he.next={lane:0,revertLane:0,gesture:null,action:Oe.action,hasEagerState:Oe.hasEagerState,eagerState:Oe.eagerState,next:null}),ot===vc&&(Je=!0);else if((Bo&ze)===ze){Oe=Oe.next,ze===vc&&(Je=!0);continue}else ot={lane:0,revertLane:Oe.revertLane,gesture:null,action:Oe.action,hasEagerState:Oe.hasEagerState,eagerState:Oe.eagerState,next:null},he===null?(W=he=ot,D=A):he=he.next=ot,Qt.lanes|=ze,Ra|=ze;ot=Oe.action,xl&&h(A,ot),A=Oe.hasEagerState?Oe.eagerState:h(A,ot)}else ze={lane:ot,revertLane:Oe.revertLane,gesture:Oe.gesture,action:Oe.action,hasEagerState:Oe.hasEagerState,eagerState:Oe.eagerState,next:null},he===null?(W=he=ze,D=A):he=he.next=ze,Qt.lanes|=ot,Ra|=ot;Oe=Oe.next}while(Oe!==null&&Oe!==l);if(he===null?D=A:he.next=W,!pr(A,o.memoizedState)&&(xi=!0,Je&&(h=yc,h!==null)))throw h;o.memoizedState=A,o.baseState=D,o.baseQueue=he,m.lastRenderedState=A}return x===null&&(m.lanes=0),[o.memoizedState,m.dispatch]}function sh(o){var l=ui(),h=l.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=o;var m=h.dispatch,x=h.pending,A=l.memoizedState;if(x!==null){h.pending=null;var D=x=x.next;do A=o(A,D.action),D=D.next;while(D!==x);pr(A,l.memoizedState)||(xi=!0),l.memoizedState=A,l.baseQueue===null&&(l.baseState=A),h.lastRenderedState=A}return[A,m]}function eg(o,l,h){var m=Qt,x=ui(),A=on;if(A){if(h===void 0)throw Error(r(407));h=h()}else h=l();var D=!pr((Dn||x).memoizedState,h);if(D&&(x.memoizedState=h,xi=!0),x=x.queue,ch(sd.bind(null,m,x,o),[o]),x.getSnapshot!==l||D||Jn!==null&&Jn.memoizedState.tag&1){if(m.flags|=2048,bl(9,{destroy:void 0},u_.bind(null,m,x,h,l),null),Fn===null)throw Error(r(349));A||(Bo&127)!==0||rd(m,l,h)}return h}function rd(o,l,h){o.flags|=16384,o={getSnapshot:l,value:h},l=Qt.updateQueue,l===null?(l=Sl(),Qt.updateQueue=l,l.stores=[o]):(h=l.stores,h===null?l.stores=[o]:h.push(o))}function u_(o,l,h,m){l.value=h,l.getSnapshot=m,sn(l)&&h_(o)}function sd(o,l,h){return h(function(){sn(l)&&h_(o)})}function sn(o){var l=o.getSnapshot;o=o.value;try{var h=l();return!pr(o,h)}catch{return!0}}function h_(o){var l=ll(o,2);l!==null&&Br(l,o,2)}function tg(o){var l=lr();if(typeof o=="function"){var h=o;if(o=h(),xl){je(!0);try{h()}finally{je(!1)}}}return l.memoizedState=l.baseState=o,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vo,lastRenderedState:o},l}function Cc(o,l,h,m){return o.baseState=h,Jm(o,Dn,typeof m=="function"?m:Vo)}function f_(o,l,h,m,x){if(hh(o))throw Error(r(485));if(o=l.action,o!==null){var A={payload:x,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(D){A.listeners.push(D)}};j.T!==null?h(!0):A.isTransition=!1,m(A),h=l.pending,h===null?(A.next=l.pending=A,d_(l,A)):(A.next=h.next,l.pending=h.next=A)}}function d_(o,l){var h=l.action,m=l.payload,x=o.state;if(l.isTransition){var A=j.T,D={};j.T=D;try{var W=h(x,m),he=j.S;he!==null&&he(D,W),p_(o,l,W)}catch(Oe){ng(o,l,Oe)}finally{A!==null&&D.types!==null&&(A.types=D.types),j.T=A}}else try{A=h(x,m),p_(o,l,A)}catch(Oe){ng(o,l,Oe)}}function p_(o,l,h){h!==null&&typeof h=="object"&&typeof h.then=="function"?h.then(function(m){Kr(o,l,m)},function(m){return ng(o,l,m)}):Kr(o,l,h)}function Kr(o,l,h){l.status="fulfilled",l.value=h,oh(l),o.state=h,l=o.pending,l!==null&&(h=l.next,h===l?o.pending=null:(h=h.next,l.next=h,d_(o,h)))}function ng(o,l,h){var m=o.pending;if(o.pending=null,m!==null){m=m.next;do l.status="rejected",l.reason=h,oh(l),l=l.next;while(l!==m)}o.action=null}function oh(o){o=o.listeners;for(var l=0;l<o.length;l++)(0,o[l])()}function od(o,l){return l}function ig(o,l){if(on){var h=Fn.formState;if(h!==null){e:{var m=Qt;if(on){if(Vn){t:{for(var x=Vn,A=ji;x.nodeType!==8;){if(!A){x=null;break t}if(x=es(x.nextSibling),x===null){x=null;break t}}A=x.data,x=A==="F!"||A==="F"?x:null}if(x){Vn=es(x.nextSibling),m=x.data==="F!";break e}}ms(m)}m=!1}m&&(l=h[0])}}return h=lr(),h.memoizedState=h.baseState=l,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:od,lastRenderedState:l},h.queue=m,h=dg.bind(null,Qt,m),m.dispatch=h,m=tg(!1),A=pg.bind(null,Qt,!1,m.queue),m=lr(),x={state:l,dispatch:null,action:o,pending:null},m.queue=x,h=f_.bind(null,Qt,x,A,h),x.dispatch=h,m.memoizedState=o,[l,h,!1]}function rg(o){return Ir(ui(),Dn,o)}function Ir(o,l,h){if(l=Jm(o,l,od)[0],o=rh(Vo)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var m=nh(l)}catch(D){throw D===xc?Pr:D}else m=l;l=ui();var x=l.queue,A=x.dispatch;return h!==l.memoizedState&&(Qt.flags|=2048,bl(9,{destroy:void 0},Ea.bind(null,x,h),null)),[m,A,o]}function Ea(o,l){o.action=l}function ad(o){var l=ui(),h=Dn;if(h!==null)return Ir(l,h,o);ui(),l=l.memoizedState,h=ui();var m=h.queue.dispatch;return h.memoizedState=o,[l,m,!1]}function bl(o,l,h,m){return o={tag:o,create:h,deps:m,inst:l,next:null},l=Qt.updateQueue,l===null&&(l=Sl(),Qt.updateQueue=l),h=l.lastEffect,h===null?l.lastEffect=o.next=o:(m=h.next,h.next=o,o.next=m,l.lastEffect=o),o}function ah(){return ui().memoizedState}function lh(o,l,h,m){var x=lr();Qt.flags|=o,x.memoizedState=bl(1|l,{destroy:void 0},h,m===void 0?null:m)}function Rc(o,l,h,m){var x=ui();m=m===void 0?null:m;var A=x.memoizedState.inst;Dn!==null&&m!==null&&qm(m,Dn.memoizedState.deps)?x.memoizedState=bl(l,A,h,m):(Qt.flags|=o,x.memoizedState=bl(1|l,A,h,m))}function sg(o,l){lh(8390656,8,o,l)}function ch(o,l){Rc(2048,8,o,l)}function og(o){Qt.flags|=4;var l=Qt.updateQueue;if(l===null)l=Sl(),Qt.updateQueue=l,l.events=[o];else{var h=l.events;h===null?l.events=[o]:h.push(o)}}function Fo(o){var l=ui().memoizedState;return og({ref:l,nextImpl:o}),function(){if((Tn&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}function m_(o,l){return Rc(4,2,o,l)}function ko(o,l){return Rc(4,4,o,l)}function ag(o,l){if(typeof l=="function"){o=o();var h=l(o);return function(){typeof h=="function"?h():l(null)}}if(l!=null)return o=o(),l.current=o,function(){l.current=null}}function lg(o,l,h){h=h!=null?h.concat([o]):null,Rc(4,4,ag.bind(null,l,o),h)}function uh(){}function g_(o,l){var h=ui();l=l===void 0?null:l;var m=h.memoizedState;return l!==null&&qm(l,m[1])?m[0]:(h.memoizedState=[o,l],o)}function __(o,l){var h=ui();l=l===void 0?null:l;var m=h.memoizedState;if(l!==null&&qm(l,m[1]))return m[0];if(m=o(),xl){je(!0);try{o()}finally{je(!1)}}return h.memoizedState=[m,l],m}function cg(o,l,h){return h===void 0||(Bo&1073741824)!==0&&(mn&261930)===0?o.memoizedState=l:(o.memoizedState=h,o=H_(),Qt.lanes|=o,Ra|=o,h)}function ug(o,l,h,m){return pr(h,l)?h:Ac.current!==null?(o=cg(o,h,m),pr(o,l)||(xi=!0),o):(Bo&42)===0||(Bo&1073741824)!==0&&(mn&261930)===0?(xi=!0,o.memoizedState=h):(o=H_(),Qt.lanes|=o,Ra|=o,l)}function hg(o,l,h,m,x){var A=J.p;J.p=A!==0&&8>A?A:8;var D=j.T,W={};j.T=W,pg(o,!1,l,h);try{var he=x(),Oe=j.S;Oe!==null&&Oe(W,he),he!==null&&typeof he=="object"&&typeof he.then=="function"?Pc(o,l,BS(he,m),vs(o)):Pc(o,l,m,vs(o))}catch(Je){Pc(o,l,{then:function(){},status:"rejected",reason:Je},vs())}finally{J.p=A,D!==null&&W.types!==null&&(D.types=W.types),j.T=D}}function VS(){}function ld(o,l,h,m){if(o.tag!==5)throw Error(r(476));var x=fg(o).queue;hg(o,x,l,xe,h===null?VS:function(){return _r(o),h(m)})}function fg(o){var l=o.memoizedState;if(l!==null)return l;l={memoizedState:xe,baseState:xe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vo,lastRenderedState:xe},next:null};var h={};return l.next={memoizedState:h,baseState:h,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vo,lastRenderedState:h},next:null},o.memoizedState=l,o=o.alternate,o!==null&&(o.memoizedState=l),l}function _r(o){var l=fg(o);l.next===null&&(l=o.alternate.memoizedState),Pc(o,l.next.queue,{},vs())}function _s(){return qi(Lh)}function v_(){return ui().memoizedState}function y_(){return ui().memoizedState}function cd(o){for(var l=o.return;l!==null;){switch(l.tag){case 24:case 3:var h=vs();o=zi(h);var m=vl(l,o,h);m!==null&&(Br(m,l,h),Mc(m,l,h)),l={cache:Fm()},o.payload=l;return}l=l.return}}function Lc(o,l,h){var m=vs();h={lane:m,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},hh(o)?Ml(l,h):(h=fc(o,l,h,m),h!==null&&(Br(h,o,m),Nc(h,l,m)))}function dg(o,l,h){Pc(o,l,h,vs())}function Pc(o,l,h,m){var x={lane:m,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null};if(hh(o))Ml(l,x);else{var A=o.alternate;if(o.lanes===0&&(A===null||A.lanes===0)&&(A=l.lastRenderedReducer,A!==null))try{var D=l.lastRenderedState,W=A(D,h);if(x.hasEagerState=!0,x.eagerState=W,pr(W,D))return Gu(o,l,x,0),Fn===null&&jf(),!1}catch{}if(h=fc(o,l,x,m),h!==null)return Br(h,o,m),Nc(h,l,m),!0}return!1}function pg(o,l,h,m){if(m={lane:2,revertLane:Hg(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},hh(o)){if(l)throw Error(r(479))}else l=fc(o,h,m,2),l!==null&&Br(l,o,2)}function hh(o){var l=o.alternate;return o===Qt||l!==null&&l===Qt}function Ml(o,l){Ec=Ju=!0;var h=o.pending;h===null?l.next=l:(l.next=h.next,h.next=l),o.pending=l}function Nc(o,l,h){if((h&4194048)!==0){var m=l.lanes;m&=o.pendingLanes,h|=m,l.lanes=h,Ci(o,h)}}var fh={readContext:qi,use:ih,useCallback:ii,useContext:ii,useEffect:ii,useImperativeHandle:ii,useLayoutEffect:ii,useInsertionEffect:ii,useMemo:ii,useReducer:ii,useRef:ii,useState:ii,useDebugValue:ii,useDeferredValue:ii,useTransition:ii,useSyncExternalStore:ii,useId:ii,useHostTransitionStatus:ii,useFormState:ii,useActionState:ii,useOptimistic:ii,useMemoCache:ii,useCacheRefresh:ii};fh.useEffectEvent=ii;var mg={readContext:qi,use:ih,useCallback:function(o,l){return lr().memoizedState=[o,l===void 0?null:l],o},useContext:qi,useEffect:sg,useImperativeHandle:function(o,l,h){h=h!=null?h.concat([o]):null,lh(4194308,4,ag.bind(null,l,o),h)},useLayoutEffect:function(o,l){return lh(4194308,4,o,l)},useInsertionEffect:function(o,l){lh(4,2,o,l)},useMemo:function(o,l){var h=lr();l=l===void 0?null:l;var m=o();if(xl){je(!0);try{o()}finally{je(!1)}}return h.memoizedState=[m,l],m},useReducer:function(o,l,h){var m=lr();if(h!==void 0){var x=h(l);if(xl){je(!0);try{h(l)}finally{je(!1)}}}else x=l;return m.memoizedState=m.baseState=x,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:x},m.queue=o,o=o.dispatch=Lc.bind(null,Qt,o),[m.memoizedState,o]},useRef:function(o){var l=lr();return o={current:o},l.memoizedState=o},useState:function(o){o=tg(o);var l=o.queue,h=dg.bind(null,Qt,l);return l.dispatch=h,[o.memoizedState,h]},useDebugValue:uh,useDeferredValue:function(o,l){return cg(lr(),o,l)},useTransition:function(){var o=tg(!1);return o=hg.bind(null,Qt,o.queue,!0,!1),lr().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,l,h){var m=Qt,x=lr();if(on){if(h===void 0)throw Error(r(407));h=h()}else{if(h=l(),Fn===null)throw Error(r(349));(mn&127)!==0||rd(m,l,h)}x.memoizedState=h;var A={value:h,getSnapshot:l};return x.queue=A,sg(sd.bind(null,m,A,o),[o]),m.flags|=2048,bl(9,{destroy:void 0},u_.bind(null,m,A,h,l),null),h},useId:function(){var o=lr(),l=Fn.identifierPrefix;if(on){var h=ao,m=oo;h=(m&~(1<<32-nt(m)-1)).toString(32)+h,l="_"+l+"R_"+h,h=Aa++,0<h&&(l+="H"+h.toString(32)),l+="_"}else h=Ym++,l="_"+l+"r_"+h.toString(32)+"_";return o.memoizedState=l},useHostTransitionStatus:_s,useFormState:ig,useActionState:ig,useOptimistic:function(o){var l=lr();l.memoizedState=l.baseState=o;var h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=h,l=pg.bind(null,Qt,!0,h),h.dispatch=l,[o,l]},useMemoCache:id,useCacheRefresh:function(){return lr().memoizedState=cd.bind(null,Qt)},useEffectEvent:function(o){var l=lr(),h={impl:o};return l.memoizedState=h,function(){if((Tn&2)!==0)throw Error(r(440));return h.impl.apply(void 0,arguments)}}},ud={readContext:qi,use:ih,useCallback:g_,useContext:qi,useEffect:ch,useImperativeHandle:lg,useInsertionEffect:m_,useLayoutEffect:ko,useMemo:__,useReducer:rh,useRef:ah,useState:function(){return rh(Vo)},useDebugValue:uh,useDeferredValue:function(o,l){return ug(ui(),Dn.memoizedState,o,l)},useTransition:function(){var o=rh(Vo)[0],l=ui().memoizedState;return[typeof o=="boolean"?o:nh(o),l]},useSyncExternalStore:eg,useId:v_,useHostTransitionStatus:_s,useFormState:rg,useActionState:rg,useOptimistic:function(o,l){return Cc(ui(),Dn,o,l)},useMemoCache:id,useCacheRefresh:y_};ud.useEffectEvent=Fo;var dh={readContext:qi,use:ih,useCallback:g_,useContext:qi,useEffect:ch,useImperativeHandle:lg,useInsertionEffect:m_,useLayoutEffect:ko,useMemo:__,useReducer:sh,useRef:ah,useState:function(){return sh(Vo)},useDebugValue:uh,useDeferredValue:function(o,l){var h=ui();return Dn===null?cg(h,o,l):ug(h,Dn.memoizedState,o,l)},useTransition:function(){var o=sh(Vo)[0],l=ui().memoizedState;return[typeof o=="boolean"?o:nh(o),l]},useSyncExternalStore:eg,useId:v_,useHostTransitionStatus:_s,useFormState:ad,useActionState:ad,useOptimistic:function(o,l){var h=ui();return Dn!==null?Cc(h,Dn,o,l):(h.baseState=o,[o,h.queue.dispatch])},useMemoCache:id,useCacheRefresh:y_};dh.useEffectEvent=Fo;function hd(o,l,h,m){l=o.memoizedState,h=h(m,l),h=h==null?l:v({},l,h),o.memoizedState=h,o.lanes===0&&(o.updateQueue.baseState=h)}var Ic={enqueueSetState:function(o,l,h){o=o._reactInternals;var m=vs(),x=zi(m);x.payload=l,h!=null&&(x.callback=h),l=vl(o,x,m),l!==null&&(Br(l,o,m),Mc(l,o,m))},enqueueReplaceState:function(o,l,h){o=o._reactInternals;var m=vs(),x=zi(m);x.tag=1,x.payload=l,h!=null&&(x.callback=h),l=vl(o,x,m),l!==null&&(Br(l,o,m),Mc(l,o,m))},enqueueForceUpdate:function(o,l){o=o._reactInternals;var h=vs(),m=zi(h);m.tag=2,l!=null&&(m.callback=l),l=vl(o,m,h),l!==null&&(Br(l,o,h),Mc(l,o,h))}};function fd(o,l,h,m,x,A,D){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(m,A,D):l.prototype&&l.prototype.isPureReactComponent?!cc(h,m)||!cc(x,A):!0}function ph(o,l,h,m){o=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(h,m),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(h,m),l.state!==o&&Ic.enqueueReplaceState(l,l.state,null)}function wl(o,l){var h=l;if("ref"in l){h={};for(var m in l)m!=="ref"&&(h[m]=l[m])}if(o=o.defaultProps){h===l&&(h=v({},h));for(var x in o)h[x]===void 0&&(h[x]=o[x])}return h}function x_(o){Ro(o)}function dd(o){console.error(o)}function S_(o){Ro(o)}function Oc(o,l){try{var h=o.onUncaughtError;h(l.value,{componentStack:l.stack})}catch(m){setTimeout(function(){throw m})}}function b_(o,l,h){try{var m=o.onCaughtError;m(h.value,{componentStack:h.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function pd(o,l,h){return h=zi(h),h.tag=3,h.payload={element:null},h.callback=function(){Oc(o,l)},h}function ho(o){return o=zi(o),o.tag=3,o}function gg(o,l,h,m){var x=h.type.getDerivedStateFromError;if(typeof x=="function"){var A=m.value;o.payload=function(){return x(A)},o.callback=function(){b_(l,h,m)}}var D=h.stateNode;D!==null&&typeof D.componentDidCatch=="function"&&(o.callback=function(){b_(l,h,m),typeof x!="function"&&(La===null?La=new Set([this]):La.add(this));var W=m.stack;this.componentDidCatch(m.value,{componentStack:W!==null?W:""})})}function M_(o,l,h,m,x){if(h.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(l=h.alternate,l!==null&&Yi(l,h,x,!0),h=li.current,h!==null){switch(h.tag){case 31:case 13:return Nr===null?Ld():h.alternate===null&&fi===0&&(fi=3),h.flags&=-257,h.flags|=65536,h.lanes=x,m===Qf?h.flags|=16384:(l=h.updateQueue,l===null?h.updateQueue=new Set([m]):l.add(m),Od(o,m,x)),!1;case 22:return h.flags|=65536,m===Qf?h.flags|=16384:(l=h.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([m])},h.updateQueue=l):(h=l.retryQueue,h===null?l.retryQueue=new Set([m]):h.add(m)),Od(o,m,x)),!1}throw Error(r(435,h.tag))}return Od(o,m,x),Ld(),!1}if(on)return l=li.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=x,m!==ul&&(o=Error(r(422),{cause:m}),ju(ds(o,h)))):(m!==ul&&(l=Error(r(423),{cause:m}),ju(ds(l,h))),o=o.current.alternate,o.flags|=65536,x&=-x,o.lanes|=x,m=ds(m,h),x=pd(o.stateNode,m,x),Jf(o,x),fi!==4&&(fi=2)),!1;var A=Error(r(520),{cause:m});if(A=ds(A,h),Cl===null?Cl=[A]:Cl.push(A),fi!==4&&(fi=2),l===null)return!0;m=ds(m,h),h=l;do{switch(h.tag){case 3:return h.flags|=65536,o=x&-x,h.lanes|=o,o=pd(h.stateNode,m,o),Jf(h,o),!1;case 1:if(l=h.type,A=h.stateNode,(h.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||A!==null&&typeof A.componentDidCatch=="function"&&(La===null||!La.has(A))))return h.flags|=65536,x&=-x,h.lanes|=x,x=ho(x),gg(x,o,h,m),Jf(h,x),!1}h=h.return}while(h!==null);return!1}var _g=Error(r(461)),xi=!1;function Zi(o,l,h,m){l.child=o===null?a_(l,null,h,m):wa(l,o.child,h,m)}function w_(o,l,h,m,x){h=h.render;var A=l.ref;if("ref"in m){var D={};for(var W in m)W!=="ref"&&(D[W]=m[W])}else D=m;return dl(l),m=$m(o,l,h,D,A,x),W=Qm(),o!==null&&!xi?(th(o,l,x),ri(o,l,x)):(on&&W&&Dm(l),l.flags|=1,Zi(o,l,m,x),l.child)}function fo(o,l,h,m,x){if(o===null){var A=h.type;return typeof A=="function"&&!qf(A)&&A.defaultProps===void 0&&h.compare===null?(l.tag=15,l.type=A,md(o,l,A,m,x)):(o=Hu(h.type,null,m,l,l.mode,x),o.ref=l.ref,o.return=l,l.child=o)}if(A=o.child,!_h(o,x)){var D=A.memoizedProps;if(h=h.compare,h=h!==null?h:cc,h(D,m)&&o.ref===l.ref)return ri(o,l,x)}return l.flags|=1,o=fs(A,m),o.ref=l.ref,o.return=l,l.child=o}function md(o,l,h,m,x){if(o!==null){var A=o.memoizedProps;if(cc(A,m)&&o.ref===l.ref)if(xi=!1,l.pendingProps=m=A,_h(o,x))(o.flags&131072)!==0&&(xi=!0);else return l.lanes=o.lanes,ri(o,l,x)}return Ho(o,l,h,m,x)}function gd(o,l,h,m){var x=m.children,A=o!==null?o.memoizedState:null;if(o===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.mode==="hidden"){if((l.flags&128)!==0){if(A=A!==null?A.baseLanes|h:h,o!==null){for(m=l.child=o.child,x=0;m!==null;)x=x|m.lanes|m.childLanes,m=m.sibling;m=x&~A}else m=0,l.child=null;return mh(o,l,A,h,m)}if((h&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},o!==null&&Kf(l,A!==null?A.cachePool:null),A!==null?Ui(l,A):Qu(),jm(l);else return m=l.lanes=536870912,mh(o,l,A!==null?A.baseLanes|h:h,h,m)}else A!==null?(Kf(l,A.cachePool),Ui(l,A),ci(l),l.memoizedState=null):(o!==null&&Kf(l,null),Qu(),ci(l));return Zi(o,l,x,h),l.child}function Al(o,l){return o!==null&&o.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function mh(o,l,h,m,x){var A=Gm();return A=A===null?null:{parent:wi._currentValue,pool:A},l.memoizedState={baseLanes:h,cachePool:A},o!==null&&Kf(l,null),Qu(),jm(l),o!==null&&Yi(o,l,m,!0),l.childLanes=x,null}function Go(o,l){return l=gh({mode:l.mode,children:l.children},o.mode),l.ref=o.ref,o.child=l,l.return=o,l}function kt(o,l,h){return wa(l,o.child,null,h),o=Go(l,l.pendingProps),o.flags|=2,gr(l),l.memoizedState=null,o}function _d(o,l,h){var m=l.pendingProps,x=(l.flags&128)!==0;if(l.flags&=-129,o===null){if(on){if(m.mode==="hidden")return o=Go(l,m),l.lanes=536870912,Al(null,o);if(Uo(l),(o=Vn)?(o=Mv(o,ji),o=o!==null&&o.data==="&"?o:null,o!==null&&(l.memoizedState={dehydrated:o,treeContext:Io!==null?{id:oo,overflow:ao}:null,retryLane:536870912,hydrationErrors:null},h=dc(o),h.return=l,l.child=h,Xi=l,Vn=null)):o=null,o===null)throw ms(l);return l.lanes=536870912,null}return Go(l,m)}var A=o.memoizedState;if(A!==null){var D=A.dehydrated;if(Uo(l),x)if(l.flags&256)l.flags&=-257,l=kt(o,l,h);else if(l.memoizedState!==null)l.child=o.child,l.flags|=128,l=null;else throw Error(r(558));else if(xi||Yi(o,l,h,!1),x=(h&o.childLanes)!==0,xi||x){if(m=Fn,m!==null&&(D=bn(m,h),D!==0&&D!==A.retryLane))throw A.retryLane=D,ll(o,D),Br(m,o,D),_g;Ld(),l=kt(o,l,h)}else o=A.treeContext,Vn=es(D.nextSibling),Xi=l,on=!0,lo=null,ji=!1,o!==null&&Um(l,o),l=Go(l,m),l.flags|=4096;return l}return o=fs(o.child,{mode:m.mode,children:m.children}),o.ref=l.ref,l.child=o,o.return=l,o}function Dc(o,l){var h=l.ref;if(h===null)o!==null&&o.ref!==null&&(l.flags|=4194816);else{if(typeof h!="function"&&typeof h!="object")throw Error(r(284));(o===null||o.ref!==h)&&(l.flags|=4194816)}}function Ho(o,l,h,m,x){return dl(l),h=$m(o,l,h,m,void 0,x),m=Qm(),o!==null&&!xi?(th(o,l,x),ri(o,l,x)):(on&&m&&Dm(l),l.flags|=1,Zi(o,l,h,x),l.child)}function A_(o,l,h,m,x,A){return dl(l),l.updateQueue=null,h=Zm(l,m,h,x),c_(o),m=Qm(),o!==null&&!xi?(th(o,l,A),ri(o,l,A)):(on&&m&&Dm(l),l.flags|=1,Zi(o,l,h,A),l.child)}function vd(o,l,h,m,x){if(dl(l),l.stateNode===null){var A=Po,D=h.contextType;typeof D=="object"&&D!==null&&(A=qi(D)),A=new h(m,A),l.memoizedState=A.state!==null&&A.state!==void 0?A.state:null,A.updater=Ic,l.stateNode=A,A._reactInternals=l,A=l.stateNode,A.props=m,A.state=l.memoizedState,A.refs={},$u(l),D=h.contextType,A.context=typeof D=="object"&&D!==null?qi(D):Po,A.state=l.memoizedState,D=h.getDerivedStateFromProps,typeof D=="function"&&(hd(l,h,D,m),A.state=l.memoizedState),typeof h.getDerivedStateFromProps=="function"||typeof A.getSnapshotBeforeUpdate=="function"||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(D=A.state,typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount(),D!==A.state&&Ic.enqueueReplaceState(A,A.state,null),wc(l,m,A,x),gs(),A.state=l.memoizedState),typeof A.componentDidMount=="function"&&(l.flags|=4194308),m=!0}else if(o===null){A=l.stateNode;var W=l.memoizedProps,he=wl(h,W);A.props=he;var Oe=A.context,Je=h.contextType;D=Po,typeof Je=="object"&&Je!==null&&(D=qi(Je));var ot=h.getDerivedStateFromProps;Je=typeof ot=="function"||typeof A.getSnapshotBeforeUpdate=="function",W=l.pendingProps!==W,Je||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(W||Oe!==D)&&ph(l,A,m,D),$i=!1;var ze=l.memoizedState;A.state=ze,wc(l,m,A,x),gs(),Oe=l.memoizedState,W||ze!==Oe||$i?(typeof ot=="function"&&(hd(l,h,ot,m),Oe=l.memoizedState),(he=$i||fd(l,h,he,m,ze,Oe,D))?(Je||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"&&(l.flags|=4194308)):(typeof A.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=m,l.memoizedState=Oe),A.props=m,A.state=Oe,A.context=D,m=he):(typeof A.componentDidMount=="function"&&(l.flags|=4194308),m=!1)}else{A=l.stateNode,zo(o,l),D=l.memoizedProps,Je=wl(h,D),A.props=Je,ot=l.pendingProps,ze=A.context,Oe=h.contextType,he=Po,typeof Oe=="object"&&Oe!==null&&(he=qi(Oe)),W=h.getDerivedStateFromProps,(Oe=typeof W=="function"||typeof A.getSnapshotBeforeUpdate=="function")||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(D!==ot||ze!==he)&&ph(l,A,m,he),$i=!1,ze=l.memoizedState,A.state=ze,wc(l,m,A,x),gs();var Ye=l.memoizedState;D!==ot||ze!==Ye||$i||o!==null&&o.dependencies!==null&&an(o.dependencies)?(typeof W=="function"&&(hd(l,h,W,m),Ye=l.memoizedState),(Je=$i||fd(l,h,Je,m,ze,Ye,he)||o!==null&&o.dependencies!==null&&an(o.dependencies))?(Oe||typeof A.UNSAFE_componentWillUpdate!="function"&&typeof A.componentWillUpdate!="function"||(typeof A.componentWillUpdate=="function"&&A.componentWillUpdate(m,Ye,he),typeof A.UNSAFE_componentWillUpdate=="function"&&A.UNSAFE_componentWillUpdate(m,Ye,he)),typeof A.componentDidUpdate=="function"&&(l.flags|=4),typeof A.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof A.componentDidUpdate!="function"||D===o.memoizedProps&&ze===o.memoizedState||(l.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||D===o.memoizedProps&&ze===o.memoizedState||(l.flags|=1024),l.memoizedProps=m,l.memoizedState=Ye),A.props=m,A.state=Ye,A.context=he,m=Je):(typeof A.componentDidUpdate!="function"||D===o.memoizedProps&&ze===o.memoizedState||(l.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||D===o.memoizedProps&&ze===o.memoizedState||(l.flags|=1024),m=!1)}return A=m,Dc(o,l),m=(l.flags&128)!==0,A||m?(A=l.stateNode,h=m&&typeof h.getDerivedStateFromError!="function"?null:A.render(),l.flags|=1,o!==null&&m?(l.child=wa(l,o.child,null,x),l.child=wa(l,null,h,x)):Zi(o,l,h,x),l.memoizedState=A.state,o=l.child):o=ri(o,l,x),o}function vg(o,l,h,m){return fl(),l.flags|=256,Zi(o,l,h,m),l.child}var Bi={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function yg(o){return{baseLanes:o,cachePool:Ma()}}function xg(o,l,h){return o=o!==null?o.childLanes&~h:0,l&&(o|=Jr),o}function Sg(o,l,h){var m=l.pendingProps,x=!1,A=(l.flags&128)!==0,D;if((D=A)||(D=o!==null&&o.memoizedState===null?!1:(yi.current&2)!==0),D&&(x=!0,l.flags&=-129),D=(l.flags&32)!==0,l.flags&=-33,o===null){if(on){if(x?zs(l):ci(l),(o=Vn)?(o=Mv(o,ji),o=o!==null&&o.data!=="&"?o:null,o!==null&&(l.memoizedState={dehydrated:o,treeContext:Io!==null?{id:oo,overflow:ao}:null,retryLane:536870912,hydrationErrors:null},h=dc(o),h.return=l,l.child=h,Xi=l,Vn=null)):o=null,o===null)throw ms(l);return ks(o)?l.lanes=32:l.lanes=536870912,null}var W=m.children;return m=m.fallback,x?(ci(l),x=l.mode,W=gh({mode:"hidden",children:W},x),m=so(m,x,h,null),W.return=l,m.return=l,W.sibling=m,l.child=W,m=l.child,m.memoizedState=yg(h),m.childLanes=xg(o,D,h),l.memoizedState=Bi,Al(null,m)):(zs(l),bg(l,W))}var he=o.memoizedState;if(he!==null&&(W=he.dehydrated,W!==null)){if(A)l.flags&256?(zs(l),l.flags&=-257,l=Mg(o,l,h)):l.memoizedState!==null?(ci(l),l.child=o.child,l.flags|=128,l=null):(ci(l),W=m.fallback,x=l.mode,m=gh({mode:"visible",children:m.children},x),W=so(W,x,h,null),W.flags|=2,m.return=l,W.return=l,m.sibling=W,l.child=m,wa(l,o.child,null,h),m=l.child,m.memoizedState=yg(h),m.childLanes=xg(o,D,h),l.memoizedState=Bi,l=Al(null,m));else if(zs(l),ks(W)){if(D=W.nextSibling&&W.nextSibling.dataset,D)var Oe=D.dgst;D=Oe,m=Error(r(419)),m.stack="",m.digest=D,ju({value:m,source:null,stack:null}),l=Mg(o,l,h)}else if(xi||Yi(o,l,h,!1),D=(h&o.childLanes)!==0,xi||D){if(D=Fn,D!==null&&(m=bn(D,h),m!==0&&m!==he.retryLane))throw he.retryLane=m,ll(o,m),Br(D,o,m),_g;kd(W)||Ld(),l=Mg(o,l,h)}else kd(W)?(l.flags|=192,l.child=o.child,l=null):(o=he.treeContext,Vn=es(W.nextSibling),Xi=l,on=!0,lo=null,ji=!1,o!==null&&Um(l,o),l=bg(l,m.children),l.flags|=4096);return l}return x?(ci(l),W=m.fallback,x=l.mode,he=o.child,Oe=he.sibling,m=fs(he,{mode:"hidden",children:m.children}),m.subtreeFlags=he.subtreeFlags&65011712,Oe!==null?W=fs(Oe,W):(W=so(W,x,h,null),W.flags|=2),W.return=l,m.return=l,m.sibling=W,l.child=m,Al(null,m),m=l.child,W=o.child.memoizedState,W===null?W=yg(h):(x=W.cachePool,x!==null?(he=wi._currentValue,x=x.parent!==he?{parent:he,pool:he}:x):x=Ma(),W={baseLanes:W.baseLanes|h,cachePool:x}),m.memoizedState=W,m.childLanes=xg(o,D,h),l.memoizedState=Bi,Al(o.child,m)):(zs(l),h=o.child,o=h.sibling,h=fs(h,{mode:"visible",children:m.children}),h.return=l,h.sibling=null,o!==null&&(D=l.deletions,D===null?(l.deletions=[o],l.flags|=16):D.push(o)),l.child=h,l.memoizedState=null,h)}function bg(o,l){return l=gh({mode:"visible",children:l},o.mode),l.return=o,o.child=l}function gh(o,l){return o=ar(22,o,null,l),o.lanes=0,o}function Mg(o,l,h){return wa(l,o.child,null,h),o=bg(l,l.pendingProps.children),o.flags|=2,l.memoizedState=null,o}function E_(o,l,h){o.lanes|=l;var m=o.alternate;m!==null&&(m.lanes|=l),Sa(o.return,l,h)}function wg(o,l,h,m,x,A){var D=o.memoizedState;D===null?o.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:m,tail:h,tailMode:x,treeForkCount:A}:(D.isBackwards=l,D.rendering=null,D.renderingStartTime=0,D.last=m,D.tail=h,D.tailMode=x,D.treeForkCount=A)}function po(o,l,h){var m=l.pendingProps,x=m.revealOrder,A=m.tail;m=m.children;var D=yi.current,W=(D&2)!==0;if(W?(D=D&1|2,l.flags|=128):D&=1,ue(yi,D),Zi(o,l,m,h),m=on?xa:0,!W&&o!==null&&(o.flags&128)!==0)e:for(o=l.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&E_(o,h,l);else if(o.tag===19)E_(o,h,l);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===l)break e;for(;o.sibling===null;){if(o.return===null||o.return===l)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(x){case"forwards":for(h=l.child,x=null;h!==null;)o=h.alternate,o!==null&&td(o)===null&&(x=h),h=h.sibling;h=x,h===null?(x=l.child,l.child=null):(x=h.sibling,h.sibling=null),wg(l,!1,x,h,A,m);break;case"backwards":case"unstable_legacy-backwards":for(h=null,x=l.child,l.child=null;x!==null;){if(o=x.alternate,o!==null&&td(o)===null){l.child=x;break}o=x.sibling,x.sibling=h,h=x,x=o}wg(l,!0,h,null,A,m);break;case"together":wg(l,!1,null,null,void 0,m);break;default:l.memoizedState=null}return l.child}function ri(o,l,h){if(o!==null&&(l.dependencies=o.dependencies),Ra|=l.lanes,(h&l.childLanes)===0)if(o!==null){if(Yi(o,l,h,!1),(h&l.childLanes)===0)return null}else return null;if(o!==null&&l.child!==o.child)throw Error(r(153));if(l.child!==null){for(o=l.child,h=fs(o,o.pendingProps),l.child=h,h.return=l;o.sibling!==null;)o=o.sibling,h=h.sibling=fs(o,o.pendingProps),h.return=l;h.sibling=null}return l.child}function _h(o,l){return(o.lanes&l)!==0?!0:(o=o.dependencies,!!(o!==null&&an(o)))}function FS(o,l,h){switch(l.tag){case 3:lt(l,l.stateNode.containerInfo),Oo(l,wi,o.memoizedState.cache),fl();break;case 27:case 5:ne(l);break;case 4:lt(l,l.stateNode.containerInfo);break;case 10:Oo(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,Uo(l),null;break;case 13:var m=l.memoizedState;if(m!==null)return m.dehydrated!==null?(zs(l),l.flags|=128,null):(h&l.child.childLanes)!==0?Sg(o,l,h):(zs(l),o=ri(o,l,h),o!==null?o.sibling:null);zs(l);break;case 19:var x=(o.flags&128)!==0;if(m=(h&l.childLanes)!==0,m||(Yi(o,l,h,!1),m=(h&l.childLanes)!==0),x){if(m)return po(o,l,h);l.flags|=128}if(x=l.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),ue(yi,yi.current),m)break;return null;case 22:return l.lanes=0,gd(o,l,h,l.pendingProps);case 24:Oo(l,wi,o.memoizedState.cache)}return ri(o,l,h)}function yd(o,l,h){if(o!==null)if(o.memoizedProps!==l.pendingProps)xi=!0;else{if(!_h(o,h)&&(l.flags&128)===0)return xi=!1,FS(o,l,h);xi=(o.flags&131072)!==0}else xi=!1,on&&(l.flags&1048576)!==0&&Wi(l,xa,l.index);switch(l.lanes=0,l.tag){case 16:e:{var m=l.pendingProps;if(o=ml(l.elementType),l.type=o,typeof o=="function")qf(o)?(m=wl(o,m),l.tag=1,l=vd(null,l,o,m,h)):(l.tag=0,l=Ho(null,l,o,m,h));else{if(o!=null){var x=o.$$typeof;if(x===P){l.tag=11,l=w_(null,l,o,m,h);break e}else if(x===U){l.tag=14,l=fo(null,l,o,m,h);break e}}throw l=X(o)||o,Error(r(306,l,""))}}return l;case 0:return Ho(o,l,l.type,l.pendingProps,h);case 1:return m=l.type,x=wl(m,l.pendingProps),vd(o,l,m,x,h);case 3:e:{if(lt(l,l.stateNode.containerInfo),o===null)throw Error(r(387));m=l.pendingProps;var A=l.memoizedState;x=A.element,zo(o,l),wc(l,m,null,h);var D=l.memoizedState;if(m=D.cache,Oo(l,wi,m),m!==A.cache&&_c(l,[wi],h,!0),gs(),m=D.element,A.isDehydrated)if(A={element:m,isDehydrated:!1,cache:D.cache},l.updateQueue.baseState=A,l.memoizedState=A,l.flags&256){l=vg(o,l,m,h);break e}else if(m!==x){x=ds(Error(r(424)),l),ju(x),l=vg(o,l,m,h);break e}else for(o=l.stateNode.containerInfo,o.nodeType===9?o=o.body:o=o.nodeName==="HTML"?o.ownerDocument.body:o,Vn=es(o.firstChild),Xi=l,on=!0,lo=null,ji=!0,h=a_(l,null,m,h),l.child=h;h;)h.flags=h.flags&-3|4096,h=h.sibling;else{if(fl(),m===x){l=ri(o,l,h);break e}Zi(o,l,m,h)}l=l.child}return l;case 26:return Dc(o,l),o===null?(h=Gd(l.type,null,l.pendingProps,null))?l.memoizedState=h:on||(h=l.type,o=l.pendingProps,m=Vd(Fe.current).createElement(h),m[K]=l,m[Re]=o,Fi(m,h,o),Kt(m),l.stateNode=m):l.memoizedState=Gd(l.type,o.memoizedProps,l.pendingProps,o.memoizedState),null;case 27:return ne(l),o===null&&on&&(m=l.stateNode=Cn(l.type,l.pendingProps,Fe.current),Xi=l,ji=!0,x=Vn,Ai(l.type)?(Vr=x,Vn=es(m.firstChild)):Vn=x),Zi(o,l,l.pendingProps.children,h),Dc(o,l),o===null&&(l.flags|=4194304),l.child;case 5:return o===null&&on&&((x=m=Vn)&&(m=eb(m,l.type,l.pendingProps,ji),m!==null?(l.stateNode=m,Xi=l,Vn=es(m.firstChild),ji=!1,x=!0):x=!1),x||ms(l)),ne(l),x=l.type,A=l.pendingProps,D=o!==null?o.memoizedProps:null,m=A.children,Yg(x,A)?m=null:D!==null&&Yg(x,D)&&(l.flags|=32),l.memoizedState!==null&&(x=$m(o,l,Km,null,null,h),Lh._currentValue=x),Dc(o,l),Zi(o,l,m,h),l.child;case 6:return o===null&&on&&((o=h=Vn)&&(h=tb(h,l.pendingProps,ji),h!==null?(l.stateNode=h,Xi=l,Vn=null,o=!0):o=!1),o||ms(l)),null;case 13:return Sg(o,l,h);case 4:return lt(l,l.stateNode.containerInfo),m=l.pendingProps,o===null?l.child=wa(l,null,m,h):Zi(o,l,m,h),l.child;case 11:return w_(o,l,l.type,l.pendingProps,h);case 7:return Zi(o,l,l.pendingProps,h),l.child;case 8:return Zi(o,l,l.pendingProps.children,h),l.child;case 12:return Zi(o,l,l.pendingProps.children,h),l.child;case 10:return m=l.pendingProps,Oo(l,l.type,m.value),Zi(o,l,m.children,h),l.child;case 9:return x=l.type._context,m=l.pendingProps.children,dl(l),x=qi(x),m=m(x),l.flags|=1,Zi(o,l,m,h),l.child;case 14:return fo(o,l,l.type,l.pendingProps,h);case 15:return md(o,l,l.type,l.pendingProps,h);case 19:return po(o,l,h);case 31:return _d(o,l,h);case 22:return gd(o,l,h,l.pendingProps);case 24:return dl(l),m=qi(wi),o===null?(x=Gm(),x===null&&(x=Fn,A=Fm(),x.pooledCache=A,A.refCount++,A!==null&&(x.pooledCacheLanes|=h),x=A),l.memoizedState={parent:m,cache:x},$u(l),Oo(l,wi,x)):((o.lanes&h)!==0&&(zo(o,l),wc(l,null,null,h),gs()),x=o.memoizedState,A=l.memoizedState,x.parent!==m?(x={parent:m,cache:m},l.memoizedState=x,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=x),Oo(l,wi,m)):(m=A.cache,Oo(l,wi,m),m!==x.cache&&_c(l,[wi],h,!0))),Zi(o,l,l.pendingProps.children,h),l.child;case 29:throw l.pendingProps}throw Error(r(156,l.tag))}function Wo(o){o.flags|=4}function Ag(o,l,h,m,x){if((l=(o.mode&32)!==0)&&(l=!1),l){if(o.flags|=16777216,(x&335544128)===x)if(o.stateNode.complete)o.flags|=8192;else if(Y_())o.flags|=8192;else throw gl=Qf,Hm}else o.flags&=-16777217}function zc(o,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!t1(l))if(Y_())o.flags|=8192;else throw gl=Qf,Hm}function vh(o,l){l!==null&&(o.flags|=4),o.flags&16384&&(l=o.tag!==22?Nt():536870912,o.lanes|=l,Xc|=l)}function Uc(o,l){if(!on)switch(o.tailMode){case"hidden":l=o.tail;for(var h=null;l!==null;)l.alternate!==null&&(h=l),l=l.sibling;h===null?o.tail=null:h.sibling=null;break;case"collapsed":h=o.tail;for(var m=null;h!==null;)h.alternate!==null&&(m=h),h=h.sibling;m===null?l||o.tail===null?o.tail=null:o.tail.sibling=null:m.sibling=null}}function jn(o){var l=o.alternate!==null&&o.alternate.child===o.child,h=0,m=0;if(l)for(var x=o.child;x!==null;)h|=x.lanes|x.childLanes,m|=x.subtreeFlags&65011712,m|=x.flags&65011712,x.return=o,x=x.sibling;else for(x=o.child;x!==null;)h|=x.lanes|x.childLanes,m|=x.subtreeFlags,m|=x.flags,x.return=o,x=x.sibling;return o.subtreeFlags|=m,o.childLanes=h,l}function kS(o,l,h){var m=l.pendingProps;switch(zm(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jn(l),null;case 1:return jn(l),null;case 3:return h=l.stateNode,m=null,o!==null&&(m=o.memoizedState.cache),l.memoizedState.cache!==m&&(l.flags|=2048),H(wi),mt(),h.pendingContext&&(h.context=h.pendingContext,h.pendingContext=null),(o===null||o.child===null)&&(gc(l)?Wo(l):o===null||o.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Bm())),jn(l),null;case 26:var x=l.type,A=l.memoizedState;return o===null?(Wo(l),A!==null?(jn(l),zc(l,A)):(jn(l),Ag(l,x,null,m,h))):A?A!==o.memoizedState?(Wo(l),jn(l),zc(l,A)):(jn(l),l.flags&=-16777217):(o=o.memoizedProps,o!==m&&Wo(l),jn(l),Ag(l,x,o,m,h)),null;case 27:if(Be(l),h=Fe.current,x=l.type,o!==null&&l.stateNode!=null)o.memoizedProps!==m&&Wo(l);else{if(!m){if(l.stateNode===null)throw Error(r(166));return jn(l),null}o=_e.current,gc(l)?Xu(l,o):(o=Cn(x,m,h),l.stateNode=o,Wo(l))}return jn(l),null;case 5:if(Be(l),x=l.type,o!==null&&l.stateNode!=null)o.memoizedProps!==m&&Wo(l);else{if(!m){if(l.stateNode===null)throw Error(r(166));return jn(l),null}if(A=_e.current,gc(l))Xu(l,A);else{var D=Vd(Fe.current);switch(A){case 1:A=D.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:A=D.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":A=D.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":A=D.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":A=D.createElement("div"),A.innerHTML="<script><\/script>",A=A.removeChild(A.firstChild);break;case"select":A=typeof m.is=="string"?D.createElement("select",{is:m.is}):D.createElement("select"),m.multiple?A.multiple=!0:m.size&&(A.size=m.size);break;default:A=typeof m.is=="string"?D.createElement(x,{is:m.is}):D.createElement(x)}}A[K]=l,A[Re]=m;e:for(D=l.child;D!==null;){if(D.tag===5||D.tag===6)A.appendChild(D.stateNode);else if(D.tag!==4&&D.tag!==27&&D.child!==null){D.child.return=D,D=D.child;continue}if(D===l)break e;for(;D.sibling===null;){if(D.return===null||D.return===l)break e;D=D.return}D.sibling.return=D.return,D=D.sibling}l.stateNode=A;e:switch(Fi(A,x,m),x){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&Wo(l)}}return jn(l),Ag(l,l.type,o===null?null:o.memoizedProps,l.pendingProps,h),null;case 6:if(o&&l.stateNode!=null)o.memoizedProps!==m&&Wo(l);else{if(typeof m!="string"&&l.stateNode===null)throw Error(r(166));if(o=Fe.current,gc(l)){if(o=l.stateNode,h=l.memoizedProps,m=null,x=Xi,x!==null)switch(x.tag){case 27:case 5:m=x.memoizedProps}o[K]=l,o=!!(o.nodeValue===h||m!==null&&m.suppressHydrationWarning===!0||zd(o.nodeValue,h)),o||ms(l,!0)}else o=Vd(o).createTextNode(m),o[K]=l,l.stateNode=o}return jn(l),null;case 31:if(h=l.memoizedState,o===null||o.memoizedState!==null){if(m=gc(l),h!==null){if(o===null){if(!m)throw Error(r(318));if(o=l.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[K]=l}else fl(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;jn(l),o=!1}else h=Bm(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=h),o=!0;if(!o)return l.flags&256?(gr(l),l):(gr(l),null);if((l.flags&128)!==0)throw Error(r(558))}return jn(l),null;case 13:if(m=l.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(x=gc(l),m!==null&&m.dehydrated!==null){if(o===null){if(!x)throw Error(r(318));if(x=l.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[K]=l}else fl(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;jn(l),x=!1}else x=Bm(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=x),x=!0;if(!x)return l.flags&256?(gr(l),l):(gr(l),null)}return gr(l),(l.flags&128)!==0?(l.lanes=h,l):(h=m!==null,o=o!==null&&o.memoizedState!==null,h&&(m=l.child,x=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(x=m.alternate.memoizedState.cachePool.pool),A=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(A=m.memoizedState.cachePool.pool),A!==x&&(m.flags|=2048)),h!==o&&h&&(l.child.flags|=8192),vh(l,l.updateQueue),jn(l),null);case 4:return mt(),o===null&&pv(l.stateNode.containerInfo),jn(l),null;case 10:return H(l.type),jn(l),null;case 19:if(re(yi),m=l.memoizedState,m===null)return jn(l),null;if(x=(l.flags&128)!==0,A=m.rendering,A===null)if(x)Uc(m,!1);else{if(fi!==0||o!==null&&(o.flags&128)!==0)for(o=l.child;o!==null;){if(A=td(o),A!==null){for(l.flags|=128,Uc(m,!1),o=A.updateQueue,l.updateQueue=o,vh(l,o),l.subtreeFlags=0,o=h,h=l.child;h!==null;)Om(h,o),h=h.sibling;return ue(yi,yi.current&1|2),on&&Bn(l,m.treeForkCount),l.child}o=o.sibling}m.tail!==null&&Ve()>Td&&(l.flags|=128,x=!0,Uc(m,!1),l.lanes=4194304)}else{if(!x)if(o=td(A),o!==null){if(l.flags|=128,x=!0,o=o.updateQueue,l.updateQueue=o,vh(l,o),Uc(m,!0),m.tail===null&&m.tailMode==="hidden"&&!A.alternate&&!on)return jn(l),null}else 2*Ve()-m.renderingStartTime>Td&&h!==536870912&&(l.flags|=128,x=!0,Uc(m,!1),l.lanes=4194304);m.isBackwards?(A.sibling=l.child,l.child=A):(o=m.last,o!==null?o.sibling=A:l.child=A,m.last=A)}return m.tail!==null?(o=m.tail,m.rendering=o,m.tail=o.sibling,m.renderingStartTime=Ve(),o.sibling=null,h=yi.current,ue(yi,x?h&1|2:h&1),on&&Bn(l,m.treeForkCount),o):(jn(l),null);case 22:case 23:return gr(l),ed(),m=l.memoizedState!==null,o!==null?o.memoizedState!==null!==m&&(l.flags|=8192):m&&(l.flags|=8192),m?(h&536870912)!==0&&(l.flags&128)===0&&(jn(l),l.subtreeFlags&6&&(l.flags|=8192)):jn(l),h=l.updateQueue,h!==null&&vh(l,h.retryQueue),h=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),m=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),m!==h&&(l.flags|=2048),o!==null&&re(pl),null;case 24:return h=null,o!==null&&(h=o.memoizedState.cache),l.memoizedState.cache!==h&&(l.flags|=2048),H(wi),jn(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function GS(o,l){switch(zm(l),l.tag){case 1:return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 3:return H(wi),mt(),o=l.flags,(o&65536)!==0&&(o&128)===0?(l.flags=o&-65537|128,l):null;case 26:case 27:case 5:return Be(l),null;case 31:if(l.memoizedState!==null){if(gr(l),l.alternate===null)throw Error(r(340));fl()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 13:if(gr(l),o=l.memoizedState,o!==null&&o.dehydrated!==null){if(l.alternate===null)throw Error(r(340));fl()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 19:return re(yi),null;case 4:return mt(),null;case 10:return H(l.type),null;case 22:case 23:return gr(l),ed(),o!==null&&re(pl),o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 24:return H(wi),null;case 25:return null;default:return null}}function T_(o,l){switch(zm(l),l.tag){case 3:H(wi),mt();break;case 26:case 27:case 5:Be(l);break;case 4:mt();break;case 31:l.memoizedState!==null&&gr(l);break;case 13:gr(l);break;case 19:re(yi);break;case 10:H(l.type);break;case 22:case 23:gr(l),ed(),o!==null&&re(pl);break;case 24:H(wi)}}function Bc(o,l){try{var h=l.updateQueue,m=h!==null?h.lastEffect:null;if(m!==null){var x=m.next;h=x;do{if((h.tag&o)===o){m=void 0;var A=h.create,D=h.inst;m=A(),D.destroy=m}h=h.next}while(h!==x)}}catch(W){Rn(l,l.return,W)}}function Xo(o,l,h){try{var m=l.updateQueue,x=m!==null?m.lastEffect:null;if(x!==null){var A=x.next;m=A;do{if((m.tag&o)===o){var D=m.inst,W=D.destroy;if(W!==void 0){D.destroy=void 0,x=l;var he=h,Oe=W;try{Oe()}catch(Je){Rn(x,he,Je)}}}m=m.next}while(m!==A)}}catch(Je){Rn(l,l.return,Je)}}function C_(o){var l=o.updateQueue;if(l!==null){var h=o.stateNode;try{Zu(l,h)}catch(m){Rn(o,o.return,m)}}}function xd(o,l,h){h.props=wl(o.type,o.memoizedProps),h.state=o.memoizedState;try{h.componentWillUnmount()}catch(m){Rn(o,l,m)}}function Vc(o,l){try{var h=o.ref;if(h!==null){switch(o.tag){case 26:case 27:case 5:var m=o.stateNode;break;case 30:m=o.stateNode;break;default:m=o.stateNode}typeof h=="function"?o.refCleanup=h(m):h.current=m}}catch(x){Rn(o,l,x)}}function Or(o,l){var h=o.ref,m=o.refCleanup;if(h!==null)if(typeof m=="function")try{m()}catch(x){Rn(o,l,x)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof h=="function")try{h(null)}catch(x){Rn(o,l,x)}else h.current=null}function Sd(o){var l=o.type,h=o.memoizedProps,m=o.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":h.autoFocus&&m.focus();break e;case"img":h.src?m.src=h.src:h.srcSet&&(m.srcset=h.srcSet)}}catch(x){Rn(o,o.return,x)}}function bd(o,l,h){try{var m=o.stateNode;Ud(m,o.type,h,l),m[Re]=l}catch(x){Rn(o,o.return,x)}}function Eg(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Ai(o.type)||o.tag===4}function Fc(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Eg(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Ai(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Md(o,l,h){var m=o.tag;if(m===5||m===6)o=o.stateNode,l?(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h).insertBefore(o,l):(l=h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,l.appendChild(o),h=h._reactRootContainer,h!=null||l.onclick!==null||(l.onclick=io));else if(m!==4&&(m===27&&Ai(o.type)&&(h=o.stateNode,l=null),o=o.child,o!==null))for(Md(o,l,h),o=o.sibling;o!==null;)Md(o,l,h),o=o.sibling}function Dr(o,l,h){var m=o.tag;if(m===5||m===6)o=o.stateNode,l?h.insertBefore(o,l):h.appendChild(o);else if(m!==4&&(m===27&&Ai(o.type)&&(h=o.stateNode),o=o.child,o!==null))for(Dr(o,l,h),o=o.sibling;o!==null;)Dr(o,l,h),o=o.sibling}function Ta(o){var l=o.stateNode,h=o.memoizedProps;try{for(var m=o.type,x=l.attributes;x.length;)l.removeAttributeNode(x[0]);Fi(l,m,h),l[K]=o,l[Re]=h}catch(A){Rn(o,o.return,A)}}var jo=!1,Si=!1,Tg=!1,R_=typeof WeakSet=="function"?WeakSet:Set,Vi=null;function HS(o,l){if(o=o.containerInfo,Bd=Ph,o=J0(o),Pm(o)){if("selectionStart"in o)var h={start:o.selectionStart,end:o.selectionEnd};else e:{h=(h=o.ownerDocument)&&h.defaultView||window;var m=h.getSelection&&h.getSelection();if(m&&m.rangeCount!==0){h=m.anchorNode;var x=m.anchorOffset,A=m.focusNode;m=m.focusOffset;try{h.nodeType,A.nodeType}catch{h=null;break e}var D=0,W=-1,he=-1,Oe=0,Je=0,ot=o,ze=null;t:for(;;){for(var Ye;ot!==h||x!==0&&ot.nodeType!==3||(W=D+x),ot!==A||m!==0&&ot.nodeType!==3||(he=D+m),ot.nodeType===3&&(D+=ot.nodeValue.length),(Ye=ot.firstChild)!==null;)ze=ot,ot=Ye;for(;;){if(ot===o)break t;if(ze===h&&++Oe===x&&(W=D),ze===A&&++Je===m&&(he=D),(Ye=ot.nextSibling)!==null)break;ot=ze,ze=ot.parentNode}ot=Ye}h=W===-1||he===-1?null:{start:W,end:he}}else h=null}h=h||{start:0,end:0}}else h=null;for(jg={focusedElem:o,selectionRange:h},Ph=!1,Vi=l;Vi!==null;)if(l=Vi,o=l.child,(l.subtreeFlags&1028)!==0&&o!==null)o.return=l,Vi=o;else for(;Vi!==null;){switch(l=Vi,A=l.alternate,o=l.flags,l.tag){case 0:if((o&4)!==0&&(o=l.updateQueue,o=o!==null?o.events:null,o!==null))for(h=0;h<o.length;h++)x=o[h],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&A!==null){o=void 0,h=l,x=A.memoizedProps,A=A.memoizedState,m=h.stateNode;try{var Ct=wl(h.type,x);o=m.getSnapshotBeforeUpdate(Ct,A),m.__reactInternalSnapshotBeforeUpdate=o}catch(Gt){Rn(h,h.return,Gt)}}break;case 3:if((o&1024)!==0){if(o=l.stateNode.containerInfo,h=o.nodeType,h===9)Zg(o);else if(h===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":Zg(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(r(163))}if(o=l.sibling,o!==null){o.return=l.return,Vi=o;break}Vi=l.return}}function L_(o,l,h){var m=h.flags;switch(h.tag){case 0:case 11:case 15:qo(o,h),m&4&&Bc(5,h);break;case 1:if(qo(o,h),m&4)if(o=h.stateNode,l===null)try{o.componentDidMount()}catch(D){Rn(h,h.return,D)}else{var x=wl(h.type,l.memoizedProps);l=l.memoizedState;try{o.componentDidUpdate(x,l,o.__reactInternalSnapshotBeforeUpdate)}catch(D){Rn(h,h.return,D)}}m&64&&C_(h),m&512&&Vc(h,h.return);break;case 3:if(qo(o,h),m&64&&(o=h.updateQueue,o!==null)){if(l=null,h.child!==null)switch(h.child.tag){case 27:case 5:l=h.child.stateNode;break;case 1:l=h.child.stateNode}try{Zu(o,l)}catch(D){Rn(h,h.return,D)}}break;case 27:l===null&&m&4&&Ta(h);case 26:case 5:qo(o,h),l===null&&m&4&&Sd(h),m&512&&Vc(h,h.return);break;case 12:qo(o,h);break;case 31:qo(o,h),m&4&&I_(o,h);break;case 13:qo(o,h),m&4&&Cg(o,h),m&64&&(o=h.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(h=iv.bind(null,h),nn(o,h))));break;case 22:if(m=h.memoizedState!==null||jo,!m){l=l!==null&&l.memoizedState!==null||Si,x=jo;var A=Si;jo=m,(Si=l)&&!A?$o(o,h,(h.subtreeFlags&8772)!==0):qo(o,h),jo=x,Si=A}break;case 30:break;default:qo(o,h)}}function P_(o){var l=o.alternate;l!==null&&(o.alternate=null,P_(l)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(l=o.stateNode,l!==null&&Vt(l)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var ei=null,zr=!1;function Yo(o,l,h){for(h=h.child;h!==null;)N_(o,l,h),h=h.sibling}function N_(o,l,h){if(Ee&&typeof Ee.onCommitFiberUnmount=="function")try{Ee.onCommitFiberUnmount(De,h)}catch{}switch(h.tag){case 26:Si||Or(h,l),Yo(o,l,h),h.memoizedState?h.memoizedState.count--:h.stateNode&&(h=h.stateNode,h.parentNode.removeChild(h));break;case 27:Si||Or(h,l);var m=ei,x=zr;Ai(h.type)&&(ei=h.stateNode,zr=!1),Yo(o,l,h),Eh(h.stateNode),ei=m,zr=x;break;case 5:Si||Or(h,l);case 6:if(m=ei,x=zr,ei=null,Yo(o,l,h),ei=m,zr=x,ei!==null)if(zr)try{(ei.nodeType===9?ei.body:ei.nodeName==="HTML"?ei.ownerDocument.body:ei).removeChild(h.stateNode)}catch(A){Rn(h,l,A)}else try{ei.removeChild(h.stateNode)}catch(A){Rn(h,l,A)}break;case 18:ei!==null&&(zr?(o=ei,Nl(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,h.stateNode),Ba(o)):Nl(ei,h.stateNode));break;case 4:m=ei,x=zr,ei=h.stateNode.containerInfo,zr=!0,Yo(o,l,h),ei=m,zr=x;break;case 0:case 11:case 14:case 15:Xo(2,h,l),Si||Xo(4,h,l),Yo(o,l,h);break;case 1:Si||(Or(h,l),m=h.stateNode,typeof m.componentWillUnmount=="function"&&xd(h,l,m)),Yo(o,l,h);break;case 21:Yo(o,l,h);break;case 22:Si=(m=Si)||h.memoizedState!==null,Yo(o,l,h),Si=m;break;default:Yo(o,l,h)}}function I_(o,l){if(l.memoizedState===null&&(o=l.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{Ba(o)}catch(h){Rn(l,l.return,h)}}}function Cg(o,l){if(l.memoizedState===null&&(o=l.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{Ba(o)}catch(h){Rn(l,l.return,h)}}function O_(o){switch(o.tag){case 31:case 13:case 19:var l=o.stateNode;return l===null&&(l=o.stateNode=new R_),l;case 22:return o=o.stateNode,l=o._retryCache,l===null&&(l=o._retryCache=new R_),l;default:throw Error(r(435,o.tag))}}function yh(o,l){var h=O_(o);l.forEach(function(m){if(!h.has(m)){h.add(m);var x=rv.bind(null,o,m);m.then(x,x)}})}function Ur(o,l){var h=l.deletions;if(h!==null)for(var m=0;m<h.length;m++){var x=h[m],A=o,D=l,W=D;e:for(;W!==null;){switch(W.tag){case 27:if(Ai(W.type)){ei=W.stateNode,zr=!1;break e}break;case 5:ei=W.stateNode,zr=!1;break e;case 3:case 4:ei=W.stateNode.containerInfo,zr=!0;break e}W=W.return}if(ei===null)throw Error(r(160));N_(A,D,x),ei=null,zr=!1,A=x.alternate,A!==null&&(A.return=null),x.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)D_(l,o),l=l.sibling}var Us=null;function D_(o,l){var h=o.alternate,m=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:Ur(l,o),vr(o),m&4&&(Xo(3,o,o.return),Bc(3,o),Xo(5,o,o.return));break;case 1:Ur(l,o),vr(o),m&512&&(Si||h===null||Or(h,h.return)),m&64&&jo&&(o=o.updateQueue,o!==null&&(m=o.callbacks,m!==null&&(h=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=h===null?m:h.concat(m))));break;case 26:var x=Us;if(Ur(l,o),vr(o),m&512&&(Si||h===null||Or(h,h.return)),m&4){var A=h!==null?h.memoizedState:null;if(m=o.memoizedState,h===null)if(m===null)if(o.stateNode===null){e:{m=o.type,h=o.memoizedProps,x=x.ownerDocument||x;t:switch(m){case"title":A=x.getElementsByTagName("title")[0],(!A||A[Rt]||A[K]||A.namespaceURI==="http://www.w3.org/2000/svg"||A.hasAttribute("itemprop"))&&(A=x.createElement(m),x.head.insertBefore(A,x.querySelector("head > title"))),Fi(A,m,h),A[K]=o,Kt(A),m=A;break e;case"link":var D=Tv("link","href",x).get(m+(h.href||""));if(D){for(var W=0;W<D.length;W++)if(A=D[W],A.getAttribute("href")===(h.href==null||h.href===""?null:h.href)&&A.getAttribute("rel")===(h.rel==null?null:h.rel)&&A.getAttribute("title")===(h.title==null?null:h.title)&&A.getAttribute("crossorigin")===(h.crossOrigin==null?null:h.crossOrigin)){D.splice(W,1);break t}}A=x.createElement(m),Fi(A,m,h),x.head.appendChild(A);break;case"meta":if(D=Tv("meta","content",x).get(m+(h.content||""))){for(W=0;W<D.length;W++)if(A=D[W],A.getAttribute("content")===(h.content==null?null:""+h.content)&&A.getAttribute("name")===(h.name==null?null:h.name)&&A.getAttribute("property")===(h.property==null?null:h.property)&&A.getAttribute("http-equiv")===(h.httpEquiv==null?null:h.httpEquiv)&&A.getAttribute("charset")===(h.charSet==null?null:h.charSet)){D.splice(W,1);break t}}A=x.createElement(m),Fi(A,m,h),x.head.appendChild(A);break;default:throw Error(r(468,m))}A[K]=o,Kt(A),m=A}o.stateNode=m}else Cv(x,o.type,o.stateNode);else o.stateNode=Sr(x,m,o.memoizedProps);else A!==m?(A===null?h.stateNode!==null&&(h=h.stateNode,h.parentNode.removeChild(h)):A.count--,m===null?Cv(x,o.type,o.stateNode):Sr(x,m,o.memoizedProps)):m===null&&o.stateNode!==null&&bd(o,o.memoizedProps,h.memoizedProps)}break;case 27:Ur(l,o),vr(o),m&512&&(Si||h===null||Or(h,h.return)),h!==null&&m&4&&bd(o,o.memoizedProps,h.memoizedProps);break;case 5:if(Ur(l,o),vr(o),m&512&&(Si||h===null||Or(h,h.return)),o.flags&32){x=o.stateNode;try{rc(x,"")}catch(Ct){Rn(o,o.return,Ct)}}m&4&&o.stateNode!=null&&(x=o.memoizedProps,bd(o,x,h!==null?h.memoizedProps:x)),m&1024&&(Tg=!0);break;case 6:if(Ur(l,o),vr(o),m&4){if(o.stateNode===null)throw Error(r(162));m=o.memoizedProps,h=o.stateNode;try{h.nodeValue=m}catch(Ct){Rn(o,o.return,Ct)}}break;case 3:if(Th=null,x=Us,Us=Qc(l.containerInfo),Ur(l,o),Us=x,vr(o),m&4&&h!==null&&h.memoizedState.isDehydrated)try{Ba(l.containerInfo)}catch(Ct){Rn(o,o.return,Ct)}Tg&&(Tg=!1,z_(o));break;case 4:m=Us,Us=Qc(o.stateNode.containerInfo),Ur(l,o),vr(o),Us=m;break;case 12:Ur(l,o),vr(o);break;case 31:Ur(l,o),vr(o),m&4&&(m=o.updateQueue,m!==null&&(o.updateQueue=null,yh(o,m)));break;case 13:Ur(l,o),vr(o),o.child.flags&8192&&o.memoizedState!==null!=(h!==null&&h.memoizedState!==null)&&(Ed=Ve()),m&4&&(m=o.updateQueue,m!==null&&(o.updateQueue=null,yh(o,m)));break;case 22:x=o.memoizedState!==null;var he=h!==null&&h.memoizedState!==null,Oe=jo,Je=Si;if(jo=Oe||x,Si=Je||he,Ur(l,o),Si=Je,jo=Oe,vr(o),m&8192)e:for(l=o.stateNode,l._visibility=x?l._visibility&-2:l._visibility|1,x&&(h===null||he||jo||Si||El(o)),h=null,l=o;;){if(l.tag===5||l.tag===26){if(h===null){he=h=l;try{if(A=he.stateNode,x)D=A.style,typeof D.setProperty=="function"?D.setProperty("display","none","important"):D.display="none";else{W=he.stateNode;var ot=he.memoizedProps.style,ze=ot!=null&&ot.hasOwnProperty("display")?ot.display:null;W.style.display=ze==null||typeof ze=="boolean"?"":(""+ze).trim()}}catch(Ct){Rn(he,he.return,Ct)}}}else if(l.tag===6){if(h===null){he=l;try{he.stateNode.nodeValue=x?"":he.memoizedProps}catch(Ct){Rn(he,he.return,Ct)}}}else if(l.tag===18){if(h===null){he=l;try{var Ye=he.stateNode;x?bv(Ye,!0):bv(he.stateNode,!1)}catch(Ct){Rn(he,he.return,Ct)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===o)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break e;for(;l.sibling===null;){if(l.return===null||l.return===o)break e;h===l&&(h=null),l=l.return}h===l&&(h=null),l.sibling.return=l.return,l=l.sibling}m&4&&(m=o.updateQueue,m!==null&&(h=m.retryQueue,h!==null&&(m.retryQueue=null,yh(o,h))));break;case 19:Ur(l,o),vr(o),m&4&&(m=o.updateQueue,m!==null&&(o.updateQueue=null,yh(o,m)));break;case 30:break;case 21:break;default:Ur(l,o),vr(o)}}function vr(o){var l=o.flags;if(l&2){try{for(var h,m=o.return;m!==null;){if(Eg(m)){h=m;break}m=m.return}if(h==null)throw Error(r(160));switch(h.tag){case 27:var x=h.stateNode;Dr(o,Fc(o),x);break;case 5:var A=h.stateNode;h.flags&32&&(rc(A,""),h.flags&=-33),Dr(o,Fc(o),A);break;case 3:case 4:var D=h.stateNode.containerInfo;Md(o,Fc(o),D);break;default:throw Error(r(161))}}catch(W){Rn(o,o.return,W)}o.flags&=-3}l&4096&&(o.flags&=-4097)}function z_(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var l=o;z_(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),o=o.sibling}}function qo(o,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)L_(o,l.alternate,l),l=l.sibling}function El(o){for(o=o.child;o!==null;){var l=o;switch(l.tag){case 0:case 11:case 14:case 15:Xo(4,l,l.return),El(l);break;case 1:Or(l,l.return);var h=l.stateNode;typeof h.componentWillUnmount=="function"&&xd(l,l.return,h),El(l);break;case 27:Eh(l.stateNode);case 26:case 5:Or(l,l.return),El(l);break;case 22:l.memoizedState===null&&El(l);break;case 30:El(l);break;default:El(l)}o=o.sibling}}function $o(o,l,h){for(h=h&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var m=l.alternate,x=o,A=l,D=A.flags;switch(A.tag){case 0:case 11:case 15:$o(x,A,h),Bc(4,A);break;case 1:if($o(x,A,h),m=A,x=m.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(Oe){Rn(m,m.return,Oe)}if(m=A,x=m.updateQueue,x!==null){var W=m.stateNode;try{var he=x.shared.hiddenCallbacks;if(he!==null)for(x.shared.hiddenCallbacks=null,x=0;x<he.length;x++)l_(he[x],W)}catch(Oe){Rn(m,m.return,Oe)}}h&&D&64&&C_(A),Vc(A,A.return);break;case 27:Ta(A);case 26:case 5:$o(x,A,h),h&&m===null&&D&4&&Sd(A),Vc(A,A.return);break;case 12:$o(x,A,h);break;case 31:$o(x,A,h),h&&D&4&&I_(x,A);break;case 13:$o(x,A,h),h&&D&4&&Cg(x,A);break;case 22:A.memoizedState===null&&$o(x,A,h),Vc(A,A.return);break;case 30:break;default:$o(x,A,h)}l=l.sibling}}function Rg(o,l){var h=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),o=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(o=l.memoizedState.cachePool.pool),o!==h&&(o!=null&&o.refCount++,h!=null&&Zr(h))}function Lg(o,l){o=null,l.alternate!==null&&(o=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==o&&(l.refCount++,o!=null&&Zr(o))}function hi(o,l,h,m){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)U_(o,l,h,m),l=l.sibling}function U_(o,l,h,m){var x=l.flags;switch(l.tag){case 0:case 11:case 15:hi(o,l,h,m),x&2048&&Bc(9,l);break;case 1:hi(o,l,h,m);break;case 3:hi(o,l,h,m),x&2048&&(o=null,l.alternate!==null&&(o=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==o&&(l.refCount++,o!=null&&Zr(o)));break;case 12:if(x&2048){hi(o,l,h,m),o=l.stateNode;try{var A=l.memoizedProps,D=A.id,W=A.onPostCommit;typeof W=="function"&&W(D,l.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(he){Rn(l,l.return,he)}}else hi(o,l,h,m);break;case 31:hi(o,l,h,m);break;case 13:hi(o,l,h,m);break;case 23:break;case 22:A=l.stateNode,D=l.alternate,l.memoizedState!==null?A._visibility&2?hi(o,l,h,m):xh(o,l):A._visibility&2?hi(o,l,h,m):(A._visibility|=2,kc(o,l,h,m,(l.subtreeFlags&10256)!==0||!1)),x&2048&&Rg(D,l);break;case 24:hi(o,l,h,m),x&2048&&Lg(l.alternate,l);break;default:hi(o,l,h,m)}}function kc(o,l,h,m,x){for(x=x&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var A=o,D=l,W=h,he=m,Oe=D.flags;switch(D.tag){case 0:case 11:case 15:kc(A,D,W,he,x),Bc(8,D);break;case 23:break;case 22:var Je=D.stateNode;D.memoizedState!==null?Je._visibility&2?kc(A,D,W,he,x):xh(A,D):(Je._visibility|=2,kc(A,D,W,he,x)),x&&Oe&2048&&Rg(D.alternate,D);break;case 24:kc(A,D,W,he,x),x&&Oe&2048&&Lg(D.alternate,D);break;default:kc(A,D,W,he,x)}l=l.sibling}}function xh(o,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var h=o,m=l,x=m.flags;switch(m.tag){case 22:xh(h,m),x&2048&&Rg(m.alternate,m);break;case 24:xh(h,m),x&2048&&Lg(m.alternate,m);break;default:xh(h,m)}l=l.sibling}}var Gc=8192;function Hc(o,l,h){if(o.subtreeFlags&Gc)for(o=o.child;o!==null;)B_(o,l,h),o=o.sibling}function B_(o,l,h){switch(o.tag){case 26:Hc(o,l,h),o.flags&Gc&&o.memoizedState!==null&&db(h,Us,o.memoizedState,o.memoizedProps);break;case 5:Hc(o,l,h);break;case 3:case 4:var m=Us;Us=Qc(o.stateNode.containerInfo),Hc(o,l,h),Us=m;break;case 22:o.memoizedState===null&&(m=o.alternate,m!==null&&m.memoizedState!==null?(m=Gc,Gc=16777216,Hc(o,l,h),Gc=m):Hc(o,l,h));break;default:Hc(o,l,h)}}function V_(o){var l=o.alternate;if(l!==null&&(o=l.child,o!==null)){l.child=null;do l=o.sibling,o.sibling=null,o=l;while(o!==null)}}function Sh(o){var l=o.deletions;if((o.flags&16)!==0){if(l!==null)for(var h=0;h<l.length;h++){var m=l[h];Vi=m,F_(m,o)}V_(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)wd(o),o=o.sibling}function wd(o){switch(o.tag){case 0:case 11:case 15:Sh(o),o.flags&2048&&Xo(9,o,o.return);break;case 3:Sh(o);break;case 12:Sh(o);break;case 22:var l=o.stateNode;o.memoizedState!==null&&l._visibility&2&&(o.return===null||o.return.tag!==13)?(l._visibility&=-3,Ad(o)):Sh(o);break;default:Sh(o)}}function Ad(o){var l=o.deletions;if((o.flags&16)!==0){if(l!==null)for(var h=0;h<l.length;h++){var m=l[h];Vi=m,F_(m,o)}V_(o)}for(o=o.child;o!==null;){switch(l=o,l.tag){case 0:case 11:case 15:Xo(8,l,l.return),Ad(l);break;case 22:h=l.stateNode,h._visibility&2&&(h._visibility&=-3,Ad(l));break;default:Ad(l)}o=o.sibling}}function F_(o,l){for(;Vi!==null;){var h=Vi;switch(h.tag){case 0:case 11:case 15:Xo(8,h,l);break;case 23:case 22:if(h.memoizedState!==null&&h.memoizedState.cachePool!==null){var m=h.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:Zr(h.memoizedState.cache)}if(m=h.child,m!==null)m.return=h,Vi=m;else e:for(h=o;Vi!==null;){m=Vi;var x=m.sibling,A=m.return;if(P_(m),m===h){Vi=null;break e}if(x!==null){x.return=A,Vi=x;break e}Vi=A}}}var WS={getCacheForType:function(o){var l=qi(wi),h=l.data.get(o);return h===void 0&&(h=o(),l.data.set(o,h)),h},cacheSignal:function(){return qi(wi).controller.signal}},XS=typeof WeakMap=="function"?WeakMap:Map,Tn=0,Fn=null,fn=null,mn=0,Nn=0,Qr=null,Ca=!1,Wc=!1,Pg=!1,Zo=0,fi=0,Ra=0,Tl=0,Ng=0,Jr=0,Xc=0,Cl=null,yr=null,Ig=!1,Ed=0,k_=0,Td=1/0,Cd=null,La=null,Pi=0,Pa=null,Rl=null,Ko=0,jc=0,Og=null,G_=null,bh=0,Dg=null;function vs(){return(Tn&2)!==0&&mn!==0?mn&-mn:j.T!==null?Hg():Ls()}function H_(){if(Jr===0)if((mn&536870912)===0||on){var o=Ke;Ke<<=1,(Ke&3932160)===0&&(Ke=262144),Jr=o}else Jr=536870912;return o=li.current,o!==null&&(o.flags|=32),Jr}function Br(o,l,h){(o===Fn&&(Nn===2||Nn===9)||o.cancelPendingCommit!==null)&&(Yc(o,0),Na(o,mn,Jr,!1)),Gn(o,h),((Tn&2)===0||o!==Fn)&&(o===Fn&&((Tn&2)===0&&(Tl|=h),fi===4&&Na(o,mn,Jr,!1)),Qo(o))}function W_(o,l,h){if((Tn&6)!==0)throw Error(r(327));var m=!h&&(l&127)===0&&(l&o.expiredLanes)===0||Yt(o,l),x=m?qS(o,l):Vg(o,l,!0),A=m;do{if(x===0){Wc&&!m&&Na(o,l,0,!1);break}else{if(h=o.current.alternate,A&&!jS(h)){x=Vg(o,l,!1),A=!1;continue}if(x===2){if(A=l,o.errorRecoveryDisabledLanes&A)var D=0;else D=o.pendingLanes&-536870913,D=D!==0?D:D&536870912?536870912:0;if(D!==0){l=D;e:{var W=o;x=Cl;var he=W.current.memoizedState.isDehydrated;if(he&&(Yc(W,D).flags|=256),D=Vg(W,D,!1),D!==2){if(Pg&&!he){W.errorRecoveryDisabledLanes|=A,Tl|=A,x=4;break e}A=yr,yr=x,A!==null&&(yr===null?yr=A:yr.push.apply(yr,A))}x=D}if(A=!1,x!==2)continue}}if(x===1){Yc(o,0),Na(o,l,0,!0);break}e:{switch(m=o,A=x,A){case 0:case 1:throw Error(r(345));case 4:if((l&4194048)!==l)break;case 6:Na(m,l,Jr,!Ca);break e;case 2:yr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((l&62914560)===l&&(x=Ed+300-Ve(),10<x)){if(Na(m,l,Jr,!Ca),be(m,0,!0)!==0)break e;Ko=l,m.timeoutHandle=Kc(X_.bind(null,m,h,yr,Cd,Ig,l,Jr,Tl,Xc,Ca,A,"Throttled",-0,0),x);break e}X_(m,h,yr,Cd,Ig,l,Jr,Tl,Xc,Ca,A,null,-0,0)}}break}while(!0);Qo(o)}function X_(o,l,h,m,x,A,D,W,he,Oe,Je,ot,ze,Ye){if(o.timeoutHandle=-1,ot=l.subtreeFlags,ot&8192||(ot&16785408)===16785408){ot={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:io},B_(l,A,ot);var Ct=(A&62914560)===A?Ed-Ve():(A&4194048)===A?k_-Ve():0;if(Ct=pb(ot,Ct),Ct!==null){Ko=A,o.cancelPendingCommit=Ct(K_.bind(null,o,l,A,h,m,x,D,W,he,Je,ot,null,ze,Ye)),Na(o,A,D,!Oe);return}}K_(o,l,A,h,m,x,D,W,he)}function jS(o){for(var l=o;;){var h=l.tag;if((h===0||h===11||h===15)&&l.flags&16384&&(h=l.updateQueue,h!==null&&(h=h.stores,h!==null)))for(var m=0;m<h.length;m++){var x=h[m],A=x.getSnapshot;x=x.value;try{if(!pr(A(),x))return!1}catch{return!1}}if(h=l.child,l.subtreeFlags&16384&&h!==null)h.return=l,l=h;else{if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Na(o,l,h,m){l&=~Ng,l&=~Tl,o.suspendedLanes|=l,o.pingedLanes&=~l,m&&(o.warmLanes|=l),m=o.expirationTimes;for(var x=l;0<x;){var A=31-nt(x),D=1<<A;m[A]=-1,x&=~D}h!==0&&Gi(o,h,l)}function Rd(){return(Tn&6)===0?(Pl(0,!1),!1):!0}function zg(){if(fn!==null){if(Nn===0)var o=fn.return;else o=fn,$r=co=null,nd(o),Sc=null,qu=0,o=fn;for(;o!==null;)T_(o.alternate,o),o=o.return;fn=null}}function Yc(o,l){var h=o.timeoutHandle;h!==-1&&(o.timeoutHandle=-1,$g(h)),h=o.cancelPendingCommit,h!==null&&(o.cancelPendingCommit=null,h()),Ko=0,zg(),Fn=o,fn=h=fs(o.current,null),mn=l,Nn=0,Qr=null,Ca=!1,Wc=Yt(o,l),Pg=!1,Xc=Jr=Ng=Tl=Ra=fi=0,yr=Cl=null,Ig=!1,(l&8)!==0&&(l|=l&32);var m=o.entangledLanes;if(m!==0)for(o=o.entanglements,m&=l;0<m;){var x=31-nt(m),A=1<<x;l|=o[x],m&=~A}return Zo=l,jf(),h}function j_(o,l){Qt=null,j.H=fh,l===xc||l===Pr?(l=Wm(),Nn=3):l===Hm?(l=Wm(),Nn=4):Nn=l===_g?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Qr=l,fn===null&&(fi=1,Oc(o,ds(l,o.current)))}function Y_(){var o=li.current;return o===null?!0:(mn&4194048)===mn?Nr===null:(mn&62914560)===mn||(mn&536870912)!==0?o===Nr:!1}function Ug(){var o=j.H;return j.H=fh,o===null?fh:o}function Bg(){var o=j.A;return j.A=WS,o}function Ld(){fi=4,Ca||(mn&4194048)!==mn&&li.current!==null||(Wc=!0),(Ra&134217727)===0&&(Tl&134217727)===0||Fn===null||Na(Fn,mn,Jr,!1)}function Vg(o,l,h){var m=Tn;Tn|=2;var x=Ug(),A=Bg();(Fn!==o||mn!==l)&&(Cd=null,Yc(o,l)),l=!1;var D=fi;e:do try{if(Nn!==0&&fn!==null){var W=fn,he=Qr;switch(Nn){case 8:zg(),D=6;break e;case 3:case 2:case 9:case 6:li.current===null&&(l=!0);var Oe=Nn;if(Nn=0,Qr=null,qc(o,W,he,Oe),h&&Wc){D=0;break e}break;default:Oe=Nn,Nn=0,Qr=null,qc(o,W,he,Oe)}}YS(),D=fi;break}catch(Je){j_(o,Je)}while(!0);return l&&o.shellSuspendCounter++,$r=co=null,Tn=m,j.H=x,j.A=A,fn===null&&(Fn=null,mn=0,jf()),D}function YS(){for(;fn!==null;)q_(fn)}function qS(o,l){var h=Tn;Tn|=2;var m=Ug(),x=Bg();Fn!==o||mn!==l?(Cd=null,Td=Ve()+500,Yc(o,l)):Wc=Yt(o,l);e:do try{if(Nn!==0&&fn!==null){l=fn;var A=Qr;t:switch(Nn){case 1:Nn=0,Qr=null,qc(o,l,A,1);break;case 2:case 9:if(r_(A)){Nn=0,Qr=null,$_(l);break}l=function(){Nn!==2&&Nn!==9||Fn!==o||(Nn=7),Qo(o)},A.then(l,l);break e;case 3:Nn=7;break e;case 4:Nn=5;break e;case 7:r_(A)?(Nn=0,Qr=null,$_(l)):(Nn=0,Qr=null,qc(o,l,A,7));break;case 5:var D=null;switch(fn.tag){case 26:D=fn.memoizedState;case 5:case 27:var W=fn;if(D?t1(D):W.stateNode.complete){Nn=0,Qr=null;var he=W.sibling;if(he!==null)fn=he;else{var Oe=W.return;Oe!==null?(fn=Oe,Nd(Oe)):fn=null}break t}}Nn=0,Qr=null,qc(o,l,A,5);break;case 6:Nn=0,Qr=null,qc(o,l,A,6);break;case 8:zg(),fi=6;break e;default:throw Error(r(462))}}Pd();break}catch(Je){j_(o,Je)}while(!0);return $r=co=null,j.H=m,j.A=x,Tn=h,fn!==null?0:(Fn=null,mn=0,jf(),fi)}function Pd(){for(;fn!==null&&!ie();)q_(fn)}function q_(o){var l=yd(o.alternate,o,Zo);o.memoizedProps=o.pendingProps,l===null?Nd(o):fn=l}function $_(o){var l=o,h=l.alternate;switch(l.tag){case 15:case 0:l=A_(h,l,l.pendingProps,l.type,void 0,mn);break;case 11:l=A_(h,l,l.pendingProps,l.type.render,l.ref,mn);break;case 5:nd(l);default:T_(h,l),l=fn=Om(l,Zo),l=yd(h,l,Zo)}o.memoizedProps=o.pendingProps,l===null?Nd(o):fn=l}function qc(o,l,h,m){$r=co=null,nd(l),Sc=null,qu=0;var x=l.return;try{if(M_(o,x,l,h,mn)){fi=1,Oc(o,ds(h,o.current)),fn=null;return}}catch(A){if(x!==null)throw fn=x,A;fi=1,Oc(o,ds(h,o.current)),fn=null;return}l.flags&32768?(on||m===1?o=!0:Wc||(mn&536870912)!==0?o=!1:(Ca=o=!0,(m===2||m===9||m===3||m===6)&&(m=li.current,m!==null&&m.tag===13&&(m.flags|=16384))),Z_(l,o)):Nd(l)}function Nd(o){var l=o;do{if((l.flags&32768)!==0){Z_(l,Ca);return}o=l.return;var h=kS(l.alternate,l,Zo);if(h!==null){fn=h;return}if(l=l.sibling,l!==null){fn=l;return}fn=l=o}while(l!==null);fi===0&&(fi=5)}function Z_(o,l){do{var h=GS(o.alternate,o);if(h!==null){h.flags&=32767,fn=h;return}if(h=o.return,h!==null&&(h.flags|=32768,h.subtreeFlags=0,h.deletions=null),!l&&(o=o.sibling,o!==null)){fn=o;return}fn=o=h}while(o!==null);fi=6,fn=null}function K_(o,l,h,m,x,A,D,W,he){o.cancelPendingCommit=null;do Id();while(Pi!==0);if((Tn&6)!==0)throw Error(r(327));if(l!==null){if(l===o.current)throw Error(r(177));if(A=l.lanes|l.childLanes,A|=wn,Di(o,h,A,D,W,he),o===Fn&&(fn=Fn=null,mn=0),Rl=l,Pa=o,Ko=h,jc=A,Og=x,G_=m,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,sv(G,function(){return Mh(),null})):(o.callbackNode=null,o.callbackPriority=0),m=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||m){m=j.T,j.T=null,x=J.p,J.p=2,D=Tn,Tn|=4;try{HS(o,l,h)}finally{Tn=D,J.p=x,j.T=m}}Pi=1,Q_(),J_(),ev()}}function Q_(){if(Pi===1){Pi=0;var o=Pa,l=Rl,h=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||h){h=j.T,j.T=null;var m=J.p;J.p=2;var x=Tn;Tn|=4;try{D_(l,o);var A=jg,D=J0(o.containerInfo),W=A.focusedElem,he=A.selectionRange;if(D!==W&&W&&W.ownerDocument&&Q0(W.ownerDocument.documentElement,W)){if(he!==null&&Pm(W)){var Oe=he.start,Je=he.end;if(Je===void 0&&(Je=Oe),"selectionStart"in W)W.selectionStart=Oe,W.selectionEnd=Math.min(Je,W.value.length);else{var ot=W.ownerDocument||document,ze=ot&&ot.defaultView||window;if(ze.getSelection){var Ye=ze.getSelection(),Ct=W.textContent.length,Gt=Math.min(he.start,Ct),In=he.end===void 0?Gt:Math.min(he.end,Ct);!Ye.extend&&Gt>In&&(D=In,In=Gt,Gt=D);var Te=Fu(W,Gt),ge=Fu(W,In);if(Te&&ge&&(Ye.rangeCount!==1||Ye.anchorNode!==Te.node||Ye.anchorOffset!==Te.offset||Ye.focusNode!==ge.node||Ye.focusOffset!==ge.offset)){var Ie=ot.createRange();Ie.setStart(Te.node,Te.offset),Ye.removeAllRanges(),Gt>In?(Ye.addRange(Ie),Ye.extend(ge.node,ge.offset)):(Ie.setEnd(ge.node,ge.offset),Ye.addRange(Ie))}}}}for(ot=[],Ye=W;Ye=Ye.parentNode;)Ye.nodeType===1&&ot.push({element:Ye,left:Ye.scrollLeft,top:Ye.scrollTop});for(typeof W.focus=="function"&&W.focus(),W=0;W<ot.length;W++){var it=ot[W];it.element.scrollLeft=it.left,it.element.scrollTop=it.top}}Ph=!!Bd,jg=Bd=null}finally{Tn=x,J.p=m,j.T=h}}o.current=l,Pi=2}}function J_(){if(Pi===2){Pi=0;var o=Pa,l=Rl,h=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||h){h=j.T,j.T=null;var m=J.p;J.p=2;var x=Tn;Tn|=4;try{L_(o,l.alternate,l)}finally{Tn=x,J.p=m,j.T=h}}Pi=3}}function ev(){if(Pi===4||Pi===3){Pi=0,Z();var o=Pa,l=Rl,h=Ko,m=G_;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?Pi=5:(Pi=0,Rl=Pa=null,tv(o,o.pendingLanes));var x=o.pendingLanes;if(x===0&&(La=null),Xr(h),l=l.stateNode,Ee&&typeof Ee.onCommitFiberRoot=="function")try{Ee.onCommitFiberRoot(De,l,void 0,(l.current.flags&128)===128)}catch{}if(m!==null){l=j.T,x=J.p,J.p=2,j.T=null;try{for(var A=o.onRecoverableError,D=0;D<m.length;D++){var W=m[D];A(W.value,{componentStack:W.stack})}}finally{j.T=l,J.p=x}}(Ko&3)!==0&&Id(),Qo(o),x=o.pendingLanes,(h&261930)!==0&&(x&42)!==0?o===Dg?bh++:(bh=0,Dg=o):bh=0,Pl(0,!1)}}function tv(o,l){(o.pooledCacheLanes&=l)===0&&(l=o.pooledCache,l!=null&&(o.pooledCache=null,Zr(l)))}function Id(){return Q_(),J_(),ev(),Mh()}function Mh(){if(Pi!==5)return!1;var o=Pa,l=jc;jc=0;var h=Xr(Ko),m=j.T,x=J.p;try{J.p=32>h?32:h,j.T=null,h=Og,Og=null;var A=Pa,D=Ko;if(Pi=0,Rl=Pa=null,Ko=0,(Tn&6)!==0)throw Error(r(331));var W=Tn;if(Tn|=4,wd(A.current),U_(A,A.current,D,h),Tn=W,Pl(0,!1),Ee&&typeof Ee.onPostCommitFiberRoot=="function")try{Ee.onPostCommitFiberRoot(De,A)}catch{}return!0}finally{J.p=x,j.T=m,tv(o,l)}}function nv(o,l,h){l=ds(h,l),l=pd(o.stateNode,l,2),o=vl(o,l,2),o!==null&&(Gn(o,2),Qo(o))}function Rn(o,l,h){if(o.tag===3)nv(o,o,h);else for(;l!==null;){if(l.tag===3){nv(l,o,h);break}else if(l.tag===1){var m=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(La===null||!La.has(m))){o=ds(h,o),h=ho(2),m=vl(l,h,2),m!==null&&(gg(h,m,l,o),Gn(m,2),Qo(m));break}}l=l.return}}function Od(o,l,h){var m=o.pingCache;if(m===null){m=o.pingCache=new XS;var x=new Set;m.set(l,x)}else x=m.get(l),x===void 0&&(x=new Set,m.set(l,x));x.has(h)||(Pg=!0,x.add(h),o=Fg.bind(null,o,l,h),l.then(o,o))}function Fg(o,l,h){var m=o.pingCache;m!==null&&m.delete(l),o.pingedLanes|=o.suspendedLanes&h,o.warmLanes&=~h,Fn===o&&(mn&h)===h&&(fi===4||fi===3&&(mn&62914560)===mn&&300>Ve()-Ed?(Tn&2)===0&&Yc(o,0):Ng|=h,Xc===mn&&(Xc=0)),Qo(o)}function kg(o,l){l===0&&(l=Nt()),o=ll(o,l),o!==null&&(Gn(o,l),Qo(o))}function iv(o){var l=o.memoizedState,h=0;l!==null&&(h=l.retryLane),kg(o,h)}function rv(o,l){var h=0;switch(o.tag){case 31:case 13:var m=o.stateNode,x=o.memoizedState;x!==null&&(h=x.retryLane);break;case 19:m=o.stateNode;break;case 22:m=o.stateNode._retryCache;break;default:throw Error(r(314))}m!==null&&m.delete(l),kg(o,h)}function sv(o,l){return Bt(o,l)}var Dd=null,$c=null,Gg=!1,Ll=!1,Zc=!1,Ia=0;function Qo(o){o!==$c&&o.next===null&&($c===null?Dd=$c=o:$c=$c.next=o),Ll=!0,Gg||(Gg=!0,$S())}function Pl(o,l){if(!Zc&&Ll){Zc=!0;do for(var h=!1,m=Dd;m!==null;){if(!l)if(o!==0){var x=m.pendingLanes;if(x===0)var A=0;else{var D=m.suspendedLanes,W=m.pingedLanes;A=(1<<31-nt(42|o)+1)-1,A&=x&~(D&~W),A=A&201326741?A&201326741|1:A?A|2:0}A!==0&&(h=!0,uv(m,A))}else A=mn,A=be(m,m===Fn?A:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(A&3)===0||Yt(m,A)||(h=!0,uv(m,A));m=m.next}while(h);Zc=!1}}function ov(){av()}function av(){Ll=Gg=!1;var o=0;Ia!==0&&yv()&&(o=Ia);for(var l=Ve(),h=null,m=Dd;m!==null;){var x=m.next,A=lv(m,l);A===0?(m.next=null,h===null?Dd=x:h.next=x,x===null&&($c=h)):(h=m,(o!==0||(A&3)!==0)&&(Ll=!0)),m=x}Pi!==0&&Pi!==5||Pl(o,!1),Ia!==0&&(Ia=0)}function lv(o,l){for(var h=o.suspendedLanes,m=o.pingedLanes,x=o.expirationTimes,A=o.pendingLanes&-62914561;0<A;){var D=31-nt(A),W=1<<D,he=x[D];he===-1?((W&h)===0||(W&m)!==0)&&(x[D]=ke(W,l)):he<=l&&(o.expiredLanes|=W),A&=~W}if(l=Fn,h=mn,h=be(o,o===l?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),m=o.callbackNode,h===0||o===l&&(Nn===2||Nn===9)||o.cancelPendingCommit!==null)return m!==null&&m!==null&&Ft(m),o.callbackNode=null,o.callbackPriority=0;if((h&3)===0||Yt(o,h)){if(l=h&-h,l===o.callbackPriority)return l;switch(m!==null&&Ft(m),Xr(h)){case 2:case 8:h=dt;break;case 32:h=G;break;case 268435456:h=Y;break;default:h=G}return m=cv.bind(null,o),h=Bt(h,m),o.callbackPriority=l,o.callbackNode=h,l}return m!==null&&m!==null&&Ft(m),o.callbackPriority=2,o.callbackNode=null,2}function cv(o,l){if(Pi!==0&&Pi!==5)return o.callbackNode=null,o.callbackPriority=0,null;var h=o.callbackNode;if(Id()&&o.callbackNode!==h)return null;var m=mn;return m=be(o,o===Fn?m:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),m===0?null:(W_(o,m,l),lv(o,Ve()),o.callbackNode!=null&&o.callbackNode===h?cv.bind(null,o):null)}function uv(o,l){if(Id())return null;W_(o,l,!0)}function $S(){Sv(function(){(Tn&6)!==0?Bt(gt,ov):av()})}function Hg(){if(Ia===0){var o=vc;o===0&&(o=Se,Se<<=1,(Se&261888)===0&&(Se=256)),Ia=o}return Ia}function hv(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Nf(""+o)}function fv(o,l){var h=l.ownerDocument.createElement("input");return h.name=l.name,h.value=l.value,o.id&&h.setAttribute("form",o.id),l.parentNode.insertBefore(h,l),o=new FormData(o),h.parentNode.removeChild(h),o}function ZS(o,l,h,m,x){if(l==="submit"&&h&&h.stateNode===x){var A=hv((x[Re]||null).action),D=m.submitter;D&&(l=(l=D[Re]||null)?hv(l.formAction):D.getAttribute("formAction"),l!==null&&(A=l,D=null));var W=new vi("action","action",null,m,x);o.push({event:W,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(Ia!==0){var he=D?fv(x,D):new FormData(x);ld(h,{pending:!0,data:he,method:x.method,action:A},null,he)}}else typeof A=="function"&&(W.preventDefault(),he=D?fv(x,D):new FormData(x),ld(h,{pending:!0,data:he,method:x.method,action:A},A,he))},currentTarget:x}]})}}for(var Wg=0;Wg<hc.length;Wg++){var Xg=hc[Wg];Ds(Xg.toLowerCase(),"on"+(Xg[0].toUpperCase()+Xg.slice(1)))}Ds(wt,"onAnimationEnd"),Ds(qt,"onAnimationIteration"),Ds(Mn,"onAnimationStart"),Ds("dblclick","onDoubleClick"),Ds("focusin","onFocus"),Ds("focusout","onBlur"),Ds(Li,"onTransitionRun"),Ds(Un,"onTransitionStart"),Ds(Im,"onTransitionCancel"),Ds(t_,"onTransitionEnd"),tn("onMouseEnter",["mouseout","mouseover"]),tn("onMouseLeave",["mouseout","mouseover"]),tn("onPointerEnter",["pointerout","pointerover"]),tn("onPointerLeave",["pointerout","pointerover"]),On("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),On("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),On("onBeforeInput",["compositionend","keypress","textInput","paste"]),On("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),On("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),On("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var wh="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(" "),Bs=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(wh));function dv(o,l){l=(l&4)!==0;for(var h=0;h<o.length;h++){var m=o[h],x=m.event;m=m.listeners;e:{var A=void 0;if(l)for(var D=m.length-1;0<=D;D--){var W=m[D],he=W.instance,Oe=W.currentTarget;if(W=W.listener,he!==A&&x.isPropagationStopped())break e;A=W,x.currentTarget=Oe;try{A(x)}catch(Je){Ro(Je)}x.currentTarget=null,A=he}else for(D=0;D<m.length;D++){if(W=m[D],he=W.instance,Oe=W.currentTarget,W=W.listener,he!==A&&x.isPropagationStopped())break e;A=W,x.currentTarget=Oe;try{A(x)}catch(Je){Ro(Je)}x.currentTarget=null,A=he}}}}function dn(o,l){var h=l[Ae];h===void 0&&(h=l[Ae]=new Set);var m=o+"__bubble";h.has(m)||(xr(l,o,2,!1),h.add(m))}function Jo(o,l,h){var m=0;l&&(m|=4),xr(h,o,m,l)}var $t="_reactListening"+Math.random().toString(36).slice(2);function pv(o){if(!o[$t]){o[$t]=!0,Ri.forEach(function(h){h!=="selectionchange"&&(Bs.has(h)||Jo(h,!1,o),Jo(h,!0,o))});var l=o.nodeType===9?o:o.ownerDocument;l===null||l[$t]||(l[$t]=!0,Jo("selectionchange",!1,l))}}function xr(o,l,h,m){switch(Nv(l)){case 2:var x=vb;break;case 8:x=yb;break;default:x=s1}h=x.bind(null,l,h,o),x=void 0,!Sm||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(x=!0),m?x!==void 0?o.addEventListener(l,h,{capture:!0,passive:x}):o.addEventListener(l,h,!0):x!==void 0?o.addEventListener(l,h,{passive:x}):o.addEventListener(l,h,!1)}function si(o,l,h,m,x){var A=m;if((l&1)===0&&(l&2)===0&&m!==null)e:for(;;){if(m===null)return;var D=m.tag;if(D===3||D===4){var W=m.stateNode.containerInfo;if(W===x)break;if(D===4)for(D=m.return;D!==null;){var he=D.tag;if((he===3||he===4)&&D.stateNode.containerInfo===x)return;D=D.return}for(;W!==null;){if(D=jt(W),D===null)return;if(he=D.tag,he===5||he===6||he===26||he===27){m=A=D;continue e}W=W.parentNode}}m=m.return}B0(function(){var Oe=A,Je=ym(h),ot=[];e:{var ze=qr.get(o);if(ze!==void 0){var Ye=vi,Ct=o;switch(o){case"keypress":if(Df(h)===0)break e;case"keydown":case"keyup":Ye=Vf;break;case"focusin":Ct="focus",Ye=Bf;break;case"focusout":Ct="blur",Ye=Bf;break;case"beforeblur":case"afterblur":Ye=Bf;break;case"click":if(h.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ye=Mm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ye=k0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ye=Qn;break;case wt:case qt:case Mn:Ye=G0;break;case t_:Ye=va;break;case"scroll":case"scrollend":Ye=il;break;case"wheel":Ye=wm;break;case"copy":case"cut":case"paste":Ye=H0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ye=Ff;break;case"toggle":case"beforetoggle":Ye=CS}var Gt=(l&4)!==0,In=!Gt&&(o==="scroll"||o==="scrollend"),Te=Gt?ze!==null?ze+"Capture":null:ze;Gt=[];for(var ge=Oe,Ie;ge!==null;){var it=ge;if(Ie=it.stateNode,it=it.tag,it!==5&&it!==26&&it!==27||Ie===null||Te===null||(it=Ou(ge,Te),it!=null&&Gt.push(Ah(ge,it,Ie))),In)break;ge=ge.return}0<Gt.length&&(ze=new Ye(ze,Ct,null,h,Je),ot.push({event:ze,listeners:Gt}))}}if((l&7)===0){e:{if(ze=o==="mouseover"||o==="pointerover",Ye=o==="mouseout"||o==="pointerout",ze&&h!==vm&&(Ct=h.relatedTarget||h.fromElement)&&(jt(Ct)||Ct[$e]))break e;if((Ye||ze)&&(ze=Je.window===Je?Je:(ze=Je.ownerDocument)?ze.defaultView||ze.parentWindow:window,Ye?(Ct=h.relatedTarget||h.toElement,Ye=Oe,Ct=Ct?jt(Ct):null,Ct!==null&&(In=a(Ct),Gt=Ct.tag,Ct!==In||Gt!==5&&Gt!==27&&Gt!==6)&&(Ct=null)):(Ye=null,Ct=Oe),Ye!==Ct)){if(Gt=Mm,it="onMouseLeave",Te="onMouseEnter",ge="mouse",(o==="pointerout"||o==="pointerover")&&(Gt=Ff,it="onPointerLeave",Te="onPointerEnter",ge="pointer"),In=Ye==null?ze:It(Ye),Ie=Ct==null?ze:It(Ct),ze=new Gt(it,ge+"leave",Ye,h,Je),ze.target=In,ze.relatedTarget=Ie,it=null,jt(Je)===Oe&&(Gt=new Gt(Te,ge+"enter",Ct,h,Je),Gt.target=Ie,Gt.relatedTarget=In,it=Gt),In=it,Ye&&Ct)t:{for(Gt=KS,Te=Ye,ge=Ct,Ie=0,it=Te;it;it=Gt(it))Ie++;it=0;for(var Ut=ge;Ut;Ut=Gt(Ut))it++;for(;0<Ie-it;)Te=Gt(Te),Ie--;for(;0<it-Ie;)ge=Gt(ge),it--;for(;Ie--;){if(Te===ge||ge!==null&&Te===ge.alternate){Gt=Te;break t}Te=Gt(Te),ge=Gt(ge)}Gt=null}else Gt=null;Ye!==null&&mv(ot,ze,Ye,Gt,!1),Ct!==null&&In!==null&&mv(ot,In,Ct,Gt,!0)}}e:{if(ze=Oe?It(Oe):window,Ye=ze.nodeName&&ze.nodeName.toLowerCase(),Ye==="select"||Ye==="input"&&ze.type==="file")var An=Gf;else if(Y0(ze))if(ac)An=NS;else{An=PS;var Lt=LS}else Ye=ze.nodeName,!Ye||Ye.toLowerCase()!=="input"||ze.type!=="checkbox"&&ze.type!=="radio"?Oe&&Pf(Oe.elementType)&&(An=Gf):An=lc;if(An&&(An=An(o,Oe))){kf(ot,An,h,Je);break e}Lt&&Lt(o,ze,Oe),o==="focusout"&&Oe&&ze.type==="number"&&Oe.memoizedProps.value!=null&&Iu(ze,"number",ze.value)}switch(Lt=Oe?It(Oe):window,o){case"focusin":(Y0(Lt)||Lt.contentEditable==="true")&&(or=Lt,Xf=Oe,ku=null);break;case"focusout":ku=Xf=or=null;break;case"mousedown":Nm=!0;break;case"contextmenu":case"mouseup":case"dragend":Nm=!1,e_(ot,h,Je);break;case"selectionchange":if(uc)break;case"keydown":case"keyup":e_(ot,h,Je)}var rn;if(Em)e:{switch(o){case"compositionstart":var gn="onCompositionStart";break e;case"compositionend":gn="onCompositionEnd";break e;case"compositionupdate":gn="onCompositionUpdate";break e}gn=void 0}else sl?X0(o,h)&&(gn="onCompositionEnd"):o==="keydown"&&h.keyCode===229&&(gn="onCompositionStart");gn&&(Tm&&h.locale!=="ko"&&(sl||gn!=="onCompositionStart"?gn==="onCompositionEnd"&&sl&&(rn=V0()):(xn=Je,bm="value"in xn?xn.value:xn.textContent,sl=!0)),Lt=Vs(Oe,gn),0<Lt.length&&(gn=new Rr(gn,o,null,h,Je),ot.push({event:gn,listeners:Lt}),rn?gn.data=rn:(rn=Cm(h),rn!==null&&(gn.data=rn)))),(rn=RS?Rm(o,h):Lm(o,h))&&(gn=Vs(Oe,"onBeforeInput"),0<gn.length&&(Lt=new Rr("onBeforeInput","beforeinput",null,h,Je),ot.push({event:Lt,listeners:gn}),Lt.data=rn)),ZS(ot,o,Oe,h,Je)}dv(ot,l)})}function Ah(o,l,h){return{instance:o,listener:l,currentTarget:h}}function Vs(o,l){for(var h=l+"Capture",m=[];o!==null;){var x=o,A=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||A===null||(x=Ou(o,h),x!=null&&m.unshift(Ah(o,x,A)),x=Ou(o,l),x!=null&&m.push(Ah(o,x,A))),o.tag===3)return m;o=o.return}return[]}function KS(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function mv(o,l,h,m,x){for(var A=l._reactName,D=[];h!==null&&h!==m;){var W=h,he=W.alternate,Oe=W.stateNode;if(W=W.tag,he!==null&&he===m)break;W!==5&&W!==26&&W!==27||Oe===null||(he=Oe,x?(Oe=Ou(h,A),Oe!=null&&D.unshift(Ah(h,Oe,he))):x||(Oe=Ou(h,A),Oe!=null&&D.push(Ah(h,Oe,he)))),h=h.return}D.length!==0&&o.push({event:l,listeners:D})}var QS=/\r\n?/g,JS=/\u0000|\uFFFD/g;function gv(o){return(typeof o=="string"?o:""+o).replace(QS,`
`).replace(JS,"")}function zd(o,l){return l=gv(l),gv(o)===l}function zn(o,l,h,m,x,A){switch(h){case"children":typeof m=="string"?l==="body"||l==="textarea"&&m===""||rc(o,m):(typeof m=="number"||typeof m=="bigint")&&l!=="body"&&rc(o,""+m);break;case"className":no(o,"class",m);break;case"tabIndex":no(o,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":no(o,h,m);break;case"style":_m(o,m,A);break;case"data":if(l!=="object"){no(o,"data",m);break}case"src":case"href":if(m===""&&(l!=="a"||h!=="href")){o.removeAttribute(h);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){o.removeAttribute(h);break}m=Nf(""+m),o.setAttribute(h,m);break;case"action":case"formAction":if(typeof m=="function"){o.setAttribute(h,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof A=="function"&&(h==="formAction"?(l!=="input"&&zn(o,l,"name",x.name,x,null),zn(o,l,"formEncType",x.formEncType,x,null),zn(o,l,"formMethod",x.formMethod,x,null),zn(o,l,"formTarget",x.formTarget,x,null)):(zn(o,l,"encType",x.encType,x,null),zn(o,l,"method",x.method,x,null),zn(o,l,"target",x.target,x,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){o.removeAttribute(h);break}m=Nf(""+m),o.setAttribute(h,m);break;case"onClick":m!=null&&(o.onclick=io);break;case"onScroll":m!=null&&dn("scroll",o);break;case"onScrollEnd":m!=null&&dn("scrollend",o);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(h=m.__html,h!=null){if(x.children!=null)throw Error(r(60));o.innerHTML=h}}break;case"multiple":o.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":o.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){o.removeAttribute("xlink:href");break}h=Nf(""+m),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",h);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":m!=null&&typeof m!="function"&&typeof m!="symbol"?o.setAttribute(h,""+m):o.removeAttribute(h);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":m&&typeof m!="function"&&typeof m!="symbol"?o.setAttribute(h,""):o.removeAttribute(h);break;case"capture":case"download":m===!0?o.setAttribute(h,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?o.setAttribute(h,m):o.removeAttribute(h);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?o.setAttribute(h,m):o.removeAttribute(h);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?o.removeAttribute(h):o.setAttribute(h,m);break;case"popover":dn("beforetoggle",o),dn("toggle",o),Is(o,"popover",m);break;case"xlinkActuate":Xn(o,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":Xn(o,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":Xn(o,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":Xn(o,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":Xn(o,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":Xn(o,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":Xn(o,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":Xn(o,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":Xn(o,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":Is(o,"is",m);break;case"innerText":case"textContent":break;default:(!(2<h.length)||h[0]!=="o"&&h[0]!=="O"||h[1]!=="n"&&h[1]!=="N")&&(h=wS.get(h)||h,Is(o,h,m))}}function Fs(o,l,h,m,x,A){switch(h){case"style":_m(o,m,A);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(h=m.__html,h!=null){if(x.children!=null)throw Error(r(60));o.innerHTML=h}}break;case"children":typeof m=="string"?rc(o,m):(typeof m=="number"||typeof m=="bigint")&&rc(o,""+m);break;case"onScroll":m!=null&&dn("scroll",o);break;case"onScrollEnd":m!=null&&dn("scrollend",o);break;case"onClick":m!=null&&(o.onclick=io);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Hi.hasOwnProperty(h))e:{if(h[0]==="o"&&h[1]==="n"&&(x=h.endsWith("Capture"),l=h.slice(2,x?h.length-7:void 0),A=o[Re]||null,A=A!=null?A[h]:null,typeof A=="function"&&o.removeEventListener(l,A,x),typeof m=="function")){typeof A!="function"&&A!==null&&(h in o?o[h]=null:o.hasAttribute(h)&&o.removeAttribute(h)),o.addEventListener(l,m,x);break e}h in o?o[h]=m:m===!0?o.setAttribute(h,""):Is(o,h,m)}}}function Fi(o,l,h){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":dn("error",o),dn("load",o);var m=!1,x=!1,A;for(A in h)if(h.hasOwnProperty(A)){var D=h[A];if(D!=null)switch(A){case"src":m=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:zn(o,l,A,D,h,null)}}x&&zn(o,l,"srcSet",h.srcSet,h,null),m&&zn(o,l,"src",h.src,h,null);return;case"input":dn("invalid",o);var W=A=D=x=null,he=null,Oe=null;for(m in h)if(h.hasOwnProperty(m)){var Je=h[m];if(Je!=null)switch(m){case"name":x=Je;break;case"type":D=Je;break;case"checked":he=Je;break;case"defaultChecked":Oe=Je;break;case"value":A=Je;break;case"defaultValue":W=Je;break;case"children":case"dangerouslySetInnerHTML":if(Je!=null)throw Error(r(137,l));break;default:zn(o,l,m,Je,h,null)}}Lf(o,A,W,he,Oe,D,x,!1);return;case"select":dn("invalid",o),m=D=A=null;for(x in h)if(h.hasOwnProperty(x)&&(W=h[x],W!=null))switch(x){case"value":A=W;break;case"defaultValue":D=W;break;case"multiple":m=W;default:zn(o,l,x,W,h,null)}l=A,h=D,o.multiple=!!m,l!=null?Os(o,!!m,l,!1):h!=null&&Os(o,!!m,h,!0);return;case"textarea":dn("invalid",o),A=x=m=null;for(D in h)if(h.hasOwnProperty(D)&&(W=h[D],W!=null))switch(D){case"value":m=W;break;case"defaultValue":x=W;break;case"children":A=W;break;case"dangerouslySetInnerHTML":if(W!=null)throw Error(r(91));break;default:zn(o,l,D,W,h,null)}mm(o,m,x,A);return;case"option":for(he in h)h.hasOwnProperty(he)&&(m=h[he],m!=null)&&(he==="selected"?o.selected=m&&typeof m!="function"&&typeof m!="symbol":zn(o,l,he,m,h,null));return;case"dialog":dn("beforetoggle",o),dn("toggle",o),dn("cancel",o),dn("close",o);break;case"iframe":case"object":dn("load",o);break;case"video":case"audio":for(m=0;m<wh.length;m++)dn(wh[m],o);break;case"image":dn("error",o),dn("load",o);break;case"details":dn("toggle",o);break;case"embed":case"source":case"link":dn("error",o),dn("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Oe in h)if(h.hasOwnProperty(Oe)&&(m=h[Oe],m!=null))switch(Oe){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:zn(o,l,Oe,m,h,null)}return;default:if(Pf(l)){for(Je in h)h.hasOwnProperty(Je)&&(m=h[Je],m!==void 0&&Fs(o,l,Je,m,h,void 0));return}}for(W in h)h.hasOwnProperty(W)&&(m=h[W],m!=null&&zn(o,l,W,m,h,null))}function Ud(o,l,h,m){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,A=null,D=null,W=null,he=null,Oe=null,Je=null;for(Ye in h){var ot=h[Ye];if(h.hasOwnProperty(Ye)&&ot!=null)switch(Ye){case"checked":break;case"value":break;case"defaultValue":he=ot;default:m.hasOwnProperty(Ye)||zn(o,l,Ye,null,m,ot)}}for(var ze in m){var Ye=m[ze];if(ot=h[ze],m.hasOwnProperty(ze)&&(Ye!=null||ot!=null))switch(ze){case"type":A=Ye;break;case"name":x=Ye;break;case"checked":Oe=Ye;break;case"defaultChecked":Je=Ye;break;case"value":D=Ye;break;case"defaultValue":W=Ye;break;case"children":case"dangerouslySetInnerHTML":if(Ye!=null)throw Error(r(137,l));break;default:Ye!==ot&&zn(o,l,ze,Ye,m,ot)}}Rf(o,D,W,he,Oe,Je,A,x);return;case"select":Ye=D=W=ze=null;for(A in h)if(he=h[A],h.hasOwnProperty(A)&&he!=null)switch(A){case"value":break;case"multiple":Ye=he;default:m.hasOwnProperty(A)||zn(o,l,A,null,m,he)}for(x in m)if(A=m[x],he=h[x],m.hasOwnProperty(x)&&(A!=null||he!=null))switch(x){case"value":ze=A;break;case"defaultValue":W=A;break;case"multiple":D=A;default:A!==he&&zn(o,l,x,A,m,he)}l=W,h=D,m=Ye,ze!=null?Os(o,!!h,ze,!1):!!m!=!!h&&(l!=null?Os(o,!!h,l,!0):Os(o,!!h,h?[]:"",!1));return;case"textarea":Ye=ze=null;for(W in h)if(x=h[W],h.hasOwnProperty(W)&&x!=null&&!m.hasOwnProperty(W))switch(W){case"value":break;case"children":break;default:zn(o,l,W,null,m,x)}for(D in m)if(x=m[D],A=h[D],m.hasOwnProperty(D)&&(x!=null||A!=null))switch(D){case"value":ze=x;break;case"defaultValue":Ye=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:x!==A&&zn(o,l,D,x,m,A)}pm(o,ze,Ye);return;case"option":for(var Ct in h)ze=h[Ct],h.hasOwnProperty(Ct)&&ze!=null&&!m.hasOwnProperty(Ct)&&(Ct==="selected"?o.selected=!1:zn(o,l,Ct,null,m,ze));for(he in m)ze=m[he],Ye=h[he],m.hasOwnProperty(he)&&ze!==Ye&&(ze!=null||Ye!=null)&&(he==="selected"?o.selected=ze&&typeof ze!="function"&&typeof ze!="symbol":zn(o,l,he,ze,m,Ye));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Gt in h)ze=h[Gt],h.hasOwnProperty(Gt)&&ze!=null&&!m.hasOwnProperty(Gt)&&zn(o,l,Gt,null,m,ze);for(Oe in m)if(ze=m[Oe],Ye=h[Oe],m.hasOwnProperty(Oe)&&ze!==Ye&&(ze!=null||Ye!=null))switch(Oe){case"children":case"dangerouslySetInnerHTML":if(ze!=null)throw Error(r(137,l));break;default:zn(o,l,Oe,ze,m,Ye)}return;default:if(Pf(l)){for(var In in h)ze=h[In],h.hasOwnProperty(In)&&ze!==void 0&&!m.hasOwnProperty(In)&&Fs(o,l,In,void 0,m,ze);for(Je in m)ze=m[Je],Ye=h[Je],!m.hasOwnProperty(Je)||ze===Ye||ze===void 0&&Ye===void 0||Fs(o,l,Je,ze,m,Ye);return}}for(var Te in h)ze=h[Te],h.hasOwnProperty(Te)&&ze!=null&&!m.hasOwnProperty(Te)&&zn(o,l,Te,null,m,ze);for(ot in m)ze=m[ot],Ye=h[ot],!m.hasOwnProperty(ot)||ze===Ye||ze==null&&Ye==null||zn(o,l,ot,ze,m,Ye)}function ti(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function di(){if(typeof performance.getEntriesByType=="function"){for(var o=0,l=0,h=performance.getEntriesByType("resource"),m=0;m<h.length;m++){var x=h[m],A=x.transferSize,D=x.initiatorType,W=x.duration;if(A&&W&&ti(D)){for(D=0,W=x.responseEnd,m+=1;m<h.length;m++){var he=h[m],Oe=he.startTime;if(Oe>W)break;var Je=he.transferSize,ot=he.initiatorType;Je&&ti(ot)&&(he=he.responseEnd,D+=Je*(he<W?1:(W-Oe)/(he-Oe)))}if(--m,l+=8*(A+D)/(x.duration/1e3),o++,10<o)break}}if(0<o)return l/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var Bd=null,jg=null;function Vd(o){return o.nodeType===9?o:o.ownerDocument}function _v(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function vv(o,l){if(o===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&l==="foreignObject"?0:o}function Yg(o,l){return o==="textarea"||o==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var qg=null;function yv(){var o=window.event;return o&&o.type==="popstate"?o===qg?!1:(qg=o,!0):(qg=null,!1)}var Kc=typeof setTimeout=="function"?setTimeout:void 0,$g=typeof clearTimeout=="function"?clearTimeout:void 0,xv=typeof Promise=="function"?Promise:void 0,Sv=typeof queueMicrotask=="function"?queueMicrotask:typeof xv<"u"?function(o){return xv.resolve(null).then(o).catch(Fd)}:Kc;function Fd(o){setTimeout(function(){throw o})}function Ai(o){return o==="head"}function Nl(o,l){var h=l,m=0;do{var x=h.nextSibling;if(o.removeChild(h),x&&x.nodeType===8)if(h=x.data,h==="/$"||h==="/&"){if(m===0){o.removeChild(x),Ba(l);return}m--}else if(h==="$"||h==="$?"||h==="$~"||h==="$!"||h==="&")m++;else if(h==="html")Eh(o.ownerDocument.documentElement);else if(h==="head"){h=o.ownerDocument.head,Eh(h);for(var A=h.firstChild;A;){var D=A.nextSibling,W=A.nodeName;A[Rt]||W==="SCRIPT"||W==="STYLE"||W==="LINK"&&A.rel.toLowerCase()==="stylesheet"||h.removeChild(A),A=D}}else h==="body"&&Eh(o.ownerDocument.body);h=x}while(h);Ba(l)}function bv(o,l){var h=o;o=0;do{var m=h.nextSibling;if(h.nodeType===1?l?(h._stashedDisplay=h.style.display,h.style.display="none"):(h.style.display=h._stashedDisplay||"",h.getAttribute("style")===""&&h.removeAttribute("style")):h.nodeType===3&&(l?(h._stashedText=h.nodeValue,h.nodeValue=""):h.nodeValue=h._stashedText||""),m&&m.nodeType===8)if(h=m.data,h==="/$"){if(o===0)break;o--}else h!=="$"&&h!=="$?"&&h!=="$~"&&h!=="$!"||o++;h=m}while(h)}function Zg(o){var l=o.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var h=l;switch(l=l.nextSibling,h.nodeName){case"HTML":case"HEAD":case"BODY":Zg(h),Vt(h);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(h.rel.toLowerCase()==="stylesheet")continue}o.removeChild(h)}}function eb(o,l,h,m){for(;o.nodeType===1;){var x=h;if(o.nodeName.toLowerCase()!==l.toLowerCase()){if(!m&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(m){if(!o[Rt])switch(l){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(A=o.getAttribute("rel"),A==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(A!==x.rel||o.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||o.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||o.getAttribute("title")!==(x.title==null?null:x.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(A=o.getAttribute("src"),(A!==(x.src==null?null:x.src)||o.getAttribute("type")!==(x.type==null?null:x.type)||o.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&A&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(l==="input"&&o.type==="hidden"){var A=x.name==null?null:""+x.name;if(x.type==="hidden"&&o.getAttribute("name")===A)return o}else return o;if(o=es(o.nextSibling),o===null)break}return null}function tb(o,l,h){if(l==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!h||(o=es(o.nextSibling),o===null))return null;return o}function Mv(o,l){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!l||(o=es(o.nextSibling),o===null))return null;return o}function kd(o){return o.data==="$?"||o.data==="$~"}function ks(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function nn(o,l){var h=o.ownerDocument;if(o.data==="$~")o._reactRetry=l;else if(o.data!=="$?"||h.readyState!=="loading")l();else{var m=function(){l(),h.removeEventListener("DOMContentLoaded",m)};h.addEventListener("DOMContentLoaded",m),o._reactRetry=m}}function es(o){for(;o!=null;o=o.nextSibling){var l=o.nodeType;if(l===1||l===3)break;if(l===8){if(l=o.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return o}var Vr=null;function Kg(o){o=o.nextSibling;for(var l=0;o;){if(o.nodeType===8){var h=o.data;if(h==="/$"||h==="/&"){if(l===0)return es(o.nextSibling);l--}else h!=="$"&&h!=="$!"&&h!=="$?"&&h!=="$~"&&h!=="&"||l++}o=o.nextSibling}return null}function wv(o){o=o.previousSibling;for(var l=0;o;){if(o.nodeType===8){var h=o.data;if(h==="$"||h==="$!"||h==="$?"||h==="$~"||h==="&"){if(l===0)return o;l--}else h!=="/$"&&h!=="/&"||l++}o=o.previousSibling}return null}function Cn(o,l,h){switch(l=Vd(h),o){case"html":if(o=l.documentElement,!o)throw Error(r(452));return o;case"head":if(o=l.head,!o)throw Error(r(453));return o;case"body":if(o=l.body,!o)throw Error(r(454));return o;default:throw Error(r(451))}}function Eh(o){for(var l=o.attributes;l.length;)o.removeAttributeNode(l[0]);Vt(o)}var ts=new Map,Qg=new Set;function Qc(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var ea=J.d;J.d={f:nb,r:ib,D:rb,C:sb,L:ob,m:ab,X:cb,S:lb,M:ub};function nb(){var o=ea.f(),l=Rd();return o||l}function ib(o){var l=zt(o);l!==null&&l.tag===5&&l.type==="form"?_r(l):ea.r(o)}var Jc=typeof document>"u"?null:document;function Av(o,l,h){var m=Jc;if(m&&typeof l=="string"&&l){var x=hs(l);x='link[rel="'+o+'"][href="'+x+'"]',typeof h=="string"&&(x+='[crossorigin="'+h+'"]'),Qg.has(x)||(Qg.add(x),o={rel:o,crossOrigin:h,href:l},m.querySelector(x)===null&&(l=m.createElement("link"),Fi(l,"link",o),Kt(l),m.head.appendChild(l)))}}function rb(o){ea.D(o),Av("dns-prefetch",o,null)}function sb(o,l){ea.C(o,l),Av("preconnect",o,l)}function ob(o,l,h){ea.L(o,l,h);var m=Jc;if(m&&o&&l){var x='link[rel="preload"][as="'+hs(l)+'"]';l==="image"&&h&&h.imageSrcSet?(x+='[imagesrcset="'+hs(h.imageSrcSet)+'"]',typeof h.imageSizes=="string"&&(x+='[imagesizes="'+hs(h.imageSizes)+'"]')):x+='[href="'+hs(o)+'"]';var A=x;switch(l){case"style":A=eu(o);break;case"script":A=tu(o)}ts.has(A)||(o=v({rel:"preload",href:l==="image"&&h&&h.imageSrcSet?void 0:o,as:l},h),ts.set(A,o),m.querySelector(x)!==null||l==="style"&&m.querySelector(Il(A))||l==="script"&&m.querySelector(pi(A))||(l=m.createElement("link"),Fi(l,"link",o),Kt(l),m.head.appendChild(l)))}}function ab(o,l){ea.m(o,l);var h=Jc;if(h&&o){var m=l&&typeof l.as=="string"?l.as:"script",x='link[rel="modulepreload"][as="'+hs(m)+'"][href="'+hs(o)+'"]',A=x;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":A=tu(o)}if(!ts.has(A)&&(o=v({rel:"modulepreload",href:o},l),ts.set(A,o),h.querySelector(x)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(h.querySelector(pi(A)))return}m=h.createElement("link"),Fi(m,"link",o),Kt(m),h.head.appendChild(m)}}}function lb(o,l,h){ea.S(o,l,h);var m=Jc;if(m&&o){var x=yn(m).hoistableStyles,A=eu(o);l=l||"default";var D=x.get(A);if(!D){var W={loading:0,preload:null};if(D=m.querySelector(Il(A)))W.loading=5;else{o=v({rel:"stylesheet",href:o,"data-precedence":l},h),(h=ts.get(A))&&Jg(o,h);var he=D=m.createElement("link");Kt(he),Fi(he,"link",o),he._p=new Promise(function(Oe,Je){he.onload=Oe,he.onerror=Je}),he.addEventListener("load",function(){W.loading|=1}),he.addEventListener("error",function(){W.loading|=2}),W.loading|=4,Hd(D,l,m)}D={type:"stylesheet",instance:D,count:1,state:W},x.set(A,D)}}}function cb(o,l){ea.X(o,l);var h=Jc;if(h&&o){var m=yn(h).hoistableScripts,x=tu(o),A=m.get(x);A||(A=h.querySelector(pi(x)),A||(o=v({src:o,async:!0},l),(l=ts.get(x))&&e1(o,l),A=h.createElement("script"),Kt(A),Fi(A,"link",o),h.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},m.set(x,A))}}function ub(o,l){ea.M(o,l);var h=Jc;if(h&&o){var m=yn(h).hoistableScripts,x=tu(o),A=m.get(x);A||(A=h.querySelector(pi(x)),A||(o=v({src:o,async:!0,type:"module"},l),(l=ts.get(x))&&e1(o,l),A=h.createElement("script"),Kt(A),Fi(A,"link",o),h.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},m.set(x,A))}}function Gd(o,l,h,m){var x=(x=Fe.current)?Qc(x):null;if(!x)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof h.precedence=="string"&&typeof h.href=="string"?(l=eu(h.href),h=yn(x).hoistableStyles,m=h.get(l),m||(m={type:"style",instance:null,count:0,state:null},h.set(l,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(h.rel==="stylesheet"&&typeof h.href=="string"&&typeof h.precedence=="string"){o=eu(h.href);var A=yn(x).hoistableStyles,D=A.get(o);if(D||(x=x.ownerDocument||x,D={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},A.set(o,D),(A=x.querySelector(Il(o)))&&!A._p&&(D.instance=A,D.state.loading=5),ts.has(o)||(h={rel:"preload",as:"style",href:h.href,crossOrigin:h.crossOrigin,integrity:h.integrity,media:h.media,hrefLang:h.hrefLang,referrerPolicy:h.referrerPolicy},ts.set(o,h),A||hb(x,o,h,D.state))),l&&m===null)throw Error(r(528,""));return D}if(l&&m!==null)throw Error(r(529,""));return null;case"script":return l=h.async,h=h.src,typeof h=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=tu(h),h=yn(x).hoistableScripts,m=h.get(l),m||(m={type:"script",instance:null,count:0,state:null},h.set(l,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function eu(o){return'href="'+hs(o)+'"'}function Il(o){return'link[rel="stylesheet"]['+o+"]"}function Ev(o){return v({},o,{"data-precedence":o.precedence,precedence:null})}function hb(o,l,h,m){o.querySelector('link[rel="preload"][as="style"]['+l+"]")?m.loading=1:(l=o.createElement("link"),m.preload=l,l.addEventListener("load",function(){return m.loading|=1}),l.addEventListener("error",function(){return m.loading|=2}),Fi(l,"link",h),Kt(l),o.head.appendChild(l))}function tu(o){return'[src="'+hs(o)+'"]'}function pi(o){return"script[async]"+o}function Sr(o,l,h){if(l.count++,l.instance===null)switch(l.type){case"style":var m=o.querySelector('style[data-href~="'+hs(h.href)+'"]');if(m)return l.instance=m,Kt(m),m;var x=v({},h,{"data-href":h.href,"data-precedence":h.precedence,href:null,precedence:null});return m=(o.ownerDocument||o).createElement("style"),Kt(m),Fi(m,"style",x),Hd(m,h.precedence,o),l.instance=m;case"stylesheet":x=eu(h.href);var A=o.querySelector(Il(x));if(A)return l.state.loading|=4,l.instance=A,Kt(A),A;m=Ev(h),(x=ts.get(x))&&Jg(m,x),A=(o.ownerDocument||o).createElement("link"),Kt(A);var D=A;return D._p=new Promise(function(W,he){D.onload=W,D.onerror=he}),Fi(A,"link",m),l.state.loading|=4,Hd(A,h.precedence,o),l.instance=A;case"script":return A=tu(h.src),(x=o.querySelector(pi(A)))?(l.instance=x,Kt(x),x):(m=h,(x=ts.get(A))&&(m=v({},h),e1(m,x)),o=o.ownerDocument||o,x=o.createElement("script"),Kt(x),Fi(x,"link",m),o.head.appendChild(x),l.instance=x);case"void":return null;default:throw Error(r(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(m=l.instance,l.state.loading|=4,Hd(m,h.precedence,o));return l.instance}function Hd(o,l,h){for(var m=h.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=m.length?m[m.length-1]:null,A=x,D=0;D<m.length;D++){var W=m[D];if(W.dataset.precedence===l)A=W;else if(A!==x)break}A?A.parentNode.insertBefore(o,A.nextSibling):(l=h.nodeType===9?h.head:h,l.insertBefore(o,l.firstChild))}function Jg(o,l){o.crossOrigin??=l.crossOrigin,o.referrerPolicy??=l.referrerPolicy,o.title??=l.title}function e1(o,l){o.crossOrigin??=l.crossOrigin,o.referrerPolicy??=l.referrerPolicy,o.integrity??=l.integrity}var Th=null;function Tv(o,l,h){if(Th===null){var m=new Map,x=Th=new Map;x.set(h,m)}else x=Th,m=x.get(h),m||(m=new Map,x.set(h,m));if(m.has(o))return m;for(m.set(o,null),h=h.getElementsByTagName(o),x=0;x<h.length;x++){var A=h[x];if(!(A[Rt]||A[K]||o==="link"&&A.getAttribute("rel")==="stylesheet")&&A.namespaceURI!=="http://www.w3.org/2000/svg"){var D=A.getAttribute(l)||"";D=o+D;var W=m.get(D);W?W.push(A):m.set(D,[A])}}return m}function Cv(o,l,h){o=o.ownerDocument||o,o.head.insertBefore(h,l==="title"?o.querySelector("head > title"):null)}function fb(o,l,h){if(h===1||l.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;return l.rel==="stylesheet"?(o=l.disabled,typeof l.precedence=="string"&&o==null):!0;case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function t1(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function db(o,l,h,m){if(h.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(h.state.loading&4)===0){if(h.instance===null){var x=eu(m.href),A=l.querySelector(Il(x));if(A){l=A._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(o.count++,o=Ch.bind(o),l.then(o,o)),h.state.loading|=4,h.instance=A,Kt(A);return}A=l.ownerDocument||l,m=Ev(m),(x=ts.get(x))&&Jg(m,x),A=A.createElement("link"),Kt(A);var D=A;D._p=new Promise(function(W,he){D.onload=W,D.onerror=he}),Fi(A,"link",m),h.instance=A}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(h,l),(l=h.state.preload)&&(h.state.loading&3)===0&&(o.count++,h=Ch.bind(o),l.addEventListener("load",h),l.addEventListener("error",h))}}var n1=0;function pb(o,l){return o.stylesheets&&o.count===0&&Wd(o,o.stylesheets),0<o.count||0<o.imgCount?function(h){var m=setTimeout(function(){if(o.stylesheets&&Wd(o,o.stylesheets),o.unsuspend){var A=o.unsuspend;o.unsuspend=null,A()}},6e4+l);0<o.imgBytes&&n1===0&&(n1=62500*di());var x=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&Wd(o,o.stylesheets),o.unsuspend)){var A=o.unsuspend;o.unsuspend=null,A()}},(o.imgBytes>n1?50:800)+l);return o.unsuspend=h,function(){o.unsuspend=null,clearTimeout(m),clearTimeout(x)}}:null}function Ch(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Wd(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Rh=null;function Wd(o,l){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Rh=new Map,l.forEach(mb,o),Rh=null,Ch.call(o))}function mb(o,l){if(!(l.state.loading&4)){var h=Rh.get(o);if(h)var m=h.get(null);else{h=new Map,Rh.set(o,h);for(var x=o.querySelectorAll("link[data-precedence],style[data-precedence]"),A=0;A<x.length;A++){var D=x[A];(D.nodeName==="LINK"||D.getAttribute("media")!=="not all")&&(h.set(D.dataset.precedence,D),m=D)}m&&h.set(null,m)}x=l.instance,D=x.getAttribute("data-precedence"),A=h.get(D)||m,A===m&&h.set(null,x),h.set(D,x),this.count++,m=Ch.bind(this),x.addEventListener("load",m),x.addEventListener("error",m),A?A.parentNode.insertBefore(x,A.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(x,o.firstChild)),l.state.loading|=4}}var Lh={$$typeof:C,Provider:null,Consumer:null,_currentValue:xe,_currentValue2:xe,_threadCount:0};function gb(o,l,h,m,x,A,D,W,he){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=hn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=hn(0),this.hiddenUpdates=hn(null),this.identifierPrefix=m,this.onUncaughtError=x,this.onCaughtError=A,this.onRecoverableError=D,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=he,this.incompleteTransitions=new Map}function nu(o,l,h,m,x,A,D,W,he,Oe,Je,ot){return o=new gb(o,l,h,D,he,Oe,Je,ot,W),l=1,A===!0&&(l|=24),A=ar(3,null,null,l),o.current=A,A.stateNode=o,l=Fm(),l.refCount++,o.pooledCache=l,l.refCount++,A.memoizedState={element:m,isDehydrated:h,cache:l},$u(A),o}function _b(o){return o?(o=Po,o):Po}function Rv(o,l,h,m,x,A){x=_b(x),m.context===null?m.context=x:m.pendingContext=x,m=zi(l),m.payload={element:h},A=A===void 0?null:A,A!==null&&(m.callback=A),h=vl(o,m,l),h!==null&&(Br(h,o,l),Mc(h,o,l))}function Lv(o,l){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var h=o.retryLane;o.retryLane=h!==0&&h<l?h:l}}function i1(o,l){Lv(o,l),(o=o.alternate)&&Lv(o,l)}function Pv(o){if(o.tag===13||o.tag===31){var l=ll(o,67108864);l!==null&&Br(l,o,67108864),i1(o,67108864)}}function r1(o){if(o.tag===13||o.tag===31){var l=vs();l=mi(l);var h=ll(o,l);h!==null&&Br(h,o,l),i1(o,l)}}var Ph=!0;function vb(o,l,h,m){var x=j.T;j.T=null;var A=J.p;try{J.p=2,s1(o,l,h,m)}finally{J.p=A,j.T=x}}function yb(o,l,h,m){var x=j.T;j.T=null;var A=J.p;try{J.p=8,s1(o,l,h,m)}finally{J.p=A,j.T=x}}function s1(o,l,h,m){if(Ph){var x=o1(m);if(x===null)si(o,l,m,Xd,h),Iv(o,m);else if(Sb(x,o,l,h,m))m.stopPropagation();else if(Iv(o,m),l&4&&-1<xb.indexOf(o)){for(;x!==null;){var A=zt(x);if(A!==null)switch(A.tag){case 3:if(A=A.stateNode,A.current.memoizedState.isDehydrated){var D=At(A.pendingLanes);if(D!==0){var W=A;for(W.pendingLanes|=2,W.entangledLanes|=2;D;){var he=1<<31-nt(D);W.entanglements[1]|=he,D&=~he}Qo(A),(Tn&6)===0&&(Td=Ve()+500,Pl(0,!1))}}break;case 31:case 13:W=ll(A,2),W!==null&&Br(W,A,2),Rd(),i1(A,2)}if(A=o1(m),A===null&&si(o,l,m,Xd,h),A===x)break;x=A}x!==null&&m.stopPropagation()}else si(o,l,m,null,h)}}function o1(o){return o=ym(o),a1(o)}var Xd=null;function a1(o){if(Xd=null,o=jt(o),o!==null){var l=a(o);if(l===null)o=null;else{var h=l.tag;if(h===13){if(o=c(l),o!==null)return o;o=null}else if(h===31){if(o=u(l),o!==null)return o;o=null}else if(h===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;o=null}else l!==o&&(o=null)}}return Xd=o,null}function Nv(o){switch(o){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ut()){case gt:return 2;case dt:return 8;case G:case q:return 32;case Y:return 268435456;default:return 32}default:return 32}}var l1=!1,Oa=null,Da=null,za=null,Nh=new Map,Ih=new Map,Ua=[],xb="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".split(" ");function Iv(o,l){switch(o){case"focusin":case"focusout":Oa=null;break;case"dragenter":case"dragleave":Da=null;break;case"mouseover":case"mouseout":za=null;break;case"pointerover":case"pointerout":Nh.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ih.delete(l.pointerId)}}function Oh(o,l,h,m,x,A){return o===null||o.nativeEvent!==A?(o={blockedOn:l,domEventName:h,eventSystemFlags:m,nativeEvent:A,targetContainers:[x]},l!==null&&(l=zt(l),l!==null&&Pv(l)),o):(o.eventSystemFlags|=m,l=o.targetContainers,x!==null&&l.indexOf(x)===-1&&l.push(x),o)}function Sb(o,l,h,m,x){switch(l){case"focusin":return Oa=Oh(Oa,o,l,h,m,x),!0;case"dragenter":return Da=Oh(Da,o,l,h,m,x),!0;case"mouseover":return za=Oh(za,o,l,h,m,x),!0;case"pointerover":var A=x.pointerId;return Nh.set(A,Oh(Nh.get(A)||null,o,l,h,m,x)),!0;case"gotpointercapture":return A=x.pointerId,Ih.set(A,Oh(Ih.get(A)||null,o,l,h,m,x)),!0}return!1}function Ov(o){var l=jt(o.target);if(l!==null){var h=a(l);if(h!==null){if(l=h.tag,l===13){if(l=c(h),l!==null){o.blockedOn=l,Ps(o.priority,function(){r1(h)});return}}else if(l===31){if(l=u(h),l!==null){o.blockedOn=l,Ps(o.priority,function(){r1(h)});return}}else if(l===3&&h.stateNode.current.memoizedState.isDehydrated){o.blockedOn=h.tag===3?h.stateNode.containerInfo:null;return}}}o.blockedOn=null}function jd(o){if(o.blockedOn!==null)return!1;for(var l=o.targetContainers;0<l.length;){var h=o1(o.nativeEvent);if(h===null){h=o.nativeEvent;var m=new h.constructor(h.type,h);vm=m,h.target.dispatchEvent(m),vm=null}else return l=zt(h),l!==null&&Pv(l),o.blockedOn=h,!1;l.shift()}return!0}function Dv(o,l,h){jd(o)&&h.delete(l)}function bb(){l1=!1,Oa!==null&&jd(Oa)&&(Oa=null),Da!==null&&jd(Da)&&(Da=null),za!==null&&jd(za)&&(za=null),Nh.forEach(Dv),Ih.forEach(Dv)}function Yd(o,l){o.blockedOn===l&&(o.blockedOn=null,l1||(l1=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,bb)))}var qd=null;function zv(o){qd!==o&&(qd=o,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){qd===o&&(qd=null);for(var l=0;l<o.length;l+=3){var h=o[l],m=o[l+1],x=o[l+2];if(typeof m!="function"){if(a1(m||h)===null)continue;break}var A=zt(h);A!==null&&(o.splice(l,3),l-=3,ld(A,{pending:!0,data:x,method:h.method,action:m},m,x))}}))}function Ba(o){function l(he){return Yd(he,o)}Oa!==null&&Yd(Oa,o),Da!==null&&Yd(Da,o),za!==null&&Yd(za,o),Nh.forEach(l),Ih.forEach(l);for(var h=0;h<Ua.length;h++){var m=Ua[h];m.blockedOn===o&&(m.blockedOn=null)}for(;0<Ua.length&&(h=Ua[0],h.blockedOn===null);)Ov(h),h.blockedOn===null&&Ua.shift();if(h=(o.ownerDocument||o).$$reactFormReplay,h!=null)for(m=0;m<h.length;m+=3){var x=h[m],A=h[m+1],D=x[Re]||null;if(typeof A=="function")D||zv(h);else if(D){var W=null;if(A&&A.hasAttribute("formAction")){if(x=A,D=A[Re]||null)W=D.formAction;else if(a1(x)!==null)continue}else W=D.action;typeof W=="function"?h[m+1]=W:(h.splice(m,3),m-=3),zv(h)}}}function Uv(){function o(A){A.canIntercept&&A.info==="react-transition"&&A.intercept({handler:function(){return new Promise(function(D){return x=D})},focusReset:"manual",scroll:"manual"})}function l(){x!==null&&(x(),x=null),m||setTimeout(h,20)}function h(){if(!m&&!navigation.transition){var A=navigation.currentEntry;A&&A.url!=null&&navigation.navigate(A.url,{state:A.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var m=!1,x=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(h,100),function(){m=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),x!==null&&(x(),x=null)}}}function $d(o){this._internalRoot=o}c1.prototype.render=$d.prototype.render=function(o){var l=this._internalRoot;if(l===null)throw Error(r(409));var h=l.current;Rv(h,vs(),o,l,null,null)},c1.prototype.unmount=$d.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var l=o.containerInfo;Rv(o.current,2,null,o,null,null),Rd(),l[$e]=null}};function c1(o){this._internalRoot=o}c1.prototype.unstable_scheduleHydration=function(o){if(o){var l=Ls();o={blockedOn:null,target:o,priority:l};for(var h=0;h<Ua.length&&l!==0&&l<Ua[h].priority;h++);Ua.splice(h,0,o),h===0&&Ov(o)}};var Bv=n.version;if(Bv!=="19.2.5")throw Error(r(527,Bv,"19.2.5"));J.findDOMNode=function(o){var l=o._reactInternals;if(l===void 0)throw typeof o.render=="function"?Error(r(188)):(o=Object.keys(o).join(","),Error(r(268,o)));return o=p(l),o=o!==null?g(o):null,o=o===null?null:o.stateNode,o};var Mb={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:j,reconcilerVersion:"19.2.5"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var iu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!iu.isDisabled&&iu.supportsFiber)try{De=iu.inject(Mb),Ee=iu}catch{}}e.createRoot=function(o,l){if(!s(o))throw Error(r(299));var h=!1,m="",x=x_,A=dd,D=S_;return l!=null&&(l.unstable_strictMode===!0&&(h=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onUncaughtError!==void 0&&(x=l.onUncaughtError),l.onCaughtError!==void 0&&(A=l.onCaughtError),l.onRecoverableError!==void 0&&(D=l.onRecoverableError)),l=nu(o,1,!1,null,null,h,m,null,x,A,D,Uv),o[$e]=l.current,pv(o),new $d(l)}})),DI=ha(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}n(),t.exports=OI()})),zI=yx(DI(),1),UI=ha((e=>{var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function i(r,s,a){var c=null;if(a!==void 0&&(c=""+a),s.key!==void 0&&(c=""+s.key),"key"in s){a={};for(var u in s)u!=="key"&&(a[u]=s[u])}else a=s;return s=a.ref,{$$typeof:t,type:r,key:c,ref:s!==void 0?s:null,props:a}}e.Fragment=n,e.jsx=i,e.jsxs=i})),BI=ha(((e,t)=>{t.exports=UI()})),ht=yx(bM(),1),Ue=BI(),VI=e=>(0,Ue.jsxs)("div",{style:{padding:"1rem",border:"1px solid #ccc",borderRadius:"4px"},children:[(0,Ue.jsx)("h3",{style:{margin:"0 0 0.5rem 0"},children:e.data?.name}),(0,Ue.jsx)("p",{style:{margin:"0 0 0.5rem 0",color:"#666"},children:e.data?.description}),(0,Ue.jsxs)("div",{style:{fontSize:"0.9rem",color:"#999"},children:["Value: ",e.data?.data.text||"Not set"]})]});function ja(e){return Object.keys(e)}function Ab(e){return e&&typeof e=="object"&&!Array.isArray(e)}function MM(e,t){const n={...e},i=t;return Ab(e)&&Ab(t)&&Object.keys(t).forEach(r=>{Ab(i[r])&&r in e?n[r]=MM(n[r],i[r]):n[r]=i[r]}),n}function FI(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function kI(e){return typeof e!="string"||!e.includes("var(--mantine-scale)")?e:e.match(/^calc\((.*?)\)$/)?.[1].split("*")[0].trim()}function GI(e){const t=kI(e);return typeof t=="number"?t:typeof t=="string"?t.includes("calc")||t.includes("var")?t:t.includes("px")?Number(t.replace("px","")):t.includes("rem")?Number(t.replace("rem",""))*16:t.includes("em")?Number(t.replace("em",""))*16:Number(t):NaN}function DA(e){return e==="0rem"?"0rem":`calc(${e} * var(--mantine-scale))`}function c3(e,{shouldScale:t=!1}={}){function n(i){if(i===0||i==="0")return`0${e}`;if(typeof i=="number"){const r=`${i/16}${e}`;return t?DA(r):r}if(typeof i=="string"){if(i===""||i.startsWith("calc(")||i.startsWith("clamp(")||i.includes("rgba("))return i;if(i.includes(","))return i.split(",").map(s=>n(s)).join(",");if(i.includes(" "))return i.split(" ").map(s=>n(s)).join(" ");const r=i.replace("px","");if(!Number.isNaN(Number(r))){const s=`${Number(r)/16}${e}`;return t?DA(s):s}}return i}return n}var yt=c3("rem",{shouldScale:!0}),zA=c3("em");function wM(e){return Object.keys(e).reduce((t,n)=>(e[n]!==void 0&&(t[n]=e[n]),t),{})}function u3(e){if(typeof e=="number")return!0;if(typeof e=="string"){if(e.startsWith("calc(")||e.startsWith("var(")||e.includes(" ")&&e.trim()!=="")return!0;const t=/^[+-]?[0-9]+(\.[0-9]+)?(px|em|rem|ex|ch|lh|rlh|vw|vh|vmin|vmax|vb|vi|svw|svh|lvw|lvh|dvw|dvh|cm|mm|in|pt|pc|q|cqw|cqh|cqi|cqb|cqmin|cqmax|%)?$/;return e.trim().split(/\s+/).every(n=>t.test(n))}return!1}function HI(e){const t=(0,ht.createContext)(null);return[t,()=>{const i=(0,ht.use)(t);if(i===null)throw new Error(e);return i}]}function UA(e,t){return n=>{if(typeof n!="string"||n.trim().length===0)throw new Error(t);return`${e}-${n}`}}function H2(e,t){let n=e;for(;(n=n.parentElement)&&!n.matches(t););return n}function WI(e,t,n){for(let i=e-1;i>=0;i-=1)if(!t[i].disabled)return i;if(n){for(let i=t.length-1;i>-1;i-=1)if(!t[i].disabled)return i}return e}function XI(e,t,n){for(let i=e+1;i<t.length;i+=1)if(!t[i].disabled)return i;if(n){for(let i=0;i<t.length;i+=1)if(!t[i].disabled)return i}return e}function jI(e,t,n){return H2(e,n)===H2(t,n)}function YI({parentSelector:e,siblingSelector:t,onKeyDown:n,loop:i=!0,activateOnFocus:r=!1,dir:s="rtl",orientation:a}){return c=>{n?.(c);const u=Array.from(H2(c.currentTarget,e)?.querySelectorAll(t)||[]).filter(S=>jI(c.currentTarget,S,e)),d=u.findIndex(S=>c.currentTarget===S),p=XI(d,u,i),g=WI(d,u,i),v=s==="rtl"?g:p,y=s==="rtl"?p:g;switch(c.key){case"ArrowRight":a==="horizontal"&&(c.stopPropagation(),c.preventDefault(),u[v].focus(),r&&u[v].click());break;case"ArrowLeft":a==="horizontal"&&(c.stopPropagation(),c.preventDefault(),u[y].focus(),r&&u[y].click());break;case"ArrowUp":a==="vertical"&&(c.stopPropagation(),c.preventDefault(),u[g].focus(),r&&u[g].click());break;case"ArrowDown":a==="vertical"&&(c.stopPropagation(),c.preventDefault(),u[p].focus(),r&&u[p].click());break;case"Home":c.stopPropagation(),c.preventDefault(),!u[0].disabled&&u[0].focus();break;case"End":{c.stopPropagation(),c.preventDefault();const S=u.length-1;!u[S].disabled&&u[S].focus();break}}}}var qI=()=>{};function $s(e,t="size",n=!0){if(e!==void 0)return u3(e)?n?yt(e):e:`var(--${t}-${e})`}function tm(e){return e===void 0?"var(--mantine-radius-default)":$s(e,"mantine-radius")}function xo(e){return $s(e,"mantine-font-size")}function $I(e){return $s(e,"mantine-line-height",!1)}function ZI(e){if(e)return $s(e,"mantine-shadow",!1)}function h3(e="mantine-"){return`${e}${Math.random().toString(36).slice(2,11)}`}function KI(e,t){return typeof t=="boolean"?t:typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function f3(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[i,r]=(0,ht.useState)(n?t:KI(e));return(0,ht.useEffect)(()=>{try{if("matchMedia"in window){const s=window.matchMedia(e);r(s.matches);const a=c=>r(c.matches);return s.addEventListener("change",a),()=>{s.removeEventListener("change",a)}}}catch{return}},[e]),i||!1}function QI(e,t){return f3("(prefers-color-scheme: dark)",e==="dark",t)?"dark":"light"}var AM=typeof document<"u"?ht.useLayoutEffect:ht.useEffect;function JI(e,t){const n=(0,ht.useRef)(!1);(0,ht.useEffect)(()=>()=>{n.current=!1},[]),(0,ht.useEffect)(()=>{if(n.current)return e();n.current=!0},t)}function d3(e){const[t,n]=(0,ht.useState)(`mantine-${(0,ht.useId)().replace(/:/g,"")}`);return AM(()=>{n(h3())},[]),typeof e=="string"?e:t}function BA(e,t){if(typeof e=="function")return e(t);typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function e4(...e){const t=new Map;return n=>{if(e.forEach(i=>{const r=BA(i,n);r&&t.set(i,r)}),t.size>0)return()=>{e.forEach(i=>{const r=t.get(i);r&&typeof r=="function"?r():BA(i,null)}),t.clear()}}}function t4(...e){return(0,ht.useCallback)(e4(...e),e)}function n4({value:e,defaultValue:t,finalValue:n,onChange:i=()=>{}}){const[r,s]=(0,ht.useState)(t!==void 0?t:n),a=(c,...u)=>{s(c),i?.(c,...u)};return e!==void 0?[e,i,!0]:[r,a,!1]}function i4(e,t){return f3("(prefers-reduced-motion: reduce)",e,t)}function r4(){return"development"}function p3(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=p3(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function _f(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=p3(e))&&(i&&(i+=" "),i+=t);return i}var s4={};function o4(e){const t={};return e.forEach(n=>{Object.entries(n).forEach(([i,r])=>{t[i]?t[i]=_f(t[i],r):t[i]=r})}),t}function X1({theme:e,classNames:t,props:n,stylesCtx:i}){return o4((Array.isArray(t)?t:[t]).map(r=>typeof r=="function"?r(e,n,i):r||s4))}function ux({theme:e,styles:t,props:n,stylesCtx:i}){const r=Array.isArray(t)?t:[t],s={};for(const a of r)typeof a=="function"?Object.assign(s,a(e,n,i)):a&&Object.assign(s,a);return s}function VA(e){return e==="auto"||e==="dark"||e==="light"}function m3({key:e="mantine-color-scheme-value"}={}){let t;return{get:n=>{if(typeof window>"u")return n;try{const i=window.localStorage.getItem(e);return VA(i)?i:n}catch{return n}},set:n=>{try{window.localStorage.setItem(e,n)}catch(i){console.warn("[@mantine/core] Local storage color scheme manager was unable to save color scheme.",i)}},subscribe:n=>{t=i=>{i.storageArea===window.localStorage&&i.key===e&&VA(i.newValue)&&n(i.newValue)},window.addEventListener("storage",t)},unsubscribe:()=>{window.removeEventListener("storage",t)},clear:()=>{window.localStorage.removeItem(e)}}}function j1(e,t){return typeof e.primaryShade=="number"?e.primaryShade:t==="dark"?e.primaryShade.dark:e.primaryShade.light}function a4(e){return/^#?([0-9A-F]{3}){1,2}([0-9A-F]{2})?$/i.test(e)}function l4(e){let t=e.replace("#","");if(t.length===3){const i=t.split("");t=[i[0],i[0],i[1],i[1],i[2],i[2]].join("")}if(t.length===8){const i=parseInt(t.slice(6,8),16)/255;return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16),a:i}}const n=parseInt(t,16);return{r:n>>16&255,g:n>>8&255,b:n&255,a:1}}function c4(e){const[t,n,i,r]=e.replace(/[^0-9,./]/g,"").split(/[/,]/).map(Number);return{r:t,g:n,b:i,a:r===void 0?1:r}}function u4(e){const t=e.match(/^hsla?\(\s*(\d+)\s*,\s*(\d+%)\s*,\s*(\d+%)\s*(,\s*(0?\.\d+|\d+(\.\d+)?))?\s*\)$/i);if(!t)return{r:0,g:0,b:0,a:1};const n=parseInt(t[1],10),i=parseInt(t[2],10)/100,r=parseInt(t[3],10)/100,s=t[5]?parseFloat(t[5]):void 0,a=(1-Math.abs(2*r-1))*i,c=n/60,u=a*(1-Math.abs(c%2-1)),d=r-a/2;let p,g,v;return c>=0&&c<1?(p=a,g=u,v=0):c>=1&&c<2?(p=u,g=a,v=0):c>=2&&c<3?(p=0,g=a,v=u):c>=3&&c<4?(p=0,g=u,v=a):c>=4&&c<5?(p=u,g=0,v=a):(p=a,g=0,v=u),{r:Math.round((p+d)*255),g:Math.round((g+d)*255),b:Math.round((v+d)*255),a:s||1}}function EM(e){return a4(e)?l4(e):e.startsWith("rgb")?c4(e):e.startsWith("hsl")?u4(e):{r:0,g:0,b:0,a:1}}function Eb(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}function h4(e){const t=e.match(/oklch\((.*?)%\s/);return t?parseFloat(t[1]):null}function f4(e){if(e.startsWith("oklch("))return(h4(e)||0)/100;const{r:t,g:n,b:i}=EM(e),r=t/255,s=n/255,a=i/255,c=Eb(r),u=Eb(s),d=Eb(a);return .2126*c+.7152*u+.0722*d}function u1(e,t=.179){return e.startsWith("var(")?!1:f4(e)>t}function d0({color:e,theme:t,colorScheme:n}){if(typeof e!="string")throw new Error(`[@mantine/core] Failed to parse color. Expected color to be a string, instead got ${typeof e}`);if(e==="bright")return{color:e,value:n==="dark"?t.white:t.black,shade:void 0,isThemeColor:!1,isLight:u1(n==="dark"?t.white:t.black,t.luminanceThreshold),variable:"--mantine-color-bright"};if(e==="dimmed")return{color:e,value:n==="dark"?t.colors.dark[2]:t.colors.gray[7],shade:void 0,isThemeColor:!1,isLight:u1(n==="dark"?t.colors.dark[2]:t.colors.gray[6],t.luminanceThreshold),variable:"--mantine-color-dimmed"};if(e==="white"||e==="black")return{color:e,value:e==="white"?t.white:t.black,shade:void 0,isThemeColor:!1,isLight:u1(e==="white"?t.white:t.black,t.luminanceThreshold),variable:`--mantine-color-${e}`};const[i,r]=e.split("."),s=r?Number(r):void 0,a=i in t.colors;if(a){const c=s!==void 0?t.colors[i][s]:t.colors[i][j1(t,n||"light")];return{color:i,value:c,shade:s,isThemeColor:a,isLight:u1(c,t.luminanceThreshold),variable:r?`--mantine-color-${i}-${s}`:`--mantine-color-${i}-filled`}}return{color:e,value:e,isThemeColor:a,isLight:u1(e,t.luminanceThreshold),shade:s,variable:void 0}}function Yp(e,t){const n=d0({color:e||t.primaryColor,theme:t});return n.variable?`var(${n.variable})`:e}function Qh(e,t){if(e.startsWith("var("))return`color-mix(in srgb, ${e}, black ${t*100}%)`;const{r:n,g:i,b:r,a:s}=EM(e),a=1-t,c=u=>Math.round(u*a);return`rgba(${c(n)}, ${c(i)}, ${c(r)}, ${s})`}function W2(e,t){const n={from:e?.from||t.defaultGradient.from,to:e?.to||t.defaultGradient.to,deg:e?.deg??t.defaultGradient.deg??0},i=Yp(n.from,t),r=Yp(n.to,t);return`linear-gradient(${n.deg}deg, ${i} 0%, ${r} 100%)`}function qh(e,t){if(typeof e!="string"||t>1||t<0)return"rgba(0, 0, 0, 1)";if(e.startsWith("var("))return`color-mix(in srgb, ${e}, transparent ${(1-t)*100}%)`;if(e.startsWith("oklch"))return e.includes("/")?e.replace(/\/\s*[\d.]+\s*\)/,`/ ${t})`):e.replace(")",` / ${t})`);const{r:n,g:i,b:r}=EM(e);return`rgba(${n}, ${i}, ${r}, ${t})`}var FA=qh,d4=({color:e,theme:t,variant:n,gradient:i,autoContrast:r})=>{const s=d0({color:e,theme:t}),a=typeof r=="boolean"?r:t.autoContrast;if(n==="none")return{background:"transparent",hover:"transparent",color:"inherit",border:"none"};if(n==="filled"){const c=a&&s.isLight?"var(--mantine-color-black)":"var(--mantine-color-white)";return s.isThemeColor?s.shade===void 0?{background:`var(--mantine-color-${e}-filled)`,hover:`var(--mantine-color-${e}-filled-hover)`,color:c,border:`${yt(1)} solid transparent`}:{background:`var(--mantine-color-${s.color}-${s.shade})`,hover:`var(--mantine-color-${s.color}-${s.shade===9?8:s.shade+1})`,color:c,border:`${yt(1)} solid transparent`}:{background:e,hover:Qh(e,.1),color:c,border:`${yt(1)} solid transparent`}}if(n==="light"){if(s.isThemeColor){if(s.shade===void 0)return{background:`var(--mantine-color-${e}-light)`,hover:`var(--mantine-color-${e}-light-hover)`,color:`var(--mantine-color-${e}-light-color)`,border:`${yt(1)} solid transparent`};const c=t.colors[s.color][s.shade];return{background:c,hover:Qh(c,.1),color:`var(--mantine-color-${s.color}-light-color)`,border:`${yt(1)} solid transparent`}}return{background:qh(e,.1),hover:qh(e,.12),color:e,border:`${yt(1)} solid transparent`}}if(n==="outline")return s.isThemeColor?s.shade===void 0?{background:"transparent",hover:`var(--mantine-color-${e}-outline-hover)`,color:`var(--mantine-color-${e}-outline)`,border:`${yt(1)} solid var(--mantine-color-${e}-outline)`}:{background:"transparent",hover:qh(t.colors[s.color][s.shade],.05),color:`var(--mantine-color-${s.color}-${s.shade})`,border:`${yt(1)} solid var(--mantine-color-${s.color}-${s.shade})`}:{background:"transparent",hover:qh(e,.05),color:e,border:`${yt(1)} solid ${e}`};if(n==="subtle"){if(s.isThemeColor){if(s.shade===void 0)return{background:"transparent",hover:`var(--mantine-color-${e}-light-hover)`,color:`var(--mantine-color-${e}-light-color)`,border:`${yt(1)} solid transparent`};const c=t.colors[s.color][s.shade];return{background:"transparent",hover:qh(c,.12),color:`var(--mantine-color-${s.color}-${Math.min(s.shade,6)})`,border:`${yt(1)} solid transparent`}}return{background:"transparent",hover:qh(e,.12),color:e,border:`${yt(1)} solid transparent`}}return n==="transparent"?s.isThemeColor?s.shade===void 0?{background:"transparent",hover:"transparent",color:`var(--mantine-color-${e}-light-color)`,border:`${yt(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:`var(--mantine-color-${s.color}-${Math.min(s.shade,6)})`,border:`${yt(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:e,border:`${yt(1)} solid transparent`}:n==="white"?s.isThemeColor?s.shade===void 0?{background:"var(--mantine-color-white)",hover:Qh(t.white,.01),color:`var(--mantine-color-${e}-filled)`,border:`${yt(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:Qh(t.white,.01),color:`var(--mantine-color-${s.color}-${s.shade})`,border:`${yt(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:Qh(t.white,.01),color:e,border:`${yt(1)} solid transparent`}:n==="gradient"?{background:W2(i,t),hover:W2(i,t),color:"var(--mantine-color-white)",border:"none"}:n==="default"?{background:"var(--mantine-color-default)",hover:"var(--mantine-color-default-hover)",color:"var(--mantine-color-default-color)",border:`${yt(1)} solid var(--mantine-color-default-border)`}:{}};function g3({color:e,theme:t,autoContrast:n}){return(typeof n=="boolean"?n:t.autoContrast)&&d0({color:e||t.primaryColor,theme:t}).isLight?"var(--mantine-color-black)":"var(--mantine-color-white)"}function kA(e,t){return g3({color:e.colors[e.primaryColor][j1(e,t)],theme:e,autoContrast:null})}function p4(e,t){return typeof e=="boolean"?e:t.autoContrast}function Wl(e){return Array.isArray(e)?e:Array(10).fill(e)}var xx=(0,ht.createContext)(null);function nc(){const e=(0,ht.use)(xx);if(!e)throw new Error("[@mantine/core] MantineProvider was not found in tree");return e}function m4(){return nc().cssVariablesResolver}function g4(){return nc().classNamesPrefix}function Sx(){return nc().getStyleNonce}function _4(){return nc().withStaticClasses}function v4(){return nc().headless}function y4(){return nc().stylesTransform?.sx}function x4(){return nc().stylesTransform?.styles}function _3(){return nc().env||"default"}function S4(){return nc().deduplicateInlineStyles}function GA(e){const t=document.createElement("style");return t.setAttribute("data-mantine-styles","inline"),t.innerHTML="*, *::before, *::after {transition: none !important;}",t.setAttribute("data-mantine-disable-transition","true"),e&&t.setAttribute("nonce",e),document.head.appendChild(t),()=>document.querySelectorAll("[data-mantine-disable-transition]").forEach(i=>i.remove())}function b4({keepTransitions:e}={}){const t=(0,ht.useRef)(qI),n=(0,ht.useRef)(-1),i=(0,ht.use)(xx),r=(0,ht.useRef)(Sx()?.());if(!i)throw new Error("[@mantine/core] MantineProvider was not found in tree");const s=p=>{i.setColorScheme(p),t.current=e?()=>{}:GA(r.current),window.clearTimeout(n.current),n.current=window.setTimeout(()=>{t.current?.()},10)},a=()=>{i.clearColorScheme(),t.current=e?()=>{}:GA(r.current),window.clearTimeout(n.current),n.current=window.setTimeout(()=>{t.current?.()},10)},c=QI("light",{getInitialValueInEffect:!1}),u=i.colorScheme==="auto"?c:i.colorScheme,d=(0,ht.useCallback)(()=>s(u==="light"?"dark":"light"),[s,u]);return(0,ht.useEffect)(()=>()=>{t.current?.(),window.clearTimeout(n.current)},[]),{colorScheme:i.colorScheme,setColorScheme:s,clearColorScheme:a,toggleColorScheme:d}}function Zd(e,t){const n=typeof window<"u"&&"matchMedia"in window&&window.matchMedia("(prefers-color-scheme: dark)")?.matches,i=e!=="auto"?e:n?"dark":"light";t()?.setAttribute("data-mantine-color-scheme",i)}function M4({manager:e,defaultColorScheme:t,getRootElement:n,forceColorScheme:i}){const r=(0,ht.useRef)(null),[s,a]=(0,ht.useState)(()=>e.get(t)),c=i||s,u=(0,ht.useCallback)(p=>{i||(Zd(p,n),a(p),e.set(p))},[e.set,c,i]),d=(0,ht.useCallback)(()=>{a(t),Zd(t,n),e.clear()},[e.clear,t]);return(0,ht.useEffect)(()=>(e.subscribe(u),e.unsubscribe),[e.subscribe,e.unsubscribe]),AM(()=>{Zd(e.get(t),n)},[]),(0,ht.useEffect)(()=>{if(i)return Zd(i,n),()=>{};i===void 0&&Zd(s,n),typeof window<"u"&&"matchMedia"in window&&(r.current=window.matchMedia("(prefers-color-scheme: dark)"));const p=g=>{s==="auto"&&Zd(g.matches?"dark":"light",n)};return r.current?.addEventListener("change",p),()=>r.current?.removeEventListener("change",p)},[s,i]),{colorScheme:c,setColorScheme:u,clearColorScheme:d}}var w4={dark:["#C9C9C9","#b8b8b8","#828282","#696969","#424242","#3b3b3b","#2e2e2e","#242424","#1f1f1f","#141414"],gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]},HA="-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",TM={scale:1,fontSmoothing:!0,focusRing:"auto",white:"#fff",black:"#000",colors:w4,primaryShade:{light:6,dark:8},primaryColor:"blue",variantColorResolver:d4,autoContrast:!1,luminanceThreshold:.3,fontFamily:HA,fontFamilyMonospace:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",respectReducedMotion:!1,cursorType:"default",defaultGradient:{from:"blue",to:"cyan",deg:45},defaultRadius:"md",activeClassName:"mantine-active",focusClassName:"",headings:{fontFamily:HA,fontWeight:"700",textWrap:"wrap",sizes:{h1:{fontSize:yt(34),lineHeight:"1.3"},h2:{fontSize:yt(26),lineHeight:"1.35"},h3:{fontSize:yt(22),lineHeight:"1.4"},h4:{fontSize:yt(18),lineHeight:"1.45"},h5:{fontSize:yt(16),lineHeight:"1.5"},h6:{fontSize:yt(14),lineHeight:"1.5"}}},fontSizes:{xs:yt(12),sm:yt(14),md:yt(16),lg:yt(18),xl:yt(20)},lineHeights:{xs:"1.4",sm:"1.45",md:"1.55",lg:"1.6",xl:"1.65"},fontWeights:{regular:"400",medium:"600",bold:"700"},radius:{xs:yt(2),sm:yt(4),md:yt(8),lg:yt(16),xl:yt(32)},spacing:{xs:yt(10),sm:yt(12),md:yt(16),lg:yt(20),xl:yt(32)},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},shadows:{xs:`0 ${yt(1)} ${yt(3)} rgba(0, 0, 0, 0.05), 0 ${yt(1)} ${yt(2)} rgba(0, 0, 0, 0.1)`,sm:`0 ${yt(1)} ${yt(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${yt(10)} ${yt(15)} ${yt(-5)}, rgba(0, 0, 0, 0.04) 0 ${yt(7)} ${yt(7)} ${yt(-5)}`,md:`0 ${yt(1)} ${yt(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${yt(20)} ${yt(25)} ${yt(-5)}, rgba(0, 0, 0, 0.04) 0 ${yt(10)} ${yt(10)} ${yt(-5)}`,lg:`0 ${yt(1)} ${yt(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${yt(28)} ${yt(23)} ${yt(-7)}, rgba(0, 0, 0, 0.04) 0 ${yt(12)} ${yt(12)} ${yt(-7)}`,xl:`0 ${yt(1)} ${yt(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${yt(36)} ${yt(28)} ${yt(-7)}, rgba(0, 0, 0, 0.04) 0 ${yt(17)} ${yt(17)} ${yt(-7)}`},other:{},components:{}},A4="[@mantine/core] MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color",WA="[@mantine/core] MantineProvider: Invalid theme.primaryShade, it accepts only 0-9 integers or an object { light: 0-9, dark: 0-9 }";function Tb(e){return e<0||e>9?!1:parseInt(e.toString(),10)===e}function XA(e){if(!(e.primaryColor in e.colors))throw new Error(A4);if(typeof e.primaryShade=="object"&&(!Tb(e.primaryShade.dark)||!Tb(e.primaryShade.light)))throw new Error(WA);if(typeof e.primaryShade=="number"&&!Tb(e.primaryShade))throw new Error(WA)}function E4(e,t){if(!t)return XA(e),e;const n=MM(e,t);return t.fontFamily&&!t.headings?.fontFamily&&(n.headings.fontFamily=t.fontFamily),XA(n),n}var CM=(0,ht.createContext)(null),T4=()=>(0,ht.use)(CM)||TM;function Za(){const e=(0,ht.use)(CM);if(!e)throw new Error("@mantine/core: MantineProvider was not found in component tree, make sure you have it in your app");return e}function RM({theme:e,children:t,inherit:n=!0}){const i=T4();return(0,Ue.jsx)(CM,{value:(0,ht.useMemo)(()=>E4(n?i:TM,e),[e,i,n]),children:t})}RM.displayName="@mantine/core/MantineThemeProvider";function Cb(e){return Object.entries(e).map(([t,n])=>`${t}: ${n};`).join("")}function v3(e,t){const n=t?[t]:[":root",":host"],i=Cb(e.variables),r=i?`${n.join(", ")}{${i}}`:"",s=Cb(e.dark),a=Cb(e.light),c=u=>n.map(d=>d===":host"?`${d}([data-mantine-color-scheme="${u}"])`:`${d}[data-mantine-color-scheme="${u}"]`).join(", ");return`${r}
${s?`${c("dark")}{${s}}`:""}
${a?`${c("light")}{${a}}`:""}`}function Vv({theme:e,color:t,colorScheme:n,name:i=t,withColorValues:r=!0}){if(!e.colors[t])return{};if(n==="light"){const c=j1(e,"light"),u={[`--mantine-color-${i}-text`]:`var(--mantine-color-${i}-filled)`,[`--mantine-color-${i}-filled`]:`var(--mantine-color-${i}-${c})`,[`--mantine-color-${i}-filled-hover`]:`var(--mantine-color-${i}-${c===9?8:c+1})`,[`--mantine-color-${i}-light`]:`var(--mantine-color-${i}-1)`,[`--mantine-color-${i}-light-hover`]:`var(--mantine-color-${i}-2)`,[`--mantine-color-${i}-light-color`]:`var(--mantine-color-${i}-9)`,[`--mantine-color-${i}-outline`]:`var(--mantine-color-${i}-${c})`,[`--mantine-color-${i}-outline-hover`]:FA(e.colors[t][c],.05)};return r?{[`--mantine-color-${i}-0`]:e.colors[t][0],[`--mantine-color-${i}-1`]:e.colors[t][1],[`--mantine-color-${i}-2`]:e.colors[t][2],[`--mantine-color-${i}-3`]:e.colors[t][3],[`--mantine-color-${i}-4`]:e.colors[t][4],[`--mantine-color-${i}-5`]:e.colors[t][5],[`--mantine-color-${i}-6`]:e.colors[t][6],[`--mantine-color-${i}-7`]:e.colors[t][7],[`--mantine-color-${i}-8`]:e.colors[t][8],[`--mantine-color-${i}-9`]:e.colors[t][9],...u}:u}const s=j1(e,"dark"),a={[`--mantine-color-${i}-text`]:`var(--mantine-color-${i}-4)`,[`--mantine-color-${i}-filled`]:`var(--mantine-color-${i}-${s})`,[`--mantine-color-${i}-filled-hover`]:`var(--mantine-color-${i}-${s===9?8:s+1})`,[`--mantine-color-${i}-light`]:Qh(e.colors[t][9],.5),[`--mantine-color-${i}-light-hover`]:Qh(e.colors[t][9],.3),[`--mantine-color-${i}-light-color`]:`var(--mantine-color-${i}-0)`,[`--mantine-color-${i}-outline`]:`var(--mantine-color-${i}-${Math.max(s-4,0)})`,[`--mantine-color-${i}-outline-hover`]:FA(e.colors[t][Math.max(s-4,0)],.05)};return r?{[`--mantine-color-${i}-0`]:e.colors[t][0],[`--mantine-color-${i}-1`]:e.colors[t][1],[`--mantine-color-${i}-2`]:e.colors[t][2],[`--mantine-color-${i}-3`]:e.colors[t][3],[`--mantine-color-${i}-4`]:e.colors[t][4],[`--mantine-color-${i}-5`]:e.colors[t][5],[`--mantine-color-${i}-6`]:e.colors[t][6],[`--mantine-color-${i}-7`]:e.colors[t][7],[`--mantine-color-${i}-8`]:e.colors[t][8],[`--mantine-color-${i}-9`]:e.colors[t][9],...a}:a}function h1(e){const t=Wl(Array.from({length:10}).map((n,i)=>`var(--mantine-color-${e.name}-${i})`));return Object.defineProperty(t,"mantine-virtual-color",{enumerable:!1,writable:!1,configurable:!1,value:!0}),Object.defineProperty(t,"dark",{enumerable:!1,writable:!1,configurable:!1,value:e.dark}),Object.defineProperty(t,"light",{enumerable:!1,writable:!1,configurable:!1,value:e.light}),Object.defineProperty(t,"name",{enumerable:!1,writable:!1,configurable:!1,value:e.name}),t}function C4(e){return!!e&&typeof e=="object"&&"mantine-virtual-color"in e}function Dh(e,t,n){ja(t).forEach(i=>Object.assign(e,{[`--mantine-${n}-${i}`]:t[i]}))}var y3=e=>{const t=j1(e,"light"),n=e.defaultRadius in e.radius?e.radius[e.defaultRadius]:yt(e.defaultRadius),i={variables:{"--mantine-z-index-app":"100","--mantine-z-index-modal":"200","--mantine-z-index-popover":"300","--mantine-z-index-overlay":"400","--mantine-z-index-max":"9999","--mantine-scale":e.scale.toString(),"--mantine-cursor-type":e.cursorType,"--mantine-webkit-font-smoothing":e.fontSmoothing?"antialiased":"unset","--mantine-moz-font-smoothing":e.fontSmoothing?"grayscale":"unset","--mantine-color-white":e.white,"--mantine-color-black":e.black,"--mantine-line-height":e.lineHeights.md,"--mantine-font-family":e.fontFamily,"--mantine-font-family-monospace":e.fontFamilyMonospace,"--mantine-font-family-headings":e.headings.fontFamily,"--mantine-heading-font-weight":e.headings.fontWeight,"--mantine-heading-text-wrap":e.headings.textWrap,"--mantine-radius-default":n,"--mantine-primary-color-filled":`var(--mantine-color-${e.primaryColor}-filled)`,"--mantine-primary-color-filled-hover":`var(--mantine-color-${e.primaryColor}-filled-hover)`,"--mantine-primary-color-light":`var(--mantine-color-${e.primaryColor}-light)`,"--mantine-primary-color-light-hover":`var(--mantine-color-${e.primaryColor}-light-hover)`,"--mantine-primary-color-light-color":`var(--mantine-color-${e.primaryColor}-light-color)`},light:{"--mantine-color-scheme":"light","--mantine-primary-color-contrast":kA(e,"light"),"--mantine-color-bright":"var(--mantine-color-black)","--mantine-color-text":e.black,"--mantine-color-body":e.white,"--mantine-color-error":"var(--mantine-color-red-6)","--mantine-color-placeholder":"var(--mantine-color-gray-5)","--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-${t})`,"--mantine-color-default":"var(--mantine-color-white)","--mantine-color-default-hover":"var(--mantine-color-gray-0)","--mantine-color-default-color":"var(--mantine-color-black)","--mantine-color-default-border":"var(--mantine-color-gray-4)","--mantine-color-dimmed":"var(--mantine-color-gray-6)","--mantine-color-disabled":"var(--mantine-color-gray-2)","--mantine-color-disabled-color":"var(--mantine-color-gray-5)","--mantine-color-disabled-border":"var(--mantine-color-gray-3)"},dark:{"--mantine-color-scheme":"dark","--mantine-primary-color-contrast":kA(e,"dark"),"--mantine-color-bright":"var(--mantine-color-white)","--mantine-color-text":"var(--mantine-color-dark-0)","--mantine-color-body":"var(--mantine-color-dark-7)","--mantine-color-error":"var(--mantine-color-red-8)","--mantine-color-placeholder":"var(--mantine-color-dark-3)","--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-4)`,"--mantine-color-default":"var(--mantine-color-dark-6)","--mantine-color-default-hover":"var(--mantine-color-dark-5)","--mantine-color-default-color":"var(--mantine-color-white)","--mantine-color-default-border":"var(--mantine-color-dark-4)","--mantine-color-dimmed":"var(--mantine-color-dark-2)","--mantine-color-disabled":"var(--mantine-color-dark-6)","--mantine-color-disabled-color":"var(--mantine-color-dark-3)","--mantine-color-disabled-border":"var(--mantine-color-dark-4)"}};Dh(i.variables,e.breakpoints,"breakpoint"),Dh(i.variables,e.spacing,"spacing"),Dh(i.variables,e.fontSizes,"font-size"),Dh(i.variables,e.lineHeights,"line-height"),Dh(i.variables,e.shadows,"shadow"),Dh(i.variables,e.radius,"radius"),Dh(i.variables,e.fontWeights,"font-weight"),e.colors[e.primaryColor].forEach((s,a)=>{i.variables[`--mantine-primary-color-${a}`]=`var(--mantine-color-${e.primaryColor}-${a})`}),ja(e.colors).forEach(s=>{const a=e.colors[s];if(C4(a)){Object.assign(i.light,Vv({theme:e,name:a.name,color:a.light,colorScheme:"light",withColorValues:!0})),Object.assign(i.dark,Vv({theme:e,name:a.name,color:a.dark,colorScheme:"dark",withColorValues:!0}));return}a.forEach((c,u)=>{i.variables[`--mantine-color-${s}-${u}`]=c}),Object.assign(i.light,Vv({theme:e,color:s,colorScheme:"light",withColorValues:!1})),Object.assign(i.dark,Vv({theme:e,color:s,colorScheme:"dark",withColorValues:!1}))});const r=e.headings.sizes;return ja(r).forEach(s=>{i.variables[`--mantine-${s}-font-size`]=r[s].fontSize,i.variables[`--mantine-${s}-line-height`]=r[s].lineHeight,i.variables[`--mantine-${s}-font-weight`]=r[s].fontWeight||e.headings.fontWeight}),i};function R4(){const e=Za(),t=Sx(),n=ja(e.breakpoints).reduce((i,r)=>{const s=e.breakpoints[r].includes("px"),a=GI(e.breakpoints[r]);return`${i}@media (max-width: ${s?`${a-.1}px`:zA(a-.1)}) {.mantine-visible-from-${r} {display: none !important;}}@media (min-width: ${s?`${a}px`:zA(a)}) {.mantine-hidden-from-${r} {display: none !important;}}`},"");return(0,Ue.jsx)("style",{"data-mantine-styles":"classes",nonce:t?.(),dangerouslySetInnerHTML:{__html:n}})}function L4({theme:e,generator:t}){const n=y3(e),i=t?.(e);return i?MM(n,i):n}var Rb=y3(TM);function P4(e){const t={variables:{},light:{},dark:{}};return ja(e.variables).forEach(n=>{Rb.variables[n]!==e.variables[n]&&(t.variables[n]=e.variables[n])}),ja(e.light).forEach(n=>{Rb.light[n]!==e.light[n]&&(t.light[n]=e.light[n])}),ja(e.dark).forEach(n=>{Rb.dark[n]!==e.dark[n]&&(t.dark[n]=e.dark[n])}),t}function N4(e){return v3({variables:{},dark:{"--mantine-color-scheme":"dark"},light:{"--mantine-color-scheme":"light"}},e)}function x3({cssVariablesSelector:e,deduplicateCssVariables:t}){const n=Za(),i=Sx(),r=L4({theme:n,generator:m4()}),s=(e===void 0||e===":root"||e===":host")&&t,a=v3(s?P4(r):r,e);return a?(0,Ue.jsx)("style",{"data-mantine-styles":!0,nonce:i?.(),dangerouslySetInnerHTML:{__html:`${a}${s?"":N4(e)}`}}):null}x3.displayName="@mantine/CssVariables";function I4({respectReducedMotion:e,getRootElement:t}){AM(()=>{e&&t()?.setAttribute("data-respect-reduced-motion","true")},[e])}function X2({theme:e,children:t,getStyleNonce:n,withStaticClasses:i=!0,withGlobalClasses:r=!0,deduplicateCssVariables:s=!0,withCssVariables:a=!0,cssVariablesSelector:c,classNamesPrefix:u="mantine",colorSchemeManager:d=m3(),defaultColorScheme:p="light",getRootElement:g=()=>document.documentElement,cssVariablesResolver:v,forceColorScheme:y,stylesTransform:S,env:E,deduplicateInlineStyles:w=!1}){const{colorScheme:b,setColorScheme:T,clearColorScheme:L}=M4({defaultColorScheme:p,forceColorScheme:y,manager:d,getRootElement:g});return I4({respectReducedMotion:e?.respectReducedMotion||!1,getRootElement:g}),(0,Ue.jsx)(xx,{value:{colorScheme:b,setColorScheme:T,clearColorScheme:L,getRootElement:g,classNamesPrefix:u,getStyleNonce:n,cssVariablesResolver:v,cssVariablesSelector:c??":root",withStaticClasses:i,stylesTransform:S,env:E,deduplicateInlineStyles:w},children:(0,Ue.jsxs)(RM,{theme:e,children:[a&&(0,Ue.jsx)(x3,{cssVariablesSelector:c,deduplicateCssVariables:s}),r&&(0,Ue.jsx)(R4,{}),t]})})}X2.displayName="@mantine/core/MantineProvider";function O4({children:e,theme:t,env:n}){return(0,Ue.jsx)(xx,{value:{colorScheme:"auto",setColorScheme:()=>{},clearColorScheme:()=>{},getRootElement:()=>document.documentElement,classNamesPrefix:"mantine",cssVariablesSelector:":root",withStaticClasses:!1,headless:!0,env:n},children:(0,Ue.jsx)(RM,{theme:t,children:e})})}O4.displayName="@mantine/core/HeadlessMantineProvider";function ai(e,t,n){const i=Za(),r=i.components[e]?.defaultProps,s=typeof r=="function"?r(i):r;return{...t,...s,...wM(n)}}function D4({classNames:e,styles:t,props:n,stylesCtx:i}){const r=Za();return{resolvedClassNames:e===void 0?void 0:X1({theme:r,classNames:e,props:n,stylesCtx:i||void 0}),resolvedStyles:t===void 0?void 0:ux({theme:r,styles:t,props:n,stylesCtx:i||void 0})}}var z4={always:"mantine-focus-always",auto:"mantine-focus-auto",never:"mantine-focus-never"};function U4({theme:e,options:t,unstyled:n}){return _f(t?.focusable&&!n&&(e.focusClassName||z4[e.focusRing]),t?.active&&!n&&e.activeClassName)}function B4({selector:e,stylesCtx:t,options:n,props:i,theme:r}){return X1({theme:r,classNames:n?.classNames,props:n?.props||i,stylesCtx:t})[e]}function V4({selector:e,stylesCtx:t,theme:n,classNames:i,props:r}){return X1({theme:n,classNames:i,props:r,stylesCtx:t})[e]}function F4({rootSelector:e,selector:t,className:n}){return e===t?n:void 0}function k4({selector:e,classes:t,unstyled:n}){return n?void 0:t[e]}function G4({themeName:e,classNamesPrefix:t,selector:n,withStaticClass:i}){return i===!1?[]:e.map(r=>`${t}-${r}-${n}`)}function H4({options:e,classes:t,selector:n,unstyled:i}){return e?.variant&&!i?t[`${n}--${e.variant}`]:void 0}function W4({theme:e,options:t,themeName:n,selector:i,classNamesPrefix:r,resolvedClassNames:s,resolvedThemeClassNames:a,classes:c,unstyled:u,className:d,rootSelector:p,props:g,stylesCtx:v,withStaticClasses:y,headless:S,transformedStyles:E}){return _f(U4({theme:e,options:t,unstyled:u||S}),a.map(w=>w[i]),H4({options:t,classes:c,selector:i,unstyled:u||S}),s[i],V4({selector:i,stylesCtx:v,theme:e,classNames:E,props:g}),B4({selector:i,stylesCtx:v,options:t,props:g,theme:e}),F4({rootSelector:p,selector:i,className:d}),k4({selector:i,classes:c,unstyled:u||S}),y&&!S&&G4({themeName:n,classNamesPrefix:r,selector:i,withStaticClass:t?.withStaticClass}),t?.className)}function LM({style:e,theme:t}){return Array.isArray(e)?e.reduce((n,i)=>({...n,...LM({style:i,theme:t})}),{}):typeof e=="function"?e(t):e??{}}function X4({theme:e,selector:t,options:n,props:i,stylesCtx:r,rootSelector:s,withStylesTransform:a,resolvedStyles:c,resolvedThemeStyles:u,resolvedVars:d,resolvedRootStyle:p}){return{...u[t],...c[t],...!a&&ux({theme:e,styles:n?.styles,props:n?.props||i,stylesCtx:r})[t],...d[t],...s===t?p:null,...LM({style:n?.style,theme:e})}}function j4(e){return e.reduce((t,n)=>(n&&Object.keys(n).forEach(i=>{t[i]={...t[i],...wM(n[i])}}),t),{})}function Y4({props:e,stylesCtx:t,themeName:n,theme:i}){const r=x4()?.();return{getTransformedStyles:a=>r?[...a.map(c=>r(c,{props:e,theme:i,ctx:t})),...n.map(c=>r(i.components[c]?.styles,{props:e,theme:i,ctx:t}))].filter(Boolean):[],withStylesTransform:!!r}}function Tr({name:e,classes:t,props:n,stylesCtx:i,className:r,style:s,rootSelector:a="root",unstyled:c,classNames:u,styles:d,vars:p,varsResolver:g,attributes:v}){const y=Za(),S=g4(),E=_4(),w=v4(),b=(Array.isArray(e)?e:[e]).filter(z=>z),{withStylesTransform:T,getTransformedStyles:L}=Y4({props:n,stylesCtx:i,themeName:b,theme:y}),C=X1({theme:y,classNames:u,props:n,stylesCtx:i}),P=b.map(z=>X1({theme:y,classNames:y.components[z]?.classNames,props:n,stylesCtx:i})),O=T?{}:ux({theme:y,styles:d,props:n,stylesCtx:i}),B={};if(!T)for(const z of b){const te=ux({theme:y,styles:y.components[z]?.styles,props:n,stylesCtx:i});for(const oe of Object.keys(te))B[oe]={...B[oe],...te[oe]}}const U=j4([w?{}:g?.(y,n,i),...b.map(z=>y.components?.[z]?.vars?.(y,n,i)),p?.(y,n,i)]),I=LM({style:s,theme:y});return(z,te)=>({...v?.[z],className:W4({theme:y,options:te,themeName:b,selector:z,classNamesPrefix:S,resolvedClassNames:C,resolvedThemeClassNames:P,classes:t,unstyled:c,className:r,rootSelector:a,props:n,stylesCtx:i,withStaticClasses:E,headless:w,transformedStyles:L([te?.styles,d])}),style:X4({theme:y,selector:z,options:te,props:n,stylesCtx:i,rootSelector:a,withStylesTransform:T,resolvedStyles:O,resolvedThemeStyles:B,resolvedVars:U,resolvedRootStyle:I})})}function V1(e){return ja(e).reduce((t,n)=>e[n]!==void 0?`${t}${FI(n)}:${e[n]};`:t,"").trim()}function q4({selector:e,styles:t,media:n,container:i}){const r=t?V1(t):"",s=Array.isArray(n)?n.map(c=>`@media${c.query}{${e}{${V1(c.styles)}}}`):[],a=Array.isArray(i)?i.map(c=>`@container ${c.query}{${e}{${V1(c.styles)}}}`):[];return`${r?`${e}{${r}}`:""}${s.join("")}${a.join("")}`.trim()}function $4(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)&4294967295;return(t>>>0).toString(36)}function Z4({deduplicate:e,...t}){const n=Sx(),i=q4(t);return e?(0,Ue.jsx)("style",{href:`mantine-${$4(i)}`,precedence:"mantine",nonce:n?.(),children:i}):(0,Ue.jsx)("style",{"data-mantine-styles":"inline",nonce:n?.(),dangerouslySetInnerHTML:{__html:i}})}function K4(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)&4294967295;return(t>>>0).toString(36)}function Q4(e,t){return`__mdi__-${K4(`${e?V1(e):""}|${Array.isArray(t)?t.map(n=>`${n.query}:${V1(n.styles)}`).join("|"):""}`)}`}function PM(e){const{m:t,mx:n,my:i,mt:r,mb:s,ml:a,mr:c,me:u,ms:d,mis:p,mie:g,p:v,px:y,py:S,pt:E,pb:w,pl:b,pr:T,pe:L,ps:C,pis:P,pie:O,bd:B,bdrs:U,bg:I,c:z,opacity:te,ff:oe,fz:ee,fw:k,lts:X,ta:$,lh:j,fs:J,tt:xe,td:de,w:fe,miw:F,maw:re,h:ue,mih:_e,mah:Le,bgsz:Fe,bgp:Xe,bgr:lt,bga:mt,pos:ne,top:Be,left:Ne,bottom:ve,right:ye,inset:et,display:tt,flex:_t,hiddenFrom:St,visibleFrom:Mt,lightHidden:Bt,darkHidden:Ft,sx:ie,...Z}=e;return{styleProps:wM({m:t,mx:n,my:i,mt:r,mb:s,ml:a,mr:c,me:u,ms:d,mis:p,mie:g,p:v,px:y,py:S,pt:E,pb:w,pl:b,pr:T,pis:P,pie:O,pe:L,ps:C,bd:B,bg:I,c:z,opacity:te,ff:oe,fz:ee,fw:k,lts:X,ta:$,lh:j,fs:J,tt:xe,td:de,w:fe,miw:F,maw:re,h:ue,mih:_e,mah:Le,bgsz:Fe,bgp:Xe,bgr:lt,bga:mt,pos:ne,top:Be,left:Ne,bottom:ve,right:ye,inset:et,display:tt,flex:_t,bdrs:U,hiddenFrom:St,visibleFrom:Mt,lightHidden:Bt,darkHidden:Ft,sx:ie}),rest:Z}}var J4={m:{type:"spacing",property:"margin"},mt:{type:"spacing",property:"marginTop"},mb:{type:"spacing",property:"marginBottom"},ml:{type:"spacing",property:"marginLeft"},mr:{type:"spacing",property:"marginRight"},ms:{type:"spacing",property:"marginInlineStart"},me:{type:"spacing",property:"marginInlineEnd"},mis:{type:"spacing",property:"marginInlineStart"},mie:{type:"spacing",property:"marginInlineEnd"},mx:{type:"spacing",property:"marginInline"},my:{type:"spacing",property:"marginBlock"},p:{type:"spacing",property:"padding"},pt:{type:"spacing",property:"paddingTop"},pb:{type:"spacing",property:"paddingBottom"},pl:{type:"spacing",property:"paddingLeft"},pr:{type:"spacing",property:"paddingRight"},ps:{type:"spacing",property:"paddingInlineStart"},pe:{type:"spacing",property:"paddingInlineEnd"},pis:{type:"spacing",property:"paddingInlineStart"},pie:{type:"spacing",property:"paddingInlineEnd"},px:{type:"spacing",property:"paddingInline"},py:{type:"spacing",property:"paddingBlock"},bd:{type:"border",property:"border"},bdrs:{type:"radius",property:"borderRadius"},bg:{type:"color",property:"background"},c:{type:"textColor",property:"color"},opacity:{type:"identity",property:"opacity"},ff:{type:"fontFamily",property:"fontFamily"},fz:{type:"fontSize",property:"fontSize"},fw:{type:"identity",property:"fontWeight"},lts:{type:"size",property:"letterSpacing"},ta:{type:"identity",property:"textAlign"},lh:{type:"lineHeight",property:"lineHeight"},fs:{type:"identity",property:"fontStyle"},tt:{type:"identity",property:"textTransform"},td:{type:"identity",property:"textDecoration"},w:{type:"spacing",property:"width"},miw:{type:"spacing",property:"minWidth"},maw:{type:"spacing",property:"maxWidth"},h:{type:"spacing",property:"height"},mih:{type:"spacing",property:"minHeight"},mah:{type:"spacing",property:"maxHeight"},bgsz:{type:"size",property:"backgroundSize"},bgp:{type:"identity",property:"backgroundPosition"},bgr:{type:"identity",property:"backgroundRepeat"},bga:{type:"identity",property:"backgroundAttachment"},pos:{type:"identity",property:"position"},top:{type:"size",property:"top"},left:{type:"size",property:"left"},bottom:{type:"size",property:"bottom"},right:{type:"size",property:"right"},inset:{type:"size",property:"inset"},display:{type:"identity",property:"display"},flex:{type:"identity",property:"flex"}};function NM(e,t){const n=d0({color:e,theme:t});return n.color==="dimmed"?"var(--mantine-color-dimmed)":n.color==="bright"?"var(--mantine-color-bright)":n.variable?`var(${n.variable})`:n.color}function e5(e,t){const n=d0({color:e,theme:t});return n.isThemeColor&&n.shade===void 0?`var(--mantine-color-${n.color}-text)`:NM(e,t)}function t5(e,t){if(typeof e=="number")return yt(e);if(typeof e=="string"){const[n,i,...r]=e.split(" ").filter(a=>a.trim()!=="");let s=`${yt(n)}`;return i&&(s+=` ${i}`),r.length>0&&(s+=` ${NM(r.join(" "),t)}`),s.trim()}return e}var jA={text:"var(--mantine-font-family)",mono:"var(--mantine-font-family-monospace)",monospace:"var(--mantine-font-family-monospace)",heading:"var(--mantine-font-family-headings)",headings:"var(--mantine-font-family-headings)"};function n5(e){return typeof e=="string"&&e in jA?jA[e]:e}var i5=["h1","h2","h3","h4","h5","h6"];function r5(e,t){return typeof e=="string"&&e in t.fontSizes?`var(--mantine-font-size-${e})`:typeof e=="string"&&i5.includes(e)?`var(--mantine-${e}-font-size)`:typeof e=="number"||typeof e=="string"?yt(e):e}function s5(e){return e}var o5=["h1","h2","h3","h4","h5","h6"];function a5(e,t){return typeof e=="string"&&e in t.lineHeights?`var(--mantine-line-height-${e})`:typeof e=="string"&&o5.includes(e)?`var(--mantine-${e}-line-height)`:e}function l5(e,t){return typeof e=="string"&&e in t.radius?`var(--mantine-radius-${e})`:typeof e=="number"||typeof e=="string"?yt(e):e}function c5(e){return typeof e=="number"?yt(e):e}function u5(e,t){if(typeof e=="number")return yt(e);if(typeof e=="string"){const n=e.replace("-","");if(!(n in t.spacing))return yt(e);const i=`--mantine-spacing-${n}`;return e.startsWith("-")?`calc(var(${i}) * -1)`:`var(${i})`}return e}var Lb={color:NM,textColor:e5,fontSize:r5,spacing:u5,radius:l5,identity:s5,size:c5,lineHeight:a5,fontFamily:n5,border:t5};function YA(e){return e.replace("(min-width: ","").replace("em)","")}function h5({media:e,...t}){const n=Object.keys(e).sort((i,r)=>Number(YA(i))-Number(YA(r))).map(i=>({query:i,styles:e[i]}));return{...t,media:n}}function f5(e){if(typeof e!="object"||e===null)return!1;const t=Object.keys(e);return!(t.length===1&&t[0]==="base")}function d5(e){return typeof e=="object"&&e!==null?"base"in e?e.base:void 0:e}function p5(e){return typeof e=="object"&&e!==null?ja(e).filter(t=>t!=="base"):[]}function m5(e,t){return typeof e=="object"&&e!==null&&t in e?e[t]:e}function g5({styleProps:e,data:t,theme:n}){return h5(ja(e).reduce((i,r)=>{if(r==="hiddenFrom"||r==="visibleFrom"||r==="sx")return i;const s=t[r],a=Array.isArray(s.property)?s.property:[s.property],c=d5(e[r]);if(!f5(e[r]))return a.forEach(d=>{i.inlineStyles[d]=Lb[s.type](c,n)}),i;i.hasResponsiveStyles=!0;const u=p5(e[r]);return a.forEach(d=>{c!=null&&(i.styles[d]=Lb[s.type](c,n)),u.forEach(p=>{const g=`(min-width: ${n.breakpoints[p]})`;i.media[g]={...i.media[g],[d]:Lb[s.type](m5(e[r],p),n)}})}),i},{hasResponsiveStyles:!1,styles:{},inlineStyles:{},media:{}}))}function _5(){return`__m__-${(0,ht.useId)().replace(/[:«»]/g,"")}`}function v5(e){return e}var y5=v5;function S3(e){return e}function cs(e){const t=e;return t.extend=S3,t.withProps=n=>{const i=r=>(0,Ue.jsx)(t,{...n,...r});return i.extend=t.extend,i.displayName=`WithProps(${t.displayName})`,i},t}function Au(e){const t=e;return t.withProps=n=>{const i=r=>(0,Ue.jsx)(t,{...n,...r});return i.extend=t.extend,i.displayName=`WithProps(${t.displayName})`,i},t.extend=S3,t}function b3(e){return`data-${(e.startsWith("data-")?e.slice(5):e).replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}`}function x5(e){return Object.keys(e).reduce((t,n)=>{const i=e[n];return i===void 0||i===""||i===!1||i===null||(t[b3(n)]=e[n]),t},{})}function M3(e){return e?typeof e=="string"?{[b3(e)]:!0}:Array.isArray(e)?[...e].reduce((t,n)=>({...t,...M3(n)}),{}):x5(e):null}function j2(e,t){return Array.isArray(e)?[...e].reduce((n,i)=>({...n,...j2(i,t)}),{}):typeof e=="function"?e(t):e??{}}function S5({theme:e,style:t,vars:n,styleProps:i}){const r=j2(t,e),s=j2(n,e);return{...r,...s,...i}}function w3({component:e,style:t,__vars:n,className:i,variant:r,mod:s,size:a,hiddenFrom:c,visibleFrom:u,lightHidden:d,darkHidden:p,renderRoot:g,__size:v,ref:y,...S}){const E=Za(),w=e||"div",{styleProps:b,rest:T}=PM(S),L=y4()?.()?.(b.sx),C=_5(),P=g5({styleProps:b,theme:E,data:J4}),O=S4(),B=O&&P.hasResponsiveStyles?Q4(P.styles,P.media):C,U={ref:y,style:S5({theme:E,style:t,vars:n,styleProps:P.inlineStyles}),className:_f(i,L,{[B]:P.hasResponsiveStyles,"mantine-light-hidden":d,"mantine-dark-hidden":p,[`mantine-hidden-from-${c}`]:c,[`mantine-visible-from-${u}`]:u}),"data-variant":r,"data-size":u3(a)?void 0:a||void 0,size:v,...M3(s),...T};return(0,Ue.jsxs)(Ue.Fragment,{children:[P.hasResponsiveStyles&&(0,Ue.jsx)(Z4,{selector:`.${B}`,styles:P.styles,media:P.media,deduplicate:O}),typeof g=="function"?g(U):(0,Ue.jsx)(w,{...U})]})}w3.displayName="@mantine/core/Box";var Zn=y5(w3),b5=(0,ht.createContext)({dir:"ltr",toggleDirection:()=>{},setDirection:()=>{}});function M5(){return(0,ht.use)(b5)}var A3={root:"m_87cf2631"},w5={__staticSelector:"UnstyledButton"},nm=Au(e=>{const t=ai("UnstyledButton",w5,e),{className:n,component:i="button",__staticSelector:r,unstyled:s,classNames:a,styles:c,style:u,attributes:d,...p}=t;return(0,Ue.jsx)(Zn,{...Tr({name:r,props:t,classes:A3,className:n,style:u,classNames:a,styles:c,unstyled:s,attributes:d})("root",{focusable:!0}),component:i,type:i==="button"?"button":void 0,...p})});nm.classes=A3;nm.displayName="@mantine/core/UnstyledButton";var E3={root:"m_1b7284a3"},T3=(e,{radius:t,shadow:n})=>({root:{"--paper-radius":t===void 0?void 0:tm(t),"--paper-shadow":ZI(n)}}),bx=Au(e=>{const t=ai("Paper",null,e),{classNames:n,className:i,style:r,styles:s,unstyled:a,withBorder:c,vars:u,radius:d,shadow:p,variant:g,mod:v,attributes:y,...S}=t,E=Tr({name:"Paper",props:t,classes:E3,className:i,style:r,classNames:n,styles:s,unstyled:a,attributes:y,vars:u,varsResolver:T3});return(0,Ue.jsx)(Zn,{mod:[{"data-with-border":c},v],...E("root"),variant:g,...S})});bx.classes=E3;bx.varsResolver=T3;bx.displayName="@mantine/core/Paper";var f1=e=>({in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${e==="bottom"?10:-10}px)`},transitionProperty:"transform, opacity"}),Fv={fade:{in:{opacity:1},out:{opacity:0},transitionProperty:"opacity"},"fade-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(30px)"},transitionProperty:"opacity, transform"},"fade-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-30px)"},transitionProperty:"opacity, transform"},"fade-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(30px)"},transitionProperty:"opacity, transform"},"fade-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-30px)"},transitionProperty:"opacity, transform"},scale:{in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:"scale(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-y":{in:{opacity:1,transform:"scaleY(1)"},out:{opacity:0,transform:"scaleY(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-x":{in:{opacity:1,transform:"scaleX(1)"},out:{opacity:0,transform:"scaleX(0)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"skew-up":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:"translateY(-20px) skew(-10deg, -5deg)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"skew-down":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:"translateY(20px) skew(-10deg, -5deg)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-left":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:"translateY(20px) rotate(-5deg)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:"translateY(20px) rotate(5deg)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-100%)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(100%)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"slide-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(100%)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"slide-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-100%)"},common:{transformOrigin:"right"},transitionProperty:"transform, opacity"},pop:{...f1("bottom"),common:{transformOrigin:"center center"}},"pop-bottom-left":{...f1("bottom"),common:{transformOrigin:"bottom left"}},"pop-bottom-right":{...f1("bottom"),common:{transformOrigin:"bottom right"}},"pop-top-left":{...f1("top"),common:{transformOrigin:"top left"}},"pop-top-right":{...f1("top"),common:{transformOrigin:"top right"}}},qA={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function $A({transition:e,state:t,duration:n,timingFunction:i}){const r={WebkitBackfaceVisibility:"hidden",transitionDuration:`${n}ms`,transitionTimingFunction:i};return typeof e=="string"?e in Fv?{transitionProperty:Fv[e].transitionProperty,...r,...Fv[e].common,...Fv[e][qA[t]]}:{}:{transitionProperty:e.transitionProperty,...r,...e.common,...e[qA[t]]}}var A5=yx(l3(),1);function E5({duration:e,exitDuration:t,timingFunction:n,mounted:i,onEnter:r,onExit:s,onEntered:a,onExited:c,enterDelay:u,exitDelay:d}){const p=Za(),g=i4(),v=p.respectReducedMotion?g:!1,[y,S]=(0,ht.useState)(v?0:e),[E,w]=(0,ht.useState)(i?"entered":"exited"),b=(0,ht.useRef)(-1),T=(0,ht.useRef)(-1),L=(0,ht.useRef)(-1);function C(){window.clearTimeout(b.current),window.clearTimeout(T.current),cancelAnimationFrame(L.current)}const P=B=>{C();const U=B?r:s,I=B?a:c,z=v?0:B?e:t;S(z),z===0?(typeof U=="function"&&U(),typeof I=="function"&&I(),w(B?"entered":"exited")):L.current=requestAnimationFrame(()=>{A5.flushSync(()=>{w(B?"pre-entering":"pre-exiting")}),L.current=requestAnimationFrame(()=>{typeof U=="function"&&U(),w(B?"entering":"exiting"),b.current=window.setTimeout(()=>{typeof I=="function"&&I(),w(B?"entered":"exited")},z)})})},O=B=>{if(C(),typeof(B?u:d)!="number"){P(B);return}T.current=window.setTimeout(()=>{P(B)},B?u:d)};return JI(()=>{O(i)},[i]),(0,ht.useEffect)(()=>()=>{C()},[]),{transitionDuration:y,transitionStatus:E,transitionTimingFunction:n||"ease"}}function C3({keepMounted:e,transition:t="fade",duration:n=250,exitDuration:i=n,mounted:r,children:s,timingFunction:a="ease",onExit:c,onEntered:u,onEnter:d,onExited:p,enterDelay:g,exitDelay:v}){const y=_3(),{transitionDuration:S,transitionStatus:E,transitionTimingFunction:w}=E5({mounted:r,exitDuration:i,duration:n,timingFunction:a,onExit:c,onEntered:u,onEnter:d,onExited:p,enterDelay:g,exitDelay:v});if(y==="test")return r?(0,Ue.jsx)(Ue.Fragment,{children:s({})}):e?s({display:"none"}):null;if(S===0)return e?(0,Ue.jsx)(ht.Activity,{mode:r?"visible":"hidden",children:s({})}):r?(0,Ue.jsx)(Ue.Fragment,{children:s({})}):null;const b=E==="exited";return e?(0,Ue.jsx)(ht.Activity,{mode:b?"hidden":"visible",children:s(b?{}:$A({transition:t,duration:S,state:E,timingFunction:w}))}):b?null:(0,Ue.jsx)(Ue.Fragment,{children:s($A({transition:t,duration:S,state:E,timingFunction:w}))})}C3.displayName="@mantine/core/Transition";var aa={root:"m_5ae2e3c",barsLoader:"m_7a2bd4cd",bar:"m_870bb79","bars-loader-animation":"m_5d2b3b9d",dotsLoader:"m_4e3f22d7",dot:"m_870c4af","loader-dots-animation":"m_aac34a1",ovalLoader:"m_b34414df","oval-loader-animation":"m_f8e89c4b"},R3=({className:e,...t})=>(0,Ue.jsxs)(Zn,{component:"span",className:_f(aa.barsLoader,e),...t,children:[(0,Ue.jsx)("span",{className:aa.bar}),(0,Ue.jsx)("span",{className:aa.bar}),(0,Ue.jsx)("span",{className:aa.bar})]});R3.displayName="@mantine/core/Bars";var L3=({className:e,...t})=>(0,Ue.jsxs)(Zn,{component:"span",className:_f(aa.dotsLoader,e),...t,children:[(0,Ue.jsx)("span",{className:aa.dot}),(0,Ue.jsx)("span",{className:aa.dot}),(0,Ue.jsx)("span",{className:aa.dot})]});L3.displayName="@mantine/core/Dots";var P3=({className:e,...t})=>(0,Ue.jsx)(Zn,{component:"span",className:_f(aa.ovalLoader,e),...t});P3.displayName="@mantine/core/Oval";var N3={bars:R3,oval:P3,dots:L3},T5={loaders:N3,type:"oval"},I3=(e,{size:t,color:n})=>({root:{"--loader-size":$s(t,"loader-size"),"--loader-color":n?Yp(n,e):void 0}}),im=cs(e=>{const t=ai("Loader",T5,e),{size:n,color:i,type:r,vars:s,className:a,style:c,classNames:u,styles:d,unstyled:p,loaders:g,variant:v,children:y,attributes:S,...E}=t,w=Tr({name:"Loader",props:t,classes:aa,className:a,style:c,classNames:u,styles:d,unstyled:p,attributes:S,vars:s,varsResolver:I3});return y?(0,Ue.jsx)(Zn,{...w("root"),...E,children:y}):(0,Ue.jsx)(Zn,{...w("root"),component:g[r],variant:v,size:n,...E})});im.defaultLoaders=N3;im.classes=aa;im.varsResolver=I3;im.displayName="@mantine/core/Loader";function O3({size:e="var(--cb-icon-size, 70%)",style:t,...n}){return(0,Ue.jsx)("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{...t,width:e,height:e},...n,children:(0,Ue.jsx)("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}O3.displayName="@mantine/core/CloseIcon";var D3={root:"m_86a44da5","root--subtle":"m_220c80f2"},C5={variant:"subtle"},z3=(e,{size:t,radius:n,iconSize:i})=>({root:{"--cb-size":$s(t,"cb-size"),"--cb-radius":n===void 0?void 0:tm(n),"--cb-icon-size":yt(i)}}),Mx=Au(e=>{const t=ai("CloseButton",C5,e),{iconSize:n,children:i,vars:r,radius:s,className:a,classNames:c,style:u,styles:d,unstyled:p,"data-disabled":g,disabled:v,variant:y,icon:S,mod:E,attributes:w,__staticSelector:b,...T}=t,L=Tr({name:b||"CloseButton",props:t,className:a,style:u,classes:D3,classNames:c,styles:d,unstyled:p,attributes:w,vars:r,varsResolver:z3});return(0,Ue.jsxs)(nm,{...T,unstyled:p,variant:y,disabled:v,mod:[{disabled:v||g},E],...L("root",{variant:y,active:!v&&!g}),children:[S||(0,Ue.jsx)(O3,{}),i]})});Mx.classes=D3;Mx.varsResolver=z3;Mx.displayName="@mantine/core/CloseButton";var U3=(0,ht.createContext)({size:"sm"}),B3=cs(e=>{const t=ai("InputClearButton",null,e),{size:n,variant:i,vars:r,classNames:s,styles:a,...c}=t,u=(0,ht.use)(U3),{resolvedClassNames:d,resolvedStyles:p}=D4({classNames:s,styles:a,props:t});return(0,Ue.jsx)(Mx,{variant:i||"transparent",size:n||u?.size||"sm",classNames:d,styles:p,__staticSelector:"InputClearButton",style:{pointerEvents:"all",background:"var(--input-bg)",...c.style},...c})});B3.displayName="@mantine/core/InputClearButton";var R5={xs:7,sm:8,md:10,lg:12,xl:15};function L5({__clearable:e,__clearSection:t,rightSection:n,__defaultRightSection:i,size:r="sm",__clearSectionMode:s="both"}){const a=e&&t;return s==="rightSection"?n===null?null:n||i:s==="clear"?n===null?null:a||i:a&&(n||i)?(0,Ue.jsxs)("div",{"data-combined-clear-section":!0,style:{display:"flex",gap:2,alignItems:"center",paddingInlineEnd:R5[r]},children:[a,n||i]}):n===null?null:n||a||i}var p0=(0,ht.createContext)({offsetBottom:!1,offsetTop:!1,describedBy:void 0,getStyles:null,inputId:void 0,labelId:void 0}),bo={wrapper:"m_6c018570",input:"m_8fb7ebe7",section:"m_82577fc2",placeholder:"m_88bacfd0",root:"m_46b77525",label:"m_8fdc1311",required:"m_78a94662",error:"m_8f816625",description:"m_fe47ce59"},V3=(e,{size:t})=>({description:{"--input-description-size":t===void 0?void 0:`calc(${xo(t)} - ${yt(2)})`}}),m0=cs(e=>{const t=ai("InputDescription",null,e),{classNames:n,className:i,style:r,styles:s,unstyled:a,vars:c,__staticSelector:u,__inheritStyles:d=!0,attributes:p,...g}=ai("InputDescription",null,t),v=(0,ht.use)(p0),y=Tr({name:["InputWrapper",u],props:t,classes:bo,className:i,style:r,classNames:n,styles:s,unstyled:a,attributes:p,rootSelector:"description",vars:c,varsResolver:V3});return(0,Ue.jsx)(Zn,{component:"p",...(d&&v?.getStyles||y)("description",v?.getStyles?{className:i,style:r}:void 0),...g})});m0.classes=bo;m0.varsResolver=V3;m0.displayName="@mantine/core/InputDescription";var F3=(e,{size:t})=>({error:{"--input-error-size":t===void 0?void 0:`calc(${xo(t)} - ${yt(2)})`}}),g0=cs(e=>{const t=ai("InputError",null,e),{classNames:n,className:i,style:r,styles:s,unstyled:a,vars:c,attributes:u,__staticSelector:d,__inheritStyles:p=!0,...g}=t,v=Tr({name:["InputWrapper",d],props:t,classes:bo,className:i,style:r,classNames:n,styles:s,unstyled:a,attributes:u,rootSelector:"error",vars:c,varsResolver:F3}),y=(0,ht.use)(p0);return(0,Ue.jsx)(Zn,{component:"p",...(p&&y?.getStyles||v)("error",y?.getStyles?{className:i,style:r}:void 0),...g})});g0.classes=bo;g0.varsResolver=F3;g0.displayName="@mantine/core/InputError";var P5={labelElement:"label"},k3=(e,{size:t})=>({label:{"--input-label-size":xo(t),"--input-asterisk-color":void 0}}),_0=cs(e=>{const t=ai("InputLabel",P5,e),{classNames:n,className:i,style:r,styles:s,unstyled:a,vars:c,labelElement:u,required:d,htmlFor:p,onMouseDown:g,children:v,__staticSelector:y,mod:S,attributes:E,...w}=t,b=Tr({name:["InputWrapper",y],props:t,classes:bo,className:i,style:r,classNames:n,styles:s,unstyled:a,attributes:E,rootSelector:"label",vars:c,varsResolver:k3}),T=(0,ht.use)(p0),L=T?.getStyles||b;return(0,Ue.jsxs)(Zn,{...L("label",T?.getStyles?{className:i,style:r}:void 0),component:u,htmlFor:u==="label"?p:void 0,mod:[{required:d},S],onMouseDown:C=>{g?.(C),!C.defaultPrevented&&C.detail>1&&C.preventDefault()},...w,children:[v,d&&(0,Ue.jsx)("span",{...L("required"),"aria-hidden":!0,children:" *"})]})});_0.classes=bo;_0.varsResolver=k3;_0.displayName="@mantine/core/InputLabel";var IM=cs(e=>{const t=ai("InputPlaceholder",null,e),{classNames:n,className:i,style:r,styles:s,unstyled:a,vars:c,__staticSelector:u,error:d,mod:p,attributes:g,...v}=t;return(0,Ue.jsx)(Zn,{...Tr({name:["InputPlaceholder",u],props:t,classes:bo,className:i,style:r,classNames:n,styles:s,unstyled:a,attributes:g,rootSelector:"placeholder"})("placeholder"),mod:[{error:!!d},p],component:"span",...v})});IM.classes=bo;IM.displayName="@mantine/core/InputPlaceholder";function N5(e,{hasDescription:t,hasError:n}){const i=e.findIndex(c=>c==="input"),r=e.slice(0,i),s=e.slice(i+1),a=t&&r.includes("description")||n&&r.includes("error");return{offsetBottom:t&&s.includes("description")||n&&s.includes("error"),offsetTop:a}}var I5={labelElement:"label",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},G3=(e,{size:t})=>({label:{"--input-label-size":xo(t),"--input-asterisk-color":void 0},error:{"--input-error-size":t===void 0?void 0:`calc(${xo(t)} - ${yt(2)})`},description:{"--input-description-size":t===void 0?void 0:`calc(${xo(t)} - ${yt(2)})`}}),wx=cs(e=>{const t=ai("InputWrapper",I5,e),{classNames:n,className:i,style:r,styles:s,unstyled:a,vars:c,size:u,variant:d,__staticSelector:p,inputContainer:g,inputWrapperOrder:v,label:y,error:S,description:E,labelProps:w,descriptionProps:b,errorProps:T,labelElement:L,children:C,withAsterisk:P,id:O,required:B,__stylesApiProps:U,mod:I,attributes:z,...te}=t,oe=Tr({name:["InputWrapper",p],props:U||t,classes:bo,className:i,style:r,classNames:n,styles:s,unstyled:a,attributes:z,vars:c,varsResolver:G3}),ee={size:u,variant:d,__staticSelector:p},k=d3(O),X=typeof P=="boolean"?P:B,$=T?.id||`${k}-error`,j=b?.id||`${k}-description`,J=k,xe=!!S&&typeof S!="boolean",de=!!E,fe=`${xe?$:""} ${de?j:""}`,F=fe.trim().length>0?fe.trim():void 0,re=w?.id||`${k}-label`,ue=y&&(0,Ue.jsx)(_0,{labelElement:L,id:re,htmlFor:J,required:X,...ee,...w,children:y},"label"),_e=de&&(0,Ue.jsx)(m0,{...b,...ee,size:b?.size||ee.size,id:b?.id||j,children:E},"description"),Le=(0,Ue.jsx)(ht.Fragment,{children:g(C)},"input"),Fe=xe&&(0,ht.createElement)(g0,{...T,...ee,size:T?.size||ee.size,key:"error",id:T?.id||$},S),Xe=v.map(lt=>{switch(lt){case"label":return ue;case"input":return Le;case"description":return _e;case"error":return Fe;default:return null}});return(0,Ue.jsx)(p0,{value:{getStyles:oe,describedBy:F,inputId:J,labelId:re,...N5(v,{hasDescription:de,hasError:xe})},children:(0,Ue.jsx)(Zn,{variant:d,size:u,mod:[{error:!!S},I],id:L==="label"?void 0:O,...oe("root"),...te,children:Xe})})});wx.classes=bo;wx.varsResolver=G3;wx.displayName="@mantine/core/InputWrapper";var O5={variant:"default",leftSectionPointerEvents:"none",rightSectionPointerEvents:"none",withAria:!0,withErrorStyles:!0,size:"sm",loading:!1,loadingPosition:"right"},H3=(e,t,n)=>({wrapper:{"--input-margin-top":n.offsetTop?"calc(var(--mantine-spacing-xs) / 2)":void 0,"--input-margin-bottom":n.offsetBottom?"calc(var(--mantine-spacing-xs) / 2)":void 0,"--input-height":$s(t.size,"input-height"),"--input-fz":xo(t.size),"--input-radius":t.radius===void 0?void 0:tm(t.radius),"--input-left-section-width":t.leftSectionWidth!==void 0?yt(t.leftSectionWidth):void 0,"--input-right-section-width":t.rightSectionWidth!==void 0?yt(t.rightSectionWidth):void 0,"--input-padding-y":t.multiline?$s(t.size,"input-padding-y"):void 0,"--input-left-section-pointer-events":t.leftSectionPointerEvents,"--input-right-section-pointer-events":t.rightSectionPointerEvents}}),Zs=Au(e=>{const t=ai("Input",O5,e),{classNames:n,className:i,style:r,styles:s,unstyled:a,required:c,__staticSelector:u,__stylesApiProps:d,size:p,wrapperProps:g,error:v,disabled:y,leftSection:S,leftSectionProps:E,leftSectionWidth:w,rightSection:b,rightSectionProps:T,rightSectionWidth:L,rightSectionPointerEvents:C,leftSectionPointerEvents:P,variant:O,vars:B,pointer:U,multiline:I,radius:z,id:te,withAria:oe,withErrorStyles:ee,mod:k,inputSize:X,attributes:$,__clearSection:j,__clearable:J,__clearSectionMode:xe,__defaultRightSection:de,loading:fe,loadingPosition:F,rootRef:re,...ue}=t,{styleProps:_e,rest:Le}=PM(ue),Fe=(0,ht.use)(p0),Xe={offsetBottom:Fe?.offsetBottom,offsetTop:Fe?.offsetTop},lt=Tr({name:["Input",u],props:d||t,classes:bo,className:i,style:r,classNames:n,styles:s,unstyled:a,attributes:$,stylesCtx:Xe,rootSelector:"wrapper",vars:B,varsResolver:H3}),mt=oe?{required:c,disabled:y,"aria-invalid":v?!0:void 0,"aria-describedby":Fe?.describedBy,id:Fe?.inputId||te}:{},ne=fe?(0,Ue.jsx)(im,{size:F==="left"?"calc(var(--input-left-section-size) / 2)":"calc(var(--input-right-section-size) / 2)"}):null,Be=fe&&F==="left"?ne:S,Ne=L5({__clearable:J,__clearSection:j,rightSection:fe&&F==="right"?ne:b,__defaultRightSection:de,size:p,__clearSectionMode:xe});return(0,Ue.jsx)(U3,{value:{size:p||"sm"},children:(0,Ue.jsxs)(Zn,{ref:re,...lt("wrapper"),..._e,...g,mod:[{error:!!v&&ee,pointer:U,disabled:y,multiline:I,"data-with-right-section":!!Ne,"data-with-left-section":!!Be},k],variant:O,size:p,children:[Be&&(0,Ue.jsx)("div",{...E,"data-position":"left",...lt("section",{className:E?.className,style:E?.style}),children:Be}),(0,Ue.jsx)(Zn,{component:"input",...Le,...mt,required:c,mod:{disabled:y,error:!!v&&ee},variant:O,__size:X,...lt("input")}),Ne&&(0,Ue.jsx)("div",{...T,"data-position":"right",...lt("section",{className:T?.className,style:T?.style}),children:Ne})]})})});Zs.classes=bo;Zs.varsResolver=H3;Zs.Wrapper=wx;Zs.Label=_0;Zs.Error=g0;Zs.Description=m0;Zs.Placeholder=IM;Zs.ClearButton=B3;Zs.displayName="@mantine/core/Input";function D5(e,t,n){const i=ai(e,t,n),{label:r,description:s,error:a,required:c,classNames:u,styles:d,className:p,unstyled:g,__staticSelector:v,__stylesApiProps:y,errorProps:S,labelProps:E,descriptionProps:w,wrapperProps:b,id:T,size:L,style:C,inputContainer:P,inputWrapperOrder:O,withAsterisk:B,variant:U,vars:I,mod:z,attributes:te,...oe}=i,{styleProps:ee,rest:k}=PM(oe),X={label:r,description:s,error:a,required:c,classNames:u,className:p,__staticSelector:v,__stylesApiProps:y||i,errorProps:S,labelProps:E,descriptionProps:w,unstyled:g,styles:d,size:L,style:C,inputContainer:P,inputWrapperOrder:O,withAsterisk:B,variant:U,id:T,mod:z,attributes:te,...b};return{...k,classNames:u,styles:d,unstyled:g,wrapperProps:{...X,...ee},inputProps:{required:c,classNames:u,styles:d,unstyled:g,size:L,__staticSelector:v,__stylesApiProps:y||i,error:a,variant:U,id:T,attributes:te}}}var z5={__staticSelector:"InputBase",withAria:!0,size:"sm"},Ax=Au(e=>{const{inputProps:t,wrapperProps:n,...i}=D5("InputBase",z5,e);return(0,Ue.jsx)(Zs.Wrapper,{...n,children:(0,Ue.jsx)(Zs,{...t,...i})})});Ax.classes={...Zs.classes,...Zs.Wrapper.classes};Ax.displayName="@mantine/core/InputBase";var W3={root:"m_b6d8b162"};function U5(e){if(e==="start")return"start";if(e==="end"||e)return"end"}var B5={inherit:!1},X3=(e,{variant:t,lineClamp:n,gradient:i,size:r})=>({root:{"--text-fz":xo(r),"--text-lh":$I(r),"--text-gradient":t==="gradient"?W2(i,e):void 0,"--text-line-clamp":typeof n=="number"?n.toString():void 0}}),Zl=Au(e=>{const t=ai("Text",B5,e),{lineClamp:n,truncate:i,inline:r,inherit:s,gradient:a,span:c,__staticSelector:u,vars:d,className:p,style:g,classNames:v,styles:y,unstyled:S,variant:E,mod:w,size:b,attributes:T,...L}=t;return(0,Ue.jsx)(Zn,{...Tr({name:["Text",u],props:t,classes:W3,className:p,style:g,classNames:v,styles:y,unstyled:S,attributes:T,vars:d,varsResolver:X3})("root",{focusable:!0}),component:c?"span":"p",variant:E,mod:[{"data-truncate":U5(i),"data-line-clamp":typeof n=="number","data-inline":r,"data-inherit":s},w],size:b,...L})});Zl.classes=W3;Zl.varsResolver=X3;Zl.displayName="@mantine/core/Text";var rm={root:"m_77c9d27d",inner:"m_80f1301b",label:"m_811560b9",section:"m_a74036a",loader:"m_a25b86ee",group:"m_80d6d844",groupSection:"m_70be2a01"},ZA={orientation:"horizontal"},j3=(e,{borderWidth:t})=>({group:{"--button-border-width":yt(t)}}),Ex=cs(e=>{const t=ai("ButtonGroup",ZA,e),{className:n,style:i,classNames:r,styles:s,unstyled:a,orientation:c,vars:u,borderWidth:d,mod:p,attributes:g,...v}=ai("ButtonGroup",ZA,e);return(0,Ue.jsx)(Zn,{...Tr({name:"ButtonGroup",props:t,classes:rm,className:n,style:i,classNames:r,styles:s,unstyled:a,attributes:g,vars:u,varsResolver:j3,rootSelector:"group"})("group"),mod:[{"data-orientation":c},p],role:"group",...v})});Ex.classes=rm;Ex.varsResolver=j3;Ex.displayName="@mantine/core/ButtonGroup";var Y3=(e,{radius:t,color:n,gradient:i,variant:r,autoContrast:s,size:a})=>{const c=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:i,variant:r||"filled",autoContrast:s});return{groupSection:{"--section-height":$s(a,"section-height"),"--section-padding-x":$s(a,"section-padding-x"),"--section-fz":a?.includes("compact")?xo(a.replace("compact-","")):xo(a),"--section-radius":t===void 0?void 0:tm(t),"--section-bg":n||r?c.background:void 0,"--section-color":c.color,"--section-bd":n||r?c.border:void 0}}},Tx=cs(e=>{const t=ai("ButtonGroupSection",null,e),{className:n,style:i,classNames:r,styles:s,unstyled:a,vars:c,gradient:u,radius:d,autoContrast:p,attributes:g,...v}=t;return(0,Ue.jsx)(Zn,{...Tr({name:"ButtonGroupSection",props:t,classes:rm,className:n,style:i,classNames:r,styles:s,unstyled:a,attributes:g,vars:c,varsResolver:Y3,rootSelector:"groupSection"})("groupSection"),...v})});Tx.classes=rm;Tx.varsResolver=Y3;Tx.displayName="@mantine/core/ButtonGroupSection";var V5={in:{opacity:1,transform:`translate(-50%, calc(-50% + ${yt(1)}))`},out:{opacity:0,transform:"translate(-50%, -200%)"},common:{transformOrigin:"center"},transitionProperty:"transform, opacity"},q3=(e,{radius:t,color:n,gradient:i,variant:r,size:s,justify:a,autoContrast:c})=>{const u=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:i,variant:r||"filled",autoContrast:c});return{root:{"--button-justify":a,"--button-height":$s(s,"button-height"),"--button-padding-x":$s(s,"button-padding-x"),"--button-fz":s?.includes("compact")?xo(s.replace("compact-","")):xo(s),"--button-radius":t===void 0?void 0:tm(t),"--button-bg":n||r?u.background:void 0,"--button-hover":n||r?u.hover:void 0,"--button-color":u.color,"--button-bd":n||r?u.border:void 0,"--button-hover-color":n||r?u.hoverColor:void 0}}},cf=Au(e=>{const t=ai("Button",null,e),{style:n,vars:i,className:r,color:s,disabled:a,children:c,leftSection:u,rightSection:d,fullWidth:p,variant:g,radius:v,loading:y,loaderProps:S,gradient:E,classNames:w,styles:b,unstyled:T,"data-disabled":L,autoContrast:C,mod:P,attributes:O,...B}=t,U=Tr({name:"Button",props:t,classes:rm,className:r,style:n,classNames:w,styles:b,unstyled:T,attributes:O,vars:i,varsResolver:q3}),I=!!u,z=!!d;return(0,Ue.jsxs)(nm,{...U("root",{active:!a&&!y&&!L}),unstyled:T,variant:g,disabled:a||y,mod:[{disabled:a||L,loading:y,block:p,"with-left-section":I,"with-right-section":z},P],...B,children:[typeof y=="boolean"&&(0,Ue.jsx)(C3,{mounted:y,transition:V5,duration:150,children:te=>(0,Ue.jsx)(Zn,{component:"span",...U("loader",{style:te}),"aria-hidden":!0,children:(0,Ue.jsx)(im,{color:"var(--button-color)",size:"calc(var(--button-height) / 1.8)",...S})})}),(0,Ue.jsxs)("span",{...U("inner"),children:[u&&(0,Ue.jsx)(Zn,{component:"span",...U("section"),mod:{position:"left"},children:u}),(0,Ue.jsx)(Zn,{component:"span",mod:{loading:y},...U("label"),children:c}),d&&(0,Ue.jsx)(Zn,{component:"span",...U("section"),mod:{position:"right"},children:d})]})]})});cf.classes=rm;cf.varsResolver=q3;cf.displayName="@mantine/core/Button";cf.Group=Ex;cf.GroupSection=Tx;var $3={root:"m_4451eb3a"},OM=Au(e=>{const t=ai("Center",null,e),{classNames:n,className:i,style:r,styles:s,unstyled:a,vars:c,inline:u,mod:d,attributes:p,...g}=t,v=Tr({name:"Center",props:t,classes:$3,className:i,style:r,classNames:n,styles:s,unstyled:a,attributes:p,vars:c});return(0,Ue.jsx)(Zn,{mod:[{inline:u},d],...v("root"),...g})});OM.classes=$3;OM.displayName="@mantine/core/Center";var Z3={root:"m_3eebeb36",label:"m_9e365f20"},F5={orientation:"horizontal"},K3=(e,{color:t,variant:n,size:i})=>({root:{"--divider-color":t?Yp(t,e):void 0,"--divider-border-style":n,"--divider-size":$s(i,"divider-size")}}),v0=cs(e=>{const t=ai("Divider",F5,e),{classNames:n,className:i,style:r,styles:s,unstyled:a,vars:c,color:u,orientation:d,label:p,labelPosition:g,mod:v,attributes:y,...S}=t,E=Tr({name:"Divider",classes:Z3,props:t,className:i,style:r,classNames:n,styles:s,unstyled:a,attributes:y,vars:c,varsResolver:K3});return(0,Ue.jsx)(Zn,{mod:[{orientation:d,withLabel:!!p},v],role:"separator",...E("root"),...S,children:p&&(0,Ue.jsx)(Zn,{component:"span",mod:{position:g},...E("label"),children:p})})});v0.classes=Z3;v0.varsResolver=K3;v0.displayName="@mantine/core/Divider";var k5=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],KA={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"};function QA(e){Object.keys(KA).forEach(t=>{e.style.setProperty(t,KA[t],"important")})}function G5(e){const t=window.getComputedStyle(e);if(t===null)return null;const n={};for(const i of k5)n[i]=t[i];return n.boxSizing===""?null:{sizingStyle:n,paddingSize:parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),borderSize:parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth)}}var cr=null;function H5(e,t,n=1,i=1/0){cr||(cr=document.createElement("textarea"),cr.setAttribute("tabindex","-1"),cr.setAttribute("aria-hidden","true"),cr.setAttribute("aria-label","autosize measurement"),QA(cr)),cr.parentNode===null&&document.body.appendChild(cr);const{paddingSize:r,borderSize:s,sizingStyle:a}=e,{boxSizing:c}=a;Object.keys(a).forEach(v=>{cr.style[v]=a[v]}),QA(cr),cr.value=t;let u=c==="border-box"?cr.scrollHeight+s:cr.scrollHeight-r;cr.value=t,u=c==="border-box"?cr.scrollHeight+s:cr.scrollHeight-r,cr.value="x";const d=cr.scrollHeight-r;let p=d*n;c==="border-box"&&(p=p+r+s),u=Math.max(p,u);let g=d*i;return c==="border-box"&&(g=g+r+s),u=Math.min(g,u),[u,d]}function W5({maxRows:e,minRows:t,onChange:n,ref:i,...r}){const s=r.value!==void 0,a=(0,ht.useRef)(null),c=t4(a,i),u=(0,ht.useRef)(0),d=()=>{const g=a.current;if(!g)return;const v=G5(g);if(!v)return;const[y]=H5(v,g.value||g.placeholder||"x",t,e);u.current!==y&&(u.current=y,g.style.setProperty("height",`${y}px`,"important"))},p=g=>{s||d(),n?.(g)};return(0,ht.useLayoutEffect)(d),(0,ht.useEffect)(()=>{const g=()=>d();return window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)},[]),(0,ht.useEffect)(()=>{const g=()=>d();return document.fonts.addEventListener("loadingdone",g),()=>document.fonts.removeEventListener("loadingdone",g)},[]),(0,ht.useEffect)(()=>{const g=v=>{if(a.current?.form===v.target&&!s){const y=a.current.value;requestAnimationFrame(()=>{a.current&&y!==a.current.value&&d()})}};return document.body.addEventListener("reset",g),()=>document.body.removeEventListener("reset",g)},[s]),(0,Ue.jsx)("textarea",{...r,onChange:p,ref:c})}var X5={size:"sm"},DM=cs(e=>{const{autosize:t,maxRows:n,minRows:i,__staticSelector:r,resize:s,...a}=ai("Textarea",X5,e),c=t&&r4()!=="test",u=c?{maxRows:n,minRows:i}:{};return(0,Ue.jsx)(Ax,{component:c?W5:"textarea",...a,__staticSelector:r||"Textarea",multiline:!0,"data-no-overflow":t&&n===void 0||void 0,__vars:{"--input-resize":s},...u})});DM.classes=Ax.classes;DM.displayName="@mantine/core/Textarea";var[j5,zM]=HI("Tabs component was not found in the tree"),y0={root:"m_89d60db1","list--default":"m_576c9d4",list:"m_89d33d6d",tab:"m_4ec4dce6",panel:"m_b0c91715",tabSection:"m_fc420b1f",tabLabel:"m_42bbd1ae","tab--default":"m_539e827b","list--outline":"m_6772fbd5","tab--outline":"m_b59ab47c","tab--pills":"m_c3381914"},UM=cs(e=>{const t=ai("TabsList",null,e),{children:n,className:i,grow:r,justify:s,classNames:a,styles:c,style:u,mod:d,...p}=t,g=zM();return(0,Ue.jsx)(Zn,{...g.getStyles("list",{className:i,style:u,classNames:a,styles:c,props:t,variant:g.variant}),role:"tablist",variant:g.variant,mod:[{grow:r,orientation:g.orientation,placement:g.orientation==="vertical"&&g.placement,inverted:g.inverted},d],"aria-orientation":g.orientation,__vars:{"--tabs-justify":s},...p,children:n})});UM.classes=y0;UM.displayName="@mantine/core/TabsList";var BM=cs(e=>{const t=ai("TabsPanel",null,e),{children:n,className:i,value:r,classNames:s,styles:a,style:c,mod:u,keepMounted:d,...p}=t,g=_3(),v=zM(),y=v.value===r,S=v.keepMounted||d,E=v.keepMountedMode!=="display-none",w=S&&E&&g!=="test"?(0,Ue.jsx)(ht.Activity,{mode:y?"visible":"hidden",children:n}):S||y?n:null;return(0,Ue.jsx)(Zn,{...v.getStyles("panel",{className:i,classNames:s,styles:a,style:[c,y?void 0:{display:"none"}],props:t}),mod:[{orientation:v.orientation},u],role:"tabpanel",id:v.getPanelId(r),"aria-labelledby":v.getTabId(r),...p,children:w})});BM.classes=y0;BM.displayName="@mantine/core/TabsPanel";var VM=cs(e=>{const t=ai("TabsTab",null,e),{className:n,children:i,rightSection:r,leftSection:s,value:a,onClick:c,onKeyDown:u,disabled:d,color:p,style:g,classNames:v,styles:y,vars:S,mod:E,tabIndex:w,...b}=t,T=Za(),{dir:L}=M5(),C=zM(),P=a===C.value,O=U=>{C.onChange(C.allowTabDeactivation&&a===C.value?null:a),c?.(U)},B={classNames:v,styles:y,props:t};return(0,Ue.jsxs)(nm,{...C.getStyles("tab",{className:n,style:g,variant:C.variant,...B}),disabled:d,unstyled:C.unstyled,variant:C.variant,mod:[{active:P,disabled:d,orientation:C.orientation,inverted:C.inverted,placement:C.orientation==="vertical"&&C.placement},E],role:"tab",id:C.getTabId(a),"aria-selected":P,tabIndex:w!==void 0?w:P||C.value===null?0:-1,"aria-controls":C.getPanelId(a),onClick:O,__vars:{"--tabs-color":p?Yp(p,T):void 0},onKeyDown:YI({siblingSelector:'[role="tab"]',parentSelector:'[role="tablist"]',activateOnFocus:C.activateTabWithKeyboard,loop:C.loop,orientation:C.orientation||"horizontal",dir:L,onKeyDown:u}),...b,children:[s&&(0,Ue.jsx)("span",{...C.getStyles("tabSection",B),"data-position":"left",children:s}),i&&(0,Ue.jsx)("span",{...C.getStyles("tabLabel",B),children:i}),r&&(0,Ue.jsx)("span",{...C.getStyles("tabSection",B),"data-position":"right",children:r})]})});VM.classes=y0;VM.displayName="@mantine/core/TabsTab";var JA="Tabs.Tab or Tabs.Panel component was rendered with invalid value or without value",Y5={keepMounted:!0,keepMountedMode:"activity",orientation:"horizontal",loop:!0,activateTabWithKeyboard:!0,variant:"default",placement:"left"},Q3=(e,{radius:t,color:n,autoContrast:i})=>({root:{"--tabs-radius":tm(t),"--tabs-color":Yp(n,e),"--tabs-text-color":p4(i,e)?g3({color:n,theme:e,autoContrast:i}):void 0}}),vo=cs(e=>{const t=ai("Tabs",Y5,e),{defaultValue:n,value:i,onChange:r,orientation:s,children:a,loop:c,id:u,activateTabWithKeyboard:d,allowTabDeactivation:p,variant:g,color:v,radius:y,inverted:S,placement:E,keepMounted:w,keepMountedMode:b,classNames:T,styles:L,unstyled:C,className:P,style:O,vars:B,autoContrast:U,mod:I,attributes:z,...te}=t,oe=d3(u),[ee,k]=n4({value:i,defaultValue:n,finalValue:null,onChange:r}),X=Tr({name:"Tabs",props:t,classes:y0,className:P,style:O,classNames:T,styles:L,unstyled:C,attributes:z,vars:B,varsResolver:Q3});return(0,Ue.jsx)(j5,{value:{placement:E,value:ee,orientation:s,id:oe,loop:c,activateTabWithKeyboard:d,getTabId:UA(`${oe}-tab`,JA),getPanelId:UA(`${oe}-panel`,JA),onChange:k,allowTabDeactivation:p,variant:g,color:v,radius:y,inverted:S,keepMounted:w,keepMountedMode:b,unstyled:C,getStyles:X},children:(0,Ue.jsx)(Zn,{id:oe,variant:g,mod:[{orientation:s,inverted:s==="horizontal"&&S,placement:s==="vertical"&&E},I],...X("root"),...te,children:a})})});vo.classes=y0;vo.varsResolver=Q3;vo.displayName="@mantine/core/Tabs";vo.Tab=VM;vo.Panel=BM;vo.List=UM;function q5(e,t){const n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function $5(e,t){const n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function Z5(e){return e/100*window.innerHeight}function K5(e){return e/100*window.innerWidth}function Q5(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function O1({groupSize:e,panelElement:t,styleProp:n}){let i;const[r,s]=Q5(n);switch(s){case"%":i=r/100*e;break;case"px":i=r;break;case"rem":i=$5(t,r);break;case"em":i=q5(t,r);break;case"vh":i=Z5(r);break;case"vw":i=K5(r);break}return i}function As(e){return parseFloat(e.toFixed(3))}function qp({group:e}){const{orientation:t,panels:n}=e;return n.reduce((i,r)=>(i+=t==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,i),0)}function Y2(e){const{panels:t}=e,n=qp({group:e});return n===0?t.map(i=>({groupResizeBehavior:i.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:i.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:i.panelConstraints.disabled,minSize:0,maxSize:100,panelId:i.id})):t.map(i=>{const{element:r,panelConstraints:s}=i;let a=0;s.collapsedSize!==void 0&&(a=As(O1({groupSize:n,panelElement:r,styleProp:s.collapsedSize})/n*100));let c;s.defaultSize!==void 0&&(c=As(O1({groupSize:n,panelElement:r,styleProp:s.defaultSize})/n*100));let u=0;s.minSize!==void 0&&(u=As(O1({groupSize:n,panelElement:r,styleProp:s.minSize})/n*100));let d=100;return s.maxSize!==void 0&&(d=As(O1({groupSize:n,panelElement:r,styleProp:s.maxSize})/n*100)),{groupResizeBehavior:s.groupResizeBehavior,collapsedSize:a,collapsible:s.collapsible===!0,defaultSize:c,disabled:s.disabled,minSize:u,maxSize:d,panelId:i.id}})}function Hn(e,t="Assertion error"){if(!e)throw Error(t)}function q2(e,t){return Array.from(t).sort(e==="horizontal"?J5:eO)}function J5(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function eO(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function J3(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function eR(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function tO({orientation:e,rects:t,targetRect:n}){const i={x:n.x+n.width/2,y:n.y+n.height/2};let r,s=Number.MAX_VALUE;for(const a of t){const{x:c,y:u}=eR(i,a),d=e==="horizontal"?c:u;d<s&&(s=d,r=a)}return Hn(r,"No rect found"),r}var kv;function nO(){return kv===void 0&&(typeof matchMedia=="function"?kv=!!matchMedia("(pointer:coarse)").matches:kv=!1),kv}function tR(e){const{element:t,orientation:n,panels:i,separators:r}=e,s=q2(n,Array.from(t.children).filter(J3).map(S=>({element:S}))).map(({element:S})=>S),a=[];let c=!1,u=!1,d=-1,p=-1,g=0,v,y=[];{let S=-1;for(const E of s)E.hasAttribute("data-panel")&&(S++,E.hasAttribute("data-disabled")||(g++,d===-1&&(d=S),p=S))}if(g>1){let S=-1;for(const E of s)if(E.hasAttribute("data-panel")){S++;const w=i.find(b=>b.element===E);if(w){if(v){const b=v.element.getBoundingClientRect(),T=E.getBoundingClientRect();let L;if(u){const C=n==="horizontal"?new DOMRect(b.right,b.top,0,b.height):new DOMRect(b.left,b.bottom,b.width,0),P=n==="horizontal"?new DOMRect(T.left,T.top,0,T.height):new DOMRect(T.left,T.top,T.width,0);switch(y.length){case 0:L=[C,P];break;case 1:{const O=y[0];L=[O,tO({orientation:n,rects:[b,T],targetRect:O.element.getBoundingClientRect()})===b?P:C];break}default:L=y;break}}else y.length?L=y:L=[n==="horizontal"?new DOMRect(b.right,T.top,T.left-b.right,T.height):new DOMRect(T.left,b.bottom,T.width,T.top-b.bottom)];for(const C of L){let P="width"in C?C:C.element.getBoundingClientRect();const O=nO()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(P.width<O){const B=O-P.width;P=new DOMRect(P.x-B/2,P.y,P.width+B,P.height)}if(P.height<O){const B=O-P.height;P=new DOMRect(P.x,P.y-B/2,P.width,P.height+B)}!c&&!(S<=d||S>p)&&a.push({group:e,groupSize:qp({group:e}),panels:[v,w],separator:"width"in C?void 0:C,rect:P}),c=!1}}u=!1,v=w,y=[]}}else if(E.hasAttribute("data-separator")){E.ariaDisabled!==null&&(c=!0);const w=r.find(b=>b.element===E);w?y.push(w):(v=void 0,y=[])}else u=!0}return a}var nR=class{#e={};addListener(e,t){const n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){const n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let i=!1,r=null;const s=Array.from(n);for(let a=0;a<s.length;a++){const c=s[a];try{c.call(null,t)}catch(u){r===null&&(i=!0,r=u)}}if(i)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){const n=this.#e[e];if(n!==void 0){const i=n.indexOf(t);i>=0&&n.splice(i,1)}}},Xa=new Map,iR=new nR;function iO(e){Xa=new Map(Xa),Xa.delete(e)}function eE(e,t){for(const[n]of Xa)if(n.id===e)return n}function xu(e,t){for(const[n,i]of Xa)if(n.id===e)return i;if(t)throw Error(`Could not find data for Group with id ${e}`)}function vf(){return Xa}function FM(e,t){return iR.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function Kl(e,t){const n=Xa.get(e);Xa=new Map(Xa),Xa.set(e,t),iR.emit("groupChange",{group:e,prev:n,next:t})}function rO(e,t,n){let i,r={x:1/0,y:1/0};for(const s of t){const a=eR(n,s.rect);switch(e){case"horizontal":a.x<=r.x&&(i=s,r=a);break;case"vertical":a.y<=r.y&&(i=s,r=a);break}}return i?{distance:r,hitRegion:i}:void 0}function sO(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function oO(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:iE(e),b:iE(t)};let i;for(;n.a.at(-1)===n.b.at(-1);)i=n.a.pop(),n.b.pop();Hn(i,"Stacking order can only be calculated for elements with a common ancestor");const r={a:nE(tE(n.a)),b:nE(tE(n.b))};if(r.a===r.b){const s=i.childNodes,a={a:n.a.at(-1),b:n.b.at(-1)};let c=s.length;for(;c--;){const u=s[c];if(u===a.a)return 1;if(u===a.b)return-1}}return Math.sign(r.a-r.b)}var aO=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function lO(e){const t=getComputedStyle(rR(e)??e).display;return t==="flex"||t==="inline-flex"}function cO(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||lO(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||aO.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function tE(e){let t=e.length;for(;t--;){const n=e[t];if(Hn(n,"Missing node"),cO(n))return n}return null}function nE(e){return e&&Number(getComputedStyle(e).zIndex)||0}function iE(e){const t=[];for(;e;)t.push(e),e=rR(e);return t}function rR(e){const{parentNode:t}=e;return sO(t)?t.host:t}function uO(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function hO({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!J3(n)||n.contains(e)||e.contains(n))return!0;if(oO(n,e)>0){let i=n;for(;i;){if(i.contains(e))return!0;if(uO(i.getBoundingClientRect(),t))return!1;i=i.parentElement}}return!0}function kM(e,t){const n=[];return t.forEach((i,r)=>{if(r.disabled)return;const s=tR(r),a=rO(r.orientation,s,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&hO({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function fO(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function os(e,t,n=0){return Math.abs(As(e)-As(t))<=n}function Wa(e,t){return os(e,t)?0:e>t?1:-1}function Dp({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:i}){const{collapsedSize:r=0,collapsible:s,disabled:a,maxSize:c=100,minSize:u=0}=t;if(a&&!e)return n;if(Wa(i,u)<0)if(s){const d=(r+u)/2;Wa(i,d)<0?i=r:i=u}else i=u;return i=Math.min(c,i),i=As(i),i}function Y1({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:i,prevLayout:r,trigger:s}){if(os(e,0))return t;const a=s==="imperative-api",c=Object.values(t),u=Object.values(r),d=[...c],[p,g]=i;Hn(p!=null,"Invalid first pivot index"),Hn(g!=null,"Invalid second pivot index");let v=0;switch(s){case"keyboard":{const S=e<0?g:p,E=n[S];Hn(E,`Panel constraints not found for index ${S}`);const{collapsedSize:w=0,collapsible:b,minSize:T=0}=E;if(b){const L=c[S];if(Hn(L!=null,`Previous layout not found for panel index ${S}`),os(L,w)){const C=T-L;Wa(C,Math.abs(e))>0&&(e=e<0?0-C:C)}}}{const S=e<0?p:g,E=n[S];Hn(E,`No panel constraints found for index ${S}`);const{collapsedSize:w=0,collapsible:b,minSize:T=0}=E;if(b){const L=c[S];if(Hn(L!=null,`Previous layout not found for panel index ${S}`),os(L,T)){const C=L-w;Wa(C,Math.abs(e))>0&&(e=e<0?0-C:C)}}}break;default:{const S=e<0?g:p,E=n[S];Hn(E,`Panel constraints not found for index ${S}`);const w=c[S],{collapsible:b,collapsedSize:T,minSize:L}=E;if(b&&Wa(w,L)<0)if(e>0){const C=L-T,P=C/2;Wa(w+e,L)<0&&(e=Wa(e,P)<=0?0:C)}else{const C=L-T,P=100-C/2;Wa(w-e,L)<0&&(e=Wa(100+e,P)>0?0:-C)}break}}{const S=e<0?1:-1;let E=e<0?g:p,w=0;for(;;){const T=c[E];Hn(T!=null,`Previous layout not found for panel index ${E}`);const L=Dp({overrideDisabledPanels:a,panelConstraints:n[E],prevSize:T,size:100})-T;if(w+=L,E+=S,E<0||E>=n.length)break}const b=Math.min(Math.abs(e),Math.abs(w));e=e<0?0-b:b}{let S=e<0?p:g;for(;S>=0&&S<n.length;){const E=Math.abs(e)-Math.abs(v),w=c[S];Hn(w!=null,`Previous layout not found for panel index ${S}`);const b=w-E,T=Dp({overrideDisabledPanels:a,panelConstraints:n[S],prevSize:w,size:b});if(!os(w,T)&&(v+=w-T,d[S]=T,v.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?S--:S++}}if(fO(u,d))return r;{const S=e<0?g:p,E=c[S];Hn(E!=null,`Previous layout not found for panel index ${S}`);const w=E+v,b=Dp({overrideDisabledPanels:a,panelConstraints:n[S],prevSize:E,size:w});if(d[S]=b,!os(b,w)){let T=w-b,L=e<0?g:p;for(;L>=0&&L<n.length;){const C=d[L];Hn(C!=null,`Previous layout not found for panel index ${L}`);const P=C+T,O=Dp({overrideDisabledPanels:a,panelConstraints:n[L],prevSize:C,size:P});if(os(C,O)||(T-=O-C,d[L]=O),os(T,0))break;e>0?L--:L++}}}if(!os(Object.values(d).reduce((S,E)=>E+S,0),100,.1))return r;const y=Object.keys(r);return d.reduce((S,E,w)=>(S[y[w]]=E,S),{})}function uf(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||Wa(e[n],t[n])!==0)return!1;return!0}function hf({layout:e,panelConstraints:t}){const n=Object.values(e),i=[...n],r=i.reduce((c,u)=>c+u,0);if(i.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${i.map(c=>`${c}%`).join(", ")}`);if(!os(r,100)&&i.length>0)for(let c=0;c<t.length;c++){const u=i[c];Hn(u!=null,`No layout data found for index ${c}`),i[c]=100/r*u}let s=0;for(let c=0;c<t.length;c++){const u=n[c];Hn(u!=null,`No layout data found for index ${c}`);const d=i[c];Hn(d!=null,`No layout data found for index ${c}`);const p=Dp({overrideDisabledPanels:!0,panelConstraints:t[c],prevSize:u,size:d});d!=p&&(s+=d-p,i[c]=p)}if(!os(s,0))for(let c=0;c<t.length;c++){const u=i[c];Hn(u!=null,`No layout data found for index ${c}`);const d=u+s,p=Dp({overrideDisabledPanels:!0,panelConstraints:t[c],prevSize:u,size:d});if(u!==p&&(s-=p-u,i[c]=p,os(s,0)))break}const a=Object.keys(e);return i.reduce((c,u,d)=>(c[a[d]]=u,c),{})}function sR({groupId:e,panelId:t}){const n=()=>{const c=vf();for(const[u,{defaultLayoutDeferred:d,derivedPanelConstraints:p,layout:g,groupSize:v,separatorToPanels:y}]of c)if(u.id===e)return{defaultLayoutDeferred:d,derivedPanelConstraints:p,group:u,groupSize:v,layout:g,separatorToPanels:y};throw Error(`Group ${e} not found`)},i=()=>{const c=n().derivedPanelConstraints.find(u=>u.panelId===t);if(c!==void 0)return c;throw Error(`Panel constraints not found for Panel ${t}`)},r=()=>{const c=n().group.panels.find(u=>u.id===t);if(c!==void 0)return c;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const c=n().layout[t];if(c!==void 0)return c;throw Error(`Layout not found for Panel ${t}`)},a=c=>{const u=s();if(c===u)return;const{defaultLayoutDeferred:d,derivedPanelConstraints:p,group:g,groupSize:v,layout:y,separatorToPanels:S}=n(),E=g.panels.findIndex(T=>T.id===t),w=E===g.panels.length-1,b=hf({layout:Y1({delta:w?u-c:c-u,initialLayout:y,panelConstraints:p,pivotIndices:w?[E-1,E]:[E,E+1],prevLayout:y,trigger:"imperative-api"}),panelConstraints:p});uf(y,b)||Kl(g,{defaultLayoutDeferred:d,derivedPanelConstraints:p,groupSize:v,layout:b,separatorToPanels:S})};return{collapse:()=>{const{collapsible:c,collapsedSize:u}=i(),{mutableValues:d}=r(),p=s();c&&p!==u&&(d.expandToSize=p,a(u))},expand:()=>{const{collapsible:c,collapsedSize:u,minSize:d}=i(),{mutableValues:p}=r(),g=s();if(c&&g===u){let v=p.expandToSize??d;v===0&&(v=1),a(v)}},getSize:()=>{const{group:c}=n(),u=s(),{element:d}=r();return{asPercentage:u,inPixels:c.orientation==="horizontal"?d.offsetWidth:d.offsetHeight}},isCollapsed:()=>{const{collapsible:c,collapsedSize:u}=i(),d=s();return c&&os(u,d)},resize:c=>{const{group:u}=n(),{element:d}=r(),p=qp({group:u});a(As(O1({groupSize:p,panelElement:d,styleProp:c})/p*100))}}}function rE(e){e.defaultPrevented||kM(e,vf()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){const n=t.panels.find(i=>i.panelConstraints.defaultSize!==void 0);if(n){const i=n.panelConstraints.defaultSize,r=sR({groupId:t.group.id,panelId:n.id});r&&i!==void 0&&(r.resize(i),e.preventDefault())}}})}function Jy(e){const t=vf();for(const[n]of t)if(n.separators.some(i=>i.element===e))return n;throw Error("Could not find parent Group for separator element")}function oR({groupId:e}){const t=()=>{const n=vf();for(const[i,r]of n)if(i.id===e)return{group:i,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:i}=t();return n?{}:i},setLayout(n){const{defaultLayoutDeferred:i,derivedPanelConstraints:r,group:s,groupSize:a,layout:c,separatorToPanels:u}=t(),d=hf({layout:n,panelConstraints:r});return i?c:(uf(c,d)||Kl(s,{defaultLayoutDeferred:i,derivedPanelConstraints:r,groupSize:a,layout:d,separatorToPanels:u}),d)}}}function zh(e,t){const n=Jy(e),i=xu(n.id,!0),r=n.separators.find(d=>d.element===e);Hn(r,"Matching separator not found");const s=i.separatorToPanels.get(r);Hn(s,"Matching panels not found");const a=s.map(d=>n.panels.indexOf(d)),c=oR({groupId:n.id}).getLayout(),u=hf({layout:Y1({delta:t,initialLayout:c,panelConstraints:i.derivedPanelConstraints,pivotIndices:a,prevLayout:c,trigger:"keyboard"}),panelConstraints:i.derivedPanelConstraints});uf(c,u)||Kl(n,{defaultLayoutDeferred:i.defaultLayoutDeferred,derivedPanelConstraints:i.derivedPanelConstraints,groupSize:i.groupSize,layout:u,separatorToPanels:i.separatorToPanels})}function sE(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=Jy(t);if(!n.disabled)switch(e.key){case"ArrowDown":e.preventDefault(),n.orientation==="vertical"&&zh(t,5);break;case"ArrowLeft":e.preventDefault(),n.orientation==="horizontal"&&zh(t,-5);break;case"ArrowRight":e.preventDefault(),n.orientation==="horizontal"&&zh(t,5);break;case"ArrowUp":e.preventDefault(),n.orientation==="vertical"&&zh(t,-5);break;case"End":e.preventDefault(),zh(t,100);break;case"Enter":{e.preventDefault();const i=Jy(t),{derivedPanelConstraints:r,layout:s,separatorToPanels:a}=xu(i.id,!0),c=i.separators.find(g=>g.element===t);Hn(c,"Matching separator not found");const u=a.get(c);Hn(u,"Matching panels not found");const d=u[0],p=r.find(g=>g.panelId===d.id);if(Hn(p,"Panel metadata not found"),p.collapsible){const g=s[d.id];zh(t,(p.collapsedSize===g?i.mutableState.expandedPanelSizes[d.id]??p.minSize:p.collapsedSize)-g)}break}case"F6":{e.preventDefault();const i=Jy(t).separators.map(s=>s.element),r=Array.from(i).findIndex(s=>s===e.currentTarget);Hn(r!==null,"Index not found"),i[e.shiftKey?r>0?r-1:i.length-1:r+1<i.length?r+1:0].focus({preventScroll:!0});break}case"Home":e.preventDefault(),zh(t,-100);break}}var Fp={cursorFlags:0,state:"inactive"},GM=new nR;function ff(){return Fp}function dO(e){return GM.addListener("change",e)}function pO(e){const t=Fp,n={...Fp};n.cursorFlags=e,Fp=n,GM.emit("change",{prev:t,next:n})}function kp(e){const t=Fp;Fp=e,GM.emit("change",{prev:t,next:e})}function oE(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=vf(),n=kM(e,t),i=new Map;let r=!1;n.forEach(s=>{s.separator&&(r||(r=!0,s.separator.element.focus({preventScroll:!0})));const a=t.get(s.group);a&&i.set(s.group,a.layout)}),kp({cursorFlags:0,hitRegions:n,initialLayoutMap:i,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}var mO=e=>e,Pb=()=>{},aR=1,lR=2,cR=4,uR=8,aE=3,lE=12,Gv;function cE(){return Gv===void 0&&(Gv=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Gv=!0)),Gv}function gO({cursorFlags:e,groups:t,state:n}){let i=0,r=0;switch(n){case"active":case"hover":t.forEach(s=>{if(!s.mutableState.disableCursor)switch(s.orientation){case"horizontal":i++;break;case"vertical":r++;break}})}if(!(i===0&&r===0)){switch(n){case"active":if(e&&cE()){const s=(e&aR)!==0,a=(e&lR)!==0,c=(e&cR)!==0,u=(e&uR)!==0;if(s)return c?"se-resize":u?"ne-resize":"e-resize";if(a)return c?"sw-resize":u?"nw-resize":"w-resize";if(c)return"s-resize";if(u)return"n-resize"}break}return cE()?i>0&&r>0?"move":i>0?"ew-resize":"ns-resize":i>0&&r>0?"grab":i>0?"col-resize":"row-resize"}}var uE=new WeakMap;function HM(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=uE.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));const i=ff();switch(i.state){case"active":case"hover":{const r=gO({cursorFlags:i.cursorFlags,groups:i.hitRegions.map(a=>a.group),state:i.state}),s=`*, *:hover {cursor: ${r} !important; }`;if(t===s)return;t=s,r?n.cssRules.length===0?n.insertRule(s):n.replaceSync(s):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}uE.set(e,{prevStyle:t,styleSheet:n})}function hR({document:e,event:t,hitRegions:n,initialLayoutMap:i,mountedGroups:r,pointerDownAtPoint:s,prevCursorFlags:a}){let c=0;n.forEach(d=>{const{group:p,groupSize:g}=d,{orientation:v,panels:y}=p,{disableCursor:S}=p.mutableState;let E=0;s?v==="horizontal"?E=(t.clientX-s.x)/g*100:E=(t.clientY-s.y)/g*100:v==="horizontal"?E=t.clientX<0?-100:100:E=t.clientY<0?-100:100;const w=i.get(p),b=r.get(p);if(!w||!b)return;const{defaultLayoutDeferred:T,derivedPanelConstraints:L,groupSize:C,layout:P,separatorToPanels:O}=b;if(L&&P&&O){const B=Y1({delta:E,initialLayout:w,panelConstraints:L,pivotIndices:d.panels.map(U=>y.indexOf(U)),prevLayout:P,trigger:"mouse-or-touch"});if(uf(B,P)){if(E!==0&&!S)switch(v){case"horizontal":c|=E<0?aR:lR;break;case"vertical":c|=E<0?cR:uR;break}}else Kl(d.group,{defaultLayoutDeferred:T,derivedPanelConstraints:L,groupSize:C,layout:B,separatorToPanels:O})}});let u=0;t.movementX===0?u|=a&aE:u|=c&aE,t.movementY===0?u|=a&lE:u|=c&lE,pO(u),HM(e)}function hE(e){const t=vf(),n=ff();n.state==="active"&&hR({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}function fE(e){if(e.defaultPrevented)return;const t=ff(),n=vf();switch(t.state){case"active":if(e.buttons===0){kp({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(i=>{const r=xu(i.group.id,!0);Kl(i.group,r)});return}for(const i of t.hitRegions)if(i.separator){const{element:r}=i.separator;r.hasPointerCapture?.(e.pointerId)||r.setPointerCapture?.(e.pointerId)}hR({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{const i=kM(e,n);i.length===0?t.state!=="inactive"&&kp({cursorFlags:0,state:"inactive"}):kp({cursorFlags:0,hitRegions:i,state:"hover"}),HM(e.currentTarget);break}}}function dE(e){e.relatedTarget instanceof HTMLIFrameElement&&ff().state==="hover"&&kp({cursorFlags:0,state:"inactive"})}function pE(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=ff();t.state==="active"&&(kp({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(HM(e.currentTarget),t.hitRegions.forEach(n=>{const i=xu(n.group.id,!0);Kl(n.group,i)}),e.preventDefault()))}function mE(e){let t=0,n=0;const i={};for(const s of e)if(s.defaultSize!==void 0){t++;const a=As(s.defaultSize);n+=a,i[s.panelId]=a}else i[s.panelId]=void 0;const r=e.length-t;if(r!==0){const s=As((100-n)/r);for(const a of e)a.defaultSize===void 0&&(i[a.panelId]=s)}return i}function _O(e,t,n){if(!n[0])return;const i=e.panels.find(u=>u.element===t);if(!i||!i.onResize)return;const r=qp({group:e}),s=e.orientation==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,a=i.mutableValues.prevSize,c={asPercentage:As(s/r*100),inPixels:s};i.mutableValues.prevSize=c,i.onResize(c,i.id,a)}function vO(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function yO({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:i}){if(n<=0||t<=0||n===t)return i;let r=0,s=0,a=!1;const c=new Map,u=[];for(const g of e.panels){const v=i[g.id]??0;if(g.panelConstraints.groupResizeBehavior==="preserve-pixel-size"){a=!0;const y=As(v/100*n/t*100);c.set(g.id,y),r+=y}else u.push(g.id),s+=v}if(!a||u.length===0)return i;const d=100-r,p={...i};if(c.forEach((g,v)=>{p[v]=g}),s>0)for(const g of u)p[g]=As((i[g]??0)/s*d);else{const g=As(d/u.length);for(const v of u)p[v]=g}return p}function xO(e,t){const n=e.map(r=>r.id),i=Object.keys(t);if(n.length!==i.length)return!1;for(const r of n)if(!i.includes(r))return!1;return!0}var Kd=new Map;function SO(e){let t=!0;Hn(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,i=new Set,r=new Set,s=new n(y=>{for(const S of y){const{borderBoxSize:E,target:w}=S;if(w===e.element){if(t){const b=qp({group:e});if(b===0)return;const T=xu(e.id);if(!T)return;const L=Y2(e),C=T.defaultLayoutDeferred?mE(L):T.layout,P=hf({layout:yO({group:e,nextGroupSize:b,prevGroupSize:T.groupSize,prevLayout:C}),panelConstraints:L});if(!T.defaultLayoutDeferred&&uf(T.layout,P)&&vO(T.derivedPanelConstraints,L)&&T.groupSize===b)return;Kl(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:L,groupSize:b,layout:P,separatorToPanels:T.separatorToPanels})}}else _O(e,w,E)}});s.observe(e.element),e.panels.forEach(y=>{Hn(!i.has(y.id),`Panel ids must be unique; id "${y.id}" was used more than once`),i.add(y.id),y.onResize&&s.observe(y.element)});const a=qp({group:e}),c=Y2(e),u=e.panels.map(({id:y})=>y).join(",");let d=e.mutableState.defaultLayout;d&&(xO(e.panels,d)||(d=void 0));const p=hf({layout:e.mutableState.layouts[u]??d??mE(c),panelConstraints:c}),g=e.element.ownerDocument;Kd.set(g,(Kd.get(g)??0)+1);const v=new Map;return tR(e).forEach(y=>{y.separator&&v.set(y.separator,y.panels)}),Kl(e,{defaultLayoutDeferred:a===0,derivedPanelConstraints:c,groupSize:a,layout:p,separatorToPanels:v}),e.separators.forEach(y=>{Hn(!r.has(y.id),`Separator ids must be unique; id "${y.id}" was used more than once`),r.add(y.id),y.element.addEventListener("keydown",sE)}),Kd.get(g)===1&&(g.addEventListener("dblclick",rE,!0),g.addEventListener("pointerdown",oE,!0),g.addEventListener("pointerleave",hE),g.addEventListener("pointermove",fE),g.addEventListener("pointerout",dE),g.addEventListener("pointerup",pE,!0)),function(){t=!1,Kd.set(g,Math.max(0,(Kd.get(g)??0)-1)),iO(e),e.separators.forEach(y=>{y.element.removeEventListener("keydown",sE)}),Kd.get(g)||(g.removeEventListener("dblclick",rE,!0),g.removeEventListener("pointerdown",oE,!0),g.removeEventListener("pointerleave",hE),g.removeEventListener("pointermove",fE),g.removeEventListener("pointerout",dE),g.removeEventListener("pointerup",pE,!0)),s.disconnect()}}function bO(){const[e,t]=(0,ht.useState)({});return[e,(0,ht.useCallback)(()=>t({}),[])]}function WM(e){const t=(0,ht.useId)();return`${e??t}`}var yf=typeof window<"u"?ht.useLayoutEffect:ht.useEffect;function F1(e){const t=(0,ht.useRef)(e);return yf(()=>{t.current=e},[e]),(0,ht.useCallback)((...n)=>t.current?.(...n),[t])}function XM(...e){return F1(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":n(t);break;case"object":n.current=t;break}})})}function jM(e){const t=(0,ht.useRef)({...e});return yf(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}var fR=(0,ht.createContext)(null);function MO(e,t){const n=(0,ht.useRef)({getLayout:()=>({}),setLayout:mO});(0,ht.useImperativeHandle)(t,()=>n.current,[]),yf(()=>{Object.assign(n.current,oR({groupId:e}))})}function dR({children:e,className:t,defaultLayout:n,disableCursor:i,disabled:r,elementRef:s,groupRef:a,id:c,onLayoutChange:u,onLayoutChanged:d,orientation:p="horizontal",resizeTargetMinimumSize:g={coarse:20,fine:10},style:v,...y}){const S=(0,ht.useRef)({onLayoutChange:{},onLayoutChanged:{}}),E=F1(te=>{uf(S.current.onLayoutChange,te)||(S.current.onLayoutChange=te,u?.(te))}),w=F1(te=>{uf(S.current.onLayoutChanged,te)||(S.current.onLayoutChanged=te,d?.(te))}),b=WM(c),T=(0,ht.useRef)(null),[L,C]=bO(),P=(0,ht.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:g,separators:[]}),O=XM(T,s);MO(b,a);const B=F1((te,oe)=>{const ee=ff(),k=eE(te),X=xu(te);if(X){let $=!1;return ee.state==="active"&&($=ee.hitRegions.some(j=>j.group===k)),{flexGrow:X.layout[oe]??1,pointerEvents:$?"none":void 0}}if(n?.[oe])return{flexGrow:n?.[oe]}}),U=jM({defaultLayout:n,disableCursor:i}),I=(0,ht.useMemo)(()=>({get disableCursor(){return!!U.disableCursor},getPanelStyles:B,id:b,orientation:p,registerPanel:te=>{const oe=P.current;return oe.panels=q2(p,[...oe.panels,te]),C(),()=>{oe.panels=oe.panels.filter(ee=>ee!==te),C()}},registerSeparator:te=>{const oe=P.current;return oe.separators=q2(p,[...oe.separators,te]),C(),()=>{oe.separators=oe.separators.filter(ee=>ee!==te),C()}},updatePanelProps:(te,{disabled:oe})=>{const ee=P.current.panels.find($=>$.id===te);ee&&(ee.panelConstraints.disabled=oe);const k=eE(b),X=xu(b);k&&X&&Kl(k,{...X,derivedPanelConstraints:Y2(k)})},updateSeparatorProps:(te,{disabled:oe,disableDoubleClick:ee})=>{const k=P.current.separators.find(X=>X.id===te);k&&(k.disabled=oe,k.disableDoubleClick=ee)}}),[B,b,C,p,U]),z=(0,ht.useRef)(null);return yf(()=>{const te=T.current;if(te===null)return;const oe=P.current;let ee;if(U.defaultLayout!==void 0&&Object.keys(U.defaultLayout).length===oe.panels.length){ee={};for(const de of oe.panels){const fe=U.defaultLayout[de.id];fe!==void 0&&(ee[de.id]=fe)}}const k={disabled:!!r,element:te,id:b,mutableState:{defaultLayout:ee,disableCursor:!!U.disableCursor,expandedPanelSizes:P.current.lastExpandedPanelSizes,layouts:P.current.layouts},orientation:p,panels:oe.panels,resizeTargetMinimumSize:oe.resizeTargetMinimumSize,separators:oe.separators};z.current=k;const X=SO(k),{defaultLayoutDeferred:$,derivedPanelConstraints:j,layout:J}=xu(k.id,!0);!$&&j.length>0&&(E(J),w(J));const xe=FM(b,de=>{const{defaultLayoutDeferred:fe,derivedPanelConstraints:F,layout:re}=de.next;if(fe||F.length===0)return;const ue=k.panels.map(({id:Le})=>Le).join(",");k.mutableState.layouts[ue]=re,F.forEach(Le=>{if(Le.collapsible){const{layout:Fe}=de.prev??{};if(Fe){const Xe=os(Le.collapsedSize,re[Le.panelId]),lt=os(Le.collapsedSize,Fe[Le.panelId]);Xe&&!lt&&(k.mutableState.expandedPanelSizes[Le.panelId]=Fe[Le.panelId])}}});const _e=ff().state!=="active";E(re),_e&&w(re)});return()=>{z.current=null,X(),xe()}},[r,b,w,E,p,L,U]),(0,ht.useEffect)(()=>{const te=z.current;te&&(te.mutableState.defaultLayout=n,te.mutableState.disableCursor=!!i)}),(0,Ue.jsx)(fR.Provider,{value:I,children:(0,Ue.jsx)("div",{...y,className:t,"data-group":!0,"data-testid":b,id:b,ref:O,style:{height:"100%",width:"100%",overflow:"hidden",...v,display:"flex",flexDirection:p==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:p==="horizontal"?"pan-y":"pan-x"},children:e})})}dR.displayName="Group";function YM(){const e=(0,ht.useContext)(fR);return Hn(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function wO(e,t){const{id:n}=YM(),i=(0,ht.useRef)({collapse:Pb,expand:Pb,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Pb});(0,ht.useImperativeHandle)(t,()=>i.current,[]),yf(()=>{Object.assign(i.current,sR({groupId:n,panelId:e}))})}function $2({children:e,className:t,collapsedSize:n="0%",collapsible:i=!1,defaultSize:r,disabled:s,elementRef:a,groupResizeBehavior:c="preserve-relative-size",id:u,maxSize:d="100%",minSize:p="0%",onResize:g,panelRef:v,style:y,...S}){const E=!!u,w=WM(u),b=jM({disabled:s}),T=(0,ht.useRef)(null),L=XM(T,a),{getPanelStyles:C,id:P,orientation:O,registerPanel:B,updatePanelProps:U}=YM(),I=g!==null,z=F1((k,X,$)=>{g?.(k,u,$)});yf(()=>{const k=T.current;if(k!==null)return B({element:k,id:w,idIsStable:E,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:I?z:void 0,panelConstraints:{groupResizeBehavior:c,collapsedSize:n,collapsible:i,defaultSize:r,disabled:b.disabled,maxSize:d,minSize:p}})},[c,n,i,r,I,w,E,d,p,z,B,b]),(0,ht.useEffect)(()=>{U(w,{disabled:s})},[s,w,U]),wO(w,v);const te=()=>{const k=C(P,w);if(k)return JSON.stringify(k)},oe=(0,ht.useSyncExternalStore)(k=>FM(P,k),te,te);let ee;return oe?ee=JSON.parse(oe):r?ee={flexGrow:void 0,flexShrink:void 0,flexBasis:r}:ee={flexGrow:1},(0,Ue.jsx)("div",{...S,"data-disabled":s||void 0,"data-panel":!0,"data-testid":w,id:w,ref:L,style:{...AO,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...ee},children:(0,Ue.jsx)("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...y,touchAction:O==="horizontal"?"pan-y":"pan-x"},children:e})})}$2.displayName="Panel";var AO={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function EO({layout:e,panelConstraints:t,panelId:n,panelIndex:i}){let r,s;const a=e[n],c=t.find(u=>u.panelId===n);if(c){const u=c.maxSize,d=c.collapsible?c.collapsedSize:c.minSize,p=[i,i+1];s=hf({layout:Y1({delta:d-a,initialLayout:e,panelConstraints:t,pivotIndices:p,prevLayout:e}),panelConstraints:t})[n],r=hf({layout:Y1({delta:u-a,initialLayout:e,panelConstraints:t,pivotIndices:p,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:r,valueMin:s,valueNow:a}}function pR({children:e,className:t,disabled:n,disableDoubleClick:i,elementRef:r,id:s,style:a,...c}){const u=WM(s),d=jM({disabled:n,disableDoubleClick:i}),[p,g]=(0,ht.useState)({}),[v,y]=(0,ht.useState)("inactive"),[S,E]=(0,ht.useState)(!1),w=(0,ht.useRef)(null),b=XM(w,r),{disableCursor:T,id:L,orientation:C,registerSeparator:P,updateSeparatorProps:O}=YM(),B=C==="horizontal"?"vertical":"horizontal";yf(()=>{const z=w.current;if(z!==null){const te={disabled:d.disabled,disableDoubleClick:d.disableDoubleClick,element:z,id:u},oe=P(te),ee=dO(X=>{y(X.next.state!=="inactive"&&X.next.hitRegions.some($=>$.separator===te)?X.next.state:"inactive")}),k=FM(L,X=>{const{derivedPanelConstraints:$,layout:j,separatorToPanels:J}=X.next,xe=J.get(te);if(xe){const de=xe[0],fe=xe.indexOf(de);g(EO({layout:j,panelConstraints:$,panelId:de.id,panelIndex:fe}))}});return()=>{ee(),k(),oe()}}},[L,u,P,d]),(0,ht.useEffect)(()=>{O(u,{disabled:n,disableDoubleClick:i})},[n,i,u,O]);let U;n&&!T&&(U="not-allowed");let I;return n?I="disabled":v==="active"?I="active":S?I="focus":I=v,(0,Ue.jsx)("div",{...c,"aria-controls":p.valueControls,"aria-disabled":n||void 0,"aria-orientation":B,"aria-valuemax":p.valueMax,"aria-valuemin":p.valueMin,"aria-valuenow":p.valueNow,children:e,className:t,"data-separator":I,"data-testid":u,id:u,onBlur:()=>E(!1),onFocus:()=>E(!0),ref:b,role:"separator",style:{flexBasis:"auto",cursor:U,...a,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}pR.displayName="Separator";var TO={outline:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}},Eu=(e,t,n,i)=>{const r=(0,ht.forwardRef)(({color:s="currentColor",size:a=24,stroke:c=2,title:u,className:d,children:p,...g},v)=>(0,ht.createElement)("svg",{ref:v,...TO[e],width:a,height:a,className:["tabler-icon",`tabler-icon-${t}`,d].join(" "),...e==="filled"?{fill:s}:{strokeWidth:c,stroke:s},...g},[u&&(0,ht.createElement)("title",{key:"svg-title"},u),...i.map(([y,S])=>(0,ht.createElement)(y,S)),...Array.isArray(p)?p:[p]]));return r.displayName=`${n}`,r},CO=[["path",{d:"M19.875 6.27c.7 .398 1.13 1.143 1.125 1.948v7.284c0 .809 -.443 1.555 -1.158 1.948l-6.75 4.27a2.269 2.269 0 0 1 -2.184 0l-6.75 -4.27a2.225 2.225 0 0 1 -1.158 -1.948v-7.285c0 -.809 .443 -1.554 1.158 -1.947l6.75 -3.98a2.33 2.33 0 0 1 2.25 0l6.75 3.98h-.033",key:"svg-0"}],["path",{d:"M12 8v4",key:"svg-1"}],["path",{d:"M12 16h.01",key:"svg-2"}]],RO=Eu("outline","alert-hexagon","AlertHexagon",CO),LO=[["path",{d:"M8 12h-6",key:"svg-0"}],["path",{d:"M5 15l-3 -3l3 -3",key:"svg-1"}],["path",{d:"M22 12h-6",key:"svg-2"}],["path",{d:"M19 15l3 -3l-3 -3",key:"svg-3"}],["path",{d:"M12 4v16",key:"svg-4"}]],PO=Eu("outline","arrow-bar-both","ArrowBarBoth",LO),NO=[["path",{d:"M5 12l5 5l10 -10",key:"svg-0"}]],IO=Eu("outline","check","Check",NO),OO=[["path",{d:"M7 8l-4 4l4 4",key:"svg-0"}],["path",{d:"M17 8l4 4l-4 4",key:"svg-1"}],["path",{d:"M14 4l-4 16",key:"svg-2"}]],DO=Eu("outline","code","Code",OO),zO=[["path",{d:"M8 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M8 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M8 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}],["path",{d:"M14 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-3"}],["path",{d:"M14 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-4"}],["path",{d:"M14 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-5"}]],UO=Eu("outline","grip-vertical","GripVertical",zO),BO=[["path",{d:"M9 6l11 0",key:"svg-0"}],["path",{d:"M9 12l11 0",key:"svg-1"}],["path",{d:"M9 18l11 0",key:"svg-2"}],["path",{d:"M5 6l0 .01",key:"svg-3"}],["path",{d:"M5 12l0 .01",key:"svg-4"}],["path",{d:"M5 18l0 .01",key:"svg-5"}]],VO=Eu("outline","list","List",BO),FO=[["path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4",key:"svg-0"}],["path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4",key:"svg-1"}]],kO=Eu("outline","refresh","Refresh",FO),GO=[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]],HO=Eu("outline","x","X",GO);function WO(e){const t=(0,ht.useRef)(null),n=(0,ht.useRef)(null);return(0,ht.useEffect)(()=>{const i=document.querySelector(".MoleculeEditInput"),r=document.querySelector(".MoleculeEditLineNumber");if(!i||!r)return;let s=!1,a=null;const c=(d,p)=>{s||(s=!0,requestAnimationFrame(()=>{p.scrollTop=d.scrollTop,s=!1}))},u=d=>{a=d.target,a===i?c(i,r):c(r,i)};return i.addEventListener("scroll",u,{passive:!0}),r.addEventListener("scroll",u,{passive:!0}),()=>{i.removeEventListener("scroll",u),r.removeEventListener("scroll",u)}},[]),(0,Ue.jsx)(DM,{className:"MoleculeEdit",value:e.text,ref:t,onChange:i=>{e.onTextChange(i.currentTarget.value)},autoFocus:!0,wrap:"no-wrap",leftSection:(0,Ue.jsx)("div",{className:"MoleculeEditLineNumber",ref:n,children:Array.from({length:e.text.split(`
`).length},(i,r)=>r>1?r-1:"").join(`
`)}),classNames:{input:"MoleculeEditInput",wrapper:"MoleculeEditWrapper"},onKeyDown:i=>{["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(i.key)&&i.stopPropagation()}})}var XO=ha(((e,t)=>{(function(){var n,i="4.18.1",r=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",c="Invalid `variable` option passed into `_.template`",u="Invalid `imports` option passed into `_.template`",d="__lodash_hash_undefined__",p=500,g="__lodash_placeholder__",v=1,y=2,S=4,E=1,w=2,b=1,T=2,L=4,C=8,P=16,O=32,B=64,U=128,I=256,z=512,te=30,oe="...",ee=800,k=16,X=1,$=2,j=3,J=1/0,xe=9007199254740991,de=17976931348623157e292,fe=NaN,F=4294967295,re=F-1,ue=F>>>1,_e=[["ary",U],["bind",b],["bindKey",T],["curry",C],["curryRight",P],["flip",z],["partial",O],["partialRight",B],["rearg",I]],Le="[object Arguments]",Fe="[object Array]",Xe="[object AsyncFunction]",lt="[object Boolean]",mt="[object Date]",ne="[object DOMException]",Be="[object Error]",Ne="[object Function]",ve="[object GeneratorFunction]",ye="[object Map]",et="[object Number]",tt="[object Null]",_t="[object Object]",St="[object Promise]",Mt="[object Proxy]",Bt="[object RegExp]",Ft="[object Set]",ie="[object String]",Z="[object Symbol]",Ve="[object Undefined]",ut="[object WeakMap]",gt="[object WeakSet]",dt="[object ArrayBuffer]",G="[object DataView]",q="[object Float32Array]",Y="[object Float64Array]",pe="[object Int8Array]",Me="[object Int16Array]",De="[object Int32Array]",Ee="[object Uint8Array]",je="[object Uint8ClampedArray]",nt="[object Uint16Array]",ft="[object Uint32Array]",se=/\b__p \+= '';/g,Ze=/\b(__p \+=) '' \+/g,Se=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ke=/&(?:amp|lt|gt|quot|#39);/g,le=/[&<>"']/g,At=RegExp(Ke.source),be=RegExp(le.source),Yt=/<%-([\s\S]+?)%>/g,ke=/<%([\s\S]+?)%>/g,Nt=/<%=([\s\S]+?)%>/g,hn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Gn=/^\w*$/,Di=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Gi=/[\\^$.*+?()[\]{}|]/g,Ci=RegExp(Gi.source),bn=/^\s+/,mi=/\s/,Xr=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ls=/\{\n\/\* \[wrapped with (.+)\] \*/,Ps=/,? & /,fr=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,K=/[()=,{}\[\]\/\s]/,Re=/\\(\\)?/g,$e=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ae=/\w*$/,qe=/^[-+]0x[0-9a-f]+$/i,xt=/^0b[01]+$/i,Dt=/^\[object .+?Constructor\]$/,Rt=/^0o[0-7]+$/i,Vt=/^(?:0|[1-9]\d*)$/,jt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,zt=/($^)/,It=/['\n\r\u2028\u2029\\]/g,yn="\\ud800-\\udfff",Kt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Ri="\\u2700-\\u27bf",Hi="a-z\\xdf-\\xf6\\xf8-\\xff",On="\\xac\\xb1\\xd7\\xf7",tn="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Lu="\\u2000-\\u206f",gi=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ns="A-Z\\xc0-\\xd6\\xd8-\\xde",Pu="\\ufe0e\\ufe0f",Is=On+tn+Lu+gi,no="['’]",Xn="["+yn+"]",_i="["+Is+"]",Eo="["+Kt+"]",ir="\\d+",el="["+Ri+"]",Nu="["+Hi+"]",_a="[^"+yn+Is+ir+Ri+Hi+Ns+"]",dm="\\ud83c[\\udffb-\\udfff]",hs="(?:"+Eo+"|"+dm+")",Rf="[^"+yn+"]",Lf="(?:\\ud83c[\\udde6-\\uddff]){2}",Iu="[\\ud800-\\udbff][\\udc00-\\udfff]",Os="["+Ns+"]",pm="\\u200d",mm="(?:"+Nu+"|"+_a+")",rc="(?:"+Os+"|"+_a+")",U0="(?:"+no+"(?:d|ll|m|re|s|t|ve))?",gm="(?:"+no+"(?:D|LL|M|RE|S|T|VE))?",_m=hs+"?",Pf="["+Pu+"]?",wS="(?:"+pm+"(?:"+[Rf,Lf,Iu].join("|")+")"+Pf+_m+")*",AS="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Nf="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",io=Pf+_m+wS,vm="(?:"+[el,Lf,Iu].join("|")+")"+io,ym="(?:"+[Rf+Eo+"?",Eo,Lf,Iu,Xn].join("|")+")",sc=RegExp(no,"g"),oc=RegExp(Eo,"g"),If=RegExp(dm+"(?="+dm+")|"+ym+io,"g"),xm=RegExp([Os+"?"+Nu+"+"+U0+"(?="+[_i,Os,"$"].join("|")+")",rc+"+"+gm+"(?="+[_i,Os+mm,"$"].join("|")+")",Os+"?"+mm+"+"+U0,Os+"+"+gm,Nf,AS,ir,vm].join("|"),"g"),B0=RegExp("["+pm+yn+Kt+Pu+"]"),Ou=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,To=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Sm=-1,Pn={};Pn[q]=Pn[Y]=Pn[pe]=Pn[Me]=Pn[De]=Pn[Ee]=Pn[je]=Pn[nt]=Pn[ft]=!0,Pn[Le]=Pn[Fe]=Pn[dt]=Pn[lt]=Pn[G]=Pn[mt]=Pn[Be]=Pn[Ne]=Pn[ye]=Pn[et]=Pn[_t]=Pn[Bt]=Pn[Ft]=Pn[ie]=Pn[ut]=!1;var xn={};xn[Le]=xn[Fe]=xn[dt]=xn[G]=xn[lt]=xn[mt]=xn[q]=xn[Y]=xn[pe]=xn[Me]=xn[De]=xn[ye]=xn[et]=xn[_t]=xn[Bt]=xn[Ft]=xn[ie]=xn[Z]=xn[Ee]=xn[je]=xn[nt]=xn[ft]=!0,xn[Be]=xn[Ne]=xn[ut]=!1;var bm={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Of={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},V0={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Df={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},zf=parseFloat,F0=parseInt,dr=typeof global=="object"&&global&&global.Object===Object&&global,tl=typeof self=="object"&&self&&self.Object===Object&&self,vi=dr||tl||Function("return this")(),nl=typeof e=="object"&&e&&!e.nodeType&&e,il=nl&&typeof t=="object"&&t&&!t.nodeType&&t,Uf=il&&il.exports===nl,Du=Uf&&dr.process,rr=(function(){try{var we=il&&il.require&&il.require("util").types;return we||Du&&Du.binding&&Du.binding("util")}catch{}})(),zu=rr&&rr.isArrayBuffer,Mm=rr&&rr.isDate,k0=rr&&rr.isMap,Bf=rr&&rr.isRegExp,G0=rr&&rr.isSet,H0=rr&&rr.isTypedArray;function Rr(we,Qe,He){switch(He.length){case 0:return we.call(Qe);case 1:return we.call(Qe,He[0]);case 2:return we.call(Qe,He[0],He[1]);case 3:return we.call(Qe,He[0],He[1],He[2])}return we.apply(Qe,He)}function ES(we,Qe,He,wt){for(var qt=-1,Mn=we==null?0:we.length;++qt<Mn;){var Li=we[qt];Qe(wt,Li,He(Li),we)}return wt}function jr(we,Qe){for(var He=-1,wt=we==null?0:we.length;++He<wt&&Qe(we[He],He,we)!==!1;);return we}function TS(we,Qe){for(var He=we==null?0:we.length;He--&&Qe(we[He],He,we)!==!1;);return we}function W0(we,Qe){for(var He=-1,wt=we==null?0:we.length;++He<wt;)if(!Qe(we[He],He,we))return!1;return!0}function ro(we,Qe){for(var He=-1,wt=we==null?0:we.length,qt=0,Mn=[];++He<wt;){var Li=we[He];Qe(Li,He,we)&&(Mn[qt++]=Li)}return Mn}function Vf(we,Qe){return!!(we!=null&&we.length)&&rl(we,Qe,0)>-1}function Ff(we,Qe,He){for(var wt=-1,qt=we==null?0:we.length;++wt<qt;)if(He(Qe,we[wt]))return!0;return!1}function Qn(we,Qe){for(var He=-1,wt=we==null?0:we.length,qt=Array(wt);++He<wt;)qt[He]=Qe(we[He],He,we);return qt}function va(we,Qe){for(var He=-1,wt=Qe.length,qt=we.length;++He<wt;)we[qt+He]=Qe[He];return we}function wm(we,Qe,He,wt){var qt=-1,Mn=we==null?0:we.length;for(wt&&Mn&&(He=we[++qt]);++qt<Mn;)He=Qe(He,we[qt],qt,we);return He}function CS(we,Qe,He,wt){var qt=we==null?0:we.length;for(wt&&qt&&(He=we[--qt]);qt--;)He=Qe(He,we[qt],qt,we);return He}function Am(we,Qe){for(var He=-1,wt=we==null?0:we.length;++He<wt;)if(Qe(we[He],He,we))return!0;return!1}var Em=Rm("length");function Uu(we){return we.split("")}function RS(we){return we.match(fr)||[]}function Tm(we,Qe,He){var wt;return He(we,function(qt,Mn,Li){if(Qe(qt,Mn,Li))return wt=Mn,!1}),wt}function Bu(we,Qe,He,wt){for(var qt=we.length,Mn=He+(wt?1:-1);wt?Mn--:++Mn<qt;)if(Qe(we[Mn],Mn,we))return Mn;return-1}function rl(we,Qe,He){return Qe===Qe?J0(we,Qe,He):Bu(we,Cm,He)}function X0(we,Qe,He,wt){for(var qt=He-1,Mn=we.length;++qt<Mn;)if(wt(we[qt],Qe))return qt;return-1}function Cm(we){return we!==we}function sl(we,Qe){var He=we==null?0:we.length;return He?kf(we,Qe)/He:fe}function Rm(we){return function(Qe){return Qe==null?n:Qe[we]}}function Lm(we){return function(Qe){return we==null?n:we[Qe]}}function j0(we,Qe,He,wt,qt){return qt(we,function(Mn,Li,Un){He=wt?(wt=!1,Mn):Qe(He,Mn,Li,Un)}),He}function Y0(we,Qe){var He=we.length;for(we.sort(Qe);He--;)we[He]=we[He].value;return we}function kf(we,Qe){for(var He,wt=-1,qt=we.length;++wt<qt;){var Mn=Qe(we[wt]);Mn!==n&&(He=He===n?Mn:He+Mn)}return He}function ol(we,Qe){for(var He=-1,wt=Array(we);++He<we;)wt[He]=Qe(He);return wt}function Vu(we,Qe){return Qn(Qe,function(He){return[He,we[He]]})}function q0(we){return we&&we.slice(0,Xf(we)+1).replace(bn,"")}function sr(we){return function(Qe){return we(Qe)}}function Gf(we,Qe){return Qn(Qe,function(He){return we[He]})}function ac(we,Qe){return we.has(Qe)}function Hf(we,Qe){for(var He=-1,wt=we.length;++He<wt&&rl(Qe,we[He],0)>-1;);return He}function Wf(we,Qe){for(var He=we.length;He--&&rl(Qe,we[He],0)>-1;);return He}function $0(we,Qe){for(var He=we.length,wt=0;He--;)we[He]===Qe&&++wt;return wt}var Z0=Lm(bm),K0=Lm(Of);function LS(we){return"\\"+Df[we]}function PS(we,Qe){return we==null?n:we[Qe]}function lc(we){return B0.test(we)}function NS(we){return Ou.test(we)}function IS(we){for(var Qe,He=[];!(Qe=we.next()).done;)He.push(Qe.value);return He}function pr(we){var Qe=-1,He=Array(we.size);return we.forEach(function(wt,qt){He[++Qe]=[qt,wt]}),He}function cc(we,Qe){return function(He){return we(Qe(He))}}function Co(we,Qe){for(var He=-1,wt=we.length,qt=0,Mn=[];++He<wt;){var Li=we[He];(Li===Qe||Li===g)&&(we[He]=g,Mn[qt++]=He)}return Mn}function Fu(we){var Qe=-1,He=Array(we.size);return we.forEach(function(wt){He[++Qe]=wt}),He}function Q0(we){var Qe=-1,He=Array(we.size);return we.forEach(function(wt){He[++Qe]=[wt,wt]}),He}function J0(we,Qe,He){for(var wt=He-1,qt=we.length;++wt<qt;)if(we[wt]===Qe)return wt;return-1}function Pm(we,Qe,He){for(var wt=He+1;wt--;)if(we[wt]===Qe)return wt;return wt}function uc(we){return lc(we)?Nm(we):Em(we)}function or(we){return lc(we)?e_(we):Uu(we)}function Xf(we){for(var Qe=we.length;Qe--&&mi.test(we.charAt(Qe)););return Qe}var ku=Lm(V0);function Nm(we){for(var Qe=If.lastIndex=0;If.test(we);)++Qe;return Qe}function e_(we){return we.match(If)||[]}function al(we){return we.match(xm)||[]}var Yr=(function we(Qe){Qe=Qe==null?vi:Yr.defaults(vi.Object(),Qe,Yr.pick(vi,To));var He=Qe.Array,wt=Qe.Date,qt=Qe.Error,Mn=Qe.Function,Li=Qe.Math,Un=Qe.Object,Im=Qe.RegExp,t_=Qe.String,qr=Qe.TypeError,hc=He.prototype,Ds=Mn.prototype,Ro=Un.prototype,mr=Qe["__core-js_shared__"],Lo=Ds.toString,wn=Ro.hasOwnProperty,jf=0,Gu=(function(){var f=/[^.]+$/.exec(mr&&mr.keys&&mr.keys.IE_PROTO||"");return f?"Symbol(src)_1."+f:""})(),fc=Ro.toString,ll=Lo.call(Un),n_=vi._,Yf=Im("^"+Lo.call(wn).replace(Gi,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Po=Uf?Qe.Buffer:n,ya=Qe.Symbol,ar=Qe.Uint8Array,qf=Po?Po.allocUnsafe:n,fs=cc(Un.getPrototypeOf,Un),Om=Un.create,Hu=Ro.propertyIsEnumerable,so=hc.splice,$f=ya?ya.isConcatSpreadable:n,dc=ya?ya.iterator:n,No=ya?ya.toStringTag:n,Wu=(function(){try{var f=Ho(Un,"defineProperty");return f({},"",{}),f}catch{}})(),ds=Qe.clearTimeout!==vi.clearTimeout&&Qe.clearTimeout,pc=wt&&wt.now!==vi.Date.now&&wt.now,mc=Qe.setTimeout!==vi.setTimeout&&Qe.setTimeout,cl=Li.ceil,xa=Li.floor,Lr=Un.getOwnPropertySymbols,ps=Po?Po.isBuffer:n,Io=Qe.isFinite,oo=hc.join,ao=cc(Un.keys,Un),Bn=Li.max,Wi=Li.min,Dm=wt.now,zm=Qe.parseInt,Um=Li.random,Xi=hc.reverse,Vn=Ho(Qe,"DataView"),on=Ho(Qe,"Map"),lo=Ho(Qe,"Promise"),ji=Ho(Qe,"Set"),ul=Ho(Qe,"WeakMap"),ms=Ho(Un,"create"),Xu=ul&&new ul,hl={},gc=Ta(Vn),fl=Ta(on),Bm=Ta(lo),ju=Ta(ji),Vm=Ta(ul),co=ya?ya.prototype:n,$r=co?co.valueOf:n,Oo=co?co.toString:n;function H(f){if(di(f)&&!$t(f)&&!(f instanceof an)){if(f instanceof Yi)return f;if(wn.call(f,"__wrapped__"))return Si(f)}return new Yi(f)}var Sa=(function(){function f(){}return function(_){if(!ti(_))return{};if(Om)return Om(_);f.prototype=_;var M=new f;return f.prototype=n,M}})();function _c(){}function Yi(f,_){this.__wrapped__=f,this.__actions__=[],this.__chain__=!!_,this.__index__=0,this.__values__=n}H.templateSettings={escape:Yt,evaluate:ke,interpolate:Nt,variable:"",imports:{_:H}},H.prototype=_c.prototype,H.prototype.constructor=H,Yi.prototype=Sa(_c.prototype),Yi.prototype.constructor=Yi;function an(f){this.__wrapped__=f,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=F,this.__views__=[]}function dl(){var f=new an(this.__wrapped__);return f.__actions__=_r(this.__actions__),f.__dir__=this.__dir__,f.__filtered__=this.__filtered__,f.__iteratees__=_r(this.__iteratees__),f.__takeCount__=this.__takeCount__,f.__views__=_r(this.__views__),f}function qi(){if(this.__filtered__){var f=new an(this);f.__dir__=-1,f.__filtered__=!0}else f=this.clone(),f.__dir__*=-1;return f}function Zf(){var f=this.__wrapped__.value(),_=this.__dir__,M=$t(f),N=_<0,V=M?f.length:0,Q=yg(0,V,this.__views__),ce=Q.start,me=Q.end,Ce=me-ce,ct=N?me:ce-1,st=this.__iteratees__,vt=st.length,Et=0,Pt=Wi(Ce,this.__takeCount__);if(!M||!N&&V==Ce&&Pt==Ce)return lh(f,this.__actions__);var Ht=[];e:for(;Ce--&&Et<Pt;){ct+=_;for(var Jt=-1,Wt=f[ct];++Jt<vt;){var Yn=st[Jt],Sn=Yn.iteratee,ns=Yn.type,Fa=Sn(Wt);if(ns==$)Wt=Fa;else if(!Fa){if(ns==X)continue e;break e}}Ht[Et++]=Wt}return Ht}an.prototype=Sa(_c.prototype),an.prototype.constructor=an;function ba(f){var _=-1,M=f==null?0:f.length;for(this.clear();++_<M;){var N=f[_];this.set(N[0],N[1])}}function OS(){this.__data__=ms?ms(null):{},this.size=0}function DS(f){var _=this.has(f)&&delete this.__data__[f];return this.size-=_?1:0,_}function zS(f){var _=this.__data__;if(ms){var M=_[f];return M===d?n:M}return wn.call(_,f)?_[f]:n}function wi(f){var _=this.__data__;return ms?_[f]!==n:wn.call(_,f)}function Fm(f,_){var M=this.__data__;return this.size+=this.has(f)?0:1,M[f]=ms&&_===n?d:_,this}ba.prototype.clear=OS,ba.prototype.delete=DS,ba.prototype.get=zS,ba.prototype.has=wi,ba.prototype.set=Fm;function Zr(f){var _=-1,M=f==null?0:f.length;for(this.clear();++_<M;){var N=f[_];this.set(N[0],N[1])}}function Yu(){this.__data__=[],this.size=0}function km(f){var _=this.__data__,M=_l(_,f);return M<0?!1:(M==_.length-1?_.pop():so.call(_,M,1),--this.size,!0)}function vc(f){var _=this.__data__,M=_l(_,f);return M<0?n:_[M][1]}function yc(f){return _l(this.__data__,f)>-1}function US(f,_){var M=this.__data__,N=_l(M,f);return N<0?(++this.size,M.push([f,_])):M[N][1]=_,this}Zr.prototype.clear=Yu,Zr.prototype.delete=km,Zr.prototype.get=vc,Zr.prototype.has=yc,Zr.prototype.set=US;function uo(f){var _=-1,M=f==null?0:f.length;for(this.clear();++_<M;){var N=f[_];this.set(N[0],N[1])}}function BS(){this.size=0,this.__data__={hash:new ba,map:new(on||Zr),string:new ba}}function i_(f){var _=_d(this,f).delete(f);return this.size-=_?1:0,_}function pl(f){return _d(this,f).get(f)}function Gm(f){return _d(this,f).has(f)}function Kf(f,_){var M=_d(this,f),N=M.size;return M.set(f,_),this.size+=M.size==N?0:1,this}uo.prototype.clear=BS,uo.prototype.delete=i_,uo.prototype.get=pl,uo.prototype.has=Gm,uo.prototype.set=Kf;function Ma(f){var _=-1,M=f==null?0:f.length;for(this.__data__=new uo;++_<M;)this.add(f[_])}function xc(f){return this.__data__.set(f,d),this}function Hm(f){return this.__data__.has(f)}Ma.prototype.add=Ma.prototype.push=xc,Ma.prototype.has=Hm;function Pr(f){var _=this.__data__=new Zr(f);this.size=_.size}function Qf(){this.__data__=new Zr,this.size=0}function r_(f){var _=this.__data__,M=_.delete(f);return this.size=_.size,M}function s_(f){return this.__data__.get(f)}function ml(f){return this.__data__.has(f)}function gl(f,_){var M=this.__data__;if(M instanceof Zr){var N=M.__data__;if(!on||N.length<r-1)return N.push([f,_]),this.size=++M.size,this;M=this.__data__=new uo(N)}return M.set(f,_),this.size=M.size,this}Pr.prototype.clear=Qf,Pr.prototype.delete=r_,Pr.prototype.get=s_,Pr.prototype.has=ml,Pr.prototype.set=gl;function Wm(f,_){var M=$t(f),N=!M&&Jo(f),V=!M&&!N&&Vs(f),Q=!M&&!N&&!V&&Nl(f),ce=M||N||V||Q,me=ce?ol(f.length,t_):[],Ce=me.length;for(var ct in f)(_||wn.call(f,ct))&&!(ce&&(ct=="length"||V&&(ct=="offset"||ct=="parent")||Q&&(ct=="buffer"||ct=="byteLength"||ct=="byteOffset")||po(ct,Ce)))&&me.push(ct);return me}function Xm(f){var _=f.length;return _?f[rd(0,_-1)]:n}function Sc(f,_){return Fc(_r(f),zo(_,0,f.length))}function qu(f){return Fc(_r(f))}function bc(f,_,M){(M!==n&&!Bs(f[_],M)||M===n&&!(_ in f))&&$i(f,_,M)}function Do(f,_,M){var N=f[_];(!(wn.call(f,_)&&Bs(N,M))||M===n&&!(_ in f))&&$i(f,_,M)}function _l(f,_){for(var M=f.length;M--;)if(Bs(f[M][0],_))return M;return-1}function o_(f,_,M,N){return gs(f,function(V,Q,ce){_(N,V,M(V),ce)}),N}function wa(f,_){return f&&_s(_,pi(_),f)}function a_(f,_){return f&&_s(_,Sr(_),f)}function $i(f,_,M){_=="__proto__"&&Wu?Wu(f,_,{configurable:!0,enumerable:!0,value:M,writable:!0}):f[_]=M}function $u(f,_){for(var M=-1,N=_.length,V=He(N),Q=f==null;++M<N;)V[M]=Q?n:Gd(f,_[M]);return V}function zo(f,_,M){return f===f&&(M!==n&&(f=f<=M?f:M),_!==n&&(f=f>=_?f:_)),f}function zi(f,_,M,N,V,Q){var ce,me=_&v,Ce=_&y,ct=_&S;if(M&&(ce=V?M(f,N,V,Q):M(f)),ce!==n)return ce;if(!ti(f))return f;var st=$t(f);if(st){if(ce=bg(f),!me)return _r(f,ce)}else{var vt=Bi(f),Et=vt==Ne||vt==ve;if(Vs(f))return lg(f,me);if(vt==_t||vt==Le||Et&&!V){if(ce=Ce||Et?{}:gh(f),!me)return Ce?y_(f,a_(ce,f)):v_(f,wa(ce,f))}else{if(!xn[vt])return V?f:{};ce=Mg(f,vt,me)}}Q||(Q=new Pr);var Pt=Q.get(f);if(Pt)return Pt;Q.set(f,ce),Sv(f)?f.forEach(function(Jt){ce.add(zi(Jt,_,M,Jt,f,Q))}):Bd(f)&&f.forEach(function(Jt,Wt){ce.set(Wt,zi(Jt,_,M,Wt,f,Q))});var Ht=st?n:(ct?Ce?gd:md:Ce?Sr:pi)(f);return jr(Ht||f,function(Jt,Wt){Ht&&(Wt=Jt,Jt=f[Wt]),Do(ce,Wt,zi(Jt,_,M,Wt,f,Q))}),ce}function vl(f){var _=pi(f);return function(M){return Mc(M,f,_)}}function Mc(f,_,M){var N=M.length;if(f==null)return!N;for(f=Un(f);N--;){var V=M[N],Q=_[V],ce=f[V];if(ce===n&&!(V in f)||!Q(ce))return!1}return!0}function Jf(f,_,M){if(typeof f!="function")throw new qr(a);return Or(function(){f.apply(n,M)},_)}function yl(f,_,M,N){var V=-1,Q=Vf,ce=!0,me=f.length,Ce=[],ct=_.length;if(!me)return Ce;M&&(_=Qn(_,sr(M))),N?(Q=Ff,ce=!1):_.length>=r&&(Q=ac,ce=!1,_=new Ma(_));e:for(;++V<me;){var st=f[V],vt=M==null?st:M(st);if(st=N||st!==0?st:0,ce&&vt===vt){for(var Et=ct;Et--;)if(_[Et]===vt)continue e;Ce.push(st)}else Q(_,vt,N)||Ce.push(st)}return Ce}var gs=dg(li),wc=dg(Nr,!0);function l_(f,_){var M=!0;return gs(f,function(N,V,Q){return M=!!_(N,V,Q),M}),M}function Zu(f,_,M){for(var N=-1,V=f.length;++N<V;){var Q=f[N],ce=_(Q);if(ce!=null&&(me===n?ce===ce&&!Ai(ce):M(ce,me)))var me=ce,Ce=Q}return Ce}function Ac(f,_,M,N){var V=f.length;for(M=nn(M),M<0&&(M=-M>V?0:V+M),N=N===n||N>V?V:nn(N),N<0&&(N+=V),N=M>N?0:es(N);M<N;)f[M++]=_;return f}function Ku(f,_){var M=[];return gs(f,function(N,V,Q){_(N,V,Q)&&M.push(N)}),M}function Ui(f,_,M,N,V){var Q=-1,ce=f.length;for(M||(M=wg),V||(V=[]);++Q<ce;){var me=f[Q];_>0&&M(me)?_>1?Ui(me,_-1,M,N,V):va(V,me):N||(V[V.length]=me)}return V}var Qu=Pc(),ed=Pc(!0);function li(f,_){return f&&Qu(f,_,pi)}function Nr(f,_){return f&&ed(f,_,pi)}function zs(f,_){return ro(_,function(M){return Fs(f[M])})}function Uo(f,_){_=Fo(_,f);for(var M=0,N=_.length;f!=null&&M<N;)f=f[Dr(_[M++])];return M&&M==N?f:n}function jm(f,_,M){var N=_(f);return $t(f)?N:va(N,M(f))}function ci(f){return f==null?f===n?Ve:tt:No&&No in Un(f)?A_(f):T_(f)}function gr(f,_){return f>_}function yi(f,_){return f!=null&&wn.call(f,_)}function td(f,_){return f!=null&&_ in Un(f)}function Bo(f,_,M){return f>=Wi(_,M)&&f<Bn(_,M)}function Qt(f,_,M){for(var N=M?Ff:Vf,V=f[0].length,Q=f.length,ce=Q,me=He(Q),Ce=1/0,ct=[];ce--;){var st=f[ce];ce&&_&&(st=Qn(st,sr(_))),Ce=Wi(st.length,Ce),me[ce]=!M&&(_||V>=120&&st.length>=120)?new Ma(ce&&st):n}st=f[0];var vt=-1,Et=me[0];e:for(;++vt<V&&ct.length<Ce;){var Pt=st[vt],Ht=_?_(Pt):Pt;if(Pt=M||Pt!==0?Pt:0,!(Et?ac(Et,Ht):N(ct,Ht,M))){for(ce=Q;--ce;){var Jt=me[ce];if(!(Jt?ac(Jt,Ht):N(f[ce],Ht,M)))continue e}Et&&Et.push(Ht),ct.push(Pt)}}return ct}function Dn(f,_,M,N){return li(f,function(V,Q,ce){_(N,M(V),Q,ce)}),N}function Jn(f,_,M){_=Fo(_,f),f=Xo(f,_);var N=f==null?f:f[Dr(hi(_))];return N==null?n:Rr(N,f,M)}function Ju(f){return di(f)&&ci(f)==Le}function Ec(f){return di(f)&&ci(f)==dt}function xl(f){return di(f)&&ci(f)==mt}function Aa(f,_,M,N,V){return f===_?!0:f==null||_==null||!di(f)&&!di(_)?f!==f&&_!==_:eh(f,_,M,N,Aa,V)}function eh(f,_,M,N,V,Q){var ce=$t(f),me=$t(_),Ce=ce?Fe:Bi(f),ct=me?Fe:Bi(_);Ce=Ce==Le?_t:Ce,ct=ct==Le?_t:ct;var st=Ce==_t,vt=ct==_t,Et=Ce==ct;if(Et&&Vs(f)){if(!Vs(_))return!1;ce=!0,st=!1}if(Et&&!st)return Q||(Q=new Pr),ce||Nl(f)?xi(f,_,M,N,V,Q):Zi(f,_,Ce,M,N,V,Q);if(!(M&E)){var Pt=st&&wn.call(f,"__wrapped__"),Ht=vt&&wn.call(_,"__wrapped__");if(Pt||Ht){var Jt=Pt?f.value():f,Wt=Ht?_.value():_;return Q||(Q=new Pr),V(Jt,Wt,M,N,Q)}}return Et?(Q||(Q=new Pr),w_(f,_,M,N,V,Q)):!1}function Tc(f){return di(f)&&Bi(f)==ye}function Ym(f,_,M,N){var V=M.length,Q=V,ce=!N;if(f==null)return!Q;for(f=Un(f);V--;){var me=M[V];if(ce&&me[2]?me[1]!==f[me[0]]:!(me[0]in f))return!1}for(;++V<Q;){me=M[V];var Ce=me[0],ct=f[Ce],st=me[1];if(ce&&me[2]){if(ct===n&&!(Ce in f))return!1}else{var vt=new Pr;if(N)var Et=N(ct,st,Ce,f,_,vt);if(!(Et===n?Aa(st,ct,E|w,N,vt):Et))return!1}}return!0}function ii(f){return!ti(f)||Wo(f)?!1:(Fs(f)?Yf:Dt).test(Ta(f))}function qm(f){return di(f)&&ci(f)==Bt}function $m(f){return di(f)&&Bi(f)==Ft}function c_(f){return di(f)&&Ud(f.length)&&!!Pn[ci(f)]}function Zm(f){return typeof f=="function"?f:f==null?m:typeof f=="object"?$t(f)?ui(f[0],f[1]):lr(f):In(f)}function Km(f){if(!zc(f))return ao(f);var _=[];for(var M in Un(f))wn.call(f,M)&&M!="constructor"&&_.push(M);return _}function Qm(f){if(!ti(f))return GS(f);var _=zc(f),M=[];for(var N in f)N=="constructor"&&(_||!wn.call(f,N))||M.push(N);return M}function th(f,_){return f<_}function nd(f,_){var M=-1,N=xr(f)?He(f.length):[];return gs(f,function(V,Q,ce){N[++M]=_(V,Q,ce)}),N}function lr(f){var _=Dc(f);return _.length==1&&_[0][2]?Uc(_[0][0],_[0][1]):function(M){return M===f||Ym(M,f,_)}}function ui(f,_){return _h(f)&&vh(_)?Uc(Dr(f),_):function(M){var N=Gd(M,f);return N===n&&N===_?Il(M,f):Aa(_,N,E|w)}}function Sl(f,_,M,N,V){f!==_&&Qu(_,function(Q,ce){if(V||(V=new Pr),ti(Q))nh(f,_,ce,M,Sl,N,V);else{var me=N?N(xd(f,ce),Q,ce+"",f,_,V):n;me===n&&(me=Q),bc(f,ce,me)}},Sr)}function nh(f,_,M,N,V,Q,ce){var me=xd(f,M),Ce=xd(_,M),ct=ce.get(Ce);if(ct){bc(f,M,ct);return}var st=Q?Q(me,Ce,M+"",f,_,ce):n,vt=st===n;if(vt){var Et=$t(Ce),Pt=!Et&&Vs(Ce),Ht=!Et&&!Pt&&Nl(Ce);st=Ce,Et||Pt||Ht?$t(me)?st=me:si(me)?st=_r(me):Pt?(vt=!1,st=lg(Ce,!0)):Ht?(vt=!1,st=ug(Ce,!0)):st=[]:Kc(Ce)||Jo(Ce)?(st=me,Jo(me)?st=Kg(me):(!ti(me)||Fs(me))&&(st=gh(Ce))):vt=!1}vt&&(ce.set(Ce,st),V(st,Ce,N,Q,ce),ce.delete(Ce)),bc(f,M,st)}function ih(f,_){var M=f.length;if(M)return _+=_<0?M:0,po(_,M)?f[_]:n}function id(f,_,M){_.length?_=Qn(_,function(V){return $t(V)?function(Q){return Uo(Q,V.length===1?V[0]:V)}:V}):_=[m];var N=-1;return _=Qn(_,sr(kt())),Y0(nd(f,function(V,Q,ce){return{criteria:Qn(_,function(me){return me(V)}),index:++N,value:V}}),function(V,Q){return VS(V,Q,M)})}function Vo(f,_){return rh(f,_,function(M,N){return Il(f,N)})}function rh(f,_,M){for(var N=-1,V=_.length,Q={};++N<V;){var ce=_[N],me=Uo(f,ce);M(me,ce)&&Cc(Q,Fo(ce,f),me)}return Q}function Jm(f){return function(_){return Uo(_,f)}}function sh(f,_,M,N){var V=N?X0:rl,Q=-1,ce=_.length,me=f;for(f===_&&(_=_r(_)),M&&(me=Qn(f,sr(M)));++Q<ce;)for(var Ce=0,ct=_[Q],st=M?M(ct):ct;(Ce=V(me,st,Ce,N))>-1;)me!==f&&so.call(me,Ce,1),so.call(f,Ce,1);return f}function eg(f,_){for(var M=f?_.length:0,N=M-1;M--;){var V=_[M];if(M==N||V!==Q){var Q=V;po(V)?so.call(f,V,1):ad(f,V)}}return f}function rd(f,_){return f+xa(Um()*(_-f+1))}function u_(f,_,M,N){for(var V=-1,Q=Bn(cl((_-f)/(M||1)),0),ce=He(Q);Q--;)ce[N?Q:++V]=f,f+=M;return ce}function sd(f,_){var M="";if(!f||_<1||_>xe)return M;do _%2&&(M+=f),_=xa(_/2),_&&(f+=f);while(_);return M}function sn(f,_){return Sd(Bc(f,_,m),f+"")}function h_(f){return Xm(nu(f))}function tg(f,_){var M=nu(f);return Fc(M,zo(_,0,M.length))}function Cc(f,_,M,N){if(!ti(f))return f;_=Fo(_,f);for(var V=-1,Q=_.length,ce=Q-1,me=f;me!=null&&++V<Q;){var Ce=Dr(_[V]),ct=M;if(Ce==="__proto__"||Ce==="constructor"||Ce==="prototype")return f;if(V!=ce){var st=me[Ce];ct=N?N(st,Ce,me):n,ct===n&&(ct=ti(st)?st:po(_[V+1])?[]:{})}Do(me,Ce,ct),me=me[Ce]}return f}var f_=Xu?function(f,_){return Xu.set(f,_),f}:m,d_=Wu?function(f,_){return Wu(f,"toString",{configurable:!0,enumerable:!1,value:iu(_),writable:!0})}:m;function p_(f){return Fc(nu(f))}function Kr(f,_,M){var N=-1,V=f.length;_<0&&(_=-_>V?0:V+_),M=M>V?V:M,M<0&&(M+=V),V=_>M?0:M-_>>>0,_>>>=0;for(var Q=He(V);++N<V;)Q[N]=f[N+_];return Q}function ng(f,_){var M;return gs(f,function(N,V,Q){return M=_(N,V,Q),!M}),!!M}function oh(f,_,M){var N=0,V=f==null?N:f.length;if(typeof _=="number"&&_===_&&V<=ue){for(;N<V;){var Q=N+V>>>1,ce=f[Q];ce!==null&&!Ai(ce)&&(M?ce<=_:ce<_)?N=Q+1:V=Q}return V}return od(f,_,m,M)}function od(f,_,M,N){var V=0,Q=f==null?0:f.length;if(Q===0)return 0;_=M(_);for(var ce=_!==_,me=_===null,Ce=Ai(_),ct=_===n;V<Q;){var st=xa((V+Q)/2),vt=M(f[st]),Et=vt!==n,Pt=vt===null,Ht=vt===vt,Jt=Ai(vt);if(ce)var Wt=N||Ht;else ct?Wt=Ht&&(N||Et):me?Wt=Ht&&Et&&(N||!Pt):Ce?Wt=Ht&&Et&&!Pt&&(N||!Jt):Pt||Jt?Wt=!1:Wt=N?vt<=_:vt<_;Wt?V=st+1:Q=st}return Wi(Q,re)}function ig(f,_){for(var M=-1,N=f.length,V=0,Q=[];++M<N;){var ce=f[M],me=_?_(ce):ce;if(!M||!Bs(me,Ce)){var Ce=me;Q[V++]=ce===0?0:ce}}return Q}function rg(f){return typeof f=="number"?f:Ai(f)?fe:+f}function Ir(f){if(typeof f=="string")return f;if($t(f))return Qn(f,Ir)+"";if(Ai(f))return Oo?Oo.call(f):"";var _=f+"";return _=="0"&&1/f==-J?"-0":_}function Ea(f,_,M){var N=-1,V=Vf,Q=f.length,ce=!0,me=[],Ce=me;if(M)ce=!1,V=Ff;else if(Q>=r){var ct=_?null:b_(f);if(ct)return Fu(ct);ce=!1,V=ac,Ce=new Ma}else Ce=_?[]:me;e:for(;++N<Q;){var st=f[N],vt=_?_(st):st;if(st=M||st!==0?st:0,ce&&vt===vt){for(var Et=Ce.length;Et--;)if(Ce[Et]===vt)continue e;_&&Ce.push(vt),me.push(st)}else V(Ce,vt,M)||(Ce!==me&&Ce.push(vt),me.push(st))}return me}function ad(f,_){_=Fo(_,f);var M=-1,N=_.length;if(!N)return!0;for(;++M<N;){var V=Dr(_[M]);if(V==="__proto__"&&!wn.call(f,"__proto__")||(V==="constructor"||V==="prototype")&&M<N-1)return!1}var Q=Xo(f,_);return Q==null||delete Q[Dr(hi(_))]}function bl(f,_,M,N){return Cc(f,_,M(Uo(f,_)),N)}function ah(f,_,M,N){for(var V=f.length,Q=N?V:-1;(N?Q--:++Q<V)&&_(f[Q],Q,f););return M?Kr(f,N?0:Q,N?Q+1:V):Kr(f,N?Q+1:0,N?V:Q)}function lh(f,_){var M=f;return M instanceof an&&(M=M.value()),wm(_,function(N,V){return V.func.apply(V.thisArg,va([N],V.args))},M)}function Rc(f,_,M){var N=f.length;if(N<2)return N?Ea(f[0]):[];for(var V=-1,Q=He(N);++V<N;)for(var ce=f[V],me=-1;++me<N;)me!=V&&(Q[V]=yl(Q[V]||ce,f[me],_,M));return Ea(Ui(Q,1),_,M)}function sg(f,_,M){for(var N=-1,V=f.length,Q=_.length,ce={};++N<V;){var me=N<Q?_[N]:n;M(ce,f[N],me)}return ce}function ch(f){return si(f)?f:[]}function og(f){return typeof f=="function"?f:m}function Fo(f,_){return $t(f)?f:_h(f,_)?[f]:Md(Cn(f))}var m_=sn;function ko(f,_,M){var N=f.length;return M=M===n?N:M,!_&&M>=N?f:Kr(f,_,M)}var ag=ds||function(f){return vi.clearTimeout(f)};function lg(f,_){if(_)return f.slice();var M=f.length,N=qf?qf(M):new f.constructor(M);return f.copy(N),N}function uh(f){var _=new f.constructor(f.byteLength);return new ar(_).set(new ar(f)),_}function g_(f,_){var M=_?uh(f.buffer):f.buffer;return new f.constructor(M,f.byteOffset,f.byteLength)}function __(f){var _=new f.constructor(f.source,Ae.exec(f));return _.lastIndex=f.lastIndex,_}function cg(f){return $r?Un($r.call(f)):{}}function ug(f,_){var M=_?uh(f.buffer):f.buffer;return new f.constructor(M,f.byteOffset,f.length)}function hg(f,_){if(f!==_){var M=f!==n,N=f===null,V=f===f,Q=Ai(f),ce=_!==n,me=_===null,Ce=_===_,ct=Ai(_);if(!me&&!ct&&!Q&&f>_||Q&&ce&&Ce&&!me&&!ct||N&&ce&&Ce||!M&&Ce||!V)return 1;if(!N&&!Q&&!ct&&f<_||ct&&M&&V&&!N&&!Q||me&&M&&V||!ce&&V||!Ce)return-1}return 0}function VS(f,_,M){for(var N=-1,V=f.criteria,Q=_.criteria,ce=V.length,me=M.length;++N<ce;){var Ce=hg(V[N],Q[N]);if(Ce)return N>=me?Ce:Ce*(M[N]=="desc"?-1:1)}return f.index-_.index}function ld(f,_,M,N){for(var V=-1,Q=f.length,ce=M.length,me=-1,Ce=_.length,ct=Bn(Q-ce,0),st=He(Ce+ct),vt=!N;++me<Ce;)st[me]=_[me];for(;++V<ce;)(vt||V<Q)&&(st[M[V]]=f[V]);for(;ct--;)st[me++]=f[V++];return st}function fg(f,_,M,N){for(var V=-1,Q=f.length,ce=-1,me=M.length,Ce=-1,ct=_.length,st=Bn(Q-me,0),vt=He(st+ct),Et=!N;++V<st;)vt[V]=f[V];for(var Pt=V;++Ce<ct;)vt[Pt+Ce]=_[Ce];for(;++ce<me;)(Et||V<Q)&&(vt[Pt+M[ce]]=f[V++]);return vt}function _r(f,_){var M=-1,N=f.length;for(_||(_=He(N));++M<N;)_[M]=f[M];return _}function _s(f,_,M,N){var V=!M;M||(M={});for(var Q=-1,ce=_.length;++Q<ce;){var me=_[Q],Ce=N?N(M[me],f[me],me,M,f):n;Ce===n&&(Ce=f[me]),V?$i(M,me,Ce):Do(M,me,Ce)}return M}function v_(f,_){return _s(f,vd(f),_)}function y_(f,_){return _s(f,vg(f),_)}function cd(f,_){return function(M,N){var V=$t(M)?ES:o_,Q=_?_():{};return V(M,f,kt(N,2),Q)}}function Lc(f){return sn(function(_,M){var N=-1,V=M.length,Q=V>1?M[V-1]:n,ce=V>2?M[2]:n;for(Q=f.length>3&&typeof Q=="function"?(V--,Q):n,ce&&ri(M[0],M[1],ce)&&(Q=V<3?n:Q,V=1),_=Un(_);++N<V;){var me=M[N];me&&f(_,me,N,Q)}return _})}function dg(f,_){return function(M,N){if(M==null)return M;if(!xr(M))return f(M,N);for(var V=M.length,Q=_?V:-1,ce=Un(M);(_?Q--:++Q<V)&&N(ce[Q],Q,ce)!==!1;);return M}}function Pc(f){return function(_,M,N){for(var V=-1,Q=Un(_),ce=N(_),me=ce.length;me--;){var Ce=ce[f?me:++V];if(M(Q[Ce],Ce,Q)===!1)break}return _}}function pg(f,_,M){var N=_&b,V=Nc(f);function Q(){return(this&&this!==vi&&this instanceof Q?V:f).apply(N?M:this,arguments)}return Q}function hh(f){return function(_){_=Cn(_);var M=lc(_)?or(_):n,N=M?M[0]:_.charAt(0),V=M?ko(M,1).join(""):_.slice(1);return N[f]()+V}}function Ml(f){return function(_){return wm(Uv(Ph(_).replace(sc,"")),f,"")}}function Nc(f){return function(){var _=arguments;switch(_.length){case 0:return new f;case 1:return new f(_[0]);case 2:return new f(_[0],_[1]);case 3:return new f(_[0],_[1],_[2]);case 4:return new f(_[0],_[1],_[2],_[3]);case 5:return new f(_[0],_[1],_[2],_[3],_[4]);case 6:return new f(_[0],_[1],_[2],_[3],_[4],_[5]);case 7:return new f(_[0],_[1],_[2],_[3],_[4],_[5],_[6])}var M=Sa(f.prototype),N=f.apply(M,_);return ti(N)?N:M}}function fh(f,_,M){var N=Nc(f);function V(){for(var Q=arguments.length,ce=He(Q),me=Q,Ce=Go(V);me--;)ce[me]=arguments[me];var ct=Q<3&&ce[0]!==Ce&&ce[Q-1]!==Ce?[]:Co(ce,Ce);return Q-=ct.length,Q<M?S_(f,_,dh,V.placeholder,n,ce,ct,n,n,M-Q):Rr(this&&this!==vi&&this instanceof V?N:f,this,ce)}return V}function mg(f){return function(_,M,N){var V=Un(_);if(!xr(_)){var Q=kt(M,3);_=pi(_),M=function(me){return Q(V[me],me,V)}}var ce=f(_,M,N);return ce>-1?V[Q?_[ce]:ce]:n}}function ud(f){return fo(function(_){var M=_.length,N=M,V=Yi.prototype.thru;for(f&&_.reverse();N--;){var Q=_[N];if(typeof Q!="function")throw new qr(a);if(V&&!ce&&mh(Q)=="wrapper")var ce=new Yi([],!0)}for(N=ce?N:M;++N<M;){Q=_[N];var me=mh(Q),Ce=me=="wrapper"?Al(Q):n;Ce&&yd(Ce[0])&&Ce[1]==(U|C|O|I)&&!Ce[4].length&&Ce[9]==1?ce=ce[mh(Ce[0])].apply(ce,Ce[3]):ce=Q.length==1&&yd(Q)?ce[me]():ce.thru(Q)}return function(){var ct=arguments,st=ct[0];if(ce&&ct.length==1&&$t(st))return ce.plant(st).value();for(var vt=0,Et=M?_[vt].apply(this,ct):st;++vt<M;)Et=_[vt].call(this,Et);return Et}})}function dh(f,_,M,N,V,Q,ce,me,Ce,ct){var st=_&U,vt=_&b,Et=_&T,Pt=_&(C|P),Ht=_&z,Jt=Et?n:Nc(f);function Wt(){for(var Yn=arguments.length,Sn=He(Yn),ns=Yn;ns--;)Sn[ns]=arguments[ns];if(Pt)var Fa=Go(Wt),ru=$0(Sn,Fa);if(N&&(Sn=ld(Sn,N,V,Pt)),Q&&(Sn=fg(Sn,Q,ce,Pt)),Yn-=ru,Pt&&Yn<ct){var Ni=Co(Sn,Fa);return S_(f,_,dh,Wt.placeholder,M,Sn,Ni,me,Ce,ct-Yn)}var ta=vt?M:this,Ol=Et?ta[f]:f;return Yn=Sn.length,me?Sn=C_(Sn,me):Ht&&Yn>1&&Sn.reverse(),st&&Ce<Yn&&(Sn.length=Ce),this&&this!==vi&&this instanceof Wt&&(Ol=Jt||Nc(Ol)),Ol.apply(ta,Sn)}return Wt}function hd(f,_){return function(M,N){return Dn(M,f,_(N),{})}}function Ic(f,_){return function(M,N){var V;if(M===n&&N===n)return _;if(M!==n&&(V=M),N!==n){if(V===n)return N;typeof M=="string"||typeof N=="string"?(M=Ir(M),N=Ir(N)):(M=rg(M),N=rg(N)),V=f(M,N)}return V}}function fd(f){return fo(function(_){return _=Qn(_,sr(kt())),sn(function(M){var N=this;return f(_,function(V){return Rr(V,N,M)})})})}function ph(f,_){_=_===n?" ":Ir(_);var M=_.length;if(M<2)return M?sd(_,f):_;var N=sd(_,cl(f/uc(_)));return lc(_)?ko(or(N),0,f).join(""):N.slice(0,f)}function wl(f,_,M,N){var V=_&b,Q=Nc(f);function ce(){for(var me=-1,Ce=arguments.length,ct=-1,st=N.length,vt=He(st+Ce),Et=this&&this!==vi&&this instanceof ce?Q:f;++ct<st;)vt[ct]=N[ct];for(;Ce--;)vt[ct++]=arguments[++me];return Rr(Et,V?M:this,vt)}return ce}function x_(f){return function(_,M,N){return N&&typeof N!="number"&&ri(_,M,N)&&(M=N=n),_=ks(_),M===n?(M=_,_=0):M=ks(M),N=N===n?_<M?1:-1:ks(N),u_(_,M,N,f)}}function dd(f){return function(_,M){return typeof _=="string"&&typeof M=="string"||(_=Vr(_),M=Vr(M)),f(_,M)}}function S_(f,_,M,N,V,Q,ce,me,Ce,ct){var st=_&C,vt=st?ce:n,Et=st?n:ce,Pt=st?Q:n,Ht=st?n:Q;_|=st?O:B,_&=~(st?B:O),_&L||(_&=~(b|T));var Jt=[f,_,V,Pt,vt,Ht,Et,me,Ce,ct],Wt=M.apply(n,Jt);return yd(f)&&Vc(Wt,Jt),Wt.placeholder=N,bd(Wt,f,_)}function Oc(f){var _=Li[f];return function(M,N){if(M=Vr(M),N=N==null?0:Wi(nn(N),292),N&&Io(M)){var V=(Cn(M)+"e").split("e");return V=(Cn(_(V[0]+"e"+(+V[1]+N)))+"e").split("e"),+(V[0]+"e"+(+V[1]-N))}return _(M)}}var b_=ji&&1/Fu(new ji([,-0]))[1]==J?function(f){return new ji(f)}:ot;function pd(f){return function(_){var M=Bi(_);return M==ye?pr(_):M==Ft?Q0(_):Vu(_,f(_))}}function ho(f,_,M,N,V,Q,ce,me){var Ce=_&T;if(!Ce&&typeof f!="function")throw new qr(a);var ct=N?N.length:0;if(ct||(_&=~(O|B),N=V=n),ce=ce===n?ce:Bn(nn(ce),0),me=me===n?me:nn(me),ct-=V?V.length:0,_&B){var st=N,vt=V;N=V=n}var Et=Ce?n:Al(f),Pt=[f,_,M,N,V,st,vt,Q,ce,me];if(Et&&kS(Pt,Et),f=Pt[0],_=Pt[1],M=Pt[2],N=Pt[3],V=Pt[4],me=Pt[9]=Pt[9]===n?Ce?0:f.length:Bn(Pt[9]-ct,0),!me&&_&(C|P)&&(_&=~(C|P)),!_||_==b)var Ht=pg(f,_,M);else _==C||_==P?Ht=fh(f,_,me):(_==O||_==(b|O))&&!V.length?Ht=wl(f,_,M,N):Ht=dh.apply(n,Pt);return bd((Et?f_:Vc)(Ht,Pt),f,_)}function gg(f,_,M,N){return f===n||Bs(f,Ro[M])&&!wn.call(N,M)?_:f}function M_(f,_,M,N,V,Q){return ti(f)&&ti(_)&&(Q.set(_,f),Sl(f,_,n,M_,Q),Q.delete(_)),f}function _g(f){return Kc(f)?n:f}function xi(f,_,M,N,V,Q){var ce=M&E,me=f.length,Ce=_.length;if(me!=Ce&&!(ce&&Ce>me))return!1;var ct=Q.get(f),st=Q.get(_);if(ct&&st)return ct==_&&st==f;var vt=-1,Et=!0,Pt=M&w?new Ma:n;for(Q.set(f,_),Q.set(_,f);++vt<me;){var Ht=f[vt],Jt=_[vt];if(N)var Wt=ce?N(Jt,Ht,vt,_,f,Q):N(Ht,Jt,vt,f,_,Q);if(Wt!==n){if(Wt)continue;Et=!1;break}if(Pt){if(!Am(_,function(Yn,Sn){if(!ac(Pt,Sn)&&(Ht===Yn||V(Ht,Yn,M,N,Q)))return Pt.push(Sn)})){Et=!1;break}}else if(!(Ht===Jt||V(Ht,Jt,M,N,Q))){Et=!1;break}}return Q.delete(f),Q.delete(_),Et}function Zi(f,_,M,N,V,Q,ce){switch(M){case G:if(f.byteLength!=_.byteLength||f.byteOffset!=_.byteOffset)return!1;f=f.buffer,_=_.buffer;case dt:return!(f.byteLength!=_.byteLength||!Q(new ar(f),new ar(_)));case lt:case mt:case et:return Bs(+f,+_);case Be:return f.name==_.name&&f.message==_.message;case Bt:case ie:return f==_+"";case ye:var me=pr;case Ft:var Ce=N&E;if(me||(me=Fu),f.size!=_.size&&!Ce)return!1;var ct=ce.get(f);if(ct)return ct==_;N|=w,ce.set(f,_);var st=xi(me(f),me(_),N,V,Q,ce);return ce.delete(f),st;case Z:if($r)return $r.call(f)==$r.call(_)}return!1}function w_(f,_,M,N,V,Q){var ce=M&E,me=md(f),Ce=me.length;if(Ce!=md(_).length&&!ce)return!1;for(var ct=Ce;ct--;){var st=me[ct];if(!(ce?st in _:wn.call(_,st)))return!1}var vt=Q.get(f),Et=Q.get(_);if(vt&&Et)return vt==_&&Et==f;var Pt=!0;Q.set(f,_),Q.set(_,f);for(var Ht=ce;++ct<Ce;){st=me[ct];var Jt=f[st],Wt=_[st];if(N)var Yn=ce?N(Wt,Jt,st,_,f,Q):N(Jt,Wt,st,f,_,Q);if(!(Yn===n?Jt===Wt||V(Jt,Wt,M,N,Q):Yn)){Pt=!1;break}Ht||(Ht=st=="constructor")}if(Pt&&!Ht){var Sn=f.constructor,ns=_.constructor;Sn!=ns&&"constructor"in f&&"constructor"in _&&!(typeof Sn=="function"&&Sn instanceof Sn&&typeof ns=="function"&&ns instanceof ns)&&(Pt=!1)}return Q.delete(f),Q.delete(_),Pt}function fo(f){return Sd(Bc(f,n,yh),f+"")}function md(f){return jm(f,pi,vd)}function gd(f){return jm(f,Sr,vg)}var Al=Xu?function(f){return Xu.get(f)}:ot;function mh(f){for(var _=f.name+"",M=hl[_],N=wn.call(hl,_)?M.length:0;N--;){var V=M[N],Q=V.func;if(Q==null||Q==f)return V.name}return _}function Go(f){return(wn.call(H,"placeholder")?H:f).placeholder}function kt(){var f=H.iteratee||x;return f=f===x?Zm:f,arguments.length?f(arguments[0],arguments[1]):f}function _d(f,_){var M=f.__data__;return FS(_)?M[typeof _=="string"?"string":"hash"]:M.map}function Dc(f){for(var _=pi(f),M=_.length;M--;){var N=_[M],V=f[N];_[M]=[N,V,vh(V)]}return _}function Ho(f,_){var M=PS(f,_);return ii(M)?M:n}function A_(f){var _=wn.call(f,No),M=f[No];try{f[No]=n;var N=!0}catch{}var V=fc.call(f);return N&&(_?f[No]=M:delete f[No]),V}var vd=Lr?function(f){return f==null?[]:(f=Un(f),ro(Lr(f),function(_){return Hu.call(f,_)}))}:it,vg=Lr?function(f){for(var _=[];f;)va(_,vd(f)),f=fs(f);return _}:it,Bi=ci;(Vn&&Bi(new Vn(new ArrayBuffer(1)))!=G||on&&Bi(new on)!=ye||lo&&Bi(lo.resolve())!=St||ji&&Bi(new ji)!=Ft||ul&&Bi(new ul)!=ut)&&(Bi=function(f){var _=ci(f),M=_==_t?f.constructor:n,N=M?Ta(M):"";if(N)switch(N){case gc:return G;case fl:return ye;case Bm:return St;case ju:return Ft;case Vm:return ut}return _});function yg(f,_,M){for(var N=-1,V=M.length;++N<V;){var Q=M[N],ce=Q.size;switch(Q.type){case"drop":f+=ce;break;case"dropRight":_-=ce;break;case"take":_=Wi(_,f+ce);break;case"takeRight":f=Bn(f,_-ce);break}}return{start:f,end:_}}function xg(f){var _=f.match(Ls);return _?_[1].split(Ps):[]}function Sg(f,_,M){_=Fo(_,f);for(var N=-1,V=_.length,Q=!1;++N<V;){var ce=Dr(_[N]);if(!(Q=f!=null&&M(f,ce)))break;f=f[ce]}return Q||++N!=V?Q:(V=f==null?0:f.length,!!V&&Ud(V)&&po(ce,V)&&($t(f)||Jo(f)))}function bg(f){var _=f.length,M=new f.constructor(_);return _&&typeof f[0]=="string"&&wn.call(f,"index")&&(M.index=f.index,M.input=f.input),M}function gh(f){return typeof f.constructor=="function"&&!zc(f)?Sa(fs(f)):{}}function Mg(f,_,M){var N=f.constructor;switch(_){case dt:return uh(f);case lt:case mt:return new N(+f);case G:return g_(f,M);case q:case Y:case pe:case Me:case De:case Ee:case je:case nt:case ft:return ug(f,M);case ye:return new N;case et:case ie:return new N(f);case Bt:return __(f);case Ft:return new N;case Z:return cg(f)}}function E_(f,_){var M=_.length;if(!M)return f;var N=M-1;return _[N]=(M>1?"& ":"")+_[N],_=_.join(M>2?", ":" "),f.replace(Xr,`{
/* [wrapped with `+_+`] */
`)}function wg(f){return $t(f)||Jo(f)||!!($f&&f&&f[$f])}function po(f,_){var M=typeof f;return _=_??xe,!!_&&(M=="number"||M!="symbol"&&Vt.test(f))&&f>-1&&f%1==0&&f<_}function ri(f,_,M){if(!ti(M))return!1;var N=typeof _;return(N=="number"?xr(M)&&po(_,M.length):N=="string"&&_ in M)?Bs(M[_],f):!1}function _h(f,_){if($t(f))return!1;var M=typeof f;return M=="number"||M=="symbol"||M=="boolean"||f==null||Ai(f)?!0:Gn.test(f)||!hn.test(f)||_!=null&&f in Un(_)}function FS(f){var _=typeof f;return _=="string"||_=="number"||_=="symbol"||_=="boolean"?f!=="__proto__":f===null}function yd(f){var _=mh(f),M=H[_];if(typeof M!="function"||!(_ in an.prototype))return!1;if(f===M)return!0;var N=Al(M);return!!N&&f===N[0]}function Wo(f){return!!Gu&&Gu in f}var Ag=mr?Fs:Ut;function zc(f){var _=f&&f.constructor;return f===(typeof _=="function"&&_.prototype||Ro)}function vh(f){return f===f&&!ti(f)}function Uc(f,_){return function(M){return M==null?!1:M[f]===_&&(_!==n||f in Un(M))}}function jn(f){var _=Ll(f,function(N){return M.size===p&&M.clear(),N}),M=_.cache;return _}function kS(f,_){var M=f[1],N=_[1],V=M|N,Q=V<(b|T|U),ce=N==U&&M==C||N==U&&M==I&&f[7].length<=_[8]||N==(U|I)&&_[7].length<=_[8]&&M==C;if(!(Q||ce))return f;N&b&&(f[2]=_[2],V|=M&b?0:L);var me=_[3];if(me){var Ce=f[3];f[3]=Ce?ld(Ce,me,_[4]):me,f[4]=Ce?Co(f[3],g):_[4]}return me=_[5],me&&(Ce=f[5],f[5]=Ce?fg(Ce,me,_[6]):me,f[6]=Ce?Co(f[5],g):_[6]),me=_[7],me&&(f[7]=me),N&U&&(f[8]=f[8]==null?_[8]:Wi(f[8],_[8])),f[9]==null&&(f[9]=_[9]),f[0]=_[0],f[1]=V,f}function GS(f){var _=[];if(f!=null)for(var M in Un(f))_.push(M);return _}function T_(f){return fc.call(f)}function Bc(f,_,M){return _=Bn(_===n?f.length-1:_,0),function(){for(var N=arguments,V=-1,Q=Bn(N.length-_,0),ce=He(Q);++V<Q;)ce[V]=N[_+V];V=-1;for(var me=He(_+1);++V<_;)me[V]=N[V];return me[_]=M(ce),Rr(f,this,me)}}function Xo(f,_){return _.length<2?f:Uo(f,Kr(_,0,-1))}function C_(f,_){for(var M=f.length,N=Wi(_.length,M),V=_r(f);N--;){var Q=_[N];f[N]=po(Q,M)?V[Q]:n}return f}function xd(f,_){if(!(_==="constructor"&&typeof f[_]=="function")&&_!="__proto__")return f[_]}var Vc=Eg(f_),Or=mc||function(f,_){return vi.setTimeout(f,_)},Sd=Eg(d_);function bd(f,_,M){var N=_+"";return Sd(f,E_(N,jo(xg(N),M)))}function Eg(f){var _=0,M=0;return function(){var N=Dm(),V=k-(N-M);if(M=N,V>0){if(++_>=ee)return arguments[0]}else _=0;return f.apply(n,arguments)}}function Fc(f,_){var M=-1,N=f.length,V=N-1;for(_=_===n?N:_;++M<_;){var Q=rd(M,V),ce=f[Q];f[Q]=f[M],f[M]=ce}return f.length=_,f}var Md=jn(function(f){var _=[];return f.charCodeAt(0)===46&&_.push(""),f.replace(Di,function(M,N,V,Q){_.push(V?Q.replace(Re,"$1"):N||M)}),_});function Dr(f){if(typeof f=="string"||Ai(f))return f;var _=f+"";return _=="0"&&1/f==-J?"-0":_}function Ta(f){if(f!=null){try{return Lo.call(f)}catch{}try{return f+""}catch{}}return""}function jo(f,_){return jr(_e,function(M){var N="_."+M[0];_&M[1]&&!Vf(f,N)&&f.push(N)}),f.sort()}function Si(f){if(f instanceof an)return f.clone();var _=new Yi(f.__wrapped__,f.__chain__);return _.__actions__=_r(f.__actions__),_.__index__=f.__index__,_.__values__=f.__values__,_}function Tg(f,_,M){(M?ri(f,_,M):_===n)?_=1:_=Bn(nn(_),0);var N=f==null?0:f.length;if(!N||_<1)return[];for(var V=0,Q=0,ce=He(cl(N/_));V<N;)ce[Q++]=Kr(f,V,V+=_);return ce}function R_(f){for(var _=-1,M=f==null?0:f.length,N=0,V=[];++_<M;){var Q=f[_];Q&&(V[N++]=Q)}return V}function Vi(){var f=arguments.length;if(!f)return[];for(var _=He(f-1),M=arguments[0],N=f;N--;)_[N-1]=arguments[N];return va($t(M)?_r(M):[M],Ui(_,1))}var HS=sn(function(f,_){return si(f)?yl(f,Ui(_,1,si,!0)):[]}),L_=sn(function(f,_){var M=hi(_);return si(M)&&(M=n),si(f)?yl(f,Ui(_,1,si,!0),kt(M,2)):[]}),P_=sn(function(f,_){var M=hi(_);return si(M)&&(M=n),si(f)?yl(f,Ui(_,1,si,!0),n,M):[]});function ei(f,_,M){var N=f==null?0:f.length;return N?(_=M||_===n?1:nn(_),Kr(f,_<0?0:_,N)):[]}function zr(f,_,M){var N=f==null?0:f.length;return N?(_=M||_===n?1:nn(_),_=N-_,Kr(f,0,_<0?0:_)):[]}function Yo(f,_){return f&&f.length?ah(f,kt(_,3),!0,!0):[]}function N_(f,_){return f&&f.length?ah(f,kt(_,3),!0):[]}function I_(f,_,M,N){var V=f==null?0:f.length;return V?(M&&typeof M!="number"&&ri(f,_,M)&&(M=0,N=V),Ac(f,_,M,N)):[]}function Cg(f,_,M){var N=f==null?0:f.length;if(!N)return-1;var V=M==null?0:nn(M);return V<0&&(V=Bn(N+V,0)),Bu(f,kt(_,3),V)}function O_(f,_,M){var N=f==null?0:f.length;if(!N)return-1;var V=N-1;return M!==n&&(V=nn(M),V=M<0?Bn(N+V,0):Wi(V,N-1)),Bu(f,kt(_,3),V,!0)}function yh(f){return f!=null&&f.length?Ui(f,1):[]}function Ur(f){return f!=null&&f.length?Ui(f,J):[]}function Us(f,_){return f!=null&&f.length?(_=_===n?1:nn(_),Ui(f,_)):[]}function D_(f){for(var _=-1,M=f==null?0:f.length,N={};++_<M;){var V=f[_];$i(N,V[0],V[1])}return N}function vr(f){return f&&f.length?f[0]:n}function z_(f,_,M){var N=f==null?0:f.length;if(!N)return-1;var V=M==null?0:nn(M);return V<0&&(V=Bn(N+V,0)),rl(f,_,V)}function qo(f){return f!=null&&f.length?Kr(f,0,-1):[]}var El=sn(function(f){var _=Qn(f,ch);return _.length&&_[0]===f[0]?Qt(_):[]}),$o=sn(function(f){var _=hi(f),M=Qn(f,ch);return _===hi(M)?_=n:M.pop(),M.length&&M[0]===f[0]?Qt(M,kt(_,2)):[]}),Rg=sn(function(f){var _=hi(f),M=Qn(f,ch);return _=typeof _=="function"?_:n,_&&M.pop(),M.length&&M[0]===f[0]?Qt(M,n,_):[]});function Lg(f,_){return f==null?"":oo.call(f,_)}function hi(f){var _=f==null?0:f.length;return _?f[_-1]:n}function U_(f,_,M){var N=f==null?0:f.length;if(!N)return-1;var V=N;return M!==n&&(V=nn(M),V=V<0?Bn(N+V,0):Wi(V,N-1)),_===_?Pm(f,_,V):Bu(f,Cm,V,!0)}function kc(f,_){return f&&f.length?ih(f,nn(_)):n}var xh=sn(Gc);function Gc(f,_){return f&&f.length&&_&&_.length?sh(f,_):f}function Hc(f,_,M){return f&&f.length&&_&&_.length?sh(f,_,kt(M,2)):f}function B_(f,_,M){return f&&f.length&&_&&_.length?sh(f,_,n,M):f}var V_=fo(function(f,_){var M=f==null?0:f.length,N=$u(f,_);return eg(f,Qn(_,function(V){return po(V,M)?+V:V}).sort(hg)),N});function Sh(f,_){var M=[];if(!(f&&f.length))return M;var N=-1,V=[],Q=f.length;for(_=kt(_,3);++N<Q;){var ce=f[N];_(ce,N,f)&&(M.push(ce),V.push(N))}return eg(f,V),M}function wd(f){return f==null?f:Xi.call(f)}function Ad(f,_,M){var N=f==null?0:f.length;return N?(M&&typeof M!="number"&&ri(f,_,M)?(_=0,M=N):(_=_==null?0:nn(_),M=M===n?N:nn(M)),Kr(f,_,M)):[]}function F_(f,_){return oh(f,_)}function WS(f,_,M){return od(f,_,kt(M,2))}function XS(f,_){var M=f==null?0:f.length;if(M){var N=oh(f,_);if(N<M&&Bs(f[N],_))return N}return-1}function Tn(f,_){return oh(f,_,!0)}function Fn(f,_,M){return od(f,_,kt(M,2),!0)}function fn(f,_){if(f!=null&&f.length){var M=oh(f,_,!0)-1;if(Bs(f[M],_))return M}return-1}function mn(f){return f&&f.length?ig(f):[]}function Nn(f,_){return f&&f.length?ig(f,kt(_,2)):[]}function Qr(f){var _=f==null?0:f.length;return _?Kr(f,1,_):[]}function Ca(f,_,M){return f&&f.length?(_=M||_===n?1:nn(_),Kr(f,0,_<0?0:_)):[]}function Wc(f,_,M){var N=f==null?0:f.length;return N?(_=M||_===n?1:nn(_),_=N-_,Kr(f,_<0?0:_,N)):[]}function Pg(f,_){return f&&f.length?ah(f,kt(_,3),!1,!0):[]}function Zo(f,_){return f&&f.length?ah(f,kt(_,3)):[]}var fi=sn(function(f){return Ea(Ui(f,1,si,!0))}),Ra=sn(function(f){var _=hi(f);return si(_)&&(_=n),Ea(Ui(f,1,si,!0),kt(_,2))}),Tl=sn(function(f){var _=hi(f);return _=typeof _=="function"?_:n,Ea(Ui(f,1,si,!0),n,_)});function Ng(f){return f&&f.length?Ea(f):[]}function Jr(f,_){return f&&f.length?Ea(f,kt(_,2)):[]}function Xc(f,_){return _=typeof _=="function"?_:n,f&&f.length?Ea(f,n,_):[]}function Cl(f){if(!(f&&f.length))return[];var _=0;return f=ro(f,function(M){if(si(M))return _=Bn(M.length,_),!0}),ol(_,function(M){return Qn(f,Rm(M))})}function yr(f,_){if(!(f&&f.length))return[];var M=Cl(f);return _==null?M:Qn(M,function(N){return Rr(_,n,N)})}var Ig=sn(function(f,_){return si(f)?yl(f,_):[]}),Ed=sn(function(f){return Rc(ro(f,si))}),k_=sn(function(f){var _=hi(f);return si(_)&&(_=n),Rc(ro(f,si),kt(_,2))}),Td=sn(function(f){var _=hi(f);return _=typeof _=="function"?_:n,Rc(ro(f,si),n,_)}),Cd=sn(Cl);function La(f,_){return sg(f||[],_||[],Do)}function Pi(f,_){return sg(f||[],_||[],Cc)}var Pa=sn(function(f){var _=f.length,M=_>1?f[_-1]:n;return M=typeof M=="function"?(f.pop(),M):n,yr(f,M)});function Rl(f){var _=H(f);return _.__chain__=!0,_}function Ko(f,_){return _(f),f}function jc(f,_){return _(f)}var Og=fo(function(f){var _=f.length,M=_?f[0]:0,N=this.__wrapped__,V=function(Q){return $u(Q,f)};return _>1||this.__actions__.length||!(N instanceof an)||!po(M)?this.thru(V):(N=N.slice(M,+M+(_?1:0)),N.__actions__.push({func:jc,args:[V],thisArg:n}),new Yi(N,this.__chain__).thru(function(Q){return _&&!Q.length&&Q.push(n),Q}))});function G_(){return Rl(this)}function bh(){return new Yi(this.value(),this.__chain__)}function Dg(){this.__values__===n&&(this.__values__=kd(this.value()));var f=this.__index__>=this.__values__.length;return{done:f,value:f?n:this.__values__[this.__index__++]}}function vs(){return this}function H_(f){for(var _,M=this;M instanceof _c;){var N=Si(M);N.__index__=0,N.__values__=n,_?V.__wrapped__=N:_=N;var V=N;M=M.__wrapped__}return V.__wrapped__=f,_}function Br(){var f=this.__wrapped__;if(f instanceof an){var _=f;return this.__actions__.length&&(_=new an(this)),_=_.reverse(),_.__actions__.push({func:jc,args:[wd],thisArg:n}),new Yi(_,this.__chain__)}return this.thru(wd)}function W_(){return lh(this.__wrapped__,this.__actions__)}var X_=cd(function(f,_,M){wn.call(f,M)?++f[M]:$i(f,M,1)});function jS(f,_,M){var N=$t(f)?W0:l_;return M&&ri(f,_,M)&&(_=n),N(f,kt(_,3))}function Na(f,_){return($t(f)?ro:Ku)(f,kt(_,3))}var Rd=mg(Cg),zg=mg(O_);function Yc(f,_){return Ui(Pd(f,_),1)}function j_(f,_){return Ui(Pd(f,_),J)}function Y_(f,_,M){return M=M===n?1:nn(M),Ui(Pd(f,_),M)}function Ug(f,_){return($t(f)?jr:gs)(f,kt(_,3))}function Bg(f,_){return($t(f)?TS:wc)(f,kt(_,3))}var Ld=cd(function(f,_,M){wn.call(f,M)?f[M].push(_):$i(f,M,[_])});function Vg(f,_,M,N){f=xr(f)?f:nu(f),M=M&&!N?nn(M):0;var V=f.length;return M<0&&(M=Bn(V+M,0)),Fd(f)?M<=V&&f.indexOf(_,M)>-1:!!V&&rl(f,_,M)>-1}var YS=sn(function(f,_,M){var N=-1,V=typeof _=="function",Q=xr(f)?He(f.length):[];return gs(f,function(ce){Q[++N]=V?Rr(_,ce,M):Jn(ce,_,M)}),Q}),qS=cd(function(f,_,M){$i(f,M,_)});function Pd(f,_){return($t(f)?Qn:nd)(f,kt(_,3))}function q_(f,_,M,N){return f==null?[]:($t(_)||(_=_==null?[]:[_]),M=N?n:M,$t(M)||(M=M==null?[]:[M]),id(f,_,M))}var $_=cd(function(f,_,M){f[M?0:1].push(_)},function(){return[[],[]]});function qc(f,_,M){var N=$t(f)?wm:j0,V=arguments.length<3;return N(f,kt(_,4),M,V,gs)}function Nd(f,_,M){var N=$t(f)?CS:j0,V=arguments.length<3;return N(f,kt(_,4),M,V,wc)}function Z_(f,_){return($t(f)?ro:Ku)(f,Zc(kt(_,3)))}function K_(f){return($t(f)?Xm:h_)(f)}function Q_(f,_,M){return(M?ri(f,_,M):_===n)?_=1:_=nn(_),($t(f)?Sc:tg)(f,_)}function J_(f){return($t(f)?qu:p_)(f)}function ev(f){if(f==null)return 0;if(xr(f))return Fd(f)?uc(f):f.length;var _=Bi(f);return _==ye||_==Ft?f.size:Km(f).length}function tv(f,_,M){var N=$t(f)?Am:ng;return M&&ri(f,_,M)&&(_=n),N(f,kt(_,3))}var Id=sn(function(f,_){if(f==null)return[];var M=_.length;return M>1&&ri(f,_[0],_[1])?_=[]:M>2&&ri(_[0],_[1],_[2])&&(_=[_[0]]),id(f,Ui(_,1),[])}),Mh=pc||function(){return vi.Date.now()};function nv(f,_){if(typeof _!="function")throw new qr(a);return f=nn(f),function(){if(--f<1)return _.apply(this,arguments)}}function Rn(f,_,M){return _=M?n:_,_=f&&_==null?f.length:_,ho(f,U,n,n,n,n,_)}function Od(f,_){var M;if(typeof _!="function")throw new qr(a);return f=nn(f),function(){return--f>0&&(M=_.apply(this,arguments)),f<=1&&(_=n),M}}var Fg=sn(function(f,_,M){var N=b;if(M.length){var V=Co(M,Go(Fg));N|=O}return ho(f,N,_,M,V)}),kg=sn(function(f,_,M){var N=b|T;if(M.length){var V=Co(M,Go(kg));N|=O}return ho(_,N,f,M,V)});function iv(f,_,M){_=M?n:_;var N=ho(f,C,n,n,n,n,n,_);return N.placeholder=iv.placeholder,N}function rv(f,_,M){_=M?n:_;var N=ho(f,P,n,n,n,n,n,_);return N.placeholder=rv.placeholder,N}function sv(f,_,M){var N,V,Q,ce,me,Ce,ct=0,st=!1,vt=!1,Et=!0;if(typeof f!="function")throw new qr(a);_=Vr(_)||0,ti(M)&&(st=!!M.leading,vt="maxWait"in M,Q=vt?Bn(Vr(M.maxWait)||0,_):Q,Et="trailing"in M?!!M.trailing:Et);function Pt(Ni){var ta=N,Ol=V;return N=V=n,ct=Ni,ce=f.apply(Ol,ta),ce}function Ht(Ni){return ct=Ni,me=Or(Yn,_),st?Pt(Ni):ce}function Jt(Ni){var ta=Ni-Ce,Ol=Ni-ct,OA=_-ta;return vt?Wi(OA,Q-Ol):OA}function Wt(Ni){var ta=Ni-Ce,Ol=Ni-ct;return Ce===n||ta>=_||ta<0||vt&&Ol>=Q}function Yn(){var Ni=Mh();if(Wt(Ni))return Sn(Ni);me=Or(Yn,Jt(Ni))}function Sn(Ni){return me=n,Et&&N?Pt(Ni):(N=V=n,ce)}function ns(){me!==n&&ag(me),ct=0,N=Ce=V=me=n}function Fa(){return me===n?ce:Sn(Mh())}function ru(){var Ni=Mh(),ta=Wt(Ni);if(N=arguments,V=this,Ce=Ni,ta){if(me===n)return Ht(Ce);if(vt)return ag(me),me=Or(Yn,_),Pt(Ce)}return me===n&&(me=Or(Yn,_)),ce}return ru.cancel=ns,ru.flush=Fa,ru}var Dd=sn(function(f,_){return Jf(f,1,_)}),$c=sn(function(f,_,M){return Jf(f,Vr(_)||0,M)});function Gg(f){return ho(f,z)}function Ll(f,_){if(typeof f!="function"||_!=null&&typeof _!="function")throw new qr(a);var M=function(){var N=arguments,V=_?_.apply(this,N):N[0],Q=M.cache;if(Q.has(V))return Q.get(V);var ce=f.apply(this,N);return M.cache=Q.set(V,ce)||Q,ce};return M.cache=new(Ll.Cache||uo),M}Ll.Cache=uo;function Zc(f){if(typeof f!="function")throw new qr(a);return function(){var _=arguments;switch(_.length){case 0:return!f.call(this);case 1:return!f.call(this,_[0]);case 2:return!f.call(this,_[0],_[1]);case 3:return!f.call(this,_[0],_[1],_[2])}return!f.apply(this,_)}}function Ia(f){return Od(2,f)}var Qo=m_(function(f,_){_=_.length==1&&$t(_[0])?Qn(_[0],sr(kt())):Qn(Ui(_,1),sr(kt()));var M=_.length;return sn(function(N){for(var V=-1,Q=Wi(N.length,M);++V<Q;)N[V]=_[V].call(this,N[V]);return Rr(f,this,N)})}),Pl=sn(function(f,_){return ho(f,O,n,_,Co(_,Go(Pl)))}),ov=sn(function(f,_){return ho(f,B,n,_,Co(_,Go(ov)))}),av=fo(function(f,_){return ho(f,I,n,n,n,_)});function lv(f,_){if(typeof f!="function")throw new qr(a);return _=_===n?_:nn(_),sn(f,_)}function cv(f,_){if(typeof f!="function")throw new qr(a);return _=_==null?0:Bn(nn(_),0),sn(function(M){var N=M[_],V=ko(M,0,_);return N&&va(V,N),Rr(f,this,V)})}function uv(f,_,M){var N=!0,V=!0;if(typeof f!="function")throw new qr(a);return ti(M)&&(N="leading"in M?!!M.leading:N,V="trailing"in M?!!M.trailing:V),sv(f,_,{leading:N,maxWait:_,trailing:V})}function $S(f){return Rn(f,1)}function Hg(f,_){return Pl(og(_),f)}function hv(){if(!arguments.length)return[];var f=arguments[0];return $t(f)?f:[f]}function fv(f){return zi(f,S)}function ZS(f,_){return _=typeof _=="function"?_:n,zi(f,S,_)}function Wg(f){return zi(f,v|S)}function Xg(f,_){return _=typeof _=="function"?_:n,zi(f,v|S,_)}function wh(f,_){return _==null||Mc(f,_,pi(_))}function Bs(f,_){return f===_||f!==f&&_!==_}var dv=dd(gr),dn=dd(function(f,_){return f>=_}),Jo=Ju((function(){return arguments})())?Ju:function(f){return di(f)&&wn.call(f,"callee")&&!Hu.call(f,"callee")},$t=He.isArray,pv=zu?sr(zu):Ec;function xr(f){return f!=null&&Ud(f.length)&&!Fs(f)}function si(f){return di(f)&&xr(f)}function Ah(f){return f===!0||f===!1||di(f)&&ci(f)==lt}var Vs=ps||Ut,KS=Mm?sr(Mm):xl;function mv(f){return di(f)&&f.nodeType===1&&!Kc(f)}function QS(f){if(f==null)return!0;if(xr(f)&&($t(f)||typeof f=="string"||typeof f.splice=="function"||Vs(f)||Nl(f)||Jo(f)))return!f.length;var _=Bi(f);if(_==ye||_==Ft)return!f.size;if(zc(f))return!Km(f).length;for(var M in f)if(wn.call(f,M))return!1;return!0}function JS(f,_){return Aa(f,_)}function gv(f,_,M){M=typeof M=="function"?M:n;var N=M?M(f,_):n;return N===n?Aa(f,_,n,M):!!N}function zd(f){if(!di(f))return!1;var _=ci(f);return _==Be||_==ne||typeof f.message=="string"&&typeof f.name=="string"&&!Kc(f)}function zn(f){return typeof f=="number"&&Io(f)}function Fs(f){if(!ti(f))return!1;var _=ci(f);return _==Ne||_==ve||_==Xe||_==Mt}function Fi(f){return typeof f=="number"&&f==nn(f)}function Ud(f){return typeof f=="number"&&f>-1&&f%1==0&&f<=xe}function ti(f){var _=typeof f;return f!=null&&(_=="object"||_=="function")}function di(f){return f!=null&&typeof f=="object"}var Bd=k0?sr(k0):Tc;function jg(f,_){return f===_||Ym(f,_,Dc(_))}function Vd(f,_,M){return M=typeof M=="function"?M:n,Ym(f,_,Dc(_),M)}function _v(f){return yv(f)&&f!=+f}function vv(f){if(Ag(f))throw new qt(s);return ii(f)}function Yg(f){return f===null}function qg(f){return f==null}function yv(f){return typeof f=="number"||di(f)&&ci(f)==et}function Kc(f){if(!di(f)||ci(f)!=_t)return!1;var _=fs(f);if(_===null)return!0;var M=wn.call(_,"constructor")&&_.constructor;return typeof M=="function"&&M instanceof M&&Lo.call(M)==ll}var $g=Bf?sr(Bf):qm;function xv(f){return Fi(f)&&f>=-xe&&f<=xe}var Sv=G0?sr(G0):$m;function Fd(f){return typeof f=="string"||!$t(f)&&di(f)&&ci(f)==ie}function Ai(f){return typeof f=="symbol"||di(f)&&ci(f)==Z}var Nl=H0?sr(H0):c_;function bv(f){return f===n}function Zg(f){return di(f)&&Bi(f)==ut}function eb(f){return di(f)&&ci(f)==gt}var tb=dd(th),Mv=dd(function(f,_){return f<=_});function kd(f){if(!f)return[];if(xr(f))return Fd(f)?or(f):_r(f);if(dc&&f[dc])return IS(f[dc]());var _=Bi(f);return(_==ye?pr:_==Ft?Fu:nu)(f)}function ks(f){return f?(f=Vr(f),f===J||f===-J?(f<0?-1:1)*de:f===f?f:0):f===0?f:0}function nn(f){var _=ks(f),M=_%1;return _===_?M?_-M:_:0}function es(f){return f?zo(nn(f),0,F):0}function Vr(f){if(typeof f=="number")return f;if(Ai(f))return fe;if(ti(f)){var _=typeof f.valueOf=="function"?f.valueOf():f;f=ti(_)?_+"":_}if(typeof f!="string")return f===0?f:+f;f=q0(f);var M=xt.test(f);return M||Rt.test(f)?F0(f.slice(2),M?2:8):qe.test(f)?fe:+f}function Kg(f){return _s(f,Sr(f))}function wv(f){return f?zo(nn(f),-xe,xe):f===0?f:0}function Cn(f){return f==null?"":Ir(f)}var Eh=Lc(function(f,_){if(zc(_)||xr(_)){_s(_,pi(_),f);return}for(var M in _)wn.call(_,M)&&Do(f,M,_[M])}),ts=Lc(function(f,_){_s(_,Sr(_),f)}),Qg=Lc(function(f,_,M,N){_s(_,Sr(_),f,N)}),Qc=Lc(function(f,_,M,N){_s(_,pi(_),f,N)}),ea=fo($u);function nb(f,_){var M=Sa(f);return _==null?M:wa(M,_)}var ib=sn(function(f,_){f=Un(f);var M=-1,N=_.length,V=N>2?_[2]:n;for(V&&ri(_[0],_[1],V)&&(N=1);++M<N;)for(var Q=_[M],ce=Sr(Q),me=-1,Ce=ce.length;++me<Ce;){var ct=ce[me],st=f[ct];(st===n||Bs(st,Ro[ct])&&!wn.call(f,ct))&&(f[ct]=Q[ct])}return f}),Jc=sn(function(f){return f.push(n,M_),Rr(Th,n,f)});function Av(f,_){return Tm(f,kt(_,3),li)}function rb(f,_){return Tm(f,kt(_,3),Nr)}function sb(f,_){return f==null?f:Qu(f,kt(_,3),Sr)}function ob(f,_){return f==null?f:ed(f,kt(_,3),Sr)}function ab(f,_){return f&&li(f,kt(_,3))}function lb(f,_){return f&&Nr(f,kt(_,3))}function cb(f){return f==null?[]:zs(f,pi(f))}function ub(f){return f==null?[]:zs(f,Sr(f))}function Gd(f,_,M){var N=f==null?n:Uo(f,_);return N===n?M:N}function eu(f,_){return f!=null&&Sg(f,_,yi)}function Il(f,_){return f!=null&&Sg(f,_,td)}var Ev=hd(function(f,_,M){_!=null&&typeof _.toString!="function"&&(_=fc.call(_)),f[_]=M},iu(m)),hb=hd(function(f,_,M){_!=null&&typeof _.toString!="function"&&(_=fc.call(_)),wn.call(f,_)?f[_].push(M):f[_]=[M]},kt),tu=sn(Jn);function pi(f){return xr(f)?Wm(f):Km(f)}function Sr(f){return xr(f)?Wm(f,!0):Qm(f)}function Hd(f,_){var M={};return _=kt(_,3),li(f,function(N,V,Q){$i(M,_(N,V,Q),N)}),M}function Jg(f,_){var M={};return _=kt(_,3),li(f,function(N,V,Q){$i(M,V,_(N,V,Q))}),M}var e1=Lc(function(f,_,M){Sl(f,_,M)}),Th=Lc(function(f,_,M,N){Sl(f,_,M,N)}),Tv=fo(function(f,_){var M={};if(f==null)return M;var N=!1;_=Qn(_,function(Q){return Q=Fo(Q,f),N||(N=Q.length>1),Q}),_s(f,gd(f),M),N&&(M=zi(M,v|y|S,_g));for(var V=_.length;V--;)ad(M,_[V]);return M});function Cv(f,_){return t1(f,Zc(kt(_)))}var fb=fo(function(f,_){return f==null?{}:Vo(f,_)});function t1(f,_){if(f==null)return{};var M=Qn(gd(f),function(N){return[N]});return _=kt(_),rh(f,M,function(N,V){return _(N,V[0])})}function db(f,_,M){_=Fo(_,f);var N=-1,V=_.length;for(V||(V=1,f=n);++N<V;){var Q=f==null?n:f[Dr(_[N])];Q===n&&(N=V,Q=M),f=Fs(Q)?Q.call(f):Q}return f}function n1(f,_,M){return f==null?f:Cc(f,_,M)}function pb(f,_,M,N){return N=typeof N=="function"?N:n,f==null?f:Cc(f,_,M,N)}var Ch=pd(pi),Rh=pd(Sr);function Wd(f,_,M){var N=$t(f),V=N||Vs(f)||Nl(f);if(_=kt(_,4),M==null){var Q=f&&f.constructor;V?M=N?new Q:[]:ti(f)?M=Fs(Q)?Sa(fs(f)):{}:M={}}return(V?jr:li)(f,function(ce,me,Ce){return _(M,ce,me,Ce)}),M}function mb(f,_){return f==null?!0:ad(f,_)}function Lh(f,_,M){return f==null?f:bl(f,_,og(M))}function gb(f,_,M,N){return N=typeof N=="function"?N:n,f==null?f:bl(f,_,og(M),N)}function nu(f){return f==null?[]:Gf(f,pi(f))}function _b(f){return f==null?[]:Gf(f,Sr(f))}function Rv(f,_,M){return M===n&&(M=_,_=n),M!==n&&(M=Vr(M),M=M===M?M:0),_!==n&&(_=Vr(_),_=_===_?_:0),zo(Vr(f),_,M)}function Lv(f,_,M){return _=ks(_),M===n?(M=_,_=0):M=ks(M),f=Vr(f),Bo(f,_,M)}function i1(f,_,M){if(M&&typeof M!="boolean"&&ri(f,_,M)&&(_=M=n),M===n&&(typeof _=="boolean"?(M=_,_=n):typeof f=="boolean"&&(M=f,f=n)),f===n&&_===n?(f=0,_=1):(f=ks(f),_===n?(_=f,f=0):_=ks(_)),f>_){var N=f;f=_,_=N}if(M||f%1||_%1){var V=Um();return Wi(f+V*(_-f+zf("1e-"+((V+"").length-1))),_)}return rd(f,_)}var Pv=Ml(function(f,_,M){return _=_.toLowerCase(),f+(M?r1(_):_)});function r1(f){return Ba(Cn(f).toLowerCase())}function Ph(f){return f=Cn(f),f&&f.replace(jt,Z0).replace(oc,"")}function vb(f,_,M){f=Cn(f),_=Ir(_);var N=f.length;M=M===n?N:zo(nn(M),0,N);var V=M;return M-=_.length,M>=0&&f.slice(M,V)==_}function yb(f){return f=Cn(f),f&&be.test(f)?f.replace(le,K0):f}function s1(f){return f=Cn(f),f&&Ci.test(f)?f.replace(Gi,"\\$&"):f}var o1=Ml(function(f,_,M){return f+(M?"-":"")+_.toLowerCase()}),Xd=Ml(function(f,_,M){return f+(M?" ":"")+_.toLowerCase()}),a1=hh("toLowerCase");function Nv(f,_,M){f=Cn(f),_=nn(_);var N=_?uc(f):0;if(!_||N>=_)return f;var V=(_-N)/2;return ph(xa(V),M)+f+ph(cl(V),M)}function l1(f,_,M){f=Cn(f),_=nn(_);var N=_?uc(f):0;return _&&N<_?f+ph(_-N,M):f}function Oa(f,_,M){f=Cn(f),_=nn(_);var N=_?uc(f):0;return _&&N<_?ph(_-N,M)+f:f}function Da(f,_,M){return M||_==null?_=0:_&&(_=+_),zm(Cn(f).replace(bn,""),_||0)}function za(f,_,M){return(M?ri(f,_,M):_===n)?_=1:_=nn(_),sd(Cn(f),_)}function Nh(){var f=arguments,_=Cn(f[0]);return f.length<3?_:_.replace(f[1],f[2])}var Ih=Ml(function(f,_,M){return f+(M?"_":"")+_.toLowerCase()});function Ua(f,_,M){return M&&typeof M!="number"&&ri(f,_,M)&&(_=M=n),M=M===n?F:M>>>0,M?(f=Cn(f),f&&(typeof _=="string"||_!=null&&!$g(_))&&(_=Ir(_),!_&&lc(f))?ko(or(f),0,M):f.split(_,M)):[]}var xb=Ml(function(f,_,M){return f+(M?" ":"")+Ba(_)});function Iv(f,_,M){return f=Cn(f),M=M==null?0:zo(nn(M),0,f.length),_=Ir(_),f.slice(M,M+_.length)==_}function Oh(f,_,M){var N=H.templateSettings;M&&ri(f,_,M)&&(_=n),f=Cn(f),_=Qc({},_,N,gg);var V=Qc({},_.imports,N.imports,gg),Q=pi(V),ce=Gf(V,Q);jr(Q,function(Wt){if(K.test(Wt))throw new qt(u)});var me,Ce,ct=0,st=_.interpolate||zt,vt="__p += '",Et=Im((_.escape||zt).source+"|"+st.source+"|"+(st===Nt?$e:zt).source+"|"+(_.evaluate||zt).source+"|$","g"),Pt="//# sourceURL="+(wn.call(_,"sourceURL")?(_.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Sm+"]")+`
`;f.replace(Et,function(Wt,Yn,Sn,ns,Fa,ru){return Sn||(Sn=ns),vt+=f.slice(ct,ru).replace(It,LS),Yn&&(me=!0,vt+=`' +
__e(`+Yn+`) +
'`),Fa&&(Ce=!0,vt+=`';
`+Fa+`;
__p += '`),Sn&&(vt+=`' +
((__t = (`+Sn+`)) == null ? '' : __t) +
'`),ct=ru+Wt.length,Wt}),vt+=`';
`;var Ht=wn.call(_,"variable")&&_.variable;if(!Ht)vt=`with (obj) {
`+vt+`
}
`;else if(K.test(Ht))throw new qt(c);vt=(Ce?vt.replace(se,""):vt).replace(Ze,"$1").replace(Se,"$1;"),vt="function("+(Ht||"obj")+`) {
`+(Ht?"":`obj || (obj = {});
`)+"var __t, __p = ''"+(me?", __e = _.escape":"")+(Ce?`, __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') }
`:`;
`)+vt+`return __p
}`;var Jt=$d(function(){return Mn(Q,Pt+"return "+vt).apply(n,ce)});if(Jt.source=vt,zd(Jt))throw Jt;return Jt}function Sb(f){return Cn(f).toLowerCase()}function Ov(f){return Cn(f).toUpperCase()}function jd(f,_,M){if(f=Cn(f),f&&(M||_===n))return q0(f);if(!f||!(_=Ir(_)))return f;var N=or(f),V=or(_);return ko(N,Hf(N,V),Wf(N,V)+1).join("")}function Dv(f,_,M){if(f=Cn(f),f&&(M||_===n))return f.slice(0,Xf(f)+1);if(!f||!(_=Ir(_)))return f;var N=or(f);return ko(N,0,Wf(N,or(_))+1).join("")}function bb(f,_,M){if(f=Cn(f),f&&(M||_===n))return f.replace(bn,"");if(!f||!(_=Ir(_)))return f;var N=or(f);return ko(N,Hf(N,or(_))).join("")}function Yd(f,_){var M=te,N=oe;if(ti(_)){var V="separator"in _?_.separator:V;M="length"in _?nn(_.length):M,N="omission"in _?Ir(_.omission):N}f=Cn(f);var Q=f.length;if(lc(f)){var ce=or(f);Q=ce.length}if(M>=Q)return f;var me=M-uc(N);if(me<1)return N;var Ce=ce?ko(ce,0,me).join(""):f.slice(0,me);if(V===n)return Ce+N;if(ce&&(me+=Ce.length-me),$g(V)){if(f.slice(me).search(V)){var ct,st=Ce;for(V.global||(V=Im(V.source,Cn(Ae.exec(V))+"g")),V.lastIndex=0;ct=V.exec(st);)var vt=ct.index;Ce=Ce.slice(0,vt===n?me:vt)}}else if(f.indexOf(Ir(V),me)!=me){var Et=Ce.lastIndexOf(V);Et>-1&&(Ce=Ce.slice(0,Et))}return Ce+N}function qd(f){return f=Cn(f),f&&At.test(f)?f.replace(Ke,ku):f}var zv=Ml(function(f,_,M){return f+(M?" ":"")+_.toUpperCase()}),Ba=hh("toUpperCase");function Uv(f,_,M){return f=Cn(f),_=M?n:_,_===n?NS(f)?al(f):RS(f):f.match(_)||[]}var $d=sn(function(f,_){try{return Rr(f,n,_)}catch(M){return zd(M)?M:new qt(M)}}),c1=fo(function(f,_){return jr(_,function(M){M=Dr(M),$i(f,M,Fg(f[M],f))}),f});function Bv(f){var _=f==null?0:f.length,M=kt();return f=_?Qn(f,function(N){if(typeof N[1]!="function")throw new qr(a);return[M(N[0]),N[1]]}):[],sn(function(N){for(var V=-1;++V<_;){var Q=f[V];if(Rr(Q[0],this,N))return Rr(Q[1],this,N)}})}function Mb(f){return vl(zi(f,v))}function iu(f){return function(){return f}}function o(f,_){return f==null||f!==f?_:f}var l=ud(),h=ud(!0);function m(f){return f}function x(f){return Zm(typeof f=="function"?f:zi(f,v))}function A(f){return lr(zi(f,v))}function D(f,_){return ui(f,zi(_,v))}var W=sn(function(f,_){return function(M){return Jn(M,f,_)}}),he=sn(function(f,_){return function(M){return Jn(f,M,_)}});function Oe(f,_,M){var N=pi(_),V=zs(_,N);M==null&&!(ti(_)&&(V.length||!N.length))&&(M=_,_=f,f=this,V=zs(_,pi(_)));var Q=!(ti(M)&&"chain"in M)||!!M.chain,ce=Fs(f);return jr(V,function(me){var Ce=_[me];f[me]=Ce,ce&&(f.prototype[me]=function(){var ct=this.__chain__;if(Q||ct){var st=f(this.__wrapped__);return(st.__actions__=_r(this.__actions__)).push({func:Ce,args:arguments,thisArg:f}),st.__chain__=ct,st}return Ce.apply(f,va([this.value()],arguments))})}),f}function Je(){return vi._===this&&(vi._=n_),this}function ot(){}function ze(f){return f=nn(f),sn(function(_){return ih(_,f)})}var Ye=fd(Qn),Ct=fd(W0),Gt=fd(Am);function In(f){return _h(f)?Rm(Dr(f)):Jm(f)}function Te(f){return function(_){return f==null?n:Uo(f,_)}}var ge=x_(),Ie=x_(!0);function it(){return[]}function Ut(){return!1}function An(){return{}}function Lt(){return""}function rn(){return!0}function gn(f,_){if(f=nn(f),f<1||f>xe)return[];var M=F,N=Wi(f,F);_=kt(_),f-=F;for(var V=ol(N,_);++M<f;)_(M);return V}function En(f){return $t(f)?Qn(f,Dr):Ai(f)?[f]:_r(Md(Cn(f)))}function Va(f){var _=++jf;return Cn(f)+_}var wb=Ic(function(f,_){return f+_},0),cI=Oc("ceil"),uI=Ic(function(f,_){return f/_},1),hI=Oc("floor");function fI(f){return f&&f.length?Zu(f,m,gr):n}function dI(f,_){return f&&f.length?Zu(f,kt(_,2),gr):n}function pI(f){return sl(f,m)}function mI(f,_){return sl(f,kt(_,2))}function gI(f){return f&&f.length?Zu(f,m,th):n}function _I(f,_){return f&&f.length?Zu(f,kt(_,2),th):n}var vI=Ic(function(f,_){return f*_},1),yI=Oc("round"),xI=Ic(function(f,_){return f-_},0);function SI(f){return f&&f.length?kf(f,m):0}function bI(f,_){return f&&f.length?kf(f,kt(_,2)):0}return H.after=nv,H.ary=Rn,H.assign=Eh,H.assignIn=ts,H.assignInWith=Qg,H.assignWith=Qc,H.at=ea,H.before=Od,H.bind=Fg,H.bindAll=c1,H.bindKey=kg,H.castArray=hv,H.chain=Rl,H.chunk=Tg,H.compact=R_,H.concat=Vi,H.cond=Bv,H.conforms=Mb,H.constant=iu,H.countBy=X_,H.create=nb,H.curry=iv,H.curryRight=rv,H.debounce=sv,H.defaults=ib,H.defaultsDeep=Jc,H.defer=Dd,H.delay=$c,H.difference=HS,H.differenceBy=L_,H.differenceWith=P_,H.drop=ei,H.dropRight=zr,H.dropRightWhile=Yo,H.dropWhile=N_,H.fill=I_,H.filter=Na,H.flatMap=Yc,H.flatMapDeep=j_,H.flatMapDepth=Y_,H.flatten=yh,H.flattenDeep=Ur,H.flattenDepth=Us,H.flip=Gg,H.flow=l,H.flowRight=h,H.fromPairs=D_,H.functions=cb,H.functionsIn=ub,H.groupBy=Ld,H.initial=qo,H.intersection=El,H.intersectionBy=$o,H.intersectionWith=Rg,H.invert=Ev,H.invertBy=hb,H.invokeMap=YS,H.iteratee=x,H.keyBy=qS,H.keys=pi,H.keysIn=Sr,H.map=Pd,H.mapKeys=Hd,H.mapValues=Jg,H.matches=A,H.matchesProperty=D,H.memoize=Ll,H.merge=e1,H.mergeWith=Th,H.method=W,H.methodOf=he,H.mixin=Oe,H.negate=Zc,H.nthArg=ze,H.omit=Tv,H.omitBy=Cv,H.once=Ia,H.orderBy=q_,H.over=Ye,H.overArgs=Qo,H.overEvery=Ct,H.overSome=Gt,H.partial=Pl,H.partialRight=ov,H.partition=$_,H.pick=fb,H.pickBy=t1,H.property=In,H.propertyOf=Te,H.pull=xh,H.pullAll=Gc,H.pullAllBy=Hc,H.pullAllWith=B_,H.pullAt=V_,H.range=ge,H.rangeRight=Ie,H.rearg=av,H.reject=Z_,H.remove=Sh,H.rest=lv,H.reverse=wd,H.sampleSize=Q_,H.set=n1,H.setWith=pb,H.shuffle=J_,H.slice=Ad,H.sortBy=Id,H.sortedUniq=mn,H.sortedUniqBy=Nn,H.split=Ua,H.spread=cv,H.tail=Qr,H.take=Ca,H.takeRight=Wc,H.takeRightWhile=Pg,H.takeWhile=Zo,H.tap=Ko,H.throttle=uv,H.thru=jc,H.toArray=kd,H.toPairs=Ch,H.toPairsIn=Rh,H.toPath=En,H.toPlainObject=Kg,H.transform=Wd,H.unary=$S,H.union=fi,H.unionBy=Ra,H.unionWith=Tl,H.uniq=Ng,H.uniqBy=Jr,H.uniqWith=Xc,H.unset=mb,H.unzip=Cl,H.unzipWith=yr,H.update=Lh,H.updateWith=gb,H.values=nu,H.valuesIn=_b,H.without=Ig,H.words=Uv,H.wrap=Hg,H.xor=Ed,H.xorBy=k_,H.xorWith=Td,H.zip=Cd,H.zipObject=La,H.zipObjectDeep=Pi,H.zipWith=Pa,H.entries=Ch,H.entriesIn=Rh,H.extend=ts,H.extendWith=Qg,Oe(H,H),H.add=wb,H.attempt=$d,H.camelCase=Pv,H.capitalize=r1,H.ceil=cI,H.clamp=Rv,H.clone=fv,H.cloneDeep=Wg,H.cloneDeepWith=Xg,H.cloneWith=ZS,H.conformsTo=wh,H.deburr=Ph,H.defaultTo=o,H.divide=uI,H.endsWith=vb,H.eq=Bs,H.escape=yb,H.escapeRegExp=s1,H.every=jS,H.find=Rd,H.findIndex=Cg,H.findKey=Av,H.findLast=zg,H.findLastIndex=O_,H.findLastKey=rb,H.floor=hI,H.forEach=Ug,H.forEachRight=Bg,H.forIn=sb,H.forInRight=ob,H.forOwn=ab,H.forOwnRight=lb,H.get=Gd,H.gt=dv,H.gte=dn,H.has=eu,H.hasIn=Il,H.head=vr,H.identity=m,H.includes=Vg,H.indexOf=z_,H.inRange=Lv,H.invoke=tu,H.isArguments=Jo,H.isArray=$t,H.isArrayBuffer=pv,H.isArrayLike=xr,H.isArrayLikeObject=si,H.isBoolean=Ah,H.isBuffer=Vs,H.isDate=KS,H.isElement=mv,H.isEmpty=QS,H.isEqual=JS,H.isEqualWith=gv,H.isError=zd,H.isFinite=zn,H.isFunction=Fs,H.isInteger=Fi,H.isLength=Ud,H.isMap=Bd,H.isMatch=jg,H.isMatchWith=Vd,H.isNaN=_v,H.isNative=vv,H.isNil=qg,H.isNull=Yg,H.isNumber=yv,H.isObject=ti,H.isObjectLike=di,H.isPlainObject=Kc,H.isRegExp=$g,H.isSafeInteger=xv,H.isSet=Sv,H.isString=Fd,H.isSymbol=Ai,H.isTypedArray=Nl,H.isUndefined=bv,H.isWeakMap=Zg,H.isWeakSet=eb,H.join=Lg,H.kebabCase=o1,H.last=hi,H.lastIndexOf=U_,H.lowerCase=Xd,H.lowerFirst=a1,H.lt=tb,H.lte=Mv,H.max=fI,H.maxBy=dI,H.mean=pI,H.meanBy=mI,H.min=gI,H.minBy=_I,H.stubArray=it,H.stubFalse=Ut,H.stubObject=An,H.stubString=Lt,H.stubTrue=rn,H.multiply=vI,H.nth=kc,H.noConflict=Je,H.noop=ot,H.now=Mh,H.pad=Nv,H.padEnd=l1,H.padStart=Oa,H.parseInt=Da,H.random=i1,H.reduce=qc,H.reduceRight=Nd,H.repeat=za,H.replace=Nh,H.result=db,H.round=yI,H.runInContext=we,H.sample=K_,H.size=ev,H.snakeCase=Ih,H.some=tv,H.sortedIndex=F_,H.sortedIndexBy=WS,H.sortedIndexOf=XS,H.sortedLastIndex=Tn,H.sortedLastIndexBy=Fn,H.sortedLastIndexOf=fn,H.startCase=xb,H.startsWith=Iv,H.subtract=xI,H.sum=SI,H.sumBy=bI,H.template=Oh,H.times=gn,H.toFinite=ks,H.toInteger=nn,H.toLength=es,H.toLower=Sb,H.toNumber=Vr,H.toSafeInteger=wv,H.toString=Cn,H.toUpper=Ov,H.trim=jd,H.trimEnd=Dv,H.trimStart=bb,H.truncate=Yd,H.unescape=qd,H.uniqueId=Va,H.upperCase=zv,H.upperFirst=Ba,H.each=Ug,H.eachRight=Bg,H.first=vr,Oe(H,(function(){var f={};return li(H,function(_,M){wn.call(H.prototype,M)||(f[M]=_)}),f})(),{chain:!1}),H.VERSION=i,jr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(f){H[f].placeholder=H}),jr(["drop","take"],function(f,_){an.prototype[f]=function(M){M=M===n?1:Bn(nn(M),0);var N=this.__filtered__&&!_?new an(this):this.clone();return N.__filtered__?N.__takeCount__=Wi(M,N.__takeCount__):N.__views__.push({size:Wi(M,F),type:f+(N.__dir__<0?"Right":"")}),N},an.prototype[f+"Right"]=function(M){return this.reverse()[f](M).reverse()}}),jr(["filter","map","takeWhile"],function(f,_){var M=_+1,N=M==X||M==j;an.prototype[f]=function(V){var Q=this.clone();return Q.__iteratees__.push({iteratee:kt(V,3),type:M}),Q.__filtered__=Q.__filtered__||N,Q}}),jr(["head","last"],function(f,_){var M="take"+(_?"Right":"");an.prototype[f]=function(){return this[M](1).value()[0]}}),jr(["initial","tail"],function(f,_){var M="drop"+(_?"":"Right");an.prototype[f]=function(){return this.__filtered__?new an(this):this[M](1)}}),an.prototype.compact=function(){return this.filter(m)},an.prototype.find=function(f){return this.filter(f).head()},an.prototype.findLast=function(f){return this.reverse().find(f)},an.prototype.invokeMap=sn(function(f,_){return typeof f=="function"?new an(this):this.map(function(M){return Jn(M,f,_)})}),an.prototype.reject=function(f){return this.filter(Zc(kt(f)))},an.prototype.slice=function(f,_){f=nn(f);var M=this;return M.__filtered__&&(f>0||_<0)?new an(M):(f<0?M=M.takeRight(-f):f&&(M=M.drop(f)),_!==n&&(_=nn(_),M=_<0?M.dropRight(-_):M.take(_-f)),M)},an.prototype.takeRightWhile=function(f){return this.reverse().takeWhile(f).reverse()},an.prototype.toArray=function(){return this.take(F)},li(an.prototype,function(f,_){var M=/^(?:filter|find|map|reject)|While$/.test(_),N=/^(?:head|last)$/.test(_),V=H[N?"take"+(_=="last"?"Right":""):_],Q=N||/^find/.test(_);V&&(H.prototype[_]=function(){var ce=this.__wrapped__,me=N?[1]:arguments,Ce=ce instanceof an,ct=me[0],st=Ce||$t(ce),vt=function(Yn){var Sn=V.apply(H,va([Yn],me));return N&&Et?Sn[0]:Sn};st&&M&&typeof ct=="function"&&ct.length!=1&&(Ce=st=!1);var Et=this.__chain__,Pt=!!this.__actions__.length,Ht=Q&&!Et,Jt=Ce&&!Pt;if(!Q&&st){ce=Jt?ce:new an(this);var Wt=f.apply(ce,me);return Wt.__actions__.push({func:jc,args:[vt],thisArg:n}),new Yi(Wt,Et)}return Ht&&Jt?f.apply(this,me):(Wt=this.thru(vt),Ht?N?Wt.value()[0]:Wt.value():Wt)})}),jr(["pop","push","shift","sort","splice","unshift"],function(f){var _=hc[f],M=/^(?:push|sort|unshift)$/.test(f)?"tap":"thru",N=/^(?:pop|shift)$/.test(f);H.prototype[f]=function(){var V=arguments;if(N&&!this.__chain__){var Q=this.value();return _.apply($t(Q)?Q:[],V)}return this[M](function(ce){return _.apply($t(ce)?ce:[],V)})}}),li(an.prototype,function(f,_){var M=H[_];if(M){var N=M.name+"";wn.call(hl,N)||(hl[N]=[]),hl[N].push({name:_,func:M})}}),hl[dh(n,T).name]=[{name:"wrapper",func:n}],an.prototype.clone=dl,an.prototype.reverse=qi,an.prototype.value=Zf,H.prototype.at=Og,H.prototype.chain=G_,H.prototype.commit=bh,H.prototype.next=Dg,H.prototype.plant=H_,H.prototype.reverse=Br,H.prototype.toJSON=H.prototype.valueOf=H.prototype.value=W_,H.prototype.first=H.prototype.head,dc&&(H.prototype[dc]=vs),H})();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(vi._=Yr,define(function(){return Yr})):il?((il.exports=Yr)._=Yr,nl._=Yr):vi._=Yr}).call(e)})),jO=yx(XO()),YO=CI({ACESFilmicToneMapping:()=>4,AddEquation:()=>100,AddOperation:()=>2,AdditiveAnimationBlendMode:()=>JM,AdditiveBlending:()=>2,AlphaFormat:()=>oD,AlwaysCompare:()=>519,AlwaysDepth:()=>1,AlwaysStencilFunc:()=>519,AmbientLight:()=>JL,AmbientLightProbe:()=>KB,AnimationAction:()=>cP,AnimationClip:()=>l0,AnimationLoader:()=>BB,AnimationMixer:()=>m8,AnimationObjectGroup:()=>d8,AnimationUtils:()=>OB,ArcCurve:()=>aL,ArrayCamera:()=>GR,ArrowHelper:()=>B8,Audio:()=>aP,AudioAnalyser:()=>i8,AudioContext:()=>kw,AudioListener:()=>e8,AudioLoader:()=>$B,AxesHelper:()=>V8,BackSide:()=>1,BasicDepthPacking:()=>vR,BasicShadowMap:()=>0,Bone:()=>dw,BooleanKeyframeTrack:()=>Sf,Box2:()=>w8,Box3:()=>Ka,Box3Helper:()=>z8,BoxBufferGeometry:()=>k8,BoxGeometry:()=>am,BoxHelper:()=>D8,BufferAttribute:()=>Kn,BufferGeometry:()=>vn,BufferGeometryLoader:()=>sP,ByteType:()=>eD,Cache:()=>pf,Camera:()=>Dx,CameraHelper:()=>O8,CanvasTexture:()=>rB,CapsuleBufferGeometry:()=>G8,CapsuleGeometry:()=>bw,CatmullRomCurve3:()=>lL,CineonToneMapping:()=>3,CircleBufferGeometry:()=>H8,CircleGeometry:()=>Mw,ClampToEdgeWrapping:()=>yo,Clock:()=>oP,Color:()=>Tt,ColorKeyframeTrack:()=>Bw,ColorManagement:()=>go,CompressedArrayTexture:()=>iB,CompressedTexture:()=>mw,CompressedTextureLoader:()=>VB,ConeBufferGeometry:()=>W8,ConeGeometry:()=>ww,CubeCamera:()=>IR,CubeReflectionMapping:()=>301,CubeRefractionMapping:()=>302,CubeTexture:()=>x0,CubeTextureLoader:()=>FB,CubeUVReflectionMapping:()=>306,CubicBezierCurve:()=>_w,CubicBezierCurve3:()=>cL,CubicInterpolant:()=>XL,CullFaceBack:()=>1,CullFaceFront:()=>2,CullFaceFrontBack:()=>3,CullFaceNone:()=>0,Curve:()=>da,CurvePath:()=>hL,CustomBlending:()=>5,CustomToneMapping:()=>5,CylinderBufferGeometry:()=>X8,CylinderGeometry:()=>S0,Cylindrical:()=>M8,Data3DTexture:()=>sw,DataArrayTexture:()=>Ix,DataTexture:()=>Hp,DataTextureLoader:()=>kB,DataUtils:()=>Gz,DecrementStencilOp:()=>YD,DecrementWrapStencilOp:()=>$D,DefaultLoadingManager:()=>qL,DepthFormat:()=>QM,DepthStencilFormat:()=>mR,DepthTexture:()=>HR,DirectionalLight:()=>QL,DirectionalLightHelper:()=>I8,DiscreteInterpolant:()=>jL,DisplayP3ColorSpace:()=>nw,DodecahedronBufferGeometry:()=>j8,DodecahedronGeometry:()=>Aw,DoubleSide:()=>2,DstAlphaFactor:()=>206,DstColorFactor:()=>208,DynamicCopyUsage:()=>iz,DynamicDrawUsage:()=>KD,DynamicReadUsage:()=>ez,EdgesGeometry:()=>yL,EllipseCurve:()=>kx,EqualCompare:()=>514,EqualDepth:()=>4,EqualStencilFunc:()=>514,EquirectangularReflectionMapping:()=>303,EquirectangularRefractionMapping:()=>304,Euler:()=>ow,EventDispatcher:()=>ic,ExtrudeBufferGeometry:()=>Y8,ExtrudeGeometry:()=>Ew,FileLoader:()=>Ql,Float16BufferAttribute:()=>qz,Float32BufferAttribute:()=>Ot,Float64BufferAttribute:()=>$z,FloatType:()=>Rx,Fog:()=>qR,FogExp2:()=>jR,FramebufferTexture:()=>nB,FrontSide:()=>0,Frustum:()=>zx,GLBufferAttribute:()=>x8,GLSL1:()=>"100",GLSL3:()=>sz,GreaterCompare:()=>516,GreaterDepth:()=>6,GreaterEqualCompare:()=>518,GreaterEqualDepth:()=>5,GreaterEqualStencilFunc:()=>518,GreaterStencilFunc:()=>516,GridHelper:()=>P8,Group:()=>Bp,HalfFloatType:()=>KM,HemisphereLight:()=>$L,HemisphereLightHelper:()=>L8,HemisphereLightProbe:()=>ZB,IcosahedronBufferGeometry:()=>q8,IcosahedronGeometry:()=>Tw,ImageBitmapLoader:()=>qB,ImageLoader:()=>c0,ImageUtils:()=>rw,IncrementStencilOp:()=>jD,IncrementWrapStencilOp:()=>qD,InstancedBufferAttribute:()=>Jp,InstancedBufferGeometry:()=>rP,InstancedInterleavedBuffer:()=>y8,InstancedMesh:()=>rL,Int16BufferAttribute:()=>jz,Int32BufferAttribute:()=>Yz,Int8BufferAttribute:()=>Hz,IntType:()=>iD,InterleavedBuffer:()=>Fx,InterleavedBufferAttribute:()=>t0,Interpolant:()=>b0,InterpolateDiscrete:()=>K1,InterpolateLinear:()=>Q1,InterpolateSmooth:()=>ex,InvertStencilOp:()=>ZD,KeepStencilOp:()=>tx,KeyframeTrack:()=>pa,LOD:()=>eL,LatheBufferGeometry:()=>$8,LatheGeometry:()=>Hx,Layers:()=>Ox,LessCompare:()=>513,LessDepth:()=>2,LessEqualCompare:()=>515,LessEqualDepth:()=>3,LessEqualStencilFunc:()=>515,LessStencilFunc:()=>513,Light:()=>Cu,LightProbe:()=>Yx,Line:()=>Mu,Line3:()=>A8,LineBasicMaterial:()=>us,LineCurve:()=>Gx,LineCurve3:()=>uL,LineDashedMaterial:()=>HL,LineLoop:()=>sL,LineSegments:()=>Qa,LinearEncoding:()=>ew,LinearFilter:()=>Er,LinearInterpolant:()=>Uw,LinearMipMapLinearFilter:()=>JO,LinearMipMapNearestFilter:()=>QO,LinearMipmapLinearFilter:()=>sm,LinearMipmapNearestFilter:()=>ZM,LinearSRGBColorSpace:()=>qa,LinearToneMapping:()=>1,Loader:()=>Js,LoaderUtils:()=>rM,LoadingManager:()=>Vw,LoopOnce:()=>WD,LoopPingPong:()=>_R,LoopRepeat:()=>gR,LuminanceAlphaFormat:()=>lD,LuminanceFormat:()=>aD,MOUSE:()=>qO,Material:()=>Hr,MaterialLoader:()=>nP,MathUtils:()=>xz,Matrix3:()=>_n,Matrix4:()=>un,MaxEquation:()=>104,Mesh:()=>Ar,MeshBasicMaterial:()=>Tu,MeshDepthMaterial:()=>uw,MeshDistanceMaterial:()=>hw,MeshLambertMaterial:()=>kL,MeshMatcapMaterial:()=>GL,MeshNormalMaterial:()=>FL,MeshPhongMaterial:()=>BL,MeshPhysicalMaterial:()=>UL,MeshStandardMaterial:()=>Ow,MeshToonMaterial:()=>VL,MinEquation:()=>103,MirroredRepeatWrapping:()=>$1,MixOperation:()=>1,MultiplyBlending:()=>4,MultiplyOperation:()=>0,NearestFilter:()=>as,NearestMipMapLinearFilter:()=>KO,NearestMipMapNearestFilter:()=>ZO,NearestMipmapLinearFilter:()=>$M,NearestMipmapNearestFilter:()=>qM,NeverCompare:()=>512,NeverDepth:()=>0,NeverStencilFunc:()=>512,NoBlending:()=>0,NoColorSpace:()=>"",NoToneMapping:()=>0,NormalAnimationBlendMode:()=>Px,NormalBlending:()=>1,NotEqualCompare:()=>517,NotEqualDepth:()=>7,NotEqualStencilFunc:()=>517,NumberKeyframeTrack:()=>o0,Object3D:()=>Wn,ObjectLoader:()=>jB,ObjectSpaceNormalMap:()=>1,OctahedronBufferGeometry:()=>Z8,OctahedronGeometry:()=>Xx,OneFactor:()=>201,OneMinusDstAlphaFactor:()=>207,OneMinusDstColorFactor:()=>209,OneMinusSrcAlphaFactor:()=>205,OneMinusSrcColorFactor:()=>203,OrthographicCamera:()=>Bx,PCFShadowMap:()=>1,PCFSoftShadowMap:()=>2,PMREMGenerator:()=>Q2,Path:()=>n0,PerspectiveCamera:()=>wr,Plane:()=>_u,PlaneBufferGeometry:()=>K8,PlaneGeometry:()=>Ux,PlaneHelper:()=>U8,PointLight:()=>KL,PointLightHelper:()=>C8,Points:()=>oL,PointsMaterial:()=>pw,PolarGridHelper:()=>N8,PolyhedronBufferGeometry:()=>Q8,PolyhedronGeometry:()=>xf,PositionalAudio:()=>n8,PropertyBinding:()=>qn,PropertyMixer:()=>lP,QuadraticBezierCurve:()=>vw,QuadraticBezierCurve3:()=>yw,Quaternion:()=>Es,QuaternionKeyframeTrack:()=>cm,QuaternionLinearInterpolant:()=>YL,RED_GREEN_RGTC2_Format:()=>GD,RED_RGTC1_Format:()=>FD,REVISION:()=>"153",RGBADepthPacking:()=>yR,RGBAFormat:()=>$p,RGBAIntegerFormat:()=>dD,RGBA_ASTC_10x10_Format:()=>zD,RGBA_ASTC_10x5_Format:()=>ID,RGBA_ASTC_10x6_Format:()=>OD,RGBA_ASTC_10x8_Format:()=>DD,RGBA_ASTC_12x10_Format:()=>UD,RGBA_ASTC_12x12_Format:()=>BD,RGBA_ASTC_4x4_Format:()=>AD,RGBA_ASTC_5x4_Format:()=>ED,RGBA_ASTC_5x5_Format:()=>TD,RGBA_ASTC_6x5_Format:()=>CD,RGBA_ASTC_6x6_Format:()=>RD,RGBA_ASTC_8x5_Format:()=>LD,RGBA_ASTC_8x6_Format:()=>PD,RGBA_ASTC_8x8_Format:()=>ND,RGBA_BPTC_Format:()=>VD,RGBA_ETC2_EAC_Format:()=>wD,RGBA_PVRTC_2BPPV1_Format:()=>SD,RGBA_PVRTC_4BPPV1_Format:()=>xD,RGBA_S3TC_DXT1_Format:()=>mD,RGBA_S3TC_DXT3_Format:()=>gD,RGBA_S3TC_DXT5_Format:()=>_D,RGB_ETC1_Format:()=>bD,RGB_ETC2_Format:()=>MD,RGB_PVRTC_2BPPV1_Format:()=>yD,RGB_PVRTC_4BPPV1_Format:()=>vD,RGB_S3TC_DXT1_Format:()=>pD,RGFormat:()=>hD,RGIntegerFormat:()=>fD,RawShaderMaterial:()=>zL,Ray:()=>om,Raycaster:()=>S8,RectAreaLight:()=>eP,RedFormat:()=>cD,RedIntegerFormat:()=>uD,ReinhardToneMapping:()=>2,RepeatWrapping:()=>q1,ReplaceStencilOp:()=>XD,ReverseSubtractEquation:()=>102,RingBufferGeometry:()=>J8,RingGeometry:()=>Cw,SIGNED_RED_GREEN_RGTC2_Format:()=>HD,SIGNED_RED_RGTC1_Format:()=>kD,SRGBColorSpace:()=>Mr,Scene:()=>ZR,ShaderChunk:()=>ln,ShaderLib:()=>oa,ShaderMaterial:()=>$a,ShadowMaterial:()=>DL,Shape:()=>lf,ShapeBufferGeometry:()=>eV,ShapeGeometry:()=>Rw,ShapePath:()=>F8,ShapeUtils:()=>Su,ShortType:()=>tD,Skeleton:()=>nL,SkeletonHelper:()=>T8,SkinnedMesh:()=>tL,Source:()=>nf,Sphere:()=>fa,SphereBufferGeometry:()=>tV,SphereGeometry:()=>jx,Spherical:()=>b8,SphericalHarmonics3:()=>tP,SplineCurve:()=>xw,SpotLight:()=>ZL,SpotLightHelper:()=>E8,Sprite:()=>JR,SpriteMaterial:()=>fw,SrcAlphaFactor:()=>204,SrcAlphaSaturateFactor:()=>210,SrcColorFactor:()=>202,StaticCopyUsage:()=>nz,StaticDrawUsage:()=>Nx,StaticReadUsage:()=>JD,StereoCamera:()=>QB,StreamCopyUsage:()=>rz,StreamDrawUsage:()=>QD,StreamReadUsage:()=>tz,StringKeyframeTrack:()=>bf,SubtractEquation:()=>101,SubtractiveBlending:()=>3,TOUCH:()=>$O,TangentSpaceNormalMap:()=>0,TetrahedronBufferGeometry:()=>nV,TetrahedronGeometry:()=>Lw,Texture:()=>Cr,TextureLoader:()=>GB,TorusBufferGeometry:()=>iV,TorusGeometry:()=>Pw,TorusKnotBufferGeometry:()=>rV,TorusKnotGeometry:()=>Nw,Triangle:()=>rf,TriangleFanDrawMode:()=>2,TriangleStripDrawMode:()=>1,TrianglesDrawMode:()=>0,TubeBufferGeometry:()=>sV,TubeGeometry:()=>Iw,TwoPassDoubleSide:()=>2,UVMapping:()=>300,Uint16BufferAttribute:()=>aw,Uint32BufferAttribute:()=>lw,Uint8BufferAttribute:()=>Wz,Uint8ClampedBufferAttribute:()=>Xz,Uniform:()=>g8,UniformsGroup:()=>v8,UniformsLib:()=>bt,UniformsUtils:()=>NR,UnsignedByteType:()=>Z1,UnsignedInt248Type:()=>Lx,UnsignedIntType:()=>Cx,UnsignedShort4444Type:()=>rD,UnsignedShort5551Type:()=>sD,UnsignedShortType:()=>nD,VSMShadowMap:()=>3,Vector2:()=>pt,Vector3:()=>ae,Vector4:()=>$n,VectorKeyframeTrack:()=>a0,VideoTexture:()=>tB,WebGL1Renderer:()=>XR,WebGL3DRenderTarget:()=>Pz,WebGLArrayRenderTarget:()=>Lz,WebGLCoordinateSystem:()=>Zp,WebGLCubeRenderTarget:()=>OR,WebGLMultipleRenderTargets:()=>Nz,WebGLRenderTarget:()=>la,WebGLRenderer:()=>WR,WebGLUtils:()=>kR,WebGPUCoordinateSystem:()=>oz,WireframeGeometry:()=>OL,WrapAroundEnding:()=>J1,ZeroCurvatureEnding:()=>ef,ZeroFactor:()=>200,ZeroSlopeEnding:()=>tf,ZeroStencilOp:()=>0,_SRGBAFormat:()=>xR,sRGBEncoding:()=>tw});var qO={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},$O={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3};var q1=1e3,yo=1001,$1=1002,as=1003,qM=1004,ZO=1004,$M=1005,KO=1005,Er=1006,ZM=1007,QO=1007,sm=1008,JO=1008,Z1=1009,eD=1010,tD=1011,nD=1012,iD=1013,Cx=1014,Rx=1015,KM=1016,rD=1017,sD=1018,Lx=1020,oD=1021,$p=1023,aD=1024,lD=1025,QM=1026,mR=1027,cD=1028,uD=1029,hD=1030,fD=1031,dD=1033,pD=33776,mD=33777,gD=33778,_D=33779,vD=35840,yD=35841,xD=35842,SD=35843,bD=36196,MD=37492,wD=37496,AD=37808,ED=37809,TD=37810,CD=37811,RD=37812,LD=37813,PD=37814,ND=37815,ID=37816,OD=37817,DD=37818,zD=37819,UD=37820,BD=37821,VD=36492,FD=36283,kD=36284,GD=36285,HD=36286,WD=2200,gR=2201,_R=2202,K1=2300,Q1=2301,ex=2302,ef=2400,tf=2401,J1=2402,Px=2500,JM=2501;var ew=3e3,tw=3001,vR=3200,yR=3201;var Mr="srgb",qa="srgb-linear",nw="display-p3";var tx=7680,XD=7681,jD=7682,YD=7683,qD=34055,$D=34056,ZD=5386;var Nx=35044,KD=35048,QD=35040,JD=35045,ez=35049,tz=35041,nz=35046,iz=35050,rz=35042;var sz="300 es",xR=1035,Zp=2e3,oz=2001,ic=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const n=this._listeners[e];if(n!==void 0){const i=n.indexOf(t);i!==-1&&n.splice(i,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const t=this._listeners[e.type];if(t!==void 0){e.target=this;const n=t.slice(0);for(let i=0,r=n.length;i<r;i++)n[i].call(this,e);e.target=null}}},Fr=["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"],gE=1234567,af=Math.PI/180,Kp=180/Math.PI;function qs(){const e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Fr[e&255]+Fr[e>>8&255]+Fr[e>>16&255]+Fr[e>>24&255]+"-"+Fr[t&255]+Fr[t>>8&255]+"-"+Fr[t>>16&15|64]+Fr[t>>24&255]+"-"+Fr[n&63|128]+Fr[n>>8&255]+"-"+Fr[n>>16&255]+Fr[n>>24&255]+Fr[i&255]+Fr[i>>8&255]+Fr[i>>16&255]+Fr[i>>24&255]).toLowerCase()}function Ti(e,t,n){return Math.max(t,Math.min(n,e))}function iw(e,t){return(e%t+t)%t}function az(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)}function lz(e,t,n){return e!==t?(n-e)/(t-e):0}function k1(e,t,n){return(1-n)*e+n*t}function cz(e,t,n,i){return k1(e,t,1-Math.exp(-n*i))}function uz(e,t=1){return t-Math.abs(iw(e,t*2)-t)}function hz(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function fz(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function dz(e,t){return e+Math.floor(Math.random()*(t-e+1))}function pz(e,t){return e+Math.random()*(t-e)}function mz(e){return e*(.5-Math.random())}function gz(e){e!==void 0&&(gE=e);let t=gE+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function _z(e){return e*af}function vz(e){return e*Kp}function Z2(e){return(e&e-1)===0&&e!==0}function SR(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function hx(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function yz(e,t,n,i,r){const s=Math.cos,a=Math.sin,c=s(n/2),u=a(n/2),d=s((t+i)/2),p=a((t+i)/2),g=s((t-i)/2),v=a((t-i)/2),y=s((i-t)/2),S=a((i-t)/2);switch(r){case"XYX":e.set(c*p,u*g,u*v,c*d);break;case"YZY":e.set(u*v,c*p,u*g,c*d);break;case"ZXZ":e.set(u*g,u*v,c*p,c*d);break;case"XZX":e.set(c*p,u*S,u*y,c*d);break;case"YXY":e.set(u*y,c*p,u*S,c*d);break;case"ZYZ":e.set(u*S,u*y,c*p,c*d);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Ys(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function cn(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw new Error("Invalid component type.")}}var xz={DEG2RAD:af,RAD2DEG:Kp,generateUUID:qs,clamp:Ti,euclideanModulo:iw,mapLinear:az,inverseLerp:lz,lerp:k1,damp:cz,pingpong:uz,smoothstep:hz,smootherstep:fz,randInt:dz,randFloat:pz,randFloatSpread:mz,seededRandom:gz,degToRad:_z,radToDeg:vz,isPowerOfTwo:Z2,ceilPowerOfTwo:SR,floorPowerOfTwo:hx,setQuaternionFromProperEuler:yz,normalize:cn,denormalize:Ys},pt=class bR{constructor(t=0,n=0){bR.prototype.isVector2=!0,this.x=t,this.y=n}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,n){return this.x=t,this.y=n,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,n){switch(t){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,n){return this.x=t.x+n.x,this.y=t.y+n.y,this}addScaledVector(t,n){return this.x+=t.x*n,this.y+=t.y*n,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,n){return this.x=t.x-n.x,this.y=t.y-n.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const n=this.x,i=this.y,r=t.elements;return this.x=r[0]*n+r[3]*i+r[6],this.y=r[1]*n+r[4]*i+r[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,n){return this.x=Math.max(t.x,Math.min(n.x,this.x)),this.y=Math.max(t.y,Math.min(n.y,this.y)),this}clampScalar(t,n){return this.x=Math.max(t,Math.min(n,this.x)),this.y=Math.max(t,Math.min(n,this.y)),this}clampLength(t,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(n,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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const n=Math.sqrt(this.lengthSq()*t.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(t)/n;return Math.acos(Ti(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const n=this.x-t.x,i=this.y-t.y;return n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,n){return this.x+=(t.x-this.x)*n,this.y+=(t.y-this.y)*n,this}lerpVectors(t,n,i){return this.x=t.x+(n.x-t.x)*i,this.y=t.y+(n.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,n=0){return this.x=t[n],this.y=t[n+1],this}toArray(t=[],n=0){return t[n]=this.x,t[n+1]=this.y,t}fromBufferAttribute(t,n){return this.x=t.getX(n),this.y=t.getY(n),this}rotateAround(t,n){const i=Math.cos(n),r=Math.sin(n),s=this.x-t.x,a=this.y-t.y;return this.x=s*i-a*r+t.x,this.y=s*r+a*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},_n=class MR{constructor(t,n,i,r,s,a,c,u,d){MR.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,n,i,r,s,a,c,u,d)}set(t,n,i,r,s,a,c,u,d){const p=this.elements;return p[0]=t,p[1]=r,p[2]=c,p[3]=n,p[4]=s,p[5]=u,p[6]=i,p[7]=a,p[8]=d,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const n=this.elements,i=t.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],this}extractBasis(t,n,i){return t.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const n=t.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,n){const i=t.elements,r=n.elements,s=this.elements,a=i[0],c=i[3],u=i[6],d=i[1],p=i[4],g=i[7],v=i[2],y=i[5],S=i[8],E=r[0],w=r[3],b=r[6],T=r[1],L=r[4],C=r[7],P=r[2],O=r[5],B=r[8];return s[0]=a*E+c*T+u*P,s[3]=a*w+c*L+u*O,s[6]=a*b+c*C+u*B,s[1]=d*E+p*T+g*P,s[4]=d*w+p*L+g*O,s[7]=d*b+p*C+g*B,s[2]=v*E+y*T+S*P,s[5]=v*w+y*L+S*O,s[8]=v*b+y*C+S*B,this}multiplyScalar(t){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=t,n[4]*=t,n[7]*=t,n[2]*=t,n[5]*=t,n[8]*=t,this}determinant(){const t=this.elements,n=t[0],i=t[1],r=t[2],s=t[3],a=t[4],c=t[5],u=t[6],d=t[7],p=t[8];return n*a*p-n*c*d-i*s*p+i*c*u+r*s*d-r*a*u}invert(){const t=this.elements,n=t[0],i=t[1],r=t[2],s=t[3],a=t[4],c=t[5],u=t[6],d=t[7],p=t[8],g=p*a-c*d,v=c*u-p*s,y=d*s-a*u,S=n*g+i*v+r*y;if(S===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/S;return t[0]=g*E,t[1]=(r*d-p*i)*E,t[2]=(c*i-r*a)*E,t[3]=v*E,t[4]=(p*n-r*u)*E,t[5]=(r*s-c*n)*E,t[6]=y*E,t[7]=(i*u-d*n)*E,t[8]=(a*n-i*s)*E,this}transpose(){let t;const n=this.elements;return t=n[1],n[1]=n[3],n[3]=t,t=n[2],n[2]=n[6],n[6]=t,t=n[5],n[5]=n[7],n[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const n=this.elements;return t[0]=n[0],t[1]=n[3],t[2]=n[6],t[3]=n[1],t[4]=n[4],t[5]=n[7],t[6]=n[2],t[7]=n[5],t[8]=n[8],this}setUvTransform(t,n,i,r,s,a,c){const u=Math.cos(s),d=Math.sin(s);return this.set(i*u,i*d,-i*(u*a+d*c)+a+t,-r*d,r*u,-r*(-d*a+u*c)+c+n,0,0,1),this}scale(t,n){return this.premultiply(Nb.makeScale(t,n)),this}rotate(t){return this.premultiply(Nb.makeRotation(-t)),this}translate(t,n){return this.premultiply(Nb.makeTranslation(t,n)),this}makeTranslation(t,n){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,n,0,0,1),this}makeRotation(t){const n=Math.cos(t),i=Math.sin(t);return this.set(n,-i,0,i,n,0,0,0,1),this}makeScale(t,n){return this.set(t,0,0,0,n,0,0,0,1),this}equals(t){const n=this.elements,i=t.elements;for(let r=0;r<9;r++)if(n[r]!==i[r])return!1;return!0}fromArray(t,n=0){for(let i=0;i<9;i++)this.elements[i]=t[i+n];return this}toArray(t=[],n=0){const i=this.elements;return t[n]=i[0],t[n+1]=i[1],t[n+2]=i[2],t[n+3]=i[3],t[n+4]=i[4],t[n+5]=i[5],t[n+6]=i[6],t[n+7]=i[7],t[n+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}},Nb=new _n;function wR(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}var Sz={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function zp(e,t){return new Sz[e](t)}function e0(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}var _E={};function G1(e){e in _E||(_E[e]=!0,console.warn(e))}function Gp(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}function Ib(e){return e<.0031308?e*12.92:1.055*Math.pow(e,.41666)-.055}var bz=new _n().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),Mz=new _n().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function wz(e){return e.convertSRGBToLinear().applyMatrix3(Mz)}function Az(e){return e.applyMatrix3(bz).convertLinearToSRGB()}var Ez={[qa]:e=>e,[Mr]:e=>e.convertSRGBToLinear(),[nw]:wz},Tz={[qa]:e=>e,[Mr]:e=>e.convertLinearToSRGB(),[nw]:Az},go={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(e){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!e},get workingColorSpace(){return qa},set workingColorSpace(e){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,n){if(this.enabled===!1||t===n||!t||!n)return e;const i=Ez[t],r=Tz[n];if(i===void 0||r===void 0)throw new Error(`Unsupported color space conversion, "${t}" to "${n}".`);return r(i(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},Qd,rw=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Qd===void 0&&(Qd=e0("canvas")),Qd.width=e.width,Qd.height=e.height;const n=Qd.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Qd}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=e0("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let s=0;s<r.length;s++)r[s]=Gp(r[s]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Gp(t[n]/255)*255):t[n]=Gp(t[n]);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}},Cz=0,nf=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Cz++}),this.uuid=qs(),this.data=e,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 n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let s=0,a=i.length;s<a;s++)i[s].isDataTexture?r.push(Ob(i[s].image)):r.push(Ob(i[s]))}else r=Ob(i);n.url=r}return t||(e.images[this.uuid]=n),n}};function Ob(e){return typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap?rw.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var Rz=0,Cr=class nx extends ic{constructor(t=nx.DEFAULT_IMAGE,n=nx.DEFAULT_MAPPING,i=yo,r=yo,s=Er,a=sm,c=$p,u=Z1,d=nx.DEFAULT_ANISOTROPY,p=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Rz++}),this.uuid=qs(),this.name="",this.source=new nf(t),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=d,this.format=c,this.internalFormat=null,this.type=u,this.offset=new pt(0,0),this.repeat=new pt(1,1),this.center=new pt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new _n,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof p=="string"?this.colorSpace=p:(G1("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=p===3001?Mr:""),this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const n=t===void 0||typeof t=="string";if(!n&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),n||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==300)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case q1:t.x=t.x-Math.floor(t.x);break;case yo:t.x=t.x<0?0:1;break;case $1:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case q1:t.y=t.y-Math.floor(t.y);break;case yo:t.y=t.y<0?0:1;break;case $1:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return G1("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace==="srgb"?tw:ew}set encoding(t){G1("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=t===3001?Mr:""}};Cr.DEFAULT_IMAGE=null;Cr.DEFAULT_MAPPING=300;Cr.DEFAULT_ANISOTROPY=1;var $n=class AR{constructor(t=0,n=0,i=0,r=1){AR.prototype.isVector4=!0,this.x=t,this.y=n,this.z=i,this.w=r}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,n,i,r){return this.x=t,this.y=n,this.z=i,this.w=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,n){switch(t){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,n){return this.x=t.x+n.x,this.y=t.y+n.y,this.z=t.z+n.z,this.w=t.w+n.w,this}addScaledVector(t,n){return this.x+=t.x*n,this.y+=t.y*n,this.z+=t.z*n,this.w+=t.w*n,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,n){return this.x=t.x-n.x,this.y=t.y-n.y,this.z=t.z-n.z,this.w=t.w-n.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const n=this.x,i=this.y,r=this.z,s=this.w,a=t.elements;return this.x=a[0]*n+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*n+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*n+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*n+a[7]*i+a[11]*r+a[15]*s,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const n=Math.sqrt(1-t.w*t.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/n,this.y=t.y/n,this.z=t.z/n),this}setAxisAngleFromRotationMatrix(t){let n,i,r,s;const u=t.elements,d=u[0],p=u[4],g=u[8],v=u[1],y=u[5],S=u[9],E=u[2],w=u[6],b=u[10];if(Math.abs(p-v)<.01&&Math.abs(g-E)<.01&&Math.abs(S-w)<.01){if(Math.abs(p+v)<.1&&Math.abs(g+E)<.1&&Math.abs(S+w)<.1&&Math.abs(d+y+b-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const L=(d+1)/2,C=(y+1)/2,P=(b+1)/2,O=(p+v)/4,B=(g+E)/4,U=(S+w)/4;return L>C&&L>P?L<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(L),r=O/i,s=B/i):C>P?C<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(C),i=O/r,s=U/r):P<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(P),i=B/s,r=U/s),this.set(i,r,s,n),this}let T=Math.sqrt((w-S)*(w-S)+(g-E)*(g-E)+(v-p)*(v-p));return Math.abs(T)<.001&&(T=1),this.x=(w-S)/T,this.y=(g-E)/T,this.z=(v-p)/T,this.w=Math.acos((d+y+b-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,n){return this.x=Math.max(t.x,Math.min(n.x,this.x)),this.y=Math.max(t.y,Math.min(n.y,this.y)),this.z=Math.max(t.z,Math.min(n.z,this.z)),this.w=Math.max(t.w,Math.min(n.w,this.w)),this}clampScalar(t,n){return this.x=Math.max(t,Math.min(n,this.x)),this.y=Math.max(t,Math.min(n,this.y)),this.z=Math.max(t,Math.min(n,this.z)),this.w=Math.max(t,Math.min(n,this.w)),this}clampLength(t,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(n,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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,n){return this.x+=(t.x-this.x)*n,this.y+=(t.y-this.y)*n,this.z+=(t.z-this.z)*n,this.w+=(t.w-this.w)*n,this}lerpVectors(t,n,i){return this.x=t.x+(n.x-t.x)*i,this.y=t.y+(n.y-t.y)*i,this.z=t.z+(n.z-t.z)*i,this.w=t.w+(n.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,n=0){return this.x=t[n],this.y=t[n+1],this.z=t[n+2],this.w=t[n+3],this}toArray(t=[],n=0){return t[n]=this.x,t[n+1]=this.y,t[n+2]=this.z,t[n+3]=this.w,t}fromBufferAttribute(t,n){return this.x=t.getX(n),this.y=t.getY(n),this.z=t.getZ(n),this.w=t.getW(n),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}},la=class extends ic{constructor(e=1,t=1,n={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new $n(0,0,e,t),this.scissorTest=!1,this.viewport=new $n(0,0,e,t);const i={width:e,height:t,depth:1};n.encoding!==void 0&&(G1("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===3001?Mr:""),this.texture=new Cr(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.internalFormat=n.internalFormat!==void 0?n.internalFormat:null,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:Er,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null,this.samples=n.samples!==void 0?n.samples:0}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new nf(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},Ix=class extends Cr{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=as,this.minFilter=as,this.wrapR=yo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Lz=class extends la{constructor(e=1,t=1,n=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Ix(null,e,t,n),this.texture.isRenderTargetTexture=!0}},sw=class extends Cr{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=as,this.minFilter=as,this.wrapR=yo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Pz=class extends la{constructor(e=1,t=1,n=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new sw(null,e,t,n),this.texture.isRenderTargetTexture=!0}},Nz=class extends la{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLMultipleRenderTargets=!0;const r=this.texture;this.texture=[];for(let s=0;s<n;s++)this.texture[s]=r.clone(),this.texture[s].isRenderTargetTexture=!0}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.texture.length;i<r;i++)this.texture[i].image.width=e,this.texture[i].image.height=t,this.texture[i].image.depth=n;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),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.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(let t=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}},Es=class{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,s,a){let c=n[i+0],u=n[i+1],d=n[i+2],p=n[i+3];const g=r[s+0],v=r[s+1],y=r[s+2],S=r[s+3];if(a===0){e[t+0]=c,e[t+1]=u,e[t+2]=d,e[t+3]=p;return}if(a===1){e[t+0]=g,e[t+1]=v,e[t+2]=y,e[t+3]=S;return}if(p!==S||c!==g||u!==v||d!==y){let E=1-a;const w=c*g+u*v+d*y+p*S,b=w>=0?1:-1,T=1-w*w;if(T>Number.EPSILON){const C=Math.sqrt(T),P=Math.atan2(C,w*b);E=Math.sin(E*P)/C,a=Math.sin(a*P)/C}const L=a*b;if(c=c*E+g*L,u=u*E+v*L,d=d*E+y*L,p=p*E+S*L,E===1-a){const C=1/Math.sqrt(c*c+u*u+d*d+p*p);c*=C,u*=C,d*=C,p*=C}}e[t]=c,e[t+1]=u,e[t+2]=d,e[t+3]=p}static multiplyQuaternionsFlat(e,t,n,i,r,s){const a=n[i],c=n[i+1],u=n[i+2],d=n[i+3],p=r[s],g=r[s+1],v=r[s+2],y=r[s+3];return e[t]=a*y+d*p+c*v-u*g,e[t+1]=c*y+d*g+u*p-a*v,e[t+2]=u*y+d*v+a*g-c*p,e[t+3]=d*y-a*p-c*g-u*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,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const n=e._x,i=e._y,r=e._z,s=e._order,a=Math.cos,c=Math.sin,u=a(n/2),d=a(i/2),p=a(r/2),g=c(n/2),v=c(i/2),y=c(r/2);switch(s){case"XYZ":this._x=g*d*p+u*v*y,this._y=u*v*p-g*d*y,this._z=u*d*y+g*v*p,this._w=u*d*p-g*v*y;break;case"YXZ":this._x=g*d*p+u*v*y,this._y=u*v*p-g*d*y,this._z=u*d*y-g*v*p,this._w=u*d*p+g*v*y;break;case"ZXY":this._x=g*d*p-u*v*y,this._y=u*v*p+g*d*y,this._z=u*d*y+g*v*p,this._w=u*d*p-g*v*y;break;case"ZYX":this._x=g*d*p-u*v*y,this._y=u*v*p+g*d*y,this._z=u*d*y-g*v*p,this._w=u*d*p+g*v*y;break;case"YZX":this._x=g*d*p+u*v*y,this._y=u*v*p+g*d*y,this._z=u*d*y-g*v*p,this._w=u*d*p-g*v*y;break;case"XZY":this._x=g*d*p-u*v*y,this._y=u*v*p-g*d*y,this._z=u*d*y+g*v*p,this._w=u*d*p+g*v*y;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],s=t[1],a=t[5],c=t[9],u=t[2],d=t[6],p=t[10],g=n+a+p;if(g>0){const v=.5/Math.sqrt(g+1);this._w=.25/v,this._x=(d-c)*v,this._y=(r-u)*v,this._z=(s-i)*v}else if(n>a&&n>p){const v=2*Math.sqrt(1+n-a-p);this._w=(d-c)/v,this._x=.25*v,this._y=(i+s)/v,this._z=(r+u)/v}else if(a>p){const v=2*Math.sqrt(1+a-n-p);this._w=(r-u)/v,this._x=(i+s)/v,this._y=.25*v,this._z=(c+d)/v}else{const v=2*Math.sqrt(1+p-n-a);this._w=(s-i)/v,this._x=(r+u)/v,this._y=(c+d)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ti(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 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 n=e._x,i=e._y,r=e._z,s=e._w,a=t._x,c=t._y,u=t._z,d=t._w;return this._x=n*d+s*a+i*u-r*c,this._y=i*d+s*c+r*a-n*u,this._z=r*d+s*u+n*c-i*a,this._w=s*d-n*a-i*c-r*u,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,r=this._z,s=this._w;let a=s*e._w+n*e._x+i*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const c=1-a*a;if(c<=Number.EPSILON){const v=1-t;return this._w=v*s+t*this._w,this._x=v*n+t*this._x,this._y=v*i+t*this._y,this._z=v*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const u=Math.sqrt(c),d=Math.atan2(u,a),p=Math.sin((1-t)*d)/u,g=Math.sin(t*d)/u;return this._w=s*p+this._w*g,this._x=n*p+this._x*g,this._y=i*p+this._y*g,this._z=r*p+this._z*g,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(r),n*Math.cos(r),t*Math.sin(i))}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}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}},ae=class ER{constructor(t=0,n=0,i=0){ER.prototype.isVector3=!0,this.x=t,this.y=n,this.z=i}set(t,n,i){return i===void 0&&(i=this.z),this.x=t,this.y=n,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,n){switch(t){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,n){return this.x=t.x+n.x,this.y=t.y+n.y,this.z=t.z+n.z,this}addScaledVector(t,n){return this.x+=t.x*n,this.y+=t.y*n,this.z+=t.z*n,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,n){return this.x=t.x-n.x,this.y=t.y-n.y,this.z=t.z-n.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,n){return this.x=t.x*n.x,this.y=t.y*n.y,this.z=t.z*n.z,this}applyEuler(t){return this.applyQuaternion(vE.setFromEuler(t))}applyAxisAngle(t,n){return this.applyQuaternion(vE.setFromAxisAngle(t,n))}applyMatrix3(t){const n=this.x,i=this.y,r=this.z,s=t.elements;return this.x=s[0]*n+s[3]*i+s[6]*r,this.y=s[1]*n+s[4]*i+s[7]*r,this.z=s[2]*n+s[5]*i+s[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const n=this.x,i=this.y,r=this.z,s=t.elements,a=1/(s[3]*n+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*n+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*n+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*n+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(t){const n=this.x,i=this.y,r=this.z,s=t.x,a=t.y,c=t.z,u=t.w,d=u*n+a*r-c*i,p=u*i+c*n-s*r,g=u*r+s*i-a*n,v=-s*n-a*i-c*r;return this.x=d*u+v*-s+p*-c-g*-a,this.y=p*u+v*-a+g*-s-d*-c,this.z=g*u+v*-c+d*-a-p*-s,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const n=this.x,i=this.y,r=this.z,s=t.elements;return this.x=s[0]*n+s[4]*i+s[8]*r,this.y=s[1]*n+s[5]*i+s[9]*r,this.z=s[2]*n+s[6]*i+s[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,n){return this.x=Math.max(t.x,Math.min(n.x,this.x)),this.y=Math.max(t.y,Math.min(n.y,this.y)),this.z=Math.max(t.z,Math.min(n.z,this.z)),this}clampScalar(t,n){return this.x=Math.max(t,Math.min(n,this.x)),this.y=Math.max(t,Math.min(n,this.y)),this.z=Math.max(t,Math.min(n,this.z)),this}clampLength(t,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(n,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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,n){return this.x+=(t.x-this.x)*n,this.y+=(t.y-this.y)*n,this.z+=(t.z-this.z)*n,this}lerpVectors(t,n,i){return this.x=t.x+(n.x-t.x)*i,this.y=t.y+(n.y-t.y)*i,this.z=t.z+(n.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,n){const i=t.x,r=t.y,s=t.z,a=n.x,c=n.y,u=n.z;return this.x=r*u-s*c,this.y=s*a-i*u,this.z=i*c-r*a,this}projectOnVector(t){const n=t.lengthSq();if(n===0)return this.set(0,0,0);const i=t.dot(this)/n;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return Db.copy(this).projectOnVector(t),this.sub(Db)}reflect(t){return this.sub(Db.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const n=Math.sqrt(this.lengthSq()*t.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(t)/n;return Math.acos(Ti(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const n=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return n*n+i*i+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,n,i){const r=Math.sin(n)*t;return this.x=r*Math.sin(i),this.y=Math.cos(n)*t,this.z=r*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,n,i){return this.x=t*Math.sin(n),this.y=i,this.z=t*Math.cos(n),this}setFromMatrixPosition(t){const n=t.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(t){const n=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=n,this.y=i,this.z=r,this}setFromMatrixColumn(t,n){return this.fromArray(t.elements,n*4)}setFromMatrix3Column(t,n){return this.fromArray(t.elements,n*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,n=0){return this.x=t[n],this.y=t[n+1],this.z=t[n+2],this}toArray(t=[],n=0){return t[n]=this.x,t[n+1]=this.y,t[n+2]=this.z,t}fromBufferAttribute(t,n){return this.x=t.getX(n),this.y=t.getY(n),this.z=t.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=(Math.random()-.5)*2,n=Math.random()*Math.PI*2,i=Math.sqrt(1-t**2);return this.x=i*Math.cos(n),this.y=i*Math.sin(n),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Db=new ae,vE=new Es,Ka=class{constructor(e=new ae(1/0,1/0,1/0),t=new ae(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(zl.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(zl.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=zl.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){if(e.updateWorldMatrix(!1,!1),e.boundingBox!==void 0)e.boundingBox===null&&e.computeBoundingBox(),Jd.copy(e.boundingBox),Jd.applyMatrix4(e.matrixWorld),this.union(Jd);else{const i=e.geometry;if(i!==void 0)if(t&&i.attributes!==void 0&&i.attributes.position!==void 0){const r=i.attributes.position;for(let s=0,a=r.count;s<a;s++)zl.fromBufferAttribute(r,s).applyMatrix4(e.matrixWorld),this.expandByPoint(zl)}else i.boundingBox===null&&i.computeBoundingBox(),Jd.copy(i.boundingBox),Jd.applyMatrix4(e.matrixWorld),this.union(Jd)}const n=e.children;for(let i=0,r=n.length;i<r;i++)this.expandByObject(n[i],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,zl),zl.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(d1),Hv.subVectors(this.max,d1),ep.subVectors(e.a,d1),tp.subVectors(e.b,d1),np.subVectors(e.c,d1),su.subVectors(tp,ep),ou.subVectors(np,tp),Uh.subVectors(ep,np);let t=[0,-su.z,su.y,0,-ou.z,ou.y,0,-Uh.z,Uh.y,su.z,0,-su.x,ou.z,0,-ou.x,Uh.z,0,-Uh.x,-su.y,su.x,0,-ou.y,ou.x,0,-Uh.y,Uh.x,0];return!zb(t,ep,tp,np,Hv)||(t=[1,0,0,0,1,0,0,0,1],!zb(t,ep,tp,np,Hv))?!1:(Wv.crossVectors(su,ou),t=[Wv.x,Wv.y,Wv.z],zb(t,ep,tp,np,Hv))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,zl).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(zl).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:(Dl[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Dl[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Dl[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Dl[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Dl[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Dl[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Dl[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Dl[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Dl),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)}},Dl=[new ae,new ae,new ae,new ae,new ae,new ae,new ae,new ae],zl=new ae,Jd=new Ka,ep=new ae,tp=new ae,np=new ae,su=new ae,ou=new ae,Uh=new ae,d1=new ae,Hv=new ae,Wv=new ae,Bh=new ae;function zb(e,t,n,i,r){for(let s=0,a=e.length-3;s<=a;s+=3){Bh.fromArray(e,s);const c=r.x*Math.abs(Bh.x)+r.y*Math.abs(Bh.y)+r.z*Math.abs(Bh.z),u=t.dot(Bh),d=n.dot(Bh),p=i.dot(Bh);if(Math.max(-Math.max(u,d,p),Math.min(u,d,p))>c)return!1}return!0}var Iz=new Ka,p1=new ae,Ub=new ae,fa=class{constructor(e=new ae,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):Iz.setFromPoints(e).getCenter(n);let i=0;for(let r=0,s=e.length;r<s;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;p1.subVectors(e,this.center);const t=p1.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(p1,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Ub.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(p1.copy(e.center).add(Ub)),this.expandByPoint(p1.copy(e.center).sub(Ub))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},Ul=new ae,Bb=new ae,Xv=new ae,au=new ae,Vb=new ae,jv=new ae,Fb=new ae,om=class{constructor(e=new ae,t=new ae(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,Ul)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ul.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ul.copy(this.origin).addScaledVector(this.direction,t),Ul.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Bb.copy(e).add(t).multiplyScalar(.5),Xv.copy(t).sub(e).normalize(),au.copy(this.origin).sub(Bb);const r=e.distanceTo(t)*.5,s=-this.direction.dot(Xv),a=au.dot(this.direction),c=-au.dot(Xv),u=au.lengthSq(),d=Math.abs(1-s*s);let p,g,v,y;if(d>0)if(p=s*c-a,g=s*a-c,y=r*d,p>=0)if(g>=-y)if(g<=y){const S=1/d;p*=S,g*=S,v=p*(p+s*g+2*a)+g*(s*p+g+2*c)+u}else g=r,p=Math.max(0,-(s*g+a)),v=-p*p+g*(g+2*c)+u;else g=-r,p=Math.max(0,-(s*g+a)),v=-p*p+g*(g+2*c)+u;else g<=-y?(p=Math.max(0,-(-s*r+a)),g=p>0?-r:Math.min(Math.max(-r,-c),r),v=-p*p+g*(g+2*c)+u):g<=y?(p=0,g=Math.min(Math.max(-r,-c),r),v=g*(g+2*c)+u):(p=Math.max(0,-(s*r+a)),g=p>0?r:Math.min(Math.max(-r,-c),r),v=-p*p+g*(g+2*c)+u);else g=s>0?-r:r,p=Math.max(0,-(s*g+a)),v=-p*p+g*(g+2*c)+u;return n&&n.copy(this.origin).addScaledVector(this.direction,p),i&&i.copy(Bb).addScaledVector(Xv,g),v}intersectSphere(e,t){Ul.subVectors(e.center,this.origin);const n=Ul.dot(this.direction),i=Ul.dot(Ul)-n*n,r=e.radius*e.radius;if(i>r)return null;const s=Math.sqrt(r-i),a=n-s,c=n+s;return c<0?null:a<0?this.at(c,t):this.at(a,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 n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,s,a,c;const u=1/this.direction.x,d=1/this.direction.y,p=1/this.direction.z,g=this.origin;return u>=0?(n=(e.min.x-g.x)*u,i=(e.max.x-g.x)*u):(n=(e.max.x-g.x)*u,i=(e.min.x-g.x)*u),d>=0?(r=(e.min.y-g.y)*d,s=(e.max.y-g.y)*d):(r=(e.max.y-g.y)*d,s=(e.min.y-g.y)*d),n>s||r>i||((r>n||isNaN(n))&&(n=r),(s<i||isNaN(i))&&(i=s),p>=0?(a=(e.min.z-g.z)*p,c=(e.max.z-g.z)*p):(a=(e.max.z-g.z)*p,c=(e.min.z-g.z)*p),n>c||a>i)||((a>n||n!==n)&&(n=a),(c<i||i!==i)&&(i=c),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Ul)!==null}intersectTriangle(e,t,n,i,r){Vb.subVectors(t,e),jv.subVectors(n,e),Fb.crossVectors(Vb,jv);let s=this.direction.dot(Fb),a;if(s>0){if(i)return null;a=1}else if(s<0)a=-1,s=-s;else return null;au.subVectors(this.origin,e);const c=a*this.direction.dot(jv.crossVectors(au,jv));if(c<0)return null;const u=a*this.direction.dot(Vb.cross(au));if(u<0||c+u>s)return null;const d=-a*au.dot(Fb);return d<0?null:this.at(d/s,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},un=class K2{constructor(t,n,i,r,s,a,c,u,d,p,g,v,y,S,E,w){K2.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,n,i,r,s,a,c,u,d,p,g,v,y,S,E,w)}set(t,n,i,r,s,a,c,u,d,p,g,v,y,S,E,w){const b=this.elements;return b[0]=t,b[4]=n,b[8]=i,b[12]=r,b[1]=s,b[5]=a,b[9]=c,b[13]=u,b[2]=d,b[6]=p,b[10]=g,b[14]=v,b[3]=y,b[7]=S,b[11]=E,b[15]=w,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 K2().fromArray(this.elements)}copy(t){const n=this.elements,i=t.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this}copyPosition(t){const n=this.elements,i=t.elements;return n[12]=i[12],n[13]=i[13],n[14]=i[14],this}setFromMatrix3(t){const n=t.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(t,n,i){return t.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,n,i){return this.set(t.x,n.x,i.x,0,t.y,n.y,i.y,0,t.z,n.z,i.z,0,0,0,0,1),this}extractRotation(t){const n=this.elements,i=t.elements,r=1/ip.setFromMatrixColumn(t,0).length(),s=1/ip.setFromMatrixColumn(t,1).length(),a=1/ip.setFromMatrixColumn(t,2).length();return n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[3]=0,n[4]=i[4]*s,n[5]=i[5]*s,n[6]=i[6]*s,n[7]=0,n[8]=i[8]*a,n[9]=i[9]*a,n[10]=i[10]*a,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(t){const n=this.elements,i=t.x,r=t.y,s=t.z,a=Math.cos(i),c=Math.sin(i),u=Math.cos(r),d=Math.sin(r),p=Math.cos(s),g=Math.sin(s);if(t.order==="XYZ"){const v=a*p,y=a*g,S=c*p,E=c*g;n[0]=u*p,n[4]=-u*g,n[8]=d,n[1]=y+S*d,n[5]=v-E*d,n[9]=-c*u,n[2]=E-v*d,n[6]=S+y*d,n[10]=a*u}else if(t.order==="YXZ"){const v=u*p,y=u*g,S=d*p,E=d*g;n[0]=v+E*c,n[4]=S*c-y,n[8]=a*d,n[1]=a*g,n[5]=a*p,n[9]=-c,n[2]=y*c-S,n[6]=E+v*c,n[10]=a*u}else if(t.order==="ZXY"){const v=u*p,y=u*g,S=d*p,E=d*g;n[0]=v-E*c,n[4]=-a*g,n[8]=S+y*c,n[1]=y+S*c,n[5]=a*p,n[9]=E-v*c,n[2]=-a*d,n[6]=c,n[10]=a*u}else if(t.order==="ZYX"){const v=a*p,y=a*g,S=c*p,E=c*g;n[0]=u*p,n[4]=S*d-y,n[8]=v*d+E,n[1]=u*g,n[5]=E*d+v,n[9]=y*d-S,n[2]=-d,n[6]=c*u,n[10]=a*u}else if(t.order==="YZX"){const v=a*u,y=a*d,S=c*u,E=c*d;n[0]=u*p,n[4]=E-v*g,n[8]=S*g+y,n[1]=g,n[5]=a*p,n[9]=-c*p,n[2]=-d*p,n[6]=y*g+S,n[10]=v-E*g}else if(t.order==="XZY"){const v=a*u,y=a*d,S=c*u,E=c*d;n[0]=u*p,n[4]=-g,n[8]=d*p,n[1]=v*g+E,n[5]=a*p,n[9]=y*g-S,n[2]=S*g-y,n[6]=c*p,n[10]=E*g+v}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Oz,t,Dz)}lookAt(t,n,i){const r=this.elements;return Gs.subVectors(t,n),Gs.lengthSq()===0&&(Gs.z=1),Gs.normalize(),lu.crossVectors(i,Gs),lu.lengthSq()===0&&(Math.abs(i.z)===1?Gs.x+=1e-4:Gs.z+=1e-4,Gs.normalize(),lu.crossVectors(i,Gs)),lu.normalize(),Yv.crossVectors(Gs,lu),r[0]=lu.x,r[4]=Yv.x,r[8]=Gs.x,r[1]=lu.y,r[5]=Yv.y,r[9]=Gs.y,r[2]=lu.z,r[6]=Yv.z,r[10]=Gs.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,n){const i=t.elements,r=n.elements,s=this.elements,a=i[0],c=i[4],u=i[8],d=i[12],p=i[1],g=i[5],v=i[9],y=i[13],S=i[2],E=i[6],w=i[10],b=i[14],T=i[3],L=i[7],C=i[11],P=i[15],O=r[0],B=r[4],U=r[8],I=r[12],z=r[1],te=r[5],oe=r[9],ee=r[13],k=r[2],X=r[6],$=r[10],j=r[14],J=r[3],xe=r[7],de=r[11],fe=r[15];return s[0]=a*O+c*z+u*k+d*J,s[4]=a*B+c*te+u*X+d*xe,s[8]=a*U+c*oe+u*$+d*de,s[12]=a*I+c*ee+u*j+d*fe,s[1]=p*O+g*z+v*k+y*J,s[5]=p*B+g*te+v*X+y*xe,s[9]=p*U+g*oe+v*$+y*de,s[13]=p*I+g*ee+v*j+y*fe,s[2]=S*O+E*z+w*k+b*J,s[6]=S*B+E*te+w*X+b*xe,s[10]=S*U+E*oe+w*$+b*de,s[14]=S*I+E*ee+w*j+b*fe,s[3]=T*O+L*z+C*k+P*J,s[7]=T*B+L*te+C*X+P*xe,s[11]=T*U+L*oe+C*$+P*de,s[15]=T*I+L*ee+C*j+P*fe,this}multiplyScalar(t){const n=this.elements;return n[0]*=t,n[4]*=t,n[8]*=t,n[12]*=t,n[1]*=t,n[5]*=t,n[9]*=t,n[13]*=t,n[2]*=t,n[6]*=t,n[10]*=t,n[14]*=t,n[3]*=t,n[7]*=t,n[11]*=t,n[15]*=t,this}determinant(){const t=this.elements,n=t[0],i=t[4],r=t[8],s=t[12],a=t[1],c=t[5],u=t[9],d=t[13],p=t[2],g=t[6],v=t[10],y=t[14],S=t[3],E=t[7],w=t[11],b=t[15];return S*(+s*u*g-r*d*g-s*c*v+i*d*v+r*c*y-i*u*y)+E*(+n*u*y-n*d*v+s*a*v-r*a*y+r*d*p-s*u*p)+w*(+n*d*g-n*c*y-s*a*g+i*a*y+s*c*p-i*d*p)+b*(-r*c*p-n*u*g+n*c*v+r*a*g-i*a*v+i*u*p)}transpose(){const t=this.elements;let n;return n=t[1],t[1]=t[4],t[4]=n,n=t[2],t[2]=t[8],t[8]=n,n=t[6],t[6]=t[9],t[9]=n,n=t[3],t[3]=t[12],t[12]=n,n=t[7],t[7]=t[13],t[13]=n,n=t[11],t[11]=t[14],t[14]=n,this}setPosition(t,n,i){const r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=n,r[14]=i),this}invert(){const t=this.elements,n=t[0],i=t[1],r=t[2],s=t[3],a=t[4],c=t[5],u=t[6],d=t[7],p=t[8],g=t[9],v=t[10],y=t[11],S=t[12],E=t[13],w=t[14],b=t[15],T=g*w*d-E*v*d+E*u*y-c*w*y-g*u*b+c*v*b,L=S*v*d-p*w*d-S*u*y+a*w*y+p*u*b-a*v*b,C=p*E*d-S*g*d+S*c*y-a*E*y-p*c*b+a*g*b,P=S*g*u-p*E*u-S*c*v+a*E*v+p*c*w-a*g*w,O=n*T+i*L+r*C+s*P;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 t[0]=T*B,t[1]=(E*v*s-g*w*s-E*r*y+i*w*y+g*r*b-i*v*b)*B,t[2]=(c*w*s-E*u*s+E*r*d-i*w*d-c*r*b+i*u*b)*B,t[3]=(g*u*s-c*v*s-g*r*d+i*v*d+c*r*y-i*u*y)*B,t[4]=L*B,t[5]=(p*w*s-S*v*s+S*r*y-n*w*y-p*r*b+n*v*b)*B,t[6]=(S*u*s-a*w*s-S*r*d+n*w*d+a*r*b-n*u*b)*B,t[7]=(a*v*s-p*u*s+p*r*d-n*v*d-a*r*y+n*u*y)*B,t[8]=C*B,t[9]=(S*g*s-p*E*s-S*i*y+n*E*y+p*i*b-n*g*b)*B,t[10]=(a*E*s-S*c*s+S*i*d-n*E*d-a*i*b+n*c*b)*B,t[11]=(p*c*s-a*g*s-p*i*d+n*g*d+a*i*y-n*c*y)*B,t[12]=P*B,t[13]=(p*E*r-S*g*r+S*i*v-n*E*v-p*i*w+n*g*w)*B,t[14]=(S*c*r-a*E*r-S*i*u+n*E*u+a*i*w-n*c*w)*B,t[15]=(a*g*r-p*c*r+p*i*u-n*g*u-a*i*v+n*c*v)*B,this}scale(t){const n=this.elements,i=t.x,r=t.y,s=t.z;return n[0]*=i,n[4]*=r,n[8]*=s,n[1]*=i,n[5]*=r,n[9]*=s,n[2]*=i,n[6]*=r,n[10]*=s,n[3]*=i,n[7]*=r,n[11]*=s,this}getMaxScaleOnAxis(){const t=this.elements,n=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(n,i,r))}makeTranslation(t,n,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,n,0,0,1,i,0,0,0,1),this}makeRotationX(t){const n=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,n,-i,0,0,i,n,0,0,0,0,1),this}makeRotationY(t){const n=Math.cos(t),i=Math.sin(t);return this.set(n,0,i,0,0,1,0,0,-i,0,n,0,0,0,0,1),this}makeRotationZ(t){const n=Math.cos(t),i=Math.sin(t);return this.set(n,-i,0,0,i,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,n){const i=Math.cos(n),r=Math.sin(n),s=1-i,a=t.x,c=t.y,u=t.z,d=s*a,p=s*c;return this.set(d*a+i,d*c-r*u,d*u+r*c,0,d*c+r*u,p*c+i,p*u-r*a,0,d*u-r*c,p*u+r*a,s*u*u+i,0,0,0,0,1),this}makeScale(t,n,i){return this.set(t,0,0,0,0,n,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,n,i,r,s,a){return this.set(1,i,s,0,t,1,a,0,n,r,1,0,0,0,0,1),this}compose(t,n,i){const r=this.elements,s=n._x,a=n._y,c=n._z,u=n._w,d=s+s,p=a+a,g=c+c,v=s*d,y=s*p,S=s*g,E=a*p,w=a*g,b=c*g,T=u*d,L=u*p,C=u*g,P=i.x,O=i.y,B=i.z;return r[0]=(1-(E+b))*P,r[1]=(y+C)*P,r[2]=(S-L)*P,r[3]=0,r[4]=(y-C)*O,r[5]=(1-(v+b))*O,r[6]=(w+T)*O,r[7]=0,r[8]=(S+L)*B,r[9]=(w-T)*B,r[10]=(1-(v+E))*B,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,n,i){const r=this.elements;let s=ip.set(r[0],r[1],r[2]).length();const a=ip.set(r[4],r[5],r[6]).length(),c=ip.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),t.x=r[12],t.y=r[13],t.z=r[14],na.copy(this);const u=1/s,d=1/a,p=1/c;return na.elements[0]*=u,na.elements[1]*=u,na.elements[2]*=u,na.elements[4]*=d,na.elements[5]*=d,na.elements[6]*=d,na.elements[8]*=p,na.elements[9]*=p,na.elements[10]*=p,n.setFromRotationMatrix(na),i.x=s,i.y=a,i.z=c,this}makePerspective(t,n,i,r,s,a,c=Zp){const u=this.elements,d=2*s/(n-t),p=2*s/(i-r),g=(n+t)/(n-t),v=(i+r)/(i-r);let y,S;if(c===2e3)y=-(a+s)/(a-s),S=-2*a*s/(a-s);else if(c===2001)y=-a/(a-s),S=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+c);return u[0]=d,u[4]=0,u[8]=g,u[12]=0,u[1]=0,u[5]=p,u[9]=v,u[13]=0,u[2]=0,u[6]=0,u[10]=y,u[14]=S,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(t,n,i,r,s,a,c=Zp){const u=this.elements,d=1/(n-t),p=1/(i-r),g=1/(a-s),v=(n+t)*d,y=(i+r)*p;let S,E;if(c===2e3)S=(a+s)*g,E=-2*g;else if(c===2001)S=s*g,E=-1*g;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+c);return u[0]=2*d,u[4]=0,u[8]=0,u[12]=-v,u[1]=0,u[5]=2*p,u[9]=0,u[13]=-y,u[2]=0,u[6]=0,u[10]=E,u[14]=-S,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(t){const n=this.elements,i=t.elements;for(let r=0;r<16;r++)if(n[r]!==i[r])return!1;return!0}fromArray(t,n=0){for(let i=0;i<16;i++)this.elements[i]=t[i+n];return this}toArray(t=[],n=0){const i=this.elements;return t[n]=i[0],t[n+1]=i[1],t[n+2]=i[2],t[n+3]=i[3],t[n+4]=i[4],t[n+5]=i[5],t[n+6]=i[6],t[n+7]=i[7],t[n+8]=i[8],t[n+9]=i[9],t[n+10]=i[10],t[n+11]=i[11],t[n+12]=i[12],t[n+13]=i[13],t[n+14]=i[14],t[n+15]=i[15],t}},ip=new ae,na=new un,Oz=new ae(0,0,0),Dz=new ae(1,1,1),lu=new ae,Yv=new ae,Gs=new ae,yE=new un,xE=new Es,ow=class TR{constructor(t=0,n=0,i=0,r=TR.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=i,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,n,i,r=this._order){return this._x=t,this._y=n,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,n=this._order,i=!0){const r=t.elements,s=r[0],a=r[4],c=r[8],u=r[1],d=r[5],p=r[9],g=r[2],v=r[6],y=r[10];switch(n){case"XYZ":this._y=Math.asin(Ti(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-p,y),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(v,d),this._z=0);break;case"YXZ":this._x=Math.asin(-Ti(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(c,y),this._z=Math.atan2(u,d)):(this._y=Math.atan2(-g,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ti(v,-1,1)),Math.abs(v)<.9999999?(this._y=Math.atan2(-g,y),this._z=Math.atan2(-a,d)):(this._y=0,this._z=Math.atan2(u,s));break;case"ZYX":this._y=Math.asin(-Ti(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(v,y),this._z=Math.atan2(u,s)):(this._x=0,this._z=Math.atan2(-a,d));break;case"YZX":this._z=Math.asin(Ti(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-p,d),this._y=Math.atan2(-g,s)):(this._x=0,this._y=Math.atan2(c,y));break;case"XZY":this._z=Math.asin(-Ti(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(v,d),this._y=Math.atan2(c,s)):(this._x=Math.atan2(-p,y),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,i===!0&&this._onChangeCallback(),this}setFromQuaternion(t,n,i){return yE.makeRotationFromQuaternion(t),this.setFromRotationMatrix(yE,n,i)}setFromVector3(t,n=this._order){return this.set(t.x,t.y,t.z,n)}reorder(t){return xE.setFromEuler(this),this.setFromQuaternion(xE,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],n=0){return t[n]=this._x,t[n+1]=this._y,t[n+2]=this._z,t[n+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};ow.DEFAULT_ORDER="XYZ";var Ox=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},zz=0,SE=new ae,rp=new Es,Bl=new un,qv=new ae,m1=new ae,Uz=new ae,Bz=new Es,bE=new ae(1,0,0),ME=new ae(0,1,0),wE=new ae(0,0,1),Vz={type:"added"},AE={type:"removed"},Wn=class ix extends ic{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:zz++}),this.uuid=qs(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ix.DEFAULT_UP.clone();const t=new ae,n=new ow,i=new Es,r=new ae(1,1,1);function s(){i.setFromEuler(n,!1)}function a(){n.setFromQuaternion(i,void 0,!1)}n._onChange(s),i._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new un},normalMatrix:{value:new _n}}),this.matrix=new un,this.matrixWorld=new un,this.matrixAutoUpdate=ix.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=ix.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new Ox,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,n){this.quaternion.setFromAxisAngle(t,n)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,n){return rp.setFromAxisAngle(t,n),this.quaternion.multiply(rp),this}rotateOnWorldAxis(t,n){return rp.setFromAxisAngle(t,n),this.quaternion.premultiply(rp),this}rotateX(t){return this.rotateOnAxis(bE,t)}rotateY(t){return this.rotateOnAxis(ME,t)}rotateZ(t){return this.rotateOnAxis(wE,t)}translateOnAxis(t,n){return SE.copy(t).applyQuaternion(this.quaternion),this.position.add(SE.multiplyScalar(n)),this}translateX(t){return this.translateOnAxis(bE,t)}translateY(t){return this.translateOnAxis(ME,t)}translateZ(t){return this.translateOnAxis(wE,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Bl.copy(this.matrixWorld).invert())}lookAt(t,n,i){t.isVector3?qv.copy(t):qv.set(t,n,i);const r=this.parent;this.updateWorldMatrix(!0,!1),m1.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Bl.lookAt(m1,qv,this.up):Bl.lookAt(qv,m1,this.up),this.quaternion.setFromRotationMatrix(Bl),r&&(Bl.extractRotation(r.matrixWorld),rp.setFromRotationMatrix(Bl),this.quaternion.premultiply(rp.invert()))}add(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.parent!==null&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(Vz)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const n=this.children.indexOf(t);return n!==-1&&(t.parent=null,this.children.splice(n,1),t.dispatchEvent(AE)),this}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}clear(){for(let t=0;t<this.children.length;t++){const n=this.children[t];n.parent=null,n.dispatchEvent(AE)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),Bl.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Bl.multiply(t.parent.matrixWorld)),t.applyMatrix4(Bl),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,n){if(this[t]===n)return this;for(let i=0,r=this.children.length;i<r;i++){const s=this.children[i].getObjectByProperty(t,n);if(s!==void 0)return s}}getObjectsByProperty(t,n){let i=[];this[t]===n&&i.push(this);for(let r=0,s=this.children.length;r<s;r++){const a=this.children[r].getObjectsByProperty(t,n);a.length>0&&(i=i.concat(a))}return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(m1,t,Uz),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(m1,Bz,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return t.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(t){t(this);const n=this.children;for(let i=0,r=n.length;i<r;i++)n[i].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);const n=this.children;for(let i=0,r=n.length;i<r;i++)n[i].traverseVisible(t)}traverseAncestors(t){const n=this.parent;n!==null&&(t(n),n.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const n=this.children;for(let i=0,r=n.length;i<r;i++){const s=n[i];(s.matrixWorldAutoUpdate===!0||t===!0)&&s.updateMatrixWorld(t)}}updateWorldMatrix(t,n){const i=this.parent;if(t===!0&&i!==null&&i.matrixWorldAutoUpdate===!0&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),n===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++){const c=r[s];c.matrixWorldAutoUpdate===!0&&c.updateWorldMatrix(!1,!0)}}}toJSON(t){const n=t===void 0||typeof t=="string",i={};n&&(t={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()));function s(c,u){return c[u.uuid]===void 0&&(c[u.uuid]=u.toJSON(t)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(t.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const u=c.shapes;if(Array.isArray(u))for(let d=0,p=u.length;d<p;d++){const g=u[d];s(t.shapes,g)}else s(t.shapes,u)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(t.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const c=[];for(let u=0,d=this.material.length;u<d;u++)c.push(s(t.materials,this.material[u]));r.material=c}else r.material=s(t.materials,this.material);if(this.children.length>0){r.children=[];for(let c=0;c<this.children.length;c++)r.children.push(this.children[c].toJSON(t).object)}if(this.animations.length>0){r.animations=[];for(let c=0;c<this.animations.length;c++){const u=this.animations[c];r.animations.push(s(t.animations,u))}}if(n){const c=a(t.geometries),u=a(t.materials),d=a(t.textures),p=a(t.images),g=a(t.shapes),v=a(t.skeletons),y=a(t.animations),S=a(t.nodes);c.length>0&&(i.geometries=c),u.length>0&&(i.materials=u),d.length>0&&(i.textures=d),p.length>0&&(i.images=p),g.length>0&&(i.shapes=g),v.length>0&&(i.skeletons=v),y.length>0&&(i.animations=y),S.length>0&&(i.nodes=S)}return i.object=r,i;function a(c){const u=[];for(const d in c){const p=c[d];delete p.metadata,u.push(p)}return u}}clone(t){return new this.constructor().copy(this,t)}copy(t,n=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations,this.userData=JSON.parse(JSON.stringify(t.userData)),n===!0)for(let i=0;i<t.children.length;i++){const r=t.children[i];this.add(r.clone())}return this}};Wn.DEFAULT_UP=new ae(0,1,0);Wn.DEFAULT_MATRIX_AUTO_UPDATE=!0;Wn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var ia=new ae,Vl=new ae,kb=new ae,Fl=new ae,sp=new ae,op=new ae,EE=new ae,Gb=new ae,Hb=new ae,Wb=new ae,$v=!1,rf=class $h{constructor(t=new ae,n=new ae,i=new ae){this.a=t,this.b=n,this.c=i}static getNormal(t,n,i,r){r.subVectors(i,n),ia.subVectors(t,n),r.cross(ia);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(t,n,i,r,s){ia.subVectors(r,n),Vl.subVectors(i,n),kb.subVectors(t,n);const a=ia.dot(ia),c=ia.dot(Vl),u=ia.dot(kb),d=Vl.dot(Vl),p=Vl.dot(kb),g=a*d-c*c;if(g===0)return s.set(-2,-1,-1);const v=1/g,y=(d*u-c*p)*v,S=(a*p-c*u)*v;return s.set(1-y-S,S,y)}static containsPoint(t,n,i,r){return this.getBarycoord(t,n,i,r,Fl),Fl.x>=0&&Fl.y>=0&&Fl.x+Fl.y<=1}static getUV(t,n,i,r,s,a,c,u){return $v===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),$v=!0),this.getInterpolation(t,n,i,r,s,a,c,u)}static getInterpolation(t,n,i,r,s,a,c,u){return this.getBarycoord(t,n,i,r,Fl),u.setScalar(0),u.addScaledVector(s,Fl.x),u.addScaledVector(a,Fl.y),u.addScaledVector(c,Fl.z),u}static isFrontFacing(t,n,i,r){return ia.subVectors(i,n),Vl.subVectors(t,n),ia.cross(Vl).dot(r)<0}set(t,n,i){return this.a.copy(t),this.b.copy(n),this.c.copy(i),this}setFromPointsAndIndices(t,n,i,r){return this.a.copy(t[n]),this.b.copy(t[i]),this.c.copy(t[r]),this}setFromAttributeAndIndices(t,n,i,r){return this.a.fromBufferAttribute(t,n),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,r),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return ia.subVectors(this.c,this.b),Vl.subVectors(this.a,this.b),ia.cross(Vl).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return $h.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return $h.getBarycoord(t,this.a,this.b,this.c,n)}getUV(t,n,i,r,s){return $v===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),$v=!0),$h.getInterpolation(t,this.a,this.b,this.c,n,i,r,s)}getInterpolation(t,n,i,r,s){return $h.getInterpolation(t,this.a,this.b,this.c,n,i,r,s)}containsPoint(t){return $h.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return $h.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,n){const i=this.a,r=this.b,s=this.c;let a,c;sp.subVectors(r,i),op.subVectors(s,i),Gb.subVectors(t,i);const u=sp.dot(Gb),d=op.dot(Gb);if(u<=0&&d<=0)return n.copy(i);Hb.subVectors(t,r);const p=sp.dot(Hb),g=op.dot(Hb);if(p>=0&&g<=p)return n.copy(r);const v=u*g-p*d;if(v<=0&&u>=0&&p<=0)return a=u/(u-p),n.copy(i).addScaledVector(sp,a);Wb.subVectors(t,s);const y=sp.dot(Wb),S=op.dot(Wb);if(S>=0&&y<=S)return n.copy(s);const E=y*d-u*S;if(E<=0&&d>=0&&S<=0)return c=d/(d-S),n.copy(i).addScaledVector(op,c);const w=p*S-y*g;if(w<=0&&g-p>=0&&y-S>=0)return EE.subVectors(s,r),c=(g-p)/(g-p+(y-S)),n.copy(r).addScaledVector(EE,c);const b=1/(w+E+v);return a=E*b,c=v*b,n.copy(i).addScaledVector(sp,a).addScaledVector(op,c)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},Fz=0,Hr=class extends ic{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Fz++}),this.uuid=qs(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=tx,this.stencilZFail=tx,this.stencilZPass=tx,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(n.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(n.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=this.flatShading),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(r){const s=[];for(const a in r){const c=r[a];delete c.metadata,s.push(c)}return s}if(t){const r=i(e.textures),s=i(e.images);r.length>0&&(n.textures=r),s.length>0&&(n.images=s)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.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++}},CR={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},ra={h:0,s:0,l:0},Zv={h:0,s:0,l:0};function Xb(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}var Tt=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Mr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,go.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=go.workingColorSpace){return this.r=e,this.g=t,this.b=n,go.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=go.workingColorSpace){if(e=iw(e,1),t=Ti(t,0,1),n=Ti(n,0,1),t===0)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,s=2*n-r;this.r=Xb(s,r,e+1/3),this.g=Xb(s,r,e),this.b=Xb(s,r,e-1/3)}return go.toWorkingColorSpace(this,i),this}setStyle(e,t=Mr){function n(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const s=i[1],a=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=i[1],s=r.length;if(s===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(s===6)return this.setHex(parseInt(r,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=Mr){const n=CR[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Gp(e.r),this.g=Gp(e.g),this.b=Gp(e.b),this}copyLinearToSRGB(e){return this.r=Ib(e.r),this.g=Ib(e.g),this.b=Ib(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Mr){return go.fromWorkingColorSpace(kr.copy(this),e),Math.round(Ti(kr.r*255,0,255))*65536+Math.round(Ti(kr.g*255,0,255))*256+Math.round(Ti(kr.b*255,0,255))}getHexString(e=Mr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=go.workingColorSpace){go.fromWorkingColorSpace(kr.copy(this),t);const n=kr.r,i=kr.g,r=kr.b,s=Math.max(n,i,r),a=Math.min(n,i,r);let c,u;const d=(a+s)/2;if(a===s)c=0,u=0;else{const p=s-a;switch(u=d<=.5?p/(s+a):p/(2-s-a),s){case n:c=(i-r)/p+(i<r?6:0);break;case i:c=(r-n)/p+2;break;case r:c=(n-i)/p+4;break}c/=6}return e.h=c,e.s=u,e.l=d,e}getRGB(e,t=go.workingColorSpace){return go.fromWorkingColorSpace(kr.copy(this),t),e.r=kr.r,e.g=kr.g,e.b=kr.b,e}getStyle(e=Mr){go.fromWorkingColorSpace(kr.copy(this),e);const t=kr.r,n=kr.g,i=kr.b;return e!=="srgb"?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(ra),ra.h+=e,ra.s+=t,ra.l+=n,this.setHSL(ra.h,ra.s,ra.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(ra),e.getHSL(Zv);const n=k1(ra.h,Zv.h,t),i=k1(ra.s,Zv.s,t),r=k1(ra.l,Zv.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},kr=new Tt;Tt.NAMES=CR;var Tu=class extends Hr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Tt(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.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.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}},$l=kz();function kz(){const e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512);for(let u=0;u<256;++u){const d=u-127;d<-27?(i[u]=0,i[u|256]=32768,r[u]=24,r[u|256]=24):d<-14?(i[u]=1024>>-d-14,i[u|256]=1024>>-d-14|32768,r[u]=-d-1,r[u|256]=-d-1):d<=15?(i[u]=d+15<<10,i[u|256]=d+15<<10|32768,r[u]=13,r[u|256]=13):d<128?(i[u]=31744,i[u|256]=64512,r[u]=24,r[u|256]=24):(i[u]=31744,i[u|256]=64512,r[u]=13,r[u|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),c=new Uint32Array(64);for(let u=1;u<1024;++u){let d=u<<13,p=0;for(;(d&8388608)===0;)d<<=1,p-=8388608;d&=-8388609,p+=947912704,s[u]=d|p}for(let u=1024;u<2048;++u)s[u]=939524096+(u-1024<<13);for(let u=1;u<31;++u)a[u]=u<<23;a[31]=1199570944,a[32]=2147483648;for(let u=33;u<63;++u)a[u]=2147483648+(u-32<<23);a[63]=3347054592;for(let u=1;u<64;++u)u!==32&&(c[u]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:c}}function ws(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=Ti(e,-65504,65504),$l.floatView[0]=e;const t=$l.uint32View[0],n=t>>23&511;return $l.baseTable[n]+((t&8388607)>>$l.shiftTable[n])}function D1(e){const t=e>>10;return $l.uint32View[0]=$l.mantissaTable[$l.offsetTable[t]+(e&1023)]+$l.exponentTable[t],$l.floatView[0]}var Gz={toHalfFloat:ws,fromHalfFloat:D1},ki=new ae,Kv=new pt,Kn=class{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Nx,this.updateRange={offset:0,count:-1},this.gpuType=Rx,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Kv.fromBufferAttribute(this,t),Kv.applyMatrix3(e),this.setXY(t,Kv.x,Kv.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)ki.fromBufferAttribute(this,t),ki.applyMatrix3(e),this.setXYZ(t,ki.x,ki.y,ki.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)ki.fromBufferAttribute(this,t),ki.applyMatrix4(e),this.setXYZ(t,ki.x,ki.y,ki.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ki.fromBufferAttribute(this,t),ki.applyNormalMatrix(e),this.setXYZ(t,ki.x,ki.y,ki.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ki.fromBufferAttribute(this,t),ki.transformDirection(e),this.setXYZ(t,ki.x,ki.y,ki.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Ys(t,this.array)),t}setX(e,t){return this.normalized&&(t=cn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Ys(t,this.array)),t}setY(e,t){return this.normalized&&(t=cn(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=Ys(t,this.array)),t}setZ(e,t){return this.normalized&&(t=cn(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=Ys(t,this.array)),t}setW(e,t){return this.normalized&&(t=cn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=cn(t,this.array),n=cn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=cn(t,this.array),n=cn(n,this.array),i=cn(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=cn(t,this.array),n=cn(n,this.array),i=cn(i,this.array),r=cn(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==35044&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}},Hz=class extends Kn{constructor(e,t,n){super(new Int8Array(e),t,n)}},Wz=class extends Kn{constructor(e,t,n){super(new Uint8Array(e),t,n)}},Xz=class extends Kn{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}},jz=class extends Kn{constructor(e,t,n){super(new Int16Array(e),t,n)}},aw=class extends Kn{constructor(e,t,n){super(new Uint16Array(e),t,n)}},Yz=class extends Kn{constructor(e,t,n){super(new Int32Array(e),t,n)}},lw=class extends Kn{constructor(e,t,n){super(new Uint32Array(e),t,n)}},qz=class extends Kn{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=D1(this.array[e*this.itemSize]);return this.normalized&&(t=Ys(t,this.array)),t}setX(e,t){return this.normalized&&(t=cn(t,this.array)),this.array[e*this.itemSize]=ws(t),this}getY(e){let t=D1(this.array[e*this.itemSize+1]);return this.normalized&&(t=Ys(t,this.array)),t}setY(e,t){return this.normalized&&(t=cn(t,this.array)),this.array[e*this.itemSize+1]=ws(t),this}getZ(e){let t=D1(this.array[e*this.itemSize+2]);return this.normalized&&(t=Ys(t,this.array)),t}setZ(e,t){return this.normalized&&(t=cn(t,this.array)),this.array[e*this.itemSize+2]=ws(t),this}getW(e){let t=D1(this.array[e*this.itemSize+3]);return this.normalized&&(t=Ys(t,this.array)),t}setW(e,t){return this.normalized&&(t=cn(t,this.array)),this.array[e*this.itemSize+3]=ws(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=cn(t,this.array),n=cn(n,this.array)),this.array[e+0]=ws(t),this.array[e+1]=ws(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=cn(t,this.array),n=cn(n,this.array),i=cn(i,this.array)),this.array[e+0]=ws(t),this.array[e+1]=ws(n),this.array[e+2]=ws(i),this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=cn(t,this.array),n=cn(n,this.array),i=cn(i,this.array),r=cn(r,this.array)),this.array[e+0]=ws(t),this.array[e+1]=ws(n),this.array[e+2]=ws(i),this.array[e+3]=ws(r),this}},Ot=class extends Kn{constructor(e,t,n){super(new Float32Array(e),t,n)}},$z=class extends Kn{constructor(e,t,n){super(new Float64Array(e),t,n)}},Zz=0,mo=new un,jb=new Wn,ap=new ae,Hs=new Ka,g1=new Ka,ur=new ae,vn=class RR extends ic{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Zz++}),this.uuid=qs(),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(t){return Array.isArray(t)?this.index=new(wR(t)?lw:aw)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,n){return this.attributes[t]=n,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,n,i=0){this.groups.push({start:t,count:n,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,n){this.drawRange.start=t,this.drawRange.count=n}applyMatrix4(t){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(t),n.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new _n().getNormalMatrix(t);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(t),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return mo.makeRotationFromQuaternion(t),this.applyMatrix4(mo),this}rotateX(t){return mo.makeRotationX(t),this.applyMatrix4(mo),this}rotateY(t){return mo.makeRotationY(t),this.applyMatrix4(mo),this}rotateZ(t){return mo.makeRotationZ(t),this.applyMatrix4(mo),this}translate(t,n,i){return mo.makeTranslation(t,n,i),this.applyMatrix4(mo),this}scale(t,n,i){return mo.makeScale(t,n,i),this.applyMatrix4(mo),this}lookAt(t){return jb.lookAt(t),jb.updateMatrix(),this.applyMatrix4(jb.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ap).negate(),this.translate(ap.x,ap.y,ap.z),this}setFromPoints(t){const n=[];for(let i=0,r=t.length;i<r;i++){const s=t[i];n.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Ot(n,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ka);const t=this.attributes.position,n=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new ae(-1/0,-1/0,-1/0),new ae(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),n)for(let i=0,r=n.length;i<r;i++){const s=n[i];Hs.setFromBufferAttribute(s),this.morphTargetsRelative?(ur.addVectors(this.boundingBox.min,Hs.min),this.boundingBox.expandByPoint(ur),ur.addVectors(this.boundingBox.max,Hs.max),this.boundingBox.expandByPoint(ur)):(this.boundingBox.expandByPoint(Hs.min),this.boundingBox.expandByPoint(Hs.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 fa);const t=this.attributes.position,n=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new ae,1/0);return}if(t){const i=this.boundingSphere.center;if(Hs.setFromBufferAttribute(t),n)for(let s=0,a=n.length;s<a;s++){const c=n[s];g1.setFromBufferAttribute(c),this.morphTargetsRelative?(ur.addVectors(Hs.min,g1.min),Hs.expandByPoint(ur),ur.addVectors(Hs.max,g1.max),Hs.expandByPoint(ur)):(Hs.expandByPoint(g1.min),Hs.expandByPoint(g1.max))}Hs.getCenter(i);let r=0;for(let s=0,a=t.count;s<a;s++)ur.fromBufferAttribute(t,s),r=Math.max(r,i.distanceToSquared(ur));if(n)for(let s=0,a=n.length;s<a;s++){const c=n[s],u=this.morphTargetsRelative;for(let d=0,p=c.count;d<p;d++)ur.fromBufferAttribute(c,d),u&&(ap.fromBufferAttribute(t,d),ur.add(ap)),r=Math.max(r,i.distanceToSquared(ur))}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 t=this.index,n=this.attributes;if(t===null||n.position===void 0||n.normal===void 0||n.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.array,r=n.position.array,s=n.normal.array,a=n.uv.array,c=r.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Kn(new Float32Array(4*c),4));const u=this.getAttribute("tangent").array,d=[],p=[];for(let z=0;z<c;z++)d[z]=new ae,p[z]=new ae;const g=new ae,v=new ae,y=new ae,S=new pt,E=new pt,w=new pt,b=new ae,T=new ae;function L(z,te,oe){g.fromArray(r,z*3),v.fromArray(r,te*3),y.fromArray(r,oe*3),S.fromArray(a,z*2),E.fromArray(a,te*2),w.fromArray(a,oe*2),v.sub(g),y.sub(g),E.sub(S),w.sub(S);const ee=1/(E.x*w.y-w.x*E.y);isFinite(ee)&&(b.copy(v).multiplyScalar(w.y).addScaledVector(y,-E.y).multiplyScalar(ee),T.copy(y).multiplyScalar(E.x).addScaledVector(v,-w.x).multiplyScalar(ee),d[z].add(b),d[te].add(b),d[oe].add(b),p[z].add(T),p[te].add(T),p[oe].add(T))}let C=this.groups;C.length===0&&(C=[{start:0,count:i.length}]);for(let z=0,te=C.length;z<te;++z){const oe=C[z],ee=oe.start,k=oe.count;for(let X=ee,$=ee+k;X<$;X+=3)L(i[X+0],i[X+1],i[X+2])}const P=new ae,O=new ae,B=new ae,U=new ae;function I(z){B.fromArray(s,z*3),U.copy(B);const te=d[z];P.copy(te),P.sub(B.multiplyScalar(B.dot(te))).normalize(),O.crossVectors(U,te);const oe=O.dot(p[z])<0?-1:1;u[z*4]=P.x,u[z*4+1]=P.y,u[z*4+2]=P.z,u[z*4+3]=oe}for(let z=0,te=C.length;z<te;++z){const oe=C[z],ee=oe.start,k=oe.count;for(let X=ee,$=ee+k;X<$;X+=3)I(i[X+0]),I(i[X+1]),I(i[X+2])}}computeVertexNormals(){const t=this.index,n=this.getAttribute("position");if(n!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Kn(new Float32Array(n.count*3),3),this.setAttribute("normal",i);else for(let v=0,y=i.count;v<y;v++)i.setXYZ(v,0,0,0);const r=new ae,s=new ae,a=new ae,c=new ae,u=new ae,d=new ae,p=new ae,g=new ae;if(t)for(let v=0,y=t.count;v<y;v+=3){const S=t.getX(v+0),E=t.getX(v+1),w=t.getX(v+2);r.fromBufferAttribute(n,S),s.fromBufferAttribute(n,E),a.fromBufferAttribute(n,w),p.subVectors(a,s),g.subVectors(r,s),p.cross(g),c.fromBufferAttribute(i,S),u.fromBufferAttribute(i,E),d.fromBufferAttribute(i,w),c.add(p),u.add(p),d.add(p),i.setXYZ(S,c.x,c.y,c.z),i.setXYZ(E,u.x,u.y,u.z),i.setXYZ(w,d.x,d.y,d.z)}else for(let v=0,y=n.count;v<y;v+=3)r.fromBufferAttribute(n,v+0),s.fromBufferAttribute(n,v+1),a.fromBufferAttribute(n,v+2),p.subVectors(a,s),g.subVectors(r,s),p.cross(g),i.setXYZ(v+0,p.x,p.y,p.z),i.setXYZ(v+1,p.x,p.y,p.z),i.setXYZ(v+2,p.x,p.y,p.z);this.normalizeNormals(),i.needsUpdate=!0}}merge(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeGeometries() instead."),this}normalizeNormals(){const t=this.attributes.normal;for(let n=0,i=t.count;n<i;n++)ur.fromBufferAttribute(t,n),ur.normalize(),t.setXYZ(n,ur.x,ur.y,ur.z)}toNonIndexed(){function t(c,u){const d=c.array,p=c.itemSize,g=c.normalized,v=new d.constructor(u.length*p);let y=0,S=0;for(let E=0,w=u.length;E<w;E++){c.isInterleavedBufferAttribute?y=u[E]*c.data.stride+c.offset:y=u[E]*p;for(let b=0;b<p;b++)v[S++]=d[y++]}return new Kn(v,p,g)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new RR,i=this.index.array,r=this.attributes;for(const c in r){const u=r[c],d=t(u,i);n.setAttribute(c,d)}const s=this.morphAttributes;for(const c in s){const u=[],d=s[c];for(let p=0,g=d.length;p<g;p++){const v=d[p],y=t(v,i);u.push(y)}n.morphAttributes[c]=u}n.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let c=0,u=a.length;c<u;c++){const d=a[c];n.addGroup(d.start,d.count,d.materialIndex)}return n}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){const u=this.parameters;for(const d in u)u[d]!==void 0&&(t[d]=u[d]);return t}t.data={attributes:{}};const n=this.index;n!==null&&(t.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const i=this.attributes;for(const u in i){const d=i[u];t.data.attributes[u]=d.toJSON(t.data)}const r={};let s=!1;for(const u in this.morphAttributes){const d=this.morphAttributes[u],p=[];for(let g=0,v=d.length;g<v;g++){const y=d[g];p.push(y.toJSON(t.data))}p.length>0&&(r[u]=p,s=!0)}s&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const c=this.boundingSphere;return c!==null&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=t.name;const i=t.index;i!==null&&this.setIndex(i.clone(n));const r=t.attributes;for(const d in r){const p=r[d];this.setAttribute(d,p.clone(n))}const s=t.morphAttributes;for(const d in s){const p=[],g=s[d];for(let v=0,y=g.length;v<y;v++)p.push(g[v].clone(n));this.morphAttributes[d]=p}this.morphTargetsRelative=t.morphTargetsRelative;const a=t.groups;for(let d=0,p=a.length;d<p;d++){const g=a[d];this.addGroup(g.start,g.count,g.materialIndex)}const c=t.boundingBox;c!==null&&(this.boundingBox=c.clone());const u=t.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},TE=new un,Vh=new om,Qv=new fa,CE=new ae,lp=new ae,cp=new ae,up=new ae,Yb=new ae,Jv=new ae,ey=new pt,ty=new pt,ny=new pt,RE=new ae,LE=new ae,PE=new ae,iy=new ae,ry=new ae,Ar=class extends Wn{constructor(e=new vn,t=new Tu){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=e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,r=n.length;i<r;i++){const s=n[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=i}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,s=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const a=this.morphTargetInfluences;if(r&&a){Jv.set(0,0,0);for(let c=0,u=r.length;c<u;c++){const d=a[c],p=r[c];d!==0&&(Yb.fromBufferAttribute(p,e),s?Jv.addScaledVector(Yb,d):Jv.addScaledVector(Yb.sub(t),d))}t.add(Jv)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Qv.copy(n.boundingSphere),Qv.applyMatrix4(r),Vh.copy(e.ray).recast(e.near),!(Qv.containsPoint(Vh.origin)===!1&&(Vh.intersectSphere(Qv,CE)===null||Vh.origin.distanceToSquared(CE)>(e.far-e.near)**2))&&(TE.copy(r).invert(),Vh.copy(e.ray).applyMatrix4(TE),!(n.boundingBox!==null&&Vh.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Vh)))}_computeIntersections(e,t,n){let i;const r=this.geometry,s=this.material,a=r.index,c=r.attributes.position,u=r.attributes.uv,d=r.attributes.uv1,p=r.attributes.normal,g=r.groups,v=r.drawRange;if(a!==null)if(Array.isArray(s))for(let y=0,S=g.length;y<S;y++){const E=g[y],w=s[E.materialIndex],b=Math.max(E.start,v.start),T=Math.min(a.count,Math.min(E.start+E.count,v.start+v.count));for(let L=b,C=T;L<C;L+=3){const P=a.getX(L),O=a.getX(L+1),B=a.getX(L+2);i=sy(this,w,e,n,u,d,p,P,O,B),i&&(i.faceIndex=Math.floor(L/3),i.face.materialIndex=E.materialIndex,t.push(i))}}else{const y=Math.max(0,v.start),S=Math.min(a.count,v.start+v.count);for(let E=y,w=S;E<w;E+=3){const b=a.getX(E),T=a.getX(E+1),L=a.getX(E+2);i=sy(this,s,e,n,u,d,p,b,T,L),i&&(i.faceIndex=Math.floor(E/3),t.push(i))}}else if(c!==void 0)if(Array.isArray(s))for(let y=0,S=g.length;y<S;y++){const E=g[y],w=s[E.materialIndex],b=Math.max(E.start,v.start),T=Math.min(c.count,Math.min(E.start+E.count,v.start+v.count));for(let L=b,C=T;L<C;L+=3){const P=L,O=L+1,B=L+2;i=sy(this,w,e,n,u,d,p,P,O,B),i&&(i.faceIndex=Math.floor(L/3),i.face.materialIndex=E.materialIndex,t.push(i))}}else{const y=Math.max(0,v.start),S=Math.min(c.count,v.start+v.count);for(let E=y,w=S;E<w;E+=3){const b=E,T=E+1,L=E+2;i=sy(this,s,e,n,u,d,p,b,T,L),i&&(i.faceIndex=Math.floor(E/3),t.push(i))}}}};function Kz(e,t,n,i,r,s,a,c){let u;if(t.side===1?u=i.intersectTriangle(a,s,r,!0,c):u=i.intersectTriangle(r,s,a,t.side===0,c),u===null)return null;ry.copy(c),ry.applyMatrix4(e.matrixWorld);const d=n.ray.origin.distanceTo(ry);return d<n.near||d>n.far?null:{distance:d,point:ry.clone(),object:e}}function sy(e,t,n,i,r,s,a,c,u,d){e.getVertexPosition(c,lp),e.getVertexPosition(u,cp),e.getVertexPosition(d,up);const p=Kz(e,t,n,i,lp,cp,up,iy);if(p){r&&(ey.fromBufferAttribute(r,c),ty.fromBufferAttribute(r,u),ny.fromBufferAttribute(r,d),p.uv=rf.getInterpolation(iy,lp,cp,up,ey,ty,ny,new pt)),s&&(ey.fromBufferAttribute(s,c),ty.fromBufferAttribute(s,u),ny.fromBufferAttribute(s,d),p.uv1=rf.getInterpolation(iy,lp,cp,up,ey,ty,ny,new pt),p.uv2=p.uv1),a&&(RE.fromBufferAttribute(a,c),LE.fromBufferAttribute(a,u),PE.fromBufferAttribute(a,d),p.normal=rf.getInterpolation(iy,lp,cp,up,RE,LE,PE,new ae),p.normal.dot(i.direction)>0&&p.normal.multiplyScalar(-1));const g={a:c,b:u,c:d,normal:new ae,materialIndex:0};rf.getNormal(lp,cp,up,g.normal),p.face=g}return p}var am=class LR extends vn{constructor(t=1,n=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:n,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};const c=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const u=[],d=[],p=[],g=[];let v=0,y=0;S("z","y","x",-1,-1,i,n,t,a,s,0),S("z","y","x",1,-1,i,n,-t,a,s,1),S("x","z","y",1,1,t,i,n,r,a,2),S("x","z","y",1,-1,t,i,-n,r,a,3),S("x","y","z",1,-1,t,n,i,r,s,4),S("x","y","z",-1,-1,t,n,-i,r,s,5),this.setIndex(u),this.setAttribute("position",new Ot(d,3)),this.setAttribute("normal",new Ot(p,3)),this.setAttribute("uv",new Ot(g,2));function S(E,w,b,T,L,C,P,O,B,U,I){const z=C/B,te=P/U,oe=C/2,ee=P/2,k=O/2,X=B+1,$=U+1;let j=0,J=0;const xe=new ae;for(let de=0;de<$;de++){const fe=de*te-ee;for(let F=0;F<X;F++)xe[E]=(F*z-oe)*T,xe[w]=fe*L,xe[b]=k,d.push(xe.x,xe.y,xe.z),xe[E]=0,xe[w]=0,xe[b]=O>0?1:-1,p.push(xe.x,xe.y,xe.z),g.push(F/B),g.push(1-de/U),j+=1}for(let de=0;de<U;de++)for(let fe=0;fe<B;fe++){const F=v+fe+X*de,re=v+fe+X*(de+1),ue=v+(fe+1)+X*(de+1),_e=v+(fe+1)+X*de;u.push(F,re,_e),u.push(re,ue,_e),J+=6}c.addGroup(y,J,I),y+=J,v+=j}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new LR(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};function Qp(e){const t={};for(const n in e){t[n]={};for(const i in e[n]){const r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null):t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}}return t}function ss(e){const t={};for(let n=0;n<e.length;n++){const i=Qp(e[n]);for(const r in i)t[r]=i[r]}return t}function Qz(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}function PR(e){return e.getRenderTarget()===null?e.outputColorSpace:qa}var NR={clone:Qp,merge:ss},Jz=`void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,e6=`void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`,$a=class extends Hr{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Jz,this.fragmentShader=e6,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!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=Qp(e.uniforms),this.uniformsGroups=Qz(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 i in this.uniforms){const r=this.uniforms[i].value;r&&r.isTexture?t.uniforms[i]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[i]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[i]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[i]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[i]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[i]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[i]={type:"m4",value:r.toArray()}:t.uniforms[i]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}},Dx=class extends Wn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new un,this.projectionMatrix=new un,this.projectionMatrixInverse=new un,this.coordinateSystem=Zp}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){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}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)}},wr=class extends Dx{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Kp*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(af*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Kp*2*Math.atan(Math.tan(af*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,r,s){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(af*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const s=this.view;if(this.view!==null&&this.view.enabled){const c=s.fullWidth,u=s.fullHeight;r+=s.offsetX*i/c,t-=s.offsetY*n/u,i*=s.width/c,n*=s.height/u}const a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},hp=-90,fp=1,IR=class extends Wn{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null;const i=new wr(hp,fp,e,t);i.layers=this.layers,this.add(i);const r=new wr(hp,fp,e,t);r.layers=this.layers,this.add(r);const s=new wr(hp,fp,e,t);s.layers=this.layers,this.add(s);const a=new wr(hp,fp,e,t);a.layers=this.layers,this.add(a);const c=new wr(hp,fp,e,t);c.layers=this.layers,this.add(c);const u=new wr(hp,fp,e,t);u.layers=this.layers,this.add(u)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,s,a,c]=t;for(const u of t)this.remove(u);if(e===2e3)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===2001)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const u of t)this.add(u),u.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const n=this.renderTarget;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[i,r,s,a,c,u]=this.children,d=e.getRenderTarget(),p=e.toneMapping,g=e.xr.enabled;e.toneMapping=0,e.xr.enabled=!1;const v=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,r),e.setRenderTarget(n,2),e.render(t,s),e.setRenderTarget(n,3),e.render(t,a),e.setRenderTarget(n,4),e.render(t,c),n.texture.generateMipmaps=v,e.setRenderTarget(n,5),e.render(t,u),e.setRenderTarget(d),e.toneMapping=p,e.xr.enabled=g,n.texture.needsPMREMUpdate=!0}},x0=class extends Cr{constructor(e,t,n,i,r,s,a,c,u,d){e=e!==void 0?e:[],t=t!==void 0?t:301,super(e,t,n,i,r,s,a,c,u,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},OR=class extends la{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];t.encoding!==void 0&&(G1("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===3001?Mr:""),this.texture=new x0(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Er}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
varying vec3 vWorldDirection;
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}
`,fragmentShader:`
uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
}
`},i=new am(5,5,5),r=new $a({name:"CubemapFromEquirect",uniforms:Qp(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=t;const s=new Ar(i,r),a=t.minFilter;return t.minFilter===1008&&(t.minFilter=Er),new IR(1,10,this).update(e,s),t.minFilter=a,s.geometry.dispose(),s.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let s=0;s<6;s++)e.setRenderTarget(this,s),e.clear(t,n,i);e.setRenderTarget(r)}},qb=new ae,t6=new ae,n6=new _n,_u=class{constructor(e=new ae(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=qb.subVectors(n,t).cross(t6.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(qb),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||n6.getNormalMatrix(e),i=this.coplanarPoint(qb).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},Fh=new fa,oy=new ae,zx=class{constructor(e=new _u,t=new _u,n=new _u,i=new _u,r=new _u,s=new _u){this.planes=[e,t,n,i,r,s]}set(e,t,n,i,r,s){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(s),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Zp){const n=this.planes,i=e.elements,r=i[0],s=i[1],a=i[2],c=i[3],u=i[4],d=i[5],p=i[6],g=i[7],v=i[8],y=i[9],S=i[10],E=i[11],w=i[12],b=i[13],T=i[14],L=i[15];if(n[0].setComponents(c-r,g-u,E-v,L-w).normalize(),n[1].setComponents(c+r,g+u,E+v,L+w).normalize(),n[2].setComponents(c+s,g+d,E+y,L+b).normalize(),n[3].setComponents(c-s,g-d,E-y,L-b).normalize(),n[4].setComponents(c-a,g-p,E-S,L-T).normalize(),t===2e3)n[5].setComponents(c+a,g+p,E+S,L+T).normalize();else if(t===2001)n[5].setComponents(a,p,S,T).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(),Fh.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Fh.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Fh)}intersectsSprite(e){return Fh.center.set(0,0,0),Fh.radius=.7071067811865476,Fh.applyMatrix4(e.matrixWorld),this.intersectsSphere(Fh)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(oy.x=i.normal.x>0?e.max.x:e.min.x,oy.y=i.normal.y>0?e.max.y:e.min.y,oy.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(oy)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function DR(){let e=null,t=!1,n=null,i=null;function r(s,a){n(s,a),i=e.requestAnimationFrame(r)}return{start:function(){t!==!0&&n!==null&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(s){n=s},setContext:function(s){e=s}}}function i6(e,t){const n=t.isWebGL2,i=new WeakMap;function r(d,p){const g=d.array,v=d.usage,y=e.createBuffer();e.bindBuffer(p,y),e.bufferData(p,g,v),d.onUploadCallback();let S;if(g instanceof Float32Array)S=e.FLOAT;else if(g instanceof Uint16Array)if(d.isFloat16BufferAttribute)if(n)S=e.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else S=e.UNSIGNED_SHORT;else if(g instanceof Int16Array)S=e.SHORT;else if(g instanceof Uint32Array)S=e.UNSIGNED_INT;else if(g instanceof Int32Array)S=e.INT;else if(g instanceof Int8Array)S=e.BYTE;else if(g instanceof Uint8Array)S=e.UNSIGNED_BYTE;else if(g instanceof Uint8ClampedArray)S=e.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+g);return{buffer:y,type:S,bytesPerElement:g.BYTES_PER_ELEMENT,version:d.version}}function s(d,p,g){const v=p.array,y=p.updateRange;e.bindBuffer(g,d),y.count===-1?e.bufferSubData(g,0,v):(n?e.bufferSubData(g,y.offset*v.BYTES_PER_ELEMENT,v,y.offset,y.count):e.bufferSubData(g,y.offset*v.BYTES_PER_ELEMENT,v.subarray(y.offset,y.offset+y.count)),y.count=-1),p.onUploadCallback()}function a(d){return d.isInterleavedBufferAttribute&&(d=d.data),i.get(d)}function c(d){d.isInterleavedBufferAttribute&&(d=d.data);const p=i.get(d);p&&(e.deleteBuffer(p.buffer),i.delete(d))}function u(d,p){if(d.isGLBufferAttribute){const v=i.get(d);(!v||v.version<d.version)&&i.set(d,{buffer:d.buffer,type:d.type,bytesPerElement:d.elementSize,version:d.version});return}d.isInterleavedBufferAttribute&&(d=d.data);const g=i.get(d);g===void 0?i.set(d,r(d,p)):g.version<d.version&&(s(g.buffer,d,p),g.version=d.version)}return{get:a,remove:c,update:u}}var Ux=class zR extends vn{constructor(t=1,n=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:n,widthSegments:i,heightSegments:r};const s=t/2,a=n/2,c=Math.floor(i),u=Math.floor(r),d=c+1,p=u+1,g=t/c,v=n/u,y=[],S=[],E=[],w=[];for(let b=0;b<p;b++){const T=b*v-a;for(let L=0;L<d;L++){const C=L*g-s;S.push(C,-T,0),E.push(0,0,1),w.push(L/c),w.push(1-b/u)}}for(let b=0;b<u;b++)for(let T=0;T<c;T++){const L=T+d*b,C=T+d*(b+1),P=T+1+d*(b+1),O=T+1+d*b;y.push(L,C,O),y.push(C,P,O)}this.setIndex(y),this.setAttribute("position",new Ot(S,3)),this.setAttribute("normal",new Ot(E,3)),this.setAttribute("uv",new Ot(w,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new zR(t.width,t.height,t.widthSegments,t.heightSegments)}},ln={alphamap_fragment:`#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,alphamap_pars_fragment:`#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,alphatest_fragment:`#ifdef USE_ALPHATEST
if ( diffuseColor.a < alphaTest ) discard;
#endif`,alphatest_pars_fragment:`#ifdef USE_ALPHATEST
uniform float alphaTest;
#endif`,aomap_fragment:`#ifdef USE_AOMAP
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_ENVMAP ) && defined( STANDARD )
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
#endif
#endif`,aomap_pars_fragment:`#ifdef USE_AOMAP
uniform sampler2D aoMap;
uniform float aoMapIntensity;
#endif`,begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
#endif`,bsdfs:`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`,iridescence_fragment:`#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 R21 = R12;
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`,bumpmap_pars_fragment:`#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 = dFdx( surf_pos.xyz );
vec3 vSigmaY = 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`,clipping_planes_fragment:`#if NUM_CLIPPING_PLANES > 0
vec4 plane;
#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`,clipping_planes_pars_fragment:`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,clipping_planes_pars_vertex:`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
#endif`,clipping_planes_vertex:`#if NUM_CLIPPING_PLANES > 0
vClipPosition = - mvPosition.xyz;
#endif`,color_fragment:`#if defined( USE_COLOR_ALPHA )
diffuseColor *= vColor;
#elif defined( USE_COLOR )
diffuseColor.rgb *= vColor;
#endif`,color_pars_fragment:`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR )
varying vec3 vColor;
#endif`,color_pars_vertex:`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
varying vec3 vColor;
#endif`,color_vertex:`#if defined( USE_COLOR_ALPHA )
vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
vColor.xyz *= instanceColor.xyz;
#endif`,common:`#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;
};
struct GeometricContext {
vec3 position;
vec3 normal;
vec3 viewDir;
#ifdef USE_CLEARCOAT
vec3 clearcoatNormal;
#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`,cube_uv_reflection_fragment:`#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_v0 0.339
#define cubeUV_m0 - 2.0
#define cubeUV_r1 0.8
#define cubeUV_v1 0.276
#define cubeUV_m1 - 1.0
#define cubeUV_r4 0.4
#define cubeUV_v4 0.046
#define cubeUV_m4 2.0
#define cubeUV_r5 0.305
#define cubeUV_v5 0.016
#define cubeUV_m5 3.0
#define cubeUV_r6 0.21
#define cubeUV_v6 0.0038
#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`,defaultnormal_vertex:`vec3 transformedNormal = objectNormal;
#ifdef USE_INSTANCING
mat3 m = mat3( instanceMatrix );
transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
transformedNormal = m * transformedNormal;
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#ifdef FLIP_SIDED
transformedTangent = - transformedTangent;
#endif
#endif`,displacementmap_pars_vertex:`#ifdef USE_DISPLACEMENTMAP
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
#endif`,displacementmap_vertex:`#ifdef USE_DISPLACEMENTMAP
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,emissivemap_fragment:`#ifdef USE_EMISSIVEMAP
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,emissivemap_pars_fragment:`#ifdef USE_EMISSIVEMAP
uniform sampler2D emissiveMap;
#endif`,encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:`vec4 LinearToLinear( in vec4 value ) {
return value;
}
vec4 LinearTosRGB( 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 );
}`,envmap_fragment:`#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, 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`,envmap_common_pars_fragment:`#ifdef USE_ENVMAP
uniform float envMapIntensity;
uniform float flipEnvMap;
#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#else
uniform sampler2D envMap;
#endif
#endif`,envmap_pars_fragment:`#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`,envmap_pars_vertex:`#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`,envmap_physical_pars_fragment:`#ifdef USE_ENVMAP
vec3 getIBLIrradiance( const in vec3 normal ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
vec4 envMapColor = textureCubeUV( envMap, 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, 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`,envmap_vertex:`#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`,fog_vertex:`#ifdef USE_FOG
vFogDepth = - mvPosition.z;
#endif`,fog_pars_vertex:`#ifdef USE_FOG
varying float vFogDepth;
#endif`,fog_fragment:`#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`,fog_pars_fragment:`#ifdef USE_FOG
uniform vec3 fogColor;
varying float vFogDepth;
#ifdef FOG_EXP2
uniform float fogDensity;
#else
uniform float fogNear;
uniform float fogFar;
#endif
#endif`,gradientmap_pars_fragment:`#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
}`,lightmap_fragment:`#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
reflectedLight.indirectDiffuse += lightMapIrradiance;
#endif`,lightmap_pars_fragment:`#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightMapIntensity;
#endif`,lights_lambert_fragment:`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,lights_lambert_pars_fragment:`varying vec3 vViewPosition;
struct LambertMaterial {
vec3 diffuseColor;
float specularStrength;
};
void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, 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`,lights_pars_begin:`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
uniform vec3 lightProbe[ 9 ];
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 ) {
#if defined ( LEGACY_LIGHTS )
if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
}
return 1.0;
#else
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
if ( cutoffDistance > 0.0 ) {
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
}
return distanceFalloff;
#endif
}
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, const in GeometricContext geometry, 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 GeometricContext geometry, out IncidentLight light ) {
vec3 lVector = pointLight.position - geometry.position;
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 GeometricContext geometry, out IncidentLight light ) {
vec3 lVector = spotLight.position - geometry.position;
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`,lights_toon_fragment:`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,lights_toon_pars_fragment:`varying vec3 vViewPosition;
struct ToonMaterial {
vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, 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`,lights_phong_fragment:`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,lights_phong_pars_fragment:`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
vec3 diffuseColor;
vec3 specularColor;
float specularShininess;
float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, 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`,lights_physical_fragment:`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
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_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 );
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`,lights_physical_pars_fragment:`struct PhysicalMaterial {
vec3 diffuseColor;
float roughness;
vec3 specularColor;
float specularF90;
#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 clearcoatSpecular = vec3( 0.0 );
vec3 sheenSpecular = 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
vec3 normal = geometry.normal;
vec3 viewDir = geometry.viewDir;
vec3 position = geometry.position;
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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
#ifdef USE_CLEARCOAT
float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
vec3 ccIrradiance = dotNLcc * directLight.color;
clearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );
#endif
#ifdef USE_SHEEN
sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );
#endif
reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
#ifdef USE_CLEARCOAT
clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
#endif
#ifdef USE_SHEEN
sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );
#endif
vec3 singleScattering = vec3( 0.0 );
vec3 multiScattering = vec3( 0.0 );
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
#ifdef USE_IRIDESCENCE
computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
#else
computeMultiscattering( geometry.normal, geometry.viewDir, 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 );
}`,lights_fragment_begin:`
GeometricContext geometry;
geometry.position = - vViewPosition;
geometry.normal = normal;
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
#ifdef USE_CLEARCOAT
geometry.clearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
float dotNVi = saturate( dot( normal, geometry.viewDir ) );
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, geometry, 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.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
#endif
RE_Direct( directLight, geometry, 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, geometry, 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.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometry, 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, geometry, 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.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometry, 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, geometry, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
vec3 iblIrradiance = vec3( 0.0 );
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
#if ( NUM_HEMI_LIGHTS > 0 )
#pragma unroll_loop_start
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
}
#pragma unroll_loop_end
#endif
#endif
#if defined( RE_IndirectSpecular )
vec3 radiance = vec3( 0.0 );
vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,lights_fragment_maps:`#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( geometry.normal );
#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
#ifdef USE_ANISOTROPY
radiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy );
#else
radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );
#endif
#ifdef USE_CLEARCOAT
clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );
#endif
#endif`,lights_fragment_end:`#if defined( RE_IndirectDiffuse )
RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
#endif`,logdepthbuf_fragment:`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,logdepthbuf_pars_fragment:`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
#endif`,logdepthbuf_pars_vertex:`#ifdef USE_LOGDEPTHBUF
#ifdef USE_LOGDEPTHBUF_EXT
varying float vFragDepth;
varying float vIsPerspective;
#else
uniform float logDepthBufFC;
#endif
#endif`,logdepthbuf_vertex:`#ifdef USE_LOGDEPTHBUF
#ifdef USE_LOGDEPTHBUF_EXT
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#else
if ( isPerspectiveMatrix( projectionMatrix ) ) {
gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
gl_Position.z *= gl_Position.w;
}
#endif
#endif`,map_fragment:`#ifdef USE_MAP
diffuseColor *= texture2D( map, vMapUv );
#endif`,map_pars_fragment:`#ifdef USE_MAP
uniform sampler2D map;
#endif`,map_particle_fragment:`#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`,map_particle_pars_fragment:`#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`,metalnessmap_fragment:`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
metalnessFactor *= texelMetalness.b;
#endif`,metalnessmap_pars_fragment:`#ifdef USE_METALNESSMAP
uniform sampler2D metalnessMap;
#endif`,morphcolor_vertex:`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
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`,morphnormal_vertex:`#ifdef USE_MORPHNORMALS
objectNormal *= morphTargetBaseInfluence;
#ifdef MORPHTARGETS_TEXTURE
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
}
#else
objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
#endif
#endif`,morphtarget_pars_vertex:`#ifdef USE_MORPHTARGETS
uniform float morphTargetBaseInfluence;
#ifdef MORPHTARGETS_TEXTURE
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
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 );
}
#else
#ifndef USE_MORPHNORMALS
uniform float morphTargetInfluences[ 8 ];
#else
uniform float morphTargetInfluences[ 4 ];
#endif
#endif
#endif`,morphtarget_vertex:`#ifdef USE_MORPHTARGETS
transformed *= morphTargetBaseInfluence;
#ifdef MORPHTARGETS_TEXTURE
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
}
#else
transformed += morphTarget0 * morphTargetInfluences[ 0 ];
transformed += morphTarget1 * morphTargetInfluences[ 1 ];
transformed += morphTarget2 * morphTargetInfluences[ 2 ];
transformed += morphTarget3 * morphTargetInfluences[ 3 ];
#ifndef USE_MORPHNORMALS
transformed += morphTarget4 * morphTargetInfluences[ 4 ];
transformed += morphTarget5 * morphTargetInfluences[ 5 ];
transformed += morphTarget6 * morphTargetInfluences[ 6 ];
transformed += morphTarget7 * morphTargetInfluences[ 7 ];
#endif
#endif
#endif`,normal_fragment_begin:`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, vNormalMapUv );
#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 geometryNormal = normal;`,normal_fragment_maps:`#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`,normal_pars_fragment:`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,normal_pars_vertex:`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,normal_vertex:`#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
#endif`,normalmap_pars_fragment:`#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`,clearcoat_normal_fragment_begin:`#ifdef USE_CLEARCOAT
vec3 clearcoatNormal = geometryNormal;
#endif`,clearcoat_normal_fragment_maps:`#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,clearcoat_pars_fragment:`#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`,iridescence_pars_fragment:`#ifdef USE_IRIDESCENCEMAP
uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform sampler2D iridescenceThicknessMap;
#endif`,output_fragment:`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,packing:`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 );
}`,premultiplied_alpha_fragment:`#ifdef PREMULTIPLIED_ALPHA
gl_FragColor.rgb *= gl_FragColor.a;
#endif`,project_vertex:`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_INSTANCING
mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,dithering_fragment:`#ifdef DITHERING
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,dithering_pars_fragment:`#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`,roughnessmap_fragment:`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
roughnessFactor *= texelRoughness.g;
#endif`,roughnessmap_pars_fragment:`#ifdef USE_ROUGHNESSMAP
uniform sampler2D roughnessMap;
#endif`,shadowmap_pars_fragment:`#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 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 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 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 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 shadow;
}
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 shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
vec3 lightToPosition = shadowCoord.xyz;
float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
vec3 bd3D = normalize( lightToPosition );
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
return (
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
return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
#endif
}
#endif`,shadowmap_pars_vertex:`#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 shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
struct SpotLightShadow {
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 shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
#endif`,shadowmap_vertex:`#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`,shadowmask_pars_fragment:`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.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.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.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
}
#pragma unroll_loop_end
#endif
#endif
return shadow;
}`,skinbase_vertex:`#ifdef USE_SKINNING
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,skinning_pars_vertex:`#ifdef USE_SKINNING
uniform mat4 bindMatrix;
uniform mat4 bindMatrixInverse;
uniform highp sampler2D boneTexture;
uniform int boneTextureSize;
mat4 getBoneMatrix( const in float i ) {
float j = i * 4.0;
float x = mod( j, float( boneTextureSize ) );
float y = floor( j / float( boneTextureSize ) );
float dx = 1.0 / float( boneTextureSize );
float dy = 1.0 / float( boneTextureSize );
y = dy * ( y + 0.5 );
vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
mat4 bone = mat4( v1, v2, v3, v4 );
return bone;
}
#endif`,skinning_vertex:`#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`,skinnormal_vertex:`#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`,specularmap_fragment:`float specularStrength;
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
#endif`,specularmap_pars_fragment:`#ifdef USE_SPECULARMAP
uniform sampler2D specularMap;
#endif`,tonemapping_fragment:`#if defined( TONE_MAPPING )
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,tonemapping_pars_fragment:`#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 );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,transmission_fragment:`#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.ior, material.thickness,
material.attenuationColor, material.attenuationDistance );
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
#endif`,transmission_pars_fragment:`#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 ior, const in float thickness,
const in vec3 attenuationColor, const in float attenuationDistance ) {
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;
vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
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`,uv_pars_fragment:`#ifdef USE_UV
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`,uv_pars_vertex:`#ifdef USE_UV
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`,uv_vertex:`#ifdef USE_UV
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`,worldpos_vertex:`#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_INSTANCING
worldPosition = instanceMatrix * worldPosition;
#endif
worldPosition = modelMatrix * worldPosition;
#endif`,background_vert:`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,background_frag:`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
vec4 texColor = texture2D( t2D, vUv );
texColor.rgb *= backgroundIntensity;
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <encodings_fragment>
}`,backgroundCube_vert:`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,backgroundCube_frag:`#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;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
#ifdef ENVMAP_TYPE_CUBE
vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
#elif defined( ENVMAP_TYPE_CUBE_UV )
vec4 texColor = textureCubeUV( envMap, 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 <encodings_fragment>
}`,cube_vert:`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,cube_frag:`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 <encodings_fragment>
}`,depth_vert:`#include <common>
#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 <skinbase_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;
}`,depth_frag:`#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 <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( 1.0 );
#if DEPTH_PACKING == 3200
diffuseColor.a = opacity;
#endif
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_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
}`,distanceRGBA_vert:`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#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 <skinbase_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;
}`,distanceRGBA_frag:`#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 <clipping_planes_pars_fragment>
void main () {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( 1.0 );
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
float dist = length( vWorldPosition - referencePosition );
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
dist = saturate( dist );
gl_FragColor = packDepthToRGBA( dist );
}`,equirect_vert:`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}`,equirect_frag:`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 <encodings_fragment>
}`,linedashed_vert:`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 <morphcolor_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}`,linedashed_frag:`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() {
#include <clipping_planes_fragment>
if ( mod( vLineDistance, totalSize ) > dashSize ) {
discard;
}
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
outgoingLight = diffuseColor.rgb;
#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,meshbasic_vert:`#include <common>
#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 <morphcolor_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>
}`,meshbasic_frag:`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 <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() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_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 <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,meshlambert_vert:`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#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 <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>
}`,meshlambert_frag:`#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 <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() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
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 <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 <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,meshmatcap_vert:`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#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 <morphcolor_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;
}`,meshmatcap_frag:`#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 <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() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_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 <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,meshnormal_vert:`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
#include <common>
#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 <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>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
vViewPosition = - mvPosition.xyz;
#endif
}`,meshnormal_frag:`#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() {
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
#ifdef OPAQUE
gl_FragColor.a = 1.0;
#endif
}`,meshphong_vert:`#define PHONG
varying vec3 vViewPosition;
#include <common>
#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 <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>
}`,meshphong_frag:`#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 <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() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
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 <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 <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,meshphysical_vert:`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
varying vec3 vWorldPosition;
#endif
#include <common>
#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 <morphcolor_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
}`,meshphysical_frag:`#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_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 <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() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
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 <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 + sheenSpecular;
#endif
#ifdef USE_CLEARCOAT
float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;
#endif
#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,meshtoon_vert:`#define TOON
varying vec3 vViewPosition;
#include <common>
#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 <morphcolor_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>
}`,meshtoon_frag:`#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 <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() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
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 <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 <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,points_vert:`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 <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>
}`,points_frag:`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_particle_fragment>
#include <color_fragment>
#include <alphatest_fragment>
outgoingLight = diffuseColor.rgb;
#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,shadow_vert:`#include <common>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
#include <beginnormal_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>
}`,shadow_frag:`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 <encodings_fragment>
#include <fog_fragment>
}`,sprite_vert:`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>
}`,sprite_frag:`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 <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
outgoingLight = diffuseColor.rgb;
#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
}`},bt={common:{diffuse:{value:new Tt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new _n},alphaMap:{value:null},alphaMapTransform:{value:new _n},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new _n}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new _n}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new _n}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new _n},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new _n},normalScale:{value:new pt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new _n},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new _n}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new _n}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new _n}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Tt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{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 Tt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new _n},alphaTest:{value:0},uvTransform:{value:new _n}},sprite:{diffuse:{value:new Tt(16777215)},opacity:{value:1},center:{value:new pt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new _n},alphaMap:{value:null},alphaMapTransform:{value:new _n},alphaTest:{value:0}}},oa={basic:{uniforms:ss([bt.common,bt.specularmap,bt.envmap,bt.aomap,bt.lightmap,bt.fog]),vertexShader:ln.meshbasic_vert,fragmentShader:ln.meshbasic_frag},lambert:{uniforms:ss([bt.common,bt.specularmap,bt.envmap,bt.aomap,bt.lightmap,bt.emissivemap,bt.bumpmap,bt.normalmap,bt.displacementmap,bt.fog,bt.lights,{emissive:{value:new Tt(0)}}]),vertexShader:ln.meshlambert_vert,fragmentShader:ln.meshlambert_frag},phong:{uniforms:ss([bt.common,bt.specularmap,bt.envmap,bt.aomap,bt.lightmap,bt.emissivemap,bt.bumpmap,bt.normalmap,bt.displacementmap,bt.fog,bt.lights,{emissive:{value:new Tt(0)},specular:{value:new Tt(1118481)},shininess:{value:30}}]),vertexShader:ln.meshphong_vert,fragmentShader:ln.meshphong_frag},standard:{uniforms:ss([bt.common,bt.envmap,bt.aomap,bt.lightmap,bt.emissivemap,bt.bumpmap,bt.normalmap,bt.displacementmap,bt.roughnessmap,bt.metalnessmap,bt.fog,bt.lights,{emissive:{value:new Tt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ln.meshphysical_vert,fragmentShader:ln.meshphysical_frag},toon:{uniforms:ss([bt.common,bt.aomap,bt.lightmap,bt.emissivemap,bt.bumpmap,bt.normalmap,bt.displacementmap,bt.gradientmap,bt.fog,bt.lights,{emissive:{value:new Tt(0)}}]),vertexShader:ln.meshtoon_vert,fragmentShader:ln.meshtoon_frag},matcap:{uniforms:ss([bt.common,bt.bumpmap,bt.normalmap,bt.displacementmap,bt.fog,{matcap:{value:null}}]),vertexShader:ln.meshmatcap_vert,fragmentShader:ln.meshmatcap_frag},points:{uniforms:ss([bt.points,bt.fog]),vertexShader:ln.points_vert,fragmentShader:ln.points_frag},dashed:{uniforms:ss([bt.common,bt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ln.linedashed_vert,fragmentShader:ln.linedashed_frag},depth:{uniforms:ss([bt.common,bt.displacementmap]),vertexShader:ln.depth_vert,fragmentShader:ln.depth_frag},normal:{uniforms:ss([bt.common,bt.bumpmap,bt.normalmap,bt.displacementmap,{opacity:{value:1}}]),vertexShader:ln.meshnormal_vert,fragmentShader:ln.meshnormal_frag},sprite:{uniforms:ss([bt.sprite,bt.fog]),vertexShader:ln.sprite_vert,fragmentShader:ln.sprite_frag},background:{uniforms:{uvTransform:{value:new _n},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ln.background_vert,fragmentShader:ln.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:ln.backgroundCube_vert,fragmentShader:ln.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ln.cube_vert,fragmentShader:ln.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ln.equirect_vert,fragmentShader:ln.equirect_frag},distanceRGBA:{uniforms:ss([bt.common,bt.displacementmap,{referencePosition:{value:new ae},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ln.distanceRGBA_vert,fragmentShader:ln.distanceRGBA_frag},shadow:{uniforms:ss([bt.lights,bt.fog,{color:{value:new Tt(0)},opacity:{value:1}}]),vertexShader:ln.shadow_vert,fragmentShader:ln.shadow_frag}};oa.physical={uniforms:ss([oa.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new _n},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new _n},clearcoatNormalScale:{value:new pt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new _n},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new _n},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new _n},sheen:{value:0},sheenColor:{value:new Tt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new _n},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new _n},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new _n},transmissionSamplerSize:{value:new pt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new _n},attenuationDistance:{value:0},attenuationColor:{value:new Tt(0)},specularColor:{value:new Tt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new _n},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new _n},anisotropyVector:{value:new pt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new _n}}]),vertexShader:ln.meshphysical_vert,fragmentShader:ln.meshphysical_frag};var ay={r:0,b:0,g:0};function r6(e,t,n,i,r,s,a){const c=new Tt(0);let u=s===!0?0:1,d,p,g=null,v=0,y=null;function S(w,b){let T=!1,L=b.isScene===!0?b.background:null;switch(L&&L.isTexture&&(L=(b.backgroundBlurriness>0?n:t).get(L)),L===null?E(c,u):L&&L.isColor&&(E(L,1),T=!0),e.xr.getEnvironmentBlendMode()){case"opaque":T=!0;break;case"additive":i.buffers.color.setClear(0,0,0,1,a),T=!0;break;case"alpha-blend":i.buffers.color.setClear(0,0,0,0,a),T=!0;break}(e.autoClear||T)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),L&&(L.isCubeTexture||L.mapping===306)?(p===void 0&&(p=new Ar(new am(1,1,1),new $a({name:"BackgroundCubeMaterial",uniforms:Qp(oa.backgroundCube.uniforms),vertexShader:oa.backgroundCube.vertexShader,fragmentShader:oa.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),p.geometry.deleteAttribute("normal"),p.geometry.deleteAttribute("uv"),p.onBeforeRender=function(C,P,O){this.matrixWorld.copyPosition(O.matrixWorld)},Object.defineProperty(p.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(p)),p.material.uniforms.envMap.value=L,p.material.uniforms.flipEnvMap.value=L.isCubeTexture&&L.isRenderTargetTexture===!1?-1:1,p.material.uniforms.backgroundBlurriness.value=b.backgroundBlurriness,p.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,p.material.toneMapped=L.colorSpace!=="srgb",(g!==L||v!==L.version||y!==e.toneMapping)&&(p.material.needsUpdate=!0,g=L,v=L.version,y=e.toneMapping),p.layers.enableAll(),w.unshift(p,p.geometry,p.material,0,0,null)):L&&L.isTexture&&(d===void 0&&(d=new Ar(new Ux(2,2),new $a({name:"BackgroundMaterial",uniforms:Qp(oa.background.uniforms),vertexShader:oa.background.vertexShader,fragmentShader:oa.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(d)),d.material.uniforms.t2D.value=L,d.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,d.material.toneMapped=L.colorSpace!=="srgb",L.matrixAutoUpdate===!0&&L.updateMatrix(),d.material.uniforms.uvTransform.value.copy(L.matrix),(g!==L||v!==L.version||y!==e.toneMapping)&&(d.material.needsUpdate=!0,g=L,v=L.version,y=e.toneMapping),d.layers.enableAll(),w.unshift(d,d.geometry,d.material,0,0,null))}function E(w,b){w.getRGB(ay,PR(e)),i.buffers.color.setClear(ay.r,ay.g,ay.b,b,a)}return{getClearColor:function(){return c},setClearColor:function(w,b=1){c.set(w),u=b,E(c,u)},getClearAlpha:function(){return u},setClearAlpha:function(w){u=w,E(c,u)},render:S}}function s6(e,t,n,i){const r=e.getParameter(e.MAX_VERTEX_ATTRIBS),s=i.isWebGL2?null:t.get("OES_vertex_array_object"),a=i.isWebGL2||s!==null,c={},u=w(null);let d=u,p=!1;function g(k,X,$,j,J){let xe=!1;if(a){const de=E(j,$,X);d!==de&&(d=de,y(d.object)),xe=b(k,j,$,J),xe&&T(k,j,$,J)}else{const de=X.wireframe===!0;(d.geometry!==j.id||d.program!==$.id||d.wireframe!==de)&&(d.geometry=j.id,d.program=$.id,d.wireframe=de,xe=!0)}J!==null&&n.update(J,e.ELEMENT_ARRAY_BUFFER),(xe||p)&&(p=!1,U(k,X,$,j),J!==null&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.get(J).buffer))}function v(){return i.isWebGL2?e.createVertexArray():s.createVertexArrayOES()}function y(k){return i.isWebGL2?e.bindVertexArray(k):s.bindVertexArrayOES(k)}function S(k){return i.isWebGL2?e.deleteVertexArray(k):s.deleteVertexArrayOES(k)}function E(k,X,$){const j=$.wireframe===!0;let J=c[k.id];J===void 0&&(J={},c[k.id]=J);let xe=J[X.id];xe===void 0&&(xe={},J[X.id]=xe);let de=xe[j];return de===void 0&&(de=w(v()),xe[j]=de),de}function w(k){const X=[],$=[],j=[];for(let J=0;J<r;J++)X[J]=0,$[J]=0,j[J]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:X,enabledAttributes:$,attributeDivisors:j,object:k,attributes:{},index:null}}function b(k,X,$,j){const J=d.attributes,xe=X.attributes;let de=0;const fe=$.getAttributes();for(const F in fe)if(fe[F].location>=0){const re=J[F];let ue=xe[F];if(ue===void 0&&(F==="instanceMatrix"&&k.instanceMatrix&&(ue=k.instanceMatrix),F==="instanceColor"&&k.instanceColor&&(ue=k.instanceColor)),re===void 0||re.attribute!==ue||ue&&re.data!==ue.data)return!0;de++}return d.attributesNum!==de||d.index!==j}function T(k,X,$,j){const J={},xe=X.attributes;let de=0;const fe=$.getAttributes();for(const F in fe)if(fe[F].location>=0){let re=xe[F];re===void 0&&(F==="instanceMatrix"&&k.instanceMatrix&&(re=k.instanceMatrix),F==="instanceColor"&&k.instanceColor&&(re=k.instanceColor));const ue={};ue.attribute=re,re&&re.data&&(ue.data=re.data),J[F]=ue,de++}d.attributes=J,d.attributesNum=de,d.index=j}function L(){const k=d.newAttributes;for(let X=0,$=k.length;X<$;X++)k[X]=0}function C(k){P(k,0)}function P(k,X){const $=d.newAttributes,j=d.enabledAttributes,J=d.attributeDivisors;$[k]=1,j[k]===0&&(e.enableVertexAttribArray(k),j[k]=1),J[k]!==X&&((i.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](k,X),J[k]=X)}function O(){const k=d.newAttributes,X=d.enabledAttributes;for(let $=0,j=X.length;$<j;$++)X[$]!==k[$]&&(e.disableVertexAttribArray($),X[$]=0)}function B(k,X,$,j,J,xe,de){de===!0?e.vertexAttribIPointer(k,X,$,J,xe):e.vertexAttribPointer(k,X,$,j,J,xe)}function U(k,X,$,j){if(i.isWebGL2===!1&&(k.isInstancedMesh||j.isInstancedBufferGeometry)&&t.get("ANGLE_instanced_arrays")===null)return;L();const J=j.attributes,xe=$.getAttributes(),de=X.defaultAttributeValues;for(const fe in xe){const F=xe[fe];if(F.location>=0){let re=J[fe];if(re===void 0&&(fe==="instanceMatrix"&&k.instanceMatrix&&(re=k.instanceMatrix),fe==="instanceColor"&&k.instanceColor&&(re=k.instanceColor)),re!==void 0){const ue=re.normalized,_e=re.itemSize,Le=n.get(re);if(Le===void 0)continue;const Fe=Le.buffer,Xe=Le.type,lt=Le.bytesPerElement,mt=i.isWebGL2===!0&&(Xe===e.INT||Xe===e.UNSIGNED_INT||re.gpuType===1013);if(re.isInterleavedBufferAttribute){const ne=re.data,Be=ne.stride,Ne=re.offset;if(ne.isInstancedInterleavedBuffer){for(let ve=0;ve<F.locationSize;ve++)P(F.location+ve,ne.meshPerAttribute);k.isInstancedMesh!==!0&&j._maxInstanceCount===void 0&&(j._maxInstanceCount=ne.meshPerAttribute*ne.count)}else for(let ve=0;ve<F.locationSize;ve++)C(F.location+ve);e.bindBuffer(e.ARRAY_BUFFER,Fe);for(let ve=0;ve<F.locationSize;ve++)B(F.location+ve,_e/F.locationSize,Xe,ue,Be*lt,(Ne+_e/F.locationSize*ve)*lt,mt)}else{if(re.isInstancedBufferAttribute){for(let ne=0;ne<F.locationSize;ne++)P(F.location+ne,re.meshPerAttribute);k.isInstancedMesh!==!0&&j._maxInstanceCount===void 0&&(j._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let ne=0;ne<F.locationSize;ne++)C(F.location+ne);e.bindBuffer(e.ARRAY_BUFFER,Fe);for(let ne=0;ne<F.locationSize;ne++)B(F.location+ne,_e/F.locationSize,Xe,ue,_e*lt,_e/F.locationSize*ne*lt,mt)}}else if(de!==void 0){const ue=de[fe];if(ue!==void 0)switch(ue.length){case 2:e.vertexAttrib2fv(F.location,ue);break;case 3:e.vertexAttrib3fv(F.location,ue);break;case 4:e.vertexAttrib4fv(F.location,ue);break;default:e.vertexAttrib1fv(F.location,ue)}}}}O()}function I(){oe();for(const k in c){const X=c[k];for(const $ in X){const j=X[$];for(const J in j)S(j[J].object),delete j[J];delete X[$]}delete c[k]}}function z(k){if(c[k.id]===void 0)return;const X=c[k.id];for(const $ in X){const j=X[$];for(const J in j)S(j[J].object),delete j[J];delete X[$]}delete c[k.id]}function te(k){for(const X in c){const $=c[X];if($[k.id]===void 0)continue;const j=$[k.id];for(const J in j)S(j[J].object),delete j[J];delete $[k.id]}}function oe(){ee(),p=!0,d!==u&&(d=u,y(d.object))}function ee(){u.geometry=null,u.program=null,u.wireframe=!1}return{setup:g,reset:oe,resetDefaultState:ee,dispose:I,releaseStatesOfGeometry:z,releaseStatesOfProgram:te,initAttributes:L,enableAttribute:C,disableUnusedAttributes:O}}function o6(e,t,n,i){const r=i.isWebGL2;let s;function a(d){s=d}function c(d,p){e.drawArrays(s,d,p),n.update(p,s,1)}function u(d,p,g){if(g===0)return;let v,y;if(r)v=e,y="drawArraysInstanced";else if(v=t.get("ANGLE_instanced_arrays"),y="drawArraysInstancedANGLE",v===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}v[y](s,d,p,g),n.update(p,s,g)}this.setMode=a,this.render=c,this.renderInstances=u}function a6(e,t,n){let i;function r(){if(i!==void 0)return i;if(t.has("EXT_texture_filter_anisotropic")===!0){const B=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(B.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function s(B){if(B==="highp"){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";B="mediump"}return B==="mediump"&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const a=typeof WebGL2RenderingContext<"u"&&e.constructor.name==="WebGL2RenderingContext";let c=n.precision!==void 0?n.precision:"highp";const u=s(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const d=a||t.has("WEBGL_draw_buffers"),p=n.logarithmicDepthBuffer===!0,g=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),v=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y=e.getParameter(e.MAX_TEXTURE_SIZE),S=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),E=e.getParameter(e.MAX_VERTEX_ATTRIBS),w=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),b=e.getParameter(e.MAX_VARYING_VECTORS),T=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),L=v>0,C=a||t.has("OES_texture_float"),P=L&&C,O=a?e.getParameter(e.MAX_SAMPLES):0;return{isWebGL2:a,drawBuffers:d,getMaxAnisotropy:r,getMaxPrecision:s,precision:c,logarithmicDepthBuffer:p,maxTextures:g,maxVertexTextures:v,maxTextureSize:y,maxCubemapSize:S,maxAttributes:E,maxVertexUniforms:w,maxVaryings:b,maxFragmentUniforms:T,vertexTextures:L,floatFragmentTextures:C,floatVertexTextures:P,maxSamples:O}}function l6(e){const t=this;let n=null,i=0,r=!1,s=!1;const a=new _u,c=new _n,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(g,v){const y=g.length!==0||v||i!==0||r;return r=v,i=g.length,y},this.beginShadows=function(){s=!0,p(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(g,v){n=p(g,v,0)},this.setState=function(g,v,y){const S=g.clippingPlanes,E=g.clipIntersection,w=g.clipShadows,b=e.get(g);if(!r||S===null||S.length===0||s&&!w)s?p(null):d();else{const T=s?0:i,L=T*4;let C=b.clippingState||null;u.value=C,C=p(S,v,L,y);for(let P=0;P!==L;++P)C[P]=n[P];b.clippingState=C,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=T}};function d(){u.value!==n&&(u.value=n,u.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function p(g,v,y,S){const E=g!==null?g.length:0;let w=null;if(E!==0){if(w=u.value,S!==!0||w===null){const b=y+E*4,T=v.matrixWorldInverse;c.getNormalMatrix(T),(w===null||w.length<b)&&(w=new Float32Array(b));for(let L=0,C=y;L!==E;++L,C+=4)a.copy(g[L]).applyMatrix4(T,c),a.normal.toArray(w,C),w[C+3]=a.constant}u.value=w,u.needsUpdate=!0}return t.numPlanes=E,t.numIntersection=0,w}}function c6(e){let t=new WeakMap;function n(a,c){return c===303?a.mapping=301:c===304&&(a.mapping=302),a}function i(a){if(a&&a.isTexture&&a.isRenderTargetTexture===!1){const c=a.mapping;if(c===303||c===304)if(t.has(a)){const u=t.get(a).texture;return n(u,a.mapping)}else{const u=a.image;if(u&&u.height>0){const d=new OR(u.height/2);return d.fromEquirectangularTexture(e,a),t.set(a,d),a.addEventListener("dispose",r),n(d.texture,a.mapping)}else return null}}return a}function r(a){const c=a.target;c.removeEventListener("dispose",r);const u=t.get(c);u!==void 0&&(t.delete(c),u.dispose())}function s(){t=new WeakMap}return{get:i,dispose:s}}var Bx=class extends Dx{constructor(e=-1,t=1,n=1,i=-1,r=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,s){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,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),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,s=n+e,a=i+t,c=i-t;if(this.view!==null&&this.view.enabled){const u=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=u*this.view.offsetX,s=r+u*this.view.width,a-=d*this.view.offsetY,c=a-d*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,c,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}},Up=4,NE=[.125,.215,.35,.446,.526,.582],Jh=20,$b=new Bx,IE=new Tt,Zb=null,Zh=(1+Math.sqrt(5))/2,dp=1/Zh,OE=[new ae(1,1,1),new ae(-1,1,1),new ae(1,1,-1),new ae(-1,1,-1),new ae(0,Zh,dp),new ae(0,Zh,-dp),new ae(dp,0,Zh),new ae(-dp,0,Zh),new ae(Zh,dp,0),new ae(-Zh,dp,0)],Q2=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Zb=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=UE(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=zE(),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(Zb),e.scissorTest=!1,ly(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===301||e.mapping===302?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Zb=this._renderer.getRenderTarget();const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Er,minFilter:Er,generateMipmaps:!1,type:KM,format:$p,colorSpace:qa,depthBuffer:!1},i=DE(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=DE(e,t,n);const{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=u6(r)),this._blurMaterial=h6(r,e,t)}return i}_compileMaterial(e){const t=new Ar(this._lodPlanes[0],e);this._renderer.compile(t,$b)}_sceneToCubeUV(e,t,n,i){const r=new wr(90,1,t,n),s=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],c=this._renderer,u=c.autoClear,d=c.toneMapping;c.getClearColor(IE),c.toneMapping=0,c.autoClear=!1;const p=new Tu({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),g=new Ar(new am,p);let v=!1;const y=e.background;y?y.isColor&&(p.color.copy(y),e.background=null,v=!0):(p.color.copy(IE),v=!0);for(let S=0;S<6;S++){const E=S%3;E===0?(r.up.set(0,s[S],0),r.lookAt(a[S],0,0)):E===1?(r.up.set(0,0,s[S]),r.lookAt(0,a[S],0)):(r.up.set(0,s[S],0),r.lookAt(0,0,a[S]));const w=this._cubeSize;ly(i,E*w,S>2?w:0,w,w),c.setRenderTarget(i),v&&c.render(g,r),c.render(e,r)}g.geometry.dispose(),g.material.dispose(),c.toneMapping=d,c.autoClear=u,e.background=y}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===301||e.mapping===302;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=UE()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=zE());const r=i?this._cubemapMaterial:this._equirectMaterial,s=new Ar(this._lodPlanes[0],r),a=r.uniforms;a.envMap.value=e;const c=this._cubeSize;ly(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(s,$b)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;i<this._lodPlanes.length;i++){const r=Math.sqrt(this._sigmas[i]*this._sigmas[i]-this._sigmas[i-1]*this._sigmas[i-1]),s=OE[(i-1)%OE.length];this._blur(e,i-1,i,r,s)}t.autoClear=n}_blur(e,t,n,i,r){const s=this._pingPongRenderTarget;this._halfBlur(e,s,t,n,i,"latitudinal",r),this._halfBlur(s,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,s,a){const c=this._renderer,u=this._blurMaterial;s!=="latitudinal"&&s!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const d=3,p=new Ar(this._lodPlanes[i],u),g=u.uniforms,v=this._sizeLods[n]-1,y=isFinite(r)?Math.PI/(2*v):2*Math.PI/(2*Jh-1),S=r/y,E=isFinite(r)?1+Math.floor(d*S):Jh;E>Jh&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${E} samples when the maximum is set to ${Jh}`);const w=[];let b=0;for(let C=0;C<Jh;++C){const P=C/S,O=Math.exp(-P*P/2);w.push(O),C===0?b+=O:C<E&&(b+=2*O)}for(let C=0;C<w.length;C++)w[C]=w[C]/b;g.envMap.value=e.texture,g.samples.value=E,g.weights.value=w,g.latitudinal.value=s==="latitudinal",a&&(g.poleAxis.value=a);const{_lodMax:T}=this;g.dTheta.value=y,g.mipInt.value=T-n;const L=this._sizeLods[i];ly(t,3*L*(i>T-Up?i-T+Up:0),4*(this._cubeSize-L),3*L,2*L),c.setRenderTarget(t),c.render(p,$b)}};function u6(e){const t=[],n=[],i=[];let r=e;const s=e-Up+1+NE.length;for(let a=0;a<s;a++){const c=Math.pow(2,r);n.push(c);let u=1/c;a>e-Up?u=NE[a-e+Up-1]:a===0&&(u=0),i.push(u);const d=1/(c-2),p=-d,g=1+d,v=[p,p,g,p,g,g,p,p,g,g,p,g],y=6,S=6,E=3,w=2,b=1,T=new Float32Array(E*S*y),L=new Float32Array(w*S*y),C=new Float32Array(b*S*y);for(let O=0;O<y;O++){const B=O%3*2/3-1,U=O>2?0:-1,I=[B,U,0,B+2/3,U,0,B+2/3,U+1,0,B,U,0,B+2/3,U+1,0,B,U+1,0];T.set(I,E*S*O),L.set(v,w*S*O);const z=[O,O,O,O,O,O];C.set(z,b*S*O)}const P=new vn;P.setAttribute("position",new Kn(T,E)),P.setAttribute("uv",new Kn(L,w)),P.setAttribute("faceIndex",new Kn(C,b)),t.push(P),r>Up&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}function DE(e,t,n){const i=new la(e,t,n);return i.texture.mapping=306,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function ly(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function h6(e,t,n){const i=new Float32Array(Jh),r=new ae(0,1,0);return new $a({name:"SphericalGaussianBlur",defines:{n:Jh,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:cw(),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:0,depthTest:!1,depthWrite:!1})}function zE(){return new $a({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:cw(),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:0,depthTest:!1,depthWrite:!1})}function UE(){return new $a({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:cw(),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:0,depthTest:!1,depthWrite:!1})}function cw(){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 f6(e){let t=new WeakMap,n=null;function i(c){if(c&&c.isTexture){const u=c.mapping,d=u===303||u===304,p=u===301||u===302;if(d||p)if(c.isRenderTargetTexture&&c.needsPMREMUpdate===!0){c.needsPMREMUpdate=!1;let g=t.get(c);return n===null&&(n=new Q2(e)),g=d?n.fromEquirectangular(c,g):n.fromCubemap(c,g),t.set(c,g),g.texture}else{if(t.has(c))return t.get(c).texture;{const g=c.image;if(d&&g&&g.height>0||p&&g&&r(g)){n===null&&(n=new Q2(e));const v=d?n.fromEquirectangular(c):n.fromCubemap(c);return t.set(c,v),c.addEventListener("dispose",s),v.texture}else return null}}}return c}function r(c){let u=0;const d=6;for(let p=0;p<d;p++)c[p]!==void 0&&u++;return u===d}function s(c){const u=c.target;u.removeEventListener("dispose",s);const d=t.get(u);d!==void 0&&(t.delete(u),d.dispose())}function a(){t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:a}}function d6(e){const t={};function n(i){if(t[i]!==void 0)return t[i];let r;switch(i){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(i)}return t[i]=r,r}return{has:function(i){return n(i)!==null},init:function(i){i.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(i){const r=n(i);return r===null&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function p6(e,t,n,i){const r={},s=new WeakMap;function a(g){const v=g.target;v.index!==null&&t.remove(v.index);for(const S in v.attributes)t.remove(v.attributes[S]);for(const S in v.morphAttributes){const E=v.morphAttributes[S];for(let w=0,b=E.length;w<b;w++)t.remove(E[w])}v.removeEventListener("dispose",a),delete r[v.id];const y=s.get(v);y&&(t.remove(y),s.delete(v)),i.releaseStatesOfGeometry(v),v.isInstancedBufferGeometry===!0&&delete v._maxInstanceCount,n.memory.geometries--}function c(g,v){return r[v.id]===!0||(v.addEventListener("dispose",a),r[v.id]=!0,n.memory.geometries++),v}function u(g){const v=g.attributes;for(const S in v)t.update(v[S],e.ARRAY_BUFFER);const y=g.morphAttributes;for(const S in y){const E=y[S];for(let w=0,b=E.length;w<b;w++)t.update(E[w],e.ARRAY_BUFFER)}}function d(g){const v=[],y=g.index,S=g.attributes.position;let E=0;if(y!==null){const T=y.array;E=y.version;for(let L=0,C=T.length;L<C;L+=3){const P=T[L+0],O=T[L+1],B=T[L+2];v.push(P,O,O,B,B,P)}}else{const T=S.array;E=S.version;for(let L=0,C=T.length/3-1;L<C;L+=3){const P=L+0,O=L+1,B=L+2;v.push(P,O,O,B,B,P)}}const w=new(wR(v)?lw:aw)(v,1);w.version=E;const b=s.get(g);b&&t.remove(b),s.set(g,w)}function p(g){const v=s.get(g);if(v){const y=g.index;y!==null&&v.version<y.version&&d(g)}else d(g);return s.get(g)}return{get:c,update:u,getWireframeAttribute:p}}function m6(e,t,n,i){const r=i.isWebGL2;let s;function a(v){s=v}let c,u;function d(v){c=v.type,u=v.bytesPerElement}function p(v,y){e.drawElements(s,y,c,v*u),n.update(y,s,1)}function g(v,y,S){if(S===0)return;let E,w;if(r)E=e,w="drawElementsInstanced";else if(E=t.get("ANGLE_instanced_arrays"),w="drawElementsInstancedANGLE",E===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}E[w](s,y,c,v*u,S),n.update(y,s,S)}this.setMode=a,this.setIndex=d,this.render=p,this.renderInstances=g}function g6(e){const t={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,a,c){switch(n.calls++,a){case e.TRIANGLES:n.triangles+=c*(s/3);break;case e.LINES:n.lines+=c*(s/2);break;case e.LINE_STRIP:n.lines+=c*(s-1);break;case e.LINE_LOOP:n.lines+=c*s;break;case e.POINTS:n.points+=c*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:t,render:n,programs:null,autoReset:!0,reset:r,update:i}}function _6(e,t){return e[0]-t[0]}function v6(e,t){return Math.abs(t[1])-Math.abs(e[1])}function y6(e,t,n){const i={},r=new Float32Array(8),s=new WeakMap,a=new $n,c=[];for(let d=0;d<8;d++)c[d]=[d,0];function u(d,p,g){const v=d.morphTargetInfluences;if(t.isWebGL2===!0){const S=p.morphAttributes.position||p.morphAttributes.normal||p.morphAttributes.color,E=S!==void 0?S.length:0;let w=s.get(p);if(w===void 0||w.count!==E){let X=function(){ee.dispose(),s.delete(p),p.removeEventListener("dispose",X)};var y=X;w!==void 0&&w.texture.dispose();const L=p.morphAttributes.position!==void 0,C=p.morphAttributes.normal!==void 0,P=p.morphAttributes.color!==void 0,O=p.morphAttributes.position||[],B=p.morphAttributes.normal||[],U=p.morphAttributes.color||[];let I=0;L===!0&&(I=1),C===!0&&(I=2),P===!0&&(I=3);let z=p.attributes.position.count*I,te=1;z>t.maxTextureSize&&(te=Math.ceil(z/t.maxTextureSize),z=t.maxTextureSize);const oe=new Float32Array(z*te*4*E),ee=new Ix(oe,z,te,E);ee.type=Rx,ee.needsUpdate=!0;const k=I*4;for(let $=0;$<E;$++){const j=O[$],J=B[$],xe=U[$],de=z*te*4*$;for(let fe=0;fe<j.count;fe++){const F=fe*k;L===!0&&(a.fromBufferAttribute(j,fe),oe[de+F+0]=a.x,oe[de+F+1]=a.y,oe[de+F+2]=a.z,oe[de+F+3]=0),C===!0&&(a.fromBufferAttribute(J,fe),oe[de+F+4]=a.x,oe[de+F+5]=a.y,oe[de+F+6]=a.z,oe[de+F+7]=0),P===!0&&(a.fromBufferAttribute(xe,fe),oe[de+F+8]=a.x,oe[de+F+9]=a.y,oe[de+F+10]=a.z,oe[de+F+11]=xe.itemSize===4?a.w:1)}}w={count:E,texture:ee,size:new pt(z,te)},s.set(p,w),p.addEventListener("dispose",X)}let b=0;for(let L=0;L<v.length;L++)b+=v[L];const T=p.morphTargetsRelative?1:1-b;g.getUniforms().setValue(e,"morphTargetBaseInfluence",T),g.getUniforms().setValue(e,"morphTargetInfluences",v),g.getUniforms().setValue(e,"morphTargetsTexture",w.texture,n),g.getUniforms().setValue(e,"morphTargetsTextureSize",w.size)}else{const S=v===void 0?0:v.length;let E=i[p.id];if(E===void 0||E.length!==S){E=[];for(let C=0;C<S;C++)E[C]=[C,0];i[p.id]=E}for(let C=0;C<S;C++){const P=E[C];P[0]=C,P[1]=v[C]}E.sort(v6);for(let C=0;C<8;C++)C<S&&E[C][1]?(c[C][0]=E[C][0],c[C][1]=E[C][1]):(c[C][0]=Number.MAX_SAFE_INTEGER,c[C][1]=0);c.sort(_6);const w=p.morphAttributes.position,b=p.morphAttributes.normal;let T=0;for(let C=0;C<8;C++){const P=c[C],O=P[0],B=P[1];O!==Number.MAX_SAFE_INTEGER&&B?(w&&p.getAttribute("morphTarget"+C)!==w[O]&&p.setAttribute("morphTarget"+C,w[O]),b&&p.getAttribute("morphNormal"+C)!==b[O]&&p.setAttribute("morphNormal"+C,b[O]),r[C]=B,T+=B):(w&&p.hasAttribute("morphTarget"+C)===!0&&p.deleteAttribute("morphTarget"+C),b&&p.hasAttribute("morphNormal"+C)===!0&&p.deleteAttribute("morphNormal"+C),r[C]=0)}const L=p.morphTargetsRelative?1:1-T;g.getUniforms().setValue(e,"morphTargetBaseInfluence",L),g.getUniforms().setValue(e,"morphTargetInfluences",r)}}return{update:u}}function x6(e,t,n,i){let r=new WeakMap;function s(u){const d=i.render.frame,p=u.geometry,g=t.get(u,p);return r.get(g)!==d&&(t.update(g),r.set(g,d)),u.isInstancedMesh&&(u.hasEventListener("dispose",c)===!1&&u.addEventListener("dispose",c),n.update(u.instanceMatrix,e.ARRAY_BUFFER),u.instanceColor!==null&&n.update(u.instanceColor,e.ARRAY_BUFFER)),g}function a(){r=new WeakMap}function c(u){const d=u.target;d.removeEventListener("dispose",c),n.remove(d.instanceMatrix),d.instanceColor!==null&&n.remove(d.instanceColor)}return{update:s,dispose:a}}var UR=new Cr,BR=new Ix,VR=new sw,FR=new x0,BE=[],VE=[],FE=new Float32Array(16),kE=new Float32Array(9),GE=new Float32Array(4);function lm(e,t,n){const i=e[0];if(i<=0||i>0)return e;const r=t*n;let s=BE[r];if(s===void 0&&(s=new Float32Array(r),BE[r]=s),t!==0){i.toArray(s,0);for(let a=1,c=0;a!==t;++a)c+=n,e[a].toArray(s,c)}return s}function er(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function tr(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function Vx(e,t){let n=VE[t];n===void 0&&(n=new Int32Array(t),VE[t]=n);for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function S6(e,t){const n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function b6(e,t){const n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(er(n,t))return;e.uniform2fv(this.addr,t),tr(n,t)}}function M6(e,t){const n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(t.r!==void 0)(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(er(n,t))return;e.uniform3fv(this.addr,t),tr(n,t)}}function w6(e,t){const n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(er(n,t))return;e.uniform4fv(this.addr,t),tr(n,t)}}function A6(e,t){const n=this.cache,i=t.elements;if(i===void 0){if(er(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),tr(n,t)}else{if(er(n,i))return;GE.set(i),e.uniformMatrix2fv(this.addr,!1,GE),tr(n,i)}}function E6(e,t){const n=this.cache,i=t.elements;if(i===void 0){if(er(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),tr(n,t)}else{if(er(n,i))return;kE.set(i),e.uniformMatrix3fv(this.addr,!1,kE),tr(n,i)}}function T6(e,t){const n=this.cache,i=t.elements;if(i===void 0){if(er(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),tr(n,t)}else{if(er(n,i))return;FE.set(i),e.uniformMatrix4fv(this.addr,!1,FE),tr(n,i)}}function C6(e,t){const n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function R6(e,t){const n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(er(n,t))return;e.uniform2iv(this.addr,t),tr(n,t)}}function L6(e,t){const n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(er(n,t))return;e.uniform3iv(this.addr,t),tr(n,t)}}function P6(e,t){const n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(er(n,t))return;e.uniform4iv(this.addr,t),tr(n,t)}}function N6(e,t){const n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function I6(e,t){const n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(er(n,t))return;e.uniform2uiv(this.addr,t),tr(n,t)}}function O6(e,t){const n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(er(n,t))return;e.uniform3uiv(this.addr,t),tr(n,t)}}function D6(e,t){const n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(er(n,t))return;e.uniform4uiv(this.addr,t),tr(n,t)}}function z6(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2D(t||UR,r)}function U6(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||VR,r)}function B6(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(t||FR,r)}function V6(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||BR,r)}function F6(e){switch(e){case 5126:return S6;case 35664:return b6;case 35665:return M6;case 35666:return w6;case 35674:return A6;case 35675:return E6;case 35676:return T6;case 5124:case 35670:return C6;case 35667:case 35671:return R6;case 35668:case 35672:return L6;case 35669:case 35673:return P6;case 5125:return N6;case 36294:return I6;case 36295:return O6;case 36296:return D6;case 35678:case 36198:case 36298:case 36306:case 35682:return z6;case 35679:case 36299:case 36307:return U6;case 35680:case 36300:case 36308:case 36293:return B6;case 36289:case 36303:case 36311:case 36292:return V6}}function k6(e,t){e.uniform1fv(this.addr,t)}function G6(e,t){const n=lm(t,this.size,2);e.uniform2fv(this.addr,n)}function H6(e,t){const n=lm(t,this.size,3);e.uniform3fv(this.addr,n)}function W6(e,t){const n=lm(t,this.size,4);e.uniform4fv(this.addr,n)}function X6(e,t){const n=lm(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function j6(e,t){const n=lm(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Y6(e,t){const n=lm(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function q6(e,t){e.uniform1iv(this.addr,t)}function $6(e,t){e.uniform2iv(this.addr,t)}function Z6(e,t){e.uniform3iv(this.addr,t)}function K6(e,t){e.uniform4iv(this.addr,t)}function Q6(e,t){e.uniform1uiv(this.addr,t)}function J6(e,t){e.uniform2uiv(this.addr,t)}function eU(e,t){e.uniform3uiv(this.addr,t)}function tU(e,t){e.uniform4uiv(this.addr,t)}function nU(e,t,n){const i=this.cache,r=t.length,s=Vx(n,r);er(i,s)||(e.uniform1iv(this.addr,s),tr(i,s));for(let a=0;a!==r;++a)n.setTexture2D(t[a]||UR,s[a])}function iU(e,t,n){const i=this.cache,r=t.length,s=Vx(n,r);er(i,s)||(e.uniform1iv(this.addr,s),tr(i,s));for(let a=0;a!==r;++a)n.setTexture3D(t[a]||VR,s[a])}function rU(e,t,n){const i=this.cache,r=t.length,s=Vx(n,r);er(i,s)||(e.uniform1iv(this.addr,s),tr(i,s));for(let a=0;a!==r;++a)n.setTextureCube(t[a]||FR,s[a])}function sU(e,t,n){const i=this.cache,r=t.length,s=Vx(n,r);er(i,s)||(e.uniform1iv(this.addr,s),tr(i,s));for(let a=0;a!==r;++a)n.setTexture2DArray(t[a]||BR,s[a])}function oU(e){switch(e){case 5126:return k6;case 35664:return G6;case 35665:return H6;case 35666:return W6;case 35674:return X6;case 35675:return j6;case 35676:return Y6;case 5124:case 35670:return q6;case 35667:case 35671:return $6;case 35668:case 35672:return Z6;case 35669:case 35673:return K6;case 5125:return Q6;case 36294:return J6;case 36295:return eU;case 36296:return tU;case 35678:case 36198:case 36298:case 36306:case 35682:return nU;case 35679:case 36299:case 36307:return iU;case 35680:case 36300:case 36308:case 36293:return rU;case 36289:case 36303:case 36311:case 36292:return sU}}var aU=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=F6(t.type)}},lU=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=oU(t.type)}},cU=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let r=0,s=i.length;r!==s;++r){const a=i[r];a.setValue(e,t[a.id],n)}}},Kb=/(\w+)(\])?(\[|\.)?/g;function HE(e,t){e.seq.push(t),e.map[t.id]=t}function uU(e,t,n){const i=e.name,r=i.length;for(Kb.lastIndex=0;;){const s=Kb.exec(i),a=Kb.lastIndex;let c=s[1];const u=s[2]==="]",d=s[3];if(u&&(c=c|0),d===void 0||d==="["&&a+2===r){HE(n,d===void 0?new aU(c,e,t):new lU(c,e,t));break}else{let p=n.map[c];p===void 0&&(p=new cU(c),HE(n,p)),n=p}}}var rx=class{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const r=e.getActiveUniform(t,i);uU(r,e.getUniformLocation(t,r.name),this)}}setValue(e,t,n,i){const r=this.map[t];r!==void 0&&r.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,s=t.length;r!==s;++r){const a=t[r],c=n[a.id];c.needsUpdate!==!1&&a.setValue(e,c.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const s=e[i];s.id in t&&n.push(s)}return n}};function WE(e,t,n){const i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}var hU=0;function fU(e,t){const n=e.split(`
`),i=[],r=Math.max(t-6,0),s=Math.min(t+6,n.length);for(let a=r;a<s;a++){const c=a+1;i.push(`${c===t?">":" "} ${c}: ${n[a]}`)}return i.join(`
`)}function dU(e){switch(e){case qa:return["Linear","( value )"];case Mr:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),["Linear","( value )"]}}function XE(e,t,n){const i=e.getShaderParameter(t,e.COMPILE_STATUS),r=e.getShaderInfoLog(t).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return n.toUpperCase()+`
`+r+`
`+fU(e.getShaderSource(t),a)}else return r}function pU(e,t){const n=dU(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function mU(e,t){let n;switch(t){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function gU(e){return[e.extensionDerivatives||e.envMapCubeUVHeight||e.bumpMap||e.normalMapTangentSpace||e.clearcoatNormalMap||e.flatShading||e.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap||e.transmission)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(z1).join(`
`)}function _U(e){const t=[];for(const n in e){const i=e[n];i!==!1&&t.push("#define "+n+" "+i)}return t.join(`
`)}function vU(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const s=e.getActiveAttrib(t,r),a=s.name;let c=1;s.type===e.FLOAT_MAT2&&(c=2),s.type===e.FLOAT_MAT3&&(c=3),s.type===e.FLOAT_MAT4&&(c=4),n[a]={type:s.type,location:e.getAttribLocation(t,a),locationSize:c}}return n}function z1(e){return e!==""}function jE(e,t){const n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function YE(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var yU=/^[ \t]*#include +<([\w\d./]+)>/gm;function J2(e){return e.replace(yU,xU)}function xU(e,t){const n=ln[t];if(n===void 0)throw new Error("Can not resolve #include <"+t+">");return J2(n)}var SU=/#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 qE(e){return e.replace(SU,bU)}function bU(e,t,n,i){let r="";for(let s=parseInt(t);s<parseInt(n);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function $E(e){let t="precision "+e.precision+` float;
precision `+e.precision+" int;";return e.precision==="highp"?t+=`
#define HIGH_PRECISION`:e.precision==="mediump"?t+=`
#define MEDIUM_PRECISION`:e.precision==="lowp"&&(t+=`
#define LOW_PRECISION`),t}function MU(e){let t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===1?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===2?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===3&&(t="SHADOWMAP_TYPE_VSM"),t}function wU(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 301:case 302:t="ENVMAP_TYPE_CUBE";break;case 306:t="ENVMAP_TYPE_CUBE_UV";break}return t}function AU(e){let t="ENVMAP_MODE_REFLECTION";return e.envMap&&e.envMapMode===302&&(t="ENVMAP_MODE_REFRACTION"),t}function EU(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD";break}return t}function TU(e){const t=e.envMapCubeUVHeight;if(t===null)return null;const n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}function CU(e,t,n,i){const r=e.getContext(),s=n.defines;let a=n.vertexShader,c=n.fragmentShader;const u=MU(n),d=wU(n),p=AU(n),g=EU(n),v=TU(n),y=n.isWebGL2?"":gU(n),S=_U(s),E=r.createProgram();let w,b,T=n.glslVersion?"#version "+n.glslVersion+`
`:"";n.isRawShaderMaterial?(w=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,S].filter(z1).join(`
`),w.length>0&&(w+=`
`),b=[y,"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,S].filter(z1).join(`
`),b.length>0&&(b+=`
`)):(w=[$E(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,S,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+p:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","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","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","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
`].filter(z1).join(`
`),b=[y,$E(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,S,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.envMap?"#define "+p:"",n.envMap?"#define "+g:"",v?"#define CUBEUV_TEXEL_WIDTH "+v.texelWidth:"",v?"#define CUBEUV_TEXEL_HEIGHT "+v.texelHeight:"",v?"#define CUBEUV_MAX_MIP "+v.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==0?"#define TONE_MAPPING":"",n.toneMapping!==0?ln.tonemapping_pars_fragment:"",n.toneMapping!==0?mU("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",ln.encodings_pars_fragment,pU("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
`].filter(z1).join(`
`)),a=J2(a),a=jE(a,n),a=YE(a,n),c=J2(c),c=jE(c,n),c=YE(c,n),a=qE(a),c=qE(c),n.isWebGL2&&n.isRawShaderMaterial!==!0&&(T=`#version 300 es
`,w=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+w,b=["#define varying in",n.glslVersion==="300 es"?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion==="300 es"?"":"#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 L=T+w+a,C=T+b+c,P=WE(r,r.VERTEX_SHADER,L),O=WE(r,r.FRAGMENT_SHADER,C);if(r.attachShader(E,P),r.attachShader(E,O),n.index0AttributeName!==void 0?r.bindAttribLocation(E,0,n.index0AttributeName):n.morphTargets===!0&&r.bindAttribLocation(E,0,"position"),r.linkProgram(E),e.debug.checkShaderErrors){const I=r.getProgramInfoLog(E).trim(),z=r.getShaderInfoLog(P).trim(),te=r.getShaderInfoLog(O).trim();let oe=!0,ee=!0;if(r.getProgramParameter(E,r.LINK_STATUS)===!1)if(oe=!1,typeof e.debug.onShaderError=="function")e.debug.onShaderError(r,E,P,O);else{const k=XE(r,P,"vertex"),X=XE(r,O,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(E,r.VALIDATE_STATUS)+`
Program Info Log: `+I+`
`+k+`
`+X)}else I!==""?console.warn("THREE.WebGLProgram: Program Info Log:",I):(z===""||te==="")&&(ee=!1);ee&&(this.diagnostics={runnable:oe,programLog:I,vertexShader:{log:z,prefix:w},fragmentShader:{log:te,prefix:b}})}r.deleteShader(P),r.deleteShader(O);let B;this.getUniforms=function(){return B===void 0&&(B=new rx(r,E)),B};let U;return this.getAttributes=function(){return U===void 0&&(U=vU(r,E)),U},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(E),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=hU++,this.cacheKey=t,this.usedTimes=1,this.program=E,this.vertexShader=P,this.fragmentShader=O,this}var RU=0,LU=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),s=this._getShaderCacheForMaterial(e);return s.has(i)===!1&&(s.add(i),i.usedTimes++),s.has(r)===!1&&(s.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new PU(e),t.set(e,n)),n}},PU=class{constructor(e){this.id=RU++,this.code=e,this.usedTimes=0}};function NU(e,t,n,i,r,s,a){const c=new Ox,u=new LU,d=[],p=r.isWebGL2,g=r.logarithmicDepthBuffer,v=r.vertexTextures;let y=r.precision;const S={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 E(I){return I===0?"uv":`uv${I}`}function w(I,z,te,oe,ee){const k=oe.fog,X=ee.geometry,$=I.isMeshStandardMaterial?oe.environment:null,j=(I.isMeshStandardMaterial?n:t).get(I.envMap||$),J=j&&j.mapping===306?j.image.height:null,xe=S[I.type];I.precision!==null&&(y=r.getMaxPrecision(I.precision),y!==I.precision&&console.warn("THREE.WebGLProgram.getParameters:",I.precision,"not supported, using",y,"instead."));const de=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,fe=de!==void 0?de.length:0;let F=0;X.morphAttributes.position!==void 0&&(F=1),X.morphAttributes.normal!==void 0&&(F=2),X.morphAttributes.color!==void 0&&(F=3);let re,ue,_e,Le;if(xe){const be=oa[xe];re=be.vertexShader,ue=be.fragmentShader}else re=I.vertexShader,ue=I.fragmentShader,u.update(I),_e=u.getVertexShaderID(I),Le=u.getFragmentShaderID(I);const Fe=e.getRenderTarget(),Xe=ee.isInstancedMesh===!0,lt=!!I.map,mt=!!I.matcap,ne=!!j,Be=!!I.aoMap,Ne=!!I.lightMap,ve=!!I.bumpMap,ye=!!I.normalMap,et=!!I.displacementMap,tt=!!I.emissiveMap,_t=!!I.metalnessMap,St=!!I.roughnessMap,Mt=I.anisotropy>0,Bt=I.clearcoat>0,Ft=I.iridescence>0,ie=I.sheen>0,Z=I.transmission>0,Ve=Mt&&!!I.anisotropyMap,ut=Bt&&!!I.clearcoatMap,gt=Bt&&!!I.clearcoatNormalMap,dt=Bt&&!!I.clearcoatRoughnessMap,G=Ft&&!!I.iridescenceMap,q=Ft&&!!I.iridescenceThicknessMap,Y=ie&&!!I.sheenColorMap,pe=ie&&!!I.sheenRoughnessMap,Me=!!I.specularMap,De=!!I.specularColorMap,Ee=!!I.specularIntensityMap,je=Z&&!!I.transmissionMap,nt=Z&&!!I.thicknessMap,ft=!!I.gradientMap,se=!!I.alphaMap,Ze=I.alphaTest>0,Se=!!I.extensions,Ke=!!X.attributes.uv1,le=!!X.attributes.uv2,At=!!X.attributes.uv3;return{isWebGL2:p,shaderID:xe,shaderType:I.type,shaderName:I.name,vertexShader:re,fragmentShader:ue,defines:I.defines,customVertexShaderID:_e,customFragmentShaderID:Le,isRawShaderMaterial:I.isRawShaderMaterial===!0,glslVersion:I.glslVersion,precision:y,instancing:Xe,instancingColor:Xe&&ee.instanceColor!==null,supportsVertexTextures:v,outputColorSpace:Fe===null?e.outputColorSpace:Fe.isXRRenderTarget===!0?Fe.texture.colorSpace:qa,map:lt,matcap:mt,envMap:ne,envMapMode:ne&&j.mapping,envMapCubeUVHeight:J,aoMap:Be,lightMap:Ne,bumpMap:ve,normalMap:ye,displacementMap:v&&et,emissiveMap:tt,normalMapObjectSpace:ye&&I.normalMapType===1,normalMapTangentSpace:ye&&I.normalMapType===0,metalnessMap:_t,roughnessMap:St,anisotropy:Mt,anisotropyMap:Ve,clearcoat:Bt,clearcoatMap:ut,clearcoatNormalMap:gt,clearcoatRoughnessMap:dt,iridescence:Ft,iridescenceMap:G,iridescenceThicknessMap:q,sheen:ie,sheenColorMap:Y,sheenRoughnessMap:pe,specularMap:Me,specularColorMap:De,specularIntensityMap:Ee,transmission:Z,transmissionMap:je,thicknessMap:nt,gradientMap:ft,opaque:I.transparent===!1&&I.blending===1,alphaMap:se,alphaTest:Ze,combine:I.combine,mapUv:lt&&E(I.map.channel),aoMapUv:Be&&E(I.aoMap.channel),lightMapUv:Ne&&E(I.lightMap.channel),bumpMapUv:ve&&E(I.bumpMap.channel),normalMapUv:ye&&E(I.normalMap.channel),displacementMapUv:et&&E(I.displacementMap.channel),emissiveMapUv:tt&&E(I.emissiveMap.channel),metalnessMapUv:_t&&E(I.metalnessMap.channel),roughnessMapUv:St&&E(I.roughnessMap.channel),anisotropyMapUv:Ve&&E(I.anisotropyMap.channel),clearcoatMapUv:ut&&E(I.clearcoatMap.channel),clearcoatNormalMapUv:gt&&E(I.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:dt&&E(I.clearcoatRoughnessMap.channel),iridescenceMapUv:G&&E(I.iridescenceMap.channel),iridescenceThicknessMapUv:q&&E(I.iridescenceThicknessMap.channel),sheenColorMapUv:Y&&E(I.sheenColorMap.channel),sheenRoughnessMapUv:pe&&E(I.sheenRoughnessMap.channel),specularMapUv:Me&&E(I.specularMap.channel),specularColorMapUv:De&&E(I.specularColorMap.channel),specularIntensityMapUv:Ee&&E(I.specularIntensityMap.channel),transmissionMapUv:je&&E(I.transmissionMap.channel),thicknessMapUv:nt&&E(I.thicknessMap.channel),alphaMapUv:se&&E(I.alphaMap.channel),vertexTangents:!!X.attributes.tangent&&(ye||Mt),vertexColors:I.vertexColors,vertexAlphas:I.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,vertexUv1s:Ke,vertexUv2s:le,vertexUv3s:At,pointsUvs:ee.isPoints===!0&&!!X.attributes.uv&&(lt||se),fog:!!k,useFog:I.fog===!0,fogExp2:k&&k.isFogExp2,flatShading:I.flatShading===!0,sizeAttenuation:I.sizeAttenuation===!0,logarithmicDepthBuffer:g,skinning:ee.isSkinnedMesh===!0,morphTargets:X.morphAttributes.position!==void 0,morphNormals:X.morphAttributes.normal!==void 0,morphColors:X.morphAttributes.color!==void 0,morphTargetsCount:fe,morphTextureStride:F,numDirLights:z.directional.length,numPointLights:z.point.length,numSpotLights:z.spot.length,numSpotLightMaps:z.spotLightMap.length,numRectAreaLights:z.rectArea.length,numHemiLights:z.hemi.length,numDirLightShadows:z.directionalShadowMap.length,numPointLightShadows:z.pointShadowMap.length,numSpotLightShadows:z.spotShadowMap.length,numSpotLightShadowsWithMaps:z.numSpotLightShadowsWithMaps,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:I.dithering,shadowMapEnabled:e.shadowMap.enabled&&te.length>0,shadowMapType:e.shadowMap.type,toneMapping:I.toneMapped?e.toneMapping:0,useLegacyLights:e.useLegacyLights,premultipliedAlpha:I.premultipliedAlpha,doubleSided:I.side===2,flipSided:I.side===1,useDepthPacking:I.depthPacking>=0,depthPacking:I.depthPacking||0,index0AttributeName:I.index0AttributeName,extensionDerivatives:Se&&I.extensions.derivatives===!0,extensionFragDepth:Se&&I.extensions.fragDepth===!0,extensionDrawBuffers:Se&&I.extensions.drawBuffers===!0,extensionShaderTextureLOD:Se&&I.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:p||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:p||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:p||i.has("EXT_shader_texture_lod"),customProgramCacheKey:I.customProgramCacheKey()}}function b(I){const z=[];if(I.shaderID?z.push(I.shaderID):(z.push(I.customVertexShaderID),z.push(I.customFragmentShaderID)),I.defines!==void 0)for(const te in I.defines)z.push(te),z.push(I.defines[te]);return I.isRawShaderMaterial===!1&&(T(z,I),L(z,I),z.push(e.outputColorSpace)),z.push(I.customProgramCacheKey),z.join()}function T(I,z){I.push(z.precision),I.push(z.outputColorSpace),I.push(z.envMapMode),I.push(z.envMapCubeUVHeight),I.push(z.mapUv),I.push(z.alphaMapUv),I.push(z.lightMapUv),I.push(z.aoMapUv),I.push(z.bumpMapUv),I.push(z.normalMapUv),I.push(z.displacementMapUv),I.push(z.emissiveMapUv),I.push(z.metalnessMapUv),I.push(z.roughnessMapUv),I.push(z.anisotropyMapUv),I.push(z.clearcoatMapUv),I.push(z.clearcoatNormalMapUv),I.push(z.clearcoatRoughnessMapUv),I.push(z.iridescenceMapUv),I.push(z.iridescenceThicknessMapUv),I.push(z.sheenColorMapUv),I.push(z.sheenRoughnessMapUv),I.push(z.specularMapUv),I.push(z.specularColorMapUv),I.push(z.specularIntensityMapUv),I.push(z.transmissionMapUv),I.push(z.thicknessMapUv),I.push(z.combine),I.push(z.fogExp2),I.push(z.sizeAttenuation),I.push(z.morphTargetsCount),I.push(z.morphAttributeCount),I.push(z.numDirLights),I.push(z.numPointLights),I.push(z.numSpotLights),I.push(z.numSpotLightMaps),I.push(z.numHemiLights),I.push(z.numRectAreaLights),I.push(z.numDirLightShadows),I.push(z.numPointLightShadows),I.push(z.numSpotLightShadows),I.push(z.numSpotLightShadowsWithMaps),I.push(z.shadowMapType),I.push(z.toneMapping),I.push(z.numClippingPlanes),I.push(z.numClipIntersection),I.push(z.depthPacking)}function L(I,z){c.disableAll(),z.isWebGL2&&c.enable(0),z.supportsVertexTextures&&c.enable(1),z.instancing&&c.enable(2),z.instancingColor&&c.enable(3),z.matcap&&c.enable(4),z.envMap&&c.enable(5),z.normalMapObjectSpace&&c.enable(6),z.normalMapTangentSpace&&c.enable(7),z.clearcoat&&c.enable(8),z.iridescence&&c.enable(9),z.alphaTest&&c.enable(10),z.vertexColors&&c.enable(11),z.vertexAlphas&&c.enable(12),z.vertexUv1s&&c.enable(13),z.vertexUv2s&&c.enable(14),z.vertexUv3s&&c.enable(15),z.vertexTangents&&c.enable(16),z.anisotropy&&c.enable(17),I.push(c.mask),c.disableAll(),z.fog&&c.enable(0),z.useFog&&c.enable(1),z.flatShading&&c.enable(2),z.logarithmicDepthBuffer&&c.enable(3),z.skinning&&c.enable(4),z.morphTargets&&c.enable(5),z.morphNormals&&c.enable(6),z.morphColors&&c.enable(7),z.premultipliedAlpha&&c.enable(8),z.shadowMapEnabled&&c.enable(9),z.useLegacyLights&&c.enable(10),z.doubleSided&&c.enable(11),z.flipSided&&c.enable(12),z.useDepthPacking&&c.enable(13),z.dithering&&c.enable(14),z.transmission&&c.enable(15),z.sheen&&c.enable(16),z.opaque&&c.enable(17),z.pointsUvs&&c.enable(18),I.push(c.mask)}function C(I){const z=S[I.type];let te;if(z){const oe=oa[z];te=NR.clone(oe.uniforms)}else te=I.uniforms;return te}function P(I,z){let te;for(let oe=0,ee=d.length;oe<ee;oe++){const k=d[oe];if(k.cacheKey===z){te=k,++te.usedTimes;break}}return te===void 0&&(te=new CU(e,z,I,s),d.push(te)),te}function O(I){if(--I.usedTimes===0){const z=d.indexOf(I);d[z]=d[d.length-1],d.pop(),I.destroy()}}function B(I){u.remove(I)}function U(){u.dispose()}return{getParameters:w,getProgramCacheKey:b,getUniforms:C,acquireProgram:P,releaseProgram:O,releaseShaderCache:B,programs:d,dispose:U}}function IU(){let e=new WeakMap;function t(s){let a=e.get(s);return a===void 0&&(a={},e.set(s,a)),a}function n(s){e.delete(s)}function i(s,a,c){e.get(s)[a]=c}function r(){e=new WeakMap}return{get:t,remove:n,update:i,dispose:r}}function OU(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function ZE(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function KE(){const e=[];let t=0;const n=[],i=[],r=[];function s(){t=0,n.length=0,i.length=0,r.length=0}function a(g,v,y,S,E,w){let b=e[t];return b===void 0?(b={id:g.id,object:g,geometry:v,material:y,groupOrder:S,renderOrder:g.renderOrder,z:E,group:w},e[t]=b):(b.id=g.id,b.object=g,b.geometry=v,b.material=y,b.groupOrder=S,b.renderOrder=g.renderOrder,b.z=E,b.group=w),t++,b}function c(g,v,y,S,E,w){const b=a(g,v,y,S,E,w);y.transmission>0?i.push(b):y.transparent===!0?r.push(b):n.push(b)}function u(g,v,y,S,E,w){const b=a(g,v,y,S,E,w);y.transmission>0?i.unshift(b):y.transparent===!0?r.unshift(b):n.unshift(b)}function d(g,v){n.length>1&&n.sort(g||OU),i.length>1&&i.sort(v||ZE),r.length>1&&r.sort(v||ZE)}function p(){for(let g=t,v=e.length;g<v;g++){const y=e[g];if(y.id===null)break;y.id=null,y.object=null,y.geometry=null,y.material=null,y.group=null}}return{opaque:n,transmissive:i,transparent:r,init:s,push:c,unshift:u,finish:p,sort:d}}function DU(){let e=new WeakMap;function t(i,r){const s=e.get(i);let a;return s===void 0?(a=new KE,e.set(i,[a])):r>=s.length?(a=new KE,s.push(a)):a=s[r],a}function n(){e=new WeakMap}return{get:t,dispose:n}}function zU(){const e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new ae,color:new Tt};break;case"SpotLight":n={position:new ae,direction:new ae,color:new Tt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new ae,color:new Tt,distance:0,decay:0};break;case"HemisphereLight":n={direction:new ae,skyColor:new Tt,groundColor:new Tt};break;case"RectAreaLight":n={color:new Tt,position:new ae,halfWidth:new ae,halfHeight:new ae};break}return e[t.id]=n,n}}}function UU(){const e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case"DirectionalLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new pt};break;case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new pt};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new pt,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=n,n}}}var BU=0;function VU(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function FU(e,t){const n=new zU,i=UU(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-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};for(let p=0;p<9;p++)r.probe.push(new ae);const s=new ae,a=new un,c=new un;function u(p,g){let v=0,y=0,S=0;for(let te=0;te<9;te++)r.probe[te].set(0,0,0);let E=0,w=0,b=0,T=0,L=0,C=0,P=0,O=0,B=0,U=0;p.sort(VU);const I=g===!0?Math.PI:1;for(let te=0,oe=p.length;te<oe;te++){const ee=p[te],k=ee.color,X=ee.intensity,$=ee.distance,j=ee.shadow&&ee.shadow.map?ee.shadow.map.texture:null;if(ee.isAmbientLight)v+=k.r*X*I,y+=k.g*X*I,S+=k.b*X*I;else if(ee.isLightProbe)for(let J=0;J<9;J++)r.probe[J].addScaledVector(ee.sh.coefficients[J],X);else if(ee.isDirectionalLight){const J=n.get(ee);if(J.color.copy(ee.color).multiplyScalar(ee.intensity*I),ee.castShadow){const xe=ee.shadow,de=i.get(ee);de.shadowBias=xe.bias,de.shadowNormalBias=xe.normalBias,de.shadowRadius=xe.radius,de.shadowMapSize=xe.mapSize,r.directionalShadow[E]=de,r.directionalShadowMap[E]=j,r.directionalShadowMatrix[E]=ee.shadow.matrix,C++}r.directional[E]=J,E++}else if(ee.isSpotLight){const J=n.get(ee);J.position.setFromMatrixPosition(ee.matrixWorld),J.color.copy(k).multiplyScalar(X*I),J.distance=$,J.coneCos=Math.cos(ee.angle),J.penumbraCos=Math.cos(ee.angle*(1-ee.penumbra)),J.decay=ee.decay,r.spot[b]=J;const xe=ee.shadow;if(ee.map&&(r.spotLightMap[B]=ee.map,B++,xe.updateMatrices(ee),ee.castShadow&&U++),r.spotLightMatrix[b]=xe.matrix,ee.castShadow){const de=i.get(ee);de.shadowBias=xe.bias,de.shadowNormalBias=xe.normalBias,de.shadowRadius=xe.radius,de.shadowMapSize=xe.mapSize,r.spotShadow[b]=de,r.spotShadowMap[b]=j,O++}b++}else if(ee.isRectAreaLight){const J=n.get(ee);J.color.copy(k).multiplyScalar(X),J.halfWidth.set(ee.width*.5,0,0),J.halfHeight.set(0,ee.height*.5,0),r.rectArea[T]=J,T++}else if(ee.isPointLight){const J=n.get(ee);if(J.color.copy(ee.color).multiplyScalar(ee.intensity*I),J.distance=ee.distance,J.decay=ee.decay,ee.castShadow){const xe=ee.shadow,de=i.get(ee);de.shadowBias=xe.bias,de.shadowNormalBias=xe.normalBias,de.shadowRadius=xe.radius,de.shadowMapSize=xe.mapSize,de.shadowCameraNear=xe.camera.near,de.shadowCameraFar=xe.camera.far,r.pointShadow[w]=de,r.pointShadowMap[w]=j,r.pointShadowMatrix[w]=ee.shadow.matrix,P++}r.point[w]=J,w++}else if(ee.isHemisphereLight){const J=n.get(ee);J.skyColor.copy(ee.color).multiplyScalar(X*I),J.groundColor.copy(ee.groundColor).multiplyScalar(X*I),r.hemi[L]=J,L++}}T>0&&(t.isWebGL2||e.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=bt.LTC_FLOAT_1,r.rectAreaLTC2=bt.LTC_FLOAT_2):e.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=bt.LTC_HALF_1,r.rectAreaLTC2=bt.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=v,r.ambient[1]=y,r.ambient[2]=S;const z=r.hash;(z.directionalLength!==E||z.pointLength!==w||z.spotLength!==b||z.rectAreaLength!==T||z.hemiLength!==L||z.numDirectionalShadows!==C||z.numPointShadows!==P||z.numSpotShadows!==O||z.numSpotMaps!==B)&&(r.directional.length=E,r.spot.length=b,r.rectArea.length=T,r.point.length=w,r.hemi.length=L,r.directionalShadow.length=C,r.directionalShadowMap.length=C,r.pointShadow.length=P,r.pointShadowMap.length=P,r.spotShadow.length=O,r.spotShadowMap.length=O,r.directionalShadowMatrix.length=C,r.pointShadowMatrix.length=P,r.spotLightMatrix.length=O+B-U,r.spotLightMap.length=B,r.numSpotLightShadowsWithMaps=U,z.directionalLength=E,z.pointLength=w,z.spotLength=b,z.rectAreaLength=T,z.hemiLength=L,z.numDirectionalShadows=C,z.numPointShadows=P,z.numSpotShadows=O,z.numSpotMaps=B,r.version=BU++)}function d(p,g){let v=0,y=0,S=0,E=0,w=0;const b=g.matrixWorldInverse;for(let T=0,L=p.length;T<L;T++){const C=p[T];if(C.isDirectionalLight){const P=r.directional[v];P.direction.setFromMatrixPosition(C.matrixWorld),s.setFromMatrixPosition(C.target.matrixWorld),P.direction.sub(s),P.direction.transformDirection(b),v++}else if(C.isSpotLight){const P=r.spot[S];P.position.setFromMatrixPosition(C.matrixWorld),P.position.applyMatrix4(b),P.direction.setFromMatrixPosition(C.matrixWorld),s.setFromMatrixPosition(C.target.matrixWorld),P.direction.sub(s),P.direction.transformDirection(b),S++}else if(C.isRectAreaLight){const P=r.rectArea[E];P.position.setFromMatrixPosition(C.matrixWorld),P.position.applyMatrix4(b),c.identity(),a.copy(C.matrixWorld),a.premultiply(b),c.extractRotation(a),P.halfWidth.set(C.width*.5,0,0),P.halfHeight.set(0,C.height*.5,0),P.halfWidth.applyMatrix4(c),P.halfHeight.applyMatrix4(c),E++}else if(C.isPointLight){const P=r.point[y];P.position.setFromMatrixPosition(C.matrixWorld),P.position.applyMatrix4(b),y++}else if(C.isHemisphereLight){const P=r.hemi[w];P.direction.setFromMatrixPosition(C.matrixWorld),P.direction.transformDirection(b),w++}}}return{setup:u,setupView:d,state:r}}function QE(e,t){const n=new FU(e,t),i=[],r=[];function s(){i.length=0,r.length=0}function a(p){i.push(p)}function c(p){r.push(p)}function u(p){n.setup(i,p)}function d(p){n.setupView(i,p)}return{init:s,state:{lightsArray:i,shadowsArray:r,lights:n},setupLights:u,setupLightsView:d,pushLight:a,pushShadow:c}}function kU(e,t){let n=new WeakMap;function i(s,a=0){const c=n.get(s);let u;return c===void 0?(u=new QE(e,t),n.set(s,[u])):a>=c.length?(u=new QE(e,t),c.push(u)):u=c[a],u}function r(){n=new WeakMap}return{get:i,dispose:r}}var uw=class extends Hr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=vR,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}},hw=class extends Hr{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}},GU=`void main() {
gl_Position = vec4( position, 1.0 );
}`,HU=`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 WU(e,t,n){let i=new zx;const r=new pt,s=new pt,a=new $n,c=new uw({depthPacking:yR}),u=new hw,d={},p=n.maxTextureSize,g={0:1,1:0,2:2},v=new $a({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new pt},radius:{value:4}},vertexShader:GU,fragmentShader:HU}),y=v.clone();y.defines.HORIZONTAL_PASS=1;const S=new vn;S.setAttribute("position",new Kn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new Ar(S,v),w=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let b=this.type;this.render=function(P,O,B){if(w.enabled===!1||w.autoUpdate===!1&&w.needsUpdate===!1||P.length===0)return;const U=e.getRenderTarget(),I=e.getActiveCubeFace(),z=e.getActiveMipmapLevel(),te=e.state;te.setBlending(0),te.buffers.color.setClear(1,1,1,1),te.buffers.depth.setTest(!0),te.setScissorTest(!1);const oe=b!==3&&this.type===3,ee=b===3&&this.type!==3;for(let k=0,X=P.length;k<X;k++){const $=P[k],j=$.shadow;if(j===void 0){console.warn("THREE.WebGLShadowMap:",$,"has no shadow.");continue}if(j.autoUpdate===!1&&j.needsUpdate===!1)continue;r.copy(j.mapSize);const J=j.getFrameExtents();if(r.multiply(J),s.copy(j.mapSize),(r.x>p||r.y>p)&&(r.x>p&&(s.x=Math.floor(p/J.x),r.x=s.x*J.x,j.mapSize.x=s.x),r.y>p&&(s.y=Math.floor(p/J.y),r.y=s.y*J.y,j.mapSize.y=s.y)),j.map===null||oe===!0||ee===!0){const de=this.type!==3?{minFilter:as,magFilter:as}:{};j.map!==null&&j.map.dispose(),j.map=new la(r.x,r.y,de),j.map.texture.name=$.name+".shadowMap",j.camera.updateProjectionMatrix()}e.setRenderTarget(j.map),e.clear();const xe=j.getViewportCount();for(let de=0;de<xe;de++){const fe=j.getViewport(de);a.set(s.x*fe.x,s.y*fe.y,s.x*fe.z,s.y*fe.w),te.viewport(a),j.updateMatrices($,de),i=j.getFrustum(),C(O,B,j.camera,$,this.type)}j.isPointLightShadow!==!0&&this.type===3&&T(j,B),j.needsUpdate=!1}b=this.type,w.needsUpdate=!1,e.setRenderTarget(U,I,z)};function T(P,O){const B=t.update(E);v.defines.VSM_SAMPLES!==P.blurSamples&&(v.defines.VSM_SAMPLES=P.blurSamples,y.defines.VSM_SAMPLES=P.blurSamples,v.needsUpdate=!0,y.needsUpdate=!0),P.mapPass===null&&(P.mapPass=new la(r.x,r.y)),v.uniforms.shadow_pass.value=P.map.texture,v.uniforms.resolution.value=P.mapSize,v.uniforms.radius.value=P.radius,e.setRenderTarget(P.mapPass),e.clear(),e.renderBufferDirect(O,null,B,v,E,null),y.uniforms.shadow_pass.value=P.mapPass.texture,y.uniforms.resolution.value=P.mapSize,y.uniforms.radius.value=P.radius,e.setRenderTarget(P.map),e.clear(),e.renderBufferDirect(O,null,B,y,E,null)}function L(P,O,B,U){let I=null;const z=B.isPointLight===!0?P.customDistanceMaterial:P.customDepthMaterial;if(z!==void 0)I=z;else if(I=B.isPointLight===!0?u:c,e.localClippingEnabled&&O.clipShadows===!0&&Array.isArray(O.clippingPlanes)&&O.clippingPlanes.length!==0||O.displacementMap&&O.displacementScale!==0||O.alphaMap&&O.alphaTest>0||O.map&&O.alphaTest>0){const te=I.uuid,oe=O.uuid;let ee=d[te];ee===void 0&&(ee={},d[te]=ee);let k=ee[oe];k===void 0&&(k=I.clone(),ee[oe]=k),I=k}if(I.visible=O.visible,I.wireframe=O.wireframe,U===3?I.side=O.shadowSide!==null?O.shadowSide:O.side:I.side=O.shadowSide!==null?O.shadowSide:g[O.side],I.alphaMap=O.alphaMap,I.alphaTest=O.alphaTest,I.map=O.map,I.clipShadows=O.clipShadows,I.clippingPlanes=O.clippingPlanes,I.clipIntersection=O.clipIntersection,I.displacementMap=O.displacementMap,I.displacementScale=O.displacementScale,I.displacementBias=O.displacementBias,I.wireframeLinewidth=O.wireframeLinewidth,I.linewidth=O.linewidth,B.isPointLight===!0&&I.isMeshDistanceMaterial===!0){const te=e.properties.get(I);te.light=B}return I}function C(P,O,B,U,I){if(P.visible===!1)return;if(P.layers.test(O.layers)&&(P.isMesh||P.isLine||P.isPoints)&&(P.castShadow||P.receiveShadow&&I===3)&&(!P.frustumCulled||i.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,P.matrixWorld);const te=t.update(P),oe=P.material;if(Array.isArray(oe)){const ee=te.groups;for(let k=0,X=ee.length;k<X;k++){const $=ee[k],j=oe[$.materialIndex];if(j&&j.visible){const J=L(P,j,U,I);e.renderBufferDirect(B,null,te,J,P,$)}}}else if(oe.visible){const ee=L(P,oe,U,I);e.renderBufferDirect(B,null,te,ee,P,null)}}const z=P.children;for(let te=0,oe=z.length;te<oe;te++)C(z[te],O,B,U,I)}}function XU(e,t,n){const i=n.isWebGL2;function r(){let se=!1;const Ze=new $n;let Se=null;const Ke=new $n(0,0,0,0);return{setMask:function(le){Se!==le&&!se&&(e.colorMask(le,le,le,le),Se=le)},setLocked:function(le){se=le},setClear:function(le,At,be,Yt,ke){ke===!0&&(le*=Yt,At*=Yt,be*=Yt),Ze.set(le,At,be,Yt),Ke.equals(Ze)===!1&&(e.clearColor(le,At,be,Yt),Ke.copy(Ze))},reset:function(){se=!1,Se=null,Ke.set(-1,0,0,0)}}}function s(){let se=!1,Ze=null,Se=null,Ke=null;return{setTest:function(le){le?Fe(e.DEPTH_TEST):Xe(e.DEPTH_TEST)},setMask:function(le){Ze!==le&&!se&&(e.depthMask(le),Ze=le)},setFunc:function(le){if(Se!==le){switch(le){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}Se=le}},setLocked:function(le){se=le},setClear:function(le){Ke!==le&&(e.clearDepth(le),Ke=le)},reset:function(){se=!1,Ze=null,Se=null,Ke=null}}}function a(){let se=!1,Ze=null,Se=null,Ke=null,le=null,At=null,be=null,Yt=null,ke=null;return{setTest:function(Nt){se||(Nt?Fe(e.STENCIL_TEST):Xe(e.STENCIL_TEST))},setMask:function(Nt){Ze!==Nt&&!se&&(e.stencilMask(Nt),Ze=Nt)},setFunc:function(Nt,hn,Gn){(Se!==Nt||Ke!==hn||le!==Gn)&&(e.stencilFunc(Nt,hn,Gn),Se=Nt,Ke=hn,le=Gn)},setOp:function(Nt,hn,Gn){(At!==Nt||be!==hn||Yt!==Gn)&&(e.stencilOp(Nt,hn,Gn),At=Nt,be=hn,Yt=Gn)},setLocked:function(Nt){se=Nt},setClear:function(Nt){ke!==Nt&&(e.clearStencil(Nt),ke=Nt)},reset:function(){se=!1,Ze=null,Se=null,Ke=null,le=null,At=null,be=null,Yt=null,ke=null}}}const c=new r,u=new s,d=new a,p=new WeakMap,g=new WeakMap;let v={},y={},S=new WeakMap,E=[],w=null,b=!1,T=null,L=null,C=null,P=null,O=null,B=null,U=null,I=!1,z=null,te=null,oe=null,ee=null,k=null;const X=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let $=!1,j=0;const J=e.getParameter(e.VERSION);J.indexOf("WebGL")!==-1?(j=parseFloat(/^WebGL (\d)/.exec(J)[1]),$=j>=1):J.indexOf("OpenGL ES")!==-1&&(j=parseFloat(/^OpenGL ES (\d)/.exec(J)[1]),$=j>=2);let xe=null,de={};const fe=e.getParameter(e.SCISSOR_BOX),F=e.getParameter(e.VIEWPORT),re=new $n().fromArray(fe),ue=new $n().fromArray(F);function _e(se,Ze,Se,Ke){const le=new Uint8Array(4),At=e.createTexture();e.bindTexture(se,At),e.texParameteri(se,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(se,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let be=0;be<Se;be++)i&&(se===e.TEXTURE_3D||se===e.TEXTURE_2D_ARRAY)?e.texImage3D(Ze,0,e.RGBA,1,1,Ke,0,e.RGBA,e.UNSIGNED_BYTE,le):e.texImage2D(Ze+be,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,le);return At}const Le={};Le[e.TEXTURE_2D]=_e(e.TEXTURE_2D,e.TEXTURE_2D,1),Le[e.TEXTURE_CUBE_MAP]=_e(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),i&&(Le[e.TEXTURE_2D_ARRAY]=_e(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),Le[e.TEXTURE_3D]=_e(e.TEXTURE_3D,e.TEXTURE_3D,1,1)),c.setClear(0,0,0,1),u.setClear(1),d.setClear(0),Fe(e.DEPTH_TEST),u.setFunc(3),et(!1),tt(1),Fe(e.CULL_FACE),ve(0);function Fe(se){v[se]!==!0&&(e.enable(se),v[se]=!0)}function Xe(se){v[se]!==!1&&(e.disable(se),v[se]=!1)}function lt(se,Ze){return y[se]!==Ze?(e.bindFramebuffer(se,Ze),y[se]=Ze,i&&(se===e.DRAW_FRAMEBUFFER&&(y[e.FRAMEBUFFER]=Ze),se===e.FRAMEBUFFER&&(y[e.DRAW_FRAMEBUFFER]=Ze)),!0):!1}function mt(se,Ze){let Se=E,Ke=!1;if(se)if(Se=S.get(Ze),Se===void 0&&(Se=[],S.set(Ze,Se)),se.isWebGLMultipleRenderTargets){const le=se.texture;if(Se.length!==le.length||Se[0]!==e.COLOR_ATTACHMENT0){for(let At=0,be=le.length;At<be;At++)Se[At]=e.COLOR_ATTACHMENT0+At;Se.length=le.length,Ke=!0}}else Se[0]!==e.COLOR_ATTACHMENT0&&(Se[0]=e.COLOR_ATTACHMENT0,Ke=!0);else Se[0]!==e.BACK&&(Se[0]=e.BACK,Ke=!0);Ke&&(n.isWebGL2?e.drawBuffers(Se):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(Se))}function ne(se){return w!==se?(e.useProgram(se),w=se,!0):!1}const Be={100:e.FUNC_ADD,101:e.FUNC_SUBTRACT,102:e.FUNC_REVERSE_SUBTRACT};if(i)Be[103]=e.MIN,Be[104]=e.MAX;else{const se=t.get("EXT_blend_minmax");se!==null&&(Be[103]=se.MIN_EXT,Be[104]=se.MAX_EXT)}const Ne={200:e.ZERO,201:e.ONE,202:e.SRC_COLOR,204:e.SRC_ALPHA,210:e.SRC_ALPHA_SATURATE,208:e.DST_COLOR,206:e.DST_ALPHA,203:e.ONE_MINUS_SRC_COLOR,205:e.ONE_MINUS_SRC_ALPHA,209:e.ONE_MINUS_DST_COLOR,207:e.ONE_MINUS_DST_ALPHA};function ve(se,Ze,Se,Ke,le,At,be,Yt){if(se===0){b===!0&&(Xe(e.BLEND),b=!1);return}if(b===!1&&(Fe(e.BLEND),b=!0),se!==5){if(se!==T||Yt!==I){if((L!==100||O!==100)&&(e.blendEquation(e.FUNC_ADD),L=100,O=100),Yt)switch(se){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",se);break}else switch(se){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",se);break}C=null,P=null,B=null,U=null,T=se,I=Yt}return}le=le||Ze,At=At||Se,be=be||Ke,(Ze!==L||le!==O)&&(e.blendEquationSeparate(Be[Ze],Be[le]),L=Ze,O=le),(Se!==C||Ke!==P||At!==B||be!==U)&&(e.blendFuncSeparate(Ne[Se],Ne[Ke],Ne[At],Ne[be]),C=Se,P=Ke,B=At,U=be),T=se,I=!1}function ye(se,Ze){se.side===2?Xe(e.CULL_FACE):Fe(e.CULL_FACE);let Se=se.side===1;Ze&&(Se=!Se),et(Se),se.blending===1&&se.transparent===!1?ve(0):ve(se.blending,se.blendEquation,se.blendSrc,se.blendDst,se.blendEquationAlpha,se.blendSrcAlpha,se.blendDstAlpha,se.premultipliedAlpha),u.setFunc(se.depthFunc),u.setTest(se.depthTest),u.setMask(se.depthWrite),c.setMask(se.colorWrite);const Ke=se.stencilWrite;d.setTest(Ke),Ke&&(d.setMask(se.stencilWriteMask),d.setFunc(se.stencilFunc,se.stencilRef,se.stencilFuncMask),d.setOp(se.stencilFail,se.stencilZFail,se.stencilZPass)),St(se.polygonOffset,se.polygonOffsetFactor,se.polygonOffsetUnits),se.alphaToCoverage===!0?Fe(e.SAMPLE_ALPHA_TO_COVERAGE):Xe(e.SAMPLE_ALPHA_TO_COVERAGE)}function et(se){z!==se&&(se?e.frontFace(e.CW):e.frontFace(e.CCW),z=se)}function tt(se){se!==0?(Fe(e.CULL_FACE),se!==te&&(se===1?e.cullFace(e.BACK):se===2?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):Xe(e.CULL_FACE),te=se}function _t(se){se!==oe&&($&&e.lineWidth(se),oe=se)}function St(se,Ze,Se){se?(Fe(e.POLYGON_OFFSET_FILL),(ee!==Ze||k!==Se)&&(e.polygonOffset(Ze,Se),ee=Ze,k=Se)):Xe(e.POLYGON_OFFSET_FILL)}function Mt(se){se?Fe(e.SCISSOR_TEST):Xe(e.SCISSOR_TEST)}function Bt(se){se===void 0&&(se=e.TEXTURE0+X-1),xe!==se&&(e.activeTexture(se),xe=se)}function Ft(se,Ze,Se){Se===void 0&&(xe===null?Se=e.TEXTURE0+X-1:Se=xe);let Ke=de[Se];Ke===void 0&&(Ke={type:void 0,texture:void 0},de[Se]=Ke),(Ke.type!==se||Ke.texture!==Ze)&&(xe!==Se&&(e.activeTexture(Se),xe=Se),e.bindTexture(se,Ze||Le[se]),Ke.type=se,Ke.texture=Ze)}function ie(){const se=de[xe];se!==void 0&&se.type!==void 0&&(e.bindTexture(se.type,null),se.type=void 0,se.texture=void 0)}function Z(){try{e.compressedTexImage2D.apply(e,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function Ve(){try{e.compressedTexImage3D.apply(e,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function ut(){try{e.texSubImage2D.apply(e,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function gt(){try{e.texSubImage3D.apply(e,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function dt(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function G(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function q(){try{e.texStorage2D.apply(e,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function Y(){try{e.texStorage3D.apply(e,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function pe(){try{e.texImage2D.apply(e,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function Me(){try{e.texImage3D.apply(e,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function De(se){re.equals(se)===!1&&(e.scissor(se.x,se.y,se.z,se.w),re.copy(se))}function Ee(se){ue.equals(se)===!1&&(e.viewport(se.x,se.y,se.z,se.w),ue.copy(se))}function je(se,Ze){let Se=g.get(Ze);Se===void 0&&(Se=new WeakMap,g.set(Ze,Se));let Ke=Se.get(se);Ke===void 0&&(Ke=e.getUniformBlockIndex(Ze,se.name),Se.set(se,Ke))}function nt(se,Ze){const Se=g.get(Ze).get(se);p.get(Ze)!==Se&&(e.uniformBlockBinding(Ze,Se,se.__bindingPointIndex),p.set(Ze,Se))}function ft(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),i===!0&&(e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null)),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),v={},xe=null,de={},y={},S=new WeakMap,E=[],w=null,b=!1,T=null,L=null,C=null,P=null,O=null,B=null,U=null,I=!1,z=null,te=null,oe=null,ee=null,k=null,re.set(0,0,e.canvas.width,e.canvas.height),ue.set(0,0,e.canvas.width,e.canvas.height),c.reset(),u.reset(),d.reset()}return{buffers:{color:c,depth:u,stencil:d},enable:Fe,disable:Xe,bindFramebuffer:lt,drawBuffers:mt,useProgram:ne,setBlending:ve,setMaterial:ye,setFlipSided:et,setCullFace:tt,setLineWidth:_t,setPolygonOffset:St,setScissorTest:Mt,activeTexture:Bt,bindTexture:Ft,unbindTexture:ie,compressedTexImage2D:Z,compressedTexImage3D:Ve,texImage2D:pe,texImage3D:Me,updateUBOMapping:je,uniformBlockBinding:nt,texStorage2D:q,texStorage3D:Y,texSubImage2D:ut,texSubImage3D:gt,compressedTexSubImage2D:dt,compressedTexSubImage3D:G,scissor:De,viewport:Ee,reset:ft}}function jU(e,t,n,i,r,s,a){const c=r.isWebGL2,u=r.maxTextures,d=r.maxCubemapSize,p=r.maxTextureSize,g=r.maxSamples,v=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,y=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),S=new WeakMap;let E;const w=new WeakMap;let b=!1;try{b=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function T(ie,Z){return b?new OffscreenCanvas(ie,Z):e0("canvas")}function L(ie,Z,Ve,ut){let gt=1;if((ie.width>ut||ie.height>ut)&&(gt=ut/Math.max(ie.width,ie.height)),gt<1||Z===!0)if(typeof HTMLImageElement<"u"&&ie instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&ie instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&ie instanceof ImageBitmap){const dt=Z?hx:Math.floor,G=dt(gt*ie.width),q=dt(gt*ie.height);E===void 0&&(E=T(G,q));const Y=Ve?T(G,q):E;return Y.width=G,Y.height=q,Y.getContext("2d").drawImage(ie,0,0,G,q),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+ie.width+"x"+ie.height+") to ("+G+"x"+q+")."),Y}else return"data"in ie&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+ie.width+"x"+ie.height+")."),ie;return ie}function C(ie){return Z2(ie.width)&&Z2(ie.height)}function P(ie){return c?!1:ie.wrapS!==1001||ie.wrapT!==1001||ie.minFilter!==1003&&ie.minFilter!==1006}function O(ie,Z){return ie.generateMipmaps&&Z&&ie.minFilter!==1003&&ie.minFilter!==1006}function B(ie){e.generateMipmap(ie)}function U(ie,Z,Ve,ut,gt=!1){if(c===!1)return Z;if(ie!==null){if(e[ie]!==void 0)return e[ie];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+ie+"'")}let dt=Z;return Z===e.RED&&(Ve===e.FLOAT&&(dt=e.R32F),Ve===e.HALF_FLOAT&&(dt=e.R16F),Ve===e.UNSIGNED_BYTE&&(dt=e.R8)),Z===e.RG&&(Ve===e.FLOAT&&(dt=e.RG32F),Ve===e.HALF_FLOAT&&(dt=e.RG16F),Ve===e.UNSIGNED_BYTE&&(dt=e.RG8)),Z===e.RGBA&&(Ve===e.FLOAT&&(dt=e.RGBA32F),Ve===e.HALF_FLOAT&&(dt=e.RGBA16F),Ve===e.UNSIGNED_BYTE&&(dt=ut==="srgb"&&gt===!1?e.SRGB8_ALPHA8:e.RGBA8),Ve===e.UNSIGNED_SHORT_4_4_4_4&&(dt=e.RGBA4),Ve===e.UNSIGNED_SHORT_5_5_5_1&&(dt=e.RGB5_A1)),(dt===e.R16F||dt===e.R32F||dt===e.RG16F||dt===e.RG32F||dt===e.RGBA16F||dt===e.RGBA32F)&&t.get("EXT_color_buffer_float"),dt}function I(ie,Z,Ve){return O(ie,Ve)===!0||ie.isFramebufferTexture&&ie.minFilter!==1003&&ie.minFilter!==1006?Math.log2(Math.max(Z.width,Z.height))+1:ie.mipmaps!==void 0&&ie.mipmaps.length>0?ie.mipmaps.length:ie.isCompressedTexture&&Array.isArray(ie.image)?Z.mipmaps.length:1}function z(ie){return ie===1003||ie===1004||ie===1005?e.NEAREST:e.LINEAR}function te(ie){const Z=ie.target;Z.removeEventListener("dispose",te),ee(Z),Z.isVideoTexture&&S.delete(Z)}function oe(ie){const Z=ie.target;Z.removeEventListener("dispose",oe),X(Z)}function ee(ie){const Z=i.get(ie);if(Z.__webglInit===void 0)return;const Ve=ie.source,ut=w.get(Ve);if(ut){const gt=ut[Z.__cacheKey];gt.usedTimes--,gt.usedTimes===0&&k(ie),Object.keys(ut).length===0&&w.delete(Ve)}i.remove(ie)}function k(ie){const Z=i.get(ie);e.deleteTexture(Z.__webglTexture);const Ve=ie.source,ut=w.get(Ve);delete ut[Z.__cacheKey],a.memory.textures--}function X(ie){const Z=ie.texture,Ve=i.get(ie),ut=i.get(Z);if(ut.__webglTexture!==void 0&&(e.deleteTexture(ut.__webglTexture),a.memory.textures--),ie.depthTexture&&ie.depthTexture.dispose(),ie.isWebGLCubeRenderTarget)for(let gt=0;gt<6;gt++)e.deleteFramebuffer(Ve.__webglFramebuffer[gt]),Ve.__webglDepthbuffer&&e.deleteRenderbuffer(Ve.__webglDepthbuffer[gt]);else{if(e.deleteFramebuffer(Ve.__webglFramebuffer),Ve.__webglDepthbuffer&&e.deleteRenderbuffer(Ve.__webglDepthbuffer),Ve.__webglMultisampledFramebuffer&&e.deleteFramebuffer(Ve.__webglMultisampledFramebuffer),Ve.__webglColorRenderbuffer)for(let gt=0;gt<Ve.__webglColorRenderbuffer.length;gt++)Ve.__webglColorRenderbuffer[gt]&&e.deleteRenderbuffer(Ve.__webglColorRenderbuffer[gt]);Ve.__webglDepthRenderbuffer&&e.deleteRenderbuffer(Ve.__webglDepthRenderbuffer)}if(ie.isWebGLMultipleRenderTargets)for(let gt=0,dt=Z.length;gt<dt;gt++){const G=i.get(Z[gt]);G.__webglTexture&&(e.deleteTexture(G.__webglTexture),a.memory.textures--),i.remove(Z[gt])}i.remove(Z),i.remove(ie)}let $=0;function j(){$=0}function J(){const ie=$;return ie>=u&&console.warn("THREE.WebGLTextures: Trying to use "+ie+" texture units while this GPU supports only "+u),$+=1,ie}function xe(ie){const Z=[];return Z.push(ie.wrapS),Z.push(ie.wrapT),Z.push(ie.wrapR||0),Z.push(ie.magFilter),Z.push(ie.minFilter),Z.push(ie.anisotropy),Z.push(ie.internalFormat),Z.push(ie.format),Z.push(ie.type),Z.push(ie.generateMipmaps),Z.push(ie.premultiplyAlpha),Z.push(ie.flipY),Z.push(ie.unpackAlignment),Z.push(ie.colorSpace),Z.join()}function de(ie,Z){const Ve=i.get(ie);if(ie.isVideoTexture&&Bt(ie),ie.isRenderTargetTexture===!1&&ie.version>0&&Ve.__version!==ie.version){const ut=ie.image;if(ut===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ut.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{lt(Ve,ie,Z);return}}n.bindTexture(e.TEXTURE_2D,Ve.__webglTexture,e.TEXTURE0+Z)}function fe(ie,Z){const Ve=i.get(ie);if(ie.version>0&&Ve.__version!==ie.version){lt(Ve,ie,Z);return}n.bindTexture(e.TEXTURE_2D_ARRAY,Ve.__webglTexture,e.TEXTURE0+Z)}function F(ie,Z){const Ve=i.get(ie);if(ie.version>0&&Ve.__version!==ie.version){lt(Ve,ie,Z);return}n.bindTexture(e.TEXTURE_3D,Ve.__webglTexture,e.TEXTURE0+Z)}function re(ie,Z){const Ve=i.get(ie);if(ie.version>0&&Ve.__version!==ie.version){mt(Ve,ie,Z);return}n.bindTexture(e.TEXTURE_CUBE_MAP,Ve.__webglTexture,e.TEXTURE0+Z)}const ue={[q1]:e.REPEAT,[yo]:e.CLAMP_TO_EDGE,[$1]:e.MIRRORED_REPEAT},_e={[as]:e.NEAREST,[qM]:e.NEAREST_MIPMAP_NEAREST,[$M]:e.NEAREST_MIPMAP_LINEAR,[Er]:e.LINEAR,[ZM]:e.LINEAR_MIPMAP_NEAREST,[sm]:e.LINEAR_MIPMAP_LINEAR},Le={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function Fe(ie,Z,Ve){if(Ve?(e.texParameteri(ie,e.TEXTURE_WRAP_S,ue[Z.wrapS]),e.texParameteri(ie,e.TEXTURE_WRAP_T,ue[Z.wrapT]),(ie===e.TEXTURE_3D||ie===e.TEXTURE_2D_ARRAY)&&e.texParameteri(ie,e.TEXTURE_WRAP_R,ue[Z.wrapR]),e.texParameteri(ie,e.TEXTURE_MAG_FILTER,_e[Z.magFilter]),e.texParameteri(ie,e.TEXTURE_MIN_FILTER,_e[Z.minFilter])):(e.texParameteri(ie,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(ie,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),(ie===e.TEXTURE_3D||ie===e.TEXTURE_2D_ARRAY)&&e.texParameteri(ie,e.TEXTURE_WRAP_R,e.CLAMP_TO_EDGE),(Z.wrapS!==1001||Z.wrapT!==1001)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(ie,e.TEXTURE_MAG_FILTER,z(Z.magFilter)),e.texParameteri(ie,e.TEXTURE_MIN_FILTER,z(Z.minFilter)),Z.minFilter!==1003&&Z.minFilter!==1006&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),Z.compareFunction&&(e.texParameteri(ie,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(ie,e.TEXTURE_COMPARE_FUNC,Le[Z.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){const ut=t.get("EXT_texture_filter_anisotropic");if(Z.magFilter===1003||Z.minFilter!==1005&&Z.minFilter!==1008||Z.type===1015&&t.has("OES_texture_float_linear")===!1||c===!1&&Z.type===1016&&t.has("OES_texture_half_float_linear")===!1)return;(Z.anisotropy>1||i.get(Z).__currentAnisotropy)&&(e.texParameterf(ie,ut.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Z.anisotropy,r.getMaxAnisotropy())),i.get(Z).__currentAnisotropy=Z.anisotropy)}}function Xe(ie,Z){let Ve=!1;ie.__webglInit===void 0&&(ie.__webglInit=!0,Z.addEventListener("dispose",te));const ut=Z.source;let gt=w.get(ut);gt===void 0&&(gt={},w.set(ut,gt));const dt=xe(Z);if(dt!==ie.__cacheKey){gt[dt]===void 0&&(gt[dt]={texture:e.createTexture(),usedTimes:0},a.memory.textures++,Ve=!0),gt[dt].usedTimes++;const G=gt[ie.__cacheKey];G!==void 0&&(gt[ie.__cacheKey].usedTimes--,G.usedTimes===0&&k(Z)),ie.__cacheKey=dt,ie.__webglTexture=gt[dt].texture}return Ve}function lt(ie,Z,Ve){let ut=e.TEXTURE_2D;(Z.isDataArrayTexture||Z.isCompressedArrayTexture)&&(ut=e.TEXTURE_2D_ARRAY),Z.isData3DTexture&&(ut=e.TEXTURE_3D);const gt=Xe(ie,Z),dt=Z.source;n.bindTexture(ut,ie.__webglTexture,e.TEXTURE0+Ve);const G=i.get(dt);if(dt.version!==G.__version||gt===!0){n.activeTexture(e.TEXTURE0+Ve),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,Z.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Z.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,Z.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);const q=P(Z)&&C(Z.image)===!1;let Y=L(Z.image,q,!1,p);Y=Ft(Z,Y);const pe=C(Y)||c,Me=s.convert(Z.format,Z.colorSpace);let De=s.convert(Z.type),Ee=U(Z.internalFormat,Me,De,Z.colorSpace);Fe(ut,Z,pe);let je;const nt=Z.mipmaps,ft=c&&Z.isVideoTexture!==!0,se=G.__version===void 0||gt===!0,Ze=I(Z,Y,pe);if(Z.isDepthTexture)Ee=e.DEPTH_COMPONENT,c?Z.type===1015?Ee=e.DEPTH_COMPONENT32F:Z.type===1014?Ee=e.DEPTH_COMPONENT24:Z.type===1020?Ee=e.DEPTH24_STENCIL8:Ee=e.DEPTH_COMPONENT16:Z.type===1015&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),Z.format===1026&&Ee===e.DEPTH_COMPONENT&&Z.type!==1012&&Z.type!==1014&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),Z.type=Cx,De=s.convert(Z.type)),Z.format===1027&&Ee===e.DEPTH_COMPONENT&&(Ee=e.DEPTH_STENCIL,Z.type!==1020&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),Z.type=Lx,De=s.convert(Z.type))),se&&(ft?n.texStorage2D(e.TEXTURE_2D,1,Ee,Y.width,Y.height):n.texImage2D(e.TEXTURE_2D,0,Ee,Y.width,Y.height,0,Me,De,null));else if(Z.isDataTexture)if(nt.length>0&&pe){ft&&se&&n.texStorage2D(e.TEXTURE_2D,Ze,Ee,nt[0].width,nt[0].height);for(let Se=0,Ke=nt.length;Se<Ke;Se++)je=nt[Se],ft?n.texSubImage2D(e.TEXTURE_2D,Se,0,0,je.width,je.height,Me,De,je.data):n.texImage2D(e.TEXTURE_2D,Se,Ee,je.width,je.height,0,Me,De,je.data);Z.generateMipmaps=!1}else ft?(se&&n.texStorage2D(e.TEXTURE_2D,Ze,Ee,Y.width,Y.height),n.texSubImage2D(e.TEXTURE_2D,0,0,0,Y.width,Y.height,Me,De,Y.data)):n.texImage2D(e.TEXTURE_2D,0,Ee,Y.width,Y.height,0,Me,De,Y.data);else if(Z.isCompressedTexture)if(Z.isCompressedArrayTexture){ft&&se&&n.texStorage3D(e.TEXTURE_2D_ARRAY,Ze,Ee,nt[0].width,nt[0].height,Y.depth);for(let Se=0,Ke=nt.length;Se<Ke;Se++)je=nt[Se],Z.format!==1023?Me!==null?ft?n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,Se,0,0,0,je.width,je.height,Y.depth,Me,je.data,0,0):n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,Se,Ee,je.width,je.height,Y.depth,0,je.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ft?n.texSubImage3D(e.TEXTURE_2D_ARRAY,Se,0,0,0,je.width,je.height,Y.depth,Me,De,je.data):n.texImage3D(e.TEXTURE_2D_ARRAY,Se,Ee,je.width,je.height,Y.depth,0,Me,De,je.data)}else{ft&&se&&n.texStorage2D(e.TEXTURE_2D,Ze,Ee,nt[0].width,nt[0].height);for(let Se=0,Ke=nt.length;Se<Ke;Se++)je=nt[Se],Z.format!==1023?Me!==null?ft?n.compressedTexSubImage2D(e.TEXTURE_2D,Se,0,0,je.width,je.height,Me,je.data):n.compressedTexImage2D(e.TEXTURE_2D,Se,Ee,je.width,je.height,0,je.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ft?n.texSubImage2D(e.TEXTURE_2D,Se,0,0,je.width,je.height,Me,De,je.data):n.texImage2D(e.TEXTURE_2D,Se,Ee,je.width,je.height,0,Me,De,je.data)}else if(Z.isDataArrayTexture)ft?(se&&n.texStorage3D(e.TEXTURE_2D_ARRAY,Ze,Ee,Y.width,Y.height,Y.depth),n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,Y.width,Y.height,Y.depth,Me,De,Y.data)):n.texImage3D(e.TEXTURE_2D_ARRAY,0,Ee,Y.width,Y.height,Y.depth,0,Me,De,Y.data);else if(Z.isData3DTexture)ft?(se&&n.texStorage3D(e.TEXTURE_3D,Ze,Ee,Y.width,Y.height,Y.depth),n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,Y.width,Y.height,Y.depth,Me,De,Y.data)):n.texImage3D(e.TEXTURE_3D,0,Ee,Y.width,Y.height,Y.depth,0,Me,De,Y.data);else if(Z.isFramebufferTexture){if(se)if(ft)n.texStorage2D(e.TEXTURE_2D,Ze,Ee,Y.width,Y.height);else{let Se=Y.width,Ke=Y.height;for(let le=0;le<Ze;le++)n.texImage2D(e.TEXTURE_2D,le,Ee,Se,Ke,0,Me,De,null),Se>>=1,Ke>>=1}}else if(nt.length>0&&pe){ft&&se&&n.texStorage2D(e.TEXTURE_2D,Ze,Ee,nt[0].width,nt[0].height);for(let Se=0,Ke=nt.length;Se<Ke;Se++)je=nt[Se],ft?n.texSubImage2D(e.TEXTURE_2D,Se,0,0,Me,De,je):n.texImage2D(e.TEXTURE_2D,Se,Ee,Me,De,je);Z.generateMipmaps=!1}else ft?(se&&n.texStorage2D(e.TEXTURE_2D,Ze,Ee,Y.width,Y.height),n.texSubImage2D(e.TEXTURE_2D,0,0,0,Me,De,Y)):n.texImage2D(e.TEXTURE_2D,0,Ee,Me,De,Y);O(Z,pe)&&B(ut),G.__version=dt.version,Z.onUpdate&&Z.onUpdate(Z)}ie.__version=Z.version}function mt(ie,Z,Ve){if(Z.image.length!==6)return;const ut=Xe(ie,Z),gt=Z.source;n.bindTexture(e.TEXTURE_CUBE_MAP,ie.__webglTexture,e.TEXTURE0+Ve);const dt=i.get(gt);if(gt.version!==dt.__version||ut===!0){n.activeTexture(e.TEXTURE0+Ve),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,Z.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Z.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,Z.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);const G=Z.isCompressedTexture||Z.image[0].isCompressedTexture,q=Z.image[0]&&Z.image[0].isDataTexture,Y=[];for(let Se=0;Se<6;Se++)!G&&!q?Y[Se]=L(Z.image[Se],!1,!0,d):Y[Se]=q?Z.image[Se].image:Z.image[Se],Y[Se]=Ft(Z,Y[Se]);const pe=Y[0],Me=C(pe)||c,De=s.convert(Z.format,Z.colorSpace),Ee=s.convert(Z.type),je=U(Z.internalFormat,De,Ee,Z.colorSpace),nt=c&&Z.isVideoTexture!==!0,ft=dt.__version===void 0||ut===!0;let se=I(Z,pe,Me);Fe(e.TEXTURE_CUBE_MAP,Z,Me);let Ze;if(G){nt&&ft&&n.texStorage2D(e.TEXTURE_CUBE_MAP,se,je,pe.width,pe.height);for(let Se=0;Se<6;Se++){Ze=Y[Se].mipmaps;for(let Ke=0;Ke<Ze.length;Ke++){const le=Ze[Ke];Z.format!==1023?De!==null?nt?n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Ke,0,0,le.width,le.height,De,le.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Ke,je,le.width,le.height,0,le.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):nt?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Ke,0,0,le.width,le.height,De,Ee,le.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Ke,je,le.width,le.height,0,De,Ee,le.data)}}}else{Ze=Z.mipmaps,nt&&ft&&(Ze.length>0&&se++,n.texStorage2D(e.TEXTURE_CUBE_MAP,se,je,Y[0].width,Y[0].height));for(let Se=0;Se<6;Se++)if(q){nt?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Se,0,0,0,Y[Se].width,Y[Se].height,De,Ee,Y[Se].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Se,0,je,Y[Se].width,Y[Se].height,0,De,Ee,Y[Se].data);for(let Ke=0;Ke<Ze.length;Ke++){const le=Ze[Ke].image[Se].image;nt?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Ke+1,0,0,le.width,le.height,De,Ee,le.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Ke+1,je,le.width,le.height,0,De,Ee,le.data)}}else{nt?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Se,0,0,0,De,Ee,Y[Se]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Se,0,je,De,Ee,Y[Se]);for(let Ke=0;Ke<Ze.length;Ke++){const le=Ze[Ke];nt?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Ke+1,0,0,De,Ee,le.image[Se]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Ke+1,je,De,Ee,le.image[Se])}}}O(Z,Me)&&B(e.TEXTURE_CUBE_MAP),dt.__version=gt.version,Z.onUpdate&&Z.onUpdate(Z)}ie.__version=Z.version}function ne(ie,Z,Ve,ut,gt){const dt=s.convert(Ve.format,Ve.colorSpace),G=s.convert(Ve.type),q=U(Ve.internalFormat,dt,G,Ve.colorSpace);i.get(Z).__hasExternalTextures||(gt===e.TEXTURE_3D||gt===e.TEXTURE_2D_ARRAY?n.texImage3D(gt,0,q,Z.width,Z.height,Z.depth,0,dt,G,null):n.texImage2D(gt,0,q,Z.width,Z.height,0,dt,G,null)),n.bindFramebuffer(e.FRAMEBUFFER,ie),Mt(Z)?v.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,ut,gt,i.get(Ve).__webglTexture,0,St(Z)):(gt===e.TEXTURE_2D||gt>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&gt<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,ut,gt,i.get(Ve).__webglTexture,0),n.bindFramebuffer(e.FRAMEBUFFER,null)}function Be(ie,Z,Ve){if(e.bindRenderbuffer(e.RENDERBUFFER,ie),Z.depthBuffer&&!Z.stencilBuffer){let ut=e.DEPTH_COMPONENT16;if(Ve||Mt(Z)){const gt=Z.depthTexture;gt&&gt.isDepthTexture&&(gt.type===1015?ut=e.DEPTH_COMPONENT32F:gt.type===1014&&(ut=e.DEPTH_COMPONENT24));const dt=St(Z);Mt(Z)?v.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,dt,ut,Z.width,Z.height):e.renderbufferStorageMultisample(e.RENDERBUFFER,dt,ut,Z.width,Z.height)}else e.renderbufferStorage(e.RENDERBUFFER,ut,Z.width,Z.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,ie)}else if(Z.depthBuffer&&Z.stencilBuffer){const ut=St(Z);Ve&&Mt(Z)===!1?e.renderbufferStorageMultisample(e.RENDERBUFFER,ut,e.DEPTH24_STENCIL8,Z.width,Z.height):Mt(Z)?v.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,ut,e.DEPTH24_STENCIL8,Z.width,Z.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,Z.width,Z.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,ie)}else{const ut=Z.isWebGLMultipleRenderTargets===!0?Z.texture:[Z.texture];for(let gt=0;gt<ut.length;gt++){const dt=ut[gt],G=s.convert(dt.format,dt.colorSpace),q=s.convert(dt.type),Y=U(dt.internalFormat,G,q,dt.colorSpace),pe=St(Z);Ve&&Mt(Z)===!1?e.renderbufferStorageMultisample(e.RENDERBUFFER,pe,Y,Z.width,Z.height):Mt(Z)?v.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,pe,Y,Z.width,Z.height):e.renderbufferStorage(e.RENDERBUFFER,Y,Z.width,Z.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function Ne(ie,Z){if(Z&&Z.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(e.FRAMEBUFFER,ie),!(Z.depthTexture&&Z.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(Z.depthTexture).__webglTexture||Z.depthTexture.image.width!==Z.width||Z.depthTexture.image.height!==Z.height)&&(Z.depthTexture.image.width=Z.width,Z.depthTexture.image.height=Z.height,Z.depthTexture.needsUpdate=!0),de(Z.depthTexture,0);const Ve=i.get(Z.depthTexture).__webglTexture,ut=St(Z);if(Z.depthTexture.format===1026)Mt(Z)?v.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,Ve,0,ut):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,Ve,0);else if(Z.depthTexture.format===1027)Mt(Z)?v.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,Ve,0,ut):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,Ve,0);else throw new Error("Unknown depthTexture format")}function ve(ie){const Z=i.get(ie),Ve=ie.isWebGLCubeRenderTarget===!0;if(ie.depthTexture&&!Z.__autoAllocateDepthBuffer){if(Ve)throw new Error("target.depthTexture not supported in Cube render targets");Ne(Z.__webglFramebuffer,ie)}else if(Ve){Z.__webglDepthbuffer=[];for(let ut=0;ut<6;ut++)n.bindFramebuffer(e.FRAMEBUFFER,Z.__webglFramebuffer[ut]),Z.__webglDepthbuffer[ut]=e.createRenderbuffer(),Be(Z.__webglDepthbuffer[ut],ie,!1)}else n.bindFramebuffer(e.FRAMEBUFFER,Z.__webglFramebuffer),Z.__webglDepthbuffer=e.createRenderbuffer(),Be(Z.__webglDepthbuffer,ie,!1);n.bindFramebuffer(e.FRAMEBUFFER,null)}function ye(ie,Z,Ve){const ut=i.get(ie);Z!==void 0&&ne(ut.__webglFramebuffer,ie,ie.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D),Ve!==void 0&&ve(ie)}function et(ie){const Z=ie.texture,Ve=i.get(ie),ut=i.get(Z);ie.addEventListener("dispose",oe),ie.isWebGLMultipleRenderTargets!==!0&&(ut.__webglTexture===void 0&&(ut.__webglTexture=e.createTexture()),ut.__version=Z.version,a.memory.textures++);const gt=ie.isWebGLCubeRenderTarget===!0,dt=ie.isWebGLMultipleRenderTargets===!0,G=C(ie)||c;if(gt){Ve.__webglFramebuffer=[];for(let q=0;q<6;q++)Ve.__webglFramebuffer[q]=e.createFramebuffer()}else{if(Ve.__webglFramebuffer=e.createFramebuffer(),dt)if(r.drawBuffers){const q=ie.texture;for(let Y=0,pe=q.length;Y<pe;Y++){const Me=i.get(q[Y]);Me.__webglTexture===void 0&&(Me.__webglTexture=e.createTexture(),a.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(c&&ie.samples>0&&Mt(ie)===!1){const q=dt?Z:[Z];Ve.__webglMultisampledFramebuffer=e.createFramebuffer(),Ve.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,Ve.__webglMultisampledFramebuffer);for(let Y=0;Y<q.length;Y++){const pe=q[Y];Ve.__webglColorRenderbuffer[Y]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,Ve.__webglColorRenderbuffer[Y]);const Me=s.convert(pe.format,pe.colorSpace),De=s.convert(pe.type),Ee=U(pe.internalFormat,Me,De,pe.colorSpace,ie.isXRRenderTarget===!0),je=St(ie);e.renderbufferStorageMultisample(e.RENDERBUFFER,je,Ee,ie.width,ie.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+Y,e.RENDERBUFFER,Ve.__webglColorRenderbuffer[Y])}e.bindRenderbuffer(e.RENDERBUFFER,null),ie.depthBuffer&&(Ve.__webglDepthRenderbuffer=e.createRenderbuffer(),Be(Ve.__webglDepthRenderbuffer,ie,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(gt){n.bindTexture(e.TEXTURE_CUBE_MAP,ut.__webglTexture),Fe(e.TEXTURE_CUBE_MAP,Z,G);for(let q=0;q<6;q++)ne(Ve.__webglFramebuffer[q],ie,Z,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+q);O(Z,G)&&B(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(dt){const q=ie.texture;for(let Y=0,pe=q.length;Y<pe;Y++){const Me=q[Y],De=i.get(Me);n.bindTexture(e.TEXTURE_2D,De.__webglTexture),Fe(e.TEXTURE_2D,Me,G),ne(Ve.__webglFramebuffer,ie,Me,e.COLOR_ATTACHMENT0+Y,e.TEXTURE_2D),O(Me,G)&&B(e.TEXTURE_2D)}n.unbindTexture()}else{let q=e.TEXTURE_2D;(ie.isWebGL3DRenderTarget||ie.isWebGLArrayRenderTarget)&&(c?q=ie.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(q,ut.__webglTexture),Fe(q,Z,G),ne(Ve.__webglFramebuffer,ie,Z,e.COLOR_ATTACHMENT0,q),O(Z,G)&&B(q),n.unbindTexture()}ie.depthBuffer&&ve(ie)}function tt(ie){const Z=C(ie)||c,Ve=ie.isWebGLMultipleRenderTargets===!0?ie.texture:[ie.texture];for(let ut=0,gt=Ve.length;ut<gt;ut++){const dt=Ve[ut];if(O(dt,Z)){const G=ie.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,q=i.get(dt).__webglTexture;n.bindTexture(G,q),B(G),n.unbindTexture()}}}function _t(ie){if(c&&ie.samples>0&&Mt(ie)===!1){const Z=ie.isWebGLMultipleRenderTargets?ie.texture:[ie.texture],Ve=ie.width,ut=ie.height;let gt=e.COLOR_BUFFER_BIT;const dt=[],G=ie.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,q=i.get(ie),Y=ie.isWebGLMultipleRenderTargets===!0;if(Y)for(let pe=0;pe<Z.length;pe++)n.bindFramebuffer(e.FRAMEBUFFER,q.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+pe,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,q.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+pe,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,q.__webglMultisampledFramebuffer),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,q.__webglFramebuffer);for(let pe=0;pe<Z.length;pe++){dt.push(e.COLOR_ATTACHMENT0+pe),ie.depthBuffer&&dt.push(G);const Me=q.__ignoreDepthValues!==void 0?q.__ignoreDepthValues:!1;if(Me===!1&&(ie.depthBuffer&&(gt|=e.DEPTH_BUFFER_BIT),ie.stencilBuffer&&(gt|=e.STENCIL_BUFFER_BIT)),Y&&e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,q.__webglColorRenderbuffer[pe]),Me===!0&&(e.invalidateFramebuffer(e.READ_FRAMEBUFFER,[G]),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[G])),Y){const De=i.get(Z[pe]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,De,0)}e.blitFramebuffer(0,0,Ve,ut,0,0,Ve,ut,gt,e.NEAREST),y&&e.invalidateFramebuffer(e.READ_FRAMEBUFFER,dt)}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),Y)for(let pe=0;pe<Z.length;pe++){n.bindFramebuffer(e.FRAMEBUFFER,q.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+pe,e.RENDERBUFFER,q.__webglColorRenderbuffer[pe]);const Me=i.get(Z[pe]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,q.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+pe,e.TEXTURE_2D,Me,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,q.__webglMultisampledFramebuffer)}}function St(ie){return Math.min(g,ie.samples)}function Mt(ie){const Z=i.get(ie);return c&&ie.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&Z.__useRenderToTexture!==!1}function Bt(ie){const Z=a.render.frame;S.get(ie)!==Z&&(S.set(ie,Z),ie.update())}function Ft(ie,Z){const Ve=ie.colorSpace,ut=ie.format,gt=ie.type;return ie.isCompressedTexture===!0||ie.format===1035||Ve!=="srgb-linear"&&Ve!==""&&(Ve==="srgb"?c===!1?t.has("EXT_sRGB")===!0&&ut===1023?(ie.format=xR,ie.minFilter=Er,ie.generateMipmaps=!1):Z=rw.sRGBToLinear(Z):(ut!==1023||gt!==1009)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Ve)),Z}this.allocateTextureUnit=J,this.resetTextureUnits=j,this.setTexture2D=de,this.setTexture2DArray=fe,this.setTexture3D=F,this.setTextureCube=re,this.rebindTextures=ye,this.setupRenderTarget=et,this.updateRenderTargetMipmap=tt,this.updateMultisampleRenderTarget=_t,this.setupDepthRenderbuffer=ve,this.setupFrameBufferTexture=ne,this.useMultisampledRTT=Mt}function kR(e,t,n){const i=n.isWebGL2;function r(s,a=""){let c;if(s===1009)return e.UNSIGNED_BYTE;if(s===1017)return e.UNSIGNED_SHORT_4_4_4_4;if(s===1018)return e.UNSIGNED_SHORT_5_5_5_1;if(s===1010)return e.BYTE;if(s===1011)return e.SHORT;if(s===1012)return e.UNSIGNED_SHORT;if(s===1013)return e.INT;if(s===1014)return e.UNSIGNED_INT;if(s===1015)return e.FLOAT;if(s===1016)return i?e.HALF_FLOAT:(c=t.get("OES_texture_half_float"),c!==null?c.HALF_FLOAT_OES:null);if(s===1021)return e.ALPHA;if(s===1023)return e.RGBA;if(s===1024)return e.LUMINANCE;if(s===1025)return e.LUMINANCE_ALPHA;if(s===1026)return e.DEPTH_COMPONENT;if(s===1027)return e.DEPTH_STENCIL;if(s===1035)return c=t.get("EXT_sRGB"),c!==null?c.SRGB_ALPHA_EXT:null;if(s===1028)return e.RED;if(s===1029)return e.RED_INTEGER;if(s===1030)return e.RG;if(s===1031)return e.RG_INTEGER;if(s===1033)return e.RGBA_INTEGER;if(s===33776||s===33777||s===33778||s===33779)if(a==="srgb")if(c=t.get("WEBGL_compressed_texture_s3tc_srgb"),c!==null){if(s===33776)return c.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===33777)return c.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===33778)return c.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===33779)return c.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(c=t.get("WEBGL_compressed_texture_s3tc"),c!==null){if(s===33776)return c.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===33777)return c.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===33778)return c.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===33779)return c.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===35840||s===35841||s===35842||s===35843)if(c=t.get("WEBGL_compressed_texture_pvrtc"),c!==null){if(s===35840)return c.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===35841)return c.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===35842)return c.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===35843)return c.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===36196)return c=t.get("WEBGL_compressed_texture_etc1"),c!==null?c.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===37492||s===37496)if(c=t.get("WEBGL_compressed_texture_etc"),c!==null){if(s===37492)return a==="srgb"?c.COMPRESSED_SRGB8_ETC2:c.COMPRESSED_RGB8_ETC2;if(s===37496)return a==="srgb"?c.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:c.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===37808||s===37809||s===37810||s===37811||s===37812||s===37813||s===37814||s===37815||s===37816||s===37817||s===37818||s===37819||s===37820||s===37821)if(c=t.get("WEBGL_compressed_texture_astc"),c!==null){if(s===37808)return a==="srgb"?c.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:c.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===37809)return a==="srgb"?c.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:c.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===37810)return a==="srgb"?c.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:c.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===37811)return a==="srgb"?c.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:c.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===37812)return a==="srgb"?c.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:c.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===37813)return a==="srgb"?c.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:c.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===37814)return a==="srgb"?c.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:c.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===37815)return a==="srgb"?c.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:c.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===37816)return a==="srgb"?c.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:c.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===37817)return a==="srgb"?c.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:c.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===37818)return a==="srgb"?c.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:c.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===37819)return a==="srgb"?c.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:c.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===37820)return a==="srgb"?c.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:c.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===37821)return a==="srgb"?c.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:c.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===36492)if(c=t.get("EXT_texture_compression_bptc"),c!==null){if(s===36492)return a==="srgb"?c.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:c.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===36283||s===36284||s===36285||s===36286)if(c=t.get("EXT_texture_compression_rgtc"),c!==null){if(s===36492)return c.COMPRESSED_RED_RGTC1_EXT;if(s===36284)return c.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===36285)return c.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===36286)return c.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===1020?i?e.UNSIGNED_INT_24_8:(c=t.get("WEBGL_depth_texture"),c!==null?c.UNSIGNED_INT_24_8_WEBGL:null):e[s]!==void 0?e[s]:null}return{convert:r}}var GR=class extends wr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}},Bp=class extends Wn{constructor(){super(),this.isGroup=!0,this.type="Group"}},YU={type:"move"},Qb=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Bp,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 Bp,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ae,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ae),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Bp,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ae,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ae),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 n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,s=null;const a=this._targetRay,c=this._grip,u=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(u&&e.hand){s=!0;for(const S of e.hand.values()){const E=t.getJointPose(S,n),w=this._getHandJoint(u,S);E!==null&&(w.matrix.fromArray(E.transform.matrix),w.matrix.decompose(w.position,w.rotation,w.scale),w.matrixWorldNeedsUpdate=!0,w.jointRadius=E.radius),w.visible=E!==null}const d=u.joints["index-finger-tip"],p=u.joints["thumb-tip"],g=d.position.distanceTo(p.position),v=.02,y=.005;u.inputState.pinching&&g>v+y?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&g<=v-y&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&r!==null&&(i=r),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(YU)))}return a!==null&&(a.visible=i!==null),c!==null&&(c.visible=r!==null),u!==null&&(u.visible=s!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Bp;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},HR=class extends Cr{constructor(e,t,n,i,r,s,a,c,u,d){if(d=d!==void 0?d:QM,d!==1026&&d!==1027)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&d===1026&&(n=Cx),n===void 0&&d===1027&&(n=Lx),super(null,i,r,s,a,c,d,n,u),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:as,this.minFilter=c!==void 0?c:as,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}},qU=class extends ic{constructor(e,t){super();const n=this;let i=null,r=1,s=null,a="local-floor",c=1,u=null,d=null,p=null,g=null,v=null,y=null;const S=t.getContextAttributes();let E=null,w=null;const b=[],T=[];let L=null;const C=new wr;C.layers.enable(1),C.viewport=new $n;const P=new wr;P.layers.enable(2),P.viewport=new $n;const O=[C,P],B=new GR;B.layers.enable(1),B.layers.enable(2);let U=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getCamera=function(){},this.setUserCamera=function(fe){L=fe},this.getController=function(fe){let F=b[fe];return F===void 0&&(F=new Qb,b[fe]=F),F.getTargetRaySpace()},this.getControllerGrip=function(fe){let F=b[fe];return F===void 0&&(F=new Qb,b[fe]=F),F.getGripSpace()},this.getHand=function(fe){let F=b[fe];return F===void 0&&(F=new Qb,b[fe]=F),F.getHandSpace()};function z(fe){const F=T.indexOf(fe.inputSource);if(F===-1)return;const re=b[F];re!==void 0&&(re.update(fe.inputSource,fe.frame,u||s),re.dispatchEvent({type:fe.type,data:fe.inputSource}))}function te(){i.removeEventListener("select",z),i.removeEventListener("selectstart",z),i.removeEventListener("selectend",z),i.removeEventListener("squeeze",z),i.removeEventListener("squeezestart",z),i.removeEventListener("squeezeend",z),i.removeEventListener("end",te),i.removeEventListener("inputsourceschange",oe);for(let fe=0;fe<b.length;fe++){const F=T[fe];F!==null&&(T[fe]=null,b[fe].disconnect(F))}U=null,I=null,e.setRenderTarget(E),v=null,g=null,p=null,i=null,w=null,de.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(fe){r=fe,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(fe){a=fe,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return u||s},this.setReferenceSpace=function(fe){u=fe},this.getBaseLayer=function(){return g!==null?g:v},this.getBinding=function(){return p},this.getFrame=function(){return y},this.getSession=function(){return i},this.setSession=async function(fe){if(i=fe,i!==null){if(E=e.getRenderTarget(),i.addEventListener("select",z),i.addEventListener("selectstart",z),i.addEventListener("selectend",z),i.addEventListener("squeeze",z),i.addEventListener("squeezestart",z),i.addEventListener("squeezeend",z),i.addEventListener("end",te),i.addEventListener("inputsourceschange",oe),S.xrCompatible!==!0&&await t.makeXRCompatible(),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const F={antialias:i.renderState.layers===void 0?S.antialias:!0,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:r};v=new XRWebGLLayer(i,t,F),i.updateRenderState({baseLayer:v}),w=new la(v.framebufferWidth,v.framebufferHeight,{format:$p,type:Z1,colorSpace:e.outputColorSpace,stencilBuffer:S.stencil})}else{let F=null,re=null,ue=null;S.depth&&(ue=S.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,F=S.stencil?mR:QM,re=S.stencil?Lx:Cx);const _e={colorFormat:t.RGBA8,depthFormat:ue,scaleFactor:r};p=new XRWebGLBinding(i,t),g=p.createProjectionLayer(_e),i.updateRenderState({layers:[g]}),w=new la(g.textureWidth,g.textureHeight,{format:$p,type:Z1,depthTexture:new HR(g.textureWidth,g.textureHeight,re,void 0,void 0,void 0,void 0,void 0,void 0,F),stencilBuffer:S.stencil,colorSpace:e.outputColorSpace,samples:S.antialias?4:0});const Le=e.properties.get(w);Le.__ignoreDepthValues=g.ignoreDepthValues}w.isXRRenderTarget=!0,this.setFoveation(c),u=null,s=await i.requestReferenceSpace(a),de.setContext(i),de.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode};function oe(fe){for(let F=0;F<fe.removed.length;F++){const re=fe.removed[F],ue=T.indexOf(re);ue>=0&&(T[ue]=null,b[ue].disconnect(re))}for(let F=0;F<fe.added.length;F++){const re=fe.added[F];let ue=T.indexOf(re);if(ue===-1){for(let Le=0;Le<b.length;Le++)if(Le>=T.length){T.push(re),ue=Le;break}else if(T[Le]===null){T[Le]=re,ue=Le;break}if(ue===-1)break}const _e=b[ue];_e&&_e.connect(re)}}const ee=new ae,k=new ae;function X(fe,F,re){ee.setFromMatrixPosition(F.matrixWorld),k.setFromMatrixPosition(re.matrixWorld);const ue=ee.distanceTo(k),_e=F.projectionMatrix.elements,Le=re.projectionMatrix.elements,Fe=_e[14]/(_e[10]-1),Xe=_e[14]/(_e[10]+1),lt=(_e[9]+1)/_e[5],mt=(_e[9]-1)/_e[5],ne=(_e[8]-1)/_e[0],Be=(Le[8]+1)/Le[0],Ne=Fe*ne,ve=Fe*Be,ye=ue/(-ne+Be),et=ye*-ne;F.matrixWorld.decompose(fe.position,fe.quaternion,fe.scale),fe.translateX(et),fe.translateZ(ye),fe.matrixWorld.compose(fe.position,fe.quaternion,fe.scale),fe.matrixWorldInverse.copy(fe.matrixWorld).invert();const tt=Fe+ye,_t=Xe+ye,St=Ne-et,Mt=ve+(ue-et),Bt=lt*Xe/_t*tt,Ft=mt*Xe/_t*tt;fe.projectionMatrix.makePerspective(St,Mt,Bt,Ft,tt,_t),fe.projectionMatrixInverse.copy(fe.projectionMatrix).invert()}function $(fe,F){F===null?fe.matrixWorld.copy(fe.matrix):fe.matrixWorld.multiplyMatrices(F.matrixWorld,fe.matrix),fe.matrixWorldInverse.copy(fe.matrixWorld).invert()}this.updateCameraXR=function(fe){if(i===null)return fe;L&&(fe=L),B.near=P.near=C.near=fe.near,B.far=P.far=C.far=fe.far,(U!==B.near||I!==B.far)&&(i.updateRenderState({depthNear:B.near,depthFar:B.far}),U=B.near,I=B.far);const F=fe.parent,re=B.cameras;$(B,F);for(let ue=0;ue<re.length;ue++)$(re[ue],F);return re.length===2?X(B,C,P):B.projectionMatrix.copy(C.projectionMatrix),L&&j(B,F),B};function j(fe,F){const re=L;F===null?re.matrix.copy(fe.matrixWorld):(re.matrix.copy(F.matrixWorld),re.matrix.invert(),re.matrix.multiply(fe.matrixWorld)),re.matrix.decompose(re.position,re.quaternion,re.scale),re.updateMatrixWorld(!0);const ue=re.children;for(let _e=0,Le=ue.length;_e<Le;_e++)ue[_e].updateMatrixWorld(!0);re.projectionMatrix.copy(fe.projectionMatrix),re.projectionMatrixInverse.copy(fe.projectionMatrixInverse),re.isPerspectiveCamera&&(re.fov=Kp*2*Math.atan(1/re.projectionMatrix.elements[5]),re.zoom=1)}this.getFoveation=function(){if(!(g===null&&v===null))return c},this.setFoveation=function(fe){c=fe,g!==null&&(g.fixedFoveation=fe),v!==null&&v.fixedFoveation!==void 0&&(v.fixedFoveation=fe)};let J=null;function xe(fe,F){if(d=F.getViewerPose(u||s),y=F,d!==null){const re=d.views;v!==null&&(e.setRenderTargetFramebuffer(w,v.framebuffer),e.setRenderTarget(w));let ue=!1;re.length!==B.cameras.length&&(B.cameras.length=0,ue=!0);for(let _e=0;_e<re.length;_e++){const Le=re[_e];let Fe=null;if(v!==null)Fe=v.getViewport(Le);else{const lt=p.getViewSubImage(g,Le);Fe=lt.viewport,_e===0&&(e.setRenderTargetTextures(w,lt.colorTexture,g.ignoreDepthValues?void 0:lt.depthStencilTexture),e.setRenderTarget(w))}let Xe=O[_e];Xe===void 0&&(Xe=new wr,Xe.layers.enable(_e),Xe.viewport=new $n,O[_e]=Xe),Xe.matrix.fromArray(Le.transform.matrix),Xe.matrix.decompose(Xe.position,Xe.quaternion,Xe.scale),Xe.projectionMatrix.fromArray(Le.projectionMatrix),Xe.projectionMatrixInverse.copy(Xe.projectionMatrix).invert(),Xe.viewport.set(Fe.x,Fe.y,Fe.width,Fe.height),_e===0&&(B.matrix.copy(Xe.matrix),B.matrix.decompose(B.position,B.quaternion,B.scale)),ue===!0&&B.cameras.push(Xe)}}for(let re=0;re<b.length;re++){const ue=T[re],_e=b[re];ue!==null&&_e!==void 0&&_e.update(ue,F,u||s)}J&&J(fe,F),F.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:F}),y=null}const de=new DR;de.setAnimationLoop(xe),this.setAnimationLoop=function(fe){J=fe},this.dispose=function(){}}};function $U(e,t){function n(w,b){w.matrixAutoUpdate===!0&&w.updateMatrix(),b.value.copy(w.matrix)}function i(w,b){b.color.getRGB(w.fogColor.value,PR(e)),b.isFog?(w.fogNear.value=b.near,w.fogFar.value=b.far):b.isFogExp2&&(w.fogDensity.value=b.density)}function r(w,b,T,L,C){b.isMeshBasicMaterial||b.isMeshLambertMaterial?s(w,b):b.isMeshToonMaterial?(s(w,b),g(w,b)):b.isMeshPhongMaterial?(s(w,b),p(w,b)):b.isMeshStandardMaterial?(s(w,b),v(w,b),b.isMeshPhysicalMaterial&&y(w,b,C)):b.isMeshMatcapMaterial?(s(w,b),S(w,b)):b.isMeshDepthMaterial?s(w,b):b.isMeshDistanceMaterial?(s(w,b),E(w,b)):b.isMeshNormalMaterial?s(w,b):b.isLineBasicMaterial?(a(w,b),b.isLineDashedMaterial&&c(w,b)):b.isPointsMaterial?u(w,b,T,L):b.isSpriteMaterial?d(w,b):b.isShadowMaterial?(w.color.value.copy(b.color),w.opacity.value=b.opacity):b.isShaderMaterial&&(b.uniformsNeedUpdate=!1)}function s(w,b){w.opacity.value=b.opacity,b.color&&w.diffuse.value.copy(b.color),b.emissive&&w.emissive.value.copy(b.emissive).multiplyScalar(b.emissiveIntensity),b.map&&(w.map.value=b.map,n(b.map,w.mapTransform)),b.alphaMap&&(w.alphaMap.value=b.alphaMap,n(b.alphaMap,w.alphaMapTransform)),b.bumpMap&&(w.bumpMap.value=b.bumpMap,n(b.bumpMap,w.bumpMapTransform),w.bumpScale.value=b.bumpScale,b.side===1&&(w.bumpScale.value*=-1)),b.normalMap&&(w.normalMap.value=b.normalMap,n(b.normalMap,w.normalMapTransform),w.normalScale.value.copy(b.normalScale),b.side===1&&w.normalScale.value.negate()),b.displacementMap&&(w.displacementMap.value=b.displacementMap,n(b.displacementMap,w.displacementMapTransform),w.displacementScale.value=b.displacementScale,w.displacementBias.value=b.displacementBias),b.emissiveMap&&(w.emissiveMap.value=b.emissiveMap,n(b.emissiveMap,w.emissiveMapTransform)),b.specularMap&&(w.specularMap.value=b.specularMap,n(b.specularMap,w.specularMapTransform)),b.alphaTest>0&&(w.alphaTest.value=b.alphaTest);const T=t.get(b).envMap;if(T&&(w.envMap.value=T,w.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,w.reflectivity.value=b.reflectivity,w.ior.value=b.ior,w.refractionRatio.value=b.refractionRatio),b.lightMap){w.lightMap.value=b.lightMap;const L=e.useLegacyLights===!0?Math.PI:1;w.lightMapIntensity.value=b.lightMapIntensity*L,n(b.lightMap,w.lightMapTransform)}b.aoMap&&(w.aoMap.value=b.aoMap,w.aoMapIntensity.value=b.aoMapIntensity,n(b.aoMap,w.aoMapTransform))}function a(w,b){w.diffuse.value.copy(b.color),w.opacity.value=b.opacity,b.map&&(w.map.value=b.map,n(b.map,w.mapTransform))}function c(w,b){w.dashSize.value=b.dashSize,w.totalSize.value=b.dashSize+b.gapSize,w.scale.value=b.scale}function u(w,b,T,L){w.diffuse.value.copy(b.color),w.opacity.value=b.opacity,w.size.value=b.size*T,w.scale.value=L*.5,b.map&&(w.map.value=b.map,n(b.map,w.uvTransform)),b.alphaMap&&(w.alphaMap.value=b.alphaMap,n(b.alphaMap,w.alphaMapTransform)),b.alphaTest>0&&(w.alphaTest.value=b.alphaTest)}function d(w,b){w.diffuse.value.copy(b.color),w.opacity.value=b.opacity,w.rotation.value=b.rotation,b.map&&(w.map.value=b.map,n(b.map,w.mapTransform)),b.alphaMap&&(w.alphaMap.value=b.alphaMap,n(b.alphaMap,w.alphaMapTransform)),b.alphaTest>0&&(w.alphaTest.value=b.alphaTest)}function p(w,b){w.specular.value.copy(b.specular),w.shininess.value=Math.max(b.shininess,1e-4)}function g(w,b){b.gradientMap&&(w.gradientMap.value=b.gradientMap)}function v(w,b){w.metalness.value=b.metalness,b.metalnessMap&&(w.metalnessMap.value=b.metalnessMap,n(b.metalnessMap,w.metalnessMapTransform)),w.roughness.value=b.roughness,b.roughnessMap&&(w.roughnessMap.value=b.roughnessMap,n(b.roughnessMap,w.roughnessMapTransform)),t.get(b).envMap&&(w.envMapIntensity.value=b.envMapIntensity)}function y(w,b,T){w.ior.value=b.ior,b.sheen>0&&(w.sheenColor.value.copy(b.sheenColor).multiplyScalar(b.sheen),w.sheenRoughness.value=b.sheenRoughness,b.sheenColorMap&&(w.sheenColorMap.value=b.sheenColorMap,n(b.sheenColorMap,w.sheenColorMapTransform)),b.sheenRoughnessMap&&(w.sheenRoughnessMap.value=b.sheenRoughnessMap,n(b.sheenRoughnessMap,w.sheenRoughnessMapTransform))),b.clearcoat>0&&(w.clearcoat.value=b.clearcoat,w.clearcoatRoughness.value=b.clearcoatRoughness,b.clearcoatMap&&(w.clearcoatMap.value=b.clearcoatMap,n(b.clearcoatMap,w.clearcoatMapTransform)),b.clearcoatRoughnessMap&&(w.clearcoatRoughnessMap.value=b.clearcoatRoughnessMap,n(b.clearcoatRoughnessMap,w.clearcoatRoughnessMapTransform)),b.clearcoatNormalMap&&(w.clearcoatNormalMap.value=b.clearcoatNormalMap,n(b.clearcoatNormalMap,w.clearcoatNormalMapTransform),w.clearcoatNormalScale.value.copy(b.clearcoatNormalScale),b.side===1&&w.clearcoatNormalScale.value.negate())),b.iridescence>0&&(w.iridescence.value=b.iridescence,w.iridescenceIOR.value=b.iridescenceIOR,w.iridescenceThicknessMinimum.value=b.iridescenceThicknessRange[0],w.iridescenceThicknessMaximum.value=b.iridescenceThicknessRange[1],b.iridescenceMap&&(w.iridescenceMap.value=b.iridescenceMap,n(b.iridescenceMap,w.iridescenceMapTransform)),b.iridescenceThicknessMap&&(w.iridescenceThicknessMap.value=b.iridescenceThicknessMap,n(b.iridescenceThicknessMap,w.iridescenceThicknessMapTransform))),b.transmission>0&&(w.transmission.value=b.transmission,w.transmissionSamplerMap.value=T.texture,w.transmissionSamplerSize.value.set(T.width,T.height),b.transmissionMap&&(w.transmissionMap.value=b.transmissionMap,n(b.transmissionMap,w.transmissionMapTransform)),w.thickness.value=b.thickness,b.thicknessMap&&(w.thicknessMap.value=b.thicknessMap,n(b.thicknessMap,w.thicknessMapTransform)),w.attenuationDistance.value=b.attenuationDistance,w.attenuationColor.value.copy(b.attenuationColor)),b.anisotropy>0&&(w.anisotropyVector.value.set(b.anisotropy*Math.cos(b.anisotropyRotation),b.anisotropy*Math.sin(b.anisotropyRotation)),b.anisotropyMap&&(w.anisotropyMap.value=b.anisotropyMap,n(b.anisotropyMap,w.anisotropyMapTransform))),w.specularIntensity.value=b.specularIntensity,w.specularColor.value.copy(b.specularColor),b.specularColorMap&&(w.specularColorMap.value=b.specularColorMap,n(b.specularColorMap,w.specularColorMapTransform)),b.specularIntensityMap&&(w.specularIntensityMap.value=b.specularIntensityMap,n(b.specularIntensityMap,w.specularIntensityMapTransform))}function S(w,b){b.matcap&&(w.matcap.value=b.matcap)}function E(w,b){const T=t.get(b).light;w.referencePosition.value.setFromMatrixPosition(T.matrixWorld),w.nearDistance.value=T.shadow.camera.near,w.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function ZU(e,t,n,i){let r={},s={},a=[];const c=n.isWebGL2?e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS):0;function u(T,L){const C=L.program;i.uniformBlockBinding(T,C)}function d(T,L){let C=r[T.id];C===void 0&&(S(T),C=p(T),r[T.id]=C,T.addEventListener("dispose",w));const P=L.program;i.updateUBOMapping(T,P);const O=t.render.frame;s[T.id]!==O&&(v(T),s[T.id]=O)}function p(T){const L=g();T.__bindingPointIndex=L;const C=e.createBuffer(),P=T.__size,O=T.usage;return e.bindBuffer(e.UNIFORM_BUFFER,C),e.bufferData(e.UNIFORM_BUFFER,P,O),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,L,C),C}function g(){for(let T=0;T<c;T++)if(a.indexOf(T)===-1)return a.push(T),T;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function v(T){const L=r[T.id],C=T.uniforms,P=T.__cache;e.bindBuffer(e.UNIFORM_BUFFER,L);for(let O=0,B=C.length;O<B;O++){const U=C[O];if(y(U,O,P)===!0){const I=U.__offset,z=Array.isArray(U.value)?U.value:[U.value];let te=0;for(let oe=0;oe<z.length;oe++){const ee=z[oe],k=E(ee);typeof ee=="number"?(U.__data[0]=ee,e.bufferSubData(e.UNIFORM_BUFFER,I+te,U.__data)):ee.isMatrix3?(U.__data[0]=ee.elements[0],U.__data[1]=ee.elements[1],U.__data[2]=ee.elements[2],U.__data[3]=ee.elements[0],U.__data[4]=ee.elements[3],U.__data[5]=ee.elements[4],U.__data[6]=ee.elements[5],U.__data[7]=ee.elements[0],U.__data[8]=ee.elements[6],U.__data[9]=ee.elements[7],U.__data[10]=ee.elements[8],U.__data[11]=ee.elements[0]):(ee.toArray(U.__data,te),te+=k.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,I,U.__data)}}e.bindBuffer(e.UNIFORM_BUFFER,null)}function y(T,L,C){const P=T.value;if(C[L]===void 0){if(typeof P=="number")C[L]=P;else{const O=Array.isArray(P)?P:[P],B=[];for(let U=0;U<O.length;U++)B.push(O[U].clone());C[L]=B}return!0}else if(typeof P=="number"){if(C[L]!==P)return C[L]=P,!0}else{const O=Array.isArray(C[L])?C[L]:[C[L]],B=Array.isArray(P)?P:[P];for(let U=0;U<O.length;U++){const I=O[U];if(I.equals(B[U])===!1)return I.copy(B[U]),!0}}return!1}function S(T){const L=T.uniforms;let C=0;const P=16;let O=0;for(let B=0,U=L.length;B<U;B++){const I=L[B],z={boundary:0,storage:0},te=Array.isArray(I.value)?I.value:[I.value];for(let oe=0,ee=te.length;oe<ee;oe++){const k=te[oe],X=E(k);z.boundary+=X.boundary,z.storage+=X.storage}if(I.__data=new Float32Array(z.storage/Float32Array.BYTES_PER_ELEMENT),I.__offset=C,B>0){O=C%P;const oe=P-O;O!==0&&oe-z.boundary<0&&(C+=P-O,I.__offset=C)}C+=z.storage}return O=C%P,O>0&&(C+=P-O),T.__size=C,T.__cache={},this}function E(T){const L={boundary:0,storage:0};return typeof T=="number"?(L.boundary=4,L.storage=4):T.isVector2?(L.boundary=8,L.storage=8):T.isVector3||T.isColor?(L.boundary=16,L.storage=12):T.isVector4?(L.boundary=16,L.storage=16):T.isMatrix3?(L.boundary=48,L.storage=48):T.isMatrix4?(L.boundary=64,L.storage=64):T.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",T),L}function w(T){const L=T.target;L.removeEventListener("dispose",w);const C=a.indexOf(L.__bindingPointIndex);a.splice(C,1),e.deleteBuffer(r[L.id]),delete r[L.id],delete s[L.id]}function b(){for(const T in r)e.deleteBuffer(r[T]);a=[],r={},s={}}return{bind:u,update:d,dispose:b}}function KU(){const e=e0("canvas");return e.style.display="block",e}var WR=class{constructor(e={}){const{canvas:t=KU(),context:n=null,depth:i=!0,stencil:r=!0,alpha:s=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:u=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:p=!1}=e;this.isWebGLRenderer=!0;let g;n!==null?g=n.getContextAttributes().alpha:g=s;const v=new Uint32Array(4),y=new Int32Array(4);let S=null,E=null;const w=[],b=[];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=Mr,this.useLegacyLights=!0,this.toneMapping=0,this.toneMappingExposure=1;const T=this;let L=!1,C=0,P=0,O=null,B=-1,U=null;const I=new $n,z=new $n;let te=null;const oe=new Tt(0);let ee=0,k=t.width,X=t.height,$=1,j=null,J=null;const xe=new $n(0,0,k,X),de=new $n(0,0,k,X);let fe=!1;const F=new zx;let re=!1,ue=!1,_e=null;const Le=new un,Fe=new pt,Xe=new ae,lt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function mt(){return O===null?$:1}let ne=n;function Be(K,Re){for(let $e=0;$e<K.length;$e++){const Ae=K[$e],qe=t.getContext(Ae,Re);if(qe!==null)return qe}return null}try{const K={alpha:!0,depth:i,stencil:r,antialias:a,premultipliedAlpha:c,preserveDrawingBuffer:u,powerPreference:d,failIfMajorPerformanceCaveat:p};if("setAttribute"in t&&t.setAttribute("data-engine","three.js r153"),t.addEventListener("webglcontextlost",se,!1),t.addEventListener("webglcontextrestored",Ze,!1),t.addEventListener("webglcontextcreationerror",Se,!1),ne===null){const Re=["webgl2","webgl","experimental-webgl"];if(T.isWebGL1Renderer===!0&&Re.shift(),ne=Be(Re,K),ne===null)throw Be(Re)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}ne instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),ne.getShaderPrecisionFormat===void 0&&(ne.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(K){throw console.error("THREE.WebGLRenderer: "+K.message),K}let Ne,ve,ye,et,tt,_t,St,Mt,Bt,Ft,ie,Z,Ve,ut,gt,dt,G,q,Y,pe,Me,De,Ee,je;function nt(){Ne=new d6(ne),ve=new a6(ne,Ne,e),Ne.init(ve),De=new kR(ne,Ne,ve),ye=new XU(ne,Ne,ve),et=new g6(ne),tt=new IU,_t=new jU(ne,Ne,ye,tt,ve,De,et),St=new c6(T),Mt=new f6(T),Bt=new i6(ne,ve),Ee=new s6(ne,Ne,Bt,ve),Ft=new p6(ne,Bt,et,Ee),ie=new x6(ne,Ft,Bt,et),Y=new y6(ne,ve,_t),dt=new l6(tt),Z=new NU(T,St,Mt,Ne,ve,Ee,dt),Ve=new $U(T,tt),ut=new DU,gt=new kU(Ne,ve),q=new r6(T,St,Mt,ye,ie,g,c),G=new WU(T,ie,ve),je=new ZU(ne,et,ve,ye),pe=new o6(ne,Ne,et,ve),Me=new m6(ne,Ne,et,ve),et.programs=Z.programs,T.capabilities=ve,T.extensions=Ne,T.properties=tt,T.renderLists=ut,T.shadowMap=G,T.state=ye,T.info=et}nt();const ft=new qU(T,ne);this.xr=ft,this.getContext=function(){return ne},this.getContextAttributes=function(){return ne.getContextAttributes()},this.forceContextLoss=function(){const K=Ne.get("WEBGL_lose_context");K&&K.loseContext()},this.forceContextRestore=function(){const K=Ne.get("WEBGL_lose_context");K&&K.restoreContext()},this.getPixelRatio=function(){return $},this.setPixelRatio=function(K){K!==void 0&&($=K,this.setSize(k,X,!1))},this.getSize=function(K){return K.set(k,X)},this.setSize=function(K,Re,$e=!0){if(ft.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}k=K,X=Re,t.width=Math.floor(K*$),t.height=Math.floor(Re*$),$e===!0&&(t.style.width=K+"px",t.style.height=Re+"px"),this.setViewport(0,0,K,Re)},this.getDrawingBufferSize=function(K){return K.set(k*$,X*$).floor()},this.setDrawingBufferSize=function(K,Re,$e){k=K,X=Re,$=$e,t.width=Math.floor(K*$e),t.height=Math.floor(Re*$e),this.setViewport(0,0,K,Re)},this.getCurrentViewport=function(K){return K.copy(I)},this.getViewport=function(K){return K.copy(xe)},this.setViewport=function(K,Re,$e,Ae){K.isVector4?xe.set(K.x,K.y,K.z,K.w):xe.set(K,Re,$e,Ae),ye.viewport(I.copy(xe).multiplyScalar($).floor())},this.getScissor=function(K){return K.copy(de)},this.setScissor=function(K,Re,$e,Ae){K.isVector4?de.set(K.x,K.y,K.z,K.w):de.set(K,Re,$e,Ae),ye.scissor(z.copy(de).multiplyScalar($).floor())},this.getScissorTest=function(){return fe},this.setScissorTest=function(K){ye.setScissorTest(fe=K)},this.setOpaqueSort=function(K){j=K},this.setTransparentSort=function(K){J=K},this.getClearColor=function(K){return K.copy(q.getClearColor())},this.setClearColor=function(){q.setClearColor.apply(q,arguments)},this.getClearAlpha=function(){return q.getClearAlpha()},this.setClearAlpha=function(){q.setClearAlpha.apply(q,arguments)},this.clear=function(K=!0,Re=!0,$e=!0){let Ae=0;if(K){let qe=!1;if(O!==null){const xt=O.texture.format;qe=xt===1033||xt===1031||xt===1029}if(qe){const xt=O.texture.type,Dt=xt===1009||xt===1014||xt===1012||xt===1020||xt===1017||xt===1018,Rt=q.getClearColor(),Vt=q.getClearAlpha(),jt=Rt.r,zt=Rt.g,It=Rt.b,yn=tt.get(O).__webglFramebuffer;Dt?(v[0]=jt,v[1]=zt,v[2]=It,v[3]=Vt,ne.clearBufferuiv(ne.COLOR,yn,v)):(y[0]=jt,y[1]=zt,y[2]=It,y[3]=Vt,ne.clearBufferiv(ne.COLOR,yn,y))}else Ae|=ne.COLOR_BUFFER_BIT}Re&&(Ae|=ne.DEPTH_BUFFER_BIT),$e&&(Ae|=ne.STENCIL_BUFFER_BIT),ne.clear(Ae)},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",se,!1),t.removeEventListener("webglcontextrestored",Ze,!1),t.removeEventListener("webglcontextcreationerror",Se,!1),ut.dispose(),gt.dispose(),tt.dispose(),St.dispose(),Mt.dispose(),ie.dispose(),Ee.dispose(),je.dispose(),Z.dispose(),ft.dispose(),ft.removeEventListener("sessionstart",ke),ft.removeEventListener("sessionend",Nt),_e&&(_e.dispose(),_e=null),hn.stop()};function se(K){K.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),L=!0}function Ze(){console.log("THREE.WebGLRenderer: Context Restored."),L=!1;const K=et.autoReset,Re=G.enabled,$e=G.autoUpdate,Ae=G.needsUpdate,qe=G.type;nt(),et.autoReset=K,G.enabled=Re,G.autoUpdate=$e,G.needsUpdate=Ae,G.type=qe}function Se(K){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",K.statusMessage)}function Ke(K){const Re=K.target;Re.removeEventListener("dispose",Ke),le(Re)}function le(K){At(K),tt.remove(K)}function At(K){const Re=tt.get(K).programs;Re!==void 0&&(Re.forEach(function($e){Z.releaseProgram($e)}),K.isShaderMaterial&&Z.releaseShaderCache(K))}this.renderBufferDirect=function(K,Re,$e,Ae,qe,xt){Re===null&&(Re=lt);const Dt=qe.isMesh&&qe.matrixWorld.determinant()<0,Rt=Ls(K,Re,$e,Ae,qe);ye.setMaterial(Ae,Dt);let Vt=$e.index,jt=1;Ae.wireframe===!0&&(Vt=Ft.getWireframeAttribute($e),jt=2);const zt=$e.drawRange,It=$e.attributes.position;let yn=zt.start*jt,Kt=(zt.start+zt.count)*jt;xt!==null&&(yn=Math.max(yn,xt.start*jt),Kt=Math.min(Kt,(xt.start+xt.count)*jt)),Vt!==null?(yn=Math.max(yn,0),Kt=Math.min(Kt,Vt.count)):It!=null&&(yn=Math.max(yn,0),Kt=Math.min(Kt,It.count));const Ri=Kt-yn;if(Ri<0||Ri===1/0)return;Ee.setup(qe,Ae,Rt,$e,Vt);let Hi,On=pe;if(Vt!==null&&(Hi=Bt.get(Vt),On=Me,On.setIndex(Hi)),qe.isMesh)Ae.wireframe===!0?(ye.setLineWidth(Ae.wireframeLinewidth*mt()),On.setMode(ne.LINES)):On.setMode(ne.TRIANGLES);else if(qe.isLine){let tn=Ae.linewidth;tn===void 0&&(tn=1),ye.setLineWidth(tn*mt()),qe.isLineSegments?On.setMode(ne.LINES):qe.isLineLoop?On.setMode(ne.LINE_LOOP):On.setMode(ne.LINE_STRIP)}else qe.isPoints?On.setMode(ne.POINTS):qe.isSprite&&On.setMode(ne.TRIANGLES);if(qe.isInstancedMesh)On.renderInstances(yn,Ri,qe.count);else if($e.isInstancedBufferGeometry){const tn=$e._maxInstanceCount!==void 0?$e._maxInstanceCount:1/0,Lu=Math.min($e.instanceCount,tn);On.renderInstances(yn,Ri,Lu)}else On.render(yn,Ri)},this.compile=function(K,Re){function $e(Ae,qe,xt){Ae.transparent===!0&&Ae.side===2&&Ae.forceSinglePass===!1?(Ae.side=1,Ae.needsUpdate=!0,mi(Ae,qe,xt),Ae.side=0,Ae.needsUpdate=!0,mi(Ae,qe,xt),Ae.side=2):mi(Ae,qe,xt)}E=gt.get(K),E.init(),b.push(E),K.traverseVisible(function(Ae){Ae.isLight&&Ae.layers.test(Re.layers)&&(E.pushLight(Ae),Ae.castShadow&&E.pushShadow(Ae))}),E.setupLights(T.useLegacyLights),K.traverse(function(Ae){const qe=Ae.material;if(qe)if(Array.isArray(qe))for(let xt=0;xt<qe.length;xt++){const Dt=qe[xt];$e(Dt,K,Ae)}else $e(qe,K,Ae)}),b.pop(),E=null};let be=null;function Yt(K){be&&be(K)}function ke(){hn.stop()}function Nt(){hn.start()}const hn=new DR;hn.setAnimationLoop(Yt),typeof self<"u"&&hn.setContext(self),this.setAnimationLoop=function(K){be=K,ft.setAnimationLoop(K),K===null?hn.stop():hn.start()},ft.addEventListener("sessionstart",ke),ft.addEventListener("sessionend",Nt),this.render=function(K,Re){if(Re!==void 0&&Re.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;K.matrixWorldAutoUpdate===!0&&K.updateMatrixWorld(),Re.parent===null&&Re.matrixWorldAutoUpdate===!0&&Re.updateMatrixWorld(),ft.enabled===!0&&ft.isPresenting===!0&&(Re=ft.updateCameraXR(Re)),K.isScene===!0&&K.onBeforeRender(T,K,Re,O),E=gt.get(K,b.length),E.init(),b.push(E),Le.multiplyMatrices(Re.projectionMatrix,Re.matrixWorldInverse),F.setFromProjectionMatrix(Le),ue=this.localClippingEnabled,re=dt.init(this.clippingPlanes,ue),S=ut.get(K,w.length),S.init(),w.push(S),Gn(K,Re,0,T.sortObjects),S.finish(),T.sortObjects===!0&&S.sort(j,J),re===!0&&dt.beginShadows();const $e=E.state.shadowsArray;if(G.render($e,K,Re),re===!0&&dt.endShadows(),this.info.autoReset===!0&&this.info.reset(),this.info.render.frame++,q.render(S,K),E.setupLights(T.useLegacyLights),Re.isArrayCamera){const Ae=Re.cameras;for(let qe=0,xt=Ae.length;qe<xt;qe++){const Dt=Ae[qe];Di(S,K,Dt,Dt.viewport)}}else Di(S,K,Re);O!==null&&(_t.updateMultisampleRenderTarget(O),_t.updateRenderTargetMipmap(O)),K.isScene===!0&&K.onAfterRender(T,K,Re),Ee.resetDefaultState(),B=-1,U=null,b.pop(),b.length>0?E=b[b.length-1]:E=null,w.pop(),w.length>0?S=w[w.length-1]:S=null};function Gn(K,Re,$e,Ae){if(K.visible===!1)return;if(K.layers.test(Re.layers)){if(K.isGroup)$e=K.renderOrder;else if(K.isLOD)K.autoUpdate===!0&&K.update(Re);else if(K.isLight)E.pushLight(K),K.castShadow&&E.pushShadow(K);else if(K.isSprite){if(!K.frustumCulled||F.intersectsSprite(K)){Ae&&Xe.setFromMatrixPosition(K.matrixWorld).applyMatrix4(Le);const xt=ie.update(K),Dt=K.material;Dt.visible&&S.push(K,xt,Dt,$e,Xe.z,null)}}else if((K.isMesh||K.isLine||K.isPoints)&&(!K.frustumCulled||F.intersectsObject(K))){K.isSkinnedMesh&&K.skeleton.frame!==et.render.frame&&(K.skeleton.update(),K.skeleton.frame=et.render.frame);const xt=ie.update(K),Dt=K.material;if(Ae&&(K.boundingSphere!==void 0?(K.boundingSphere===null&&K.computeBoundingSphere(),Xe.copy(K.boundingSphere.center)):(xt.boundingSphere===null&&xt.computeBoundingSphere(),Xe.copy(xt.boundingSphere.center)),Xe.applyMatrix4(K.matrixWorld).applyMatrix4(Le)),Array.isArray(Dt)){const Rt=xt.groups;for(let Vt=0,jt=Rt.length;Vt<jt;Vt++){const zt=Rt[Vt],It=Dt[zt.materialIndex];It&&It.visible&&S.push(K,xt,It,$e,Xe.z,zt)}}else Dt.visible&&S.push(K,xt,Dt,$e,Xe.z,null)}}const qe=K.children;for(let xt=0,Dt=qe.length;xt<Dt;xt++)Gn(qe[xt],Re,$e,Ae)}function Di(K,Re,$e,Ae){const qe=K.opaque,xt=K.transmissive,Dt=K.transparent;E.setupLightsView($e),re===!0&&dt.setGlobalState(T.clippingPlanes,$e),xt.length>0&&Gi(qe,xt,Re,$e),Ae&&ye.viewport(I.copy(Ae)),qe.length>0&&Ci(qe,Re,$e),xt.length>0&&Ci(xt,Re,$e),Dt.length>0&&Ci(Dt,Re,$e),ye.buffers.depth.setTest(!0),ye.buffers.depth.setMask(!0),ye.buffers.color.setMask(!0),ye.setPolygonOffset(!1)}function Gi(K,Re,$e,Ae){const qe=ve.isWebGL2;_e===null&&(_e=new la(1,1,{generateMipmaps:!0,type:Ne.has("EXT_color_buffer_half_float")?KM:Z1,minFilter:sm,samples:qe&&a===!0?4:0})),T.getDrawingBufferSize(Fe),qe?_e.setSize(Fe.x,Fe.y):_e.setSize(hx(Fe.x),hx(Fe.y));const xt=T.getRenderTarget();T.setRenderTarget(_e),T.getClearColor(oe),ee=T.getClearAlpha(),ee<1&&T.setClearColor(16777215,.5),T.clear();const Dt=T.toneMapping;T.toneMapping=0,Ci(K,$e,Ae),_t.updateMultisampleRenderTarget(_e),_t.updateRenderTargetMipmap(_e);let Rt=!1;for(let Vt=0,jt=Re.length;Vt<jt;Vt++){const zt=Re[Vt],It=zt.object,yn=zt.geometry,Kt=zt.material,Ri=zt.group;if(Kt.side===2&&It.layers.test(Ae.layers)){const Hi=Kt.side;Kt.side=1,Kt.needsUpdate=!0,bn(It,$e,Ae,yn,Kt,Ri),Kt.side=Hi,Kt.needsUpdate=!0,Rt=!0}}Rt===!0&&(_t.updateMultisampleRenderTarget(_e),_t.updateRenderTargetMipmap(_e)),T.setRenderTarget(xt),T.setClearColor(oe,ee),T.toneMapping=Dt}function Ci(K,Re,$e){const Ae=Re.isScene===!0?Re.overrideMaterial:null;for(let qe=0,xt=K.length;qe<xt;qe++){const Dt=K[qe],Rt=Dt.object,Vt=Dt.geometry,jt=Ae===null?Dt.material:Ae,zt=Dt.group;Rt.layers.test($e.layers)&&bn(Rt,Re,$e,Vt,jt,zt)}}function bn(K,Re,$e,Ae,qe,xt){K.onBeforeRender(T,Re,$e,Ae,qe,xt),K.modelViewMatrix.multiplyMatrices($e.matrixWorldInverse,K.matrixWorld),K.normalMatrix.getNormalMatrix(K.modelViewMatrix),qe.onBeforeRender(T,Re,$e,Ae,K,xt),qe.transparent===!0&&qe.side===2&&qe.forceSinglePass===!1?(qe.side=1,qe.needsUpdate=!0,T.renderBufferDirect($e,Re,Ae,qe,K,xt),qe.side=0,qe.needsUpdate=!0,T.renderBufferDirect($e,Re,Ae,qe,K,xt),qe.side=2):T.renderBufferDirect($e,Re,Ae,qe,K,xt),K.onAfterRender(T,Re,$e,Ae,qe,xt)}function mi(K,Re,$e){Re.isScene!==!0&&(Re=lt);const Ae=tt.get(K),qe=E.state.lights,xt=E.state.shadowsArray,Dt=qe.state.version,Rt=Z.getParameters(K,qe.state,xt,Re,$e),Vt=Z.getProgramCacheKey(Rt);let jt=Ae.programs;Ae.environment=K.isMeshStandardMaterial?Re.environment:null,Ae.fog=Re.fog,Ae.envMap=(K.isMeshStandardMaterial?Mt:St).get(K.envMap||Ae.environment),jt===void 0&&(K.addEventListener("dispose",Ke),jt=new Map,Ae.programs=jt);let zt=jt.get(Vt);if(zt!==void 0){if(Ae.currentProgram===zt&&Ae.lightsStateVersion===Dt)return Xr(K,Rt),zt}else Rt.uniforms=Z.getUniforms(K),K.onBuild($e,Rt,T),K.onBeforeCompile(Rt,T),zt=Z.acquireProgram(Rt,Vt),jt.set(Vt,zt),Ae.uniforms=Rt.uniforms;const It=Ae.uniforms;(!K.isShaderMaterial&&!K.isRawShaderMaterial||K.clipping===!0)&&(It.clippingPlanes=dt.uniform),Xr(K,Rt),Ae.needsLights=fr(K),Ae.lightsStateVersion=Dt,Ae.needsLights&&(It.ambientLightColor.value=qe.state.ambient,It.lightProbe.value=qe.state.probe,It.directionalLights.value=qe.state.directional,It.directionalLightShadows.value=qe.state.directionalShadow,It.spotLights.value=qe.state.spot,It.spotLightShadows.value=qe.state.spotShadow,It.rectAreaLights.value=qe.state.rectArea,It.ltc_1.value=qe.state.rectAreaLTC1,It.ltc_2.value=qe.state.rectAreaLTC2,It.pointLights.value=qe.state.point,It.pointLightShadows.value=qe.state.pointShadow,It.hemisphereLights.value=qe.state.hemi,It.directionalShadowMap.value=qe.state.directionalShadowMap,It.directionalShadowMatrix.value=qe.state.directionalShadowMatrix,It.spotShadowMap.value=qe.state.spotShadowMap,It.spotLightMatrix.value=qe.state.spotLightMatrix,It.spotLightMap.value=qe.state.spotLightMap,It.pointShadowMap.value=qe.state.pointShadowMap,It.pointShadowMatrix.value=qe.state.pointShadowMatrix);const yn=zt.getUniforms(),Kt=rx.seqWithValue(yn.seq,It);return Ae.currentProgram=zt,Ae.uniformsList=Kt,zt}function Xr(K,Re){const $e=tt.get(K);$e.outputColorSpace=Re.outputColorSpace,$e.instancing=Re.instancing,$e.skinning=Re.skinning,$e.morphTargets=Re.morphTargets,$e.morphNormals=Re.morphNormals,$e.morphColors=Re.morphColors,$e.morphTargetsCount=Re.morphTargetsCount,$e.numClippingPlanes=Re.numClippingPlanes,$e.numIntersection=Re.numClipIntersection,$e.vertexAlphas=Re.vertexAlphas,$e.vertexTangents=Re.vertexTangents,$e.toneMapping=Re.toneMapping}function Ls(K,Re,$e,Ae,qe){Re.isScene!==!0&&(Re=lt),_t.resetTextureUnits();const xt=Re.fog,Dt=Ae.isMeshStandardMaterial?Re.environment:null,Rt=O===null?T.outputColorSpace:O.isXRRenderTarget===!0?O.texture.colorSpace:qa,Vt=(Ae.isMeshStandardMaterial?Mt:St).get(Ae.envMap||Dt),jt=Ae.vertexColors===!0&&!!$e.attributes.color&&$e.attributes.color.itemSize===4,zt=!!$e.attributes.tangent&&(!!Ae.normalMap||Ae.anisotropy>0),It=!!$e.morphAttributes.position,yn=!!$e.morphAttributes.normal,Kt=!!$e.morphAttributes.color,Ri=Ae.toneMapped?T.toneMapping:0,Hi=$e.morphAttributes.position||$e.morphAttributes.normal||$e.morphAttributes.color,On=Hi!==void 0?Hi.length:0,tn=tt.get(Ae),Lu=E.state.lights;if(re===!0&&(ue===!0||K!==U)){const ir=K===U&&Ae.id===B;dt.setState(Ae,K,ir)}let gi=!1;Ae.version===tn.__version?(tn.needsLights&&tn.lightsStateVersion!==Lu.state.version||tn.outputColorSpace!==Rt||qe.isInstancedMesh&&tn.instancing===!1||!qe.isInstancedMesh&&tn.instancing===!0||qe.isSkinnedMesh&&tn.skinning===!1||!qe.isSkinnedMesh&&tn.skinning===!0||tn.envMap!==Vt||Ae.fog===!0&&tn.fog!==xt||tn.numClippingPlanes!==void 0&&(tn.numClippingPlanes!==dt.numPlanes||tn.numIntersection!==dt.numIntersection)||tn.vertexAlphas!==jt||tn.vertexTangents!==zt||tn.morphTargets!==It||tn.morphNormals!==yn||tn.morphColors!==Kt||tn.toneMapping!==Ri||ve.isWebGL2===!0&&tn.morphTargetsCount!==On)&&(gi=!0):(gi=!0,tn.__version=Ae.version);let Ns=tn.currentProgram;gi===!0&&(Ns=mi(Ae,Re,qe));let Pu=!1,Is=!1,no=!1;const Xn=Ns.getUniforms(),_i=tn.uniforms;if(ye.useProgram(Ns.program)&&(Pu=!0,Is=!0,no=!0),Ae.id!==B&&(B=Ae.id,Is=!0),Pu||U!==K){if(Xn.setValue(ne,"projectionMatrix",K.projectionMatrix),ve.logarithmicDepthBuffer&&Xn.setValue(ne,"logDepthBufFC",2/(Math.log(K.far+1)/Math.LN2)),U!==K&&(U=K,Is=!0,no=!0),Ae.isShaderMaterial||Ae.isMeshPhongMaterial||Ae.isMeshToonMaterial||Ae.isMeshStandardMaterial||Ae.envMap){const ir=Xn.map.cameraPosition;ir!==void 0&&ir.setValue(ne,Xe.setFromMatrixPosition(K.matrixWorld))}(Ae.isMeshPhongMaterial||Ae.isMeshToonMaterial||Ae.isMeshLambertMaterial||Ae.isMeshBasicMaterial||Ae.isMeshStandardMaterial||Ae.isShaderMaterial)&&Xn.setValue(ne,"isOrthographic",K.isOrthographicCamera===!0),(Ae.isMeshPhongMaterial||Ae.isMeshToonMaterial||Ae.isMeshLambertMaterial||Ae.isMeshBasicMaterial||Ae.isMeshStandardMaterial||Ae.isShaderMaterial||Ae.isShadowMaterial||qe.isSkinnedMesh)&&Xn.setValue(ne,"viewMatrix",K.matrixWorldInverse)}if(qe.isSkinnedMesh){Xn.setOptional(ne,qe,"bindMatrix"),Xn.setOptional(ne,qe,"bindMatrixInverse");const ir=qe.skeleton;ir&&(ve.floatVertexTextures?(ir.boneTexture===null&&ir.computeBoneTexture(),Xn.setValue(ne,"boneTexture",ir.boneTexture,_t),Xn.setValue(ne,"boneTextureSize",ir.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const Eo=$e.morphAttributes;if((Eo.position!==void 0||Eo.normal!==void 0||Eo.color!==void 0&&ve.isWebGL2===!0)&&Y.update(qe,$e,Ns),(Is||tn.receiveShadow!==qe.receiveShadow)&&(tn.receiveShadow=qe.receiveShadow,Xn.setValue(ne,"receiveShadow",qe.receiveShadow)),Ae.isMeshGouraudMaterial&&Ae.envMap!==null&&(_i.envMap.value=Vt,_i.flipEnvMap.value=Vt.isCubeTexture&&Vt.isRenderTargetTexture===!1?-1:1),Is&&(Xn.setValue(ne,"toneMappingExposure",T.toneMappingExposure),tn.needsLights&&Ps(_i,no),xt&&Ae.fog===!0&&Ve.refreshFogUniforms(_i,xt),Ve.refreshMaterialUniforms(_i,Ae,$,X,_e),rx.upload(ne,tn.uniformsList,_i,_t)),Ae.isShaderMaterial&&Ae.uniformsNeedUpdate===!0&&(rx.upload(ne,tn.uniformsList,_i,_t),Ae.uniformsNeedUpdate=!1),Ae.isSpriteMaterial&&Xn.setValue(ne,"center",qe.center),Xn.setValue(ne,"modelViewMatrix",qe.modelViewMatrix),Xn.setValue(ne,"normalMatrix",qe.normalMatrix),Xn.setValue(ne,"modelMatrix",qe.matrixWorld),Ae.isShaderMaterial||Ae.isRawShaderMaterial){const ir=Ae.uniformsGroups;for(let el=0,Nu=ir.length;el<Nu;el++)if(ve.isWebGL2){const _a=ir[el];je.update(_a,Ns),je.bind(_a,Ns)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Ns}function Ps(K,Re){K.ambientLightColor.needsUpdate=Re,K.lightProbe.needsUpdate=Re,K.directionalLights.needsUpdate=Re,K.directionalLightShadows.needsUpdate=Re,K.pointLights.needsUpdate=Re,K.pointLightShadows.needsUpdate=Re,K.spotLights.needsUpdate=Re,K.spotLightShadows.needsUpdate=Re,K.rectAreaLights.needsUpdate=Re,K.hemisphereLights.needsUpdate=Re}function fr(K){return K.isMeshLambertMaterial||K.isMeshToonMaterial||K.isMeshPhongMaterial||K.isMeshStandardMaterial||K.isShadowMaterial||K.isShaderMaterial&&K.lights===!0}this.getActiveCubeFace=function(){return C},this.getActiveMipmapLevel=function(){return P},this.getRenderTarget=function(){return O},this.setRenderTargetTextures=function(K,Re,$e){tt.get(K.texture).__webglTexture=Re,tt.get(K.depthTexture).__webglTexture=$e;const Ae=tt.get(K);Ae.__hasExternalTextures=!0,Ae.__hasExternalTextures&&(Ae.__autoAllocateDepthBuffer=$e===void 0,Ae.__autoAllocateDepthBuffer||Ne.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),Ae.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(K,Re){const $e=tt.get(K);$e.__webglFramebuffer=Re,$e.__useDefaultFramebuffer=Re===void 0},this.setRenderTarget=function(K,Re=0,$e=0){O=K,C=Re,P=$e;let Ae=!0,qe=null,xt=!1,Dt=!1;if(K){const Rt=tt.get(K);Rt.__useDefaultFramebuffer!==void 0?(ye.bindFramebuffer(ne.FRAMEBUFFER,null),Ae=!1):Rt.__webglFramebuffer===void 0?_t.setupRenderTarget(K):Rt.__hasExternalTextures&&_t.rebindTextures(K,tt.get(K.texture).__webglTexture,tt.get(K.depthTexture).__webglTexture);const Vt=K.texture;(Vt.isData3DTexture||Vt.isDataArrayTexture||Vt.isCompressedArrayTexture)&&(Dt=!0);const jt=tt.get(K).__webglFramebuffer;K.isWebGLCubeRenderTarget?(qe=jt[Re],xt=!0):ve.isWebGL2&&K.samples>0&&_t.useMultisampledRTT(K)===!1?qe=tt.get(K).__webglMultisampledFramebuffer:qe=jt,I.copy(K.viewport),z.copy(K.scissor),te=K.scissorTest}else I.copy(xe).multiplyScalar($).floor(),z.copy(de).multiplyScalar($).floor(),te=fe;if(ye.bindFramebuffer(ne.FRAMEBUFFER,qe)&&ve.drawBuffers&&Ae&&ye.drawBuffers(K,qe),ye.viewport(I),ye.scissor(z),ye.setScissorTest(te),xt){const Rt=tt.get(K.texture);ne.framebufferTexture2D(ne.FRAMEBUFFER,ne.COLOR_ATTACHMENT0,ne.TEXTURE_CUBE_MAP_POSITIVE_X+Re,Rt.__webglTexture,$e)}else if(Dt){const Rt=tt.get(K.texture),Vt=Re||0;ne.framebufferTextureLayer(ne.FRAMEBUFFER,ne.COLOR_ATTACHMENT0,Rt.__webglTexture,$e||0,Vt)}B=-1},this.readRenderTargetPixels=function(K,Re,$e,Ae,qe,xt,Dt){if(!(K&&K.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Rt=tt.get(K).__webglFramebuffer;if(K.isWebGLCubeRenderTarget&&Dt!==void 0&&(Rt=Rt[Dt]),Rt){ye.bindFramebuffer(ne.FRAMEBUFFER,Rt);try{const Vt=K.texture,jt=Vt.format,zt=Vt.type;if(jt!==1023&&De.convert(jt)!==ne.getParameter(ne.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const It=zt===1016&&(Ne.has("EXT_color_buffer_half_float")||ve.isWebGL2&&Ne.has("EXT_color_buffer_float"));if(zt!==1009&&De.convert(zt)!==ne.getParameter(ne.IMPLEMENTATION_COLOR_READ_TYPE)&&!(zt===1015&&(ve.isWebGL2||Ne.has("OES_texture_float")||Ne.has("WEBGL_color_buffer_float")))&&!It){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Re>=0&&Re<=K.width-Ae&&$e>=0&&$e<=K.height-qe&&ne.readPixels(Re,$e,Ae,qe,De.convert(jt),De.convert(zt),xt)}finally{const Vt=O!==null?tt.get(O).__webglFramebuffer:null;ye.bindFramebuffer(ne.FRAMEBUFFER,Vt)}}},this.copyFramebufferToTexture=function(K,Re,$e=0){const Ae=Math.pow(2,-$e),qe=Math.floor(Re.image.width*Ae),xt=Math.floor(Re.image.height*Ae);_t.setTexture2D(Re,0),ne.copyTexSubImage2D(ne.TEXTURE_2D,$e,0,0,K.x,K.y,qe,xt),ye.unbindTexture()},this.copyTextureToTexture=function(K,Re,$e,Ae=0){const qe=Re.image.width,xt=Re.image.height,Dt=De.convert($e.format),Rt=De.convert($e.type);_t.setTexture2D($e,0),ne.pixelStorei(ne.UNPACK_FLIP_Y_WEBGL,$e.flipY),ne.pixelStorei(ne.UNPACK_PREMULTIPLY_ALPHA_WEBGL,$e.premultiplyAlpha),ne.pixelStorei(ne.UNPACK_ALIGNMENT,$e.unpackAlignment),Re.isDataTexture?ne.texSubImage2D(ne.TEXTURE_2D,Ae,K.x,K.y,qe,xt,Dt,Rt,Re.image.data):Re.isCompressedTexture?ne.compressedTexSubImage2D(ne.TEXTURE_2D,Ae,K.x,K.y,Re.mipmaps[0].width,Re.mipmaps[0].height,Dt,Re.mipmaps[0].data):ne.texSubImage2D(ne.TEXTURE_2D,Ae,K.x,K.y,Dt,Rt,Re.image),Ae===0&&$e.generateMipmaps&&ne.generateMipmap(ne.TEXTURE_2D),ye.unbindTexture()},this.copyTextureToTexture3D=function(K,Re,$e,Ae,qe=0){if(T.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const xt=K.max.x-K.min.x+1,Dt=K.max.y-K.min.y+1,Rt=K.max.z-K.min.z+1,Vt=De.convert(Ae.format),jt=De.convert(Ae.type);let zt;if(Ae.isData3DTexture)_t.setTexture3D(Ae,0),zt=ne.TEXTURE_3D;else if(Ae.isDataArrayTexture)_t.setTexture2DArray(Ae,0),zt=ne.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ne.pixelStorei(ne.UNPACK_FLIP_Y_WEBGL,Ae.flipY),ne.pixelStorei(ne.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Ae.premultiplyAlpha),ne.pixelStorei(ne.UNPACK_ALIGNMENT,Ae.unpackAlignment);const It=ne.getParameter(ne.UNPACK_ROW_LENGTH),yn=ne.getParameter(ne.UNPACK_IMAGE_HEIGHT),Kt=ne.getParameter(ne.UNPACK_SKIP_PIXELS),Ri=ne.getParameter(ne.UNPACK_SKIP_ROWS),Hi=ne.getParameter(ne.UNPACK_SKIP_IMAGES),On=$e.isCompressedTexture?$e.mipmaps[0]:$e.image;ne.pixelStorei(ne.UNPACK_ROW_LENGTH,On.width),ne.pixelStorei(ne.UNPACK_IMAGE_HEIGHT,On.height),ne.pixelStorei(ne.UNPACK_SKIP_PIXELS,K.min.x),ne.pixelStorei(ne.UNPACK_SKIP_ROWS,K.min.y),ne.pixelStorei(ne.UNPACK_SKIP_IMAGES,K.min.z),$e.isDataTexture||$e.isData3DTexture?ne.texSubImage3D(zt,qe,Re.x,Re.y,Re.z,xt,Dt,Rt,Vt,jt,On.data):$e.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ne.compressedTexSubImage3D(zt,qe,Re.x,Re.y,Re.z,xt,Dt,Rt,Vt,On.data)):ne.texSubImage3D(zt,qe,Re.x,Re.y,Re.z,xt,Dt,Rt,Vt,jt,On),ne.pixelStorei(ne.UNPACK_ROW_LENGTH,It),ne.pixelStorei(ne.UNPACK_IMAGE_HEIGHT,yn),ne.pixelStorei(ne.UNPACK_SKIP_PIXELS,Kt),ne.pixelStorei(ne.UNPACK_SKIP_ROWS,Ri),ne.pixelStorei(ne.UNPACK_SKIP_IMAGES,Hi),qe===0&&Ae.generateMipmaps&&ne.generateMipmap(zt),ye.unbindTexture()},this.initTexture=function(K){K.isCubeTexture?_t.setTextureCube(K,0):K.isData3DTexture?_t.setTexture3D(K,0):K.isDataArrayTexture||K.isCompressedArrayTexture?_t.setTexture2DArray(K,0):_t.setTexture2D(K,0),ye.unbindTexture()},this.resetState=function(){C=0,P=0,O=null,ye.reset(),Ee.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Zp}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace==="srgb"?tw:ew}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===3001?Mr:qa}},XR=class extends WR{};XR.prototype.isWebGL1Renderer=!0;var jR=class YR{constructor(t,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new Tt(t),this.density=n}clone(){return new YR(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}},qR=class $R{constructor(t,n=1,i=1e3){this.isFog=!0,this.name="",this.color=new Tt(t),this.near=n,this.far=i}clone(){return new $R(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}},ZR=class extends Wn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,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,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}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}},Fx=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Nx,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=qs()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=qs()),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]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=qs()),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}}},is=new ae,t0=class KR{constructor(t,n,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=n,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let n=0,i=this.data.count;n<i;n++)is.fromBufferAttribute(this,n),is.applyMatrix4(t),this.setXYZ(n,is.x,is.y,is.z);return this}applyNormalMatrix(t){for(let n=0,i=this.count;n<i;n++)is.fromBufferAttribute(this,n),is.applyNormalMatrix(t),this.setXYZ(n,is.x,is.y,is.z);return this}transformDirection(t){for(let n=0,i=this.count;n<i;n++)is.fromBufferAttribute(this,n),is.transformDirection(t),this.setXYZ(n,is.x,is.y,is.z);return this}setX(t,n){return this.normalized&&(n=cn(n,this.array)),this.data.array[t*this.data.stride+this.offset]=n,this}setY(t,n){return this.normalized&&(n=cn(n,this.array)),this.data.array[t*this.data.stride+this.offset+1]=n,this}setZ(t,n){return this.normalized&&(n=cn(n,this.array)),this.data.array[t*this.data.stride+this.offset+2]=n,this}setW(t,n){return this.normalized&&(n=cn(n,this.array)),this.data.array[t*this.data.stride+this.offset+3]=n,this}getX(t){let n=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(n=Ys(n,this.array)),n}getY(t){let n=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(n=Ys(n,this.array)),n}getZ(t){let n=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(n=Ys(n,this.array)),n}getW(t){let n=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(n=Ys(n,this.array)),n}setXY(t,n,i){return t=t*this.data.stride+this.offset,this.normalized&&(n=cn(n,this.array),i=cn(i,this.array)),this.data.array[t+0]=n,this.data.array[t+1]=i,this}setXYZ(t,n,i,r){return t=t*this.data.stride+this.offset,this.normalized&&(n=cn(n,this.array),i=cn(i,this.array),r=cn(r,this.array)),this.data.array[t+0]=n,this.data.array[t+1]=i,this.data.array[t+2]=r,this}setXYZW(t,n,i,r,s){return t=t*this.data.stride+this.offset,this.normalized&&(n=cn(n,this.array),i=cn(i,this.array),r=cn(r,this.array),s=cn(s,this.array)),this.data.array[t+0]=n,this.data.array[t+1]=i,this.data.array[t+2]=r,this.data.array[t+3]=s,this}clone(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const n=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)n.push(this.data.array[r+s])}return new Kn(new this.array.constructor(n),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new KR(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const n=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)n.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:n,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},fw=class extends Hr{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Tt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!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.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},pp,_1=new ae,mp=new ae,gp=new ae,_p=new pt,v1=new pt,QR=new un,cy=new ae,y1=new ae,uy=new ae,JE=new pt,Jb=new pt,eT=new pt,JR=class extends Wn{constructor(e){if(super(),this.isSprite=!0,this.type="Sprite",pp===void 0){pp=new vn;const t=new Fx(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);pp.setIndex([0,1,2,0,2,3]),pp.setAttribute("position",new t0(t,3,0,!1)),pp.setAttribute("uv",new t0(t,2,3,!1))}this.geometry=pp,this.material=e!==void 0?e:new fw,this.center=new pt(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),mp.setFromMatrixScale(this.matrixWorld),QR.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),gp.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&mp.multiplyScalar(-gp.z);const n=this.material.rotation;let i,r;n!==0&&(r=Math.cos(n),i=Math.sin(n));const s=this.center;hy(cy.set(-.5,-.5,0),gp,s,mp,i,r),hy(y1.set(.5,-.5,0),gp,s,mp,i,r),hy(uy.set(.5,.5,0),gp,s,mp,i,r),JE.set(0,0),Jb.set(1,0),eT.set(1,1);let a=e.ray.intersectTriangle(cy,y1,uy,!1,_1);if(a===null&&(hy(y1.set(-.5,.5,0),gp,s,mp,i,r),Jb.set(0,1),a=e.ray.intersectTriangle(cy,uy,y1,!1,_1),a===null))return;const c=e.ray.origin.distanceTo(_1);c<e.near||c>e.far||t.push({distance:c,point:_1.clone(),uv:rf.getInterpolation(_1,cy,y1,uy,JE,Jb,eT,new pt),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};function hy(e,t,n,i,r,s){_p.subVectors(e,n).addScalar(.5).multiply(i),r!==void 0?(v1.x=s*_p.x-r*_p.y,v1.y=r*_p.x+s*_p.y):v1.copy(_p),e.copy(t),e.x+=v1.x,e.y+=v1.y,e.applyMatrix4(QR)}var fy=new ae,tT=new ae,eL=class extends Wn{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const r=t[n];this.addLevel(r.object.clone(),r.distance,r.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let r;for(r=0;r<i.length&&!(t<i[r].distance);r++);return i.splice(r,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let r=t[n].distance;if(t[n].object.visible&&(r-=r*t[n].hysteresis),e<r)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){fy.setFromMatrixPosition(this.matrixWorld);const n=e.ray.origin.distanceTo(fy);this.getObjectForDistance(n).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){fy.setFromMatrixPosition(e.matrixWorld),tT.setFromMatrixPosition(this.matrixWorld);const n=fy.distanceTo(tT)/e.zoom;t[0].object.visible=!0;let i,r;for(i=1,r=t.length;i<r;i++){let s=t[i].distance;if(t[i].object.visible&&(s-=s*t[i].hysteresis),n>=s)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,r=n.length;i<r;i++){const s=n[i];t.object.levels.push({object:s.object.uuid,distance:s.distance,hysteresis:s.hysteresis})}return t}},nT=new ae,iT=new $n,rT=new $n,QU=new ae,sT=new un,vp=new ae,e2=new fa,oT=new un,t2=new om,tL=class extends Ar{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new un,this.bindMatrixInverse=new un,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Ka),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)vp.fromBufferAttribute(t,n),this.applyBoneTransform(n,vp),this.boundingBox.expandByPoint(vp)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new fa),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)vp.fromBufferAttribute(t,n),this.applyBoneTransform(n,vp),this.boundingSphere.expandByPoint(vp)}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 n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),e2.copy(this.boundingSphere),e2.applyMatrix4(i),e.ray.intersectsSphere(e2)!==!1&&(oT.copy(i).invert(),t2.copy(e.ray).applyMatrix4(oT),!(this.boundingBox!==null&&t2.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,t2)))}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 $n,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;iT.fromBufferAttribute(i.attributes.skinIndex,e),rT.fromBufferAttribute(i.attributes.skinWeight,e),nT.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){const s=rT.getComponent(r);if(s!==0){const a=iT.getComponent(r);sT.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(QU.copy(nT).applyMatrix4(sT),s)}}return t.applyMatrix4(this.bindMatrixInverse)}boneTransform(e,t){return console.warn("THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151."),this.applyBoneTransform(e,t)}},dw=class extends Wn{constructor(){super(),this.isBone=!0,this.type="Bone"}},Hp=class extends Cr{constructor(e=null,t=1,n=1,i,r,s,a,c,u=as,d=as,p,g){super(null,s,a,c,u,d,i,r,p,g),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},aT=new un,JU=new un,nL=class iL{constructor(t=[],n=[]){this.uuid=qs(),this.bones=t.slice(0),this.boneInverses=n,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const t=this.bones,n=this.boneInverses;if(this.boneMatrices=new Float32Array(t.length*16),n.length===0)this.calculateInverses();else if(t.length!==n.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 un)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,n=this.bones.length;t<n;t++){const i=new un;this.bones[t]&&i.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];i&&i.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];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 t=this.bones,n=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let s=0,a=t.length;s<a;s++){const c=t[s]?t[s].matrixWorld:JU;aT.multiplyMatrices(c,n[s]),aT.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new iL(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(this.bones.length*4);t=SR(t),t=Math.max(t,4);const n=new Float32Array(t*t*4);n.set(this.boneMatrices);const i=new Hp(n,t,t,$p,Rx);return i.needsUpdate=!0,this.boneMatrices=n,this.boneTexture=i,this.boneTextureSize=t,this}getBoneByName(t){for(let n=0,i=this.bones.length;n<i;n++){const r=this.bones[n];if(r.name===t)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,n){this.uuid=t.uuid;for(let i=0,r=t.bones.length;i<r;i++){const s=t.bones[i];let a=n[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new dw),this.bones.push(a),this.boneInverses.push(new un().fromArray(t.boneInverses[i]))}return this.init(),this}toJSON(){const t={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const n=this.bones,i=this.boneInverses;for(let r=0,s=n.length;r<s;r++){const a=n[r];t.bones.push(a.uuid);const c=i[r];t.boneInverses.push(c.toArray())}return t}},Jp=class extends Kn{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}},yp=new un,lT=new un,dy=[],cT=new Ka,eB=new un,x1=new Ar,S1=new fa,rL=class extends Ar{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Jp(new Float32Array(n*16),16),this.instanceColor=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,eB)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Ka),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,yp),cT.copy(e.boundingBox).applyMatrix4(yp),this.boundingBox.union(cT)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new fa),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,yp),S1.copy(e.boundingSphere).applyMatrix4(yp),this.boundingSphere.union(S1)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),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)}raycast(e,t){const n=this.matrixWorld,i=this.count;if(x1.geometry=this.geometry,x1.material=this.material,x1.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),S1.copy(this.boundingSphere),S1.applyMatrix4(n),e.ray.intersectsSphere(S1)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,yp),lT.multiplyMatrices(n,yp),x1.matrixWorld=lT,x1.raycast(e,dy);for(let s=0,a=dy.length;s<a;s++){const c=dy[s];c.instanceId=r,c.object=this,t.push(c)}dy.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Jp(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}},us=class extends Hr{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Tt(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}},uT=new ae,hT=new ae,fT=new un,n2=new om,py=new fa,Mu=class extends Wn{constructor(e=new vn,t=new us){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=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,r=t.count;i<r;i++)uT.fromBufferAttribute(t,i-1),hT.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=uT.distanceTo(hT);e.setAttribute("lineDistance",new Ot(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,s=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),py.copy(n.boundingSphere),py.applyMatrix4(i),py.radius+=r,e.ray.intersectsSphere(py)===!1)return;fT.copy(i).invert(),n2.copy(e.ray).applyMatrix4(fT);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,u=new ae,d=new ae,p=new ae,g=new ae,v=this.isLineSegments?2:1,y=n.index,S=n.attributes.position;if(y!==null){const E=Math.max(0,s.start),w=Math.min(y.count,s.start+s.count);for(let b=E,T=w-1;b<T;b+=v){const L=y.getX(b),C=y.getX(b+1);if(u.fromBufferAttribute(S,L),d.fromBufferAttribute(S,C),n2.distanceSqToSegment(u,d,g,p)>c)continue;g.applyMatrix4(this.matrixWorld);const P=e.ray.origin.distanceTo(g);P<e.near||P>e.far||t.push({distance:P,point:p.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}else{const E=Math.max(0,s.start),w=Math.min(S.count,s.start+s.count);for(let b=E,T=w-1;b<T;b+=v){if(u.fromBufferAttribute(S,b),d.fromBufferAttribute(S,b+1),n2.distanceSqToSegment(u,d,g,p)>c)continue;g.applyMatrix4(this.matrixWorld);const L=e.ray.origin.distanceTo(g);L<e.near||L>e.far||t.push({distance:L,point:p.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,r=n.length;i<r;i++){const s=n[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=i}}}}},dT=new ae,pT=new ae,Qa=class extends Mu{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,n=[];for(let i=0,r=t.count;i<r;i+=2)dT.fromBufferAttribute(t,i),pT.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+dT.distanceTo(pT);e.setAttribute("lineDistance",new Ot(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},sL=class extends Mu{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}},pw=class extends Hr{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Tt(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}},mT=new un,eM=new om,my=new fa,gy=new ae,oL=class extends Wn{constructor(e=new vn,t=new pw){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=e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,s=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),my.copy(n.boundingSphere),my.applyMatrix4(i),my.radius+=r,e.ray.intersectsSphere(my)===!1)return;mT.copy(i).invert(),eM.copy(e.ray).applyMatrix4(mT);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,u=n.index,d=n.attributes.position;if(u!==null){const p=Math.max(0,s.start),g=Math.min(u.count,s.start+s.count);for(let v=p,y=g;v<y;v++){const S=u.getX(v);gy.fromBufferAttribute(d,S),gT(gy,S,c,i,e,t,this)}}else{const p=Math.max(0,s.start),g=Math.min(d.count,s.start+s.count);for(let v=p,y=g;v<y;v++)gy.fromBufferAttribute(d,v),gT(gy,v,c,i,e,t,this)}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,r=n.length;i<r;i++){const s=n[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=i}}}}};function gT(e,t,n,i,r,s,a){const c=eM.distanceSqToPoint(e);if(c<n){const u=new ae;eM.closestPointToPoint(e,u),u.applyMatrix4(i);const d=r.ray.origin.distanceTo(u);if(d<r.near||d>r.far)return;s.push({distance:d,distanceToRay:Math.sqrt(c),point:u,index:t,face:null,object:a})}}var tB=class extends Cr{constructor(e,t,n,i,r,s,a,c,u){super(e,t,n,i,r,s,a,c,u),this.isVideoTexture=!0,this.minFilter=s!==void 0?s:Er,this.magFilter=r!==void 0?r:Er,this.generateMipmaps=!1;const d=this;function p(){d.needsUpdate=!0,e.requestVideoFrameCallback(p)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(p)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;!("requestVideoFrameCallback"in e)&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}},nB=class extends Cr{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=as,this.minFilter=as,this.generateMipmaps=!1,this.needsUpdate=!0}},mw=class extends Cr{constructor(e,t,n,i,r,s,a,c,u,d,p,g){super(null,s,a,c,u,d,i,r,p,g),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}},iB=class extends mw{constructor(e,t,n,i,r,s){super(e,t,n,r,s),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=yo}},rB=class extends Cr{constructor(e,t,n,i,r,s,a,c,u){super(e,t,n,i,r,s,a,c,u),this.isCanvasTexture=!0,this.needsUpdate=!0}},da=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/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 n,i=this.getPoint(0),r=0;t.push(0);for(let s=1;s<=e;s++)n=this.getPoint(s/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let s;t?s=t:s=e*n[r-1];let a=0,c=r-1,u;for(;a<=c;)if(i=Math.floor(a+(c-a)/2),u=n[i]-s,u<0)a=i+1;else if(u>0)c=i-1;else{c=i;break}if(i=c,n[i]===s)return i/(r-1);const d=n[i],p=n[i+1]-d,g=(s-d)/p;return(i+g)/(r-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),a=this.getPoint(r),c=t||(s.isVector2?new pt:new ae);return c.copy(a).sub(s).normalize(),c}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new ae,i=[],r=[],s=[],a=new ae,c=new un;for(let v=0;v<=e;v++){const y=v/e;i[v]=this.getTangentAt(y,new ae)}r[0]=new ae,s[0]=new ae;let u=Number.MAX_VALUE;const d=Math.abs(i[0].x),p=Math.abs(i[0].y),g=Math.abs(i[0].z);d<=u&&(u=d,n.set(1,0,0)),p<=u&&(u=p,n.set(0,1,0)),g<=u&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),s[0].crossVectors(i[0],r[0]);for(let v=1;v<=e;v++){if(r[v]=r[v-1].clone(),s[v]=s[v-1].clone(),a.crossVectors(i[v-1],i[v]),a.length()>Number.EPSILON){a.normalize();const y=Math.acos(Ti(i[v-1].dot(i[v]),-1,1));r[v].applyMatrix4(c.makeRotationAxis(a,y))}s[v].crossVectors(i[v],r[v])}if(t===!0){let v=Math.acos(Ti(r[0].dot(r[e]),-1,1));v/=e,i[0].dot(a.crossVectors(r[0],r[e]))>0&&(v=-v);for(let y=1;y<=e;y++)r[y].applyMatrix4(c.makeRotationAxis(i[y],v*y)),s[y].crossVectors(i[y],r[y])}return{tangents:i,normals:r,binormals:s}}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}},kx=class extends da{constructor(e=0,t=0,n=1,i=1,r=0,s=Math.PI*2,a=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=c}getPoint(e,t){const n=t||new pt,i=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(s?r=0:r=i),this.aClockwise===!0&&!s&&(r===i?r=-i:r=r-i);const a=this.aStartAngle+e*r;let c=this.aX+this.xRadius*Math.cos(a),u=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const d=Math.cos(this.aRotation),p=Math.sin(this.aRotation),g=c-this.aX,v=u-this.aY;c=g*d-v*p+this.aX,u=g*p+v*d+this.aY}return n.set(c,u)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},aL=class extends kx{constructor(e,t,n,i,r,s){super(e,t,n,n,i,r,s),this.isArcCurve=!0,this.type="ArcCurve"}};function gw(){let e=0,t=0,n=0,i=0;function r(s,a,c,u){e=s,t=c,n=-3*s+3*a-2*c-u,i=2*s-2*a+c+u}return{initCatmullRom:function(s,a,c,u,d){r(a,c,d*(c-s),d*(u-a))},initNonuniformCatmullRom:function(s,a,c,u,d,p,g){let v=(a-s)/d-(c-s)/(d+p)+(c-a)/p,y=(c-a)/p-(u-a)/(p+g)+(u-c)/g;v*=p,y*=p,r(a,c,v,y)},calc:function(s){const a=s*s,c=a*s;return e+t*s+n*a+i*c}}}var _y=new ae,i2=new gw,r2=new gw,s2=new gw,lL=class extends da{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new ae){const n=t,i=this.points,r=i.length,s=(r-(this.closed?0:1))*e;let a=Math.floor(s),c=s-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/r)+1)*r:c===0&&a===r-1&&(a=r-2,c=1);let u,d;this.closed||a>0?u=i[(a-1)%r]:(_y.subVectors(i[0],i[1]).add(i[0]),u=_y);const p=i[a%r],g=i[(a+1)%r];if(this.closed||a+2<r?d=i[(a+2)%r]:(_y.subVectors(i[r-1],i[r-2]).add(i[r-1]),d=_y),this.curveType==="centripetal"||this.curveType==="chordal"){const v=this.curveType==="chordal"?.5:.25;let y=Math.pow(u.distanceToSquared(p),v),S=Math.pow(p.distanceToSquared(g),v),E=Math.pow(g.distanceToSquared(d),v);S<1e-4&&(S=1),y<1e-4&&(y=S),E<1e-4&&(E=S),i2.initNonuniformCatmullRom(u.x,p.x,g.x,d.x,y,S,E),r2.initNonuniformCatmullRom(u.y,p.y,g.y,d.y,y,S,E),s2.initNonuniformCatmullRom(u.z,p.z,g.z,d.z,y,S,E)}else this.curveType==="catmullrom"&&(i2.initCatmullRom(u.x,p.x,g.x,d.x,this.tension),r2.initCatmullRom(u.y,p.y,g.y,d.y,this.tension),s2.initCatmullRom(u.z,p.z,g.z,d.z,this.tension));return n.set(i2.calc(c),r2.calc(c),s2.calc(c)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new ae().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function _T(e,t,n,i,r){const s=(i-t)*.5,a=(r-n)*.5,c=e*e,u=e*c;return(2*n-2*i+s+a)*u+(-3*n+3*i-2*s-a)*c+s*e+n}function sB(e,t){const n=1-e;return n*n*t}function oB(e,t){return 2*(1-e)*e*t}function aB(e,t){return e*e*t}function H1(e,t,n,i){return sB(e,t)+oB(e,n)+aB(e,i)}function lB(e,t){const n=1-e;return n*n*n*t}function cB(e,t){const n=1-e;return 3*n*n*e*t}function uB(e,t){return 3*(1-e)*e*e*t}function hB(e,t){return e*e*e*t}function W1(e,t,n,i,r){return lB(e,t)+cB(e,n)+uB(e,i)+hB(e,r)}var _w=class extends da{constructor(e=new pt,t=new pt,n=new pt,i=new pt){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new pt){const n=t,i=this.v0,r=this.v1,s=this.v2,a=this.v3;return n.set(W1(e,i.x,r.x,s.x,a.x),W1(e,i.y,r.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},cL=class extends da{constructor(e=new ae,t=new ae,n=new ae,i=new ae){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new ae){const n=t,i=this.v0,r=this.v1,s=this.v2,a=this.v3;return n.set(W1(e,i.x,r.x,s.x,a.x),W1(e,i.y,r.y,s.y,a.y),W1(e,i.z,r.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},Gx=class extends da{constructor(e=new pt,t=new pt){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new pt){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new pt){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},uL=class extends da{constructor(e=new ae,t=new ae){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new ae){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ae){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},vw=class extends da{constructor(e=new pt,t=new pt,n=new pt){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new pt){const n=t,i=this.v0,r=this.v1,s=this.v2;return n.set(H1(e,i.x,r.x,s.x),H1(e,i.y,r.y,s.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},yw=class extends da{constructor(e=new ae,t=new ae,n=new ae){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ae){const n=t,i=this.v0,r=this.v1,s=this.v2;return n.set(H1(e,i.x,r.x,s.x),H1(e,i.y,r.y,s.y),H1(e,i.z,r.z,s.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},xw=class extends da{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new pt){const n=t,i=this.points,r=(i.length-1)*e,s=Math.floor(r),a=r-s,c=i[s===0?s:s-1],u=i[s],d=i[s>i.length-2?i.length-1:s+1],p=i[s>i.length-3?i.length-1:s+2];return n.set(_T(a,c.x,u.x,d.x,p.x),_T(a,c.y,u.y,d.y,p.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new pt().fromArray(i))}return this}},Sw=Object.freeze({__proto__:null,ArcCurve:aL,CatmullRomCurve3:lL,CubicBezierCurve:_w,CubicBezierCurve3:cL,EllipseCurve:kx,LineCurve:Gx,LineCurve3:uL,QuadraticBezierCurve:vw,QuadraticBezierCurve3:yw,SplineCurve:xw}),hL=class extends da{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Gx(t,e))}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const s=i[r]-n,a=this.curves[r],c=a.getLength(),u=c===0?0:1-s/c;return a.getPointAt(u,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const s=r[i],a=s.isEllipseCurve?e*2:s.isLineCurve||s.isLineCurve3?1:s.isSplineCurve?e*s.points.length:e,c=s.getPoints(a);for(let u=0;u<c.length;u++){const d=c[u];n&&n.equals(d)||(t.push(d),n=d)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new Sw[i.type]().fromJSON(i))}return this}},n0=class extends hL{constructor(e){super(),this.type="Path",this.currentPoint=new pt,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Gx(this.currentPoint.clone(),new pt(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const r=new vw(this.currentPoint.clone(),new pt(e,t),new pt(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,r,s){const a=new _w(this.currentPoint.clone(),new pt(e,t),new pt(n,i),new pt(r,s));return this.curves.push(a),this.currentPoint.set(r,s),this}splineThru(e){const t=new xw([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,r,s){const a=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+a,t+c,n,i,r,s),this}absarc(e,t,n,i,r,s){return this.absellipse(e,t,n,n,i,r,s),this}ellipse(e,t,n,i,r,s,a,c){const u=this.currentPoint.x,d=this.currentPoint.y;return this.absellipse(e+u,t+d,n,i,r,s,a,c),this}absellipse(e,t,n,i,r,s,a,c){const u=new kx(e,t,n,i,r,s,a,c);if(this.curves.length>0){const p=u.getPoint(0);p.equals(this.currentPoint)||this.lineTo(p.x,p.y)}this.curves.push(u);const d=u.getPoint(1);return this.currentPoint.copy(d),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},Hx=class fL extends vn{constructor(t=[new pt(0,-.5),new pt(.5,0),new pt(0,.5)],n=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:t,segments:n,phiStart:i,phiLength:r},n=Math.floor(n),r=Ti(r,0,Math.PI*2);const s=[],a=[],c=[],u=[],d=[],p=1/n,g=new ae,v=new pt,y=new ae,S=new ae,E=new ae;let w=0,b=0;for(let T=0;T<=t.length-1;T++)switch(T){case 0:w=t[T+1].x-t[T].x,b=t[T+1].y-t[T].y,y.x=b*1,y.y=-w,y.z=b*0,E.copy(y),y.normalize(),u.push(y.x,y.y,y.z);break;case t.length-1:u.push(E.x,E.y,E.z);break;default:w=t[T+1].x-t[T].x,b=t[T+1].y-t[T].y,y.x=b*1,y.y=-w,y.z=b*0,S.copy(y),y.x+=E.x,y.y+=E.y,y.z+=E.z,y.normalize(),u.push(y.x,y.y,y.z),E.copy(S)}for(let T=0;T<=n;T++){const L=i+T*p*r,C=Math.sin(L),P=Math.cos(L);for(let O=0;O<=t.length-1;O++){g.x=t[O].x*C,g.y=t[O].y,g.z=t[O].x*P,a.push(g.x,g.y,g.z),v.x=T/n,v.y=O/(t.length-1),c.push(v.x,v.y);const B=u[3*O+0]*C,U=u[3*O+1],I=u[3*O+0]*P;d.push(B,U,I)}}for(let T=0;T<n;T++)for(let L=0;L<t.length-1;L++){const C=L+T*t.length,P=C,O=C+t.length,B=C+t.length+1,U=C+1;s.push(P,O,U),s.push(B,U,O)}this.setIndex(s),this.setAttribute("position",new Ot(a,3)),this.setAttribute("uv",new Ot(c,2)),this.setAttribute("normal",new Ot(d,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new fL(t.points,t.segments,t.phiStart,t.phiLength)}},bw=class dL extends Hx{constructor(t=1,n=1,i=4,r=8){const s=new n0;s.absarc(0,-n/2,t,Math.PI*1.5,0),s.absarc(0,n/2,t,0,Math.PI*.5),super(s.getPoints(i),r),this.type="CapsuleGeometry",this.parameters={radius:t,height:n,capSegments:i,radialSegments:r}}static fromJSON(t){return new dL(t.radius,t.length,t.capSegments,t.radialSegments)}},Mw=class pL extends vn{constructor(t=1,n=32,i=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:n,thetaStart:i,thetaLength:r},n=Math.max(3,n);const s=[],a=[],c=[],u=[],d=new ae,p=new pt;a.push(0,0,0),c.push(0,0,1),u.push(.5,.5);for(let g=0,v=3;g<=n;g++,v+=3){const y=i+g/n*r;d.x=t*Math.cos(y),d.y=t*Math.sin(y),a.push(d.x,d.y,d.z),c.push(0,0,1),p.x=(a[v]/t+1)/2,p.y=(a[v+1]/t+1)/2,u.push(p.x,p.y)}for(let g=1;g<=n;g++)s.push(g,g+1,0);this.setIndex(s),this.setAttribute("position",new Ot(a,3)),this.setAttribute("normal",new Ot(c,3)),this.setAttribute("uv",new Ot(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new pL(t.radius,t.segments,t.thetaStart,t.thetaLength)}},S0=class mL extends vn{constructor(t=1,n=1,i=1,r=32,s=1,a=!1,c=0,u=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:n,height:i,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:c,thetaLength:u};const d=this;r=Math.floor(r),s=Math.floor(s);const p=[],g=[],v=[],y=[];let S=0;const E=[],w=i/2;let b=0;T(),a===!1&&(t>0&&L(!0),n>0&&L(!1)),this.setIndex(p),this.setAttribute("position",new Ot(g,3)),this.setAttribute("normal",new Ot(v,3)),this.setAttribute("uv",new Ot(y,2));function T(){const C=new ae,P=new ae;let O=0;const B=(n-t)/i;for(let U=0;U<=s;U++){const I=[],z=U/s,te=z*(n-t)+t;for(let oe=0;oe<=r;oe++){const ee=oe/r,k=ee*u+c,X=Math.sin(k),$=Math.cos(k);P.x=te*X,P.y=-z*i+w,P.z=te*$,g.push(P.x,P.y,P.z),C.set(X,B,$).normalize(),v.push(C.x,C.y,C.z),y.push(ee,1-z),I.push(S++)}E.push(I)}for(let U=0;U<r;U++)for(let I=0;I<s;I++){const z=E[I][U],te=E[I+1][U],oe=E[I+1][U+1],ee=E[I][U+1];p.push(z,te,ee),p.push(te,oe,ee),O+=6}d.addGroup(b,O,0),b+=O}function L(C){const P=S,O=new pt,B=new ae;let U=0;const I=C===!0?t:n,z=C===!0?1:-1;for(let oe=1;oe<=r;oe++)g.push(0,w*z,0),v.push(0,z,0),y.push(.5,.5),S++;const te=S;for(let oe=0;oe<=r;oe++){const ee=oe/r*u+c,k=Math.cos(ee),X=Math.sin(ee);B.x=I*X,B.y=w*z,B.z=I*k,g.push(B.x,B.y,B.z),v.push(0,z,0),O.x=k*.5+.5,O.y=X*.5*z+.5,y.push(O.x,O.y),S++}for(let oe=0;oe<r;oe++){const ee=P+oe,k=te+oe;C===!0?p.push(k,k+1,ee):p.push(k+1,k,ee),U+=3}d.addGroup(b,U,C===!0?1:2),b+=U}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new mL(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},ww=class gL extends S0{constructor(t=1,n=1,i=32,r=1,s=!1,a=0,c=Math.PI*2){super(0,t,n,i,r,s,a,c),this.type="ConeGeometry",this.parameters={radius:t,height:n,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:c}}static fromJSON(t){return new gL(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},xf=class _L extends vn{constructor(t=[],n=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:n,radius:i,detail:r};const s=[],a=[];c(r),d(i),p(),this.setAttribute("position",new Ot(s,3)),this.setAttribute("normal",new Ot(s.slice(),3)),this.setAttribute("uv",new Ot(a,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function c(T){const L=new ae,C=new ae,P=new ae;for(let O=0;O<n.length;O+=3)y(n[O+0],L),y(n[O+1],C),y(n[O+2],P),u(L,C,P,T)}function u(T,L,C,P){const O=P+1,B=[];for(let U=0;U<=O;U++){B[U]=[];const I=T.clone().lerp(C,U/O),z=L.clone().lerp(C,U/O),te=O-U;for(let oe=0;oe<=te;oe++)oe===0&&U===O?B[U][oe]=I:B[U][oe]=I.clone().lerp(z,oe/te)}for(let U=0;U<O;U++)for(let I=0;I<2*(O-U)-1;I++){const z=Math.floor(I/2);I%2===0?(v(B[U][z+1]),v(B[U+1][z]),v(B[U][z])):(v(B[U][z+1]),v(B[U+1][z+1]),v(B[U+1][z]))}}function d(T){const L=new ae;for(let C=0;C<s.length;C+=3)L.x=s[C+0],L.y=s[C+1],L.z=s[C+2],L.normalize().multiplyScalar(T),s[C+0]=L.x,s[C+1]=L.y,s[C+2]=L.z}function p(){const T=new ae;for(let L=0;L<s.length;L+=3){T.x=s[L+0],T.y=s[L+1],T.z=s[L+2];const C=w(T)/2/Math.PI+.5,P=b(T)/Math.PI+.5;a.push(C,1-P)}S(),g()}function g(){for(let T=0;T<a.length;T+=6){const L=a[T+0],C=a[T+2],P=a[T+4];Math.max(L,C,P)>.9&&Math.min(L,C,P)<.1&&(L<.2&&(a[T+0]+=1),C<.2&&(a[T+2]+=1),P<.2&&(a[T+4]+=1))}}function v(T){s.push(T.x,T.y,T.z)}function y(T,L){const C=T*3;L.x=t[C+0],L.y=t[C+1],L.z=t[C+2]}function S(){const T=new ae,L=new ae,C=new ae,P=new ae,O=new pt,B=new pt,U=new pt;for(let I=0,z=0;I<s.length;I+=9,z+=6){T.set(s[I+0],s[I+1],s[I+2]),L.set(s[I+3],s[I+4],s[I+5]),C.set(s[I+6],s[I+7],s[I+8]),O.set(a[z+0],a[z+1]),B.set(a[z+2],a[z+3]),U.set(a[z+4],a[z+5]),P.copy(T).add(L).add(C).divideScalar(3);const te=w(P);E(O,z+0,T,te),E(B,z+2,L,te),E(U,z+4,C,te)}}function E(T,L,C,P){P<0&&T.x===1&&(a[L]=T.x-1),C.x===0&&C.z===0&&(a[L]=P/2/Math.PI+.5)}function w(T){return Math.atan2(T.z,-T.x)}function b(T){return Math.atan2(-T.y,Math.sqrt(T.x*T.x+T.z*T.z))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new _L(t.vertices,t.indices,t.radius,t.details)}},Aw=class vL extends xf{constructor(t=1,n=0){const i=(1+Math.sqrt(5))/2,r=1/i,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r];super(s,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,n),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:n}}static fromJSON(t){return new vL(t.radius,t.detail)}},vy=new ae,yy=new ae,o2=new ae,xy=new rf,yL=class extends vn{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const n=Math.pow(10,4),i=Math.cos(af*t),r=e.getIndex(),s=e.getAttribute("position"),a=r?r.count:s.count,c=[0,0,0],u=["a","b","c"],d=new Array(3),p={},g=[];for(let v=0;v<a;v+=3){r?(c[0]=r.getX(v),c[1]=r.getX(v+1),c[2]=r.getX(v+2)):(c[0]=v,c[1]=v+1,c[2]=v+2);const{a:y,b:S,c:E}=xy;if(y.fromBufferAttribute(s,c[0]),S.fromBufferAttribute(s,c[1]),E.fromBufferAttribute(s,c[2]),xy.getNormal(o2),d[0]=`${Math.round(y.x*n)},${Math.round(y.y*n)},${Math.round(y.z*n)}`,d[1]=`${Math.round(S.x*n)},${Math.round(S.y*n)},${Math.round(S.z*n)}`,d[2]=`${Math.round(E.x*n)},${Math.round(E.y*n)},${Math.round(E.z*n)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let w=0;w<3;w++){const b=(w+1)%3,T=d[w],L=d[b],C=xy[u[w]],P=xy[u[b]],O=`${T}_${L}`,B=`${L}_${T}`;B in p&&p[B]?(o2.dot(p[B].normal)<=i&&(g.push(C.x,C.y,C.z),g.push(P.x,P.y,P.z)),p[B]=null):O in p||(p[O]={index0:c[w],index1:c[b],normal:o2.clone()})}}for(const v in p)if(p[v]){const{index0:y,index1:S}=p[v];vy.fromBufferAttribute(s,y),yy.fromBufferAttribute(s,S),g.push(vy.x,vy.y,vy.z),g.push(yy.x,yy.y,yy.z)}this.setAttribute("position",new Ot(g,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}},lf=class extends n0{constructor(e){super(e),this.uuid=qs(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new n0().fromJSON(i))}return this}},fB={triangulate:function(e,t,n=2){const i=t&&t.length,r=i?t[0]*n:e.length;let s=xL(e,0,r,n,!0);const a=[];if(!s||s.next===s.prev)return a;let c,u,d,p,g,v,y;if(i&&(s=_B(e,t,s,n)),e.length>80*n){c=d=e[0],u=p=e[1];for(let S=n;S<r;S+=n)g=e[S],v=e[S+1],g<c&&(c=g),v<u&&(u=v),g>d&&(d=g),v>p&&(p=v);y=Math.max(d-c,p-u),y=y!==0?32767/y:0}return i0(s,a,n,c,u,y,0),a}};function xL(e,t,n,i,r){let s,a;if(r===CB(e,t,n,i)>0)for(s=t;s<n;s+=i)a=vT(s,e[s],e[s+1],a);else for(s=n-i;s>=t;s-=i)a=vT(s,e[s],e[s+1],a);return a&&Wx(a,a.next)&&(s0(a),a=a.next),a}function df(e,t){if(!e)return e;t||(t=e);let n=e,i;do if(i=!1,!n.steiner&&(Wx(n,n.next)||bi(n.prev,n,n.next)===0)){if(s0(n),n=t=n.prev,n===n.next)break;i=!0}else n=n.next;while(i||n!==t);return t}function i0(e,t,n,i,r,s,a){if(!e)return;!a&&s&&bB(e,i,r,s);let c=e,u,d;for(;e.prev!==e.next;){if(u=e.prev,d=e.next,s?pB(e,i,r,s):dB(e)){t.push(u.i/n|0),t.push(e.i/n|0),t.push(d.i/n|0),s0(e),e=d.next,c=d.next;continue}if(e=d,e===c){a?a===1?(e=mB(df(e),t,n),i0(e,t,n,i,r,s,2)):a===2&&gB(e,t,n,i,r,s):i0(df(e),t,n,i,r,s,1);break}}}function dB(e){const t=e.prev,n=e,i=e.next;if(bi(t,n,i)>=0)return!1;const r=t.x,s=n.x,a=i.x,c=t.y,u=n.y,d=i.y,p=r<s?r<a?r:a:s<a?s:a,g=c<u?c<d?c:d:u<d?u:d,v=r>s?r>a?r:a:s>a?s:a,y=c>u?c>d?c:d:u>d?u:d;let S=i.next;for(;S!==t;){if(S.x>=p&&S.x<=v&&S.y>=g&&S.y<=y&&Vp(r,c,s,u,a,d,S.x,S.y)&&bi(S.prev,S,S.next)>=0)return!1;S=S.next}return!0}function pB(e,t,n,i){const r=e.prev,s=e,a=e.next;if(bi(r,s,a)>=0)return!1;const c=r.x,u=s.x,d=a.x,p=r.y,g=s.y,v=a.y,y=c<u?c<d?c:d:u<d?u:d,S=p<g?p<v?p:v:g<v?g:v,E=c>u?c>d?c:d:u>d?u:d,w=p>g?p>v?p:v:g>v?g:v,b=tM(y,S,t,n,i),T=tM(E,w,t,n,i);let L=e.prevZ,C=e.nextZ;for(;L&&L.z>=b&&C&&C.z<=T;){if(L.x>=y&&L.x<=E&&L.y>=S&&L.y<=w&&L!==r&&L!==a&&Vp(c,p,u,g,d,v,L.x,L.y)&&bi(L.prev,L,L.next)>=0||(L=L.prevZ,C.x>=y&&C.x<=E&&C.y>=S&&C.y<=w&&C!==r&&C!==a&&Vp(c,p,u,g,d,v,C.x,C.y)&&bi(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;L&&L.z>=b;){if(L.x>=y&&L.x<=E&&L.y>=S&&L.y<=w&&L!==r&&L!==a&&Vp(c,p,u,g,d,v,L.x,L.y)&&bi(L.prev,L,L.next)>=0)return!1;L=L.prevZ}for(;C&&C.z<=T;){if(C.x>=y&&C.x<=E&&C.y>=S&&C.y<=w&&C!==r&&C!==a&&Vp(c,p,u,g,d,v,C.x,C.y)&&bi(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function mB(e,t,n){let i=e;do{const r=i.prev,s=i.next.next;!Wx(r,s)&&SL(r,i,i.next,s)&&r0(r,s)&&r0(s,r)&&(t.push(r.i/n|0),t.push(i.i/n|0),t.push(s.i/n|0),s0(i),s0(i.next),i=e=s),i=i.next}while(i!==e);return df(i)}function gB(e,t,n,i,r,s){let a=e;do{let c=a.next.next;for(;c!==a.prev;){if(a.i!==c.i&&AB(a,c)){let u=bL(a,c);a=df(a,a.next),u=df(u,u.next),i0(a,t,n,i,r,s,0),i0(u,t,n,i,r,s,0);return}c=c.next}a=a.next}while(a!==e)}function _B(e,t,n,i){const r=[];let s,a,c,u,d;for(s=0,a=t.length;s<a;s++)c=t[s]*i,u=s<a-1?t[s+1]*i:e.length,d=xL(e,c,u,i,!1),d===d.next&&(d.steiner=!0),r.push(wB(d));for(r.sort(vB),s=0;s<r.length;s++)n=yB(r[s],n);return n}function vB(e,t){return e.x-t.x}function yB(e,t){const n=xB(e,t);if(!n)return t;const i=bL(n,e);return df(i,i.next),df(n,n.next)}function xB(e,t){let n=t,i=-1/0,r;const s=e.x,a=e.y;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){const v=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(v<=s&&v>i&&(i=v,r=n.x<n.next.x?n:n.next,v===s))return r}n=n.next}while(n!==t);if(!r)return null;const c=r,u=r.x,d=r.y;let p=1/0,g;n=r;do s>=n.x&&n.x>=u&&s!==n.x&&Vp(a<d?s:i,a,u,d,a<d?i:s,a,n.x,n.y)&&(g=Math.abs(a-n.y)/(s-n.x),r0(n,e)&&(g<p||g===p&&(n.x>r.x||n.x===r.x&&SB(r,n)))&&(r=n,p=g)),n=n.next;while(n!==c);return r}function SB(e,t){return bi(e.prev,e,t.prev)<0&&bi(t.next,e,e.next)<0}function bB(e,t,n,i){let r=e;do r.z===0&&(r.z=tM(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,MB(r)}function MB(e){let t,n,i,r,s,a,c,u,d=1;do{for(n=e,e=null,s=null,a=0;n;){for(a++,i=n,c=0,t=0;t<d&&(c++,i=i.nextZ,!!i);t++);for(u=d;c>0||u>0&&i;)c!==0&&(u===0||!i||n.z<=i.z)?(r=n,n=n.nextZ,c--):(r=i,i=i.nextZ,u--),s?s.nextZ=r:e=r,r.prevZ=s,s=r;n=i}s.nextZ=null,d*=2}while(a>1);return e}function tM(e,t,n,i,r){return e=(e-n)*r|0,t=(t-i)*r|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function wB(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function Vp(e,t,n,i,r,s,a,c){return(r-a)*(t-c)>=(e-a)*(s-c)&&(e-a)*(i-c)>=(n-a)*(t-c)&&(n-a)*(s-c)>=(r-a)*(i-c)}function AB(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!EB(e,t)&&(r0(e,t)&&r0(t,e)&&TB(e,t)&&(bi(e.prev,e,t.prev)||bi(e,t.prev,t))||Wx(e,t)&&bi(e.prev,e,e.next)>0&&bi(t.prev,t,t.next)>0)}function bi(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Wx(e,t){return e.x===t.x&&e.y===t.y}function SL(e,t,n,i){const r=by(bi(e,t,n)),s=by(bi(e,t,i)),a=by(bi(n,i,e)),c=by(bi(n,i,t));return!!(r!==s&&a!==c||r===0&&Sy(e,n,t)||s===0&&Sy(e,i,t)||a===0&&Sy(n,e,i)||c===0&&Sy(n,t,i))}function Sy(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function by(e){return e>0?1:e<0?-1:0}function EB(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&SL(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function r0(e,t){return bi(e.prev,e,e.next)<0?bi(e,t,e.next)>=0&&bi(e,e.prev,t)>=0:bi(e,t,e.prev)<0||bi(e,e.next,t)<0}function TB(e,t){let n=e,i=!1;const r=(e.x+t.x)/2,s=(e.y+t.y)/2;do n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next;while(n!==e);return i}function bL(e,t){const n=new nM(e.i,e.x,e.y),i=new nM(t.i,t.x,t.y),r=e.next,s=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function vT(e,t,n,i){const r=new nM(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function s0(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function nM(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function CB(e,t,n,i){let r=0;for(let s=t,a=n-i;s<n;s+=i)r+=(e[a]-e[s])*(e[s+1]+e[a+1]),a=s;return r}var Su=class ML{static area(t){const n=t.length;let i=0;for(let r=n-1,s=0;s<n;r=s++)i+=t[r].x*t[s].y-t[s].x*t[r].y;return i*.5}static isClockWise(t){return ML.area(t)<0}static triangulateShape(t,n){const i=[],r=[],s=[];yT(t),xT(i,t);let a=t.length;n.forEach(yT);for(let u=0;u<n.length;u++)r.push(a),a+=n[u].length,xT(i,n[u]);const c=fB.triangulate(i,r);for(let u=0;u<c.length;u+=3)s.push(c.slice(u,u+3));return s}};function yT(e){const t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function xT(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}var Ew=class wL extends vn{constructor(t=new lf([new pt(.5,.5),new pt(-.5,.5),new pt(-.5,-.5),new pt(.5,-.5)]),n={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:n},t=Array.isArray(t)?t:[t];const i=this,r=[],s=[];for(let c=0,u=t.length;c<u;c++){const d=t[c];a(d)}this.setAttribute("position",new Ot(r,3)),this.setAttribute("uv",new Ot(s,2)),this.computeVertexNormals();function a(c){const u=[],d=n.curveSegments!==void 0?n.curveSegments:12,p=n.steps!==void 0?n.steps:1,g=n.depth!==void 0?n.depth:1;let v=n.bevelEnabled!==void 0?n.bevelEnabled:!0,y=n.bevelThickness!==void 0?n.bevelThickness:.2,S=n.bevelSize!==void 0?n.bevelSize:y-.1,E=n.bevelOffset!==void 0?n.bevelOffset:0,w=n.bevelSegments!==void 0?n.bevelSegments:3;const b=n.extrudePath,T=n.UVGenerator!==void 0?n.UVGenerator:RB;let L,C=!1,P,O,B,U;b&&(L=b.getSpacedPoints(p),C=!0,v=!1,P=b.computeFrenetFrames(p,!1),O=new ae,B=new ae,U=new ae),v||(w=0,y=0,S=0,E=0);const I=c.extractPoints(d);let z=I.shape;const te=I.holes;if(!Su.isClockWise(z)){z=z.reverse();for(let ne=0,Be=te.length;ne<Be;ne++){const Ne=te[ne];Su.isClockWise(Ne)&&(te[ne]=Ne.reverse())}}const oe=Su.triangulateShape(z,te),ee=z;for(let ne=0,Be=te.length;ne<Be;ne++){const Ne=te[ne];z=z.concat(Ne)}function k(ne,Be,Ne){return Be||console.error("THREE.ExtrudeGeometry: vec does not exist"),ne.clone().addScaledVector(Be,Ne)}const X=z.length,$=oe.length;function j(ne,Be,Ne){let ve,ye,et;const tt=ne.x-Be.x,_t=ne.y-Be.y,St=Ne.x-ne.x,Mt=Ne.y-ne.y,Bt=tt*tt+_t*_t,Ft=tt*Mt-_t*St;if(Math.abs(Ft)>Number.EPSILON){const ie=Math.sqrt(Bt),Z=Math.sqrt(St*St+Mt*Mt),Ve=Be.x-_t/ie,ut=Be.y+tt/ie,gt=Ne.x-Mt/Z,dt=Ne.y+St/Z,G=((gt-Ve)*Mt-(dt-ut)*St)/(tt*Mt-_t*St);ve=Ve+tt*G-ne.x,ye=ut+_t*G-ne.y;const q=ve*ve+ye*ye;if(q<=2)return new pt(ve,ye);et=Math.sqrt(q/2)}else{let ie=!1;tt>Number.EPSILON?St>Number.EPSILON&&(ie=!0):tt<-Number.EPSILON?St<-Number.EPSILON&&(ie=!0):Math.sign(_t)===Math.sign(Mt)&&(ie=!0),ie?(ve=-_t,ye=tt,et=Math.sqrt(Bt)):(ve=tt,ye=_t,et=Math.sqrt(Bt/2))}return new pt(ve/et,ye/et)}const J=[];for(let ne=0,Be=ee.length,Ne=Be-1,ve=ne+1;ne<Be;ne++,Ne++,ve++)Ne===Be&&(Ne=0),ve===Be&&(ve=0),J[ne]=j(ee[ne],ee[Ne],ee[ve]);const xe=[];let de,fe=J.concat();for(let ne=0,Be=te.length;ne<Be;ne++){const Ne=te[ne];de=[];for(let ve=0,ye=Ne.length,et=ye-1,tt=ve+1;ve<ye;ve++,et++,tt++)et===ye&&(et=0),tt===ye&&(tt=0),de[ve]=j(Ne[ve],Ne[et],Ne[tt]);xe.push(de),fe=fe.concat(de)}for(let ne=0;ne<w;ne++){const Be=ne/w,Ne=y*Math.cos(Be*Math.PI/2),ve=S*Math.sin(Be*Math.PI/2)+E;for(let ye=0,et=ee.length;ye<et;ye++){const tt=k(ee[ye],J[ye],ve);Le(tt.x,tt.y,-Ne)}for(let ye=0,et=te.length;ye<et;ye++){const tt=te[ye];de=xe[ye];for(let _t=0,St=tt.length;_t<St;_t++){const Mt=k(tt[_t],de[_t],ve);Le(Mt.x,Mt.y,-Ne)}}}const F=S+E;for(let ne=0;ne<X;ne++){const Be=v?k(z[ne],fe[ne],F):z[ne];C?(B.copy(P.normals[0]).multiplyScalar(Be.x),O.copy(P.binormals[0]).multiplyScalar(Be.y),U.copy(L[0]).add(B).add(O),Le(U.x,U.y,U.z)):Le(Be.x,Be.y,0)}for(let ne=1;ne<=p;ne++)for(let Be=0;Be<X;Be++){const Ne=v?k(z[Be],fe[Be],F):z[Be];C?(B.copy(P.normals[ne]).multiplyScalar(Ne.x),O.copy(P.binormals[ne]).multiplyScalar(Ne.y),U.copy(L[ne]).add(B).add(O),Le(U.x,U.y,U.z)):Le(Ne.x,Ne.y,g/p*ne)}for(let ne=w-1;ne>=0;ne--){const Be=ne/w,Ne=y*Math.cos(Be*Math.PI/2),ve=S*Math.sin(Be*Math.PI/2)+E;for(let ye=0,et=ee.length;ye<et;ye++){const tt=k(ee[ye],J[ye],ve);Le(tt.x,tt.y,g+Ne)}for(let ye=0,et=te.length;ye<et;ye++){const tt=te[ye];de=xe[ye];for(let _t=0,St=tt.length;_t<St;_t++){const Mt=k(tt[_t],de[_t],ve);C?Le(Mt.x,Mt.y+L[p-1].y,L[p-1].x+Ne):Le(Mt.x,Mt.y,g+Ne)}}}re(),ue();function re(){const ne=r.length/3;if(v){let Be=0,Ne=X*Be;for(let ve=0;ve<$;ve++){const ye=oe[ve];Fe(ye[2]+Ne,ye[1]+Ne,ye[0]+Ne)}Be=p+w*2,Ne=X*Be;for(let ve=0;ve<$;ve++){const ye=oe[ve];Fe(ye[0]+Ne,ye[1]+Ne,ye[2]+Ne)}}else{for(let Be=0;Be<$;Be++){const Ne=oe[Be];Fe(Ne[2],Ne[1],Ne[0])}for(let Be=0;Be<$;Be++){const Ne=oe[Be];Fe(Ne[0]+X*p,Ne[1]+X*p,Ne[2]+X*p)}}i.addGroup(ne,r.length/3-ne,0)}function ue(){const ne=r.length/3;let Be=0;_e(ee,Be),Be+=ee.length;for(let Ne=0,ve=te.length;Ne<ve;Ne++){const ye=te[Ne];_e(ye,Be),Be+=ye.length}i.addGroup(ne,r.length/3-ne,1)}function _e(ne,Be){let Ne=ne.length;for(;--Ne>=0;){const ve=Ne;let ye=Ne-1;ye<0&&(ye=ne.length-1);for(let et=0,tt=p+w*2;et<tt;et++){const _t=X*et,St=X*(et+1);Xe(Be+ve+_t,Be+ye+_t,Be+ye+St,Be+ve+St)}}}function Le(ne,Be,Ne){u.push(ne),u.push(Be),u.push(Ne)}function Fe(ne,Be,Ne){lt(ne),lt(Be),lt(Ne);const ve=r.length/3,ye=T.generateTopUV(i,r,ve-3,ve-2,ve-1);mt(ye[0]),mt(ye[1]),mt(ye[2])}function Xe(ne,Be,Ne,ve){lt(ne),lt(Be),lt(ve),lt(Be),lt(Ne),lt(ve);const ye=r.length/3,et=T.generateSideWallUV(i,r,ye-6,ye-3,ye-2,ye-1);mt(et[0]),mt(et[1]),mt(et[3]),mt(et[1]),mt(et[2]),mt(et[3])}function lt(ne){r.push(u[ne*3+0]),r.push(u[ne*3+1]),r.push(u[ne*3+2])}function mt(ne){s.push(ne.x),s.push(ne.y)}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON(),n=this.parameters.shapes,i=this.parameters.options;return LB(n,i,t)}static fromJSON(t,n){const i=[];for(let s=0,a=t.shapes.length;s<a;s++){const c=n[t.shapes[s]];i.push(c)}const r=t.options.extrudePath;return r!==void 0&&(t.options.extrudePath=new Sw[r.type]().fromJSON(r)),new wL(i,t.options)}},RB={generateTopUV:function(e,t,n,i,r){const s=t[n*3],a=t[n*3+1],c=t[i*3],u=t[i*3+1],d=t[r*3],p=t[r*3+1];return[new pt(s,a),new pt(c,u),new pt(d,p)]},generateSideWallUV:function(e,t,n,i,r,s){const a=t[n*3],c=t[n*3+1],u=t[n*3+2],d=t[i*3],p=t[i*3+1],g=t[i*3+2],v=t[r*3],y=t[r*3+1],S=t[r*3+2],E=t[s*3],w=t[s*3+1],b=t[s*3+2];return Math.abs(c-p)<Math.abs(a-d)?[new pt(a,1-u),new pt(d,1-g),new pt(v,1-S),new pt(E,1-b)]:[new pt(c,1-u),new pt(p,1-g),new pt(y,1-S),new pt(w,1-b)]}};function LB(e,t,n){if(n.shapes=[],Array.isArray(e))for(let i=0,r=e.length;i<r;i++){const s=e[i];n.shapes.push(s.uuid)}else n.shapes.push(e.uuid);return n.options=Object.assign({},t),t.extrudePath!==void 0&&(n.options.extrudePath=t.extrudePath.toJSON()),n}var Tw=class AL extends xf{constructor(t=1,n=0){const i=(1+Math.sqrt(5))/2,r=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1];super(r,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,n),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:n}}static fromJSON(t){return new AL(t.radius,t.detail)}},Xx=class EL extends xf{constructor(t=1,n=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,n),this.type="OctahedronGeometry",this.parameters={radius:t,detail:n}}static fromJSON(t){return new EL(t.radius,t.detail)}},Cw=class TL extends vn{constructor(t=.5,n=1,i=32,r=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:n,thetaSegments:i,phiSegments:r,thetaStart:s,thetaLength:a},i=Math.max(3,i),r=Math.max(1,r);const c=[],u=[],d=[],p=[];let g=t;const v=(n-t)/r,y=new ae,S=new pt;for(let E=0;E<=r;E++){for(let w=0;w<=i;w++){const b=s+w/i*a;y.x=g*Math.cos(b),y.y=g*Math.sin(b),u.push(y.x,y.y,y.z),d.push(0,0,1),S.x=(y.x/n+1)/2,S.y=(y.y/n+1)/2,p.push(S.x,S.y)}g+=v}for(let E=0;E<r;E++){const w=E*(i+1);for(let b=0;b<i;b++){const T=b+w,L=T,C=T+i+1,P=T+i+2,O=T+1;c.push(L,C,O),c.push(C,P,O)}}this.setIndex(c),this.setAttribute("position",new Ot(u,3)),this.setAttribute("normal",new Ot(d,3)),this.setAttribute("uv",new Ot(p,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new TL(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}},Rw=class CL extends vn{constructor(t=new lf([new pt(0,.5),new pt(-.5,-.5),new pt(.5,-.5)]),n=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:n};const i=[],r=[],s=[],a=[];let c=0,u=0;if(Array.isArray(t)===!1)d(t);else for(let p=0;p<t.length;p++)d(t[p]),this.addGroup(c,u,p),c+=u,u=0;this.setIndex(i),this.setAttribute("position",new Ot(r,3)),this.setAttribute("normal",new Ot(s,3)),this.setAttribute("uv",new Ot(a,2));function d(p){const g=r.length/3,v=p.extractPoints(n);let y=v.shape;const S=v.holes;Su.isClockWise(y)===!1&&(y=y.reverse());for(let w=0,b=S.length;w<b;w++){const T=S[w];Su.isClockWise(T)===!0&&(S[w]=T.reverse())}const E=Su.triangulateShape(y,S);for(let w=0,b=S.length;w<b;w++){const T=S[w];y=y.concat(T)}for(let w=0,b=y.length;w<b;w++){const T=y[w];r.push(T.x,T.y,0),s.push(0,0,1),a.push(T.x,T.y)}for(let w=0,b=E.length;w<b;w++){const T=E[w],L=T[0]+g,C=T[1]+g,P=T[2]+g;i.push(L,C,P),u+=3}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON(),n=this.parameters.shapes;return PB(n,t)}static fromJSON(t,n){const i=[];for(let r=0,s=t.shapes.length;r<s;r++){const a=n[t.shapes[r]];i.push(a)}return new CL(i,t.curveSegments)}};function PB(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,i=e.length;n<i;n++){const r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}var jx=class RL extends vn{constructor(t=1,n=32,i=16,r=0,s=Math.PI*2,a=0,c=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:n,heightSegments:i,phiStart:r,phiLength:s,thetaStart:a,thetaLength:c},n=Math.max(3,Math.floor(n)),i=Math.max(2,Math.floor(i));const u=Math.min(a+c,Math.PI);let d=0;const p=[],g=new ae,v=new ae,y=[],S=[],E=[],w=[];for(let b=0;b<=i;b++){const T=[],L=b/i;let C=0;b===0&&a===0?C=.5/n:b===i&&u===Math.PI&&(C=-.5/n);for(let P=0;P<=n;P++){const O=P/n;g.x=-t*Math.cos(r+O*s)*Math.sin(a+L*c),g.y=t*Math.cos(a+L*c),g.z=t*Math.sin(r+O*s)*Math.sin(a+L*c),S.push(g.x,g.y,g.z),v.copy(g).normalize(),E.push(v.x,v.y,v.z),w.push(O+C,1-L),T.push(d++)}p.push(T)}for(let b=0;b<i;b++)for(let T=0;T<n;T++){const L=p[b][T+1],C=p[b][T],P=p[b+1][T],O=p[b+1][T+1];(b!==0||a>0)&&y.push(L,C,O),(b!==i-1||u<Math.PI)&&y.push(C,P,O)}this.setIndex(y),this.setAttribute("position",new Ot(S,3)),this.setAttribute("normal",new Ot(E,3)),this.setAttribute("uv",new Ot(w,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new RL(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},Lw=class LL extends xf{constructor(t=1,n=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,n),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:n}}static fromJSON(t){return new LL(t.radius,t.detail)}},Pw=class PL extends vn{constructor(t=1,n=.4,i=12,r=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:n,radialSegments:i,tubularSegments:r,arc:s},i=Math.floor(i),r=Math.floor(r);const a=[],c=[],u=[],d=[],p=new ae,g=new ae,v=new ae;for(let y=0;y<=i;y++)for(let S=0;S<=r;S++){const E=S/r*s,w=y/i*Math.PI*2;g.x=(t+n*Math.cos(w))*Math.cos(E),g.y=(t+n*Math.cos(w))*Math.sin(E),g.z=n*Math.sin(w),c.push(g.x,g.y,g.z),p.x=t*Math.cos(E),p.y=t*Math.sin(E),v.subVectors(g,p).normalize(),u.push(v.x,v.y,v.z),d.push(S/r),d.push(y/i)}for(let y=1;y<=i;y++)for(let S=1;S<=r;S++){const E=(r+1)*y+S-1,w=(r+1)*(y-1)+S-1,b=(r+1)*(y-1)+S,T=(r+1)*y+S;a.push(E,w,T),a.push(w,b,T)}this.setIndex(a),this.setAttribute("position",new Ot(c,3)),this.setAttribute("normal",new Ot(u,3)),this.setAttribute("uv",new Ot(d,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new PL(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}},Nw=class NL extends vn{constructor(t=1,n=.4,i=64,r=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:n,tubularSegments:i,radialSegments:r,p:s,q:a},i=Math.floor(i),r=Math.floor(r);const c=[],u=[],d=[],p=[],g=new ae,v=new ae,y=new ae,S=new ae,E=new ae,w=new ae,b=new ae;for(let L=0;L<=i;++L){const C=L/i*s*Math.PI*2;T(C,s,a,t,y),T(C+.01,s,a,t,S),w.subVectors(S,y),b.addVectors(S,y),E.crossVectors(w,b),b.crossVectors(E,w),E.normalize(),b.normalize();for(let P=0;P<=r;++P){const O=P/r*Math.PI*2,B=-n*Math.cos(O),U=n*Math.sin(O);g.x=y.x+(B*b.x+U*E.x),g.y=y.y+(B*b.y+U*E.y),g.z=y.z+(B*b.z+U*E.z),u.push(g.x,g.y,g.z),v.subVectors(g,y).normalize(),d.push(v.x,v.y,v.z),p.push(L/i),p.push(P/r)}}for(let L=1;L<=i;L++)for(let C=1;C<=r;C++){const P=(r+1)*(L-1)+(C-1),O=(r+1)*L+(C-1),B=(r+1)*L+C,U=(r+1)*(L-1)+C;c.push(P,O,U),c.push(O,B,U)}this.setIndex(c),this.setAttribute("position",new Ot(u,3)),this.setAttribute("normal",new Ot(d,3)),this.setAttribute("uv",new Ot(p,2));function T(L,C,P,O,B){const U=Math.cos(L),I=Math.sin(L),z=P/C*L,te=Math.cos(z);B.x=O*(2+te)*.5*U,B.y=O*(2+te)*I*.5,B.z=O*Math.sin(z)*.5}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new NL(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}},Iw=class IL extends vn{constructor(t=new yw(new ae(-1,-1,0),new ae(-1,1,0),new ae(1,1,0)),n=64,i=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:n,radius:i,radialSegments:r,closed:s};const a=t.computeFrenetFrames(n,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const c=new ae,u=new ae,d=new pt;let p=new ae;const g=[],v=[],y=[],S=[];E(),this.setIndex(S),this.setAttribute("position",new Ot(g,3)),this.setAttribute("normal",new Ot(v,3)),this.setAttribute("uv",new Ot(y,2));function E(){for(let L=0;L<n;L++)w(L);w(s===!1?n:0),T(),b()}function w(L){p=t.getPointAt(L/n,p);const C=a.normals[L],P=a.binormals[L];for(let O=0;O<=r;O++){const B=O/r*Math.PI*2,U=Math.sin(B),I=-Math.cos(B);u.x=I*C.x+U*P.x,u.y=I*C.y+U*P.y,u.z=I*C.z+U*P.z,u.normalize(),v.push(u.x,u.y,u.z),c.x=p.x+i*u.x,c.y=p.y+i*u.y,c.z=p.z+i*u.z,g.push(c.x,c.y,c.z)}}function b(){for(let L=1;L<=n;L++)for(let C=1;C<=r;C++){const P=(r+1)*(L-1)+(C-1),O=(r+1)*L+(C-1),B=(r+1)*L+C,U=(r+1)*(L-1)+C;S.push(P,O,U),S.push(O,B,U)}}function T(){for(let L=0;L<=n;L++)for(let C=0;C<=r;C++)d.x=L/n,d.y=C/r,y.push(d.x,d.y)}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new IL(new Sw[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}},OL=class extends vn{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new ae,r=new ae;if(e.index!==null){const s=e.attributes.position,a=e.index;let c=e.groups;c.length===0&&(c=[{start:0,count:a.count,materialIndex:0}]);for(let u=0,d=c.length;u<d;++u){const p=c[u],g=p.start,v=p.count;for(let y=g,S=g+v;y<S;y+=3)for(let E=0;E<3;E++){const w=a.getX(y+E),b=a.getX(y+(E+1)%3);i.fromBufferAttribute(s,w),r.fromBufferAttribute(s,b),ST(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}}else{const s=e.attributes.position;for(let a=0,c=s.count/3;a<c;a++)for(let u=0;u<3;u++){const d=3*a+u,p=3*a+(u+1)%3;i.fromBufferAttribute(s,d),r.fromBufferAttribute(s,p),ST(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}this.setAttribute("position",new Ot(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function ST(e,t,n){const i=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`,r=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`;return n.has(i)===!0||n.has(r)===!0?!1:(n.add(i),n.add(r),!0)}var bT=Object.freeze({__proto__:null,BoxGeometry:am,CapsuleGeometry:bw,CircleGeometry:Mw,ConeGeometry:ww,CylinderGeometry:S0,DodecahedronGeometry:Aw,EdgesGeometry:yL,ExtrudeGeometry:Ew,IcosahedronGeometry:Tw,LatheGeometry:Hx,OctahedronGeometry:Xx,PlaneGeometry:Ux,PolyhedronGeometry:xf,RingGeometry:Cw,ShapeGeometry:Rw,SphereGeometry:jx,TetrahedronGeometry:Lw,TorusGeometry:Pw,TorusKnotGeometry:Nw,TubeGeometry:Iw,WireframeGeometry:OL}),DL=class extends Hr{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Tt(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}},zL=class extends $a{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},Ow=class extends Hr{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Tt(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 Tt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new pt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,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.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}},UL=class extends Ow{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 pt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ti(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 Tt(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 Tt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Tt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=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 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.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}},BL=class extends Hr{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Tt(16777215),this.specular=new Tt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Tt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new pt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,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.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}},VL=class extends Hr{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Tt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Tt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new pt(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}},FL=class extends Hr{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new pt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}},kL=class extends Hr{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Tt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Tt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new pt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,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.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}},GL=class extends Hr{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Tt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new pt(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}},HL=class extends us{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}};function _o(e,t,n){return Dw(e)?new e.constructor(e.subarray(t,n!==void 0?n:e.length)):e.slice(t,n)}function sf(e,t,n){return!e||!n&&e.constructor===t?e:typeof t.BYTES_PER_ELEMENT=="number"?new t(e):Array.prototype.slice.call(e)}function Dw(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function WL(e){function t(r,s){return e[r]-e[s]}const n=e.length,i=new Array(n);for(let r=0;r!==n;++r)i[r]=r;return i.sort(t),i}function iM(e,t,n){const i=e.length,r=new e.constructor(i);for(let s=0,a=0;a!==i;++s){const c=n[s]*t;for(let u=0;u!==t;++u)r[a++]=e[c+u]}return r}function zw(e,t,n,i){let r=1,s=e[0];for(;s!==void 0&&s[i]===void 0;)s=e[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&&(t.push(s.time),n.push.apply(n,a)),s=e[r++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[i],a!==void 0&&(t.push(s.time),a.toArray(n,n.length)),s=e[r++];while(s!==void 0);else do a=s[i],a!==void 0&&(t.push(s.time),n.push(a)),s=e[r++];while(s!==void 0)}function NB(e,t,n,i,r=30){const s=e.clone();s.name=t;const a=[];for(let u=0;u<s.tracks.length;++u){const d=s.tracks[u],p=d.getValueSize(),g=[],v=[];for(let y=0;y<d.times.length;++y){const S=d.times[y]*r;if(!(S<n||S>=i)){g.push(d.times[y]);for(let E=0;E<p;++E)v.push(d.values[y*p+E])}}g.length!==0&&(d.times=sf(g,d.times.constructor),d.values=sf(v,d.values.constructor),a.push(d))}s.tracks=a;let c=1/0;for(let u=0;u<s.tracks.length;++u)c>s.tracks[u].times[0]&&(c=s.tracks[u].times[0]);for(let u=0;u<s.tracks.length;++u)s.tracks[u].shift(-1*c);return s.resetDuration(),s}function IB(e,t=0,n=e,i=30){i<=0&&(i=30);const r=n.tracks.length,s=t/i;for(let a=0;a<r;++a){const c=n.tracks[a],u=c.ValueTypeName;if(u==="bool"||u==="string")continue;const d=e.tracks.find(function(b){return b.name===c.name&&b.ValueTypeName===u});if(d===void 0)continue;let p=0;const g=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(p=g/3);let v=0;const y=d.getValueSize();d.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(v=y/3);const S=c.times.length-1;let E;if(s<=c.times[0]){const b=p,T=g-p;E=_o(c.values,b,T)}else if(s>=c.times[S]){const b=S*g+p,T=b+g-p;E=_o(c.values,b,T)}else{const b=c.createInterpolant(),T=p,L=g-p;b.evaluate(s),E=_o(b.resultBuffer,T,L)}u==="quaternion"&&new Es().fromArray(E).normalize().conjugate().toArray(E);const w=d.times.length;for(let b=0;b<w;++b){const T=b*y+v;if(u==="quaternion")Es.multiplyQuaternionsFlat(d.values,T,E,0,d.values,T);else{const L=y-v*2;for(let C=0;C<L;++C)d.values[T+C]-=E[C]}}}return e.blendMode=JM,e}var OB={arraySlice:_o,convertArray:sf,isTypedArray:Dw,getKeyframeOrder:WL,sortedArray:iM,flattenJSON:zw,subclip:NB,makeClipAdditive:IB},b0=class{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let s;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(r=i,i=t[++n],e<i)break t}s=t.length;break n}if(!(e>=r)){const a=t[1];e<a&&(n=2,r=a);for(let c=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(i=r,r=t[--n-1],e>=r)break t}s=n,n=0;break n}break e}for(;n<s;){const a=n+s>>>1;e<t[a]?s=a:n=a+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let s=0;s!==i;++s)t[s]=n[r+s];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},XL=class extends b0{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:ef,endingEnd:ef}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,s=e+1,a=i[r],c=i[s];if(a===void 0)switch(this.getSettings_().endingStart){case tf:r=e,a=2*t-n;break;case J1:r=i.length-2,a=t+i[r]-i[r+1];break;default:r=e,a=n}if(c===void 0)switch(this.getSettings_().endingEnd){case tf:s=e,c=2*n-t;break;case J1:s=1,c=n+i[1]-i[0];break;default:s=e-1,c=t}const u=(n-t)*.5,d=this.valueSize;this._weightPrev=u/(t-a),this._weightNext=u/(c-n),this._offsetPrev=r*d,this._offsetNext=s*d}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,c=e*a,u=c-a,d=this._offsetPrev,p=this._offsetNext,g=this._weightPrev,v=this._weightNext,y=(n-t)/(i-t),S=y*y,E=S*y,w=-g*E+2*g*S-g*y,b=(1+g)*E+(-1.5-2*g)*S+(-.5+g)*y+1,T=(-1-v)*E+(1.5+v)*S+.5*y,L=v*E-v*S;for(let C=0;C!==a;++C)r[C]=w*s[d+C]+b*s[u+C]+T*s[c+C]+L*s[p+C];return r}},Uw=class extends b0{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,c=e*a,u=c-a,d=(n-t)/(i-t),p=1-d;for(let g=0;g!==a;++g)r[g]=s[u+g]*p+s[c+g]*d;return r}},jL=class extends b0{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}},pa=class{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=sf(t,this.TimeBufferType),this.values=sf(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:sf(e.times,Array),values:sf(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new jL(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Uw(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new XL(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case K1:t=this.InterpolantFactoryMethodDiscrete;break;case Q1:t=this.InterpolantFactoryMethodLinear;break;case ex:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return K1;case this.InterpolantFactoryMethodLinear:return Q1;case this.InterpolantFactoryMethodSmooth:return ex}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,s=i-1;for(;r!==i&&n[r]<e;)++r;for(;s!==-1&&n[s]>t;)--s;if(++s,r!==0||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const a=this.getValueSize();this.times=_o(n,r,s),this.values=_o(this.values,r*a,s*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let s=null;for(let a=0;a!==r;a++){const c=n[a];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(s!==null&&s>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,c,s),e=!1;break}s=c}if(i!==void 0&&Dw(i))for(let a=0,c=i.length;a!==c;++a){const u=i[a];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,u),e=!1;break}}return e}optimize(){const e=_o(this.times),t=_o(this.values),n=this.getValueSize(),i=this.getInterpolation()===ex,r=e.length-1;let s=1;for(let a=1;a<r;++a){let c=!1;const u=e[a];if(u!==e[a+1]&&(a!==1||u!==e[0]))if(i)c=!0;else{const d=a*n,p=d-n,g=d+n;for(let v=0;v!==n;++v){const y=t[d+v];if(y!==t[p+v]||y!==t[g+v]){c=!0;break}}}if(c){if(a!==s){e[s]=e[a];const d=a*n,p=s*n;for(let g=0;g!==n;++g)t[p+g]=t[d+g]}++s}}if(r>0){e[s]=e[r];for(let a=r*n,c=s*n,u=0;u!==n;++u)t[c+u]=t[a+u];++s}return s!==e.length?(this.times=_o(e,0,s),this.values=_o(t,0,s*n)):(this.times=e,this.values=t),this}clone(){const e=_o(this.times,0),t=_o(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}};pa.prototype.TimeBufferType=Float32Array;pa.prototype.ValueBufferType=Float32Array;pa.prototype.DefaultInterpolation=Q1;var Sf=class extends pa{};Sf.prototype.ValueTypeName="bool";Sf.prototype.ValueBufferType=Array;Sf.prototype.DefaultInterpolation=K1;Sf.prototype.InterpolantFactoryMethodLinear=void 0;Sf.prototype.InterpolantFactoryMethodSmooth=void 0;var Bw=class extends pa{};Bw.prototype.ValueTypeName="color";var o0=class extends pa{};o0.prototype.ValueTypeName="number";var YL=class extends b0{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,c=(n-t)/(i-t);let u=e*a;for(let d=u+a;u!==d;u+=4)Es.slerpFlat(r,0,s,u-a,s,u,c);return r}},cm=class extends pa{InterpolantFactoryMethodLinear(e){return new YL(this.times,this.values,this.getValueSize(),e)}};cm.prototype.ValueTypeName="quaternion";cm.prototype.DefaultInterpolation=Q1;cm.prototype.InterpolantFactoryMethodSmooth=void 0;var bf=class extends pa{};bf.prototype.ValueTypeName="string";bf.prototype.ValueBufferType=Array;bf.prototype.DefaultInterpolation=K1;bf.prototype.InterpolantFactoryMethodLinear=void 0;bf.prototype.InterpolantFactoryMethodSmooth=void 0;var a0=class extends pa{};a0.prototype.ValueTypeName="vector";var l0=class{constructor(e,t=-1,n,i=Px){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=qs(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let s=0,a=n.length;s!==a;++s)t.push(zB(n[s]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,s=n.length;r!==s;++r)t.push(pa.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,s=[];for(let a=0;a<r;a++){let c=[],u=[];c.push((a+r-1)%r,a,(a+1)%r),u.push(0,1,0);const d=WL(c);c=iM(c,1,d),u=iM(u,1,d),!i&&c[0]===0&&(c.push(r),u.push(u[0])),s.push(new o0(".morphTargetInfluences["+t[a].name+"]",c,u).scale(1/n))}return new this(e,-1,s)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let a=0,c=e.length;a<c;a++){const u=e[a],d=u.name.match(r);if(d&&d.length>1){const p=d[1];let g=i[p];g||(i[p]=g=[]),g.push(u)}}const s=[];for(const a in i)s.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return s}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(d,p,g,v,y){if(g.length!==0){const S=[],E=[];zw(g,S,E,v),S.length!==0&&y.push(new d(p,S,E))}},i=[],r=e.name||"default",s=e.fps||30,a=e.blendMode;let c=e.length||-1;const u=e.hierarchy||[];for(let d=0;d<u.length;d++){const p=u[d].keys;if(!(!p||p.length===0))if(p[0].morphTargets){const g={};let v;for(v=0;v<p.length;v++)if(p[v].morphTargets)for(let y=0;y<p[v].morphTargets.length;y++)g[p[v].morphTargets[y]]=-1;for(const y in g){const S=[],E=[];for(let w=0;w!==p[v].morphTargets.length;++w){const b=p[v];S.push(b.time),E.push(b.morphTarget===y?1:0)}i.push(new o0(".morphTargetInfluence["+y+"]",S,E))}c=g.length*s}else{const g=".bones["+t[d].name+"]";n(a0,g+".position",p,"pos",i),n(cm,g+".quaternion",p,"rot",i),n(a0,g+".scale",p,"scl",i)}}return i.length===0?null:new this(r,c,i,a)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){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 DB(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return o0;case"vector":case"vector2":case"vector3":case"vector4":return a0;case"color":return Bw;case"quaternion":return cm;case"bool":case"boolean":return Sf;case"string":return bf}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}function zB(e){if(e.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=DB(e.type);if(e.times===void 0){const n=[],i=[];zw(e.keys,n,i,"value"),e.times=n,e.values=i}return t.parse!==void 0?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}var pf={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(this.files[e]=t)},get:function(e){if(this.enabled!==!1)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},Vw=class{constructor(e,t,n){const i=this;let r=!1,s=0,a=0,c;const u=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(d){a++,r===!1&&i.onStart!==void 0&&i.onStart(d,s,a),r=!0},this.itemEnd=function(d){s++,i.onProgress!==void 0&&i.onProgress(d,s,a),s===a&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(d){i.onError!==void 0&&i.onError(d)},this.resolveURL=function(d){return c?c(d):d},this.setURLModifier=function(d){return c=d,this},this.addHandler=function(d,p){return u.push(d,p),this},this.removeHandler=function(d){const p=u.indexOf(d);return p!==-1&&u.splice(p,2),this},this.getHandler=function(d){for(let p=0,g=u.length;p<g;p+=2){const v=u[p],y=u[p+1];if(v.global&&(v.lastIndex=0),v.test(d))return y}return null}}},qL=new Vw,Js=class{constructor(e){this.manager=e!==void 0?e:qL,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}},kl={},UB=class extends Error{constructor(e,t){super(e),this.response=t}},Ql=class extends Js{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=pf.get(e);if(r!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(kl[e]!==void 0){kl[e].push({onLoad:t,onProgress:n,onError:i});return}kl[e]=[],kl[e].push({onLoad:t,onProgress:n,onError:i});const s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,c=this.responseType;fetch(s).then(u=>{if(u.status===200||u.status===0){if(u.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||u.body===void 0||u.body.getReader===void 0)return u;const d=kl[e],p=u.body.getReader(),g=u.headers.get("Content-Length")||u.headers.get("X-File-Size"),v=g?parseInt(g):0,y=v!==0;let S=0;const E=new ReadableStream({start(w){b();function b(){p.read().then(({done:T,value:L})=>{if(T)w.close();else{S+=L.byteLength;const C=new ProgressEvent("progress",{lengthComputable:y,loaded:S,total:v});for(let P=0,O=d.length;P<O;P++){const B=d[P];B.onProgress&&B.onProgress(C)}w.enqueue(L),b()}})}}});return new Response(E)}else throw new UB(`fetch for "${u.url}" responded with ${u.status}: ${u.statusText}`,u)}).then(u=>{switch(c){case"arraybuffer":return u.arrayBuffer();case"blob":return u.blob();case"document":return u.text().then(d=>new DOMParser().parseFromString(d,a));case"json":return u.json();default:if(a===void 0)return u.text();{const d=/charset="?([^;"\s]*)"?/i.exec(a),p=d&&d[1]?d[1].toLowerCase():void 0,g=new TextDecoder(p);return u.arrayBuffer().then(v=>g.decode(v))}}}).then(u=>{pf.add(e,u);const d=kl[e];delete kl[e];for(let p=0,g=d.length;p<g;p++){const v=d[p];v.onLoad&&v.onLoad(u)}}).catch(u=>{const d=kl[e];if(d===void 0)throw this.manager.itemError(e),u;delete kl[e];for(let p=0,g=d.length;p<g;p++){const v=d[p];v.onError&&v.onError(u)}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}},BB=class extends Js{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new Ql(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(c){i?i(c):console.error(c),r.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=l0.parse(e[n]);t.push(i)}return t}},VB=class extends Js{constructor(e){super(e)}load(e,t,n,i){const r=this,s=[],a=new mw,c=new Ql(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(r.withCredentials);let u=0;function d(p){c.load(e[p],function(g){const v=r.parse(g,!0);s[p]={width:v.width,height:v.height,format:v.format,mipmaps:v.mipmaps},u+=1,u===6&&(v.mipmapCount===1&&(a.minFilter=Er),a.image=s,a.format=v.format,a.needsUpdate=!0,t&&t(a))},n,i)}if(Array.isArray(e))for(let p=0,g=e.length;p<g;++p)d(p);else c.load(e,function(p){const g=r.parse(p,!0);if(g.isCubemap){const v=g.mipmaps.length/g.mipmapCount;for(let y=0;y<v;y++){s[y]={mipmaps:[]};for(let S=0;S<g.mipmapCount;S++)s[y].mipmaps.push(g.mipmaps[y*g.mipmapCount+S]),s[y].format=g.format,s[y].width=g.width,s[y].height=g.height}a.image=s}else a.image.width=g.width,a.image.height=g.height,a.mipmaps=g.mipmaps;g.mipmapCount===1&&(a.minFilter=Er),a.format=g.format,a.needsUpdate=!0,t&&t(a)},n,i);return a}},c0=class extends Js{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,s=pf.get(e);if(s!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(s),r.manager.itemEnd(e)},0),s;const a=e0("img");function c(){d(),pf.add(e,this),t&&t(this),r.manager.itemEnd(e)}function u(p){d(),i&&i(p),r.manager.itemError(e),r.manager.itemEnd(e)}function d(){a.removeEventListener("load",c,!1),a.removeEventListener("error",u,!1)}return a.addEventListener("load",c,!1),a.addEventListener("error",u,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}},FB=class extends Js{constructor(e){super(e)}load(e,t,n,i){const r=new x0;r.colorSpace=Mr;const s=new c0(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let a=0;function c(u){s.load(e[u],function(d){r.images[u]=d,a++,a===6&&(r.needsUpdate=!0,t&&t(r))},void 0,i)}for(let u=0;u<e.length;++u)c(u);return r}},kB=class extends Js{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new Hp,a=new Ql(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(r.withCredentials),a.load(e,function(c){const u=r.parse(c);u&&(u.image!==void 0?s.image=u.image:u.data!==void 0&&(s.image.width=u.width,s.image.height=u.height,s.image.data=u.data),s.wrapS=u.wrapS!==void 0?u.wrapS:yo,s.wrapT=u.wrapT!==void 0?u.wrapT:yo,s.magFilter=u.magFilter!==void 0?u.magFilter:Er,s.minFilter=u.minFilter!==void 0?u.minFilter:Er,s.anisotropy=u.anisotropy!==void 0?u.anisotropy:1,u.colorSpace!==void 0?s.colorSpace=u.colorSpace:u.encoding!==void 0&&(s.encoding=u.encoding),u.flipY!==void 0&&(s.flipY=u.flipY),u.format!==void 0&&(s.format=u.format),u.type!==void 0&&(s.type=u.type),u.mipmaps!==void 0&&(s.mipmaps=u.mipmaps,s.minFilter=sm),u.mipmapCount===1&&(s.minFilter=Er),u.generateMipmaps!==void 0&&(s.generateMipmaps=u.generateMipmaps),s.needsUpdate=!0,t&&t(s,u))},n,i),s}},GB=class extends Js{constructor(e){super(e)}load(e,t,n,i){const r=new Cr,s=new c0(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(e,function(a){r.image=a,r.needsUpdate=!0,t!==void 0&&t(r)},n,i),r}},Cu=class extends Wn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Tt(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()),t}},$L=class extends Cu{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Wn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Tt(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}},a2=new un,MT=new ae,wT=new ae,Fw=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new pt(512,512),this.map=null,this.mapPass=null,this.matrix=new un,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new zx,this._frameExtents=new pt(1,1),this._viewportCount=1,this._viewports=[new $n(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;MT.setFromMatrixPosition(e.matrixWorld),t.position.copy(MT),wT.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(wT),t.updateMatrixWorld(),a2.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(a2),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(a2)}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.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.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}},HB=class extends Fw{constructor(){super(new wr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=Kp*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(n!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},ZL=class extends Cu{constructor(e,t,n=0,i=Math.PI/3,r=0,s=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Wn.DEFAULT_UP),this.updateMatrix(),this.target=new Wn,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new HB}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}},AT=new un,b1=new ae,l2=new ae,WB=class extends Fw{constructor(){super(new wr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new pt(4,2),this._viewportCount=6,this._viewports=[new $n(2,1,1,1),new $n(0,1,1,1),new $n(3,1,1,1),new $n(1,1,1,1),new $n(3,0,1,1),new $n(1,0,1,1)],this._cubeDirections=[new ae(1,0,0),new ae(-1,0,0),new ae(0,0,1),new ae(0,0,-1),new ae(0,1,0),new ae(0,-1,0)],this._cubeUps=[new ae(0,1,0),new ae(0,1,0),new ae(0,1,0),new ae(0,1,0),new ae(0,0,1),new ae(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),b1.setFromMatrixPosition(e.matrixWorld),n.position.copy(b1),l2.copy(n.position),l2.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(l2),n.updateMatrixWorld(),i.makeTranslation(-b1.x,-b1.y,-b1.z),AT.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(AT)}},KL=class extends Cu{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new WB}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}},XB=class extends Fw{constructor(){super(new Bx(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},QL=class extends Cu{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Wn.DEFAULT_UP),this.updateMatrix(),this.target=new Wn,this.shadow=new XB}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},JL=class extends Cu{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}},eP=class extends Cu{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}},tP=class{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new ae)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,r=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.282095),t.addScaledVector(s[1],.488603*i),t.addScaledVector(s[2],.488603*r),t.addScaledVector(s[3],.488603*n),t.addScaledVector(s[4],1.092548*(n*i)),t.addScaledVector(s[5],1.092548*(i*r)),t.addScaledVector(s[6],.315392*(3*r*r-1)),t.addScaledVector(s[7],1.092548*(n*r)),t.addScaledVector(s[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,r=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.886227),t.addScaledVector(s[1],2*.511664*i),t.addScaledVector(s[2],2*.511664*r),t.addScaledVector(s[3],2*.511664*n),t.addScaledVector(s[4],2*.429043*n*i),t.addScaledVector(s[5],2*.429043*i*r),t.addScaledVector(s[6],.743125*r*r-.247708),t.addScaledVector(s[7],2*.429043*n*r),t.addScaledVector(s[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}},Yx=class extends Cu{constructor(e=new tP,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}},nP=class iP extends Js{constructor(t){super(t),this.textures={}}load(t,n,i,r){const s=this,a=new Ql(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(t,function(c){try{n(s.parse(JSON.parse(c)))}catch(u){r?r(u):console.error(u),s.manager.itemError(t)}},i,r)}parse(t){const n=this.textures;function i(s){return n[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),n[s]}const r=iP.createMaterialFromType(t.type);if(t.uuid!==void 0&&(r.uuid=t.uuid),t.name!==void 0&&(r.name=t.name),t.color!==void 0&&r.color!==void 0&&r.color.setHex(t.color),t.roughness!==void 0&&(r.roughness=t.roughness),t.metalness!==void 0&&(r.metalness=t.metalness),t.sheen!==void 0&&(r.sheen=t.sheen),t.sheenColor!==void 0&&(r.sheenColor=new Tt().setHex(t.sheenColor)),t.sheenRoughness!==void 0&&(r.sheenRoughness=t.sheenRoughness),t.emissive!==void 0&&r.emissive!==void 0&&r.emissive.setHex(t.emissive),t.specular!==void 0&&r.specular!==void 0&&r.specular.setHex(t.specular),t.specularIntensity!==void 0&&(r.specularIntensity=t.specularIntensity),t.specularColor!==void 0&&r.specularColor!==void 0&&r.specularColor.setHex(t.specularColor),t.shininess!==void 0&&(r.shininess=t.shininess),t.clearcoat!==void 0&&(r.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=t.clearcoatRoughness),t.iridescence!==void 0&&(r.iridescence=t.iridescence),t.iridescenceIOR!==void 0&&(r.iridescenceIOR=t.iridescenceIOR),t.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=t.iridescenceThicknessRange),t.transmission!==void 0&&(r.transmission=t.transmission),t.thickness!==void 0&&(r.thickness=t.thickness),t.attenuationDistance!==void 0&&(r.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&r.attenuationColor!==void 0&&r.attenuationColor.setHex(t.attenuationColor),t.anisotropy!==void 0&&(r.anisotropy=t.anisotropy),t.anisotropyRotation!==void 0&&(r.anisotropyRotation=t.anisotropyRotation),t.fog!==void 0&&(r.fog=t.fog),t.flatShading!==void 0&&(r.flatShading=t.flatShading),t.blending!==void 0&&(r.blending=t.blending),t.combine!==void 0&&(r.combine=t.combine),t.side!==void 0&&(r.side=t.side),t.shadowSide!==void 0&&(r.shadowSide=t.shadowSide),t.opacity!==void 0&&(r.opacity=t.opacity),t.transparent!==void 0&&(r.transparent=t.transparent),t.alphaTest!==void 0&&(r.alphaTest=t.alphaTest),t.depthTest!==void 0&&(r.depthTest=t.depthTest),t.depthWrite!==void 0&&(r.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(r.colorWrite=t.colorWrite),t.stencilWrite!==void 0&&(r.stencilWrite=t.stencilWrite),t.stencilWriteMask!==void 0&&(r.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(r.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(r.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(r.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(r.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(r.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(r.stencilZPass=t.stencilZPass),t.wireframe!==void 0&&(r.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(r.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(r.rotation=t.rotation),t.linewidth!==1&&(r.linewidth=t.linewidth),t.dashSize!==void 0&&(r.dashSize=t.dashSize),t.gapSize!==void 0&&(r.gapSize=t.gapSize),t.scale!==void 0&&(r.scale=t.scale),t.polygonOffset!==void 0&&(r.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=t.polygonOffsetUnits),t.dithering!==void 0&&(r.dithering=t.dithering),t.alphaToCoverage!==void 0&&(r.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(r.premultipliedAlpha=t.premultipliedAlpha),t.forceSinglePass!==void 0&&(r.forceSinglePass=t.forceSinglePass),t.visible!==void 0&&(r.visible=t.visible),t.toneMapped!==void 0&&(r.toneMapped=t.toneMapped),t.userData!==void 0&&(r.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?r.vertexColors=t.vertexColors>0:r.vertexColors=t.vertexColors),t.uniforms!==void 0)for(const s in t.uniforms){const a=t.uniforms[s];switch(r.uniforms[s]={},a.type){case"t":r.uniforms[s].value=i(a.value);break;case"c":r.uniforms[s].value=new Tt().setHex(a.value);break;case"v2":r.uniforms[s].value=new pt().fromArray(a.value);break;case"v3":r.uniforms[s].value=new ae().fromArray(a.value);break;case"v4":r.uniforms[s].value=new $n().fromArray(a.value);break;case"m3":r.uniforms[s].value=new _n().fromArray(a.value);break;case"m4":r.uniforms[s].value=new un().fromArray(a.value);break;default:r.uniforms[s].value=a.value}}if(t.defines!==void 0&&(r.defines=t.defines),t.vertexShader!==void 0&&(r.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(r.fragmentShader=t.fragmentShader),t.glslVersion!==void 0&&(r.glslVersion=t.glslVersion),t.extensions!==void 0)for(const s in t.extensions)r.extensions[s]=t.extensions[s];if(t.lights!==void 0&&(r.lights=t.lights),t.clipping!==void 0&&(r.clipping=t.clipping),t.size!==void 0&&(r.size=t.size),t.sizeAttenuation!==void 0&&(r.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(r.map=i(t.map)),t.matcap!==void 0&&(r.matcap=i(t.matcap)),t.alphaMap!==void 0&&(r.alphaMap=i(t.alphaMap)),t.bumpMap!==void 0&&(r.bumpMap=i(t.bumpMap)),t.bumpScale!==void 0&&(r.bumpScale=t.bumpScale),t.normalMap!==void 0&&(r.normalMap=i(t.normalMap)),t.normalMapType!==void 0&&(r.normalMapType=t.normalMapType),t.normalScale!==void 0){let s=t.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new pt().fromArray(s)}return t.displacementMap!==void 0&&(r.displacementMap=i(t.displacementMap)),t.displacementScale!==void 0&&(r.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(r.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(r.roughnessMap=i(t.roughnessMap)),t.metalnessMap!==void 0&&(r.metalnessMap=i(t.metalnessMap)),t.emissiveMap!==void 0&&(r.emissiveMap=i(t.emissiveMap)),t.emissiveIntensity!==void 0&&(r.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(r.specularMap=i(t.specularMap)),t.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(t.specularIntensityMap)),t.specularColorMap!==void 0&&(r.specularColorMap=i(t.specularColorMap)),t.envMap!==void 0&&(r.envMap=i(t.envMap)),t.envMapIntensity!==void 0&&(r.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(r.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(r.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(r.lightMap=i(t.lightMap)),t.lightMapIntensity!==void 0&&(r.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(r.aoMap=i(t.aoMap)),t.aoMapIntensity!==void 0&&(r.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(r.gradientMap=i(t.gradientMap)),t.clearcoatMap!==void 0&&(r.clearcoatMap=i(t.clearcoatMap)),t.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(t.clearcoatRoughnessMap)),t.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(t.clearcoatNormalMap)),t.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new pt().fromArray(t.clearcoatNormalScale)),t.iridescenceMap!==void 0&&(r.iridescenceMap=i(t.iridescenceMap)),t.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(t.iridescenceThicknessMap)),t.transmissionMap!==void 0&&(r.transmissionMap=i(t.transmissionMap)),t.thicknessMap!==void 0&&(r.thicknessMap=i(t.thicknessMap)),t.anisotropyMap!==void 0&&(r.anisotropyMap=i(t.anisotropyMap)),t.sheenColorMap!==void 0&&(r.sheenColorMap=i(t.sheenColorMap)),t.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(t.sheenRoughnessMap)),r}setTextures(t){return this.textures=t,this}static createMaterialFromType(t){return new{ShadowMaterial:DL,SpriteMaterial:fw,RawShaderMaterial:zL,ShaderMaterial:$a,PointsMaterial:pw,MeshPhysicalMaterial:UL,MeshStandardMaterial:Ow,MeshPhongMaterial:BL,MeshToonMaterial:VL,MeshNormalMaterial:FL,MeshLambertMaterial:kL,MeshDepthMaterial:uw,MeshDistanceMaterial:hw,MeshBasicMaterial:Tu,MeshMatcapMaterial:GL,LineDashedMaterial:HL,LineBasicMaterial:us,Material:Hr}[t]}},rM=class{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{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)}},rP=class extends vn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}},sP=class extends Js{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new Ql(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(c){i?i(c):console.error(c),r.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(g,v){if(t[v]!==void 0)return t[v];const y=g.interleavedBuffers[v],S=r(g,y.buffer),E=new Fx(zp(y.type,S),y.stride);return E.uuid=y.uuid,t[v]=E,E}function r(g,v){if(n[v]!==void 0)return n[v];const y=g.arrayBuffers[v],S=new Uint32Array(y).buffer;return n[v]=S,S}const s=e.isInstancedBufferGeometry?new rP:new vn,a=e.data.index;if(a!==void 0){const g=zp(a.type,a.array);s.setIndex(new Kn(g,1))}const c=e.data.attributes;for(const g in c){const v=c[g];let y;if(v.isInterleavedBufferAttribute)y=new t0(i(e.data,v.data),v.itemSize,v.offset,v.normalized);else{const S=zp(v.type,v.array);y=new(v.isInstancedBufferAttribute?Jp:Kn)(S,v.itemSize,v.normalized)}v.name!==void 0&&(y.name=v.name),v.usage!==void 0&&y.setUsage(v.usage),v.updateRange!==void 0&&(y.updateRange.offset=v.updateRange.offset,y.updateRange.count=v.updateRange.count),s.setAttribute(g,y)}const u=e.data.morphAttributes;if(u)for(const g in u){const v=u[g],y=[];for(let S=0,E=v.length;S<E;S++){const w=v[S];let b;w.isInterleavedBufferAttribute?b=new t0(i(e.data,w.data),w.itemSize,w.offset,w.normalized):b=new Kn(zp(w.type,w.array),w.itemSize,w.normalized),w.name!==void 0&&(b.name=w.name),y.push(b)}s.morphAttributes[g]=y}e.data.morphTargetsRelative&&(s.morphTargetsRelative=!0);const d=e.data.groups||e.data.drawcalls||e.data.offsets;if(d!==void 0)for(let g=0,v=d.length;g!==v;++g){const y=d[g];s.addGroup(y.start,y.count,y.materialIndex)}const p=e.data.boundingSphere;if(p!==void 0){const g=new ae;p.center!==void 0&&g.fromArray(p.center),s.boundingSphere=new fa(g,p.radius)}return e.name&&(s.name=e.name),e.userData&&(s.userData=e.userData),s}},jB=class extends Js{constructor(e){super(e)}load(e,t,n,i){const r=this,s=this.path===""?rM.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||s;const a=new Ql(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(c){let u=null;try{u=JSON.parse(c)}catch(p){i!==void 0&&i(p),console.error("THREE:ObjectLoader: Can't parse "+e+".",p.message);return}const d=u.metadata;if(d===void 0||d.type===void 0||d.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}r.parse(u,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?rM.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const r=new Ql(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);const s=await r.loadAsync(e,t),a=JSON.parse(s),c=a.metadata;if(c===void 0||c.type===void 0||c.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(a)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),s=this.parseImages(e.images,function(){t!==void 0&&t(u)}),a=this.parseTextures(e.textures,s),c=this.parseMaterials(e.materials,a),u=this.parseObject(e.object,r,c,a,n),d=this.parseSkeletons(e.skeletons,u);if(this.bindSkeletons(u,d),t!==void 0){let p=!1;for(const g in s)if(s[g].data instanceof HTMLImageElement){p=!0;break}p===!1&&t(u)}return u}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),r=await this.parseImagesAsync(e.images),s=this.parseTextures(e.textures,r),a=this.parseMaterials(e.materials,s),c=this.parseObject(e.object,i,a,s,t),u=this.parseSkeletons(e.skeletons,c);return this.bindSkeletons(c,u),c}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const r=new lf().fromJSON(e[n]);t[r.uuid]=r}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(r){r.isBone&&(i[r.uuid]=r)}),e!==void 0)for(let r=0,s=e.length;r<s;r++){const a=new nL().fromJSON(e[r],i);n[a.uuid]=a}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new sP;for(let r=0,s=e.length;r<s;r++){let a;const c=e[r];switch(c.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(c);break;default:c.type in bT?a=bT[c.type].fromJSON(c,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${c.type}"`)}a.uuid=c.uuid,c.name!==void 0&&(a.name=c.name),c.userData!==void 0&&(a.userData=c.userData),n[c.uuid]=a}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const r=new nP;r.setTextures(t);for(let s=0,a=e.length;s<a;s++){const c=e[s];n[c.uuid]===void 0&&(n[c.uuid]=r.parse(c)),i[c.uuid]=n[c.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],r=l0.parse(i);t[r.uuid]=r}return t}parseImages(e,t){const n=this,i={};let r;function s(c){return n.manager.itemStart(c),r.load(c,function(){n.manager.itemEnd(c)},void 0,function(){n.manager.itemError(c),n.manager.itemEnd(c)})}function a(c){if(typeof c=="string"){const u=c;return s(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(u)?u:n.resourcePath+u)}else return c.data?{data:zp(c.type,c.data),width:c.width,height:c.height}:null}if(e!==void 0&&e.length>0){r=new c0(new Vw(t)),r.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c<u;c++){const d=e[c],p=d.url;if(Array.isArray(p)){const g=[];for(let v=0,y=p.length;v<y;v++){const S=p[v],E=a(S);E!==null&&(E instanceof HTMLImageElement?g.push(E):g.push(new Hp(E.data,E.width,E.height)))}i[d.uuid]=new nf(g)}else{const g=a(d.url);i[d.uuid]=new nf(g)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function r(s){if(typeof s=="string"){const a=s,c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await i.loadAsync(c)}else return s.data?{data:zp(s.type,s.data),width:s.width,height:s.height}:null}if(e!==void 0&&e.length>0){i=new c0(this.manager),i.setCrossOrigin(this.crossOrigin);for(let s=0,a=e.length;s<a;s++){const c=e[s],u=c.url;if(Array.isArray(u)){const d=[];for(let p=0,g=u.length;p<g;p++){const v=u[p],y=await r(v);y!==null&&(y instanceof HTMLImageElement?d.push(y):d.push(new Hp(y.data,y.width,y.height)))}n[c.uuid]=new nf(d)}else{const d=await r(c.url);n[c.uuid]=new nf(d)}}}return n}parseTextures(e,t){function n(r,s){return typeof r=="number"?r:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",r),s[r])}const i={};if(e!==void 0)for(let r=0,s=e.length;r<s;r++){const a=e[r];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);const c=t[a.image],u=c.data;let d;Array.isArray(u)?(d=new x0,u.length===6&&(d.needsUpdate=!0)):(u&&u.data?d=new Hp:d=new Cr,u&&(d.needsUpdate=!0)),d.source=c,d.uuid=a.uuid,a.name!==void 0&&(d.name=a.name),a.mapping!==void 0&&(d.mapping=n(a.mapping,YB)),a.channel!==void 0&&(d.channel=a.channel),a.offset!==void 0&&d.offset.fromArray(a.offset),a.repeat!==void 0&&d.repeat.fromArray(a.repeat),a.center!==void 0&&d.center.fromArray(a.center),a.rotation!==void 0&&(d.rotation=a.rotation),a.wrap!==void 0&&(d.wrapS=n(a.wrap[0],ET),d.wrapT=n(a.wrap[1],ET)),a.format!==void 0&&(d.format=a.format),a.internalFormat!==void 0&&(d.internalFormat=a.internalFormat),a.type!==void 0&&(d.type=a.type),a.colorSpace!==void 0&&(d.colorSpace=a.colorSpace),a.encoding!==void 0&&(d.encoding=a.encoding),a.minFilter!==void 0&&(d.minFilter=n(a.minFilter,TT)),a.magFilter!==void 0&&(d.magFilter=n(a.magFilter,TT)),a.anisotropy!==void 0&&(d.anisotropy=a.anisotropy),a.flipY!==void 0&&(d.flipY=a.flipY),a.generateMipmaps!==void 0&&(d.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(d.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(d.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(d.compareFunction=a.compareFunction),a.userData!==void 0&&(d.userData=a.userData),i[a.uuid]=d}return i}parseObject(e,t,n,i,r){let s;function a(g){return t[g]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",g),t[g]}function c(g){if(g!==void 0){if(Array.isArray(g)){const v=[];for(let y=0,S=g.length;y<S;y++){const E=g[y];n[E]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",E),v.push(n[E])}return v}return n[g]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",g),n[g]}}function u(g){return i[g]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",g),i[g]}let d,p;switch(e.type){case"Scene":s=new ZR,e.background!==void 0&&(Number.isInteger(e.background)?s.background=new Tt(e.background):s.background=u(e.background)),e.environment!==void 0&&(s.environment=u(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?s.fog=new qR(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(s.fog=new jR(e.fog.color,e.fog.density))),e.backgroundBlurriness!==void 0&&(s.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(s.backgroundIntensity=e.backgroundIntensity);break;case"PerspectiveCamera":s=new wr(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(s.focus=e.focus),e.zoom!==void 0&&(s.zoom=e.zoom),e.filmGauge!==void 0&&(s.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(s.filmOffset=e.filmOffset),e.view!==void 0&&(s.view=Object.assign({},e.view));break;case"OrthographicCamera":s=new Bx(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(s.zoom=e.zoom),e.view!==void 0&&(s.view=Object.assign({},e.view));break;case"AmbientLight":s=new JL(e.color,e.intensity);break;case"DirectionalLight":s=new QL(e.color,e.intensity);break;case"PointLight":s=new KL(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":s=new eP(e.color,e.intensity,e.width,e.height);break;case"SpotLight":s=new ZL(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":s=new $L(e.color,e.groundColor,e.intensity);break;case"LightProbe":s=new Yx().fromJSON(e);break;case"SkinnedMesh":d=a(e.geometry),p=c(e.material),s=new tL(d,p),e.bindMode!==void 0&&(s.bindMode=e.bindMode),e.bindMatrix!==void 0&&s.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(s.skeleton=e.skeleton);break;case"Mesh":d=a(e.geometry),p=c(e.material),s=new Ar(d,p);break;case"InstancedMesh":d=a(e.geometry),p=c(e.material);const g=e.count,v=e.instanceMatrix,y=e.instanceColor;s=new rL(d,p,g),s.instanceMatrix=new Jp(new Float32Array(v.array),16),y!==void 0&&(s.instanceColor=new Jp(new Float32Array(y.array),y.itemSize));break;case"LOD":s=new eL;break;case"Line":s=new Mu(a(e.geometry),c(e.material));break;case"LineLoop":s=new sL(a(e.geometry),c(e.material));break;case"LineSegments":s=new Qa(a(e.geometry),c(e.material));break;case"PointCloud":case"Points":s=new oL(a(e.geometry),c(e.material));break;case"Sprite":s=new JR(c(e.material));break;case"Group":s=new Bp;break;case"Bone":s=new dw;break;default:s=new Wn}if(s.uuid=e.uuid,e.name!==void 0&&(s.name=e.name),e.matrix!==void 0?(s.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(s.matrixAutoUpdate=e.matrixAutoUpdate),s.matrixAutoUpdate&&s.matrix.decompose(s.position,s.quaternion,s.scale)):(e.position!==void 0&&s.position.fromArray(e.position),e.rotation!==void 0&&s.rotation.fromArray(e.rotation),e.quaternion!==void 0&&s.quaternion.fromArray(e.quaternion),e.scale!==void 0&&s.scale.fromArray(e.scale)),e.up!==void 0&&s.up.fromArray(e.up),e.castShadow!==void 0&&(s.castShadow=e.castShadow),e.receiveShadow!==void 0&&(s.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(s.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(s.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(s.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&s.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(s.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(s.visible=e.visible),e.frustumCulled!==void 0&&(s.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(s.renderOrder=e.renderOrder),e.userData!==void 0&&(s.userData=e.userData),e.layers!==void 0&&(s.layers.mask=e.layers),e.children!==void 0){const g=e.children;for(let v=0;v<g.length;v++)s.add(this.parseObject(g[v],t,n,i,r))}if(e.animations!==void 0){const g=e.animations;for(let v=0;v<g.length;v++){const y=g[v];s.animations.push(r[y])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(s.autoUpdate=e.autoUpdate);const g=e.levels;for(let v=0;v<g.length;v++){const y=g[v],S=s.getObjectByProperty("uuid",y.object);S!==void 0&&s.addLevel(S,y.distance,y.hysteresis)}}return s}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}},YB={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,CubeUVReflectionMapping:306},ET={RepeatWrapping:q1,ClampToEdgeWrapping:yo,MirroredRepeatWrapping:$1},TT={NearestFilter:as,NearestMipmapNearestFilter:qM,NearestMipmapLinearFilter:$M,LinearFilter:Er,LinearMipmapNearestFilter:ZM,LinearMipmapLinearFilter:sm},qB=class extends Js{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,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,s=pf.get(e);if(s!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(s),r.manager.itemEnd(e)},0),s;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(c){pf.add(e,c),t&&t(c),r.manager.itemEnd(e)}).catch(function(c){i&&i(c),r.manager.itemError(e),r.manager.itemEnd(e)}),r.manager.itemStart(e)}},My,kw=class{static getContext(){return My===void 0&&(My=new(window.AudioContext||window.webkitAudioContext)),My}static setContext(e){My=e}},$B=class extends Js{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new Ql(this.manager);s.setResponseType("arraybuffer"),s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(c){try{const u=c.slice(0);kw.getContext().decodeAudioData(u,function(d){t(d)},a)}catch(u){a(u)}},n,i);function a(c){i?i(c):console.error(c),r.manager.itemError(e)}}},ZB=class extends Yx{constructor(e,t,n=1){super(void 0,n),this.isHemisphereLightProbe=!0;const i=new Tt().set(e),r=new Tt().set(t),s=new ae(i.r,i.g,i.b),a=new ae(r.r,r.g,r.b),c=Math.sqrt(Math.PI),u=c*Math.sqrt(.75);this.sh.coefficients[0].copy(s).add(a).multiplyScalar(c),this.sh.coefficients[1].copy(s).sub(a).multiplyScalar(u)}},KB=class extends Yx{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const n=new Tt().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}},CT=new un,RT=new un,kh=new un,QB=class{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new wr,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new wr,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,kh.copy(e.projectionMatrix);const n=t.eyeSep/2,i=n*t.near/t.focus,r=t.near*Math.tan(af*t.fov*.5)/t.zoom;let s,a;RT.elements[12]=-n,CT.elements[12]=n,s=-r*t.aspect+i,a=r*t.aspect+i,kh.elements[0]=2*t.near/(a-s),kh.elements[8]=(a+s)/(a-s),this.cameraL.projectionMatrix.copy(kh),s=-r*t.aspect-i,a=r*t.aspect-i,kh.elements[0]=2*t.near/(a-s),kh.elements[8]=(a+s)/(a-s),this.cameraR.projectionMatrix.copy(kh)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(RT),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(CT)}},oP=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=LT(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=LT();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function LT(){return(typeof performance>"u"?Date:performance).now()}var Gh=new ae,PT=new Es,JB=new ae,Hh=new ae,e8=class extends Wn{constructor(){super(),this.type="AudioListener",this.context=kw.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new oP}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Gh,PT,JB),Hh.set(0,0,-1).applyQuaternion(PT),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Gh.x,i),t.positionY.linearRampToValueAtTime(Gh.y,i),t.positionZ.linearRampToValueAtTime(Gh.z,i),t.forwardX.linearRampToValueAtTime(Hh.x,i),t.forwardY.linearRampToValueAtTime(Hh.y,i),t.forwardZ.linearRampToValueAtTime(Hh.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(Gh.x,Gh.y,Gh.z),t.setOrientation(Hh.x,Hh.y,Hh.z,n.x,n.y,n.z)}},aP=class extends Wn{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}},Wh=new ae,NT=new Es,t8=new ae,Xh=new ae,n8=class extends aP{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Wh,NT,t8),Xh.set(0,0,1).applyQuaternion(NT);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Wh.x,n),t.positionY.linearRampToValueAtTime(Wh.y,n),t.positionZ.linearRampToValueAtTime(Wh.z,n),t.orientationX.linearRampToValueAtTime(Xh.x,n),t.orientationY.linearRampToValueAtTime(Xh.y,n),t.orientationZ.linearRampToValueAtTime(Xh.z,n)}else t.setPosition(Wh.x,Wh.y,Wh.z),t.setOrientation(Xh.x,Xh.y,Xh.z)}},i8=class{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}},lP=class{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,r,s;switch(t){case"quaternion":i=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,r=e*i+i;let s=this.cumulativeWeight;if(s===0){for(let a=0;a!==i;++a)n[r+a]=n[a];s=t}else{s+=t;const a=t/s;this._mixBufferRegion(n,r,0,a,i)}this.cumulativeWeight=s}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const c=t*this._origIndex;this._mixBufferRegion(n,i,c,1-r,t)}s>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let c=t,u=t+t;c!==u;++c)if(n[c]!==n[c+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,s=i;r!==s;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=.5)for(let s=0;s!==r;++s)e[t+s]=e[n+s]}_slerp(e,t,n,i){Es.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const s=this._workIndex*r;Es.multiplyQuaternionsFlat(e,s,e,t,e,n),Es.slerpFlat(e,t,e,t,e,s,i)}_lerp(e,t,n,i,r){const s=1-i;for(let a=0;a!==r;++a){const c=t+a;e[c]=e[c]*s+e[n+a]*i}}_lerpAdditive(e,t,n,i,r){for(let s=0;s!==r;++s){const a=t+s;e[a]=e[a]+e[n+s]*i}}},Gw="\\[\\]\\.:\\/",r8=new RegExp("["+Gw+"]","g"),Hw="[^"+Gw+"]",s8="[^"+Gw.replace("\\.","")+"]",o8=/((?:WC+[\/:])*)/.source.replace("WC",Hw),a8=/(WCOD+)?/.source.replace("WCOD",s8),l8=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Hw),c8=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Hw),u8=new RegExp("^"+o8+a8+l8+c8+"$"),h8=["material","materials","bones","map"],f8=class{constructor(e,t,n){const i=n||qn.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},qn=class Op{constructor(t,n,i){this.path=n,this.parsedPath=i||Op.parseTrackName(n),this.node=Op.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,n,i){return t&&t.isAnimationObjectGroup?new Op.Composite(t,n,i):new Op(t,n,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(r8,"")}static parseTrackName(t){const n=u8.exec(t);if(n===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);h8.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: "+t);return i}static findNode(t,n){if(n===void 0||n===""||n==="."||n===-1||n===t.name||n===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(n);if(i!==void 0)return i}if(t.children){const i=function(s){for(let a=0;a<s.length;a++){const c=s[a];if(c.name===n||c.uuid===n)return c;const u=i(c.children);if(u)return u}return null},r=i(t.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,n){t[n]=this.targetObject[this.propertyName]}_getValue_array(t,n){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)t[n++]=i[r]}_getValue_arrayElement(t,n){t[n]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,n){this.resolvedProperty.toArray(t,n)}_setValue_direct(t,n){this.targetObject[this.propertyName]=t[n]}_setValue_direct_setNeedsUpdate(t,n){this.targetObject[this.propertyName]=t[n],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,n){this.targetObject[this.propertyName]=t[n],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,n){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=t[n++]}_setValue_array_setNeedsUpdate(t,n){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=t[n++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,n){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=t[n++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,n){this.resolvedProperty[this.propertyIndex]=t[n]}_setValue_arrayElement_setNeedsUpdate(t,n){this.resolvedProperty[this.propertyIndex]=t[n],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,n){this.resolvedProperty[this.propertyIndex]=t[n],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,n){this.resolvedProperty.fromArray(t,n)}_setValue_fromArray_setNeedsUpdate(t,n){this.resolvedProperty.fromArray(t,n),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,n){this.resolvedProperty.fromArray(t,n),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,n){this.bind(),this.getValue(t,n)}_setValue_unbound(t,n){this.bind(),this.setValue(t,n)}bind(){let t=this.node;const n=this.parsedPath,i=n.objectName,r=n.propertyName;let s=n.propertyIndex;if(t||(t=Op.findNode(this.rootNode,n.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(i){let d=n.objectIndex;switch(i){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let p=0;p<t.length;p++)if(t[p].name===d){d=p;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[i]}if(d!==void 0){if(t[d]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[d]}}const a=t[r];if(a===void 0){const d=n.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+d+"."+r+" but it wasn't found.",t);return}let c=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?c=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(c=this.Versioning.MatrixWorldNeedsUpdate);let u=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[s]!==void 0&&(s=t.morphTargetDictionary[s])}u=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(u=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][c]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};qn.Composite=f8;qn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};qn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};qn.prototype.GetterByBindingType=[qn.prototype._getValue_direct,qn.prototype._getValue_array,qn.prototype._getValue_arrayElement,qn.prototype._getValue_toArray];qn.prototype.SetterByBindingTypeAndVersioning=[[qn.prototype._setValue_direct,qn.prototype._setValue_direct_setNeedsUpdate,qn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[qn.prototype._setValue_array,qn.prototype._setValue_array_setNeedsUpdate,qn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[qn.prototype._setValue_arrayElement,qn.prototype._setValue_arrayElement_setNeedsUpdate,qn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[qn.prototype._setValue_fromArray,qn.prototype._setValue_fromArray_setNeedsUpdate,qn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var d8=class{constructor(){this.isAnimationObjectGroup=!0,this.uuid=qs(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,s=r.length;let a,c=e.length,u=this.nCachedObjects_;for(let d=0,p=arguments.length;d!==p;++d){const g=arguments[d],v=g.uuid;let y=t[v];if(y===void 0){y=c++,t[v]=y,e.push(g);for(let S=0,E=s;S!==E;++S)r[S].push(new qn(g,n[S],i[S]))}else if(y<u){a=e[y];const S=--u,E=e[S];t[E.uuid]=y,e[y]=E,t[v]=S,e[S]=g;for(let w=0,b=s;w!==b;++w){const T=r[w],L=T[S];let C=T[y];T[y]=L,C===void 0&&(C=new qn(g,n[w],i[w])),T[S]=C}}else e[y]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=u}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let s=0,a=arguments.length;s!==a;++s){const c=arguments[s],u=c.uuid,d=t[u];if(d!==void 0&&d>=r){const p=r++,g=e[p];t[g.uuid]=d,e[d]=g,t[u]=p,e[p]=c;for(let v=0,y=i;v!==y;++v){const S=n[v],E=S[p],w=S[d];S[d]=E,S[p]=w}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=e.length;for(let a=0,c=arguments.length;a!==c;++a){const u=arguments[a].uuid,d=t[u];if(d!==void 0)if(delete t[u],d<r){const p=--r,g=e[p],v=--s,y=e[v];t[g.uuid]=d,e[d]=g,t[y.uuid]=p,e[p]=y,e.pop();for(let S=0,E=i;S!==E;++S){const w=n[S],b=w[p],T=w[v];w[d]=b,w[p]=T,w.pop()}}else{const p=--s,g=e[p];p>0&&(t[g.uuid]=d),e[d]=g,e.pop();for(let v=0,y=i;v!==y;++v){const S=n[v];S[d]=S[p],S.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(i!==void 0)return r[i];const s=this._paths,a=this._parsedPaths,c=this._objects,u=c.length,d=this.nCachedObjects_,p=new Array(u);i=r.length,n[e]=i,s.push(e),a.push(t),r.push(p);for(let g=d,v=c.length;g!==v;++g){const y=c[g];p[g]=new qn(y,e,t)}return p}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,r=this._parsedPaths,s=this._bindings,a=s.length-1,c=s[a],u=e[a];t[u]=n,s[n]=c,s.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}},cP=class{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,s=r.length,a=new Array(s),c={endingStart:ef,endingEnd:ef};for(let u=0;u!==s;++u){const d=r[u].createInterpolant(null);a[u]=d,d.settings=c}this._interpolantSettings=c,this._interpolants=a,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=gR,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,r=e._clip.duration,s=r/i,a=i/r;e.warp(1,s,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,r=i.time,s=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const c=a.parameterPositions,u=a.sampleValues;return c[0]=r,c[1]=r+n,u[0]=e/s,u[1]=t/s,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const r=this._startTime;if(r!==null){const c=(e-r)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);const s=this._updateTime(t),a=this._updateWeight(e);if(a>0){const c=this._interpolants,u=this._propertyBindings;switch(this.blendMode){case JM:for(let d=0,p=c.length;d!==p;++d)c[d].evaluate(s),u[d].accumulateAdditive(a);break;case Px:default:for(let d=0,p=c.length;d!==p;++d)c[d].evaluate(s),u[d].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const s=n===_R;if(e===0)return r===-1?i:s&&(r&1)===1?t-i:i;if(n===2200){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,s)):this._setEndings(this.repetitions===0,!0,s)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,r+=Math.abs(a);const c=this.repetitions-r;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const u=e<0;this._setEndings(u,!u,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(s&&(r&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=tf,i.endingEnd=tf):(e?i.endingStart=this.zeroSlopeAtStart?tf:ef:i.endingStart=J1,t?i.endingEnd=this.zeroSlopeAtEnd?tf:ef:i.endingEnd=J1)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;s===null&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const a=s.parameterPositions,c=s.sampleValues;return a[0]=r,c[0]=t,a[1]=r+e,c[1]=n,this}},p8=new Float32Array(1),m8=class extends ic{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,s=e._propertyBindings,a=e._interpolants,c=n.uuid,u=this._bindingsByRootAndName;let d=u[c];d===void 0&&(d={},u[c]=d);for(let p=0;p!==r;++p){const g=i[p],v=g.name;let y=d[v];if(y!==void 0)++y.referenceCount,s[p]=y;else{if(y=s[p],y!==void 0){y._cacheIndex===null&&(++y.referenceCount,this._addInactiveBinding(y,c,v));continue}const S=t&&t._propertyBindings[p].binding.parsedPath;y=new lP(qn.create(n,v,S),g.ValueTypeName,g.getValueSize()),++y.referenceCount,this._addInactiveBinding(y,c,v),s[p]=y}a[p].resultBuffer=y.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,r=this._actionsByClip;let s=r[t];if(s===void 0)s={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=s;else{const a=s.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),s.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const r=e._clip.uuid,s=this._actionsByClip,a=s[r],c=a.knownActions,u=c[c.length-1],d=e._byClipCacheIndex;u._byClipCacheIndex=d,c[d]=u,c.pop(),e._byClipCacheIndex=null;const p=a.actionByRoot,g=(e._localRoot||this._root).uuid;delete p[g],c.length===0&&delete s[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,r=this._bindings;let s=i[t];s===void 0&&(s={},i[t]=s),s[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,s=this._bindingsByRootAndName,a=s[i],c=t[t.length-1],u=e._cacheIndex;c._cacheIndex=u,t[u]=c,t.pop(),delete a[r],Object.keys(a).length===0&&delete s[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Uw(new Float32Array(2),new Float32Array(2),1,p8),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){const i=t||this._root,r=i.uuid;let s=typeof e=="string"?l0.findByName(i,e):e;const a=s!==null?s.uuid:e,c=this._actionsByClip[a];let u=null;if(n===void 0&&(s!==null?n=s.blendMode:n=Px),c!==void 0){const p=c.actionByRoot[r];if(p!==void 0&&p.blendMode===n)return p;u=c.knownActions[0],s===null&&(s=u._clip)}if(s===null)return null;const d=new cP(this,s,t,n);return this._bindAction(d,u),this._addInactiveAction(d,a,r),d}existingAction(e,t){const n=t||this._root,i=n.uuid,r=typeof e=="string"?l0.findByName(n,e):e,s=r?r.uuid:e,a=this._actionsByClip[s];return a!==void 0&&a.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),s=this._accuIndex^=1;for(let u=0;u!==n;++u)t[u]._update(i,e,r,s);const a=this._bindings,c=this._nActiveBindings;for(let u=0;u!==c;++u)a[u].apply(s);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(r!==void 0){const s=r.knownActions;for(let a=0,c=s.length;a!==c;++a){const u=s[a];this._deactivateAction(u);const d=u._cacheIndex,p=t[t.length-1];u._cacheIndex=null,u._byClipCacheIndex=null,p._cacheIndex=d,t[d]=p,t.pop(),this._removeInactiveBindingsForAction(u)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const r in n){const s=n[r].actionByRoot[t];s!==void 0&&(this._deactivateAction(s),this._removeInactiveAction(s))}const i=this._bindingsByRootAndName[t];if(i!==void 0)for(const r in i){const s=i[r];s.restoreOriginalState(),this._removeInactiveBinding(s)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}},g8=class uP{constructor(t){this.value=t}clone(){return new uP(this.value.clone===void 0?this.value:this.value.clone())}},_8=0,v8=class extends ic{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:_8++}),this.name="",this.usage=Nx,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++)this.uniforms.push(t[n].clone());return this}clone(){return new this.constructor().copy(this)}},y8=class extends Fx{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}},x8=class{constructor(e,t,n,i,r){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}},S8=class{constructor(e,t,n=0,i=1/0){this.ray=new om(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Ox,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)}intersectObject(e,t=!0,n=[]){return sM(e,this,n,t),n.sort(IT),n}intersectObjects(e,t=!0,n=[]){for(let i=0,r=e.length;i<r;i++)sM(e[i],this,n,t);return n.sort(IT),n}};function IT(e,t){return e.distance-t.distance}function sM(e,t,n,i){if(e.layers.test(t.layers)&&e.raycast(t,n),i===!0){const r=e.children;for(let s=0,a=r.length;s<a;s++)sM(r[s],t,n,!0)}}var b8=class{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){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,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Ti(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}},M8=class{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}},OT=new pt,w8=class{constructor(e=new pt(1/0,1/0),t=new pt(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=OT.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}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=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(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}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}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}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))}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)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,OT).distanceTo(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}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)}},DT=new ae,wy=new ae,A8=class{constructor(e=new ae,t=new ae){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){DT.subVectors(e,this.start),wy.subVectors(this.end,this.start);const n=wy.dot(wy);let i=wy.dot(DT)/n;return t&&(i=Ti(i,0,1)),i}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}},zT=new ae,E8=class extends Wn{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new vn,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let s=0,a=1,c=32;s<c;s++,a++){const u=s/c*Math.PI*2,d=a/c*Math.PI*2;i.push(Math.cos(u),Math.sin(u),1,Math.cos(d),Math.sin(d),1)}n.setAttribute("position",new Ot(i,3));const r=new us({fog:!1,toneMapped:!1});this.cone=new Qa(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),zT.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(zT),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},cu=new ae,Ay=new un,c2=new un,T8=class extends Qa{constructor(e){const t=hP(e),n=new vn,i=[],r=[],s=new Tt(0,0,1),a=new Tt(0,1,0);for(let u=0;u<t.length;u++){const d=t[u];d.parent&&d.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(s.r,s.g,s.b),r.push(a.r,a.g,a.b))}n.setAttribute("position",new Ot(i,3)),n.setAttribute("color",new Ot(r,3));const c=new us({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,c),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");c2.copy(this.root.matrixWorld).invert();for(let r=0,s=0;r<t.length;r++){const a=t[r];a.parent&&a.parent.isBone&&(Ay.multiplyMatrices(c2,a.matrixWorld),cu.setFromMatrixPosition(Ay),i.setXYZ(s,cu.x,cu.y,cu.z),Ay.multiplyMatrices(c2,a.parent.matrixWorld),cu.setFromMatrixPosition(Ay),i.setXYZ(s+1,cu.x,cu.y,cu.z),s+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}};function hP(e){const t=[];e.isBone===!0&&t.push(e);for(let n=0;n<e.children.length;n++)t.push.apply(t,hP(e.children[n]));return t}var C8=class extends Ar{constructor(e,t,n){const i=new jx(t,4,2),r=new Tu({wireframe:!0,fog:!1,toneMapped:!1});super(i,r),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}},R8=new ae,UT=new Tt,BT=new Tt,L8=class extends Wn{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new Xx(t);i.rotateY(Math.PI*.5),this.material=new Tu({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),s=new Float32Array(r.count*3);i.setAttribute("color",new Kn(s,3)),this.add(new Ar(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");UT.copy(this.light.color),BT.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const r=n<i/2?UT:BT;t.setXYZ(n,r.r,r.g,r.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(R8.setFromMatrixPosition(this.light.matrixWorld).negate())}},P8=class extends Qa{constructor(e=10,t=10,n=4473924,i=8947848){n=new Tt(n),i=new Tt(i);const r=t/2,s=e/t,a=e/2,c=[],u=[];for(let g=0,v=0,y=-a;g<=t;g++,y+=s){c.push(-a,0,y,a,0,y),c.push(y,0,-a,y,0,a);const S=g===r?n:i;S.toArray(u,v),v+=3,S.toArray(u,v),v+=3,S.toArray(u,v),v+=3,S.toArray(u,v),v+=3}const d=new vn;d.setAttribute("position",new Ot(c,3)),d.setAttribute("color",new Ot(u,3));const p=new us({vertexColors:!0,toneMapped:!1});super(d,p),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}},N8=class extends Qa{constructor(e=10,t=16,n=8,i=64,r=4473924,s=8947848){r=new Tt(r),s=new Tt(s);const a=[],c=[];if(t>1)for(let p=0;p<t;p++){const g=p/t*(Math.PI*2),v=Math.sin(g)*e,y=Math.cos(g)*e;a.push(0,0,0),a.push(v,0,y);const S=p&1?r:s;c.push(S.r,S.g,S.b),c.push(S.r,S.g,S.b)}for(let p=0;p<n;p++){const g=p&1?r:s,v=e-e/n*p;for(let y=0;y<i;y++){let S=y/i*(Math.PI*2),E=Math.sin(S)*v,w=Math.cos(S)*v;a.push(E,0,w),c.push(g.r,g.g,g.b),S=(y+1)/i*(Math.PI*2),E=Math.sin(S)*v,w=Math.cos(S)*v,a.push(E,0,w),c.push(g.r,g.g,g.b)}}const u=new vn;u.setAttribute("position",new Ot(a,3)),u.setAttribute("color",new Ot(c,3));const d=new us({vertexColors:!0,toneMapped:!1});super(u,d),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}},VT=new ae,Ey=new ae,FT=new ae,I8=class extends Wn{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let i=new vn;i.setAttribute("position",new Ot([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const r=new us({fog:!1,toneMapped:!1});this.lightPlane=new Mu(i,r),this.add(this.lightPlane),i=new vn,i.setAttribute("position",new Ot([0,0,0,0,0,1],3)),this.targetLine=new Mu(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),VT.setFromMatrixPosition(this.light.matrixWorld),Ey.setFromMatrixPosition(this.light.target.matrixWorld),FT.subVectors(Ey,VT),this.lightPlane.lookAt(Ey),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Ey),this.targetLine.scale.z=FT.length()}},Ty=new ae,Ei=new Dx,O8=class extends Qa{constructor(e){const t=new vn,n=new us({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],s={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(y,S){c(y),c(S)}function c(y){i.push(0,0,0),r.push(0,0,0),s[y]===void 0&&(s[y]=[]),s[y].push(i.length/3-1)}t.setAttribute("position",new Ot(i,3)),t.setAttribute("color",new Ot(r,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update();const u=new Tt(16755200),d=new Tt(16711680),p=new Tt(43775),g=new Tt(16777215),v=new Tt(3355443);this.setColors(u,d,p,g,v)}setColors(e,t,n,i,r){const s=this.geometry.getAttribute("color");s.setXYZ(0,e.r,e.g,e.b),s.setXYZ(1,e.r,e.g,e.b),s.setXYZ(2,e.r,e.g,e.b),s.setXYZ(3,e.r,e.g,e.b),s.setXYZ(4,e.r,e.g,e.b),s.setXYZ(5,e.r,e.g,e.b),s.setXYZ(6,e.r,e.g,e.b),s.setXYZ(7,e.r,e.g,e.b),s.setXYZ(8,e.r,e.g,e.b),s.setXYZ(9,e.r,e.g,e.b),s.setXYZ(10,e.r,e.g,e.b),s.setXYZ(11,e.r,e.g,e.b),s.setXYZ(12,e.r,e.g,e.b),s.setXYZ(13,e.r,e.g,e.b),s.setXYZ(14,e.r,e.g,e.b),s.setXYZ(15,e.r,e.g,e.b),s.setXYZ(16,e.r,e.g,e.b),s.setXYZ(17,e.r,e.g,e.b),s.setXYZ(18,e.r,e.g,e.b),s.setXYZ(19,e.r,e.g,e.b),s.setXYZ(20,e.r,e.g,e.b),s.setXYZ(21,e.r,e.g,e.b),s.setXYZ(22,e.r,e.g,e.b),s.setXYZ(23,e.r,e.g,e.b),s.setXYZ(24,t.r,t.g,t.b),s.setXYZ(25,t.r,t.g,t.b),s.setXYZ(26,t.r,t.g,t.b),s.setXYZ(27,t.r,t.g,t.b),s.setXYZ(28,t.r,t.g,t.b),s.setXYZ(29,t.r,t.g,t.b),s.setXYZ(30,t.r,t.g,t.b),s.setXYZ(31,t.r,t.g,t.b),s.setXYZ(32,n.r,n.g,n.b),s.setXYZ(33,n.r,n.g,n.b),s.setXYZ(34,n.r,n.g,n.b),s.setXYZ(35,n.r,n.g,n.b),s.setXYZ(36,n.r,n.g,n.b),s.setXYZ(37,n.r,n.g,n.b),s.setXYZ(38,i.r,i.g,i.b),s.setXYZ(39,i.r,i.g,i.b),s.setXYZ(40,r.r,r.g,r.b),s.setXYZ(41,r.r,r.g,r.b),s.setXYZ(42,r.r,r.g,r.b),s.setXYZ(43,r.r,r.g,r.b),s.setXYZ(44,r.r,r.g,r.b),s.setXYZ(45,r.r,r.g,r.b),s.setXYZ(46,r.r,r.g,r.b),s.setXYZ(47,r.r,r.g,r.b),s.setXYZ(48,r.r,r.g,r.b),s.setXYZ(49,r.r,r.g,r.b),s.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;Ei.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Ii("c",t,e,Ei,0,0,-1),Ii("t",t,e,Ei,0,0,1),Ii("n1",t,e,Ei,-n,-i,-1),Ii("n2",t,e,Ei,n,-i,-1),Ii("n3",t,e,Ei,-n,i,-1),Ii("n4",t,e,Ei,n,i,-1),Ii("f1",t,e,Ei,-n,-i,1),Ii("f2",t,e,Ei,n,-i,1),Ii("f3",t,e,Ei,-n,i,1),Ii("f4",t,e,Ei,n,i,1),Ii("u1",t,e,Ei,n*.7,i*1.1,-1),Ii("u2",t,e,Ei,-n*.7,i*1.1,-1),Ii("u3",t,e,Ei,0,i*2,-1),Ii("cf1",t,e,Ei,-n,0,1),Ii("cf2",t,e,Ei,n,0,1),Ii("cf3",t,e,Ei,0,-i,1),Ii("cf4",t,e,Ei,0,i,1),Ii("cn1",t,e,Ei,-n,0,-1),Ii("cn2",t,e,Ei,n,0,-1),Ii("cn3",t,e,Ei,0,-i,-1),Ii("cn4",t,e,Ei,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function Ii(e,t,n,i,r,s,a){Ty.set(r,s,a).unproject(i);const c=t[e];if(c!==void 0){const u=n.getAttribute("position");for(let d=0,p=c.length;d<p;d++)u.setXYZ(c[d],Ty.x,Ty.y,Ty.z)}}var Cy=new Ka,D8=class extends Qa{constructor(e,t=16776960){const n=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]),i=new Float32Array(24),r=new vn;r.setIndex(new Kn(n,1)),r.setAttribute("position",new Kn(i,3)),super(r,new us({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&Cy.setFromObject(this.object),Cy.isEmpty())return;const t=Cy.min,n=Cy.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=t.x,r[4]=n.y,r[5]=n.z,r[6]=t.x,r[7]=t.y,r[8]=n.z,r[9]=n.x,r[10]=t.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=t.z,r[15]=t.x,r[16]=n.y,r[17]=t.z,r[18]=t.x,r[19]=t.y,r[20]=t.z,r[21]=n.x,r[22]=t.y,r[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}},z8=class extends Qa{constructor(e,t=16776960){const n=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]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],r=new vn;r.setIndex(new Kn(n,1)),r.setAttribute("position",new Ot(i,3)),super(r,new us({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()}},U8=class extends Mu{constructor(e,t=1,n=16776960){const i=n,r=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],s=new vn;s.setAttribute("position",new Ot(r,3)),s.computeBoundingSphere(),super(s,new us({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],c=new vn;c.setAttribute("position",new Ot(a,3)),c.computeBoundingSphere(),this.add(new Ar(c,new Tu({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}},kT=new ae,Ry,u2,B8=class extends Wn{constructor(e=new ae(0,0,1),t=new ae(0,0,0),n=1,i=16776960,r=n*.2,s=r*.2){super(),this.type="ArrowHelper",Ry===void 0&&(Ry=new vn,Ry.setAttribute("position",new Ot([0,0,0,0,1,0],3)),u2=new S0(0,.5,1,5,1),u2.translate(0,-.5,0)),this.position.copy(t),this.line=new Mu(Ry,new us({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Ar(u2,new Tu({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,s)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{kT.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(kT,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}},V8=class extends Qa{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new vn;i.setAttribute("position",new Ot(t,3)),i.setAttribute("color",new Ot(n,3));const r=new us({vertexColors:!0,toneMapped:!1});super(i,r),this.type="AxesHelper"}setColors(e,t,n){const i=new Tt,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},F8=class{constructor(){this.type="ShapePath",this.color=new Tt,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new n0,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,s){return this.currentPath.bezierCurveTo(e,t,n,i,r,s),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(w){const b=[];for(let T=0,L=w.length;T<L;T++){const C=w[T],P=new lf;P.curves=C.curves,b.push(P)}return b}function n(w,b){const T=b.length;let L=!1;for(let C=T-1,P=0;P<T;C=P++){let O=b[C],B=b[P],U=B.x-O.x,I=B.y-O.y;if(Math.abs(I)>Number.EPSILON){if(I<0&&(O=b[P],U=-U,B=b[C],I=-I),w.y<O.y||w.y>B.y)continue;if(w.y===O.y){if(w.x===O.x)return!0}else{const z=I*(w.x-O.x)-U*(w.y-O.y);if(z===0)return!0;if(z<0)continue;L=!L}}else{if(w.y!==O.y)continue;if(B.x<=w.x&&w.x<=O.x||O.x<=w.x&&w.x<=B.x)return!0}}return L}const i=Su.isClockWise,r=this.subPaths;if(r.length===0)return[];let s,a,c;const u=[];if(r.length===1)return a=r[0],c=new lf,c.curves=a.curves,u.push(c),u;let d=!i(r[0].getPoints());d=e?!d:d;const p=[],g=[];let v=[],y=0,S;g[y]=void 0,v[y]=[];for(let w=0,b=r.length;w<b;w++)a=r[w],S=a.getPoints(),s=i(S),s=e?!s:s,s?(!d&&g[y]&&y++,g[y]={s:new lf,p:S},g[y].s.curves=a.curves,d&&y++,v[y]=[]):v[y].push({h:a,p:S[0]});if(!g[0])return t(r);if(g.length>1){let w=!1,b=0;for(let T=0,L=g.length;T<L;T++)p[T]=[];for(let T=0,L=g.length;T<L;T++){const C=v[T];for(let P=0;P<C.length;P++){const O=C[P];let B=!0;for(let U=0;U<g.length;U++)n(O.p,g[U].p)&&(T!==U&&b++,B?(B=!1,p[U].push(O)):w=!0);B&&p[T].push(O)}}b>0&&w===!1&&(v=p)}let E;for(let w=0,b=g.length;w<b;w++){c=g[w].s,u.push(c),E=v[w];for(let T=0,L=E.length;T<L;T++)c.holes.push(E[T].h)}return u}},k8=class extends am{constructor(e,t,n,i,r,s){console.warn("THREE.BoxBufferGeometry has been renamed to THREE.BoxGeometry."),super(e,t,n,i,r,s)}},G8=class extends bw{constructor(e,t,n,i){console.warn("THREE.CapsuleBufferGeometry has been renamed to THREE.CapsuleGeometry."),super(e,t,n,i)}},H8=class extends Mw{constructor(e,t,n,i){console.warn("THREE.CircleBufferGeometry has been renamed to THREE.CircleGeometry."),super(e,t,n,i)}},W8=class extends ww{constructor(e,t,n,i,r,s,a){console.warn("THREE.ConeBufferGeometry has been renamed to THREE.ConeGeometry."),super(e,t,n,i,r,s,a)}},X8=class extends S0{constructor(e,t,n,i,r,s,a,c){console.warn("THREE.CylinderBufferGeometry has been renamed to THREE.CylinderGeometry."),super(e,t,n,i,r,s,a,c)}},j8=class extends Aw{constructor(e,t){console.warn("THREE.DodecahedronBufferGeometry has been renamed to THREE.DodecahedronGeometry."),super(e,t)}},Y8=class extends Ew{constructor(e,t){console.warn("THREE.ExtrudeBufferGeometry has been renamed to THREE.ExtrudeGeometry."),super(e,t)}},q8=class extends Tw{constructor(e,t){console.warn("THREE.IcosahedronBufferGeometry has been renamed to THREE.IcosahedronGeometry."),super(e,t)}},$8=class extends Hx{constructor(e,t,n,i){console.warn("THREE.LatheBufferGeometry has been renamed to THREE.LatheGeometry."),super(e,t,n,i)}},Z8=class extends Xx{constructor(e,t){console.warn("THREE.OctahedronBufferGeometry has been renamed to THREE.OctahedronGeometry."),super(e,t)}},K8=class extends Ux{constructor(e,t,n,i){console.warn("THREE.PlaneBufferGeometry has been renamed to THREE.PlaneGeometry."),super(e,t,n,i)}},Q8=class extends xf{constructor(e,t,n,i){console.warn("THREE.PolyhedronBufferGeometry has been renamed to THREE.PolyhedronGeometry."),super(e,t,n,i)}},J8=class extends Cw{constructor(e,t,n,i,r,s){console.warn("THREE.RingBufferGeometry has been renamed to THREE.RingGeometry."),super(e,t,n,i,r,s)}},eV=class extends Rw{constructor(e,t){console.warn("THREE.ShapeBufferGeometry has been renamed to THREE.ShapeGeometry."),super(e,t)}},tV=class extends jx{constructor(e,t,n,i,r,s,a){console.warn("THREE.SphereBufferGeometry has been renamed to THREE.SphereGeometry."),super(e,t,n,i,r,s,a)}},nV=class extends Lw{constructor(e,t){console.warn("THREE.TetrahedronBufferGeometry has been renamed to THREE.TetrahedronGeometry."),super(e,t)}},iV=class extends Pw{constructor(e,t,n,i,r){console.warn("THREE.TorusBufferGeometry has been renamed to THREE.TorusGeometry."),super(e,t,n,i,r)}},rV=class extends Nw{constructor(e,t,n,i,r,s){console.warn("THREE.TorusKnotBufferGeometry has been renamed to THREE.TorusKnotGeometry."),super(e,t,n,i,r,s)}},sV=class extends Iw{constructor(e,t,n,i,r){console.warn("THREE.TubeBufferGeometry has been renamed to THREE.TubeGeometry."),super(e,t,n,i,r)}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"153"}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="153");var oV={89:(e=>{e.exports={parser:(function(){var t=function(se,Ze,Se,Ke){for(Se=Se||{},Ke=se.length;Ke--;Se[se[Ke]]=Ze);return Se},n=[1,60],i=[1,62],r=[1,63],s=[1,65],a=[1,66],c=[1,67],u=[1,68],d=[1,69],p=[1,80],g=[1,72],v=[1,73],y=[1,74],S=[1,75],E=[1,99],w=[1,76],b=[1,100],T=[1,79],L=[1,51],C=[1,81],P=[1,82],O=[1,84],B=[1,83],U=[1,85],I=[1,96],z=[1,97],te=[1,98],oe=[1,86],ee=[1,87],k=[1,64],X=[1,70],$=[1,71],j=[1,77],J=[1,78],xe=[1,53],de=[1,54],fe=[1,55],F=[1,61],re=[1,88],ue=[1,89],_e=[1,90],Le=[1,91],Fe=[1,92],Xe=[1,93],lt=[1,94],mt=[1,95],ne=[1,101],Be=[1,102],Ne=[1,103],ve=[1,104],ye=[1,105],et=[1,56],tt=[1,57],_t=[1,58],St=[1,59],Mt=[1,115],Bt=[1,111],Ft=[1,114],ie=[1,112],Z=[1,113],Ve=[1,118],ut=[1,117],gt=[1,134],dt=[1,149],G=[1,150],q=[1,157],Y=[5,6,7,9,13,14,15,17,18,19,20,23,25,26,27,30,33,34,35,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,72,74,77,78,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101],pe=[5,6,7,9,13,14,15,17,18,19,20,23,25,26,27,30,33,34,35,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,71,72,74,77,78,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101],Me=[5,6,7,9,13,15,17,18,19,20,23,25,26,27,30,33,34,37,38,41,43,45,46,49,52,54,55,56,58,59,62,64,65,66,70,72,82,83,84,85,86,87,88,89,90,91,92,93,94,95],De=[5,70,72],Ee=[5,74],je=[71,101],nt={trace:function(){},yy:{},symbols_:{error:2,Program:3,Command:4,EOF:5,RESET:6,BUILD:7,ALL:8,HELP:9,Path:10,MOTM:11,OneArgCommand:12,GET:13,STRING:14,SET:15,Value:16,SET_SAVE:17,SET_RESTORE:18,SET_RESET:19,PRESET:20,AddRepresentation:21,EditRepresentation:22,REMOVE:23,RepresentationReference:24,HIDE:25,SHOW:26,LIST:27,EXPAND_KEY:28,SELECTOR_KEY:29,SELECT:30,AS:31,WordAll:32,SELECTOR:33,WITHIN:34,NUMBER:35,OF:36,MATERIAL:37,IDENTIFIER:38,ModeCMD:39,ColorCMD:40,VIEW:41,BASE_64:42,UNIT:43,DSSP:44,SCALE:45,ROTATE:46,AxesList:47,TRANSLATE:48,CENTER:49,GetURLBranch:50,Screenshot:51,LINE:52,ArgList:53,LISTOBJ:54,REMOVEOBJ:55,URL:56,VIEW_KEY:57,SCREENSHOT:58,LOAD:59,Url:60,FILE_KEY:61,ADD:62,Description:63,REP:64,MODE:65,COLOR:66,Descriptor:67,RepresentationOwnProperty:68,RepresentationOwnPropertyOpts:69,DESC_KEY:70,"=":71,DESC_KEY_OPTS:72,AxesArg:73,DESC_KEY_AXES:74,Arg:75,PathWoDescKey:76,HEX:77,BOOL:78,Word:79,CommandSetWoDESC_KEY:80,DescKeys:81,CLEAR:82,FILE_LIST:83,FILE_REGISTER:84,FILE_DELETE:85,PRESET_ADD:86,PRESET_DELETE:87,PRESET_UPDATE:88,PRESET_RENAME:89,PRESET_OPEN:90,CREATE_SCENARIO:91,RESET_SCENARIO:92,DELETE_SCENARIO:93,ADD_SCENARIO_ITEM:94,LIST_SCENARIO:95,PDB_KEY:96,DELAY_KEY:97,PRST_KEY:98,DESCRIPTION_KEY:99,CommandSet:100,".":101,PresetPath:102,"/":103,HexOrNumber:104,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",6:"RESET",7:"BUILD",8:"ALL",9:"HELP",11:"MOTM",13:"GET",14:"STRING",15:"SET",17:"SET_SAVE",18:"SET_RESTORE",19:"SET_RESET",20:"PRESET",23:"REMOVE",25:"HIDE",26:"SHOW",27:"LIST",28:"EXPAND_KEY",29:"SELECTOR_KEY",30:"SELECT",31:"AS",33:"SELECTOR",34:"WITHIN",35:"NUMBER",36:"OF",37:"MATERIAL",38:"IDENTIFIER",41:"VIEW",42:"BASE_64",43:"UNIT",44:"DSSP",45:"SCALE",46:"ROTATE",48:"TRANSLATE",49:"CENTER",52:"LINE",54:"LISTOBJ",55:"REMOVEOBJ",56:"URL",57:"VIEW_KEY",58:"SCREENSHOT",59:"LOAD",61:"FILE_KEY",62:"ADD",64:"REP",65:"MODE",66:"COLOR",70:"DESC_KEY",71:"=",72:"DESC_KEY_OPTS",74:"DESC_KEY_AXES",77:"HEX",78:"BOOL",82:"CLEAR",83:"FILE_LIST",84:"FILE_REGISTER",85:"FILE_DELETE",86:"PRESET_ADD",87:"PRESET_DELETE",88:"PRESET_UPDATE",89:"PRESET_RENAME",90:"PRESET_OPEN",91:"CREATE_SCENARIO",92:"RESET_SCENARIO",93:"DELETE_SCENARIO",94:"ADD_SCENARIO_ITEM",95:"LIST_SCENARIO",96:"PDB_KEY",97:"DELAY_KEY",98:"PRST_KEY",99:"DESCRIPTION_KEY",101:".",103:"/"},productions_:[0,[3,2],[3,1],[4,1],[4,1],[4,2],[4,1],[4,2],[4,1],[4,1],[4,2],[4,2],[4,3],[4,3],[4,1],[4,1],[4,1],[4,1],[4,2],[4,1],[4,1],[4,2],[4,2],[4,2],[4,2],[4,1],[4,2],[4,2],[4,2],[4,4],[4,2],[4,6],[4,2],[4,1],[4,1],[4,1],[4,2],[4,2],[4,1],[4,2],[4,1],[4,2],[4,2],[4,2],[4,1],[4,2],[4,1],[4,1],[4,3],[4,3],[4,4],[4,4],[4,1],[4,2],[50,1],[50,2],[50,2],[50,3],[50,3],[51,1],[51,2],[51,3],[12,2],[12,2],[12,2],[21,1],[21,2],[21,2],[21,3],[22,2],[22,3],[39,2],[39,3],[40,2],[40,3],[24,1],[24,1],[63,1],[63,2],[63,3],[63,4],[67,1],[67,1],[67,2],[68,3],[69,3],[47,1],[47,2],[73,2],[53,1],[53,2],[75,3],[16,1],[16,1],[16,1],[16,1],[16,1],[79,1],[79,1],[32,1],[32,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[81,1],[81,1],[81,1],[81,1],[81,1],[81,1],[81,1],[100,1],[100,1],[76,1],[76,3],[76,3],[10,1],[10,1],[10,3],[10,3],[10,3],[60,1],[102,1],[102,3],[104,1],[104,1]],performAction:function(Ze,Se,Ke,le,At,be,Yt){var ke=be.length-1;switch(At){case 1:return be[ke-1];case 3:this.$=le.miew.reset(!1),le.ClearContext(),le.miew.resetReps("empty");break;case 4:this.$=le.miew.rebuild();break;case 5:this.$=le.miew.rebuildAll(),le.miew.rebuild();break;case 6:this.$=le.echo(le.utils.help().toString());break;case 7:this.$=le.echo(le.utils.help(be[ke]).toString());break;case 8:this.$=le.miew.motm();break;case 10:case 11:this.$=le.utils.propagateProp(be[ke]),le.echo(le.miew.get(be[ke]).toString());break;case 12:case 13:this.$=le.miew.set(be[ke-1],le.utils.propagateProp(be[ke-1],be[ke]));break;case 14:this.$=le.miew.saveSettings();break;case 15:this.$=le.miew.restoreSettings();break;case 16:this.$=le.miew.resetSettings();break;case 17:this.$=le.miew.resetReps();break;case 18:this.$=le.miew.applyPreset(be[ke]);break;case 21:this.$=le.miew.repRemove(be[ke]),le.representations.remove(be[ke]);break;case 22:this.$=le.miew.repHide(be[ke]);break;case 23:this.$=le.miew.repHide(be[ke],!1);break;case 24:this.$=le.echo(le.utils.listRep(le.miew,le.representations,be[ke],"-e"));break;case 25:this.$=le.echo(le.utils.list(le.miew,le.representations));break;case 26:this.$=le.echo(le.utils.list(le.miew,le.representations,be[ke]));break;case 27:this.$=le.echo(le.utils.listSelector(le.miew,le.Context));break;case 28:this.$=le.miew.select(le.utils.checkArg(be[ke-1].toLowerCase(),be[ke],!0));break;case 29:this.$=le.Context[be[ke].toLowerCase()]=le.utils.checkArg(be[ke-3].toLowerCase(),be[ke-2],!0),le.miew.select(le.Context[be[ke].toLowerCase()]);break;case 30:this.$=le.miew.rep(le.miew.repCurrent(),{selector:le.utils.checkArg(be[ke-1].toLowerCase(),be[ke])});break;case 31:this.$=le.Context[be[ke].toLowerCase()]=le.miew.within(le.utils.checkArg("select",be[ke-2],!0),Number(be[ke-4]));break;case 32:this.$=le.miew.rep(le.miew.repCurrent(),{material:le.utils.checkArg(be[ke-1].toLowerCase(),be[ke].toUpperCase())});break;case 35:this.$=le.echo(le.miew.view());break;case 36:case 37:this.$=le.miew.view(be[ke]);break;case 38:this.$=le.echo(le.miew.changeUnit());break;case 39:this.$=le.echo(le.miew.changeUnit(be[ke]));break;case 40:this.$=le.miew.dssp();break;case 41:this.$=le.miew.scale(be[ke]);break;case 42:for(var Nt=0,hn=be[ke].length;Nt<hn;Nt++)le.miew.rotate(be[ke][Nt].x*Math.PI/180,be[ke][Nt].y*Math.PI/180,be[ke][Nt].z*Math.PI/180);break;case 43:for(var Nt=0,hn=be[ke].length;Nt<hn;Nt++)le.miew.translate(be[ke][Nt].x||0,be[ke][Nt].y||0,be[ke][Nt].z||0);break;case 44:this.$=le.miew.center();break;case 45:this.$=le.miew.center(be[ke]);break;case 48:case 49:this.$=le.miew.addObject({type:"line",params:[be[ke-1],be[ke]]},!0);break;case 50:case 51:this.$=le.miew.addObject({type:"line",params:[be[ke-2],be[ke-1]],opts:be[ke].toJSO(le.utils,"objects","line")},!0);break;case 52:this.$=le.echo(le.utils.listObjs(le.miew));break;case 53:this.$=le.miew.removeObject(be[ke]);break;case 54:this.$=le.echo(le.miew.getURL({view:!1,settings:!1}));break;case 55:this.$=le.echo(le.miew.getURL({view:!1,settings:!0}));break;case 56:this.$=le.echo(le.miew.getURL({view:!0,settings:!1}));break;case 57:case 58:this.$=le.echo(le.miew.getURL({view:!0,settings:!0}));break;case 59:this.$=le.miew.screenshotSave();break;case 60:this.$=le.miew.screenshotSave("",Number(be[ke]));break;case 61:this.$=le.miew.screenshotSave("",Number(be[ke-1]),Number(be[ke]));break;case 62:case 63:case 64:this.$=le.utils.load(le.miew,be[ke]),le.representations.clear();break;case 65:this.$=le.echo(le.representations.add(le.miew.repAdd()));break;case 66:this.$=le.echo(le.representations.add(be[ke],le.miew.repAdd()));break;case 67:this.$=le.echo(le.representations.add(le.miew.repAdd(be[ke])));break;case 68:this.$=le.echo(le.representations.add(be[ke-1],le.miew.repAdd(be[ke])));break;case 69:this.$=le.miew.rep(be[ke]),le.miew.repCurrent(be[ke]);break;case 70:this.$=le.miew.rep(be[ke-1],be[ke]),le.miew.repCurrent(be[ke-1]);break;case 71:this.$=le.miew.rep(le.miew.repCurrent(),{mode:le.utils.checkArg(be[ke-1].toLowerCase(),be[ke].toUpperCase())});break;case 72:this.$=le.miew.rep(le.miew.repCurrent(),{mode:new Array(le.utils.checkArg(be[ke-2].toLowerCase(),be[ke-1].toUpperCase()),be[ke].toJSO(le.utils,be[ke-2],be[ke-1].toUpperCase()))});break;case 73:this.$=le.miew.rep(le.miew.repCurrent(),{colorer:le.utils.checkArg(be[ke-1].toLowerCase(),be[ke].toUpperCase())});break;case 74:this.$=le.miew.rep(le.miew.repCurrent(),{colorer:new Array(le.utils.checkArg(be[ke-2].toLowerCase(),be[ke-1].toUpperCase()),be[ke].toJSO(le.utils,be[ke-2],be[ke-1].toUpperCase()))});break;case 75:this.$=Number(le.representations.get(be[ke]));break;case 76:case 92:this.$=Number(be[ke]);break;case 77:this.$=be[ke];break;case 78:this.$=le._.assign(be[ke-1],be[ke]);break;case 79:this.$=le._.assign(be[ke-2],be[ke-1],be[ke]);break;case 80:this.$=le._.assign(be[ke-3],be[ke-2],be[ke-1],be[ke]);break;case 81:case 82:this.$=le.CreateObjectPair(be[ke].key,be[ke].val);break;case 83:this.$=le.CreateObjectPair(be[ke-1].key,new Array(be[ke-1].val,be[ke].toJSO(le.utils,be[ke-1].key,be[ke-1].val)));break;case 84:case 85:this.$=Object.create({key:le.keyRemap(be[ke-2]),val:le.utils.checkArg(be[ke-2],be[ke])});break;case 86:this.$=[be[ke]];break;case 87:this.$=be[ke-1].concat(be[ke]);break;case 88:this.$=le.CreateObjectPair(be[ke-1].toLowerCase(),Number(be[ke]));break;case 89:this.$=new le.ArgList(be[ke]);break;case 90:this.$=be[ke-1].append(be[ke]);break;case 91:this.$=new le.Arg(be[ke-2],be[ke]);break;case 93:this.$=parseInt(be[ke]);break;case 94:this.$=JSON.parse(be[ke]);break;case 95:case 96:this.$=String(be[ke]);break;case 157:case 158:case 161:case 162:case 163:this.$=be[ke-2]+be[ke-1]+be[ke];break;case 166:this.$=be[ke-2]=be[ke-2]+be[ke-1]+be[ke];break}},table:[{3:1,4:2,5:[1,3],6:[1,4],7:[1,5],9:[1,6],11:[1,7],12:8,13:[1,9],15:[1,10],17:[1,11],18:[1,12],19:[1,13],20:[1,14],21:15,22:16,23:[1,17],25:[1,18],26:[1,19],27:[1,20],30:[1,21],33:[1,22],34:[1,23],37:[1,24],39:25,40:26,41:[1,27],43:[1,28],44:[1,29],45:[1,30],46:[1,31],48:[1,32],49:[1,33],50:34,51:35,52:[1,36],54:[1,37],55:[1,38],56:[1,44],58:[1,45],59:[1,39],62:[1,40],64:[1,41],65:[1,42],66:[1,43]},{1:[3]},{5:[1,46]},{1:[2,2]},{5:[2,3]},{5:[2,4],8:[1,47]},{5:[2,6],6:n,7:i,9:r,10:48,13:s,15:a,17:c,18:u,19:d,20:p,23:g,25:v,26:y,27:S,30:E,33:w,34:b,37:T,38:L,41:C,43:P,45:O,46:B,49:U,52:I,54:z,55:te,56:oe,58:ee,59:k,62:X,64:$,65:j,66:J,70:xe,72:de,74:fe,79:49,80:52,81:50,82:F,83:re,84:ue,85:_e,86:Le,87:Fe,88:Xe,89:lt,90:mt,91:ne,92:Be,93:Ne,94:ve,95:ye,96:et,97:tt,98:_t,99:St},{5:[2,8]},{5:[2,9]},{6:n,7:i,9:r,10:106,13:s,14:[1,107],15:a,17:c,18:u,19:d,20:p,23:g,25:v,26:y,27:S,30:E,33:w,34:b,37:T,38:L,41:C,43:P,45:O,46:B,49:U,52:I,54:z,55:te,56:oe,58:ee,59:k,62:X,64:$,65:j,66:J,70:xe,72:de,74:fe,79:49,80:52,81:50,82:F,83:re,84:ue,85:_e,86:Le,87:Fe,88:Xe,89:lt,90:mt,91:ne,92:Be,93:Ne,94:ve,95:ye,96:et,97:tt,98:_t,99:St},{6:n,7:i,9:r,10:108,13:s,14:[1,109],15:a,17:c,18:u,19:d,20:p,23:g,25:v,26:y,27:S,30:E,33:w,34:b,37:T,38:L,41:C,43:P,45:O,46:B,49:U,52:I,54:z,55:te,56:oe,58:ee,59:k,62:X,64:$,65:j,66:J,70:xe,72:de,74:fe,79:49,80:52,81:50,82:F,83:re,84:ue,85:_e,86:Le,87:Fe,88:Xe,89:lt,90:mt,91:ne,92:Be,93:Ne,94:ve,95:ye,96:et,97:tt,98:_t,99:St},{5:[2,14]},{5:[2,15]},{5:[2,16]},{5:[2,17],14:Mt,16:110,35:Bt,38:Ft,77:ie,78:Z},{5:[2,19]},{5:[2,20]},{24:116,35:Ve,38:ut},{24:119,35:Ve,38:ut},{24:120,35:Ve,38:ut},{5:[2,25],24:121,28:[1,122],29:[1,123],35:Ve,38:ut},{14:[1,124]},{14:[1,125]},{35:[1,126]},{38:[1,127]},{5:[2,33]},{5:[2,34]},{5:[2,35],14:[1,128],42:[1,129]},{5:[2,38],35:[1,130]},{5:[2,40]},{35:[1,131]},{47:132,73:133,74:gt},{47:135,73:133,74:gt},{5:[2,44],14:[1,136]},{5:[2,46]},{5:[2,47]},{6:n,7:i,9:r,10:138,13:s,14:[1,137],15:a,17:c,18:u,19:d,20:p,23:g,25:v,26:y,27:S,30:E,33:w,34:b,37:T,38:L,41:C,43:P,45:O,46:B,49:U,52:I,54:z,55:te,56:oe,58:ee,59:k,62:X,64:$,65:j,66:J,70:xe,72:de,74:fe,79:49,80:52,81:50,82:F,83:re,84:ue,85:_e,86:Le,87:Fe,88:Xe,89:lt,90:mt,91:ne,92:Be,93:Ne,94:ve,95:ye,96:et,97:tt,98:_t,99:St},{5:[2,52]},{35:[1,139]},{14:[1,143],38:[1,141],60:140,61:[1,142]},{5:[2,65],38:[1,144],63:145,67:146,68:147,69:148,70:dt,72:G},{24:151,35:Ve,38:ut},{38:[1,152]},{38:[1,153]},{5:[2,54],29:[1,154],57:[1,155]},{5:[2,59],35:[1,156]},{1:[2,1]},{5:[2,5]},{5:[2,7],101:q},t(Y,[2,159]),t(Y,[2,160]),t(pe,[2,97]),t(pe,[2,98]),t(Y,[2,147]),t(Y,[2,148]),t(Y,[2,149]),t(Y,[2,150]),t(Y,[2,151]),t(Y,[2,152]),t(Y,[2,153]),t(pe,[2,101]),t(pe,[2,102]),t(pe,[2,103]),t(pe,[2,104]),t(pe,[2,105]),t(pe,[2,106]),t(pe,[2,107]),t(pe,[2,108]),t(pe,[2,109]),t(pe,[2,110]),t(pe,[2,111]),t(pe,[2,112]),t(pe,[2,113]),t(pe,[2,114]),t(pe,[2,115]),t(pe,[2,116]),t(pe,[2,117]),t(pe,[2,118]),t(pe,[2,119]),t(pe,[2,120]),t(pe,[2,121]),t(pe,[2,122]),t(pe,[2,123]),t(pe,[2,124]),t(pe,[2,125]),t(pe,[2,126]),t(pe,[2,127]),t(pe,[2,128]),t(pe,[2,129]),t(pe,[2,130]),t(pe,[2,131]),t(pe,[2,132]),t(pe,[2,133]),t(pe,[2,134]),t(pe,[2,135]),t(pe,[2,136]),t(pe,[2,137]),t(pe,[2,138]),t(pe,[2,139]),t(pe,[2,140]),t(pe,[2,141]),t(pe,[2,142]),t(pe,[2,143]),t(pe,[2,144]),t(pe,[2,145]),t(pe,[2,146]),{5:[2,10],101:q},{5:[2,11]},{14:Mt,16:158,35:Bt,38:Ft,77:ie,78:Z,101:q},{14:Mt,16:159,35:Bt,38:Ft,77:ie,78:Z},{5:[2,18]},t(Me,[2,92]),t(Me,[2,93]),t(Me,[2,94]),t(Me,[2,95]),t(Me,[2,96]),{5:[2,21]},t(De,[2,75]),t(De,[2,76]),{5:[2,22]},{5:[2,23]},{5:[2,24]},{5:[2,26]},{5:[2,27]},{5:[2,28],31:[1,160]},{5:[2,30]},{36:[1,161]},{5:[2,32]},{5:[2,36]},{5:[2,37]},{5:[2,39]},{5:[2,41]},{5:[2,42],73:162,74:gt},t(Ee,[2,86]),{35:[1,163]},{5:[2,43],73:162,74:gt},{5:[2,45]},{14:[1,164]},{6:n,7:i,9:r,10:165,13:s,15:a,17:c,18:u,19:d,20:p,23:g,25:v,26:y,27:S,30:E,33:w,34:b,37:T,38:L,41:C,43:P,45:O,46:B,49:U,52:I,54:z,55:te,56:oe,58:ee,59:k,62:X,64:$,65:j,66:J,70:xe,72:de,74:fe,79:49,80:52,81:50,82:F,83:re,84:ue,85:_e,86:Le,87:Fe,88:Xe,89:lt,90:mt,91:ne,92:Be,93:Ne,94:ve,95:ye,96:et,97:tt,98:_t,99:St,101:q},{5:[2,53]},{5:[2,62]},{5:[2,63]},{5:[2,64]},{5:[2,164]},{5:[2,66],63:166,67:146,68:147,69:148,70:dt,72:G},{5:[2,67]},{5:[2,77],67:167,68:147,69:148,70:dt,72:G},t(De,[2,81]),t(De,[2,82],{80:52,53:168,75:169,76:170,79:171,6:n,7:i,9:r,13:s,15:a,17:c,18:u,19:d,20:p,23:g,25:v,26:y,27:S,30:E,33:w,34:b,37:T,38:L,41:C,43:P,45:O,46:B,49:U,52:I,54:z,55:te,56:oe,58:ee,59:k,62:X,64:$,65:j,66:J,82:F,83:re,84:ue,85:_e,86:Le,87:Fe,88:Xe,89:lt,90:mt,91:ne,92:Be,93:Ne,94:ve,95:ye}),{71:[1,172]},{71:[1,173]},{5:[2,69],63:174,67:146,68:147,69:148,70:dt,72:G},{5:[2,71],6:n,7:i,9:r,13:s,15:a,17:c,18:u,19:d,20:p,23:g,25:v,26:y,27:S,30:E,33:w,34:b,37:T,38:L,41:C,43:P,45:O,46:B,49:U,52:I,53:175,54:z,55:te,56:oe,58:ee,59:k,62:X,64:$,65:j,66:J,75:169,76:170,79:171,80:52,82:F,83:re,84:ue,85:_e,86:Le,87:Fe,88:Xe,89:lt,90:mt,91:ne,92:Be,93:Ne,94:ve,95:ye},{5:[2,73],6:n,7:i,9:r,13:s,15:a,17:c,18:u,19:d,20:p,23:g,25:v,26:y,27:S,30:E,33:w,34:b,37:T,38:L,41:C,43:P,45:O,46:B,49:U,52:I,53:176,54:z,55:te,56:oe,58:ee,59:k,62:X,64:$,65:j,66:J,75:169,76:170,79:171,80:52,82:F,83:re,84:ue,85:_e,86:Le,87:Fe,88:Xe,89:lt,90:mt,91:ne,92:Be,93:Ne,94:ve,95:ye},{5:[2,55],57:[1,177]},{5:[2,56],29:[1,178]},{5:[2,60],35:[1,179]},{6:n,7:i,9:r,13:s,15:a,17:c,18:u,19:d,20:p,23:g,25:v,26:y,27:S,30:E,33:w,34:b,35:[1,181],37:T,38:L,41:C,43:P,45:O,46:B,49:U,52:I,54:z,55:te,56:oe,58:ee,59:k,62:X,64:$,65:j,66:J,70:xe,72:de,74:fe,79:180,80:52,81:182,82:F,83:re,84:ue,85:_e,86:Le,87:Fe,88:Xe,89:lt,90:mt,91:ne,92:Be,93:Ne,94:ve,95:ye,96:et,97:tt,98:_t,99:St},{5:[2,12]},{5:[2,13]},{6:n,7:i,9:r,13:s,15:a,17:c,18:u,19:d,20:p,23:g,25:v,26:y,27:S,30:E,32:183,33:w,34:b,37:T,38:L,41:C,43:P,45:O,46:B,49:U,52:I,54:z,55:te,56:oe,58:ee,59:k,62:X,64:$,65:j,66:J,70:xe,72:de,74:fe,79:184,80:52,81:185,82:F,83:re,84:ue,85:_e,86:Le,87:Fe,88:Xe,89:lt,90:mt,91:ne,92:Be,93:Ne,94:ve,95:ye,96:et,97:tt,98:_t,99:St},{14:[1,186]},t(Ee,[2,87]),t(Ee,[2,88]),{5:[2,48],6:n,7:i,9:r,13:s,15:a,17:c,18:u,19:d,20:p,23:g,25:v,26:y,27:S,30:E,33:w,34:b,37:T,38:L,41:C,43:P,45:O,46:B,49:U,52:I,53:187,54:z,55:te,56:oe,58:ee,59:k,62:X,64:$,65:j,66:J,75:169,76:170,79:171,80:52,82:F,83:re,84:ue,85:_e,86:Le,87:Fe,88:Xe,89:lt,90:mt,91:ne,92:Be,93:Ne,94:ve,95:ye},{5:[2,49],6:n,7:i,9:r,13:s,15:a,17:c,18:u,19:d,20:p,23:g,25:v,26:y,27:S,30:E,33:w,34:b,37:T,38:L,41:C,43:P,45:O,46:B,49:U,52:I,53:188,54:z,55:te,56:oe,58:ee,59:k,62:X,64:$,65:j,66:J,75:169,76:170,79:171,80:52,82:F,83:re,84:ue,85:_e,86:Le,87:Fe,88:Xe,89:lt,90:mt,91:ne,92:Be,93:Ne,94:ve,95:ye,101:q},{5:[2,68]},{5:[2,78],67:189,68:147,69:148,70:dt,72:G},t(De,[2,83],{80:52,76:170,79:171,75:190,6:n,7:i,9:r,13:s,15:a,17:c,18:u,19:d,20:p,23:g,25:v,26:y,27:S,30:E,33:w,34:b,37:T,38:L,41:C,43:P,45:O,46:B,49:U,52:I,54:z,55:te,56:oe,58:ee,59:k,62:X,64:$,65:j,66:J,82:F,83:re,84:ue,85:_e,86:Le,87:Fe,88:Xe,89:lt,90:mt,91:ne,92:Be,93:Ne,94:ve,95:ye}),t(Me,[2,89]),{71:[1,191],101:[1,192]},t(je,[2,156]),{14:Mt,16:193,35:Bt,38:Ft,77:ie,78:Z},{14:Mt,16:194,35:Bt,38:Ft,77:ie,78:Z},{5:[2,70]},{5:[2,72],6:n,7:i,9:r,13:s,15:a,17:c,18:u,19:d,20:p,23:g,25:v,26:y,27:S,30:E,33:w,34:b,37:T,38:L,41:C,43:P,45:O,46:B,49:U,52:I,54:z,55:te,56:oe,58:ee,59:k,62:X,64:$,65:j,66:J,75:190,76:170,79:171,80:52,82:F,83:re,84:ue,85:_e,86:Le,87:Fe,88:Xe,89:lt,90:mt,91:ne,92:Be,93:Ne,94:ve,95:ye},{5:[2,74],6:n,7:i,9:r,13:s,15:a,17:c,18:u,19:d,20:p,23:g,25:v,26:y,27:S,30:E,33:w,34:b,37:T,38:L,41:C,43:P,45:O,46:B,49:U,52:I,54:z,55:te,56:oe,58:ee,59:k,62:X,64:$,65:j,66:J,75:190,76:170,79:171,80:52,82:F,83:re,84:ue,85:_e,86:Le,87:Fe,88:Xe,89:lt,90:mt,91:ne,92:Be,93:Ne,94:ve,95:ye},{5:[2,57]},{5:[2,58]},{5:[2,61]},t(Y,[2,161]),t(Y,[2,162]),t(Y,[2,163]),{5:[2,29]},{5:[2,99]},{5:[2,100]},{31:[1,195]},{5:[2,50],6:n,7:i,9:r,13:s,15:a,17:c,18:u,19:d,20:p,23:g,25:v,26:y,27:S,30:E,33:w,34:b,37:T,38:L,41:C,43:P,45:O,46:B,49:U,52:I,54:z,55:te,56:oe,58:ee,59:k,62:X,64:$,65:j,66:J,75:190,76:170,79:171,80:52,82:F,83:re,84:ue,85:_e,86:Le,87:Fe,88:Xe,89:lt,90:mt,91:ne,92:Be,93:Ne,94:ve,95:ye},{5:[2,51],6:n,7:i,9:r,13:s,15:a,17:c,18:u,19:d,20:p,23:g,25:v,26:y,27:S,30:E,33:w,34:b,37:T,38:L,41:C,43:P,45:O,46:B,49:U,52:I,54:z,55:te,56:oe,58:ee,59:k,62:X,64:$,65:j,66:J,75:190,76:170,79:171,80:52,82:F,83:re,84:ue,85:_e,86:Le,87:Fe,88:Xe,89:lt,90:mt,91:ne,92:Be,93:Ne,94:ve,95:ye},{5:[2,79],67:196,68:147,69:148,70:dt,72:G},t(Me,[2,90]),{14:Mt,16:197,35:Bt,38:Ft,77:ie,78:Z},{6:n,7:i,9:r,13:s,15:a,17:c,18:u,19:d,20:p,23:g,25:v,26:y,27:S,30:E,33:w,34:b,35:[1,199],37:T,38:L,41:C,43:P,45:O,46:B,49:U,52:I,54:z,55:te,56:oe,58:ee,59:k,62:X,64:$,65:j,66:J,79:198,80:52,82:F,83:re,84:ue,85:_e,86:Le,87:Fe,88:Xe,89:lt,90:mt,91:ne,92:Be,93:Ne,94:ve,95:ye},t(De,[2,84]),t(Me,[2,85]),{6:n,7:i,9:r,13:s,15:a,17:c,18:u,19:d,20:p,23:g,25:v,26:y,27:S,30:E,32:200,33:w,34:b,37:T,38:L,41:C,43:P,45:O,46:B,49:U,52:I,54:z,55:te,56:oe,58:ee,59:k,62:X,64:$,65:j,66:J,70:xe,72:de,74:fe,79:184,80:52,81:185,82:F,83:re,84:ue,85:_e,86:Le,87:Fe,88:Xe,89:lt,90:mt,91:ne,92:Be,93:Ne,94:ve,95:ye,96:et,97:tt,98:_t,99:St},{5:[2,80]},t(Me,[2,91]),t(je,[2,157]),t(je,[2,158]),{5:[2,31]}],defaultActions:{3:[2,2],4:[2,3],7:[2,8],8:[2,9],11:[2,14],12:[2,15],13:[2,16],15:[2,19],16:[2,20],25:[2,33],26:[2,34],29:[2,40],34:[2,46],35:[2,47],37:[2,52],46:[2,1],47:[2,5],107:[2,11],110:[2,18],116:[2,21],119:[2,22],120:[2,23],121:[2,24],122:[2,26],123:[2,27],125:[2,30],127:[2,32],128:[2,36],129:[2,37],130:[2,39],131:[2,41],136:[2,45],139:[2,53],140:[2,62],141:[2,63],142:[2,64],143:[2,164],145:[2,67],158:[2,12],159:[2,13],166:[2,68],174:[2,70],177:[2,57],178:[2,58],179:[2,61],183:[2,29],184:[2,99],185:[2,100],196:[2,80],200:[2,31]},parseError:function(Ze,Se){if(Se.recoverable)this.trace(Ze);else{var Ke=new Error(Ze);throw Ke.hash=Se,Ke}},parse:function(Ze){var Se=this,Ke=[0],le=[],At=[null],be=[],Yt=this.table,ke="",Nt=0,hn=0,Gn=0,Di=2,Gi=1,Ci=be.slice.call(arguments,1),bn=Object.create(this.lexer),mi={yy:{}};for(var Xr in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Xr)&&(mi.yy[Xr]=this.yy[Xr]);bn.setInput(Ze,mi.yy),mi.yy.lexer=bn,mi.yy.parser=this,typeof bn.yylloc>"u"&&(bn.yylloc={});var Ls=bn.yylloc;be.push(Ls);var Ps=bn.options&&bn.options.ranges;typeof mi.yy.parseError=="function"?this.parseError=mi.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function fr(){var It=le.pop()||bn.lex()||Gi;return typeof It!="number"&&(It instanceof Array&&(le=It,It=le.pop()),It=Se.symbols_[It]||It),It}for(var K,Re,$e,Ae,qe,xt={},Dt,Rt,Vt,jt;;){if($e=Ke[Ke.length-1],this.defaultActions[$e]?Ae=this.defaultActions[$e]:((K===null||typeof K>"u")&&(K=fr()),Ae=Yt[$e]&&Yt[$e][K]),typeof Ae>"u"||!Ae.length||!Ae[0]){var zt="";jt=[];for(Dt in Yt[$e])this.terminals_[Dt]&&Dt>Di&&jt.push("'"+this.terminals_[Dt]+"'");bn.showPosition?zt="Parse error on line "+(Nt+1)+`:
`+bn.showPosition()+`
Expecting `+jt.join(", ")+", got '"+(this.terminals_[K]||K)+"'":zt="Parse error on line "+(Nt+1)+": Unexpected "+(K==Gi?"end of input":"'"+(this.terminals_[K]||K)+"'"),this.parseError(zt,{text:bn.match,token:this.terminals_[K]||K,line:bn.yylineno,loc:Ls,expected:jt})}if(Ae[0]instanceof Array&&Ae.length>1)throw new Error("Parse Error: multiple actions possible at state: "+$e+", token: "+K);switch(Ae[0]){case 1:Ke.push(K),At.push(bn.yytext),be.push(bn.yylloc),Ke.push(Ae[1]),K=null,Re?(K=Re,Re=null):(hn=bn.yyleng,ke=bn.yytext,Nt=bn.yylineno,Ls=bn.yylloc,Gn>0&&Gn--);break;case 2:if(Rt=this.productions_[Ae[1]][1],xt.$=At[At.length-Rt],xt._$={first_line:be[be.length-(Rt||1)].first_line,last_line:be[be.length-1].last_line,first_column:be[be.length-(Rt||1)].first_column,last_column:be[be.length-1].last_column},Ps&&(xt._$.range=[be[be.length-(Rt||1)].range[0],be[be.length-1].range[1]]),qe=this.performAction.apply(xt,[ke,hn,Nt,mi.yy,Ae[1],At,be].concat(Ci)),typeof qe<"u")return qe;Rt&&(Ke=Ke.slice(0,-1*Rt*2),At=At.slice(0,-1*Rt),be=be.slice(0,-1*Rt)),Ke.push(this.productions_[Ae[1]][0]),At.push(xt.$),be.push(xt._$),Vt=Yt[Ke[Ke.length-2]][Ke[Ke.length-1]],Ke.push(Vt);break;case 3:return!0}}return!0}};nt.lexer=(function(){return{EOF:1,parseError:function(Ze,Se){if(this.yy.parser)this.yy.parser.parseError(Ze,Se);else throw new Error(Ze)},setInput:function(se,Ze){return this.yy=Ze||this.yy||{},this._input=se,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var se=this._input[0];return this.yytext+=se,this.yyleng++,this.offset++,this.match+=se,this.matched+=se,se.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),se},unput:function(se){var Ze=se.length,Se=se.split(/(?:\r\n?|\n)/g);this._input=se+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-Ze),this.offset-=Ze;var Ke=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),Se.length-1&&(this.yylineno-=Se.length-1);var le=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:Se?(Se.length===Ke.length?this.yylloc.first_column:0)+Ke[Ke.length-Se.length].length-Se[0].length:this.yylloc.first_column-Ze},this.options.ranges&&(this.yylloc.range=[le[0],le[0]+this.yyleng-Ze]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(se){this.unput(this.match.slice(se))},pastInput:function(){var se=this.matched.substr(0,this.matched.length-this.match.length);return(se.length>20?"...":"")+se.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var se=this.match;return se.length<20&&(se+=this._input.substr(0,20-se.length)),(se.substr(0,20)+(se.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var se=this.pastInput(),Ze=new Array(se.length+1).join("-");return se+this.upcomingInput()+`
`+Ze+"^"},test_match:function(se,Ze){var Se,Ke,le;if(this.options.backtrack_lexer&&(le={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(le.yylloc.range=this.yylloc.range.slice(0))),Ke=se[0].match(/(?:\r\n?|\n).*/g),Ke&&(this.yylineno+=Ke.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:Ke?Ke[Ke.length-1].length-Ke[Ke.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+se[0].length},this.yytext+=se[0],this.match+=se[0],this.matches=se,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(se[0].length),this.matched+=se[0],Se=this.performAction.call(this,this.yy,this,Ze,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),Se)return Se;if(this._backtrack){for(var At in le)this[At]=le[At];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var se,Ze,Se,Ke;this._more||(this.yytext="",this.match="");for(var le=this._currentRules(),At=0;At<le.length;At++)if(Se=this._input.match(this.rules[le[At]]),Se&&(!Ze||Se[0].length>Ze[0].length)){if(Ze=Se,Ke=At,this.options.backtrack_lexer){if(se=this.test_match(Se,le[At]),se!==!1)return se;if(this._backtrack){Ze=!1;continue}else return!1}else if(!this.options.flex)break}return Ze?(se=this.test_match(Ze,le[Ke]),se!==!1?se:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var Ze=this.next();return Ze||this.lex()},begin:function(Ze){this.conditionStack.push(Ze)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(Ze){return Ze=this.conditionStack.length-1-Math.abs(Ze||0),Ze>=0?this.conditionStack[Ze]:"INITIAL"},pushState:function(Ze){this.begin(Ze)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(Ze,Se,Ke,le){switch(Ke){case 0:break;case 1:return"";case 2:return"";case 3:return 42;case 4:return 35;case 5:return 77;case 6:return 78;case 7:return 78;case 8:return 8;case 9:return 6;case 10:return 82;case 11:return 7;case 12:return 9;case 13:return 59;case 14:return 13;case 15:return 15;case 16:return 17;case 17:return 18;case 18:return 19;case 19:return 20;case 20:return 11;case 21:return 62;case 22:return 64;case 23:return 23;case 24:return 25;case 25:return 26;case 26:return 27;case 27:return 30;case 28:return 34;case 29:return 33;case 30:return 65;case 31:return 66;case 32:return 37;case 33:return 41;case 34:return 43;case 35:return 52;case 36:return 54;case 37:return 55;case 38:return 46;case 39:return 48;case 40:return 45;case 41:return 49;case 42:return 56;case 43:return 58;case 44:return 44;case 45:return 83;case 46:return 84;case 47:return 85;case 48:return 86;case 49:return 87;case 50:return 88;case 51:return 89;case 52:return 90;case 53:return 91;case 54:return 92;case 55:return 93;case 56:return 94;case 57:return 95;case 58:return 70;case 59:return 70;case 60:return 72;case 61:return 72;case 62:return 74;case 63:return 74;case 64:return 74;case 65:return 31;case 66:return 36;case 67:return 96;case 68:return 97;case 69:return 98;case 70:return 99;case 71:return Se.yytext=Ze.utils.unquoteString(Se.yytext),14;case 72:return 38;case 73:return 5;case 74:return 101;case 75:return 103;case 76:return"\\";case 77:return 28;case 78:return 61;case 79:return 29;case 80:return 57;case 81:return 71}},rules:[/^(?:\s+)/i,/^(?:[#].*)/i,/^(?:\/\/.*)/i,/^(?:([_A-Z0-9\/\+]+==))/i,/^(?:-?[0-9]+(\.[0-9]+)?\b)/i,/^(?:0[xX][0-9A-F]+\b)/i,/^(?:false\b)/i,/^(?:true\b)/i,/^(?:all\b)/i,/^(?:reset\b)/i,/^(?:clear\b)/i,/^(?:build\b)/i,/^(?:help\b)/i,/^(?:load\b)/i,/^(?:get\b)/i,/^(?:set\b)/i,/^(?:set_save\b)/i,/^(?:set_restore\b)/i,/^(?:set_reset\b)/i,/^(?:preset\b)/i,/^(?:motm\b)/i,/^(?:add\b)/i,/^(?:rep\b)/i,/^(?:remove\b)/i,/^(?:hide\b)/i,/^(?:show\b)/i,/^(?:list\b)/i,/^(?:select\b)/i,/^(?:within\b)/i,/^(?:selector\b)/i,/^(?:mode\b)/i,/^(?:color\b)/i,/^(?:material\b)/i,/^(?:view\b)/i,/^(?:unit\b)/i,/^(?:line\b)/i,/^(?:listobj\b)/i,/^(?:removeobj\b)/i,/^(?:rotate\b)/i,/^(?:translate\b)/i,/^(?:scale\b)/i,/^(?:center\b)/i,/^(?:url\b)/i,/^(?:screenshot\b)/i,/^(?:dssp\b)/i,/^(?:file_list\b)/i,/^(?:file_register\b)/i,/^(?:file_delete\b)/i,/^(?:preset_add\b)/i,/^(?:preset_delete\b)/i,/^(?:preset_update\b)/i,/^(?:preset_rename\b)/i,/^(?:preset_open\b)/i,/^(?:create_scenario\b)/i,/^(?:reset_scenario\b)/i,/^(?:delete_scenario\b)/i,/^(?:add_scenario_item\b)/i,/^(?:list_scenario\b)/i,/^(?:s\b)/i,/^(?:mt\b)/i,/^(?:m\b)/i,/^(?:c\b)/i,/^(?:x\b)/i,/^(?:y\b)/i,/^(?:z\b)/i,/^(?:as\b)/i,/^(?:of\b)/i,/^(?:pdb\b)/i,/^(?:delay\b)/i,/^(?:prst\b)/i,/^(?:desc\b)/i,/^(?:((?:"(?:\\.|[^\\"])*"|'(?:\\.|[^\\'])*')))/i,/^(?:([_A-Z0-9]+))/i,/^(?:$)/i,/^(?:\.)/i,/^(?:\/)/i,/^(?:\\)/i,/^(?:-e\b)/i,/^(?:-f\b)/i,/^(?:-s\b)/i,/^(?:-v\b)/i,/^(?:=)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81],inclusive:!0}}}})();function ft(){this.yy={}}return ft.prototype=nt,nt.Parser=ft,new ft})()}}),99:(e=>{e.exports={parser:(function(){var t=function(T,L,C,P){for(C=C||{},P=T.length;P--;C[T[P]]=L);return C},n=[1,4],i=[1,5],r=[1,6],s=[1,7],a=[1,8],c=[1,9],u=[1,11],d=[1,12],p=[5,7,8,11],g=[1,17],v=[1,22],y=[1,20],S=[1,21],E=[5,7,8,11,19],w={trace:function(){},yy:{},symbols_:{error:2,Program:3,Expression:4,EOF:5,Selector:6,OR:7,AND:8,NOT:9,"(":10,")":11,SELECTOR:12,NAMED_SELECTOR:13,SELECTOR_RANGED:14,RangeList:15,SELECTOR_NAMED:16,NameList:17,Range:18,",":19,NUMBER:20,":":21,Name:22,IDENTIFIER:23,STRING:24,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",7:"OR",8:"AND",9:"NOT",10:"(",11:")",12:"SELECTOR",13:"NAMED_SELECTOR",14:"SELECTOR_RANGED",16:"SELECTOR_NAMED",19:",",20:"NUMBER",21:":",23:"IDENTIFIER",24:"STRING"},productions_:[0,[3,2],[4,1],[4,3],[4,3],[4,2],[4,3],[6,1],[6,1],[6,2],[6,2],[15,1],[15,3],[18,1],[18,3],[17,1],[17,3],[22,1],[22,1],[22,1]],performAction:function(L,C,P,O,B,U,I){var z=U.length-1;switch(B){case 1:return U[z-1];case 3:this.$=O.keyword("or")(U[z-2],U[z]);break;case 4:this.$=O.keyword("and")(U[z-2],U[z]);break;case 5:this.$=O.keyword("not")(U[z]);break;case 6:this.$=U[z-1];break;case 7:this.$=O.keyword(U[z])();break;case 8:this.$=O.GetSelector(U[z].toLowerCase().slice(1,U[z].length));break;case 9:case 10:this.$=O.keyword(U[z-1])(U[z]);break;case 11:this.$=new O.RangeList(U[z]);break;case 12:case 16:this.$=U[z-2].append(U[z]);break;case 13:this.$=new O.Range(Number(U[z]));break;case 14:this.$=new O.Range(Number(U[z-2]),Number(U[z]));break;case 15:this.$=new O.ValueList(U[z]);break}},table:[{3:1,4:2,6:3,9:n,10:i,12:r,13:s,14:a,16:c},{1:[3]},{5:[1,10],7:u,8:d},t(p,[2,2]),{4:13,6:3,9:n,10:i,12:r,13:s,14:a,16:c},{4:14,6:3,9:n,10:i,12:r,13:s,14:a,16:c},t(p,[2,7]),t(p,[2,8]),{15:15,18:16,20:g},{17:18,20:v,22:19,23:y,24:S},{1:[2,1]},{4:23,6:3,9:n,10:i,12:r,13:s,14:a,16:c},{4:24,6:3,9:n,10:i,12:r,13:s,14:a,16:c},t(p,[2,5]),{7:u,8:d,11:[1,25]},t(p,[2,9],{19:[1,26]}),t(E,[2,11]),t(E,[2,13],{21:[1,27]}),t(p,[2,10],{19:[1,28]}),t(E,[2,15]),t(E,[2,17]),t(E,[2,18]),t(E,[2,19]),t([5,7,11],[2,3],{8:d}),t(p,[2,4]),t(p,[2,6]),{18:29,20:g},{20:[1,30]},{20:v,22:31,23:y,24:S},t(E,[2,12]),t(E,[2,14]),t(E,[2,16])],defaultActions:{10:[2,1]},parseError:function(L,C){if(C.recoverable)this.trace(L);else{var P=new Error(L);throw P.hash=C,P}},parse:function(L){var C=this,P=[0],O=[],B=[null],U=[],I=this.table,z="",te=0,oe=0,ee=0,k=2,X=1,$=U.slice.call(arguments,1),j=Object.create(this.lexer),J={yy:{}};for(var xe in this.yy)Object.prototype.hasOwnProperty.call(this.yy,xe)&&(J.yy[xe]=this.yy[xe]);j.setInput(L,J.yy),J.yy.lexer=j,J.yy.parser=this,typeof j.yylloc>"u"&&(j.yylloc={});var de=j.yylloc;U.push(de);var fe=j.options&&j.options.ranges;typeof J.yy.parseError=="function"?this.parseError=J.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function F(){var ve=O.pop()||j.lex()||X;return typeof ve!="number"&&(ve instanceof Array&&(O=ve,ve=O.pop()),ve=C.symbols_[ve]||ve),ve}for(var re,ue,_e,Le,Fe,Xe={},lt,mt,ne,Be;;){if(_e=P[P.length-1],this.defaultActions[_e]?Le=this.defaultActions[_e]:((re===null||typeof re>"u")&&(re=F()),Le=I[_e]&&I[_e][re]),typeof Le>"u"||!Le.length||!Le[0]){var Ne="";Be=[];for(lt in I[_e])this.terminals_[lt]&&lt>k&&Be.push("'"+this.terminals_[lt]+"'");j.showPosition?Ne="Parse error on line "+(te+1)+`:
`+j.showPosition()+`
Expecting `+Be.join(", ")+", got '"+(this.terminals_[re]||re)+"'":Ne="Parse error on line "+(te+1)+": Unexpected "+(re==X?"end of input":"'"+(this.terminals_[re]||re)+"'"),this.parseError(Ne,{text:j.match,token:this.terminals_[re]||re,line:j.yylineno,loc:de,expected:Be})}if(Le[0]instanceof Array&&Le.length>1)throw new Error("Parse Error: multiple actions possible at state: "+_e+", token: "+re);switch(Le[0]){case 1:P.push(re),B.push(j.yytext),U.push(j.yylloc),P.push(Le[1]),re=null,ue?(re=ue,ue=null):(oe=j.yyleng,z=j.yytext,te=j.yylineno,de=j.yylloc,ee>0&&ee--);break;case 2:if(mt=this.productions_[Le[1]][1],Xe.$=B[B.length-mt],Xe._$={first_line:U[U.length-(mt||1)].first_line,last_line:U[U.length-1].last_line,first_column:U[U.length-(mt||1)].first_column,last_column:U[U.length-1].last_column},fe&&(Xe._$.range=[U[U.length-(mt||1)].range[0],U[U.length-1].range[1]]),Fe=this.performAction.apply(Xe,[z,oe,te,J.yy,Le[1],B,U].concat($)),typeof Fe<"u")return Fe;mt&&(P=P.slice(0,-1*mt*2),B=B.slice(0,-1*mt),U=U.slice(0,-1*mt)),P.push(this.productions_[Le[1]][0]),B.push(Xe.$),U.push(Xe._$),ne=I[P[P.length-2]][P[P.length-1]],P.push(ne);break;case 3:return!0}}return!0}};w.lexer=(function(){return{EOF:1,parseError:function(L,C){if(this.yy.parser)this.yy.parser.parseError(L,C);else throw new Error(L)},setInput:function(T,L){return this.yy=L||this.yy||{},this._input=T,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var T=this._input[0];return this.yytext+=T,this.yyleng++,this.offset++,this.match+=T,this.matched+=T,T.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),T},unput:function(T){var L=T.length,C=T.split(/(?:\r\n?|\n)/g);this._input=T+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-L),this.offset-=L;var P=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),C.length-1&&(this.yylineno-=C.length-1);var O=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:C?(C.length===P.length?this.yylloc.first_column:0)+P[P.length-C.length].length-C[0].length:this.yylloc.first_column-L},this.options.ranges&&(this.yylloc.range=[O[0],O[0]+this.yyleng-L]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(T){this.unput(this.match.slice(T))},pastInput:function(){var T=this.matched.substr(0,this.matched.length-this.match.length);return(T.length>20?"...":"")+T.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var T=this.match;return T.length<20&&(T+=this._input.substr(0,20-T.length)),(T.substr(0,20)+(T.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var T=this.pastInput(),L=new Array(T.length+1).join("-");return T+this.upcomingInput()+`
`+L+"^"},test_match:function(T,L){var C,P,O;if(this.options.backtrack_lexer&&(O={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(O.yylloc.range=this.yylloc.range.slice(0))),P=T[0].match(/(?:\r\n?|\n).*/g),P&&(this.yylineno+=P.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:P?P[P.length-1].length-P[P.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+T[0].length},this.yytext+=T[0],this.match+=T[0],this.matches=T,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(T[0].length),this.matched+=T[0],C=this.performAction.call(this,this.yy,this,L,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),C)return C;if(this._backtrack){for(var B in O)this[B]=O[B];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var T,L,C,P;this._more||(this.yytext="",this.match="");for(var O=this._currentRules(),B=0;B<O.length;B++)if(C=this._input.match(this.rules[O[B]]),C&&(!L||C[0].length>L[0].length)){if(L=C,P=B,this.options.backtrack_lexer){if(T=this.test_match(C,O[B]),T!==!1)return T;if(this._backtrack){L=!1;continue}else return!1}else if(!this.options.flex)break}return L?(T=this.test_match(L,O[P]),T!==!1?T:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var L=this.next();return L||this.lex()},begin:function(L){this.conditionStack.push(L)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(L){return L=this.conditionStack.length-1-Math.abs(L||0),L>=0?this.conditionStack[L]:"INITIAL"},pushState:function(L){this.begin(L)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(L,C,P,O){switch(P){case 0:break;case 1:return 20;case 2:return 7;case 3:return 8;case 4:return 9;case 5:return 12;case 6:return 16;case 7:return 14;case 8:return 10;case 9:return 11;case 10:return 19;case 11:return 21;case 12:return"<=";case 13:return">=";case 14:return"<";case 15:return">";case 16:return C.yytext=C.yytext.substr(1,C.yyleng-2),24;case 17:return 13;case 18:return 23;case 19:return 5;case 20:return"INVALID"}},rules:[/^(?:\s+)/i,/^(?:(-?(?:[1-9][0-9]+|[0-9]))\b)/i,/^(?:OR\b)/i,/^(?:AND\b)/i,/^(?:NOT\b)/i,/^(?:((ALL|NONE|HETATM|PROTEIN|BASIC|ACIDIC|CHARGED|POLAR|NONPOLAR|AROMATIC|NUCLEIC|PURINE|PYRIMIDINE|WATER|POLARH|NONPOLARH))\b)/i,/^(?:((NAME|ELEM|TYPE|RESIDUE|ICODE|CHAIN|ALTLOC))\b)/i,/^(?:((SERIAL|SEQUENCE|RESIDX))\b)/i,/^(?:\()/i,/^(?:\))/i,/^(?:,)/i,/^(?::)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:((?:"(?:\\.|[^\\"])*"|'(?:\\.|[^\\'])*')))/i,/^(?:(@[_A-Z0-9]+))/i,/^(?:([_A-Z0-9]+))/i,/^(?:$)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}}})();function b(){this.yy={}}return b.prototype=w,w.Parser=b,new b})()}}),690:(function(e,t){(function(){var n,i,r,s,a,c,u,d,p,g,v,y,S,E,w,b,T,L,C,P,O,B,U,I,z,te,oe=Object.prototype.hasOwnProperty,ee=function(k,X){for(var $ in X)oe.call(X,$)&&(k[$]=X[$]);function j(){this.constructor=k}return j.prototype=X.prototype,k.prototype=new j,k.__super__=X.prototype,k};r={METHOD_NEAREST:"nearest",METHOD_LINEAR:"linear",METHOD_CUBIC:"cubic",METHOD_LANCZOS:"lanczos",METHOD_SINC:"sinc",CLIP_CLAMP:"clamp",CLIP_ZERO:"zero",CLIP_PERIODIC:"periodic",CLIP_MIRROR:"mirror",CUBIC_TENSION_DEFAULT:0,CUBIC_TENSION_CATMULL_ROM:0},y={method:r.METHOD_CUBIC,cubicTension:r.CUBIC_TENSION_DEFAULT,clip:r.CLIP_CLAMP,scaleTo:0,sincFilterSize:2,sincWindow:void 0},p=function(k,X){return Math.max(0,Math.min(k,X-1))},v=function(k,X){return k=k%X,k<0&&(k+=X),k},g=function(k,X){var $=2*(X-1);return k=v(k,$),k>X-1&&(k=$-k),k},n=(function(){function k(X,$){if(this.array=X.slice(0),this.length=this.array.length,!(this.clipHelper={clamp:this.clipHelperClamp,zero:this.clipHelperZero,periodic:this.clipHelperPeriodic,mirror:this.clipHelperMirror}[$.clip]))throw"Invalid clip: "+$.clip}return k.prototype.getClippedInput=function(X){return 0<=X&&X<this.length?this.array[X]:this.clipHelper(X)},k.prototype.clipHelperClamp=function(X){return this.array[p(X,this.length)]},k.prototype.clipHelperZero=function(X){return 0},k.prototype.clipHelperPeriodic=function(X){return this.array[v(X,this.length)]},k.prototype.clipHelperMirror=function(X){return this.array[g(X,this.length)]},k.prototype.interpolate=function(X){throw"Subclasses of AbstractInterpolator must override the interpolate() method."},k})(),a=(function(k){ee(X,k);function X(){X.__super__.constructor.apply(this,arguments)}return X.prototype.interpolate=function($){return this.getClippedInput(Math.round($))},X})(n),s=(function(k){ee(X,k);function X(){X.__super__.constructor.apply(this,arguments)}return X.prototype.interpolate=function($){var j=Math.floor($);return $-=j,(1-$)*this.getClippedInput(j)+$*this.getClippedInput(j+1)},X})(n),i=(function(k){ee(X,k);function X($,j){this.tangentFactor=1-Math.max(-1,Math.min(1,j.cubicTension)),X.__super__.constructor.apply(this,arguments)}return X.prototype.getTangent=function($){return this.tangentFactor*(this.getClippedInput($+1)-this.getClippedInput($-1))/2},X.prototype.interpolate=function($){var j=Math.floor($),J=[this.getTangent(j),this.getTangent(j+1)],xe=[this.getClippedInput(j),this.getClippedInput(j+1)],de,fe;return $-=j,de=$*$,fe=$*de,(2*fe-3*de+1)*xe[0]+(fe-2*de+$)*J[0]+(-2*fe+3*de)*xe[1]+(fe-de)*J[1]},X})(n),B=Math.sin,c=Math.PI,U=function(k){return k===0?1:B(c*k)/(c*k)},T=function(k){return function(X){return U(X/k)}},C=function(k){return function(X){return U(X)*k(X)}},u=(function(k){ee(X,k);function X($,j){if(X.__super__.constructor.apply(this,arguments),this.a=j.sincFilterSize,!j.sincWindow)throw"No sincWindow provided";this.kernel=C(j.sincWindow)}return X.prototype.interpolate=function($){var j=Math.floor($),J,xe=0,de,fe;for(J=de=j-this.a+1,fe=j+this.a;de<=fe?J<=fe:J>=fe;de<=fe?J++:J--)xe+=this.kernel($-J)*this.getClippedInput(J);return xe},X})(n),S=function(k,X){var $,j,J,xe=[];for(j=0,J=k.length;j<J;j++)$=k[j],xe.push($[X]);return xe},L=function(k,X,$){var j,J;return $.join==="0,1"?k:(j=X/($[1]-$[0]),J=$[0],function(xe){return k(j*(xe-J))})},E=function(k){return Object.prototype.toString.call(k).slice(8,-1)},z=function(k){if(isNaN(k))throw"NaN in Smooth() input";if(E(k)!=="Number")throw"Non-number in Smooth() input";if(!isFinite(k))throw"Infinity in Smooth() input"},te=function(k,X){var $,j,J;if(E(k)!=="Array")throw"Non-vector in Smooth() input";if(k.length!==X)throw"Inconsistent dimension in Smooth() input";for(j=0,J=k.length;j<J;j++)$=k[j],z($)},w=function(k){return E(k)==="Number"&&isFinite(k)&&!isNaN(k)},P=function(k){var X="scaleTo param must be number or array of two numbers";switch(E(k)){case"Number":if(!w(k))throw X;k=[0,k];break;case"Array":if(k.length!==2||!(w(k[0])&&w(k[1])))throw X;break;default:throw X}return k},O=function(k){var X={},$,j;for($ in k)oe.call(k,$)&&(j=k[$],X[$]=j);return X},d=function(k,X){var $,j,J,xe,de,fe,F,re,ue,_e,Le;X==null&&(X={}),ue={},X=O(X),ue.config=O(X),X.scaleTo==null&&(X.scaleTo=X.period),X.sincFilterSize==null&&(X.sincFilterSize=X.lanczosFilterSize);for(F in y)oe.call(y,F)&&(Le=y[F],X[F]==null&&(X[F]=Le));if(!(de={nearest:a,linear:s,cubic:i,lanczos:u,sinc:u}[X.method]))throw"Invalid method: "+X.method;if(X.method==="lanczos"&&(X.sincWindow=T(X.sincFilterSize)),k.length<2)throw"Array must have at least two elements";ue.count=k.length,_e=(function(){var Fe,Xe,lt,mt;switch(E(k[0])){case"Number":if(ue.dimension="scalar",d.deepValidation)for(Fe=0,lt=k.length;Fe<lt;Fe++)re=k[Fe],z(re);return xe=new de(k,X),function(ne){return xe.interpolate(ne)};case"Array":if(ue.dimension=j=k[0].length,!j)throw"Vectors must be non-empty";if(d.deepValidation)for(Xe=0,mt=k.length;Xe<mt;Xe++)Le=k[Xe],te(Le,j);return fe=(function(){var ne=[];for(J=0;0<=j?J<j:J>j;0<=j?J++:J--)ne.push(new de(S(k,J),X));return ne})(),function(ne){var Be,Ne,ve,ye=[];for(Ne=0,ve=fe.length;Ne<ve;Ne++)Be=fe[Ne],ye.push(Be.interpolate(ne));return ye};default:throw"Invalid element type: "+E(k[0])}})(),X.clip==="periodic"?$=k.length:$=k.length-1,X.scaleTo||(X.scaleTo=$),ue.domain=P(X.scaleTo),_e=L(_e,$,ue.domain),ue.domain.sort();for(F in ue)oe.call(ue,F)&&(Le=ue[F],_e[F]=Le);return _e};for(b in r)oe.call(r,b)&&(I=r[b],d[b]=I);d.deepValidation=!0,(t!==null?t:window).Smooth=d}).call(this)}),660:(function(e,t){var n,i,r;(function(s,a){i=[t],n=a,r=typeof n=="function"?n.apply(t,i):n,r!==void 0&&(e.exports=r)})(this,function(s){"use strict";function a(G,q,Y){for(var pe=(G.byteLength,0),Me=Y.length;Me>pe;pe++){var De=Y.charCodeAt(pe);if(128>De)G.setUint8(q++,De>>>0&127|0);else if(2048>De)G.setUint8(q++,De>>>6&31|192),G.setUint8(q++,De>>>0&63|128);else if(65536>De)G.setUint8(q++,De>>>12&15|224),G.setUint8(q++,De>>>6&63|128),G.setUint8(q++,De>>>0&63|128);else{if(!(1114112>De))throw new Error("bad codepoint "+De);G.setUint8(q++,De>>>18&7|240),G.setUint8(q++,De>>>12&63|128),G.setUint8(q++,De>>>6&63|128),G.setUint8(q++,De>>>0&63|128)}}}function c(G){for(var q=0,Y=0,pe=G.length;pe>Y;Y++){var Me=G.charCodeAt(Y);if(128>Me)q+=1;else if(2048>Me)q+=2;else if(65536>Me)q+=3;else{if(!(1114112>Me))throw new Error("bad codepoint "+Me);q+=4}}return q}function u(G,q,Y){var pe=typeof G;if(pe==="string"){var Me=c(G);if(32>Me)return q.setUint8(Y,160|Me),a(q,Y+1,G),1+Me;if(256>Me)return q.setUint8(Y,217),q.setUint8(Y+1,Me),a(q,Y+2,G),2+Me;if(65536>Me)return q.setUint8(Y,218),q.setUint16(Y+1,Me),a(q,Y+3,G),3+Me;if(4294967296>Me)return q.setUint8(Y,219),q.setUint32(Y+1,Me),a(q,Y+5,G),5+Me}if(G instanceof Uint8Array){var Me=G.byteLength,De=new Uint8Array(q.buffer);if(256>Me)return q.setUint8(Y,196),q.setUint8(Y+1,Me),De.set(G,Y+2),2+Me;if(65536>Me)return q.setUint8(Y,197),q.setUint16(Y+1,Me),De.set(G,Y+3),3+Me;if(4294967296>Me)return q.setUint8(Y,198),q.setUint32(Y+1,Me),De.set(G,Y+5),5+Me}if(pe==="number"){if(!isFinite(G))throw new Error("Number not finite: "+G);if(Math.floor(G)!==G)return q.setUint8(Y,203),q.setFloat64(Y+1,G),9;if(G>=0){if(128>G)return q.setUint8(Y,G),1;if(256>G)return q.setUint8(Y,204),q.setUint8(Y+1,G),2;if(65536>G)return q.setUint8(Y,205),q.setUint16(Y+1,G),3;if(4294967296>G)return q.setUint8(Y,206),q.setUint32(Y+1,G),5;throw new Error("Number too big 0x"+G.toString(16))}if(G>=-32)return q.setInt8(Y,G),1;if(G>=-128)return q.setUint8(Y,208),q.setInt8(Y+1,G),2;if(G>=-32768)return q.setUint8(Y,209),q.setInt16(Y+1,G),3;if(G>=-2147483648)return q.setUint8(Y,210),q.setInt32(Y+1,G),5;throw new Error("Number too small -0x"+(-G).toString(16).substr(1))}if(G===null)return q.setUint8(Y,192),1;if(pe==="boolean")return q.setUint8(Y,G?195:194),1;if(pe==="object"){var Me,nt=0,Ee=Array.isArray(G);if(Ee)Me=G.length;else{var je=Object.keys(G);Me=je.length}var nt;if(16>Me?(q.setUint8(Y,Me|(Ee?144:128)),nt=1):65536>Me?(q.setUint8(Y,Ee?220:222),q.setUint16(Y+1,Me),nt=3):4294967296>Me&&(q.setUint8(Y,Ee?221:223),q.setUint32(Y+1,Me),nt=5),Ee)for(var ft=0;Me>ft;ft++)nt+=u(G[ft],q,Y+nt);else for(var ft=0;Me>ft;ft++){var se=je[ft];nt+=u(se,q,Y+nt),nt+=u(G[se],q,Y+nt)}return nt}throw new Error("Unknown type "+pe)}function d(G){var q=typeof G;if(q==="string"){var Y=c(G);if(32>Y)return 1+Y;if(256>Y)return 2+Y;if(65536>Y)return 3+Y;if(4294967296>Y)return 5+Y}if(G instanceof Uint8Array){var Y=G.byteLength;if(256>Y)return 2+Y;if(65536>Y)return 3+Y;if(4294967296>Y)return 5+Y}if(q==="number"){if(Math.floor(G)!==G)return 9;if(G>=0){if(128>G)return 1;if(256>G)return 2;if(65536>G)return 3;if(4294967296>G)return 5;throw new Error("Number too big 0x"+G.toString(16))}if(G>=-32)return 1;if(G>=-128)return 2;if(G>=-32768)return 3;if(G>=-2147483648)return 5;throw new Error("Number too small -0x"+G.toString(16).substr(1))}if(q==="boolean"||G===null)return 1;if(q==="object"){var Y,pe=0;if(Array.isArray(G)){Y=G.length;for(var Me=0;Y>Me;Me++)pe+=d(G[Me])}else{var De=Object.keys(G);Y=De.length;for(var Me=0;Y>Me;Me++){var Ee=De[Me];pe+=d(Ee)+d(G[Ee])}}if(16>Y)return 1+pe;if(65536>Y)return 3+pe;if(4294967296>Y)return 5+pe;throw new Error("Array or object too long 0x"+Y.toString(16))}throw new Error("Unknown type "+q)}function p(G){var q=new ArrayBuffer(d(G));return u(G,new DataView(q),0),new Uint8Array(q)}function g(G,q,Y){return q?new G(q.buffer,q.byteOffset,q.byteLength/(Y||1)):void 0}function v(G){return g(DataView,G)}function y(G){return g(Uint8Array,G)}function S(G){return g(Int8Array,G)}function E(G){return g(Int32Array,G,4)}function w(G){return g(Float32Array,G,4)}function b(G,q){var Y=G.length/2;q||(q=new Int16Array(Y));for(var pe=0,Me=0;Y>pe;++pe,Me+=2)q[pe]=G[Me]<<8^G[Me+1]<<0;return q}function T(G,q){var Y=G.length;q||(q=new Uint8Array(2*Y));for(var pe=v(q),Me=0;Y>Me;++Me)pe.setInt16(2*Me,G[Me]);return y(q)}function L(G,q){var Y=G.length/4;q||(q=new Int32Array(Y));for(var pe=0,Me=0;Y>pe;++pe,Me+=4)q[pe]=G[Me]<<24^G[Me+1]<<16^G[Me+2]<<8^G[Me+3]<<0;return q}function C(G,q){var Y=G.length;q||(q=new Uint8Array(4*Y));for(var pe=v(q),Me=0;Y>Me;++Me)pe.setInt32(4*Me,G[Me]);return y(q)}function P(G,q){var Y=G.length;q||(q=new Float32Array(Y/4));for(var pe=v(q),Me=v(G),De=0,Ee=0,je=Y/4;je>De;++De,Ee+=4)pe.setFloat32(Ee,Me.getFloat32(Ee),!0);return q}function O(G,q,Y){var pe=G.length,Me=1/q;Y||(Y=new Float32Array(pe));for(var De=0;pe>De;++De)Y[De]=G[De]*Me;return Y}function B(G,q,Y){var pe=G.length;Y||(Y=new Int32Array(pe));for(var Me=0;pe>Me;++Me)Y[Me]=Math.round(G[Me]*q);return Y}function U(G,q){var Y,pe;if(!q){var Me=0;for(Y=0,pe=G.length;pe>Y;Y+=2)Me+=G[Y+1];q=new G.constructor(Me)}var De=0;for(Y=0,pe=G.length;pe>Y;Y+=2)for(var Ee=G[Y],je=G[Y+1],nt=0;je>nt;++nt)q[De]=Ee,++De;return q}function I(G){if(G.length===0)return new Int32Array;var q,Y,pe=2;for(q=1,Y=G.length;Y>q;++q)G[q-1]!==G[q]&&(pe+=2);var Me=new Int32Array(pe),De=0,Ee=1;for(q=1,Y=G.length;Y>q;++q)G[q-1]!==G[q]?(Me[De]=G[q-1],Me[De+1]=Ee,Ee=1,De+=2):++Ee;return Me[De]=G[G.length-1],Me[De+1]=Ee,Me}function z(G,q){var Y=G.length;q||(q=new G.constructor(Y)),Y&&(q[0]=G[0]);for(var pe=1;Y>pe;++pe)q[pe]=G[pe]+q[pe-1];return q}function te(G,q){var Y=G.length;q||(q=new G.constructor(Y)),q[0]=G[0];for(var pe=1;Y>pe;++pe)q[pe]=G[pe]-G[pe-1];return q}function oe(G,q){var Y,pe,Me=G instanceof Int8Array?127:32767,De=-Me-1,Ee=G.length;if(!q){var je=0;for(Y=0;Ee>Y;++Y)G[Y]<Me&&G[Y]>De&&++je;q=new Int32Array(je)}for(Y=0,pe=0;Ee>Y;){for(var nt=0;G[Y]===Me||G[Y]===De;)nt+=G[Y],++Y;nt+=G[Y],++Y,q[pe]=nt,++pe}return q}function ee(G,q){var Y,pe=q?127:32767,Me=-pe-1,De=G.length,Ee=0;for(Y=0;De>Y;++Y){var je=G[Y];je===0?++Ee:Ee+=je===pe||je===Me?2:je>0?Math.ceil(je/pe):Math.ceil(je/Me)}var nt=q?new Int8Array(Ee):new Int16Array(Ee),ft=0;for(Y=0;De>Y;++Y){var je=G[Y];if(je>=0)for(;je>=pe;)nt[ft]=pe,++ft,je-=pe;else for(;Me>=je;)nt[ft]=Me,++ft,je-=Me;nt[ft]=je,++ft}return nt}function k(G,q){return z(U(G),q)}function X(G){return I(te(G))}function $(G,q,Y){return O(U(G,E(Y)),q,Y)}function j(G,q){return I(B(G,q))}function J(G,q,Y){return O(z(G,E(Y)),q,Y)}function xe(G,q,Y){return te(B(G,q),Y)}function de(G,q,Y){return O(oe(G,E(Y)),q,Y)}function fe(G,q,Y){var pe=oe(G,E(Y));return J(pe,q,w(pe))}function F(G,q,Y){return ee(xe(G,q),Y)}function re(De){var q=v(De),Y=q.getInt32(0),pe=q.getInt32(4),Me=De.subarray(8,12),De=De.subarray(12);return[Y,De,pe,Me]}function ue(G,q,Y,pe){var Me=new ArrayBuffer(12+pe.byteLength),De=new Uint8Array(Me),Ee=new DataView(Me);return Ee.setInt32(0,G),Ee.setInt32(4,q),Y&&De.set(Y,8),De.set(pe,12),De}function _e(G){var q=G.length;return ue(2,q,void 0,y(G))}function Le(G){var q=G.length;return ue(4,q,void 0,C(G))}function Fe(G,q){return ue(5,G.length/q,C([q]),y(G))}function Xe(G){var q=G.length;return ue(6,q,void 0,C(I(G)))}function lt(G){var q=G.length;return ue(8,q,void 0,C(X(G)))}function mt(G,q){var Y=G.length;return ue(9,Y,C([q]),C(j(G,q)))}function ne(G,q){var Y=G.length;return ue(10,Y,C([q]),T(F(G,q)))}function Be(G){var q={};return ie.forEach(function(Y){G[Y]!==void 0&&(q[Y]=G[Y])}),G.bondAtomList&&(q.bondAtomList=Le(G.bondAtomList)),G.bondOrderList&&(q.bondOrderList=_e(G.bondOrderList)),q.xCoordList=ne(G.xCoordList,1e3),q.yCoordList=ne(G.yCoordList,1e3),q.zCoordList=ne(G.zCoordList,1e3),G.bFactorList&&(q.bFactorList=ne(G.bFactorList,100)),G.atomIdList&&(q.atomIdList=lt(G.atomIdList)),G.altLocList&&(q.altLocList=Xe(G.altLocList)),G.occupancyList&&(q.occupancyList=mt(G.occupancyList,100)),q.groupIdList=lt(G.groupIdList),q.groupTypeList=Le(G.groupTypeList),G.secStructList&&(q.secStructList=_e(G.secStructList,1)),G.insCodeList&&(q.insCodeList=Xe(G.insCodeList)),G.sequenceIndexList&&(q.sequenceIndexList=lt(G.sequenceIndexList)),q.chainIdList=Fe(G.chainIdList,4),G.chainNameList&&(q.chainNameList=Fe(G.chainNameList,4)),q}function Ne(G){function q(nt){for(var ft={},se=0;nt>se;se++){var Ze=De();ft[Ze]=De()}return ft}function Y(nt){var ft=G.subarray(Ee,Ee+nt);return Ee+=nt,ft}function pe(nt){var ft=G.subarray(Ee,Ee+nt);Ee+=nt;var se=65535;if(nt>se){for(var Ze=[],Se=0;Se<ft.length;Se+=se)Ze.push(String.fromCharCode.apply(null,ft.subarray(Se,Se+se)));return Ze.join("")}return String.fromCharCode.apply(null,ft)}function Me(nt){for(var ft=new Array(nt),se=0;nt>se;se++)ft[se]=De();return ft}function De(){var nt,ft,se=G[Ee];if((128&se)===0)return Ee++,se;if((240&se)===128)return ft=15&se,Ee++,q(ft);if((240&se)===144)return ft=15&se,Ee++,Me(ft);if((224&se)===160)return ft=31&se,Ee++,pe(ft);if((224&se)===224)return nt=je.getInt8(Ee),Ee++,nt;switch(se){case 192:return Ee++,null;case 194:return Ee++,!1;case 195:return Ee++,!0;case 196:return ft=je.getUint8(Ee+1),Ee+=2,Y(ft);case 197:return ft=je.getUint16(Ee+1),Ee+=3,Y(ft);case 198:return ft=je.getUint32(Ee+1),Ee+=5,Y(ft);case 202:return nt=je.getFloat32(Ee+1),Ee+=5,nt;case 203:return nt=je.getFloat64(Ee+1),Ee+=9,nt;case 204:return nt=G[Ee+1],Ee+=2,nt;case 205:return nt=je.getUint16(Ee+1),Ee+=3,nt;case 206:return nt=je.getUint32(Ee+1),Ee+=5,nt;case 208:return nt=je.getInt8(Ee+1),Ee+=2,nt;case 209:return nt=je.getInt16(Ee+1),Ee+=3,nt;case 210:return nt=je.getInt32(Ee+1),Ee+=5,nt;case 217:return ft=je.getUint8(Ee+1),Ee+=2,pe(ft);case 218:return ft=je.getUint16(Ee+1),Ee+=3,pe(ft);case 219:return ft=je.getUint32(Ee+1),Ee+=5,pe(ft);case 220:return ft=je.getUint16(Ee+1),Ee+=3,Me(ft);case 221:return ft=je.getUint32(Ee+1),Ee+=5,Me(ft);case 222:return ft=je.getUint16(Ee+1),Ee+=3,q(ft);case 223:return ft=je.getUint32(Ee+1),Ee+=5,q(ft)}throw new Error("Unknown type 0x"+se.toString(16))}var Ee=0,je=new DataView(G.buffer);return De()}function ve(G,q,Y,pe){switch(G){case 1:return P(q);case 2:return S(q);case 3:return b(q);case 4:return L(q);case 5:return y(q);case 6:return U(L(q),new Uint8Array(Y));case 7:return U(L(q));case 8:return k(L(q));case 9:return $(L(q),L(pe)[0]);case 10:return fe(b(q),L(pe)[0]);case 11:return O(b(q),L(pe)[0]);case 12:return de(b(q),L(pe)[0]);case 13:return de(S(q),L(pe)[0]);case 14:return oe(b(q));case 15:return oe(S(q))}}function ye(G,q){q=q||{};var Y=q.ignoreFields,pe={};return Z.forEach(function(Me){var De=Y?Y.indexOf(Me)!==-1:!1,Ee=G[Me];De||Ee===void 0||(Ee instanceof Uint8Array?pe[Me]=ve.apply(null,re(Ee)):pe[Me]=Ee)}),pe}function et(G){return String.fromCharCode.apply(null,G).replace(/\0/g,"")}function tt(G,q,Y){Y=Y||{};var pe,Me,De,Ee,je,nt,ft=Y.firstModelOnly,se=q.onModel,Ze=q.onChain,Se=q.onGroup,Ke=q.onAtom,le=q.onBond,At=0,be=0,Yt=0,ke=0,Nt=0,hn=-1,Gn=G.chainNameList,Di=G.secStructList,Gi=G.insCodeList,Ci=G.sequenceIndexList,bn=G.atomIdList,mi=G.bFactorList,Xr=G.altLocList,Ls=G.occupancyList,Ps=G.bondAtomList,fr=G.bondOrderList;for(pe=0,Me=G.chainsPerModel.length;Me>pe&&!(ft&&At>0);++pe){var K=G.chainsPerModel[At];for(se&&se({chainCount:K,modelIndex:At}),De=0;K>De;++De){var Re=G.groupsPerChain[be];if(Ze){var $e=et(G.chainIdList.subarray(4*be,4*be+4)),Ae=null;Gn&&(Ae=et(Gn.subarray(4*be,4*be+4))),Ze({groupCount:Re,chainIndex:be,modelIndex:At,chainId:$e,chainName:Ae})}for(Ee=0;Re>Ee;++Ee){var qe=G.groupList[G.groupTypeList[Yt]],xt=qe.atomNameList.length;if(Se){var Dt=null;Di&&(Dt=Di[Yt]);var Rt=null;G.insCodeList&&(Rt=String.fromCharCode(Gi[Yt]));var Vt=null;Ci&&(Vt=Ci[Yt]),Se({atomCount:xt,groupIndex:Yt,chainIndex:be,modelIndex:At,groupId:G.groupIdList[Yt],groupType:G.groupTypeList[Yt],groupName:qe.groupName,singleLetterCode:qe.singleLetterCode,chemCompType:qe.chemCompType,secStruct:Dt,insCode:Rt,sequenceIndex:Vt})}for(je=0;xt>je;++je){if(Ke){var jt=null;bn&&(jt=bn[ke]);var zt=null;mi&&(zt=mi[ke]);var It=null;Xr&&(It=String.fromCharCode(Xr[ke]));var yn=null;Ls&&(yn=Ls[ke]),Ke({atomIndex:ke,groupIndex:Yt,chainIndex:be,modelIndex:At,atomId:jt,element:qe.elementList[je],atomName:qe.atomNameList[je],formalCharge:qe.formalChargeList[je],xCoord:G.xCoordList[ke],yCoord:G.yCoordList[ke],zCoord:G.zCoordList[ke],bFactor:zt,altLoc:It,occupancy:yn})}ke+=1}if(le){var Kt=qe.bondAtomList;for(je=0,nt=qe.bondOrderList.length;nt>je;++je)le({atomIndex1:ke-xt+Kt[2*je],atomIndex2:ke-xt+Kt[2*je+1],bondOrder:qe.bondOrderList[je]})}Yt+=1}be+=1}if(Nt=hn+1,hn=ke-1,le&&Ps)for(je=0,nt=Ps.length;nt>je;je+=2){var Ri=Ps[je],Hi=Ps[je+1];(Ri>=Nt&&hn>=Ri||Hi>=Nt&&hn>=Hi)&&le({atomIndex1:Ri,atomIndex2:Hi,bondOrder:fr?fr[je/2]:null})}At+=1}}function _t(G){return p(Be(G))}function St(G,q){G instanceof ArrayBuffer&&(G=new Uint8Array(G));var Y;return Y=G instanceof Uint8Array?Ne(G):G,ye(Y,q)}function Mt(G,q,Y,pe){function Me(){try{Y(St(De.response))}catch(Ee){pe(Ee)}}var De=new XMLHttpRequest;De.addEventListener("load",Me,!0),De.addEventListener("error",pe,!0),De.responseType="arraybuffer",De.open("GET",q+G.toUpperCase()),De.send()}function Bt(G,q,Y){Mt(G,gt,q,Y)}function Ft(G,q,Y){Mt(G,dt,q,Y)}var ie=["mmtfVersion","mmtfProducer","unitCell","spaceGroup","structureId","title","depositionDate","releaseDate","experimentalMethods","resolution","rFree","rWork","bioAssemblyList","ncsOperatorList","entityList","groupList","numBonds","numAtoms","numGroups","numChains","numModels","groupsPerChain","chainsPerModel"],Z=ie.concat(["xCoordList","yCoordList","zCoordList","groupIdList","groupTypeList","chainIdList","bFactorList","atomIdList","altLocList","occupancyList","secStructList","insCodeList","sequenceIndexList","chainNameList","bondAtomList","bondOrderList"]),Ve="v1.1.0dev",ut="//mmtf.rcsb.org/v1.0/",gt=ut+"full/",dt=ut+"reduced/";s.encode=_t,s.decode=St,s.traverse=tt,s.fetch=Bt,s.fetchReduced=Ft,s.version=Ve,s.fetchUrl=gt,s.fetchReducedUrl=dt,s.encodeMsgpack=p,s.encodeMmtf=Be,s.decodeMsgpack=Ne,s.decodeMmtf=ye})})},GT={};function Ts(e){var t=GT[e];if(t!==void 0)return t.exports;var n=GT[e]={exports:{}};return oV[e].call(n.exports,n,n.exports,Ts),n.exports}Ts.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return Ts.d(t,{a:t}),t};Ts.d=(e,t)=>{for(var n in t)Ts.o(t,n)&&!Ts.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})};Ts.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var fP={};Ts.d(fP,{A:()=>_j});var aV=e=>{var t={};return Ts.d(t,e),t},We=aV({default:()=>jO.default}),R=YO,fx=function(){return fx=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},fx.apply(this,arguments)},lV={lines:12,length:7,width:5,radius:10,scale:1,corners:1,color:"#000",fadeColor:"transparent",animation:"spinner-line-fade-default",rotate:0,direction:1,speed:1,zIndex:2e9,className:"spinner",top:"50%",left:"50%",shadow:"0 0 1px transparent",position:"absolute"},cV=(function(){function e(t){t===void 0&&(t={}),this.opts=fx(fx({},lV),t)}return e.prototype.spin=function(t){return this.stop(),this.el=document.createElement("div"),this.el.className=this.opts.className,this.el.setAttribute("role","progressbar"),this.el.style.position=this.opts.position,this.el.style.width="0",this.el.style.zIndex=this.opts.zIndex.toString(),this.el.style.left=this.opts.left,this.el.style.top=this.opts.top,this.el.style.transform="scale(".concat(this.opts.scale,")"),t&&t.insertBefore(this.el,t.firstChild||null),uV(this.el,this.opts),this},e.prototype.stop=function(){return this.el&&(this.el.parentNode&&this.el.parentNode.removeChild(this.el),this.el=void 0),this},e})();function HT(e,t){return typeof e=="string"?e:e[t%e.length]}function uV(e,t){var n=Math.round(t.corners*t.width*500)/1e3+"px",i="none";t.shadow===!0?i="0 2px 4px #000":typeof t.shadow=="string"&&(i=t.shadow);for(var r=hV(i),s=0;s<t.lines;s++){var a=~~(360/t.lines*s+t.rotate),c=document.createElement("div");c.style.position="absolute",c.style.top="".concat(-t.width/2,"px"),c.style.width=t.length+t.width+"px",c.style.height=t.width+"px",c.style.background=HT(t.fadeColor,s),c.style.borderRadius=n,c.style.transformOrigin="left",c.style.transform="rotate(".concat(a,"deg) translateX(").concat(t.radius,"px)");var u=s*t.direction/t.lines/t.speed;u-=1/t.speed;var d=document.createElement("div");d.style.width="100%",d.style.height="100%",d.style.background=HT(t.color,s),d.style.borderRadius=n,d.style.boxShadow=fV(r,a),d.style.animation="".concat(1/t.speed,"s linear ").concat(u,"s infinite ").concat(t.animation),c.appendChild(d),e.appendChild(c)}}function hV(e){for(var t=/^\s*([a-zA-Z]+\s+)?(-?\d+(\.\d+)?)([a-zA-Z]*)\s+(-?\d+(\.\d+)?)([a-zA-Z]*)(.*)$/,n=[],i=0,r=e.split(",");i<r.length;i++){var s=r[i].match(t);if(s!==null){var a=+s[2],c=+s[5],u=s[4],d=s[7];a===0&&!u&&(u=d),c===0&&!d&&(d=u),u===d&&n.push({prefix:s[1]||"",x:a,y:c,xUnits:u,yUnits:d,end:s[8]})}}return n}function fV(e,t){for(var n=[],i=0,r=e;i<r.length;i++){var s=r[i],a=dV(s.x,s.y,t);n.push(s.prefix+a[0]+s.xUnits+" "+a[1]+s.yUnits+s.end)}return n.join(", ")}function dV(e,t,n){var i=n*Math.PI/180,r=Math.sin(i),s=Math.cos(i);return[Math.round((e*s+t*r)*1e3)/1e3,Math.round((-e*r+t*s)*1e3)/1e3]}var qx=class oM{constructor(){this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=oM.now(),this.oldTime=this.startTime,this.running=!0}stop(){this.getElapsedTime(),this.running=!1}getElapsedTime(){return this.update(),this.elapsedTime}update(){let t=0;if(this.running){const n=oM.now();t=.001*(n-this.oldTime),this.oldTime=n,this.elapsedTime+=t}return t}};qx.now=(function(){const e=typeof window<"u"&&window.performance;return e&&e.now?e.now.bind(e):Date.now})();var{now:WT}=qx;function XT(e,t,n){const i=document.createElement(e);return i.id=t,i.style.cssText=n,i}var pV=class{constructor(){this.domElement=XT("div","stats","padding:8px"),this._text=XT("p","fps","margin:0;color:silver;font-size:large"),this.domElement.appendChild(this._text),this._startTime=WT(),this._prevTime=this._startTime,this._deltas=new Array(20),this._index=0,this._total=0,this._count=0}end(){const e=WT(),t=e-this._startTime;return this._count<this._deltas.length?this._count++:this._total-=this._deltas[this._index],this._total+=t,this._deltas[this._index]=t,this._index=(this._index+1)%this._deltas.length,this.ms=this._total/this._count,this.fps=1e3/this.ms,e>this._prevTime+1e3&&(this._text.textContent=this.fps.toPrecision(2),this._prevTime=e),e}update(){this._startTime=this.end()}show(e){e===void 0&&(e=!0),this.domElement.style.display=e?"block":"none"}},mV=pV;function h2(e,t){return!e||e===t}function $x(){this._handlers={}}$x.prototype.addEventListener=function(e,t,n){let i=this._handlers[e];i||(this._handlers[e]=[],i=this._handlers[e]);const r=[t,n];function s(a){return a[0]===r[0]&&a[1]===r[1]}We.default.find(i,s)===void 0&&i.push(r)};$x.prototype.removeEventListener=function(e,t,n){const i=this;We.default.forEach(i._handlers,(r,s)=>{We.default.remove(r,a=>h2(e,s)&&h2(t,a[0])&&h2(n,a[1]||i))}),this._handlers=We.default.omitBy(i._handlers,r=>r.length===0)};$x.prototype.dispatchEvent=function(e){const t=this;We.default.forEach(this._handlers[e.type],n=>{const i=n[1]||t;n[0].apply(i,[e])})};var eo=$x,ca={debug:0,info:1,report:2,warn:3,error:4};function ls(){eo.call(this),this.console=!1,this._priority=ca.warn}ls.prototype=Object.create(eo.prototype);ls.prototype.constructor=ls;ls.prototype.instantiate=function(){return new ls};function dP(e){if(!We.default.isNumber(e))throw new Error("Wrong log level specified!");return e}Object.defineProperty(ls.prototype,"level",{get(){return We.default.findKey(ca,e=>e===this._priority)},set(e){this._priority=dP(ca[e])}});ls.prototype.levels=function(){return Object.keys(ca)};ls.prototype.message=function(e,t){const n=dP(ca[e]);this._message(n,t)};ls.prototype.debug=function(e){this._message(ca.debug,e)};ls.prototype.info=function(e){this._message(ca.info,e)};ls.prototype.report=function(e){this._message(ca.report,e)};ls.prototype.warn=function(e){this._message(ca.warn,e)};ls.prototype.error=function(e){this._message(ca.error,e)};ls.prototype._message=function(e,t){if(e<this._priority)return;const n=We.default.findKey(ca,i=>i===e);if(t=String(t),this.console){const i=`miew:${n}: ${t}`;n==="error"?console.error(i):n==="warn"?console.warn(i):console.log(i)}this.dispatchEvent({type:"message",level:n,message:t})};var Qi=new ls,aM={DEFAULT:0,SAFARI:1};function gV(e,t){const n=i=>String.fromCharCode(parseInt(i.substr(1),16));return encodeURIComponent(e).replace(t,n).replace(/%20/g,"+")}function lM(e){return decodeURIComponent(e.replace(/\+/g," "))}function pP(e){e=e||window.location.search;const t=e.substring(e.indexOf("?")+1),n=/([^&=]+)=?([^&]*)/g,i=[];let r;for(;(r=n.exec(t))!==null;)i.push([lM(r[1]),lM(r[2])]);return i}function _V(e){const t={},n=pP(e);for(let i=0;i<n.length;++i){const[r,s]=n[i];t[r]=s}return t}function vV(e){if(typeof URL<"u")try{return typeof window<"u"?new URL(e,window.location).href:new URL(e).href}catch{}if(typeof document<"u"){const t=document.createElement("a");return t.href=e,t.href}return e}function yV(e){const t=[];for(let i=0,r=e.length;i<r;++i)t[t.length]=e[i].charCodeAt(0).toString(16);const n=t.join("|");return new RegExp(`%(?:${n})`,"gi")}function xV(e,t,n){const i=document.createElement(e);let r,s;if(t){const a=Object.keys(t);for(r=0,s=a.length;r<s;++r){const c=a[r];i.setAttribute(c,t[c])}}if(n)for(n instanceof Array||(n=[n]),r=0,s=n.length;r<s;++r){const a=n[r];typeof a=="string"?i.appendChild(document.createTextNode(a)):a instanceof HTMLElement&&i.appendChild(a)}return i}function SV(e,t,n,i){return e.prototype=We.default.assign(Object.create(t.prototype),{constructor:e},n),i&&We.default.assign(e,i),e}function cM(e,t){let n=e,i,r;if(e instanceof Array)for(n=new Array(e.length),i=0,r=e.length;i<r;++i)n[i]=cM(e[i]);else if(e instanceof Object){n=Object.create(e);const s=Object.keys(e);for(i=0,r=s.length;i<r;++i){const a=s[i],c=e[a],u=cM(c);u!==c&&(n[a]=u)}t&&Object.keys(n).length>0&&(n=Object.create(n))}return n}function bV(e){return`#${`0000000${e.toString(16)}`.substr(-6)}`}function Ww(e){let t=!1;this.enable=function(s){t=s};let n=0;const i=Object.keys(e);function r(s,a){return function(){const c=Ww.spaces.substr(0,n*2);t&&Qi.debug(`${c+a} {`),n++;for(var u=arguments.length,d=new Array(u),p=0;p<u;p++)d[p]=arguments[p];const g=s.apply(this,d);return n--,t&&Qi.debug(`${c}} // ${a}`),g}}for(let s=0,a=i.length;s<a;++s){const c=i[s],u=e[c];u instanceof Function&&c!=="constructor"&&(e[c]=r(u,c))}}Ww.spaces=" ";var mP=class extends Error{constructor(e){super(),this.name="OutOfMemoryError",this.message=e}};function MV(e,t){let n=null;try{n=new e(t)}catch(i){throw i instanceof RangeError?new mP(i.message):i}return n}function gP(e){const t=new Uint8Array(e);let n="";for(let i=0;i<t.byteLength;i++)n+=String.fromCharCode(t[i]);return window.btoa(n)}function Xw(e){const t=window.atob(e),n=new Uint8Array(t.length);for(let i=0;i<n.length;++i)n[i]=t[i].charCodeAt(0);return n.buffer}function wV(e,t){return gP(new t(e).buffer)}function AV(e,t){return Array.prototype.slice.call(new t(Xw(e)))}function EV(e,t){const n=[];if(t&&e){const i=Object.keys(e);for(let r=0;r<i.length;++r){const s=i[r],a=e[s];!(a instanceof Object)&&typeof t[s]<"u"&&t[s]!==a&&n.push(`${s}:${a}`)}if(n.length>0)return`!${n.join()}`}return""}function uM(e){if(We.default.isPlainObject(e))return!0;const t=e&&Object.getPrototypeOf(e);return!!t&&!t.hasOwnProperty("constructor")&&uM(t)}function _P(e,t){const n={};return We.default.forIn(e,(i,r)=>{const s=t[r];if(uM(i)&&uM(s)){const a=_P(i,s);We.default.isEmpty(a)||(n[r]=a)}else We.default.isEqual(i,s)||(n[r]=i)}),n}function TV(e,t){function n(i,r){We.default.forIn(i,(s,a)=>{const c=r+(r.length>0?".":"");s instanceof Object?n(s,c+a):s!==void 0&&t(s,c+a)})}n(e,"")}function CV(e){return We.default.isString(e)?`"${e.replace(/"/g,'\\"')}"`:e}function RV(e){if(!We.default.isString(e))return e;if(e[0]==='"'&&e[e.length-1]==='"')return e=e.slice(1,e.length-1),e.replace(/\\"/g,'"');if(e[0]==="'"&&e[e.length-1]==="'")return e=e.slice(1,e.length-1),e.replace(/\\'/g,"'");throw new SyntaxError("Incorrect string format, can't unqute it")}function vP(e){return e.slice(Math.max(0,e.lastIndexOf("."))||1/0)}function LV(e){const t=vP(e);return[e.slice(0,e.length-t.length),t]}function jT(e){const t=e.split(/[:;,]/),n=t.length;return n>=3&&t[n-2]==="base64"?new Blob([Xw(t[n-1])]):null}function PV(){return navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&navigator.userAgent.indexOf("CriOS")===-1&&navigator.userAgent.indexOf("FxiOS")===-1?aM.SAFARI:aM.DEFAULT}function NV(e){typeof window<"u"&&window.open().document.write(`<body style="margin:0"><img src="${e}" /></body>`)}function IV(e,t){if(!(!e||e.substr(0,5)!=="data:")){if(t||(t=["screenshot-",+new Date,".png"].join("")),typeof window<"u"&&window.navigator&&window.navigator.msSaveBlob)window.navigator.msSaveBlob(jT(e),t);else if(typeof document<"u"){const n=document.createElement("a");n.download=t,n.innerHTML="download",n.href=window.URL.createObjectURL(jT(e)),document.body.appendChild(n),n.click(),document.body.removeChild(n)}}}function OV(e,t,n){const i=new Blob([e]);if(t||(t=["data",+new Date].join("")),n?t+=`.${n}`:t+=i.type||".bin",typeof window<"u"&&window.navigator&&window.navigator.msSaveBlob)window.navigator.msSaveBlob(i,t);else if(typeof document<"u"){const r=document.createElement("a");r.download=t,r.innerHTML="download",r.href=window.URL.createObjectURL(i),document.body.appendChild(r),r.click(),document.body.removeChild(r)}}function DV(e,t,n,i){for(let r=0,s=n.length;r<s;++r)for(let a=0;a<i;++a)t[r*i+a]=e[n[r]*i+a]}function zV(e){const t=e.cloneNode(!0);return t.worldPos=e.worldPos,t}var UV=/^[a-zA-Z0-9_]*$/,YT=['"',"",'"'];function BV(e){return UV.test(e)?e:(YT[1]=e,YT.join(""))}function VV(e,t){const n=new e.constructor(e.length+t.length);return n.set(e),n.set(t,e.length),n}function FV(e){if(e.length<=0)return null;const t=e.reduce((i,r)=>i+r.length,0),n=new e[0].constructor(t);for(let i=0,r=0;i<e.length;i++){const s=e[i].length;n.set(e[i],r),r+=s}return n}var rt={browserType:aM,encodeQueryComponent:gV,decodeQueryComponent:lM,getUrlParameters:pP,getUrlParametersAsDict:_V,resolveURL:vV,generateRegExp:yV,createElement:xV,deriveClass:SV,deriveDeep:cM,hexColor:bV,DebugTracer:Ww,OutOfMemoryError:mP,allocateTyped:MV,bytesFromBase64:Xw,bytesToBase64:gP,arrayFromBase64:AV,arrayToBase64:wV,compareOptionsWithDefaults:EV,objectsDiff:_P,forInRecursive:TV,enquoteString:CV,unquoteString:RV,getBrowser:PV,shotOpen:NV,shotDownload:IV,copySubArrays:DV,shallowCloneNode:zV,correctSelectorIdentifier:BV,getFileExtension:vP,splitFileName:LV,download:OV,concatTypedArraysUnsafe:VV,mergeTypedArraysUnsafe:FV},kV=class extends eo{constructor(){super(),this._shouldCancel=!1}cancel(){this._shouldCancel=!0,this.dispatchEvent({type:"cancel"})}shouldCancel(){return this._shouldCancel}notify(e){this.dispatchEvent({type:"notification",slaveEvent:e})}},qT=0,M1={modes:{BS:{atom:.23,bond:.15,space:.5,multibond:!0,aromrad:.1,showarom:!0,polyComplexity:{poor:3,low:4,medium:6,high:12,ultra:32}},VW:{polyComplexity:{poor:4,low:6,medium:8,high:16,ultra:32}},LN:{multibond:!0,showarom:!0,offsarom:.2,chunkarom:10,atom:.23,lineWidth:2},LC:{bond:.2,space:0,multibond:!0,aromrad:.1,showarom:!0,polyComplexity:{poor:3,low:4,medium:6,high:12,ultra:32}},SA:{zClip:!1,probeRadius:1.5,subset:"",wireframe:!1,polyComplexity:{poor:6,low:8,medium:16,high:30,ultra:60}},SE:{zClip:!1,probeRadius:1.5,subset:"",wireframe:!1,polyComplexity:{poor:6,low:8,medium:16,high:30,ultra:60}},QS:{isoValue:.5,gaussLim:{poor:1.5,low:2,medium:2.5,high:3,ultra:4},scale:1,wireframe:!1,gridSpacing:{poor:2,low:1.5,medium:1,high:.5,ultra:.25},subset:"",zClip:!1},CS:{probeRadius:1.4,isoValue:1.5,wireframe:!1,probePositions:30,polyComplexity:{poor:.5,low:1,medium:1.5,high:1.75,ultra:2},subset:"",zClip:!1},TR:{radius:.3,polyComplexity:{poor:12,low:16,medium:32,high:64,ultra:64}},TU:{radius:.3,heightSegmentsRatio:1.5,tension:-.7,polyComplexity:{poor:4,low:6,medium:10,high:18,ultra:34}},CA:{radius:.3,depth:.25,ss:{helix:{width:1,arrow:2},strand:{width:1,arrow:2}},heightSegmentsRatio:1.5,tension:-.7,polyComplexity:{poor:4,low:6,medium:10,high:18,ultra:34}},TX:{template:"{{Chain}}.{{Residue}}{{Sequence}}.{{Name}}",horizontalAlign:"center",verticalAlign:"middle",dx:0,dy:0,dz:1,fg:"none",bg:"0x202020",showBg:!0},VD:{kSigma:1,kSigmaMed:2,kSigmaMax:4,frame:!0,isoMode:!1,polyComplexity:{poor:2,low:3,medium:4,high:8,ultra:10}}},colorers:{EL:{carbon:-1},UN:{color:16777215},CO:{subset:"charged",color:16711680,baseColor:16777215},CB:{color:9474192,factor:.6},SQ:{gradient:"rainbow"},TM:{gradient:"temp",min:5,max:40},OC:{gradient:"reds"},HY:{gradient:"blue-red"},MO:{gradient:"rainbow"}},antialias:!0,camFov:45,camNear:.5,camFar:100,camDistance:2.5,radiusToFit:1,fogNearFactor:.5,fogFarFactor:1,fogAlpha:1,fogColor:0,fogColorEnable:!1,palette:"JM",resolution:"medium",autoResolution:!1,autoPreset:!0,preset:"default",presets:{default:[{mode:"BS",colorer:"EL",selector:"all",material:"SF"}],empty:[],wire:[{mode:"LN",colorer:"EL",selector:"all",material:"SF"}],small:[{mode:"BS",colorer:"EL",selector:"all",material:"SF"}],macro:[{mode:"CA",colorer:"SS",selector:"not hetatm",material:"SF"},{mode:"BS",colorer:"EL",selector:"hetatm and not water",material:"SF"}]},objects:{line:{color:4294967295,dashSize:.3,gapSize:.05}},bg:{color:2105376,transparent:!1},draft:{clipPlane:!1,clipPlaneFactor:.5,clipPlaneSpeed:3e-5},plugins:{},axes:!0,fog:!0,fps:!0,zSprites:!0,isoSurfaceFakeOpacity:!0,suspendRender:!0,nowater:!1,autobuild:!0,fxaa:!0,outline:{on:!1,color:0,threshold:.1,thickness:1},ao:!1,shadow:{on:!1,type:"random",radius:1},autoRotation:0,maxfps:30,fbxprec:4,autoRotationAxisFixed:!0,zooming:!0,picking:!0,pick:"atom",editing:!1,aromatic:!1,singleUnit:!0,stereo:"NONE",interpolateViews:!0,transparency:"prepass",translationSpeed:2,debug:{example:3.5,text:"hello!",good:!0,ssaoKernelRadius:.7,ssaoFactor:.7,stereoBarrel:.25},use:{multiFile:!1}};function yP(){eo.call(this),this.old=null,this.now={},this._changed={},this.reset()}rt.deriveClass(yP,eo,{defaults:M1,set(e,t){if(We.default.isString(e))We.default.get(this.now,e)!==t&&(We.default.set(this.now,e,t),this._notifyChange(e,t));else{const n=rt.objectsDiff(e,this.now);We.default.isEmpty(n)||(We.default.merge(this.now,n),this._notifyChanges(n))}},get(e,t){return We.default.get(this.now,e,t)},reset(){const e=rt.objectsDiff(M1,this.now);this.now=We.default.cloneDeep(M1),this.old=null,this._notifyChanges(e),this._changed={}},checkpoint(){this.old=We.default.cloneDeep(this.now),this._changed={}},_notifyChange(e,t){this._changed[e]=!0,this.dispatchEvent({type:`change:${e}`,value:t})},_notifyChanges(e){rt.forInRecursive(e,(t,n)=>{this._notifyChange(n,t)})},changed(){if(!this.old)return[];const{old:e,now:t}=this;return We.default.filter(Object.keys(this._changed),n=>We.default.get(e,n)!==We.default.get(t,n))},applyDiffs(e){if(e.hasOwnProperty("VERSION")&&e.VERSION!==qT)throw new Error("Settings version does not match!");delete e.VERSION,this.reset(),this.set(e)},getDiffs(e){const t=rt.objectsDiff(this.now,M1);return e&&(t.VERSION=qT),t},setPluginOpts(e,t){M1.plugins[e]=We.default.cloneDeep(t),this.now.plugins[e]=We.default.cloneDeep(t)}});var Pe=new yP,br=0;function xP(e){return!(!e||e==="0"||We.default.isString(e)&&e.toLowerCase()==="false")}var jw={string:String,number:Number,boolean:xP},GV="=",Yw="!",SP=":",bP=",",MP="$;@/?";function HV(){return rt.generateRegExp(MP+":,")}function WV(){return rt.generateRegExp(MP+" ")}var XV=HV();function $T(e){return rt.encodeQueryComponent(e,XV)}var jV=WV();function ZT(e){return rt.encodeQueryComponent(e,jV)}function sx(e){let{reps:t}=e;if(!t){const{presets:n}=Pe.now;let i=e.preset||Pe.now.preset;t=n[i],t||(Qi.warn(`Unknown preset "${i}"`),[i]=Object.keys(n),t=n[i]),e.preset=i,e.reps=rt.deriveDeep(t,!0)}}function Ly(e,t,n){sx(e);const i=e.reps[br];i.hasOwnProperty(t)&&(br=e.reps.length,e.reps[br]=rt.deriveDeep(i,!0)),n!==void 0&&(e.reps[br][t]=n)}function YV(e,t,n){e._objects===void 0&&(e._objects=[]);const[i,r]=n,s={type:i,params:t};r!==void 0&&(s.opts=r),e._objects[e._objects.length]=s}function qV(e,t){const n=e.indexOf(",");return n>=0?(t.push(e.substr(n+1).split(",")),e.substr(0,n)):e}function Py(e,t,n){if(e){const i=e.indexOf(Yw),r=qV(e.substr(0,i>=0?i:void 0),n);if(i>=0){const s=e.substr(i+1).split(bP);if(e=r,t){const a=t[e],c=rt.deriveDeep(a,!0);s.forEach(u=>{const d=u.split(SP,2),p=decodeURIComponent(d[0]),g=decodeURIComponent(d[1]),v=jw[typeof We.default.get(a,p)];v?We.default.set(c,p,v(g)):Qi.warn(`Unknown argument "${p}" for option "${e}"`)}),Object.keys(c).length>0&&(e=[e,c])}}else e=r}return e}var KT={l:"load",load:String,t:"type",type:String,v:"view",view:String,u:"unit",unit:Number,menu:xP,o:"object",object(e,t){const n=[];let i=Py(e,Pe.defaults.objects,n);Array.isArray(i)||(i=[i]),YV(t,n[0],i)},p:"preset",preset(e,t){t.preset=e,t.reps=null,sx(t)},r:"rep",rep(e,t){sx(t),br=Number(e),br=br<=t.reps.length?br<0?0:br:t.reps.length,br===t.reps.length&&(t.reps[br]=br>0?rt.deriveDeep(t.reps[br-1],!0):rt.deriveDeep(Pe.defaults.presets.default[0],!0))},s:"select",select(e,t){Ly(t,"selector",e)},m:"mode",mode(e,t){Ly(t,"mode",Py(e,Pe.defaults.modes))},c:"color",color(e,t){Ly(t,"colorer",Py(e,Pe.defaults.colorers))},mt:"material",material(e,t){Ly(t,"material",Py(e,Pe.defaults.materials))},dup(e,t){sx(t);const{reps:n}=t,i=n[br];br=n.length,n[br]=rt.deriveDeep(i,!0)},ar:"autoResolution"};function wP(e){br=0;const t={};for(let n=0,i=e.length;n<i;++n){const r=e[n];let s=r[0];const a=r[1];let c=KT[s];for(;We.default.isString(c);)s=c,c=KT[s];if(c){if(We.default.isFunction(c)){const u=c(a,t);u!==void 0&&(t[s]=u)}}else{const u=jw[typeof We.default.get(Pe.defaults,s)];u?We.default.set(t,`settings.${s}`,u(a)):Qi.warn(`Unknown option "${s}"`)}}return t}function $V(e){return wP(rt.getUrlParameters(`?${e||""}`))}function ZV(e){return wP(rt.getUrlParameters(e))}function AP(e){const t=[];let n=0;return rt.forInRecursive(e,(i,r)=>{t[n++]=ZT(r)+SP+ZT(i)}),t.join(bP)}function f2(e){return We.default.isArray(e)?e.length<2?e[0]:`${e[0]}${Yw}${AP(e[1])}`:e}function KV(e){if(!e||!e.type)return;let t=e.type;return We.default.isArray(e.params)&&e.params.length>0&&(t+=`,${e.params.join(",")}`),e.opts&&(t+=Yw+AP(e.opts)),t}function QV(e){const t=[];let n=0;function i(c,u){u!=null&&(t[n++]=$T(c)+GV+$T(u))}function r(c){if(c)for(let u=0,d=c.length;u<d;++u)We.default.isEmpty(c[u])||(i("r",u),i("s",c[u].selector),i("m",f2(c[u].mode)),i("c",f2(c[u].colorer)),i("mt",f2(c[u].material)))}function s(c){if(c)for(let u=0,d=c.length;u<d;++u)i("o",KV(c[u]))}i("l",e.load),i("u",e.unit),i("p",e.preset),r(e.reps),s(e._objects),i("v",e.view),rt.forInRecursive(e.settings,(c,u)=>{u!=="preset"&&i(u,c)});let a="";if(typeof window<"u"){const{location:c}=window;a=`${c.protocol}//${c.host}${c.pathname}`}return t.length>0&&(a+=`?${t.join("&")}`),a}function EP(e){const t=[];let n=0;return rt.forInRecursive(e,(i,r)=>{t[n++]=`${r}=${rt.enquoteString(i)}`}),t.join(" ")}function d2(e){return We.default.isArray(e)?e.length<2?e[0]:`${e[0]} ${EP(e[1])}`:e}function JV(e){if(!e||!e.type)return;let t=e.type;return We.default.isArray(e.params)&&e.params.length>0&&(t+=` ${e.params.map(rt.enquoteString).join(" ")}`),e.opts&&(t+=` ${EP(e.opts)}`),t}function eF(e,t){const n=[];let i=0;function r(s,a){a!=null&&(n[i++]=s+a)}return We.default.isEmpty(e)?null:(r("",t),r("s=",rt.enquoteString(e.selector)),r("m=",d2(e.mode)),r("c=",d2(e.colorer)),r("mt=",d2(e.material)),n.join(" "))}function tF(e){const t=[];let n=0;function i(a,c,u){if(c!=null){const d=typeof c=="string"&&u?'"':"";t[n++]=`${a} ${d}${c}${d}`.trim()}}function r(a){if(a)for(let c=0,u=a.length;c<u;++c)i("rep",eF(a[c],c))}function s(a){if(a)for(let c=0,u=a.length;c<u;++c)i("",JV(a[c]))}return i("set","autobuild false"),i("load",e.load,!0),i("unit",e.unit),i("preset",e.preset),r(e.reps),s(e._objects),rt.forInRecursive(e.settings,(a,c)=>{c!=="preset"&&i(`set ${c}`,a,!0)}),i("view",e.view),i("set","autobuild true"),t.join(`
`)}var qw={fromURL:ZV,fromAttr:$V,adapters:jw,toURL:QV,toScript:tF},nF=class hM{constructor(t,n,i,r,s,a,c,u,d,p,g){this.index=-1,this.residue=t,this.name=n,this.element=i,this.position=r,this.role=s,this.mask=1,this.het=a,this.serial=c,this.location=(u||" ").charCodeAt(0),this.occupancy=d||1,this.temperature=p,this.charge=g,this.hydrogenCount=-1,this.radicalCount=0,this.valence=-1,this.bonds=[],this.flags=0,i.name==="H"?this.flags|=hM.Flags.HYDROGEN:i.name==="C"&&(this.flags|=hM.Flags.CARBON)}isHet(){return this.het}isHydrogen(){return this.element.number===1}getVisualName(){const{name:t}=this;return t.length>0?t:this.element.name.trim()}forEachBond(t){const{bonds:n}=this;for(let i=0,r=n.length;i<r;++i)t(n[i])}getFullName(){let t="";return this.residue!==null&&(this.residue._chain!==null&&(t+=`${this.residue._chain.getName()}.`),t+=`${this.residue._sequence}.`),t+=this.name,t}static Flags={CARBON:1,HYDROGEN:8,NONPOLARH:4104}},Ya=nF,of=class at{constructor(t,n,i,r,s,a,c){this.number=t,this.name=n,this.fullName=i,this.weight=r,this.radius=s,this.radiusBonding=a,this.hydrogenValency=c}static Constants={U1:1,Lead:2,U2:3,Wing:4,U18:18};static Role={N:at.Constants.U1,CA:at.Constants.Lead,C:at.Constants.U2,O:at.Constants.Wing,SG:at.Constants.U18};static ByAtomicNumber=[null,new at(1,"H","Hydrogen",1.008,1.2,.23,[1]),new at(2,"HE","Helium",4.003,1.4,.93,[0]),new at(3,"LI","Lithium",6.941,1.82,.68,[1]),new at(4,"BE","Beryllium",9.012,1.7,.35,[2]),new at(5,"B","Boron",10.81,2.08,.83,[3]),new at(6,"C","Carbon",12.011,1.95,.68,[4]),new at(7,"N","Nitrogen",14.007,1.85,.68,[3,5]),new at(8,"O","Oxygen",15.999,1.7,.68,[2,4]),new at(9,"F","Fluorine",18.998,1.73,.64,[1]),new at(10,"NE","Neon",20.18,1.54,1.12,[0]),new at(11,"NA","Sodium",22.99,2.27,.97,[1]),new at(12,"MG","Magnesium",24.305,1.73,1.1,[2]),new at(13,"AL","Aluminum",26.981,2.05,1.35,[3]),new at(14,"SI","Silicon",28.086,2.1,1.2,[4]),new at(15,"P","Phosphorus",30.974,2.08,.75,[3,5]),new at(16,"S","Sulfur",32.07,2,1.02,[2,4,6]),new at(17,"CL","Chlorine",35.453,1.97,.99,[1,3,5,7]),new at(18,"AR","Argon",39.948,1.88,1.57,[0]),new at(19,"K","Potassium",39.1,2.75,1.33,[1]),new at(20,"CA","Calcium",40.08,1.973,.99,[2]),new at(21,"SC","Scandium",44.956,1.7,1.44,[0]),new at(22,"TI","Titanium",47.88,1.7,1.47,[0]),new at(23,"V","Vanadium",50.941,1.7,1.33,[0]),new at(24,"CR","Chromium",52,1.7,1.35,[0]),new at(25,"MN","Manganese",54.938,1.7,1.35,[0]),new at(26,"FE","Iron",55.847,1.7,1.34,[0]),new at(27,"CO","Cobalt",58.93,1.7,1.33,[0]),new at(28,"NI","Nickel",58.69,1.63,1.5,[0]),new at(29,"CU","Copper",63.55,1.4,1.52,[0]),new at(30,"ZN","Zinc",65.39,1.39,1.45,[0]),new at(31,"GA","Gallium",69.72,1.87,1.22,[3]),new at(32,"GE","Germanium",72.61,1.7,1.17,[4]),new at(33,"AS","Arsenic",74.92,1.85,1.21,[3,5]),new at(34,"SE","Selenium",78.96,1.9,1.22,[2,4,6]),new at(35,"BR","Bromine",79.9,2.1,1.21,[1,3,5,7]),new at(36,"KR","Krypton",83.8,2.02,1.91,[0]),new at(37,"RB","Rubidium",85.47,1.7,1.47,[1]),new at(38,"SR","Strontium",87.62,1.7,1.12,[2]),new at(39,"Y","Yttrium",88.91,1.7,1.78,[0]),new at(40,"ZR","Zirconium",91.22,1.7,1.56,[0]),new at(41,"NB","Niobium",92.91,1.7,1.48,[0]),new at(42,"MO","Molybdenum",95.94,1.7,1.47,[0]),new at(43,"TC","Technetium",98.91,1.7,1.35,[0]),new at(44,"RU","Ruthenium",101.07,1.7,1.4,[0]),new at(45,"RH","Rhodium",102.91,1.7,1.45,[0]),new at(46,"PD","Palladium",106.42,1.63,1.5,[0]),new at(47,"AG","Silver",107.87,1.72,1.59,[0]),new at(48,"CD","Cadmium",112.41,1.58,1.69,[0]),new at(49,"IN","Indium",114.82,1.93,1.63,[3]),new at(50,"SN","Tin",118.71,2.17,1.46,[2,4]),new at(51,"SB","Antimony",121.75,2.2,1.46,[3,5]),new at(52,"TE","Tellurium",127.6,2.06,1.47,[2,4,6]),new at(53,"I","Iodine",126.91,2.15,1.4,[1,3,5,7]),new at(54,"XE","Xenon",131.29,2.16,1.98,[0]),new at(55,"CS","Cesium",132.91,1.7,1.67,[1]),new at(56,"BA","Barium",137.33,1.7,1.34,[2]),new at(57,"LA","Lanthanum",138.91,1.7,1.87,[0]),new at(58,"CE","Cerium",140.12,1.7,1.83,[0]),new at(59,"PR","Praseodymium",140.91,1.7,1.82,[0]),new at(60,"ND","Neodymium",144.24,1.7,1.81,[0]),new at(61,"PM","Promethium",144.9,1.7,1.8,[0]),new at(62,"SM","Samarium",150.36,1.7,1.8,[0]),new at(63,"EU","Europium",151.96,1.7,1.99,[0]),new at(64,"GD","Gadolinium",157.25,1.7,1.79,[0]),new at(65,"TB","Terbium",158.93,1.7,1.76,[0]),new at(66,"DY","Dysprosium",162.5,1.7,1.75,[0]),new at(67,"HO","Holmium",164.93,1.7,1.74,[0]),new at(68,"ER","Erbium",167.26,1.7,1.73,[0]),new at(69,"TM","Thulium",168.93,1.7,1.72,[0]),new at(70,"YB","Ytterbium",173.04,1.7,1.94,[0]),new at(71,"LU","Lutetium",174.97,1.7,1.72,[0]),new at(72,"HF","Hafnium",178.49,1.7,1.57,[0]),new at(73,"TA","Tantalum",180.95,1.7,1.43,[0]),new at(74,"W","Tungsten",183.85,1.7,1.37,[0]),new at(75,"RE","Rhenium",186.21,1.7,1.35,[0]),new at(76,"OS","Osmium",190.2,1.7,1.37,[0]),new at(77,"IR","Iridium",192.22,1.7,1.32,[0]),new at(78,"PT","Platinum",195.08,1.72,1.5,[0]),new at(79,"AU","Gold",196.97,1.66,1.5,[0]),new at(80,"HG","Mercury",200.59,1.55,1.7,[0]),new at(81,"TL","Thallium",204.38,1.96,1.55,[1,3]),new at(82,"PB","Lead",207.2,2.02,1.54,[2,4]),new at(83,"BI","Bismuth",208.98,1.7,1.54,[3,5]),new at(84,"PO","Polonium",210,1.7,1.68,[2,4,6]),new at(85,"AT","Astatine",210,1.7,1.7,[1,3,5,7]),new at(86,"RN","Radon",222,1.7,2.4,[0]),new at(87,"FR","Francium",223,1.7,2,[1]),new at(88,"RA","Radium",226.03,1.7,1.9,[2]),new at(89,"AC","Actinium",227.03,1.7,1.88,[0]),new at(90,"TH","Thorium",232.04,1.7,1.79,[0]),new at(91,"PA","Protactinium",231.04,1.7,1.61,[0]),new at(92,"U","Uranium",238.03,1.86,1.58,[0]),new at(93,"NP","Neptunium",237.05,1.7,1.55,[0]),new at(94,"PU","Plutonium",239.1,1.7,1.53,[0]),new at(95,"AM","Americium",243.1,1.7,1.51,[0]),new at(96,"CM","Curium",247.1,1.7,1.5,[0]),new at(97,"BK","Berkelium",247.1,1.7,1.5,[0]),new at(98,"CF","Californium",252.1,1.7,1.5,[0]),new at(99,"ES","Einsteinium",252.1,1.7,1.5,[0]),new at(100,"FM","Fermium",257.1,1.7,1.5,[0]),new at(101,"MD","Mendelevium",256.1,1.7,1.5,[0]),new at(102,"NO","Nobelium",259.1,1.7,1.5,[0]),new at(103,"LR","Lawrencium",260.1,1.7,1.5,[0]),new at(104,"RF","Rutherfordium",261,1.7,1.6,[0]),new at(105,"DB","Dubnium",262,1.7,1.6,[0]),new at(106,"SG","Seaborgium",263,1.7,1.6,[0]),new at(107,"BH","Bohrium",262,1.7,1.6,[0]),new at(108,"HS","Hassium",265,1.7,1.6,[0]),new at(109,"MT","Meitnerium",268,1.7,1.6,[0])];static ByName={D:new at(1,"D","Deuterium",2.014,1.2,.23,[1]),T:new at(1,"T","Tritium",3.016,1.2,.23,[1])}};(function(){const e=of.ByAtomicNumber,t=of.ByName;for(let n=0,i=e.length;n<i;++n){const r=e[n];r&&(t[r.name]=r)}})();of.getByName=function(e){let t=of.ByName[e];return t||(t=of.ByName[e]=new of(0,e,"Unknown",0,1,.01,[0])),t};var u0=of,TP={UNKNOWN:0,COVALENT:1,AROMATIC:2};function iF(e){return e.position}var CP=class{constructor(e,t,n,i,r){if(this._left=e,this._right=t,this._fixed=r,this._index=-1,e>t)throw new Error("In a bond atom indices must be in increasing order");this._order=n,this._type=i}getLeft(){return this._left}getRight(){return this._right}getOrder(){return this._order}calcLength(){return this._left.position.distanceTo(this._right.position)}_forEachNeighbour(e,t){const{bonds:n}=e;for(let i=0,r=n.length;i<r;++i)t(n[i]._left!==e?n[i]._left:n[i]._right)}forEachLevelOne(e){const t=this._left,n=this._right;this._forEachNeighbour(t,i=>{i!==n&&e(i)}),this._forEachNeighbour(n,i=>{i!==t&&e(i)})}forEachLevelTwo(e){const t=this._left,n=this._right,i=this;i._forEachNeighbour(t,r=>{r!==n&&i._forEachNeighbour(r,s=>{s!==t&&e(s)})}),i._forEachNeighbour(n,r=>{r!==t&&i._forEachNeighbour(r,s=>{s!==n&&e(s)})})}_fixDir(e,t,n){let i=0,r=0;const s=e.clone();function a(d){s.copy(n(d)),s.sub(e),t.dot(s)>0?++i:++r}function c(d){d.element.name==="C"&&a(d)}const u=[[this.forEachLevelOne,c],[this.forEachLevelOne,a],[this.forEachLevelTwo,c],[this.forEachLevelTwo,a]];for(let d=0;d<u.length;++d){if(u[d][0].call(this,u[d][1]),r>i)return t.multiplyScalar(-1);if(r<i)return t}return t}calcNormalDir(e){const t=this._left,n=this._right;let i=t,r=n;e=e===void 0?iF:e,t.bonds.length>n.bonds.length&&(i=n,r=t);let s=i,a=0;const{bonds:c}=r;for(let g=0,v=c.length;g<v;++g){let y=c[g]._left;c[g]._left===r&&(y=c[g]._right),y.bonds.length>a&&y!==i&&(s=y,a=y.bonds.length)}const u=e(r),d=e(i).clone().sub(u),p=e(s).clone().sub(u);return p.crossVectors(d,p),p.lengthSq()<1e-4&&p.set(0,1,0),d.normalize(),p.normalize(),d.crossVectors(p,d),d.lengthSq()<1e-4&&d.set(0,1,0),d.normalize(),this._fixDir(u,d,e)}static BondType=TP};CP.prototype.BondType=TP;var M0=CP,rF=["C3'","C3*","P","H5T","H3T"],QT=["OP1","O1P"],JT=["OP2","O2P"],sF=["C3'","C3*","C1","C1'","C1*","P"],Ny=[{types:["A","DA","G","DG"],atoms:["N1"]},{types:["C","DC"],atoms:["N3"]},{types:["T","DT","U","DU"],atoms:["O4"]}],oF=class{constructor(e,t,n,i){this._chain=e,this._component=null,this._type=t,this._sequence=n,this._icode=i,this._mask=1,this._index=-1,this._atoms=[],this._secondary=null,this._firstAtom=null,this._leadAtom=null,this._wingAtom=null,this._lastAtom=null,this._controlPoint=null,this._midPoint=null,this._wingVector=null,this._cylinders=null,this._isValid=!0,this._het=!1,this._molecule=null,this.temperature=null,this.occupancy=null}getChain(){return this._chain}getMolecule(){return this._molecule}getType(){return this._type}getSequence(){return this._sequence}getSecondary(){return this._secondary}getICode(){return this._icode}addAtom(e,t,n,i,r,s,a,c,u,d){const p=new Ya(this,e,t,n,i,r,s,a,c,u,d);return this._chain.getComplex().addAtom(p),this._atoms.push(p),this._het=this._het||r,p}getAtomCount(){return this._atoms.length}forEachAtom(e){const t=this._atoms;for(let n=0,i=t.length;n<i&&!e(t[n]);++n);}_findAtomByName(e){let t=null;return this.forEachAtom(n=>n.name===e?(t=n,!0):!1),t}_findFirstAtomInList(e){let t=null;for(let n=0;n<e.length;++n)if(t=this._findAtomByName(e[n]),t!==null)return t;return t}collectMask(){let e=4294967295;const t=this._atoms;for(let n=0,i=t.length;n<i;++n)e&=t[n].mask;this._mask=e}getCylinderTargetList(){const e=this._type._name;for(let t=0,n=Ny.length;t<n;++t)for(let i=0,r=Ny[t].types.length;i<r;++i)if(e===Ny[t].types[i])return Ny[t].atoms;return null}_detectLeadWing(e,t,n){const i=this._findFirstAtomInList(rF);let r=this._findFirstAtomInList(QT),s=this._findFirstAtomInList(JT);if(r===null&&t!==null&&(r=t._findFirstAtomInList(QT)),s===null&&t!==null&&(s=t._findFirstAtomInList(JT)),i===null||r===null||s===null)return;e._leadAtom=i,e._controlPoint=n(i),e._wingVector=n(s).clone().sub(n(r)),e._isValid=!0;const a=this._findFirstAtomInList(sF),c=this.getCylinderTargetList(),u=c!==null?this._findFirstAtomInList(c):null;a===null||u===null||(e._cylinders=[n(a),n(u)])}calcWing(e,t,n,i){const r=t.clone().sub(e),s=e.clone().sub(n);return s.crossVectors(r,s),s.crossVectors(r,s).normalize(),i!==null&&i.length()>1e-4&&s.length()>1e-4&&Math.abs(i.angleTo(s))>Math.PI/2&&s.negate(),s}_innerFinalize(e,t,n,i,r,s){const a=t===null,c=s(this._leadAtom),u=new R.Vector3(c.x,c.y,c.z);if(r){this._detectLeadWing(i,n,s);return}if(a)i._midPoint=s(this._firstAtom).clone();else{const d=t._controlPoint;i._midPoint=d.clone().lerp(u,.5),i._wingVector=this.calcWing(d,u,s(e._wingAtom),t._wingVector)}i._controlPoint=u}_finalize2(e,t,n){this._innerFinalize(e,e,t,this,n,i=>i.position)}isConnected(e){if(this._chain!==e._chain)return!1;if(this===e)return!0;let t=!1;return this.forEachAtom(n=>{const{bonds:i}=n;for(let r=0,s=i.length;r<s;++r){const a=i[r];if(a._left.residue===e||a._right.residue===e)return t=!0,!0}return!1}),t}_finalize(){const e=this;[this._firstAtom]=this._atoms,this._lastAtom=this._atoms[this._atoms.length-1],this._leadAtom=null,this._wingAtom=null;let t=0,n=0,i=0,r=0;this.forEachAtom(s=>(e._leadAtom===null&&s.role===u0.Constants.Lead&&(e._leadAtom=s),e._wingAtom===null&&s.role===u0.Constants.Wing&&(e._wingAtom=s),s.temperature&&(n+=s.temperature,t++),s.occupancy&&(r+=s.occupancy,i++),e._leadAtom!==null&&e._wingAtom!==null)),t>0&&(this.temperature=n/t),i>0&&(this.occupancy=r/i),(this._leadAtom===null||this._wingAtom===null)&&(this._isValid=!1),this._leadAtom===null&&(this._leadAtom=this._firstAtom),this._wingAtom===null&&(this._wingAtom=this._lastAtom)}},dx=oF,Zx=class Zt{constructor(t,n,i){this._name=t,this._fullName=n,this.letterCode=i,this.flags=0}getName(){return this._name}static StandardTypes={ALA:new Zt("ALA","Alanine","A"),ARG:new Zt("ARG","Arginine","R"),ASN:new Zt("ASN","Asparagine","N"),ASP:new Zt("ASP","Aspartic Acid","D"),CYS:new Zt("CYS","Cysteine","C"),GLN:new Zt("GLN","Glutamine","Q"),GLU:new Zt("GLU","Glutamic Acid","E"),GLY:new Zt("GLY","Glycine","G"),HIS:new Zt("HIS","Histidine","H"),ILE:new Zt("ILE","Isoleucine","I"),LEU:new Zt("LEU","Leucine","L"),LYS:new Zt("LYS","Lysine","K"),MET:new Zt("MET","Methionine","M"),PHE:new Zt("PHE","Phenylalanine","F"),PRO:new Zt("PRO","Proline","P"),PYL:new Zt("PYL","Pyrrolysine","O"),SEC:new Zt("SEC","Selenocysteine","U"),SER:new Zt("SER","Serine","S"),THR:new Zt("THR","Threonine","T"),TRP:new Zt("TRP","Tryptophan","W"),TYR:new Zt("TYR","Tyrosine","Y"),VAL:new Zt("VAL","Valine","V"),A:new Zt("A","Adenine","A"),C:new Zt("C","Cytosine","C"),G:new Zt("G","Guanine","G"),I:new Zt("I","Inosine","I"),T:new Zt("T","Thymine","T"),U:new Zt("U","Uracil","U"),DA:new Zt("DA","Adenine","A"),DC:new Zt("DC","Cytosine","C"),DG:new Zt("DG","Guanine","G"),DI:new Zt("DI","Inosine","I"),DT:new Zt("DT","Thymine","T"),DU:new Zt("DU","Uracil","U"),"+A":new Zt("+A","Adenine","A"),"+C":new Zt("+C","Cytosine","C"),"+G":new Zt("+G","Guanine","G"),"+I":new Zt("+I","Inosine","I"),"+T":new Zt("+T","Thymine","T"),"+U":new Zt("+U","Uracil","U"),WAT:new Zt("WAT","Water",""),H2O:new Zt("H2O","Water",""),HOH:new Zt("HOH","Water",""),DOD:new Zt("DOD","Water",""),UNK:new Zt("UNK","Unknown",""),UNL:new Zt("UNL","Unknown Ligand","")};static Flags={PROTEIN:1,BASIC:2,ACIDIC:4,POLAR:8,NONPOLAR:16,AROMATIC:32,NUCLEIC:256,PURINE:512,PYRIMIDINE:1024,DNA:2048,RNA:4096,WATER:65536}};function Mo(e,t){for(let n=0,i=t.length;n<i;++n){const r=Zx.StandardTypes[t[n]];r&&(r.flags|=e)}}var{Flags:wo}=Zx;Mo(wo.WATER,["WAT","H2O","HOH","DOD"]);Mo(wo.PROTEIN,["ALA","ARG","ASN","ASP","CYS","GLY","GLU","GLN","HIS","ILE","LEU","LYS","MET","PHE","PRO","PYL","SEC","SER","THR","TRP","TYR","VAL"]);Mo(wo.BASIC,["ARG","HIS","LYS"]);Mo(wo.ACIDIC,["ASP","GLU"]);Mo(wo.POLAR,["ASN","CYS","GLN","SER","THR","TYR"]);Mo(wo.NONPOLAR,["ALA","ILE","LEU","MET","PHE","PRO","TRP","VAL","GLY"]);Mo(wo.AROMATIC,["PHE","TRP","TYR"]);Mo(wo.NUCLEIC,["A","G","I","DA","DG","DI","+A","+G","+I","C","T","U","DC","DT","DU","+C","+T","+U"]);Mo(wo.PURINE,["A","G","I","DA","DG","DI","+A","+G","+I"]);Mo(wo.PYRIMIDINE,["C","T","U","DC","DT","DU","+C","+T","+U"]);Mo(wo.DNA,["DA","DG","DI","DC","DT","DU"]);Mo(wo.RNA,["A","G","I","C","T","U"]);var aF={ILE:4.5,VAL:4.2,LEU:3.8,PHE:2.8,CYS:2.5,MET:1.9,ALA:1.8,GLY:-.4,THR:-.7,SER:-.8,TRP:-.9,TYR:-1.3,PRO:-1.6,HIS:-3.2,GLU:-3.5,GLN:-3.5,ASP:-3.5,ASN:-3.5,LYS:-3.9,ARG:-4.5};function lF(e,t){const n=Object.keys(t);for(let i=0,r=n.length;i<r;++i){const s=n[i],a=t[s];Zx.StandardTypes[s][e]=a}}lF("hydrophobicity",aF);var kn=Zx,w1={UNKNOWN:0,PROTEIN:1,NUCLEIC:2},cF=class{constructor(e,t){this._complex=e,this._name=t,this._mask=1,this._index=-1,this._residues=[],this.minSequence=Number.POSITIVE_INFINITY,this.maxSequence=Number.NEGATIVE_INFINITY}getComplex(){return this._complex}getName(){return this._name}getResidues(){return this._residues}_determineType(){const e=this._residues,{PROTEIN:t,NUCLEIC:n}=kn.Flags;this.type=w1.UNKNOWN;for(let i=0,r=e.length;i<r;++i){const{flags:s}=e[i]._type;if((s&n)!==0){this.type=w1.NUCLEIC;break}else if((s&t)!==0){this.type=w1.PROTEIN;break}}}findResidue(e,t){const n=this._residues;for(let i=0,r=n.length;i<r;++i){const s=n[i];if(s._sequence===e&&s._icode===t)return[s,i]}return null}_finalize(){this._determineType();const e=this._residues;let t=null;for(let n=0,i=e.length;n<i;++n){const r=n+1<i?e[n+1]:null,s=e[n];s._finalize2(t,r,this.type===w1.NUCLEIC),t=s}if(e.length>1&&e[1]._wingVector){const n=e[1]._wingVector;e[0]._wingVector=new R.Vector3(n.x,n.y,n.z)}else e.length>0&&(e[0]._wingVector=new R.Vector3(1,0,0))}updateToFrame(e){const t=this._residues;let n=null,i=null;const r=e._residues,s=t.length;function a(c){return e.getAtomPos(c.index)}for(let c=0;c<s;++c){const u=t[c],d=r[u._index],p=c+1<s?t[c+1]:null;u._innerFinalize(n,i,p,d,this.type===w1.NUCLEIC,a),n=u,i=d}r[t[0]._index]._wingVector=s>1?r[t[1]._index]._wingVector:new R.Vector3(1,0,0)}addResidue(e,t,n){let i=this._complex.getResidueType(e);i===null&&(i=this._complex.addResidueType(e));const r=new dx(this,i,t,n);return this._complex.addResidue(r),this._residues.push(r),i.flags&(kn.Flags.NUCLEIC|kn.Flags.PROTEIN)&&(this.maxSequence<t&&(this.maxSequence=t),this.minSequence>t&&(this.minSequence=t)),r}getResidueCount(){return this._residues.length}forEachResidue(e){const t=this._residues;for(let n=0,i=t.length;n<i;++n)e(t[n])}collectMask(){let e=4294967295;const t=this._residues;for(let n=0,i=t.length;n<i;++n)e&=t[n]._mask;this._mask=e}},RP=cF,um=class LP{constructor(t,n,i){this.type=t,this.generic=LP.genericByType[this.type]||"loop",this.init=n,this.term=i}_finalize(t,n,i){if(this.init instanceof dx&&this.term instanceof dx)return;const r=i.splitUnifiedSerial(this.init),s=i.splitUnifiedSerial(this.term);for(let a=r.chain;a<=s.chain;a++)for(let c=r.serial;c<=s.serial;c++)for(let{iCode:u}=r;u<=s.iCode;u++){const d=i.getUnifiedSerial(a,c,u);n[d]&&(n[d]._secondary=this)}this.init=n[this.init],this.term=n[this.term]}};um.Type={STRAND:"E",BRIDGE:"B",HELIX_310:"G",HELIX_ALPHA:"H",HELIX_PI:"I",HELIX:"X",TURN_310:"3",TURN_ALPHA:"4",TURN_PI:"5",TURN:"T",BEND:"S",COIL:"C"};um.Generic={STRAND:"strand",HELIX:"helix",LOOP:"loop"};var A1=um.Type,E1=um.Generic;um.genericByType={[A1.STRAND]:E1.STRAND,[A1.HELIX_310]:E1.HELIX,[A1.HELIX_ALPHA]:E1.HELIX,[A1.HELIX_PI]:E1.HELIX,[A1.HELIX]:E1.HELIX};var Ks=um,p2=Ks.Type,PP={1:p2.HELIX_ALPHA,3:p2.HELIX_PI,5:p2.HELIX_310},uF=class extends Ks{constructor(e,t,n,i,r,s,a){super(PP[e]||Ks.Type.HELIX,t,n),this.serial=i,this.name=r,this.comment=s,this.length=a}},fM=uF,hF=class extends Ks{constructor(e,t,n,i,r,s){super(Ks.Type.STRAND,t,n),this.sheet=e,this.sense=i,this.atomCur=r,this.atomPrev=s}_finalize(e,t,n){super._finalize(e,t,n);let i=this.atomCur;i!==null&&!Number.isNaN(i)&&(this.atomCur=e[i]),i=this.atomPrev,i!==null&&!Number.isNaN(i)&&(this.atomPrev=e[i])}},$w=hF,fF=class{constructor(e,t){this._name=e,this._width=t,this._strands=[]}getName(){return this._name}getWidth(){return this._width}addStrand(e){this._strands.push(e),this._width=this._strands.length}addEmptyStrand(){this._strands.push(new $w(null,null,null,null,null,null))}_finalize(e,t,n){const i=this._strands;for(let r=0,s=i.length;r<s;++r)i[r]._finalize(e,t,n);if(this._width||(this._width=i.length),i.length!==this._width)throw new Error(`Sheet ${this._name} is inconsistent.`)}},NP=fF,dF=class{constructor(e,t,n,i,r){this._id=e,this._name=t,this._position=n||new R.Vector3,this._atoms=i||[],this._charge=0,this._repeat=1,this._center=null,this.xmlNodeRef=r||null}getName(){return this._name}getPosition(){return this._position}getCentralPoint(){return this._center}_rebuildSGroupOnAtomChange(){if(this._center===null)return;const t=new R.Vector3(1e8,1e8,1e8),n=new R.Vector3(-1e8,-1e8,-1e8);for(let i=0,r=this._atoms.length;i<r;i++){const s=this._atoms[i].position;t.set(Math.min(t.x,s.x),Math.min(t.y,s.y),Math.min(t.z,s.z)),n.set(Math.max(n.x,s.x),Math.max(n.y,s.y),Math.max(n.z,s.z))}this._center.addVectors(t,n),this._center.multiplyScalar(.5)}},pF=dF,px=Ts(99),mF=class{constructor(e,t){this.min=e,this.max=typeof t>"u"?e:t}includes(e){return this.min<=e&&e<=this.max}toString(){const{min:e,max:t}=this;return e===t?String(e):[e,t].join(":")}toJSON(){return[this.min,this.max]}},IP=class{constructor(e){if(e instanceof this.constructor)return e;e instanceof Array?this._values=e.slice(0):e?this._values=[e]:this._values=[]}append(e){const t=this._values;return t[t.length]=e,this}remove(e){const t=this._values,n=t.indexOf(e);return n>=0&&t.splice(n,1),this}toString(){return this._values.join(",")}toJSON(){const e=this._values,t=[];for(let n=0,i=e.length;n<i;++n){const r=e[n];t[n]=r.toJSON?r.toJSON():r}return t}},OP=class extends IP{includes(e){const t=this._values;for(let n=0,i=t.length;n<i;++n)if(t[n].includes(e))return!0;return!1}},m2=[],DP=class extends IP{constructor(e,t){const n=super(e);if(t){this.upperOnly=!0;const i=n._values;for(let r=0,s=i.length;r<s;++r){const a=i[r];typeof a=="string"&&(i[r]=a.toUpperCase())}}else this.upperOnly=!1;return n}includes(e){return this._values.indexOf(e)!==-1}toString(){const e=this._values;m2.length=0;for(let t=0,n=e.length;t<n;++t)m2[t]=rt.correctSelectorIdentifier(String(e[t]));return m2.join(",")}_validate(e){return this.upperOnly&&typeof e=="string"?e.toUpperCase():e}append(e){return super.append(this._validate(e)),this}remove(e){return super.remove(this._validate(e)),this}},Ao=class{toString(){return this.keyword}toJSON(){return[this.name]}};Ao.prototype.name="Error";Ao.prototype.keyword="error";var zP=class extends Ao{constructor(e){super(),this.list=e}toString(){return`${this.keyword} ${this.list}`}toJSON(){return[this.name,this.list.toJSON()]}},Kx=class extends zP{constructor(e){super(new OP(e))}},Mf=class extends zP{constructor(e,t){super(new DP(e,!t))}},Qx=class extends Ao{includesAtom(e){return!1}};Qx.prototype.name="None";Qx.prototype.keyword="none";var Zw=class extends Ao{includesAtom(e){return!0}};Zw.prototype.name="All";Zw.prototype.keyword="all";var dM=new Qx,Kw=class extends Ao{constructor(e){super(),this.rhs=e||dM}toString(){const e=this.rhs.priority&&this.rhs.priority>this.priority?`(${this.rhs})`:this.rhs;return`${this.keyword} ${e}`}toJSON(){return[this.name,this.rhs.toJSON()]}};Kw.prototype.priority=1;var Jx=class extends Ao{constructor(e,t){super(),this.lhs=e||dM,this.rhs=t||dM}toString(){const e=this.lhs.priority&&this.lhs.priority>this.priority?`(${this.lhs})`:this.lhs,t=this.rhs.priority&&this.rhs.priority>this.priority?`(${this.rhs})`:this.rhs;return`${e} ${this.keyword} ${t}`}toJSON(){return[this.name,this.lhs.toJSON(),this.rhs.toJSON()]}};Jx.prototype.priority=1e3;var h0={};function Wr(e,t){const n=e.toLowerCase();t.prototype.keyword=n,t.prototype.name=e;const i=function(){for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return new t(...s)};return i.SelectorClass=t,h0[n]=i,t}Wr("Serial",class extends Kx{includesAtom(t){return this.list.includes(t.serial)}});Wr("Name",class extends Mf{includesAtom(t){return this.list.includes(t.name)}});Wr("AltLoc",class extends Mf{includesAtom(t){return this.list.includes(String.fromCharCode(t.location))}});Wr("Elem",class extends Mf{includesAtom(t){return this.list.includes(t.element.name)}});Wr("Residue",class extends Mf{includesAtom(t){return this.list.includes(t.residue._type._name)}});Wr("Sequence",class extends Kx{includesAtom(t){return this.list.includes(t.residue._sequence)}});Wr("ICode",class extends Mf{constructor(t){super(t,!0)}includesAtom(t){return this.list.includes(t.residue._icode)}});Wr("ResIdx",class extends Kx{includesAtom(t){return this.list.includes(t.residue._index)}});Wr("Chain",class extends Mf{constructor(t){super(t,!0)}includesAtom(t){return this.list.includes(t.residue._chain._name)}});Wr("Hetatm",class extends Ao{includesAtom(t){return t.het}});Wr("PolarH",class extends Ao{includesAtom(t){return(t.flags&Ya.Flags.NONPOLARH)===Ya.Flags.HYDROGEN}});Wr("NonPolarH",class extends Ao{includesAtom(t){return(t.flags&Ya.Flags.NONPOLARH)===Ya.Flags.NONPOLARH}});Wr("All",Zw);Wr("None",Qx);var UP=h0.none();function Qw(e,t,n){return n.prototype.priority=t,Wr(e,n)}Qw("Not",1,class extends Kw{includesAtom(t){return!this.rhs.includesAtom(t)}});Qw("And",2,class extends Jx{includesAtom(t){return this.lhs.includesAtom(t)&&this.rhs.includesAtom(t)}});Qw("Or",3,class extends Jx{includesAtom(t){return this.lhs.includesAtom(t)||this.rhs.includesAtom(t)}});function ma(e,t){return Wr(t,class extends Ao{includesAtom(n){return(n.residue._type.flags&e)!==0}})}ma(kn.Flags.PROTEIN,"Protein");ma(kn.Flags.BASIC,"Basic");ma(kn.Flags.ACIDIC,"Acidic");ma(kn.Flags.BASIC|kn.Flags.ACIDIC,"Charged");ma(kn.Flags.POLAR,"Polar");ma(kn.Flags.NONPOLAR,"NonPolar");ma(kn.Flags.AROMATIC,"Aromatic");ma(kn.Flags.NUCLEIC,"Nucleic");ma(kn.Flags.PURINE,"Purine");ma(kn.Flags.PYRIMIDINE,"Pyrimidine");ma(kn.Flags.WATER,"Water");var Ji=Object.create(h0);Ji.Selector=Ao;Ji.RangeListSelector=Kx;Ji.ValueListSelector=Mf;Ji.Range=mF;Ji.RangeList=OP;Ji.ValueList=DP;Ji.PrefixOperator=Kw;Ji.InfixOperator=Jx;Ji.Context=Object.create({});Ji.GetSelector=function(e){if(!Ji.Context.hasOwnProperty(e))throw{message:`selector ${e} is not registered`};return Ji.Context[e]||UP};Ji.ClearContext=function(){Object.keys(Ji.Context).forEach(e=>{delete Ji.Context[e]})};Ji.keyword=function(e){return h0[e.toLowerCase()]||h0.none};Ji.parse=function(e){const t={};try{t.selector=px.parser.parse(e)}catch(n){t.selector=UP,t.error=n.message}return t};px.parser.yy=Ji;px.parser.yy.parseError=px.parser.parseError;var mf=Ji,gF=class{constructor(e){this._complex=e,this._selector=mf.keyword("All")(),this._boundaries={boundingBox:new R.Box3,boundingSphere:new R.Sphere}}computeBoundaries(){const e=this._complex._atoms,t=e.length,n=this._selector,{boundingBox:i}=this._boundaries;if(i.makeEmpty(),t===1){i.expandByPoint(e[0].position);const a=new R.Vector3;i.getCenter(a);const c=2*e[0].element.radius;i.setFromCenterAndSize(a,new R.Vector3(c,c,c))}else for(let a=0;a<t;++a)n.includesAtom(e[a])&&i.expandByPoint(e[a].position);let r=0;const s=new R.Vector3;if(i.getCenter(s),t===1)this._boundaries.boundingSphere.set(s,e[0].element.radius);else{for(let a=0;a<t;++a){if(!n.includesAtom(e[a]))continue;const c=e[a].position,u=s.distanceToSquared(c);r<u&&(r=u)}this._boundaries.boundingSphere.set(s,Math.sqrt(r))}}getTransforms(){return[]}getSelector(){return this._selector}getBoundaries(){return this._boundaries}finalize(){}},BP=gF,_F=class extends BP{constructor(e){super(e),this.chains=[],this.matrices=[]}computeBoundaries(){super.computeBoundaries();const{matrices:e}=this,t=this._boundaries.boundingSphere.center,n=this._boundaries.boundingSphere.radius,i=this._boundaries.boundingBox=new R.Box3;i.makeEmpty();for(let a=0,c=e.length;a<c;++a)i.expandByPoint(t.clone().applyMatrix4(e[a]));const r=i.max.distanceTo(i.min)/2+n,s=new R.Vector3;i.getCenter(s),this._boundaries.boundingSphere=new R.Sphere().set(s,r),i.max.addScalar(n),i.min.subScalar(n)}addChain(e){this.chains[this.chains.length]=e}addMatrix(e){this.matrices[this.matrices.length]=e}getTransforms(){return this.matrices}finalize(){this.chains.length>0?this._selector=mf.keyword("Chain")(this.chains):this._selector=mf.keyword("None")()}},Jw=_F,vF=class{constructor(e){this._complex=e,this._index=-1,this._residueIndices=[],this._cycles=[],this._subDivs=[],this._residueCount=0}getResidues(){return this._complex._residues}getResidueCount(){return this._residueCount}forEachResidue(e){const t=this._complex._residues,n=this._residueIndices;for(let i=0,r=n.length;i<r;++i)for(let s=n[i].start,a=n[i].end;s<=a;++s)e(t[s])}setSubDivs(e){this._subDivs=e;let t=0;const n=[];let i=0;for(let r=0,s=e.length;r<s;++r)if(r===s-1||e[r].end+1!==e[r+1].start){const{start:a}=e[t],{end:c}=e[r];n[n.length]={start:a,end:c},i+=c-a+1,t=r+1}this._residueIndices=n,this._residueCount=i}getComplex(){return this._complex}forEachBond(e){const t=this._complex._bonds;for(let n=0,i=t.length;n<i;++n){const r=t[n];r._left.residue._component===this&&e(r)}}update(){this.forEachCycle(e=>{e.update()})}forEachAtom(e){this.forEachResidue(t=>{t.forEachAtom(e)})}addCycle(e){this._cycles.push(e)}forEachCycle(e){const t=this._cycles;for(let n=0,i=t.length;n<i;++n)e(t[n])}markResidues(){const e=this;e.forEachResidue(t=>{t._component=e})}_forEachSubChain(e,t){const n=this._complex._residues,i=this._subDivs;for(let r=0,s=i.length;r<s;++r)for(let a=i[r].start,c=i[r].end;a<=c;++a){const u=n[a];if(e&u._mask&&u._isValid){let d=a+1;for(;d<=c;++d){const p=n[d];if(!(e&p._mask&&p._isValid))break}t(r,a,d-1),a=d}}}getMaskedSequences(e){const t=[];let n=0;return this._forEachSubChain(e,(i,r,s)=>{t[n++]={start:r,end:s}}),t}getMaskedSubdivSequences(e){const t=[];let n=-1,i=-1;const r=this._subDivs;return this._forEachSubChain(e,(s,a,c)=>{i!==s&&(++n,t[n]={arr:[],boundaries:r[s]},i=s),t[n].arr[t[n].arr.length]={start:a,end:c}}),t}},eC=vF,T1=32,g2=1024*1024,_2=4,yF=14,v2=-1,xF=89237,SF=class{constructor(e){this.numPairs=0,this.numMaxPairs=e,this.intBuffer=rt.allocateTyped(Int32Array,e*_2);for(let t=0;t<e*_2;t++)this.intBuffer[t]=v2;this.hashBuffer=rt.allocateTyped(Int32Array,g2*T1);for(let t=0;t<g2*T1;t++)this.hashBuffer[t]=v2}destroy(){this.intBuffer=null,this.hashBuffer=null}addPair(e,t){const n=e<t?e:t,i=e>t?e:t,r=n+(i<<yF);let s=(n+i*xF&g2-1)*T1,a=0;for(;a<T1;a++){const c=this.hashBuffer[s+a];if(c===v2)break;if(c===r)return!1}if(a>=T1)throw new Error("addPair: increase cMaxPairsForHashCode");if(this.hashBuffer[s+a]=r,this.numPairs>=this.numMaxPairs)throw new Error("addPair: increase num pairs");return s=this.numPairs*_2,this.intBuffer[s]=n,this.intBuffer[s+1]=i,this.intBuffer[s+2]=r,this.numPairs++,!0}},VP=SF,bF=4,tC=32,nC=.45,MF=.001;function iC(e){const{element:t}=e;if(t)return t.radiusBonding;throw new Error("_getBondingRadius: Logic error.")}function wF(e){return!e.isHet()||e.bonds&&e.bonds.length===0}var AF=class{constructor(e){this._complex=e,this._maxRad=1.8;const t=this._complex.getDefaultBoundaries().boundingBox;this._vBoxMin=t.min.clone(),this._vBoxMax=t.max.clone(),this._pairCollection=null}_addExistingPairs(){const e=this._complex.getAtoms(),t=e.length;let n=0;const i=this._pairCollection;for(;n<t;n++){const{bonds:r}=e[n],s=r.length;for(let a=0;a<s;a++){const c=r[a];c._left.index===n&&i.addPair(n,c._right.index)}}return 0}_findPairs(){const e=this._complex.getVoxelWorld();if(e===null)return;const t=this._complex._atoms,n=t.length,i=this;let r,s,a,c,u;const d=function(p){if(s&&p.isHydrogen())return;const g=p.location;if(c!==tC&&g!==tC&&c!==g)return;const v=a.distanceToSquared(p.position),y=p.element.radiusBonding,S=r+y+nC;v>S*S||v<MF||i._pairCollection.addPair(u.index,p.index)};for(let p=0;p<n;++p)u=t[p],wF(u)&&(r=u.element.radiusBonding,s=u.isHydrogen(),a=u.position,c=u.location,e.forEachAtomWithinRadius(a,2*this._maxRad+nC,d))}_addPairs(){const e=this._complex._atoms;for(let t=0,n=0;t<this._pairCollection.numPairs;t++,n+=4){const i=this._pairCollection.intBuffer[n],r=this._pairCollection.intBuffer[n+1];this._addPair(e[i],e[r])}}_addPair(e,t){const n=e.bonds,i=e.index,r=t.index;for(let u=0,d=n.length;u<d;++u){const p=n[u];if(p._left.index===r||p._right.index===r)return}const s=i<r?e:t,a=i<r?t:e,c=this._complex.addBond(s,a,0,M0.BondType.UNKNOWN,!1);n.push(c),t.bonds.push(c)}build(){this._buildInner()}_buildInner(){const e=this._complex._atoms;if(!(e.length<2)){if(e[0].index<0)throw new Error("AutoBond: Atoms in complex were not indexed.");this._calcBoundingBox(),this._pairCollection=new VP(e.length*bF),this._addExistingPairs(),this._findPairs(),this._addPairs()}}_calcBoundingBox(){const e=this._complex._atoms,t=e.length;let n=iC(e[0]);for(let i=1;i<t;++i)n=Math.max(n,iC(e[i]));this._vBoxMax.addScalar(n),this._vBoxMin.addScalar(-n),this._maxRad=n*1.2}destroy(){this._pairCollection&&this._pairCollection.destroy()}},EF=AF,TF=.1,eA=M0.BondType.AROMATIC,rC=[u0.ByName.C.number,u0.ByName.N.number],CF=(function(){const e=new R.Vector3,t=new R.Vector3,n=new R.Vector3;return function(i,r){return e.copy(i).normalize(),t.copy(r).normalize(),n.crossVectors(e,t),n.length()>TF?!1:e.dot(t)>=0}})();function sC(e,t){let n=0;for(;n<e.length&&e[n]<t;)++n;e.splice(n,0,t)}function oC(e,t){return e._left===t?e._right:e._left}function RF(e,t){const n=e.dot(t)/Math.sqrt(e.lengthSq()*t.lengthSq());return R.MathUtils.clamp(n,-1,1)}function LF(e){e._type=eA}var PF=class{constructor(e){this.atoms=e,this.update()}update(){const{atoms:e}=this,t=new R.Vector3,n=e.length;for(let i=0;i<n;++i)t.add(e[i].position);t.multiplyScalar(1/n),this.center=t,this.radius=t.distanceTo(e[0].position.clone().lerp(e[1].position,.5))}forEachBond(e){const{atoms:t}=this,n=t.length;let i=t[0],r;function s(a){(a._left===r||a._right===r)&&e(a)}for(let a=0;a<n;++a)r=t[(a+1)%n],i.forEachBond(s),i=r}};function aC(e){return e._type===eA}function NF(e){if(e.type===eA)return!0;const t=rC.indexOf(e._right.element.number),n=rC.indexOf(e._left.element.number);return t!==-1&&n!==-1}function IF(e){return e.length>3}function OF(e){return console.assert(e.length>2),!0}var DF=class{constructor(e){this._complex=e;const t=new Array(e._bonds.length),n=new Array(e._bonds.length);for(let i=0,r=t.length;i<r;++i)t[i]=[],n[i]=!1;this._bondsData=t,this._bondMarks=n,this._resetCycles()}_resetCycles(){this._cycles=[],this._currIdx=-1}_haveSameCycle(e,t,n){const i=e[t._index],r=e[n._index],s=i.length,a=r.length;let c=0,u=0;for(;c<s&&u<a;){if(i[c]===r[u])return!0;i[c]>r[u]?++u:++c}return!1}_tryBond(e,t,n){const i=[],r=this._bondsData,s=oC(e,t),a=t.position.clone().sub(s.position),c=this._currStart,u=this,d=this._bondMarks;let p=this._checkBond;d[e._index]=!0,p=p===void 0?aC:p,t.forEachBond(g=>{if(!p(g)||g===e||d[g._index]||u._haveSameCycle(r,e,g))return;const v=oC(g,t),y=v.position.clone().sub(t.position),S=v===c?-2:1-RF(a,y),E=y.cross(a);if(!CF(E,n))return;let w=0;for(;w<i.length&&i[w].val<S;)++w;i.splice(w,0,{bond:g,val:S,dir:E})});for(let g=0,v=i.length;g<v;++g){const{bond:y}=i[g],S=y._left===t?y._right:y._left;if(S===c)return++this._currIdx,this._cycles.push([t]),d[e._index]=!1,!0;if(this._tryBond(y,S,i[g].dir))return sC(r[y._index],this._currIdx),this._cycles[this._currIdx].push(t),d[e._index]=!1,!0}return d[e._index]=!1,!1}_startCycle(e){this._currStart=e._left,this._tryBond(e,e._right,new R.Vector3)&&(sC(this._bondsData[e._index],this._currIdx),this._cycles[this._currIdx].push(e._left))}_findLoops(e,t){this._checkBond=e;const n=this._complex,i=this;n.forEachComponent(r=>{i._resetCycles(),r.forEachBond(a=>{e(a)&&i._startCycle(a)});const s=i._cycles;for(let a=0,c=s.length;a<c;++a){const u=s[a];if(!t(u))continue;const d=new PF(u);d.forEachBond(LF),r.addCycle(d)}})}markCycles(){this._findLoops(aC,IF)}detectCycles(){this._findLoops(NF,OF)}},zF=DF;function UF(e,t,n,i){const r=n-e.z,s=i-e.z,a=Math.sqrt(Math.max(t*t-r*r,0)),c=Math.sqrt(Math.max(t*t-s*s,0)),u=Math.min(a,c);let d;return n<=e.z&&i>=e.z?d=t:d=Math.max(a,c),[u,d]}function BF(e,t,n,i){const r=n-e.y,s=i-e.y,a=Math.sqrt(Math.max(t*t-r*r,0)),c=Math.sqrt(Math.max(t*t-s*s,0)),u=Math.min(a,c);let d;return n<=e.y&&i>=e.y?d=t:d=Math.max(a,c),[u,d]}var VF=class ka{constructor(t,n){this._box=t.clone();const i=new R.Vector3;t.getSize(i),this._count=i.clone().divide(n).floor().max(new R.Vector3(1,1,1)),this._last=this._count.clone().subScalar(1),this._cellSize=i.clone().divide(this._count),this._cellInnerR=.5*Math.min(Math.min(this._cellSize.x,this._cellSize.y),this._cellSize.z),this._cellOuterR=.5*Math.sqrt(this._cellSize.dot(this._cellSize));const r=this._count.x*this._count.y*this._count.z;this._voxels=rt.allocateTyped(Int32Array,r);for(let s=0;s<r;++s)this._voxels[s]=-1;this._atoms=[]}addAtoms(t){const n=this;let i=this._atoms.length;this._atoms.length+=2*t.getAtomCount(),t.forEachAtom(r=>{const s=n._findVoxel(r.position);n._atoms[i]=r,n._atoms[i+1]=n._voxels[s],n._voxels[s]=i,i+=2})}static _zero=new R.Vector3(0,0,0);static _voxel=new R.Vector3;_findVoxel(t){const n=ka._zero,i=ka._voxel;return i.copy(t).sub(this._box.min).divide(this._cellSize).floor().clamp(n,this._last),i.x+this._count.x*(i.y+this._count.y*i.z)}_forEachAtomInVoxel(t,n){for(let i=this._voxels[t];i>=0;i=this._atoms[i+1])n(this._atoms[i])}static _xRange=new R.Vector2;static _yRange=new R.Vector2;static _zRange=new R.Vector2;_forEachVoxelWithinRadius(t,n,i){const r=ka._xRange,s=ka._yRange,a=ka._zRange;if(n/this._cellInnerR<10){this._forEachVoxelWithinRadiusSimple(t,n,i);return}let c,u,d,p,g,v,y,S;a.set(t.z-n,t.z+n),a.subScalar(this._box.min.z).divideScalar(this._cellSize.z).floor().clampScalar(0,this._count.z-1);for(let E=a.x;E<=a.y;++E){g=[this._box.min.z+E*this._cellSize.z,this._box.min.z+(E+1)*this._cellSize.z],S=t.z-n<=g[0]&&g[1]<=t.z+n,c=UF(t,n,g[0],g[1]),s.set(t.y-c[1],t.y+c[1]),s.subScalar(this._box.min.y).divideScalar(this._cellSize.y).floor().clampScalar(0,this._count.y-1);for(let w=s.x;w<=s.y;++w){p=[this._box.min.y+w*this._cellSize.y,this._box.min.y+(w+1)*this._cellSize.y],y=t.y-c[0]<=p[0]&&p[1]<=t.y+c[0],u=BF(t,c[1],p[0],p[1]),r.set(t.x-u[1],t.x+u[1]),r.subScalar(this._box.min.x).divideScalar(this._cellSize.x).floor().clampScalar(0,this._count.x-1);for(let{x:b}=r;b<=r.y;++b)d=[this._box.min.x+b*this._cellSize.x,this._box.min.x+(b+1)*this._cellSize.x],v=t.x-u[0]<=d[0]&&d[1]<=t.x+u[0],i(b+this._count.x*(w+this._count.y*E),v&&y&&S)}}}static _vCenter=new R.Vector3;_forEachVoxelWithinRadiusSimple(t,n,i){const r=ka._xRange,s=ka._yRange,a=ka._zRange,c=ka._vCenter,u=(n+this._cellOuterR)*(n+this._cellOuterR);let d=-1;n>this._cellOuterR&&(d=(n-this._cellOuterR)*(n-this._cellOuterR)),r.set(t.x-n,t.x+n),r.subScalar(this._box.min.x).divideScalar(this._cellSize.x).floor(),r.x=Math.min(Math.max(r.x,0),this._count.x-1),r.y=Math.min(Math.max(r.y,0),this._count.x-1),s.set(t.y-n,t.y+n),s.subScalar(this._box.min.y).divideScalar(this._cellSize.y).floor(),s.x=Math.min(Math.max(s.x,0),this._count.y-1),s.y=Math.min(Math.max(s.y,0),this._count.y-1),a.set(t.z-n,t.z+n),a.subScalar(this._box.min.z).divideScalar(this._cellSize.z).floor(),a.x=Math.min(Math.max(a.x,0),this._count.z-1),a.y=Math.min(Math.max(a.y,0),this._count.z-1);for(let p=a.x;p<=a.y;++p){const g=[this._box.min.z+p*this._cellSize.z,this._box.min.z+(p+1)*this._cellSize.z];c.z=.5*(g[0]+g[1]);for(let v=s.x;v<=s.y;++v){const y=[this._box.min.y+v*this._cellSize.y,this._box.min.y+(v+1)*this._cellSize.y];c.y=.5*(y[0]+y[1]);for(let{x:S}=r;S<=r.y;++S){const E=[this._box.min.x+S*this._cellSize.x,this._box.min.x+(S+1)*this._cellSize.x];c.x=.5*(E[0]+E[1]);const w=t.distanceToSquared(c);w<=u&&i(S+this._count.x*(v+this._count.y*p),w<=d)}}}}forEachAtomWithinRadius(t,n,i){const r=this,s=n*n;r._forEachVoxelWithinRadius(t,n,(a,c)=>{c?r._forEachAtomInVoxel(a,i):r._forEachAtomInVoxel(a,u=>{t.distanceToSquared(u.position)<=s&&i(u)})})}forEachAtomWithinDistFromMasked(t,n,i,r){this._forEachAtomWithinDistFromGroup(s=>{t.forEachAtom(a=>{(a.mask&n)!==0&&s(a)})},i,r)}forEachAtomWithinDistFromSelected(t,n,i,r){this._forEachAtomWithinDistFromGroup(s=>{t.forEachAtom(a=>{n.includesAtom(a)&&s(a)})},i,r)}_forEachAtomWithinDistFromGroup(t,n,i){const r=this,s=n*n,a=[],c=[];let u=0;t(g=>{r._forEachVoxelWithinRadius(g.position,n,(v,y)=>{y?a[v]=-1:typeof a[v]>"u"?(c.push(g),c.push(-1),a[v]=u,u+=2):a[v]!==-1&&(c.push(g),c.push(a[v]),a[v]=u,u+=2)})});let d;const p=function(g){if(!(typeof a[d]>"u")){if(u=a[d],u===-1){i(g);return}for(;u>=0;u=c[u+1])if(g.position.distanceToSquared(c[u].position)<s){i(g);break}}};for(d in a)a.hasOwnProperty(d)&&r._forEachAtomInVoxel(d,p)}},FP=VF,Iy=.5,y2=-9.9,lC=-.5,Oy=-27.888,FF=5,kF=1e3,GF=class{constructor(e){this._complex=e,this._hbonds=[],this._complex._residues.length>kF?this._buildVW():this._build()}isBond(e,t){if(this._hbonds[e]){const[n,i]=this._hbonds[e].acceptor;if(n&&n.residue===t&&n.energy<lC||i&&i.residue===t&&i.energy<lC)return!0}return!1}_build(){const e=this;for(let t=0;t<this._complex._residues.length-1;++t){const n=this._complex._residues[t];if((n.getType().flags&kn.Flags.PROTEIN)===0)continue;let i=null;t>0&&this._complex._residues[t-1].getType().flags&kn.Flags.PROTEIN&&n._sequence===this._complex._residues[t-1]._sequence+1&&(i=this._complex._residues[t-1]);for(let r=t+1;r<this._complex._residues.length;++r){const s=this._complex._residues[r];if((s.getType().flags&kn.Flags.PROTEIN)===0)continue;let a=null;this._complex._residues[r-1].getType().flags&kn.Flags.PROTEIN&&s._sequence===this._complex._residues[r-1]._sequence+1&&(a=this._complex._residues[r-1]),e._calcHBondEnergy(i,n,s),r!==t+1&&e._calcHBondEnergy(a,s,n)}}}_buildVW(){const e=this,t=this._complex._residues;let n,i;const r=this._complex.getVoxelWorld();if(r===null)return;const s=new VP(this._complex._residues.length*this._complex._residues.length/2);function a(c){const u=c.residue;if(u._index===n._index||(u.getType().flags&kn.Flags.PROTEIN)===0||!s.addPair(n._index,u._index))return;let d=u._index>0?t[u._index-1]:null;d&&((d.getType().flags&kn.Flags.PROTEIN)===0||u._sequence!==d._sequence+1)&&(d=null),e._calcHBondEnergy(i,n,u),u._index!==n._index+1&&e._calcHBondEnergy(d,u,n)}for(let c=0;c<t.length-1;++c)n=t[c],(n.getType().flags&kn.Flags.PROTEIN)!==0&&(i=c>0?t[c-1]:null,i&&((i.getType().flags&kn.Flags.PROTEIN)===0||n._sequence!==i._sequence+1)&&(i=null),r.forEachAtomWithinRadius(this._residueGetCAlpha(n),FF,a))}_residueGetCAlpha(e){for(let t=0;t<e._atoms.length;++t){const{name:n}=e._atoms[t];if(n==="CA"||n==="C1")return e._atoms[t].position}return null}_residueGetCO(e){let t=null,n=null;return e.forEachAtom(i=>{i.name==="C"?t=i.position:i.name==="O"&&(n=i.position)}),[t,n]}_residueGetNH(e,t){const[n,i]=this._residueGetCO(e);let r;if(t.forEachAtom(s=>{s.name==="N"&&(r=s.position)}),n&&i&&r){const s=n.clone();return s.sub(i),s.multiplyScalar(1/s.length()),s.add(r),[r,s]}return[null,null]}_calcHBondEnergy(e,t,n){let i=0;if(e===null)return i;if(t.getType().getName()!=="PRO"){const[a,c]=this._residueGetNH(e,t),[u,d]=this._residueGetCO(n);if(a===null||c===null||u===null||d===null)return i;const p=c.distanceTo(d),g=c.distanceTo(u),v=a.distanceTo(u),y=a.distanceTo(d);p<Iy||g<Iy||v<Iy||y<Iy?i=y2:i=Oy/p-Oy/g+Oy/v-Oy/y,i=Math.round(i*1e3)/1e3,i<y2&&(i=y2)}typeof this._hbonds[t._index]>"u"&&(this._hbonds[t._index]={donor:[],acceptor:[]});const r=this._hbonds[t._index];r.acceptor.length<2&&r.acceptor.push({residue:n._index,energy:i}),r.acceptor.length>1&&(i<r.acceptor[0].energy?(r.acceptor[1].residue=r.acceptor[0].residue,r.acceptor[1].energy=r.acceptor[0].energy,r.acceptor[0].residue=n._index,r.acceptor[0].energy=i):i<r.acceptor[1].energy&&(r.acceptor[1].residue=n._index,r.acceptor[1].energy=i)),typeof this._hbonds[n._index]>"u"&&(this._hbonds[n._index]={donor:[],acceptor:[]});const s=this._hbonds[n._index];return s.donor.length<2&&s.donor.push({residue:t._index,energy:i}),s.donor.length>1&&(i<s.donor[0].energy?(s.donor[1].residue=s.donor[0].residue,s.donor[1].energy=s.donor[0].energy,s.donor[0].residue=t._index,s.donor[0].energy=i):i<s.donor[1].energy&&(s.donor[1].residue=t._index,s.donor[1].energy=i)),i}},Gl=Object.freeze({NO_BRIDGE:0,PARALLEL:1,ANTI_PARALLEL:2}),jh=Object.freeze({START:1,MIDDLE:2,END:3,START_AND_END:4}),Xs=Object.freeze({STRAND:"E",BRIDGE:"B",HELIX_310:"G",HELIX_ALPHA:"H",HELIX_PI:"I",TURN:"T",BEND:"S",LOOP:" "}),tA=class{constructor(e){this._complex=e,this._build()}_build(){const e=this;this._hbonds=new GF(this._complex),this._ss=[],this._sheet=[],this._betaPartners=[],this._bend=[];for(let t=0;t<this._complex.getResidues().length;++t)this._betaPartners[t]=[];this._helixFlags=[],this._helixFlags[3]=[],this._helixFlags[4]=[],this._helixFlags[5]=[],this._chainLengths=[];for(let t=0;t<this._complex._chains.length;++t){const n=this._complex._chains[t].getResidues();let i=0;for(;i<n.length&&(n[i].getType().flags&kn.Flags.PROTEIN)!==0;++i);this._chainLengths[t]=i}this._buildBetaSheets();for(let t=0;t<this._complex._chains.length;++t)e._buildAlphaHelices(this._complex._chains[t].getResidues(),this._chainLengths[t],!1)}_buildAlphaHelices(e,t,n){for(let i=3;i<=5&&!(e.length<i);++i)for(let r=0;r+i<t;++r)if(this._hbonds.isBond(e[r+i]._index,e[r]._index)){this._helixFlags[i][e[r+i]._index]=jh.END;for(let s=r+1;s<r+i;++s)typeof this._helixFlags[i][e[s]._index]>"u"&&(this._helixFlags[i][e[s]._index]=jh.MIDDLE);this._helixFlags[i][e[r]._index]===jh.END?this._helixFlags[i][e[r]._index]=jh.START_AND_END:this._helixFlags[i][e[r]._index]=jh.START}for(let i=2;i<t-2;++i){const r=this._kappa(e[i-2],e[i],e[i+2]);this._bend[e[i]._index]=r!==360&&r>70}for(let i=1;i+4<t;++i)if(this._isHelixStart(e[i]._index,4)&&this._isHelixStart(e[i-1]._index,4))for(let r=i;r<=i+3;++r)this._ss[e[r]._index]=Xs.HELIX_ALPHA;for(let i=1;i+3<t;++i)if(this._isHelixStart(e[i]._index,3)&&this._isHelixStart(e[i-1]._index,3)){let r=!0;for(let s=i;r&&s<=i+2;++s)r=typeof this._ss[e[s]._index]>"u"||this._ss[e[s]._index]===Xs.HELIX_310;if(r)for(let s=i;s<=i+2;++s)this._ss[e[s]._index]=Xs.HELIX_310}for(let i=1;i+5<t;++i)if(this._isHelixStart(e[i]._index,5)&&this._isHelixStart(e[i-1]._index,5)){let r=!0;for(let s=i;r&&s<=i+4;++s)r=typeof this._ss[e[s]._index]>"u"||this._ss[e[s]._index]===Xs.HELIX_PI||n&&this._ss[e[s]._index]===Xs.HELIX_ALPHA;if(r)for(let s=i;s<=i+4;++s)this._ss[e[s]._index]=Xs.HELIX_PI}for(let i=1;i+1<t;++i)if(typeof this._ss[e[i]._index]>"u"){let r=!1;for(let s=3;s<=5&&!r;++s)for(let a=1;a<s&&!r;++a)r=i>=a&&this._isHelixStart(e[i-a]._index,s);r?this._ss[e[i]._index]=Xs.TURN:this._bend[e[i]._index]&&(this._ss[e[i]._index]=Xs.BEND)}}_residueGetCAlpha(e){for(let t=0;t<e._atoms.length;++t){const{name:n}=e._atoms[t];if(n==="CA"||n==="C1")return e._atoms[t].position}return null}_cosinusAngle(e,t,n,i){const r=e.clone().sub(t),s=n.clone().sub(i);let a=0;const c=r.dot(r)*s.dot(s);return c>0&&(a=r.dot(s)/Math.sqrt(c)),a}_kappa(e,t,n){const i=this._residueGetCAlpha(t),r=this._residueGetCAlpha(e),s=this._residueGetCAlpha(n);if(i===null||r===null||s===null)return 180;const a=this._cosinusAngle(i,r,s,i),c=Math.sqrt(1-a*a);return Math.atan2(c,a)*180/Math.PI}_isHelixStart(e,t){return this._helixFlags[t][e]===jh.START||this._helixFlags[t][e]===jh.START_AND_END}_buildBetaSheets(){const e=[];for(let r=0;r<this._complex._chains.length;++r){const s=this._chainLengths[r];if(s<=4)continue;const a=this._complex._chains[r].getResidues();for(let c=r;c<this._complex._chains.length;++c){const u=this._chainLengths[c];if(u<=4)continue;const d=this._complex._chains[c].getResidues();for(let p=1;p+1<s;++p){const g=a[p];let v=1;for(c===r&&(v=p+3);v+1<u;++v){const y=d[v],S=this._testBridge(a,p,d,v);if(S===Gl.NO_BRIDGE)continue;let E=!1;for(const w of e)if(!(S!==w.type||g._index!==w.i[w.i.length-1]+1)){if(S===Gl.PARALLEL&&w.j[w.j.length-1]+1===y._index){w.i.push(g._index),w.j.push(y._index),E=!0;break}if(S===Gl.ANTI_PARALLEL&&w.j[0]-1===y._index){w.i.push(g._index),w.j.unshift(y._index),E=!0;break}}E||e.push({type:S,i:[g._index],chainI:g.getChain()._index,j:[y._index],chainJ:y.getChain()._index})}}}}e.sort((r,s)=>r.chainI<s.chainI||r.chainI===s.chainI&&r.i[0]<s.i[0]?-1:1);for(let r=0;r<e.length;++r)for(let s=r+1;s<e.length;++s){const a=e[r].i[0],c=e[r].i[e[r].i.length-1],u=e[r].j[0],d=e[r].j[e[r].j.length-1],p=e[s].i[0],g=e[s].i[e[s].i.length-1],v=e[s].j[0],y=e[s].j[e[s].j.length-1];if(e[r].type!==e[s].type||this._hasChainBreak(Math.min(a,p),Math.max(c,g))||this._hasChainBreak(Math.min(u,v),Math.max(d,y))||p-c>=6||c>=p&&a<=g)continue;let S=!1;e[r].type===Gl.PARALLEL?S=v-d<6&&p-c<3||v-d<3:S=u-y<6&&p-c<3||u-y<3,S&&(e[r].i=e[r].i.concat(e[s].i),e[r].type===Gl.PARALLEL?e[r].j=e[r].j.concat(e[s].j):e[r].j=e[s].j.concat(e[r].j),e.splice(s--,1))}const t=new Set;for(let r=0;r<e.length;++r)t.add(e[r]);let n=1,i=0;for(;t.size>0;){let r=t.values().next().value;t.delete(r);const s=new Set;s.add(r);let a;do{a=new Set;for(const c of s.values())for(const u of t.values())this._areBridgesLinked(c,u)&&a.add(u);for(r of a.values())s.add(r),t.delete(r)}while(a.size>0);for(r of s.values())r.ladder=i,r.sheet=n,r.link=s,++i;++n}for(let r=0;r<e.length;++r){const s=e[r];let a=0,c=0;for(let d=0;d<s.i.length;++d)if(this._betaPartners[s.i[d]][0]){a=1;break}for(let d=0;d<s.j.length;++d)if(this._betaPartners[s.j[d]][0]){c=1;break}let u=Xs.BRIDGE;if(s.i.length>1&&(u=Xs.STRAND),s.type===Gl.PARALLEL){let d=0;for(let p=0;p<s.i.length;++p)this._betaPartners[s.i[p]][a]={residue:s.j[d++],ladder:s.ladder,parallel:!0};d=0;for(let p=0;p<s.j.length;++p)this._betaPartners[s.j[p]][c]={residue:s.i[d++],ladder:s.ladder,parallel:!0}}else{let d=s.j.length-1;for(let p=0;p<s.i.length;++p)this._betaPartners[s.i[p]][a]={residue:s.j[d--],ladder:s.ladder,parallel:!1};d=s.i.length-1;for(let p=0;p<s.j.length;++p)this._betaPartners[s.j[p]][c]={residue:s.i[d--],ladder:s.ladder,parallel:!1}}for(let d=s.i[0];d<=s.i[s.i.length-1];++d)this._ss[d]!==Xs.STRAND&&(this._ss[d]=u,this._sheet[d]=s.sheet);for(let d=s.j[0];d<=s.j[s.j.length-1];++d)this._ss[d]!==Xs.STRAND&&(this._ss[d]=u,this._sheet[d]=s.sheet)}}_testBridge(e,t,n,i){let r=Gl.NO_BRIDGE;const s=e[t-1]._index,a=e[t]._index,c=e[t+1]._index,u=n[i-1]._index,d=n[i]._index,p=n[i+1]._index,g=this._hbonds.isBond.bind(this._hbonds);return g(c,d)&&g(d,s)||g(p,a)&&g(a,u)?r=Gl.PARALLEL:(g(c,u)&&g(p,s)||g(d,a)&&g(a,d))&&(r=Gl.ANTI_PARALLEL),r}_areBridgesLinked(e,t){const n=new Set(e.i),i=new Set(e.j);for(const r of t.i)if(n.has(r)||i.has(r))return!0;for(const r of t.j)if(n.has(r)||i.has(r))return!0;return!1}_hasChainBreak(e,t){for(let n=e+1;n<=t;++n)if(this._complex._residues[n]._sequence!==this._complex._residues[n-1]._sequence+1)return!0;return!1}};tA.StructureType=Xs;var x2=5,{StructureType:vu}=tA,Dy=Ks.Type,HF={[vu.HELIX_ALPHA]:1,[vu.HELIX_PI]:3,[vu.HELIX_310]:5},WF={[vu.BRIDGE]:Dy.BRIDGE,[vu.TURN]:Dy.TURN,[vu.BEND]:Dy.BEND,[vu.LOOP]:Dy.COIL},nA=class{constructor(){this._chains=[],this._components=[],this._helices=[],this._sheets=[],this.structures=[],this._residueTypes=Object.create(kn.StandardTypes),this._atoms=[],this._residues=[],this._bonds=[],this._sgroups=[],this._molecules=[],this._maskNeedsUpdate=!1,this.metadata={},this.symmetry=[],this.units=[new BP(this)],this._currentUnit=0}addAtom(e){const t=this._atoms.length;return this._atoms.push(e),t}addSheet(e){const t=this._sheets.length;return this._sheets.push(e),t}addHelix(e){const t=this._helices.length;return this._helices.push(e),t}getAtoms(){return this._atoms}getBonds(){return this._bonds}getAtomCount(){return this._atoms.length}addResidue(e){const t=this._residues.length;return this._residues.push(e),t}updateToFrame(e){this.forEachChain(t=>{t.updateToFrame(e)})}addResidueType(e){return this._residueTypes[e]=new kn(e,"Unknown","")}getResidueCount(){return this._residues.length}getResidues(){return this._residues}getSGroupCount(){return this._sgroups.length}getSGroups(){return this._sgroups}getAtomByFullname(e){const t=e.split(".");if(t.length!==3)return null;const n=t[0],i=parseInt(t[1],10);if(Number.isNaN(i))return null;const r=t[2].toUpperCase();let s=null;return this.forEachChain(a=>{s||a._name.localeCompare(n)===0&&a.forEachResidue(c=>{s||c._sequence===i&&c.forEachAtom(u=>{s||r.localeCompare(u.name)===0&&(s=u)})})}),s}addChain(e){const t=new RP(this,e);return this._chains.push(t),t}getChain(e){for(let t=0,n=this._chains.length;t<n;++t){const i=this._chains[t];if(i.getName()===e)return i}return null}getChainCount(){return this._chains.length}getMolecules(){return this._molecules}getMoleculeCount(){return this._molecules.length}forEachAtom(e){const t=this._atoms;for(let n=0,i=t.length;n<i;++n)e(t[n])}forEachBond(e){const t=this._bonds;for(let n=0,i=t.length;n<i;++n)e(t[n])}forEachResidue(e){const t=this._residues;for(let n=0,i=t.length;n<i;++n)e(t[n])}forEachChain(e){const t=this._chains;for(let n=0,i=t.length;n<i;++n)e(t[n])}forEachMolecule(e){const t=this._molecules,n=t.length;for(let i=0;i<n;++i)e(t[i])}forEachSGroup(e){const t=this._sgroups;for(let n=0,i=t.length;n<i;++n)e(t[n])}forEachComponent(e){const t=this._components;for(let n=0,i=t.length;n<i;++n)e(t[n])}forEachVisibleComponent(e){const t=this._components;for(let n=0,i=t.length;n<i;++n)e(t[n])}addBond(e,t,n,i,r){const s=new M0(e,t,n,i,r);return this._bonds.push(s),s}getBondCount(){return this._bonds.length}getResidueType(e){return this._residueTypes[e]||null}getUnifiedSerial(e,t,n){return t+n*65536+e*16777216}splitUnifiedSerial(e){const i=Math.floor(e/16777216),r=e-i*16777216,s=Math.floor(r/65536);return{chain:i,serial:r-s*65536,iCode:s}}_fillCmpEdit(){const e=this,t=this._components;function n(){const i=new eC(e);return i._index=t.length,t[i._index]=i,i}this.forEachChain(i=>{const r=i._residues,s=r.length;if(s<1)return;let a=n(),c=r[0]._index;for(let u=0;u<s;++u){const d=r[u];d._component=a;const p=u===s-1?null:r[u+1];(!p||!d.isConnected(p)||d._index!==p._index-1)&&(a.setSubDivs([{start:c,end:d._index}]),p&&(c=p._index,a=n()))}})}_fillCmpNoedit(){const e=new eC(this);e._index=0;const t=this._residues,n=t.length;if(n===0)return;const i=[];let r=0;for(let s=0;s<n;++s){const a=t[s];a._component=e;const c=s===n-1?null:t[s+1];(!c||!a.isConnected(c))&&(i[i.length]={start:r,end:s},c&&(r=s+1))}e.setSubDivs(i),this._components[e._index]=e}_fillComponents(e){e?this._fillCmpEdit():this._fillCmpNoedit()}getCurrentUnit(){return this._currentUnit}getDefaultBoundaries(){return this.units[0].getBoundaries()}getBoundaries(){return this.units[this._currentUnit].getBoundaries()}getTransforms(){return this.units[this._currentUnit].getTransforms()}getSelector(){return this.units[this._currentUnit].getSelector()}resetCurrentUnit(){this._currentUnit=0,this.setCurrentUnit(1)}setCurrentUnit(e){return e!=null&&e!==this._currentUnit&&e>=0&&e<this.units.length?(this._currentUnit=e,!0):!1}_computeBounds(){const{units:e}=this;for(let t=0,n=e.length;t<n;++t)e[t].computeBoundaries()}onAtomPositionChanged(){this.forEachChain(e=>{e._finalize()}),this.forEachComponent(e=>{e.update()}),this._computeBounds(),this._finalizeBonds(),this.forEachSGroup(e=>{e._rebuildSGroupOnAtomChange()})}update(){this._maskNeedsUpdate&&(this.updateStructuresMask(),this._maskNeedsUpdate=!1)}_finalizeBonds(){const e=this.getBonds(),t=e.length;for(let n=0;n<t;++n)e[n]._index=n}finalize(e){e=e||{};const t=this._bonds;let n,i;for(n=t.length-1;n>=0;n--){const y=t[n];y._left===null||y._right===null?t.splice(n,1):(y._left.bonds.push(y),y._right.bonds.push(y))}const r=this._residues;for(n=0,i=r.length;n<i;++n)r[n]._finalize();this.forEachChain(y=>{y._finalize()});const{units:s}=this;for(n=0,i=s.length;n<i;++n)s[n].finalize();this.setCurrentUnit(1);const a={};for(n=0,i=r.length;n<i;++n){const y=r[n];a[this.getUnifiedSerial(y.getChain().getName().charCodeAt(0),y.getSequence(),y.getICode().charCodeAt(0))]=y}const{structures:c}=this;for(n=0,i=c.length;n<i;++n)c[n]._finalize(e.serialAtomMap,a,this);const u=this._helices;for(n=0,i=u.length;n<i;++n)u[n]._finalize(e.serialAtomMap,a,this);const d=this._sheets;for(n=0,i=d.length;n<i;++n)d[n]._finalize(e.serialAtomMap,a,this);this._computeBounds();const p=this._atoms;for(n=0,i=p.length;n<i;++n){const y=p[n];y.index=n}if(e.needAutoBonding)try{const y=new EF(this);y.build(),y.destroy()}catch(y){console.warn("Autobonding failed:",y)}const g=this._chains;for(n=0,i=g.length;n<i;++n)g[n]._index=n;for(n=0,i=r.length;n<i;++n)r[n]._index=n;for(n=0,i=p.length;n<i;++n){const y=p[n];if(y.flags&Ya.Flags.HYDROGEN&&y.bonds.length===1){const S=y.bonds[0];(S._left!==y&&S._left||S._right).flags&Ya.Flags.CARBON&&(y.flags|=Ya.Flags.NONPOLARH)}}this._finalizeBonds(),this._fillComponents(e.enableEditing);const v=new zF(this);v.markCycles(),e.detectAromaticLoops&&v.detectCycles(),this._finalizeMolecules()}_finalizeMolecules(){for(let e=0;e<this._molecules.length;e++){const t=this._molecules[e],n=t.residues.length;for(let i=0;i<n;i++){const r=t.residues[i];r._molecule=t}}}updateStructuresMask(){const e=t=>t.collectMask();this.forEachResidue(e),this.forEachChain(e),this.forEachMolecule(e)}countAtomsByMask(e){let t=0;return this.forEachAtom(n=>{(n.mask&e)!==0&&t++}),t}getNumAtomsBySelector(e){let t=0;return this.forEachAtom(n=>{e.includesAtom(n)&&t++}),t}resetAtomMask(e){this.forEachAtom(t=>{t.mask=e})}markAtoms(e,t){const n=t,i=~n;let r=0;const s=mf.keyword("And")(e,this.getSelector());return this.forEachAtom(a=>{s.includesAtom(a)?(a.mask|=n,r++):a.mask&=i}),this._maskNeedsUpdate=!0,r}markAtomsAdditionally(e,t){const n=t;let i=0;return this.forEachAtom(r=>{e.includesAtom(r)&&(r.mask&t)!==t&&(r.mask|=n,i++)}),i}clearAtomBits(e){const t=~e;this.forEachAtom(i=>{i.mask&=t});const n=i=>{i._mask&=t};this.forEachAtom(n),this.forEachResidue(n),this.forEachChain(n),this.forEachMolecule(n)}getAtomNames(){if(this.hasOwnProperty("_atomNames"))return this._atomNames;const e={};return this.forEachAtom(t=>{e[t.name]=1}),this._atomNames=Object.keys(e),this._atomNames}getElements(){if(this.hasOwnProperty("_elements"))return this._elements;const e={};return this.forEachAtom(t=>{e[t.element.name]=1}),this._elements=Object.keys(e),this._elements}getResidueNames(){if(this.hasOwnProperty("_residueNames"))return this._residueNames;const e={};return this.forEachResidue(t=>{e[t._type._name]=1}),this._residueNames=Object.keys(e),this._residueNames}getChainNames(){if(this.hasOwnProperty("_chainNames"))return this._chainNames;const e={};return this.forEachChain(t=>{e[t._name]=1}),this._chainNames=Object.keys(e),this._chainNames}getAltLocNames(){if(this.hasOwnProperty("_altlocNames"))return this._altlocNames;const e={};return this.forEachAtom(t=>{e[String.fromCharCode(t.location)]=1}),this._altlocNames=Object.keys(e),this._altlocNames}getVoxelWorld(){if(!this.hasOwnProperty("_voxelWorld"))try{this._voxelWorld=new FP(this.getDefaultBoundaries().boundingBox,new R.Vector3(x2,x2,x2)),this._voxelWorld.addAtoms(this)}catch{Qi.warn("Unable to create voxel world"),this._voxelWorld=null}return this._voxelWorld}addElement(e,t,n,i){const{length:r}=e;for(let s=0;s<r;++s){const a=e[s];i(a,n),t.push(a)}}joinComplexes(e){this._chains=[],this._components=[],this._helices=[],this._sheets=[],this.structures=[],this._atoms=[],this._residues=[],this._bonds=[],this._sgroups=[];const t=this;let n=0,i=0,r=0,s=0,a=0;function c(y,S){y.serial+=S,y.index+=S}function u(y,S){y._index+=S}function d(y,S){y._index+=S}function p(y,S){y._complex=t,y._index+=S}function g(y,S){y._complex=t,y._index+=S}function v(){}for(let y=0;y<e.length;++y){const S=e[y];this.addElement(S._atoms,this._atoms,n,c),this.addElement(S._bonds,this._bonds,i,u),this.addElement(S._residues,this._residues,r,d),this.addElement(S._chains,this._chains,s,p),this.addElement(S._sheets,this._sheets,0,v),this.addElement(S._helices,this._helices,0,v),this.addElement(S._sgroups,this._sgroups,0,v),this.addElement(S._components,this._components,a,g),this.addElement(S.structures,this.structures,0,v);for(const E in S._residueTypes)S._residueTypes.hasOwnProperty(E)&&(this._residueTypes[E]=S._residueTypes[E]);n+=S._atoms.length,i+=S._bonds.length,r+=S._residues.length,s+=S._chains.length,a+=S._components.length}this._computeBounds()}dssp(){const e=new tA(this),t=this.structures=[],n=this._helices=[],i=this._sheets=[],r=d=>{let p=i[d];return p||(p=i[d]=new NP(String(d),0)),p};let s,a,c=0,u=null;for(let d=0,p=this._residues.length;d<p;++d){const g=e._ss[d],v=this._residues[d],y=e._sheet[d];if(g===s&&y===a){v._secondary=u,u&&(u.term=v),u instanceof fM&&u.length++;continue}const S=HF[g],E=WF[g];if(g===vu.STRAND){const w=r(y);u=new $w(w,v,v,0,null,null),w.addStrand(u)}else S!==void 0?(c++,u=new fM(S,v,v,c,String(c),"",1),n.push(u)):E!==void 0?u=new Ks(E,v,v):u=null;u&&t.push(u),v._secondary=u,s=g,a=y}this._sheets=i.filter(d=>!0)}};nA.prototype.id="Complex";nA.prototype.name="";var iA=nA;function cC(e){let t=2;for(e=e-1>>1;e;)t<<=1,e>>=1;return t}var kP=class GP{constructor(t,n,i,r,s,a){switch(this._box=i.clone(),this._dimVec=Math.max(Math.floor(r||1),1),this._volumeInfo=a,n instanceof Array?[this._dimX,this._dimY,this._dimZ]=n:(this._dimX=n.x,this._dimY=n.y,this._dimZ=n.z),this._dimX=Math.max(Math.floor(this._dimX),1),this._dimY=Math.max(Math.floor(this._dimY),1),this._dimZ=Math.max(Math.floor(this._dimZ),1),this._rowElements=this._dimVec*this._dimX,this._planeElements=this._rowElements*this._dimY,this._totalElements=this._planeElements*this._dimZ,this._data=s||rt.allocateTyped(t,this._totalElements),this._dimVec){case 1:break;case 2:this.getValue=function(c,u,d){const p=c*this._dimVec+u*this._rowElements+d*this._planeElements;return[this._data[p],this._data[p+1]]},this.setValue=function(c,u,d,p,g){const v=c*this._dimVec+u*this._rowElements+d*this._planeElements;this._data[v]=p,this._data[v+1]=g},this.addValue=function(c,u,d,p,g){const v=c*this._dimVec+u*this._rowElements+d*this._planeElements;this._data[v]+=p,this._data[v+1]+=g};break;case 3:this.getValue=function(c,u,d){const p=c*this._dimVec+u*this._rowElements+d*this._planeElements;return[this._data[p],this._data[p+1],this._data[p+2]]},this.setValue=function(c,u,d,p,g,v){const y=c*this._dimVec+u*this._rowElements+d*this._planeElements;this._data[y]=p,this._data[y+1]=g,this._data[y+2]=v},this.addValue=function(c,u,d,p,g,v){const y=c*this._dimVec+u*this._rowElements+d*this._planeElements;this._data[y]+=p,this._data[y+1]+=g,this._data[y+2]+=v};break;default:throw new Error("Volume: invalid vector dimension")}}getValue(t,n,i){return this._data[t+n*this._rowElements+i*this._planeElements]}setValue(t,n,i,r){this._data[t+n*this._rowElements+i*this._planeElements]=r}addValue(t,n,i,r){this._data[t+n*this._rowElements+i*this._planeElements]+=r}getDimensions(){return[this._dimX,this._dimY,this._dimZ]}getBox(){return this._box}getVolumeInfo(){return this._volumeInfo}getCellSize(){const t=new R.Vector3;this._box.getSize(t);const n=new R.Vector3;return n.x=this._dimX>1?t.x/(this._dimX-1):0,n.y=this._dimY>1?t.y/(this._dimY-1):0,n.z=this._dimZ>1?t.z/(this._dimZ-1):0,n}computeGradient(){if(this._dimVec!==1)return null;const t=new GP(Float32Array,[this._dimX,this._dimY,this._dimZ],this._box,3),n=this.getCellSize(),i=new R.Vector3(-.5/n.x,-.5/n.y,-.5/n.z);function r(p,g,v){return Math.min(v,Math.max(g,p))}const s=this._dimX,a=this._dimY,c=this._dimZ,u=this._data;function d(p,g,v){return u[v*s*a+g*s+p]}for(let p=0;p<c;++p){const g=r(p-1,0,c-1),v=r(p+1,0,c-1);for(let y=0;y<a;++y){const S=r(y-1,0,a-1),E=r(y+1,0,a-1);for(let w=0;w<s;++w){const b=r(w-1,0,s-1),T=r(w+1,0,s-1);t.setValue(w,y,p,(d(T,y,p)-d(b,y,p))*i.x,(d(w,E,p)-d(w,S,p))*i.y,(d(w,y,v)-d(w,y,g))*i.z)}}}return t}normalize(){const t=this._data;let n=t[0],i=t[0];for(let s=1;s<t.length;++s)n=Math.min(n,t[s]),i=Math.max(i,t[s]);const r=1/(i-n);if(r!==0)for(let s=0;s<t.length;++s)t[s]=r*(t[s]-n)}getTiledTextureStride(){return[this._dimX+2,this._dimY+2]}buildTiledTexture(){let t=Math.ceil(Math.sqrt(this._dimZ*this._dimY/this._dimX)),n=t*(this._dimX+2)-1;n=cC(n),t=Math.floor(n/(this._dimX+2));const i=Math.ceil(this._dimZ/t);let r=i*(this._dimY+2)-1;r=cC(r);const s=new Uint8Array(n*r);let a,c;for(let d=0;d<i;++d)for(let p=0;p<this._dimY;++p){a=d*t*this._planeElements+p*this._rowElements,c=n*(d*(this._dimY+2)+p);for(let g=0;g<t;++g){for(let v=0;v<this._dimX;++v)s[c++]=255*this._data[a++];s[c++]=255*this._data[a-1],g<t-1&&(a+=this._planeElements-this._rowElements,s[c++]=255*this._data[a])}}for(let d=0;d<i;++d){a=n*(d*(this._dimY+2)+this._dimY-1),c=a+n;for(let p=0;p<n;++p)s[c++]=s[a++];if(d<i-1){a=n*(d+1)*(this._dimY+2),c=a-n;for(let p=0;p<n;++p)s[c++]=s[a++]}}const u=new R.DataTexture(s,n,r,R.LuminanceFormat,R.UnsignedByteType,R.UVMapping,R.ClampToEdgeWrapping,R.ClampToEdgeWrapping,R.LinearFilter,R.LinearFilter);return u.needsUpdate=!0,u}getData(){return this._data}getDirectIdx(t,n,i){return t*this._dimVec+n*this._rowElements+i*this._planeElements}getStrideX(){return this._dimVec}getStrideY(){return this._rowElements}getStrideZ(){return this._planeElements}};kP.prototype.id="Volume";var HP=kP,XF=class{constructor(e,t,n){this.complex=e,this.name=t||"",this.residues=[],this.mask=1,this.index=n||-1}forEachResidue(e){const{residues:t}=this;for(let n=0,i=t.length;n<i;++n)e(t[n])}collectMask(){let e=4294967295;const{residues:t}=this;for(let n=0,i=t.length;n<i;++n)e&=t[n]._mask;this.mask=e}},nr={Atom:Ya,Element:u0,Bond:M0,Residue:dx,ResidueType:kn,Chain:RP,Helix:fM,Strand:$w,Sheet:NP,SGroup:pF,Assembly:Jw,Complex:iA,Volume:HP,VoxelWorld:FP,selectors:mf,Molecule:XF},jF=class WP extends R.Object3D{constructor(t){super();const n=this;this._element=t,this._element.style.position="absolute",this.addEventListener("removed",()=>{n._element.parentNode!==null&&n._element.parentNode.removeChild(n._element)})}getElement(){return this._element}setTransparency(t){const n=this.getElement();if(n===null)return;if(t===1){n.style.display="none";return}n.style.display="inline";const i=1-t,r=i.toString(),s=i*100;n.style.opacity=r,n.style.filter=`alpha(opacity=${s})`}clone(){const t=new WP(this._element);return t.copy(this),t}},rA=jF,YF=class extends R.Group{raycast(e,t){if(!this.visible)return;const{children:n}=this;for(let i=0,r=n.length;i<r;++i)n[i].raycast(e,t)}enableSubset(e,t){const{children:n}=this;for(let i=0,r=n.length;i<r;++i)n[i].enableSubset&&n[i].enableSubset(e,t)}disableSubset(e,t){const{children:n}=this;for(let i=0,r=n.length;i<r;++i)n[i].disableSubset&&n[i].disableSubset(e,t)}isEmpty(){return this.children.length===0}updateToFrame(e){const{children:t}=this;for(let n=0,i=t.length;n<i;++n)t[n].updateToFrame&&t[n].updateToFrame(e)}getSubset(e,t){const n=[],{children:i}=this;for(let r=0,s=i.length;r<s;++r)i[r].getSubset&&Array.prototype.push.apply(n,i[r].getSubset(e,t));return n}},wf=YF,Ru=`uniform mat4 projectionMatrix;\r
uniform mat4 modelViewMatrix;\r
\r
attribute vec2 uv;\r
attribute vec3 position;\r
\r
varying vec2 vUv;\r
\r
void main() {\r
vUv = uv;\r
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\r
}\r
`,qF=`precision highp float;\r
\r
varying vec2 vUv;\r
uniform sampler2D srcTex;\r
uniform float opacity;\r
\r
void main() {\r
vec4 color = texture2D(srcTex, vUv);\r
gl_FragColor = vec4(color.xyz, color.a * opacity);\r
}\r
`,$F=`precision highp float;\r
\r
varying vec2 vUv;\r
uniform sampler2D srcTex;\r
uniform float coef;\r
\r
void main() {\r
vec2 uv = vUv * 2.0 - 1.0;\r
float r2 = dot(uv, uv);\r
vec2 tc = uv * (1.0 + coef * r2);\r
if (!all(lessThan(abs(tc), vec2(1.0))))\r
discard;\r
tc = 0.5 * (tc + 1.0);\r
gl_FragColor = texture2D(srcTex, tc);\r
}\r
`,pM={DEFAULT:0,VOLUME:1,TRANSPARENT:2,PREPASS_TRANSPARENT:3,VOLUME_BFPLANE:4,COLOR_FROM_POSITION:5,SHADOWMAP:6},uC=[pM.DEFAULT,pM.TRANSPARENT];R.Object3D.prototype.resetTransform=function(){this.position.set(0,0,0),this.quaternion.set(0,0,0,1),this.scale.set(1,1,1)};R.Object3D.prototype.updateMatrixWorldRecursive=function(){this.parent!=null&&this.parent.updateMatrixWorldRecursive(),this.updateMatrixWorld()};R.Object3D.prototype.addSavingWorldTransform=(function(){const e=new R.Matrix4;return function(t){t instanceof R.Object3D&&(e.copy(this.matrixWorld).invert(),e.multiply(t.matrixWorld),t.matrix.copy(e),t.matrix.decompose(t.position,t.quaternion,t.scale),this.add(t))}})();R.WebGLRenderer.prototype.renderDummyQuad=(function(){const e=new R.MeshBasicMaterial({transparent:!0,opacity:0,depthWrite:!1}),t=new R.Scene,n=new R.Mesh(new R.PlaneGeometry(.01,.01),e);t.add(n);const i=new R.OrthographicCamera(-.5,.5,.5,-.5,-1e4,1e4);return i.position.z=100,function(){this.render(t,i)}})();R.WebGLRenderer.prototype.renderScreenQuad=(function(){const e=new R.Scene,t=new R.Mesh(new R.PlaneGeometry(1,1));e.add(t);const n=new R.OrthographicCamera(-.5,.5,.5,-.5,-1e4,1e4);return n.position.z=100,function(i){t.material=i,this.render(e,n)}})();R.Matrix4.prototype.isIdentity=(function(){const e=new R.Matrix4;return function(){return e.equals(this)}})();R.Matrix4.prototype.applyToPointsArray=function(e,t,n){if(!e||!t||t<3)return e;n=n||0;const i=this.elements;for(let r=0;r<e.length;r+=t){const s=e[r],a=e[r+1],c=e[r+2],u=1/(i[3]*s+i[7]*a+i[11]*c+i[15]);e[r]=(i[0]*s+i[4]*a+i[8]*c+i[12]*n)*u,e[r+1]=(i[1]*s+i[5]*a+i[9]*c+i[13]*n)*u,e[r+2]=(i[2]*s+i[6]*a+i[10]*c+i[14]*n)*u}return e};var XP=class extends R.RawShaderMaterial{constructor(e){e.uniforms===void 0&&(e.uniforms={}),e.uniforms.srcTex={type:"t",value:null},e.vertexShader=Ru,e.transparent=!1,e.depthTest=!1,e.depthWrite=!1,super(e)}};R.WebGLRenderer.prototype.renderScreenQuadFromTex=(function(){const e=new XP({uniforms:{opacity:{type:"f",value:1}},fragmentShader:qF,transparent:!0});return function(t,n){e.uniforms.srcTex.value=t,e.transparent=n<1,e.uniforms.opacity.value=n,this.renderScreenQuad(e)}})();R.WebGLRenderer.prototype.renderScreenQuadFromTexWithDistortion=(function(){const e=new XP({uniforms:{coef:{type:"f",value:1}},fragmentShader:$F});return function(t,n){e.uniforms.srcTex.value=t,e.uniforms.coef.value=n,this.renderScreenQuad(e)}})();R.PerspectiveCamera.prototype.setMinimalFov=function(e){this.aspect>=1?this.fov=e:this.fov=R.MathUtils.radToDeg(2*Math.atan(Math.tan(R.MathUtils.degToRad(e)*.5)/this.aspect))};R.StereoCamera.prototype.updateHalfSized=function(e,t){const n=e.aspect,i=e.fov;e.aspect=n/2,e.setMinimalFov(t),e.updateProjectionMatrix(),this.update(e),e.aspect=n,e.fov=i,e.updateProjectionMatrix()};R.PerspectiveCamera.prototype.setDistanceToFit=function(e,t){this.position.z=e/Math.sin(.5*R.MathUtils.degToRad(t))};R.Raycaster.prototype.intersectVisibleObject=function(e,t,n,i){const r=this.intersectObject(e,!1);if(r.length===0)return null;const s=Math.min(t.near,n);let a,c=r[0];const u=new R.Vector3;for(a=0;a<r.length&&(c=r[a],u.copy(c.point),u.applyMatrix4(t.matrixWorldInverse),!(u.z<=-s));++a);if(a===r.length)return null;const d=Math.min(t.far,i);return u.copy(c.point),u.applyMatrix4(t.matrixWorldInverse),u.z<=-d?null:c};R.Matrix4.prototype.extractScale=(function(){const e=new R.Vector3;return function(t){t===void 0&&(Qi.debug("extractScale(): new is too expensive operation to do it on-the-fly"),t=e.clone());const n=this.elements;return t.x=e.set(n[0],n[1],n[2]).length(),t.y=e.set(n[4],n[5],n[6]).length(),t.z=e.set(n[8],n[9],n[10]).length(),this.determinant()<0&&(t.x=-t.x),t}})();function ZF(e,t,n){const i=e.clone().lerp(t,.5),r=new R.Matrix4;r.makeScale(n,e.distanceTo(t),n);const s=new R.Matrix4;s.makeRotationX(Math.PI/2);const a=new R.Matrix4,c=new R.Vector3(0,1,0);return a.lookAt(i,t,c),a.multiply(s),a.multiply(r),a.setPosition(i),a}function KF(e,t,n,i){const r=new R.Matrix4;r.makeScale(i.x,i.y,0);const s=new R.Matrix4;return s.lookAt(e,t,n),s.multiply(r),s.setPosition(e),s}function QF(e){let t=!1;return e.traverse(n=>{(n.hasOwnProperty("geometry")||n instanceof rA)&&(t=!0)}),t}function JF(e,t,n){function i(a){let u=0,d=a,p=1;for(;Math.abs(d-u)>1e-5;)p=1+n*d,u=d,d=a/(p*p);return 1/p}const r=new R.PlaneGeometry(2,2,e,t),s=r.getAttribute("position");for(let a=0;a<s.count;++a){const c=s.array[3*a],u=s.array[3*a+1],d=i(c*c+u*u);s.setXY(a,d*c,d*u)}return r}R.BufferAttribute.prototype.copyAtList=function(e,t){console.assert(this.itemSize===e.itemSize,"DEBUG: BufferAttribute.copyAtList buffers have different item size.");const{itemSize:n}=this;for(let i=0,r=t.length;i<r;++i)for(let s=0;s<n;++s)this.array[i*n+s]=e.array[t[i]*n+s];return this};function e7(e,t,n,i){n=typeof n<"u"?n:0,i=typeof i<"u"?i:e.length;for(let r=n;r<i;++r)e[r]=t}function t7(e){const{children:t}=e;for(let n=0,i=t.length;n<i;++n){const r=t[n];r.parent=null,r.dispatchEvent({type:"removed"})}e.children=[]}function jP(e){e.traverse(t=>{(t instanceof R.Mesh||t instanceof R.LineSegments||t instanceof R.Line)&&t.geometry.dispose()}),t7(e)}function n7(e){jP(e),e.parent?e.parent.remove(e):e.dispatchEvent({type:"removed"})}function i7(e){for(let t=0;t<uC.length;t++)if((e.layers.mask>>uC[t]&1)===1)return!0;return!1}function r7(e,t){const n=+(t!=="BA");e.traverse(i=>{i.isGroup&&(i.renderOrder=n)})}function s7(e){e.traverse(t=>{"material"in t&&(t.material=t.material.clone(!0),t.material.setValues({depthFunc:R.LessEqualDepth,overrideColor:!0,fog:!1,lights:!1,shadowmap:!1}),t.material.setUberOptions({fixedColor:new R.Color(16776960),zOffset:-1e-6}))})}function o7(e,t,n){const i=n||new R.Vector3;return i.set(0,0,0),i.addScaledVector(e,.5),i.addScaledVector(t,.5),i}var a7=R.InstancedBufferGeometry.prototype.copy;R.InstancedBufferGeometry.prototype.copy=function(e){a7.call(this,e),this.instanceCount===void 0&&(this.instanceCount=1/0)};var Xt={calcCylinderMatrix:ZF,calcChunkMatrix:KF,groupHasGeometryToRender:QF,buildDistorionMesh:JF,RCGroup:wf,fillArray:e7,clearTree:jP,destroyObject:n7,belongToSelectLayers:i7,processObjRenderOrder:r7,applySelectionMaterial:s7,getMiddlePoint:o7,LAYERS:pM},l7={boundingBox:new R.Box3(new R.Vector3(-1,-1,-1),new R.Vector3(1,1,1)),boundingSphere:new R.Sphere(new R.Vector3(0,0,0),1)},c7=class extends Xt.RCGroup{constructor(e,t){super(e,t),this.name=e,this._dataSource=t}release(){this.parent&&this.parent.remove(this)}getDataSource(){return this._dataSource}getBoundaries(){return l7}},f0=c7;function hC(e){return e==null||Array.isArray(e)?e:[e]}var u7=class U1{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["id"];this._list=[],this._dict={},this._indices=[...n],this._indices.forEach(i=>{this._dict[i]={}}),t.forEach(i=>this.register(i))}static registerInList(t,n){t.includes(n)||t.push(n)}static unregisterFromList(t,n){const i=t.indexOf(n);i!==-1&&t.splice(i,1)}static registerInDict(t,n,i){n.forEach(r=>{r=r.toLowerCase();const s=t[r]=t[r]||[];s.includes(i)||s.push(i)})}static unregisterFromDict(t,n,i){n.forEach(r=>{r=r.toLowerCase();const s=t[r];if(s){const a=s.indexOf(i);a!==-1&&s.splice(a,1),s.length===0&&delete t[r]}})}register(t){U1.registerInList(this._list,t),this._indices.forEach(n=>{U1.registerInDict(this._dict[n],hC(t[n]),t)})}unregister(t){U1.unregisterFromList(this._list,t),this._indices.forEach(n=>{U1.unregisterFromDict(this._dict[n],hC(t[n]),t)})}get all(){return[...this._list]}get first(){return this._list[0]}keys(t){return Object.keys(this._dict[t||this._indices[0]])}get(t,n){const i=this._dict[n||this._indices[0]];if(i){const r=i[t&&t.toLowerCase()];return r&&r.length>0?r[0]:void 0}}},Af=u7;function h7(e){Object.defineProperties(e,{logger:{get(){return this.context&&this.context.logger?this.context.logger:Qi}},settings:{get(){return this.context&&this.context.settings?this.context.settings:Pe}}})}var w0=h7,f7=class YP{constructor(t,n){this._position=t,this._radius=n}static _sphere=new R.Sphere;raycast(t){const n=YP._sphere;n.set(this._position,this._radius);const i=new R.Vector3;return t.ray.intersectSphere(n,i)?{distance:t.ray.origin.distanceTo(i),point:i}:null}},d7=e=>class extends e{constructor(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];super(...i),this._objects=new Array(t),this.boundingSphere=null,this.boundingBox=null}setSphere(t,n,i){this._objects[t]=new f7(n,i)}raycast(t,n){for(let i=0,r=this._objects.length;i<r;++i){const s=this._objects[i].raycast(t);s&&(s.chunkIdx=i,n.push(s))}}computeBoundingBox(){const t=this._objects;let{boundingBox:n}=this;n===null&&(this.boundingBox=n=new R.Box3),n.makeEmpty();for(let i=0,r=t.length;i<r;++i)n.expandByPoint(t[i]._position)}computeBoundingSphere(){this.computeBoundingBox();const t=this._objects,{boundingBox:n}=this;let i=0;const r=new R.Vector3;n.getCenter(r);for(let s=0,a=t.length;s<a;++s){const c=t[s]._position,u=r.distanceToSquared(c);i<u&&(i=u)}this.boundingSphere===null&&(this.boundingSphere=new R.Sphere),this.boundingSphere.set(r,Math.sqrt(i))}},sA=d7,zy=new R.Color,Uy=4,By=3,{copySubArrays:fC}=rt;function p7(e,t,n,i,r){e[t]=n,e[t+1]=i,e[t+2]=r}function m7(e,t,n,i,r,s){e[t]=n,e[t+1]=i,e[t+2]=r,e[t+3]=s}var g7=class extends sA(R.InstancedBufferGeometry){constructor(e,t,n){super(e),this._sphGeometry=n?new R.PlaneGeometry(2,2,1,1):new R.SphereBufferGeometry(1,t*2,t,0,Math.PI*2,0,Math.PI),this._init(e,this._sphGeometry)}setItem(e,t,n){m7(this._offsets,e*Uy,t.x,t.y,t.z,n),this.setSphere(e,t,n)}setColor(e,t){zy.set(t),p7(this._colors,e*By,zy.r,zy.g,zy.b)}startUpdate(){return!0}finishUpdate(){this.getAttribute("offset").needsUpdate=!0,this.getAttribute("color").needsUpdate=!0}finalize(){this.finishUpdate(),this.computeBoundingSphere()}setOpacity(e,t){const n=this._alpha;for(let i=0,r=e.length;i<r;++i)n[e[i]]=t;this.getAttribute("alphaColor").needsUpdate=!0}getSubset(e){const t=e.length,n=new R.InstancedBufferGeometry;return this._init.call(n,t,this._sphGeometry),fC(this._offsets,n._offsets,e,Uy),fC(this._colors,n._colors,e,By),n.boundingSphere=this.boundingSphere,n.boundingBox=this.boundingBox,[n]}_init(e,t){this.copy(t),this._offsets=rt.allocateTyped(Float32Array,e*Uy),this._colors=rt.allocateTyped(Float32Array,e*By);const n=this._alpha=rt.allocateTyped(Float32Array,e);We.default.fill(n,1),this.setAttribute("offset",new R.InstancedBufferAttribute(this._offsets,Uy,!1,1)),this.setAttribute("color",new R.InstancedBufferAttribute(this._colors,By,!1,1)),this.setAttribute("alphaColor",new R.InstancedBufferAttribute(n,1,!1,1))}},qP=g7,_7=65535,uu=3,Vy=new R.Color,v7=class $P extends R.BufferGeometry{constructor(t,n){if(super(),this.constructor===$P)throw new Error("Can not instantiate abstract class!");this._chunkGeo=t,this._init(t,n)}startUpdate(){return!0}finishUpdate(){this.getAttribute("position").needsUpdate=!0,this.getAttribute("normal").needsUpdate=!0,this.getAttribute("color").needsUpdate=!0}setColor(t,n){Vy.set(n);const i=this._colors,r=this._chunkSize;for(let s=t*r,a=s+r;s<a;++s){const c=s*uu;i[c]=Vy.r,i[c+1]=Vy.g,i[c+2]=Vy.b}}finalize(){this.finishUpdate(),this.computeBoundingSphere()}setOpacity(t,n){const i=this._alpha,r=this._chunkSize;for(let s=0,a=t.length;s<a;++s){const c=t[s]*r;We.default.fill(i,n,c,c+r)}this.getAttribute("alphaColor").needsUpdate=!0}raycast(t,n){const i=[],r=new R.Mesh;r.geometry=this,r.raycast(t,i);const s=this._chunkGeo.index.count/3;for(let a=0,c=i.length;a<c;++a)i[a].hasOwnProperty("faceIndex")&&(i[a].chunkIdx=Math.floor(i[a].faceIndex/s),n.push(i[a]))}getSubset(t){const n=t.length,i=new R.BufferGeometry;this._init.call(i,this._chunkGeo,n);const r=this._positions,s=this._normals,a=this._colors,c=i._positions,u=i._normals,d=i._colors,p=this._chunkSize*uu;for(let g=0,v=t.length;g<v;++g){const y=g*p,S=t[g]*p,E=S+p;c.set(r.subarray(S,E),y),u.set(s.subarray(S,E),y),d.set(a.subarray(S,E),y)}return i.boundingSphere=this.boundingSphere,i.boundingBox=this.boundingBox,[i]}_init(t,n){const i=this._chunkSize=t.attributes.position.count,r=t.index.array,s=r.length,a=this._chunkSize*n,c=a>_7,u=s*n,d=this._index=rt.allocateTyped(c?Uint32Array:Uint16Array,u);this._positions=rt.allocateTyped(Float32Array,a*uu),this._normals=rt.allocateTyped(Float32Array,a*uu),this._colors=rt.allocateTyped(Float32Array,a*uu);const p=this._alpha=rt.allocateTyped(Float32Array,a);We.default.fill(p,1);for(let g=0;g<n;++g){const v=g*s,y=g*i;d.set(r,v);for(let S=0;S<s;++S)d[v+S]+=y}this.setIndex(new R.BufferAttribute(this._index,1)),this.setAttribute("position",new R.BufferAttribute(this._positions,uu)),this.setAttribute("normal",new R.BufferAttribute(this._normals,uu)),this.setAttribute("color",new R.BufferAttribute(this._colors,uu)),this.setAttribute("alphaColor",new R.BufferAttribute(p,1))}},eS=v7,S2=3,y7=class extends sA(eS){constructor(e,t){const n=new R.SphereBufferGeometry(1,t*2,t,0,Math.PI*2,0,Math.PI);super(e,n,e);const i=this._normals,r=n.attributes.normal.array,s=this._chunkSize;this._chunkPos=this._chunkGeo.attributes.position.array,this._tmpPositions=rt.allocateTyped(Float32Array,s*S2);for(let a=0;a<e;++a)i.set(r,s*S2*a)}setItem(e,t,n){const i=this._tmpPositions,r=this._chunkSize,s=this._chunkPos;for(let a=0;a<r;++a){const c=a*3;i[c]=t.x+s[c]*n,i[c+1]=t.y+s[c+1]*n,i[c+2]=t.z+s[c+2]*n}this._positions.set(i,r*e*S2),this.setSphere(e,t,n)}},x7=y7,xp=3,Sp=new R.Vector3,bp=new R.Vector3,dC=new R.Matrix3,S7=class extends eS{constructor(e,t){const n=new R.CylinderGeometry(1,1,1,Math.max(3,t),2,!0);super(n,2*e);const i=this._chunkSize;this._chunkPos=this._chunkGeo.attributes.position.array,this._chunkNorms=this._chunkGeo.attributes.normal.array,this._tmpVector=rt.allocateTyped(Float32Array,i*xp)}setItem(e,t,n,i){const r=this._chunkSize,s=r*2*e*xp,a=s+r*xp,c=this._tmpVector,u=this._chunkPos,d=this._chunkNorms;Sp.lerpVectors(t,n,.5);const p=Xt.calcCylinderMatrix(t,Sp,i);dC.getNormalMatrix(p);let g;for(let v=0;v<r;++v)g=v*xp,bp.fromArray(u,g),bp.applyMatrix4(p),bp.toArray(c,g);this._positions.set(c,s),Sp.sub(t);for(let v=0;v<r;++v)g=v*xp,c[g]+=Sp.x,c[g+1]+=Sp.y,c[g+2]+=Sp.z;this._positions.set(c,a);for(let v=0;v<r;++v)g=v*xp,bp.fromArray(d,g),bp.applyMatrix3(dC),bp.toArray(c,g);this._normals.set(c,s),this._normals.set(c,a)}setColor(e,t,n){const i=2*e;super.setColor(i,t);const r=i+1;super.setColor(r,n)}},oA=S7,b7=65536,C1=3,M7=class ZP extends R.BufferGeometry{constructor(t,n,i,r,s,a){super();const c=0,u=2*Math.PI;this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:n,height:i,radialSegments:r,heightSegments:s,openEnded:a};const d=a===!1&&t>0,p=a===!1&&n>0,g=(s+1)*r+d*(r+1)+p*(r+1),v=(2*s+d+p)*r,y=i/2,S=new R.BufferAttribute(rt.allocateTyped(Float32Array,g*3),3),E=new R.BufferAttribute(rt.allocateTyped(Float32Array,g*3),3),w=new R.Uint16BufferAttribute(rt.allocateTyped(Uint16Array,v*C1),1),b=new R.BufferAttribute(rt.allocateTyped(Float32Array,g*2),2);console.assert(g<b7,"DEBUG: Cylinder Geometry has too many vertices (65536 max).");let T=0,L=0;const C=-(n-t)/i;for(let P=0;P<=s;P++){if(P!==s)for(let U=0;U<r;U++){const I=T+U,z=T+r+U,te=T+r+(U+1)%r,oe=T+(U+1)%r;w.setXYZ(L*C1,I,oe,z),L++,w.setXYZ(L*C1,z,oe,te),L++}const O=P/s,B=O*(n-t)+t;for(let U=0;U<r;U++){const I=U/r,z=B*Math.sin(I*u+c),te=O*i-y,oe=B*Math.cos(I*u+c),ee=new R.Vector3(z,Math.sqrt(z*z+oe*oe)*C,oe).normalize();S.setXYZ(T,z,te,oe),E.setXYZ(T,ee.x,ee.y,ee.z),b.setXY(T,I,O),++T}}if(d){const P=T,O=T+r;for(let B=0;B<r;++B){const U=T-r;S.setXYZ(T,S.getX(U),S.getY(U),S.getZ(U)),E.setXYZ(T,0,1,0),b.setXY(T,1,1);const I=P+(B+1)%r;w.setXYZ(L*C1,T,I,O),L++,T++}S.setXYZ(T,0,y,0),E.setXYZ(T,0,1,0),b.setXY(T,1,1),++T}if(p){const P=T,O=T+r;for(let B=0;B<r;++B){const U=B;S.setXYZ(T,S.getX(U),S.getY(U),S.getZ(U)),E.setXYZ(T,0,-1,0),b.setXY(T,0,0);const I=P+(B+1)%r;w.setXYZ(L*C1,I,T,O),L++,T++}S.setXYZ(T,0,-y,0),E.setXYZ(T,0,-1,0),b.setXY(T,0,0)}this.setIndex(w),this.setAttribute("position",S),this.setAttribute("normal",E),this.setAttribute("uv",b)}clone(){const{parameters:t}=this;return new ZP(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded)}},w7=M7,hu=new R.Color,pC=new R.Matrix4,Ki=4,ql=3,{copySubArrays:fu}=rt;function mC(e,t,n,i,r){e[t]=n,e[t+1]=i,e[t+2]=r}function Mp(e,t,n,i,r,s){e[t]=n,e[t+1]=i,e[t+2]=r,e[t+3]=s}function A7(e,t){return e-t}function E7(e){e.sort(A7);const t=[],n=[];for(let i=0,r=e.length;i<r;++i){const s=e[i],a=(s|0)%2===0,c={first:!1,second:!1};a?(c.first=!0,c.second=i+1<r&&e[i+1]===e[i]+1,c.second&&++i):c.second=!0,t.push(Math.floor(s/2)),n.push(c)}return{indices:t,cylinderInfo:n}}function T7(e,t,n){for(let i=0,r=e.length;i<r;++i){const s=e[i];s.first||(t[ql*i]=-.5),s.second||(n[ql*i]=-.5)}}var C7=class extends R.InstancedBufferGeometry{constructor(e,t,n,i){super(),this._useZSprites=n,this._cylGeometry=n?new R.PlaneGeometry(2,2,1,1):new w7(1,1,1,Math.max(3,t),2,i),this._init(e,this._cylGeometry,this._useZSprites),this._collisionGeo=new oA(e,3)}setItem(e,t,n,i){const r=Xt.calcCylinderMatrix(t,n,i);let s=r.elements;const a=e*Ki;this._collisionGeo.setItem(e,t,n,i),Mp(this._matVector1,a,s[0],s[4],s[8],s[12]),Mp(this._matVector2,a,s[1],s[5],s[9],s[13]),Mp(this._matVector3,a,s[2],s[6],s[10],s[14]),this._useZSprites&&(pC.copy(r).invert(),s=pC.elements,Mp(this._invmatVector1,a,s[0],s[4],s[8],s[12]),Mp(this._invmatVector2,a,s[1],s[5],s[9],s[13]),Mp(this._invmatVector3,a,s[2],s[6],s[10],s[14]))}setColor(e,t,n){const i=e*ql;hu.set(t),mC(this._color1,i,hu.r,hu.g,hu.b),hu.set(n),mC(this._color2,i,hu.r,hu.g,hu.b)}computeBoundingSphere(){this._collisionGeo.computeBoundingSphere(),this.boundingSphere=this._collisionGeo.boundingSphere}computeBoundingBox(){this._collisionGeo.computeBoundingBox(),this.boundingBox=this._collisionGeo.boundingBox}raycast(e,t){this._collisionGeo.raycast(e,t)}startUpdate(){return!0}finishUpdate(){this.getAttribute("matVector1").needsUpdate=!0,this.getAttribute("matVector2").needsUpdate=!0,this.getAttribute("matVector3").needsUpdate=!0,this.getAttribute("color").needsUpdate=!0,this.getAttribute("color2").needsUpdate=!0,this.getAttribute("alphaColor").needsUpdate=!0,this._useZSprites&&(this.getAttribute("invmatVector1").needsUpdate=!0,this.getAttribute("invmatVector2").needsUpdate=!0,this.getAttribute("invmatVector3").needsUpdate=!0),this._collisionGeo.finishUpdate()}finalize(){this.finishUpdate(),this.computeBoundingSphere()}setOpacity(e,t){const n=this._alpha;for(let i=0,r=e.length;i<r;++i)n[Math.floor(e[i]/2)]=t;this.getAttribute("alphaColor").needsUpdate=!0}getSubset(e){const t=E7(e),n=t.indices,i=n.length,r=new R.InstancedBufferGeometry;return this._init.call(r,i,this._cylGeometry,this._useZSprites),fu(this._matVector1,r._matVector1,n,Ki),fu(this._matVector2,r._matVector2,n,Ki),fu(this._matVector3,r._matVector3,n,Ki),this._useZSprites&&(fu(this._invmatVector1,r._invmatVector1,n,Ki),fu(this._invmatVector2,r._invmatVector2,n,Ki),fu(this._invmatVector3,r._invmatVector3,n,Ki)),fu(this._color1,r._color1,n,ql),fu(this._color2,r._color2,n,ql),T7(t.cylinderInfo,r._color1,r._color2),r.boundingSphere=this.boundingSphere,r.boundingBox=this.boundingBox,[r]}getGeoParams(){return this._cylGeometry.parameters}_init(e,t,n){this.copy(t),this._matVector1=rt.allocateTyped(Float32Array,e*Ki),this._matVector2=rt.allocateTyped(Float32Array,e*Ki),this._matVector3=rt.allocateTyped(Float32Array,e*Ki),this._color1=rt.allocateTyped(Float32Array,e*ql),this._color2=rt.allocateTyped(Float32Array,e*ql);const i=this._alpha=rt.allocateTyped(Float32Array,e);We.default.fill(i,1),this.setAttribute("matVector1",new R.InstancedBufferAttribute(this._matVector1,Ki,!1,1)),this.setAttribute("matVector2",new R.InstancedBufferAttribute(this._matVector2,Ki,!1,1)),this.setAttribute("matVector3",new R.InstancedBufferAttribute(this._matVector3,Ki,!1,1)),this.setAttribute("color",new R.InstancedBufferAttribute(this._color1,ql,!1,1)),this.setAttribute("color2",new R.InstancedBufferAttribute(this._color2,ql,!1,1)),this.setAttribute("alphaColor",new R.InstancedBufferAttribute(this._alpha,1,!1,1)),n&&(this._invmatVector1=rt.allocateTyped(Float32Array,e*Ki),this._invmatVector2=rt.allocateTyped(Float32Array,e*Ki),this._invmatVector3=rt.allocateTyped(Float32Array,e*Ki),this.setAttribute("invmatVector1",new R.InstancedBufferAttribute(this._invmatVector1,Ki,!1,1)),this.setAttribute("invmatVector2",new R.InstancedBufferAttribute(this._invmatVector2,Ki,!1,1)),this.setAttribute("invmatVector3",new R.InstancedBufferAttribute(this._invmatVector3,Ki,!1,1)))}},KP=C7,Gr=3,b2=3,wp=new R.Vector3,Ap=new R.Vector3,Fy=new R.Vector3,R7=new R.Vector3(1,0,0),gC=new R.Vector3,_C=new R.Vector3;function L7(e,t){const n=new R.BufferGeometry,i=e.length,r=i*t,s=r<=65536?Uint16Array:Uint32Array,a=(t-1)*i*2,c=new R.BufferAttribute(rt.allocateTyped(s,a*b2),1);let u=0,d=0;for(let g=0;g<t;g++){if(g!==t-1)for(let v=0;v<i;v++){const y=u+v,S=u+i+v,E=u+i+(v+1)%i,w=u+(v+1)%i;c.setXYZ(d*b2,y,w,S),d++,c.setXYZ(d*b2,S,w,E),d++}u+=i}n.setIndex(c);const p=rt.allocateTyped(Float32Array,r*Gr);return n.setAttribute("position",new R.BufferAttribute(p,Gr)),n._positions=e,n}var P7=class extends eS{constructor(e,t,n){const i=L7(e,t);super(i,n),this._ringsCount=t;const r=this._tmpShape=[];for(let s=0;s<e.length;++s)r[s]=new R.Vector3}setItem(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const r=this._chunkGeo._positions.length,s=this._ringsCount,a=r*this._ringsCount*e*Gr;this._setPoints(t,r,s,a),n?this._setSlopeNormals(r,s,a):this._setBaseNormals(r,s,a),i&&this._addCut(r,s,a)}_setPoints(e,t,n,i){const r=this._tmpShape,s=this._positions,a=this._chunkGeo._positions;for(let c=0,u=i;c<n;++c){const d=e[c];for(let p=0;p<t;++p,u+=Gr)r[p].copy(a[p]).applyMatrix4(d).toArray(s,u)}}_setBaseNormals(e,t,n){const i=e*Gr;for(let r=0,s=n;r<t;++r,s+=i)this._countNormalsInRing(e,s,!1)}_setSlopeNormals(e,t,n){const i=this._normals,r=e*Gr;let s=n;for(let a=0;a<e;++a,s+=Gr)R7.toArray(i,s);if(s-2*r>0)for(let a=0;a<e;++a,s+=Gr)Fy.fromArray(i,s-2*r).toArray(i,s);else this._countNormalsInRing(e,s,!0,+r),s+=r;for(let a=2;a<t;++a,s+=r)this._countNormalsInRing(e,s,!0,-r)}_countNormalsInRing(e,t,n,i){const r=this._tmpShape,s=this._normals;r[0].fromArray(this._positions,t),r[e-1].fromArray(this._positions,t+(e-1)*Gr);for(let a=0;a<e;++a,t+=Gr)a<e-1&&r[a+1].fromArray(this._positions,t+Gr),n?(_C.fromArray(this._positions,t+i),wp.subVectors(r[(a+e-1)%e],r[(a+1)%e]).normalize(),Ap.subVectors(r[a],_C).normalize(),Fy.crossVectors(Ap,wp).normalize().toArray(s,t)):(wp.subVectors(r[a],r[(a+e-1)%e]).normalize(),Ap.subVectors(r[a],r[(a+1)%e]).normalize(),Fy.addVectors(wp,Ap).normalize().toArray(s,t))}_addCut(e,t,n){if(e<3||t<2)return;const i=this._positions,r=this._normals,s=this._tmpShape,a=e*Gr;s[0].fromArray(i,n),s[1].fromArray(i,n+Gr),s[2].fromArray(i,n+2*Gr),wp.subVectors(s[1],s[0]).normalize(),Ap.subVectors(s[1],s[2]).normalize(),gC.crossVectors(wp,Ap).normalize();let c=n;for(let u=0;u<e*2;++u,c+=Gr)gC.toArray(r,c);if(t>2)for(let u=0;u<e;++u,c+=Gr)Fy.fromArray(i,c-a).toArray(i,c)}},N7=P7,I7=65535,js=4,Hl=4,du=3,pu=3,Ws=new R.Color,ys=new R.Vector3;function mu(e,t,n,i,r){e[t]=n,e[t+1]=i,e[t+2]=r}function ky(e,t,n,i,r,s){e[t]=n,e[t+1]=i,e[t+2]=r,e[t+3]=s}function Gy(e,t,n,i){const r=t*js,s=r+n*js;return e.subarray(r*i,s*i)}var O7=class extends R.BufferGeometry{constructor(e){super(),this._initVertices(e)}startUpdate(){return!0}finishUpdate(){this.getAttribute("position").needsUpdate=!0,this.getAttribute("color").needsUpdate=!0,this.getAttribute("alphaColor").needsUpdate=!0,this.getAttribute("direction").needsUpdate=!0}setColor(e,t){Ws.set(t);let n=e*js*pu;mu(this._colors,n,Ws.r,Ws.g,Ws.b),n+=pu,mu(this._colors,n,Ws.r,Ws.g,Ws.b),n+=pu,mu(this._colors,n,Ws.r,Ws.g,Ws.b),n+=pu,mu(this._colors,n,Ws.r,Ws.g,Ws.b)}setSegment(e,t,n){ys.subVectors(t,n),ys.normalize();const i=this._positions,r=this._directions;let s=e*js*Hl,a=e*js*du;ky(i,s,t.x,t.y,t.z,.5),mu(r,a,ys.x,ys.y,ys.z),s+=Hl,a+=du,ky(i,s,t.x,t.y,t.z,-.5),mu(r,a,ys.x,ys.y,ys.z),s+=Hl,a+=du,ky(i,s,n.x,n.y,n.z,.5),mu(r,a,ys.x,ys.y,ys.z),s+=Hl,a+=du,ky(i,s,n.x,n.y,n.z,-.5),mu(r,a,ys.x,ys.y,ys.z)}setOpacity(e,t,n){const i=e*js,r=t*js;We.default.fill(this.alpha,n,r,i),this.getAttribute("alphaColor").needsUpdate=!0}getSubsetSegments(e,t){return[Gy(this._positions,e,t,Hl),Gy(this._directions,e,t,du)]}getSubsetColors(e,t){return Gy(this._colors,e,t,pu)}getSubsetOpacities(e,t){return Gy(this._alpha,e,t,1)}getNumVertexPerSegment(){return js}getPositionSize(){return Hl}setSegments(e,t){const n=e*js*Hl;if(t instanceof Array&&t.length===2){this._positions.set(t[0],n);const i=e*js*du;this._directions.set(t[1],i)}else this._positions.set(t,n)}setColors(e,t){const n=e*js*pu;this._colors.set(t,n)}_initVertices(e){this._buffersSize=e*js;const t=this._buffersSize,n=t>I7;this._index=rt.allocateTyped(n?Uint32Array:Uint16Array,e*6),this._positions=rt.allocateTyped(Float32Array,t*Hl),this._colors=rt.allocateTyped(Float32Array,t*pu),this._directions=rt.allocateTyped(Float32Array,t*du);const i=this._alpha=rt.allocateTyped(Float32Array,t);We.default.fill(i,1);const r=this._index;let s=0,a=0;for(let c=0;c<e;c++,s+=6,a+=js)r[s]=a,r[s+1]=a+1,r[s+2]=a+3,r[s+3]=a,r[s+4]=a+2,r[s+5]=a+3;this.setIndex(new R.BufferAttribute(this._index,1)),this.setAttribute("position",new R.BufferAttribute(this._positions,Hl)),this.setAttribute("color",new R.BufferAttribute(this._colors,pu)),this.setAttribute("alphaColor",new R.BufferAttribute(i,1)),this.setAttribute("direction",new R.BufferAttribute(this._directions,du))}},QP=O7,D7=class extends QP{startUpdate(){return!0}computeBoundingSphere(){const{boundingBox:e}=this;let t=0;const n=new R.Vector3;e&&e.getCenter(n);const i=this._positions,r=this.boundingSphere||new R.Sphere,s=this._positions.length,a=new R.Vector3,c=this.getPositionSize();for(let u=0;u<s;u+=c){a.set(i[u],i[u+1],i[u+2]);const d=n.distanceToSquared(a);t<d&&(t=d)}r.set(n,Math.sqrt(t)),this.boundingSphere=r}computeBoundingBox(){const e=this._positions,t=new R.Box3,n=this._positions.length,i=new R.Vector3,r=this.getPositionSize();for(let s=0;s<n;s+=r)i.set(e[s],e[s+1],e[s+2]),t.expandByPoint(i);this.boundingBox=t}finalize(){this.finishUpdate(),this.computeBoundingSphere()}},JP=D7,Hy=3,Ep=new R.Vector3,vC=new R.Matrix3,z7=class extends eS{constructor(e,t){const n=new R.CylinderGeometry(1,1,1,Math.max(3,t),2,!0);super(n,e);const i=this._chunkSize;this._chunkPos=this._chunkGeo.attributes.position.array,this._chunkNorms=this._chunkGeo.attributes.normal.array,this._tmpVector=rt.allocateTyped(Float32Array,i*Hy)}setItem(e,t,n,i){const r=this._chunkSize,s=r*e*Hy,a=this._tmpVector,c=this._chunkPos,u=this._chunkNorms,d=Xt.calcCylinderMatrix(t,n,i);vC.getNormalMatrix(d);let p;for(let g=0;g<r;++g)p=g*Hy,Ep.fromArray(c,p),Ep.applyMatrix4(d),Ep.toArray(a,p);this._positions.set(a,s);for(let g=0;g<r;++g)p=g*Hy,Ep.fromArray(u,p),Ep.applyMatrix3(vC),Ep.toArray(a,p);this._normals.set(a,s)}},U7=z7,B7=.1,V7=class eN extends JP{constructor(t,n,i){super(t*n),this._init(n),this._collisionGeo=i?new U7(t*n,3):null}startUpdate(){return!0}computeBoundingSphere(){const t=this._collisionGeo;if(t){t.computeBoundingSphere(),this.boundingSphere=t.boundingSphere;return}super.computeBoundingSphere()}computeBoundingBox(){const t=this._collisionGeo;if(t){t.computeBoundingBox(),this.boundingBox=t.boundingBox;return}super.computeBoundingBox()}raycast(t,n){if(!this._collisionGeo)return;const i=this._chunkSize;this._collisionGeo.raycast(t,n);for(let r=0,s=n.length;r<s;++r){let{chunkIdx:a}=n[r];a!==void 0&&(a=a/i|0,n[r].chunkIdx=a)}}setColor(t,n){const i=this._chunkSize;for(let r=t*i,s=r+i;r<s;++r)super.setColor(r,n)}setSegment(t,n,i,r){const s=this._chunkSize,a=t*s+n;super.setSegment(a,i,r),this._collisionGeo&&this._collisionGeo.setItem(t*s+n,i,r,B7)}finalize(){this.finishUpdate(),this.computeBoundingSphere()}setOpacity(t,n){const i=this._chunkSize;for(let r=0,s=t.length;r<s;++r){const a=t[r]*i;super.setOpacity(a,a+i-1,n)}}getSubset(t){const n=t.length,i=this._chunkSize,r=new eN(n,i,!1);for(let s=0,a=t.length;s<a;++s){const c=s*i,u=t[s]*i;r.setSegments(c,this.getSubsetSegments(u,i)),r.setColors(c,this.getSubsetColors(u,i))}return r.boundingSphere=this.boundingSphere,r.boundingBox=this.boundingBox,[r]}_init(t){this._chunkSize=t}},tN=V7,F7=.3,M2=new R.Vector3,k7=class nN extends JP{constructor(t){super(t*2),this._init(t),this._collisionGeo=new oA(t,3)}setItem(t,n,i){this._collisionGeo.setItem(t,n,i,F7);const r=2*t;M2.lerpVectors(n,i,.5),super.setSegment(r,n,M2),super.setSegment(r+1,M2,i)}setColor(t,n,i){const r=2*t;super.setColor(r,n),super.setColor(r+1,i)}raycast(t,n){this._collisionGeo&&this._collisionGeo.raycast(t,n)}getSubset(t){const n=t.length,i=new nN(n,!1);for(let r=0,s=n;r<s;++r){const a=t[r];i.setSegments(r,this.getSubsetSegments(a,1)),i.setColors(r,this.getSubsetColors(a,1))}return i.boundingSphere=this.boundingSphere,i.boundingBox=this.boundingBox,[i]}_init(t){this._segCounts=t*2}},G7=k7,Kh=[new R.Vector3(1,0,0),new R.Vector3(-1,0,0),new R.Vector3(0,1,0),new R.Vector3(0,-1,0),new R.Vector3(0,0,1),new R.Vector3(0,0,-1)],yC=Kh.length,Wy=new R.Vector3,Xy=new R.Vector3,H7=class extends sA(tN){constructor(e){super(e,e,yC/2|0,!1)}setItem(e,t,n){this.setSphere(e,t,n);for(let i=0;i<yC/2;++i){const r=i*2;Wy.x=t.x+Kh[r].x*n,Wy.y=t.y+Kh[r].y*n,Wy.z=t.z+Kh[r].z*n;const s=r+1;Xy.x=t.x+Kh[s].x*n,Xy.y=t.y+Kh[s].y*n,Xy.z=t.z+Kh[s].z*n,this.setSegment(e,i,Wy,Xy)}}},W7=H7,xC=4,SC=3,jy=new R.Color,X7=class extends R.BufferGeometry{constructor(e,t){super(),this._opts=t,this.zClip=this._opts.zClip,this._posRad=rt.allocateTyped(Float32Array,e*xC),this._colors=rt.allocateTyped(Float32Array,e*SC)}setItem(e,t,n){const i=this._posRad;let r=xC*e;i[r++]=t.x,i[r++]=t.y,i[r++]=t.z,i[r]=n}setColor(e,t){jy.set(t);const n=this._colors;let i=SC*e;n[i++]=jy.r,n[i++]=jy.g,n[i]=jy.b}finalize(){this.finishUpdate(),this.computeBoundingSphere()}finishUpdate(){this._build()}setOpacity(){}raycast(){}getSubset(){return[]}},iN=X7,rN=class{constructor(){this.pointsValuesLinear=null,this.hasIntersection=null,this.bitsInside=null}create(e){const n=e*e*e;if(n>117440512)throw new Error("Too large cube dimension: lead to memory huge uasge");return this.pointsValuesLinear=rt.allocateTyped(Float32Array,32*n),this.hasIntersection=rt.allocateTyped(Int32Array,n),this.bitsInside=rt.allocateTyped(Int32Array,n),0}destroy(){this.bitsInside=null,this.hasIntersection=null,this.pointsValuesLinear=null}};rN.prototype.striIndicesMarchCube=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,-1,-1,9,2,10,9,0,2,8,4,7,-1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1,8,4,7,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,4,7,11,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1,9,0,1,8,4,7,2,3,11,-1,-1,-1,-1,-1,-1,-1,4,7,11,9,4,11,9,11,2,9,2,1,-1,-1,-1,-1,3,10,1,3,11,10,7,8,4,-1,-1,-1,-1,-1,-1,-1,1,11,10,1,4,11,1,0,4,7,11,4,-1,-1,-1,-1,4,7,8,9,0,11,9,11,10,11,0,3,-1,-1,-1,-1,4,7,11,4,11,9,9,11,10,-1,-1,-1,-1,-1,-1,-1,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,10,4,9,5,-1,-1,-1,-1,-1,-1,-1,5,2,10,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1,2,10,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1,9,5,4,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,0,8,11,4,9,5,-1,-1,-1,-1,-1,-1,-1,0,5,4,0,1,5,2,3,11,-1,-1,-1,-1,-1,-1,-1,2,1,5,2,5,8,2,8,11,4,8,5,-1,-1,-1,-1,10,3,11,10,1,3,9,5,4,-1,-1,-1,-1,-1,-1,-1,4,9,5,0,8,1,8,10,1,8,11,10,-1,-1,-1,-1,5,4,0,5,0,11,5,11,10,11,0,3,-1,-1,-1,-1,5,4,8,5,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1,1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,7,8,9,5,7,10,1,2,-1,-1,-1,-1,-1,-1,-1,10,1,2,9,5,0,5,3,0,5,7,3,-1,-1,-1,-1,8,0,2,8,2,5,8,5,7,10,5,2,-1,-1,-1,-1,2,10,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,7,9,5,7,8,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,9,5,7,9,7,2,9,2,0,2,7,11,-1,-1,-1,-1,2,3,11,0,1,8,1,7,8,1,5,7,-1,-1,-1,-1,11,2,1,11,1,7,7,1,5,-1,-1,-1,-1,-1,-1,-1,9,5,8,8,5,7,10,1,3,10,3,11,-1,-1,-1,-1,5,7,0,5,0,9,7,11,0,1,0,10,11,10,0,-1,11,10,0,11,0,3,10,5,0,8,0,7,5,7,0,-1,11,10,5,7,11,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,1,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,1,9,8,5,10,6,-1,-1,-1,-1,-1,-1,-1,1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,6,5,1,2,6,3,0,8,-1,-1,-1,-1,-1,-1,-1,9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1,5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1,2,3,11,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,0,8,11,2,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,0,1,9,2,3,11,5,10,6,-1,-1,-1,-1,-1,-1,-1,5,10,6,1,9,2,9,11,2,9,8,11,-1,-1,-1,-1,6,3,11,6,5,3,5,1,3,-1,-1,-1,-1,-1,-1,-1,0,8,11,0,11,5,0,5,1,5,11,6,-1,-1,-1,-1,3,11,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1,6,5,9,6,9,11,11,9,8,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,4,7,3,6,5,10,-1,-1,-1,-1,-1,-1,-1,1,9,0,5,10,6,8,4,7,-1,-1,-1,-1,-1,-1,-1,10,6,5,1,9,7,1,7,3,7,9,4,-1,-1,-1,-1,6,1,2,6,5,1,4,7,8,-1,-1,-1,-1,-1,-1,-1,1,2,5,5,2,6,3,0,4,3,4,7,-1,-1,-1,-1,8,4,7,9,0,5,0,6,5,0,2,6,-1,-1,-1,-1,7,3,9,7,9,4,3,2,9,5,9,6,2,6,9,-1,3,11,2,7,8,4,10,6,5,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,2,4,2,0,2,7,11,-1,-1,-1,-1,0,1,9,4,7,8,2,3,11,5,10,6,-1,-1,-1,-1,9,2,1,9,11,2,9,4,11,7,11,4,5,10,6,-1,8,4,7,3,11,5,3,5,1,5,11,6,-1,-1,-1,-1,5,1,11,5,11,6,1,0,11,7,11,4,0,4,11,-1,0,5,9,0,6,5,0,3,6,11,6,3,8,4,7,-1,6,5,9,6,9,11,4,7,9,7,11,9,-1,-1,-1,-1,10,4,9,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,10,6,4,9,10,0,8,3,-1,-1,-1,-1,-1,-1,-1,10,0,1,10,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,6,8,6,4,6,1,10,-1,-1,-1,-1,1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,9,2,4,9,2,6,4,-1,-1,-1,-1,0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,10,4,9,10,6,4,11,2,3,-1,-1,-1,-1,-1,-1,-1,0,8,2,2,8,11,4,9,10,4,10,6,-1,-1,-1,-1,3,11,2,0,1,6,0,6,4,6,1,10,-1,-1,-1,-1,6,4,1,6,1,10,4,8,1,2,1,11,8,11,1,-1,9,6,4,9,3,6,9,1,3,11,6,3,-1,-1,-1,-1,8,11,1,8,1,0,11,6,1,9,1,4,6,4,1,-1,3,11,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1,6,4,8,11,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,10,6,7,8,10,8,9,10,-1,-1,-1,-1,-1,-1,-1,0,7,3,0,10,7,0,9,10,6,7,10,-1,-1,-1,-1,10,6,7,1,10,7,1,7,8,1,8,0,-1,-1,-1,-1,10,6,7,10,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1,1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1,2,6,9,2,9,1,6,7,9,0,9,3,7,3,9,-1,7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1,7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,11,10,6,8,10,8,9,8,6,7,-1,-1,-1,-1,2,0,7,2,7,11,0,9,7,6,7,10,9,10,7,-1,1,8,0,1,7,8,1,10,7,6,7,10,2,3,11,-1,11,2,1,11,1,7,10,6,1,6,7,1,-1,-1,-1,-1,8,9,6,8,6,7,9,1,6,11,6,3,1,3,6,-1,0,9,1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,7,0,6,3,11,0,11,6,0,-1,-1,-1,-1,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,1,9,8,3,1,11,7,6,-1,-1,-1,-1,-1,-1,-1,10,1,2,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,8,6,11,7,-1,-1,-1,-1,-1,-1,-1,2,9,0,2,10,9,6,11,7,-1,-1,-1,-1,-1,-1,-1,6,11,7,2,10,3,10,8,3,10,9,8,-1,-1,-1,-1,7,2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1,2,7,6,2,3,7,0,1,9,-1,-1,-1,-1,-1,-1,-1,1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1,10,7,6,10,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,7,6,1,7,10,1,8,7,1,0,8,-1,-1,-1,-1,0,3,7,0,7,10,0,10,9,6,10,7,-1,-1,-1,-1,7,6,10,7,10,8,8,10,9,-1,-1,-1,-1,-1,-1,-1,6,8,4,11,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,6,11,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1,8,6,11,8,4,6,9,0,1,-1,-1,-1,-1,-1,-1,-1,9,4,6,9,6,3,9,3,1,11,3,6,-1,-1,-1,-1,6,8,4,6,11,8,2,10,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,11,0,6,11,0,4,6,-1,-1,-1,-1,4,11,8,4,6,11,0,2,9,2,10,9,-1,-1,-1,-1,10,9,3,10,3,2,9,4,3,11,3,6,4,6,3,-1,8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,4,2,4,6,4,3,8,-1,-1,-1,-1,1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1,8,1,3,8,6,1,8,4,6,6,10,1,-1,-1,-1,-1,10,1,0,10,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1,4,6,3,4,3,8,6,10,3,0,3,9,10,9,3,-1,10,9,4,6,10,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,5,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,5,11,7,6,-1,-1,-1,-1,-1,-1,-1,5,0,1,5,4,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,11,7,6,8,3,4,3,5,4,3,1,5,-1,-1,-1,-1,9,5,4,10,1,2,7,6,11,-1,-1,-1,-1,-1,-1,-1,6,11,7,1,2,10,0,8,3,4,9,5,-1,-1,-1,-1,7,6,11,5,4,10,4,2,10,4,0,2,-1,-1,-1,-1,3,4,8,3,5,4,3,2,5,10,5,2,11,7,6,-1,7,2,3,7,6,2,5,4,9,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,6,0,6,2,6,8,7,-1,-1,-1,-1,3,6,2,3,7,6,1,5,0,5,4,0,-1,-1,-1,-1,6,2,8,6,8,7,2,1,8,4,8,5,1,5,8,-1,9,5,4,10,1,6,1,7,6,1,3,7,-1,-1,-1,-1,1,6,10,1,7,6,1,0,7,8,7,0,9,5,4,-1,4,0,10,4,10,5,0,3,10,6,10,7,3,7,10,-1,7,6,10,7,10,8,5,4,10,4,8,10,-1,-1,-1,-1,6,9,5,6,11,9,11,8,9,-1,-1,-1,-1,-1,-1,-1,3,6,11,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1,0,11,8,0,5,11,0,1,5,5,6,11,-1,-1,-1,-1,6,11,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,11,9,11,8,11,5,6,-1,-1,-1,-1,0,11,3,0,6,11,0,9,6,5,6,9,1,2,10,-1,11,8,5,11,5,6,8,0,5,10,5,2,0,2,5,-1,6,11,3,6,3,5,2,10,3,10,5,3,-1,-1,-1,-1,5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1,9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1,1,5,8,1,8,0,5,6,8,3,8,2,6,2,8,-1,1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,6,1,6,10,3,8,6,5,6,9,8,9,6,-1,10,1,0,10,0,6,9,5,0,5,6,0,-1,-1,-1,-1,0,3,8,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,7,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,11,7,5,8,3,0,-1,-1,-1,-1,-1,-1,-1,5,11,7,5,10,11,1,9,0,-1,-1,-1,-1,-1,-1,-1,10,7,5,10,11,7,9,8,1,8,3,1,-1,-1,-1,-1,11,1,2,11,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,7,1,7,5,7,2,11,-1,-1,-1,-1,9,7,5,9,2,7,9,0,2,2,11,7,-1,-1,-1,-1,7,5,2,7,2,11,5,9,2,3,2,8,9,8,2,-1,2,5,10,2,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,8,2,0,8,5,2,8,7,5,10,2,5,-1,-1,-1,-1,9,0,1,5,10,3,5,3,7,3,10,2,-1,-1,-1,-1,9,8,2,9,2,1,8,7,2,10,2,5,7,5,2,-1,1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1,9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1,9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,8,4,5,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,5,0,4,5,11,0,5,10,11,11,3,0,-1,-1,-1,-1,0,1,9,8,4,10,8,10,11,10,4,5,-1,-1,-1,-1,10,11,4,10,4,5,11,3,4,9,4,1,3,1,4,-1,2,5,1,2,8,5,2,11,8,4,5,8,-1,-1,-1,-1,0,4,11,0,11,3,4,5,11,2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1];var sN=rN,bC=[0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0];function j7(e,t,n){const i=e.getValue(t.x,t.y,t.z);n.set(i[0],i[1],i[2])}var Y7=class{constructor(){this._arrSize=8,this.p=new Array(this._arrSize),this.g=new Array(this._arrSize),this.val=new Array(this._arrSize);for(let e=0;e<this._arrSize;++e)this.p[e]=new R.Vector3,this.g[e]=new R.Vector3;this.cubeIndex=0}},q7=class{constructor(){this.a={p:new R.Vector3,n:new R.Vector3},this.b={p:new R.Vector3,n:new R.Vector3},this.c={p:new R.Vector3,n:new R.Vector3}}};function MC(e){const t=new Array(e);for(let n=0;n<e;++n)t[n]=new R.Vector3;return t}var $7=class Xl{constructor(){this._numTriangles=0,this._numVertices=0,this._position=[],this._normals=[],this._colors=null,this._indices=[],this._volumetricData=null,this._xAxis=new R.Vector3,this._yAxis=new R.Vector3,this._zAxis=new R.Vector3,this._xDir=new R.Vector3,this._yDir=new R.Vector3,this._zDir=new R.Vector3}_prepareAxesAndDirs(){const t=this._volumetricData.getCellSize(),n=this._xAxis,i=this._yAxis,r=this._zAxis,s=this._xDir,a=this._yDir,c=this._zDir;n.set(t.x,0,0),i.set(0,t.y,0),r.set(0,0,t.z),s.set(1,0,0),a.set(0,1,0),c.set(0,0,1);const u=new R.Vector3;if(u.crossVectors(s,a),u.dot(c)<0&&(s.negate(),a.negate(),c.negate()),s.x<0||s.y<0||s.z<0||a.x<0||a.y<0||a.z<0||c.x<0||c.y<0||c.z<0)return!1;const d=p=>Math.abs(p)>Number.EPSILON;return!(d(n.y)||d(n.z)||d(i.x)||d(i.z)||d(r.x)||d(r.y))}_vertexInterp(t,n,i,r,s,a){const c=n.p[i],u=n.p[r],d=n.g[i],p=n.g[r],g=n.val[i],v=n.val[r],y=t-g,S=v-g;let E=0;Math.abs(S)>0&&(E=y/S),E=E>1?1:E,s.lerpVectors(c,u,E),a.lerpVectors(d,p,E)}static _triTable=sN.prototype.striIndicesMarchCube;static _arrSize=12;static _firstIndices=[0,1,2,3,4,5,6,7,0,1,2,3];static _secondIndices=[1,2,3,0,5,6,7,4,4,5,6,7];static _vertexList=MC(Xl._arrSize);static _normalList=MC(Xl._arrSize);_polygonize(t,n,i){const{cubeIndex:r}=t;let s=0;const a=Xl._arrSize,c=Xl._firstIndices,u=Xl._secondIndices,d=Xl._vertexList,p=Xl._normalList;for(;s<a;++s)bC[r]&1<<s&&this._vertexInterp(n,t,c[s],u[s],d[s],p[s]);let g=0;const v=r*16,y=Xl._triTable;for(s=0;y[v+s]!==-1;s+=3)i[g].a.p.copy(d[y[v+s]]),i[g].a.n.copy(p[y[v+s]]),i[g].b.p.copy(d[y[v+s+1]]),i[g].b.n.copy(p[y[v+s+1]]),i[g].c.p.copy(d[y[v+s+2]]),i[g].c.n.copy(p[y[v+s+2]]),++g;return g}_doGridPosNorms(t,n,i){const r=this._volumetricData,s=this._volumetricData.getData(),a=r.getDimensions(),c=a[0],u=a[1],d=a[2],p=n*r.getStrideX(),g=n*r.getStrideY(),v=n*r.getStrideZ(),y=new Y7,S=y.val,E=y.val.length,w=[new R.Vector3(0,0,0),new R.Vector3(n,0,0),new R.Vector3(n,n,0),new R.Vector3(0,n,0),new R.Vector3(0,0,n),new R.Vector3(n,0,n),new R.Vector3(n,n,n),new R.Vector3(0,n,n)],b=5,T=new Array(b);for(let I=0;I<b;++I)T[I]=new q7;let L;const C=this,P=this._position,O=this._normals;i?L=(function(){const I=new R.Vector3(C._xAxis.x,C._yAxis.y,C._zAxis.z);return function(z){const te=z.p.clone();te.multiply(I),P.push(te.add(C._origin)),O.push(z.n.clone())}})():L=(function(){const I=new R.Matrix3;I.set(C._xAxis.x,C._yAxis.x,C._zAxis.x,C._xAxis.y,C._yAxis.y,C._zAxis.y,C._xAxis.z,C._yAxis.z,C._zAxis.z);const z=new R.Matrix3;return z.set(C._xDir.x,C._yDir.x,C._zDir.x,C._xDir.y,C._yDir.y,C._zDir.y,C._xDir.z,C._yDir.z,C._zDir.z),function(te){P.push(te.p.clone().applyMatrix3(I).add(C._origin)),O.push(te.n.clone().applyMatrix3(z))}})();const B=this._indices;let U=0;for(let I=0;I<d-n;I+=n)for(let z=0;z<u-n;z+=n){let te=r.getDirectIdx(0,z,I);for(let oe=0;oe<c-n;oe+=n,te+=p){S[0]=s[te],S[1]=s[te+p],S[3]=s[te+g],S[2]=s[te+p+g],S[4]=s[te+v],S[5]=s[te+p+v],S[7]=s[te+g+v],S[6]=s[te+p+g+v];let ee=0,k=0;for(;k<E;++k)S[k]<t&&(ee|=1<<k);if(bC[ee]===0)continue;for(y.cubeIndex=ee,k=0;k<E;++k)y.p[k].set(oe+w[k].x,z+w[k].y,I+w[k].z),j7(this._gradient,y.p[k],y.g[k]);const X=this._polygonize(y,t,T);for(U+=X,k=0;k<X;++k)B.push(this._numTriangles*3),B.push(this._numTriangles*3+1),B.push(this._numTriangles*3+2),++this._numTriangles,L(T[k].a),L(T[k].b),L(T[k].c)}}return U}compute(t,n,i,r){this._volumetricData=t,this._origin=n,this._gradient=t.computeGradient(),this._doGridPosNorms(i,r,this._prepareAxesAndDirs())}_remapIndices(t,n){const i=this._indices,r=rt.allocateTyped(Uint32Array,n);for(let s=0;s<n;++s)i[s]=t[i[s]],r[s]=i[s];this._indices=r}_remapVertices(t,n,i){const r=rt.allocateTyped(Float32Array,i*3),s=rt.allocateTyped(Float32Array,i*3);for(let a=0;a<i;++a){const c=t[a];r[a*3]=c.x,r[a*3+1]=c.y,r[a*3+2]=c.z;const u=n[a].normalize();s[a*3]=u.x,s[a*3+1]=u.y,s[a*3+2]=u.z}this._position=r,this._normals=s}vertexFusion(t,n){const i=this._indices.length,r=this._position,s=this._normals,a=r.length|0;if(i===0||a===0)return;const c=rt.allocateTyped(Uint32Array,a);c[0]=0;let u=1,d=1;for(;d<a;++d){const p=u-t<0?0:u-t,g=p+n>u?u:p+n;let v=-1;for(let y=p;y<g;++y)if(Math.abs(r[d]-r[y])<Number.EPSILON){v=y;break}v!==-1?c[d]=v:(r[u].copy(r[d]),s[u].copy(s[d]),c[d]=u,++u)}this._remapIndices(c,i),this._remapVertices(r,s,u)}setColorVolTex(t,n,i,r){let s,a;const c=this._position.length/3,u=this._position,d=this._origin,p=this._volumetricData.getDimensions(),g=p[0]-1,v=p[1]-1,y=p[2]-1,S=t.getData(),E=t.getStrideX(),w=t.getStrideY(),b=t.getStrideZ();let T,L,C,P;r!==null&&(T=i.getData(),L=i.getStrideX(),C=i.getStrideY(),P=i.getStrideZ());const O=1/this._xAxis.x,B=1/this._yAxis.y,U=1/this._zAxis.z;let I=[],z=[];const te=rt.allocateTyped(Float32Array,c*3);function oe($,j,J,xe){xe[0]=(1-$)*S[j]+$*S[J],xe[1]=(1-$)*S[j+1]+$*S[J+1],xe[2]=(1-$)*S[j+2]+$*S[J+2]}function ee($,j,J,xe){const de=n[$];if(de!=null){I[de.index]=de;const fe=j*J*xe*T[$];typeof z[de.index]>"u"?z[de.index]=fe:z[de.index]+=fe}}const k=rt.allocateTyped(Int32Array,c);let X=0;for(s=0;s<c;s++){const $=s*3,j=(u[$]-d.x)*O,J=(u[$+1]-d.y)*B,xe=(u[$+2]-d.z)*U,de=Math.min(Math.max(j,0),g)|0,fe=Math.min(Math.max(J,0),v)|0,F=Math.min(Math.max(xe,0),y)|0,re=j-de,ue=J-fe,_e=xe-F;if(r!=null){I=[],z=[],a=i.getDirectIdx(de,fe,F),ee(a,1-re,1-ue,1-_e),ee(a+L,re,1-ue,1-_e),ee(a+C,1-re,ue,1-_e),ee(a+L+C,re,ue,1-_e),ee(a+P,1-re,1-ue,_e),ee(a+L+P,re,1-ue,_e),ee(a+C+P,1-re,ue,_e),ee(a+L+C+P,re,ue,_e);let ye=0,et=-1;for(const tt in z)z[tt]>ye&&(et=tt,ye=z[tt]);if(et<0||!r.includesAtom(I[et])){k[s]=-1;continue}}k[s]=X++;const Le=de<g?E:0,Fe=fe<v?w:0,Xe=F<y?b:0,lt=[0,0,0],mt=[0,0,0],ne=[0,0,0],Be=[0,0,0];a=t.getDirectIdx(de,fe,F),oe(re,a,a+Le,lt),oe(re,a+Fe,a+Le+Fe,mt),oe(re,a+Xe,a+Le+Xe,ne),oe(re,a+Fe+Xe,a+Le+Fe+Xe,Be);const Ne=[0,0,0];Ne[0]=(1-ue)*lt[0]+ue*mt[0],Ne[1]=(1-ue)*lt[1]+ue*mt[1],Ne[2]=(1-ue)*lt[2]+ue*mt[2];const ve=[0,0,0];ve[0]=(1-ue)*ne[0]+ue*Be[0],ve[1]=(1-ue)*ne[1]+ue*Be[1],ve[2]=(1-ue)*ne[2]+ue*Be[2],te[$]=(1-_e)*Ne[0]+_e*ve[0],te[$+1]=(1-_e)*Ne[1]+_e*ve[1],te[$+2]=(1-_e)*Ne[2]+_e*ve[2]}if(this._colors=te,r!=null){for(s=0;s<c;++s){const J=k[s];J<0||(this._position[J*3]=this._position[s*3],this._position[J*3+1]=this._position[s*3+1],this._position[J*3+2]=this._position[s*3+2],this._normals[J*3]=this._normals[s*3],this._normals[J*3+1]=this._normals[s*3+1],this._normals[J*3+2]=this._normals[s*3+2],this._colors[J*3]=this._colors[s*3],this._colors[J*3+1]=this._colors[s*3+1],this._colors[J*3+2]=this._colors[s*3+2])}const $=this._indices.length/3;let j=0;for(s=0;s<$;++s){const J=k[this._indices[3*s]],xe=k[this._indices[3*s+1]],de=k[this._indices[3*s+2]];J>=0&&xe>=0&&de>=0&&(this._indices[3*j]=J,this._indices[3*j+1]=xe,this._indices[3*j+2]=de,++j)}this._position=new Float32Array(this._position.buffer.slice(0,X*3*4)),this._normals=new Float32Array(this._normals.buffer.slice(0,X*3*4)),this._colors=new Float32Array(this._colors.buffer.slice(0,X*3*4)),this._indices=new Uint32Array(this._indices.buffer.slice(0,j*3*4))}}toMesh(){const t=new R.BufferGeometry;return t.setIndex(new R.BufferAttribute(this._indices,1)),t.setAttribute("position",new R.BufferAttribute(this._position,3)),t.setAttribute("normal",new R.BufferAttribute(this._normals,3)),t.setAttribute("color",new R.BufferAttribute(this._colors,3)),t.computeBoundingSphere(),t}},Z7=$7,K7=class extends iN{_build(){const e=this._opts;this.numVoxels=[128,128,128],this.xAxis=new R.Vector3(1,0,0),this.yAxis=new R.Vector3(0,1,0),this.zAxis=new R.Vector3(0,0,1),this.origin=new R.Vector3(0,0,0),this._visibilitySelector=e.visibilitySelector,this._calcSurface(e)}_findMinMax(e){const n=e.length/4,i=[e[0],e[1],e[2],e[3]],r=[e[0],e[1],e[2],e[3]];for(let s=1;s<n;++s){const a=s*4;for(let c=0;c<4;++c){const u=e[a+c];i[c]=Math.max(u,i[c]),r[c]=Math.min(u,r[c])}}return{maxPosRad:i,minPosRad:r}}_findNumVoxels(e,t){const{numVoxels:n}=this,i=this._findMinMax(e),r=i.minPosRad,s=i.maxPosRad;r[3]>4&&(t.gridSpacing*=r[3]);let a=t.radScale*s[3]*1.7,c=a;c=.65*Math.sqrt(4/3*Math.PI*c*c*c),a=Math.max(a,c);let u=0;for(;u<3;++u)r[u]-=a,s[u]+=a;for(u=0;u<3;++u)n[u]=Math.ceil((s[u]-r[u])/t.gridSpacing);return this.xAxis.x=(n[0]-1)*t.gridSpacing,this.yAxis.y=(n[1]-1)*t.gridSpacing,this.zAxis.z=(n[2]-1)*t.gridSpacing,[this.origin.x,this.origin.y,this.origin.z]=r,{bbox:i,dim:n}}_makeSurface(e,t){const n=new Z7;n.compute(e.volMap,this.origin,t.isoValue,1),n.vertexFusion(9,9),n._numTriangles>0?(n.setColorVolTex(e.volTexMap,e.atomMap,e.atomWeightMap,this._visibilitySelector),this.setIndex(new R.BufferAttribute(n._indices,1)),this.setAttribute("position",new R.BufferAttribute(n._position,3)),this.setAttribute("normal",new R.BufferAttribute(n._normals,3)),this.setAttribute("color",new R.BufferAttribute(n._colors,3))):this.setAttribute("position",new R.BufferAttribute(rt.allocateTyped(Float32Array,0),3))}_calcSurface(e){const t={posRad:this._posRad,colors:this._colors,atoms:this._opts.atoms};if(t.posRad.length===0)return;const n=this._findNumVoxels(t.posRad,e),i=new R.Box3(this.origin,new R.Vector3(this.xAxis.x,this.yAxis.y,this.zAxis.z).add(this.origin)),r=this._computeSurface(t,i,n,e);this._makeSurface(r,e)}},oN=K7,{Volume:w2}=nr,Q7=class extends oN{_computeSurface(e,t,n,i){this._shiftByOrigin(e.posRad);const r={volMap:new w2(Float32Array,this.numVoxels,t),volTexMap:new w2(Float32Array,this.numVoxels,t,3)};return this._visibilitySelector!=null&&(r.atomMap=[],r.atomWeightMap=new w2(Float32Array,this.numVoxels,t)),this.gaussdensity(r,e,null,i),r}gaussdensity(e,t,n,i){const r=t.posRad.length/4,{posRad:s,colors:a}=t,{numVoxels:c}=this,{radScale:u,gaussLim:d,gridSpacing:p}=i,g=1/i.isoValue,v=1/p,y=c[0]-1,S=c[1]-1,E=c[2]-1,{volMap:w,volTexMap:b}=e,T=w.getData(),L=w.getStrideX(),C=b.getData(),P=b.getStrideX();let O;this._visibilitySelector!=null&&(O=e.atomWeightMap.getData());const{atomMap:B}=e;for(let U=0;U<r;++U){const I=U*4,z=s[I+3]*u,te=n===null?1:n[U],oe=1/(2*z*z);let ee=d*z;const k=ee*ee;ee*=v;let X=s[I]*v;const $=Math.max(X-ee|0,0),j=Math.min(X+ee|0,y);X=s[I+1]*v;const J=Math.max(X-ee|0,0),xe=Math.min(X+ee|0,S);X=s[I+2]*v;const de=Math.max(X-ee|0,0),fe=Math.min(X+ee|0,E);let F=de*p-s[I+2];for(let re=de;re<=fe;++re,F+=p){let ue=J*p-s[I+1];for(let _e=J;_e<=xe;++_e,ue+=p){const Le=ue*ue+F*F;if(Le>=k)continue;let Fe=w.getDirectIdx($,_e,re),Xe=b.getDirectIdx($,_e,re),lt=$*p-s[I];for(let mt=$;mt<=j;++mt,lt+=p,Fe+=L,Xe+=P){const ne=-(lt*lt+Le)*oe;let Be=Math.exp(ne)*te;this._visibilitySelector!=null&&Be>O[Fe]&&(O[Fe]=Be,B[Fe]=t.atoms[U]),T[Fe]+=Be,Be*=g;const Ne=U*3;C[Xe]+=Be*a[Ne],C[Xe+1]+=Be*a[Ne+1],C[Xe+2]+=Be*a[Ne+2]}}}}}_shiftByOrigin(e){const t=this.origin.x,n=this.origin.y,i=this.origin.z,r=4,s=e.length/r;for(let a=0;a<s;++a){const c=a*r;e[c]-=t,e[c+1]-=n,e[c+2]-=i}}},J7=Q7;function e9(e,t,n,i){const s=e.length/4,a=t[0],c=t[1],u=t[2],d=n[0],p=n[1],g=n[2];function v(oe,ee){return Math.floor((oe-ee)/i)}const y=v(d,a)+1,S=v(p,c)+1,E=v(g,u)+1,w=y*S*E,b=S*E,T=function(oe,ee,k){return(v(oe,a)*S+v(ee,c))*E+v(k,u)},L=[];let C,P;for(C=0;C<s;C++){const oe=4*C;P=T(e[oe],e[oe+1],e[oe+2]),L[P]===void 0?L[P]=[C]:L[P].push(C)}const O=rt.allocateTyped(Uint32Array,w),B=rt.allocateTyped(Uint16Array,w),U=rt.allocateTyped(Uint32Array,s);let I=0,z=0,te;for(C=0;C<w;C++){const oe=O[C]=I,ee=L[C];if(ee!==void 0)for(te=0;te<ee.length;te++)U[I]=ee[te],I++;const k=I-oe;B[C]=k,k>z&&(z=k)}this.neighbourListLength=27*z+1,this.withinRadii=function(oe,ee,k,X,$){let j=0;const J=v(oe,a),xe=v(ee,c),de=v(k,u),fe=Math.max(0,J-1),F=Math.max(0,xe-1),re=Math.max(0,de-1),ue=Math.min(y-1,J+1),_e=Math.min(S-1,xe+1),Le=Math.min(E-1,de+1);for(C=fe;C<=ue;++C){const Fe=C*b;for(te=F;te<=_e;++te){const Xe=te*E;for(let lt=re;lt<=Le;++lt){P=Fe+Xe+lt;const mt=O[P],ne=mt+B[P];for(let Be=mt;Be<ne;Be++){const Ne=4*U[Be],ve=e[Ne]-oe,ye=e[Ne+1]-ee,et=e[Ne+2]-k,tt=e[Ne+3]+X;ve*ve+ye*ye+et*et<=tt*tt&&($[j++]=U[Be])}}}}$[j]=-1}}function t9(e,t,n,i){const{posRad:s,colors:a,atoms:c}=e,u=s.length/4,{bbox:d}=t,p=d.minPosRad,g=d.maxPosRad;let v,y,S,E,w,b=-1,T,L,C,P,O=null,B=null,U=null,I,z,te,oe,ee,k,X;const $=new R.Vector3(0,0,0),j=new R.Vector3(0,0,0),J=new R.Vector3(0,0,0);let xe;function de(ve,ye,et){const tt=rt.allocateTyped(ve,ye);for(let _t=0;_t<ye;++_t)tt[_t]=et;return tt}function fe(ve,ye,et){for(let tt=0;tt<ve.length;tt++)ve[tt]=ye+et*tt}function F(){({scaleFactor:E}=n),{dim:T}=t,xe=Math.min(5,2+Math.floor(S*E));const ve=T[0]*T[1]*T[2];L=de(Float32Array,ve,-1001),C=rt.allocateTyped(Float32Array,ve*3),P=rt.allocateTyped(Float32Array,ve),U&&(O=rt.allocateTyped(Float32Array,ve),B=[]),I=rt.allocateTyped(Float32Array,T[0]),z=rt.allocateTyped(Float32Array,T[1]),te=rt.allocateTyped(Float32Array,T[2]),fe(I,p[0],1/E),fe(z,p[1],1/E),fe(te,p[2],1/E)}function re(){let ve=0;const ye=2*Math.PI/w;ee=rt.allocateTyped(Float32Array,w),oe=rt.allocateTyped(Float32Array,w);for(let et=0;et<w;et++)ee[et]=Math.cos(ve),oe[et]=Math.sin(ve),ve+=ye}function ue(){k=new e9(s,p,g,2.01*y),X=new Int32Array(k.neighbourListLength)}function _e(){({probeRadius:S,scaleFactor:E,probePositions:w,visibilitySelector:U}=n),v=rt.allocateTyped(Float32Array,u),y=0;for(let ve=0;ve<u;++ve){const ye=s[ve*4+3]+=S;ye>y&&(y=ye),v[ve]=ye*ye}F(),re(),ue(),b=-1}function Le(ve,ye,et,tt){const _t=4*ve,St=v[ve],Mt=s[_t]-ye,Bt=s[_t+1]-et,Ft=s[_t+2]-tt;return Mt*Mt+Bt*Bt+Ft*Ft<St}function Fe(ve,ye,et,tt,_t){let St;if(b!==-1){if(St=b,St!==tt&&St!==_t&&Le(St,ve,ye,et))return St;b=-1}let Mt=0;for(St=X[Mt];St>=0;){if(St!==tt&&St!==_t&&Le(St,ve,ye,et))return b=St,St;St=X[++Mt]}return b=-1,-1}function Xe(){const ve=1.3333333333333333,ye=1/(2*ve*ve);for(let et=0;et<u;et++){const tt=4*et,_t=s[tt],St=s[tt+1],Mt=s[tt+2],Bt=s[tt+3],Ft=v[et];k.withinRadii(_t,St,Mt,Bt,X);const ie=Math.ceil(Bt*E),Z=Math.floor(E*(_t-p[0])),Ve=Math.floor(E*(St-p[1])),ut=Math.floor(E*(Mt-p[2])),gt=Math.max(0,Z-ie),dt=Math.max(0,Ve-ie),G=Math.max(0,ut-ie),q=Math.min(T[0],Z+ie+2),Y=Math.min(T[1],Ve+ie+2),pe=Math.min(T[2],ut+ie+2),Me=et*3,De=a[Me],Ee=a[Me+1],je=a[Me+2];for(let nt=G;nt<pe;nt++){const ft=te[nt]-Mt,se=T[1]*T[0]*nt;for(let Ze=dt;Ze<Y;Ze++){const Se=z[Ze]-St,Ke=ft*ft+Se*Se,le=se+T[0]*Ze;for(let At=gt;At<q;At++){const be=At+le,Yt=I[At]-_t,ke=Ke+Yt*Yt;if(ke<Ft){const Nt=Math.exp(-ke*ye),hn=be*3;C[hn]+=De*Nt,C[hn+1]+=Ee*Nt,C[hn+2]+=je*Nt,P[be]+=Nt,U!==null&&Nt>O[be]&&(O[be]=Nt,B[be]=c[et]),L[be]<0&&(L[be]=-L[be]);const Gn=Math.sqrt(ke),Di=Bt/Gn;let Gi=Yt*Di,Ci=Se*Di,bn=ft*Di;if(Gi+=_t,Ci+=St,bn+=Mt,Fe(Gi,Ci,bn,et,-1)===-1){const mi=Bt-Gn;mi<L[be]&&(L[be]=mi)}}}}}}}function lt(ve,ye){return ve.x=ve.y=ve.z=1,ye.x!==0?ve.x=(ye.y+ye.z)/-ye.x:ye.y!==0?ve.y=(ye.x+ye.z)/-ye.y:ye.z!==0&&(ve.z=(ye.x+ye.y)/-ye.z),ve}function mt(ve,ye){const et=4*ve,tt=4*ye,_t=s[et],St=s[et+1],Mt=s[et+2],Bt=s[et+3];let Ft=$.x=s[tt]-_t,ie=$.y=s[tt+1]-St,Z=$.z=s[tt+2]-Mt;const Ve=s[tt+3];let ut=Ft*Ft+ie*ie+Z*Z;const gt=Math.sqrt(ut),dt=Bt*((Bt*Bt+gt*gt-Ve*Ve)/(2*Bt*gt));$.normalize(),lt(j,$),j.normalize(),J.crossVectors($,j),J.normalize();const G=Math.sqrt(Bt*Bt-dt*dt);j.multiplyScalar(G),J.multiplyScalar(G),$.multiplyScalar(dt),$.x+=_t,$.y+=St,$.z+=Mt,b=-1;const q=xe;for(let Y=0;Y<w;Y++){const pe=ee[Y],Me=oe[Y],De=$.x+pe*j.x+Me*J.x,Ee=$.y+pe*j.y+Me*J.y,je=$.z+pe*j.z+Me*J.z;if(Fe(De,Ee,je,ve,ye)===-1){const nt=Math.floor(E*(De-p[0])),ft=Math.floor(E*(Ee-p[1])),se=Math.floor(E*(je-p[2])),Ze=Math.max(0,nt-q),Se=Math.max(0,ft-q),Ke=Math.max(0,se-q),le=Math.min(T[0],nt+q+2),At=Math.min(T[1],ft+q+2),be=Math.min(T[2],se+q+2);for(let Yt=Ke;Yt<be;Yt++){Z=je-te[Yt];const ke=T[1]*T[0]*Yt;for(let Nt=Se;Nt<At;Nt++){ie=Ee-z[Nt];const hn=Z*Z+ie*ie,Gn=ke+T[0]*Nt;for(let Di=Ze;Di<le;Di++){Ft=De-I[Di],ut=hn+Ft*Ft;const Gi=Di+Gn,Ci=L[Gi];Ci>0&&ut<Ci*Ci&&(L[Gi]=Math.sqrt(ut))}}}}}}function ne(){for(let ve=0;ve<u;ve++){const ye=4*ve;k.withinRadii(s[ye],s[ye+1],s[ye+2],s[ye+3],X);let et=0,tt=X[et];for(;tt>=0;)ve<tt&&mt(ve,tt),tt=X[++et]}}function Be(){for(let ve=0,ye=L.length;ve<ye;ve++){L[ve]<0&&(L[ve]=0);let et=P[ve];if(et>0){et=1/et;const tt=ve*3;C[tt]*=et,C[tt+1]*=et,C[tt+2]*=et}}}function Ne(){console.time("ContactSurface.getVolume"),console.time("ContactSurface.init"),_e(),console.timeEnd("ContactSurface.init"),console.time("ContactSurface.projectPoints"),Xe(),console.timeEnd("ContactSurface.projectPoints"),console.time("ContactSurface.projectTorii"),ne(),console.timeEnd("ContactSurface.projectTorii"),Be(),console.timeEnd("ContactSurface.getVolume")}this.build=function(){Ne(),this.volTexMap=C,this.weightsMap=O,this.atomMap=B,this.volMap=L}}var n9=t9,{Volume:A2}=nr,i9=class extends oN{_computeSurface(e,t,n,i){const r=new n9(e,n,i);return r.build(),{volMap:new A2(Float32Array,this.numVoxels,t,1,r.volMap),volTexMap:new A2(Float32Array,this.numVoxels,t,3,r.volTexMap),atomMap:r.atomMap,atomWeightMap:new A2(Float32Array,this.numVoxels,t,1,r.weightsMap)}}},r9=i9,s9=class{constructor(e,t){this.coord=new R.Vector3,this.coord.copy(e),this.radius=t,this.colorX=.99999,this.colorY=0,this.colorZ=0,this.atomType=0,this.srcAtom=null}},o9=s9,a9=class{constructor(e,t,n,i,r){this._numAtoms=e,this._atoms=t,this._vBoxMin=new R.Vector3,this._vBoxMax=new R.Vector3,this._vBoxMin.copy(n),this._vBoxMax.copy(i),this._probeRadius=r,this._atomsList=null,this._voxelList=null}createVoxels(){let e,t;const i=this._numAtoms|0,r=this._atoms,s=this._vBoxMax.x-this._vBoxMin.x,a=this._vBoxMax.y-this._vBoxMin.y,c=this._vBoxMax.z-this._vBoxMin.z;let u=s<a?s:a;u=c<u?c:u;let d=0,p=0,g;for(g=0;g<i;g++)t=(r[g].radius+this._probeRadius)*2,d=t>d?t:d,p+=t;let v=Math.floor(u/d);v<2&&(v=2),p/=i,this._numCells=v,this._aveRad=p,this._maxRad=d;const y=v,S=v*v,E=v*v*v,w=this._xScale=1/(this._vBoxMax.x-this._vBoxMin.x),b=this._yScale=1/(this._vBoxMax.y-this._vBoxMin.y),T=this._zScale=1/(this._vBoxMax.z-this._vBoxMin.z);let L=0;const C=w*v,P=b*v,O=T*v;for(g=0;g<i;g++){const U=(r[g].radius+this._probeRadius)*4.5*2;let I=Math.floor(C*U+.8),z=Math.floor(P*U+.8),te=Math.floor(O*U+.8);I++,z++,te++,L+=I*z*te}this._voxelList=rt.allocateTyped(Int32Array,E);const B=[];if(B.length=L,this._voxelList===null||B===null)return-1;for(g=0;g<E;g++)this._voxelList[g]=-1;for(e=0,g=0;g<i;g++){t=(r[g].radius+this._probeRadius)*4.5;let U=Math.floor((r[g].coord.x-this._vBoxMin.x-t)*v*w),I=Math.floor((r[g].coord.y-this._vBoxMin.y-t)*v*b),z=Math.floor((r[g].coord.z-this._vBoxMin.z-t)*v*T),te=Math.floor((r[g].coord.x-this._vBoxMin.x+t)*v*w),oe=Math.floor((r[g].coord.y-this._vBoxMin.y+t)*v*b),ee=Math.floor((r[g].coord.z-this._vBoxMin.z+t)*v*T);U=U>=0?U:0,I=I>=0?I:0,z=z>=0?z:0,te=te<v?te:v-1,oe=oe<v?oe:v-1,ee=ee<v?ee:v-1;for(let k=z;k<=ee;k++)for(let X=I;X<=oe;X++)for(let $=U;$<=te;$++){const j=$+X*y+k*S;if(this._voxelList[j]<0){B[e*2+0]=g,B[e*2+1]=-1,this._voxelList[j]=e,e++;continue}const J=this._voxelList[j];this._voxelList[j]=e,B[e*2+0]=g,B[e*2+1]=J,e++}}return this._atomsList=Int32Array.from(B),0}destroyVoxels(){this._atomsList=null,this._voxelList=null,this._atoms=null,this._vertices=null,this._vBoxMin=null,this._vBoxMax=null}forEachRelatedAtom(e,t){const n=Math.floor((e.x-this._vBoxMin.x)*this._numCells*this._xScale),i=Math.floor((e.y-this._vBoxMin.y)*this._numCells*this._yScale),r=Math.floor((e.z-this._vBoxMin.z)*this._numCells*this._zScale),s=n+i*this._numCells+r*this._numCells*this._numCells,a=this._atoms;for(let c=this._voxelList[s];c>=0;c=this._atomsList[c*2+1]){const u=this._atomsList[c*2];t(a[u])}}getClosestAtom(e){let t=null,n=Number.MAX_VALUE;return this.forEachRelatedAtom(e,i=>{const r=e.distanceToSquared(i.coord);r<n&&(n=r,t=i)}),t}buildNormals(e,t,n){const i=this;let r=0,s=0,a=0,c=0,u,d=0,p=0,g=0,v=0,y=0;const S=2.5,E=.1,w=this._aveRad*S,b=w*w,T=-this._aveRad*E,L=function(P){const O=s-P.coord.x,B=a-P.coord.y,U=c-P.coord.z;if(u=O*O+B*B+U*U,u>b)return;const I=P.radius+i._probeRadius;v=u-I*I,v<0&&(v=-v),y=Math.exp(T*v),d+=O*y,p+=B*y,g+=U*y,r++};let C=0;for(let P=0;P<e;P++)s=t[P].x,a=t[P].y,c=t[P].z,r=0,d=p=g=0,this.forEachRelatedAtom(t[P],L),C=r>C?r:C,u=d*d+p*p+g*g,r>0&&(v=1/Math.sqrt(u),d*=v,p*=v,g*=v),n[P].x=d,n[P].y=p,n[P].z=g;return 0}buildColors(e,t,n,i){const r=this;let s=0,a=0,c=0,u=0,d=0;const p=.8,g=i,v=g*g;let y=[],S=[],E=0;const w=function(b){const T=s-b.coord.x,L=a-b.coord.y,C=c-b.coord.z,P=T*T+L*L+C*C;if(P>v)return;const O=b.radius+r._probeRadius;u=P-O*O,u<0&&(u=-u),d=1/(p+u),y.push([b.colorX,b.colorY,b.colorZ]),S.push(d),E+=d};for(let b=0;b<e;b++){s=t[b].x,a=t[b].y,c=t[b].z,y=[],S=[],E=0,this.forEachRelatedAtom(t[b],w);for(let T=0;T<y.length;++T){const L=S[T]/E;n[b].x+=y[T][0]*L,n[b].y+=y[T][1]*L,n[b].z+=y[T][2]*L}}return 0}},l9=a9,c9=class{constructor(e,t,n){this._maxNumVertices=e,this._maxNumTriangles=t,this._vertices=new Array(e),this._normals=new Array(e),this._colors=null,n&&(this._colors=new Array(e)),this._indices=new Array(t*3),this._numVertices=0,this._numTriangles=0;let i;for(i=0;i<e;i++)this._vertices[i]=new R.Vector3,this._normals[i]=new R.Vector3;for(i=0;i<t*3;i++)this._indices[i]=-1;if(n)for(i=0;i<e;i++)this._colors[i]=new R.Vector3}destroy(){this._vertices=null,this._normals=null,this._indices=null}},wC=c9,u9=3,E2=32768,{Element:h9}=nr,f9=class extends iN{_build(){this._innerBuild();const e=this.getGeo();this.destroy(),this._fromGeo(e)}_fromGeo(e){let t=null;const n=rt.allocateTyped(Float32Array,3*e._numVertices),i=rt.allocateTyped(Float32Array,3*e._numVertices);e._colors!==null&&(t=rt.allocateTyped(Float32Array,3*e._numVertices));const r=rt.allocateTyped(Uint32Array,3*e._numTriangles);for(let a=0,c=0;a<e._numVertices;a++)n[c+0]=e._vertices[a].x,n[c+1]=e._vertices[a].y,n[c+2]=e._vertices[a].z,i[c+0]=e._normals[a].x,i[c+1]=e._normals[a].y,i[c+2]=e._normals[a].z,c+=3;if(t!==null)for(let a=0,c=0;a<e._numVertices;a++,c+=3)t[c+0]=e._colors[a].x,t[c+1]=e._colors[a].y,t[c+2]=e._colors[a].z;const s=e._numTriangles*3;for(let a=0;a<s;a++)r[a]=e._indices[a];this.setIndex(new R.BufferAttribute(r,1)),this.setAttribute("position",new R.BufferAttribute(n,3)),this.setAttribute("normal",new R.BufferAttribute(i,3)),this.setAttribute("color",new R.BufferAttribute(t,3)),this.computeBoundingBox(),this.computeBoundingSphere(),e.destroy()}convertToAtomsColored(e,t){const{atoms:n,colors:i}=e;for(let r=0,s=n.length;r<s;r++){const a=n[r].position,{radius:c}=n[r].element;t[r]=new o9(a,c);const u=n[r].element.number;t[r].atomType=this.getType(u);let d=u9*r;t[r].colorX=i[d++],t[r].colorY=i[d++],t[r].colorZ=i[d],t[r].srcAtom=n[r]}}getGeo(){return this.geoOut}destroy(){this.atoms=null,this.hashLines=null,this.hashEntries=null}getBoundingBox(e,t,n){t.x=t.y=t.z=1e7,n.x=n.y=n.z=-1e7;const r=this.probeRadius*this.atomRadiusScale;let s=0;for(let a=0,c=e.length;a<c;a++){const u=e[a].coord,d=e[a].radius+r;s=d>s?d:s,u.x-d<t.x&&(t.x=u.x-d),u.y-d<t.y&&(t.y=u.y-d),u.z-d<t.z&&(t.z=u.z-d),u.x+d>n.x&&(n.x=u.x+d),u.y+d>n.y&&(n.y=u.y+d),u.z+d>n.z&&(n.z=u.z+d)}t.x-=s,t.y-=s,t.z-=s,n.x+=s,n.y+=s,n.z+=s}getCornerCoord(e,t,n,i,r,s,a){const c=1/(s-1),u=n*c,d=i*c,p=r*c;a.x=e.x*(1-u)+t.x*u,a.y=e.y*(1-d)+t.y*d,a.z=e.z*(1-p)+t.z*p}buildEdgePoint(e,t,n,i,r,s){if(n[e]^n[t]){const c=(0-i.pointsValuesLinear[r+24+e])/(i.pointsValuesLinear[r+24+t]-i.pointsValuesLinear[r+24+e]),u=i.pointsValuesLinear[r+e*3+0],d=i.pointsValuesLinear[r+e*3+1],p=i.pointsValuesLinear[r+e*3+2],g=i.pointsValuesLinear[r+t*3+0],v=i.pointsValuesLinear[r+t*3+1],y=i.pointsValuesLinear[r+t*3+2];s.x=u*(1-c)+g*c,s.y=d*(1-c)+v*c,s.z=p*(1-c)+y*c}}isTriangleVisible(e,t,n){const i=this.voxelWorld.getClosestAtom(e),r=this.voxelWorld.getClosestAtom(t),s=this.voxelWorld.getClosestAtom(n);return i===null||r===null||s===null||i.srcAtom===null||r.srcAtom===null||s.srcAtom===null?!1:this.visibilitySelector.includesAtom(i.srcAtom)&&this.visibilitySelector.includesAtom(r.srcAtom)&&this.visibilitySelector.includesAtom(s.srcAtom)}addTriangle(e,t,n){if(this.visibilitySelector&&!this.isTriangleVisible(e,t,n))return!0;const i=this.geoOut;if(i._numTriangles>=this.maxNumTriangles)return!1;const r=this.addVertexToGeo(i,e),s=this.addVertexToGeo(i,t),a=this.addVertexToGeo(i,n);if((r|s|a)<0)return!1;const c=3*i._numTriangles;return i._indices[c+0]=r,i._indices[c+1]=s,i._indices[c+2]=a,i._numTriangles++,!0}buildGeoFromCorners(e,t,n,i,r,s){const u=e-1,d=e,p=e*e,g=new Array(12);for(let w=0;w<12;w++)g[w]=new R.Vector3;const v=[];for(let w=0;w<8;w++)v[w]=1;const y=new R.Vector3;let S=0,E=0;for(let w=0;w<u;w++,E+=p){let b=0;for(let T=0;T<u;T++,b+=d)for(let L=0;L<u;L++){if(!s.hasIntersection[S]){S++;continue}const C=s.bitsInside[S];this.getCornerCoord(t,n,L,w,T,e,y);const P=S*32;for(let U=0,I=0;U<8;U++)s.pointsValuesLinear[P+I++]=y.x,s.pointsValuesLinear[P+I++]=y.y,s.pointsValuesLinear[P+I++]=y.z;s.pointsValuesLinear[P+3]+=r.x,s.pointsValuesLinear[P+6]+=r.x,s.pointsValuesLinear[P+15]+=r.x,s.pointsValuesLinear[P+18]+=r.x,s.pointsValuesLinear[P+6+2]+=r.z,s.pointsValuesLinear[P+9+2]+=r.z,s.pointsValuesLinear[P+18+2]+=r.z,s.pointsValuesLinear[P+21+2]+=r.z,s.pointsValuesLinear[P+12+1]+=r.y,s.pointsValuesLinear[P+15+1]+=r.y,s.pointsValuesLinear[P+18+1]+=r.y,s.pointsValuesLinear[P+21+1]+=r.y;const O=P+24;for(let U=0;U<8;++U)v[U]=s.pointsValuesLinear[O+U]<0?1:0;this.buildEdgePoint(0,1,v,s,P,g[0]),this.buildEdgePoint(1,2,v,s,P,g[1]),this.buildEdgePoint(2,3,v,s,P,g[2]),this.buildEdgePoint(3,0,v,s,P,g[3]),this.buildEdgePoint(4,5,v,s,P,g[4]),this.buildEdgePoint(5,6,v,s,P,g[5]),this.buildEdgePoint(6,7,v,s,P,g[6]),this.buildEdgePoint(7,4,v,s,P,g[7]),this.buildEdgePoint(0,4,v,s,P,g[8]),this.buildEdgePoint(1,5,v,s,P,g[9]),this.buildEdgePoint(2,6,v,s,P,g[10]),this.buildEdgePoint(3,7,v,s,P,g[11]);const B=C*16;for(let U=0,I=0;U<6;U++,I+=3){const z=s.striIndicesMarchCube[B+I];if(z<0)break;const te=s.striIndicesMarchCube[B+I+1],oe=s.striIndicesMarchCube[B+I+2];if(!this.addTriangle(g[z],g[te],g[oe]))return-2}S++}}return 0}getNumIntersectedCells(e,t,n,i){const r=e*e,s=8;let a=0,c=0,u=0;for(let d=0;d<t;d++,u+=r){let p=0;for(let g=0;g<t;g++,p+=e)for(let v=0;v<t;v++){const y=c*32+24,S=v+p+u;i.pointsValuesLinear[y]=n[S],i.pointsValuesLinear[y+1]=n[S+1],i.pointsValuesLinear[y+2]=n[S+e+1],i.pointsValuesLinear[y+3]=n[S+e],i.pointsValuesLinear[y+4]=n[r+S],i.pointsValuesLinear[y+5]=n[r+S+1],i.pointsValuesLinear[y+6]=n[r+S+e+1],i.pointsValuesLinear[y+7]=n[r+S+e];let E=0;for(let w=0;w<s;++w)i.pointsValuesLinear[y+w]<0&&(E|=1<<w);E===0||E===(1<<s)-1?i.hasIntersection[c]=!1:(i.hasIntersection[c]=!0,a++),i.bitsInside[c]=E,c++}}return a}getType(e){const t=[0,0,1,1,2,6,3,6,4,6,5,6,6,0,7,3,8,2,9,6,10,6,11,6,12,6,13,6,14,6,15,4,16,5,17,6,18,6,19,6,20,6,21,6,22,6,23,6,24,6,25,6,26,6,27,6,28,6,29,6,30,6,31,6,32,6,33,6,34,6,35,6,36,6,37,6,38,6,39,6,40,6,41,6,42,6,43,6,44,6,45,6,46,6,47,6,48,6,49,6,50,6,51,6,52,6,53,6,54,6,55,6,56,6,57,6,58,6,59,6,60,6,61,6,62,6,63,6,64,6,65,6,66,6,67,6,68,6,69,6,70,6,71,6,72,6,73,6,74,6,75,6,76,6,77,6,78,6,79,6,80,6,81,6,82,6,83,6,84,6,85,6,86,6,87,6,88,6,89,6,90,6,91,6,92,6,93,6,94,6,95,6,96,6,97,6,98,6,99,6,100,6,101,6,102,6,103,6,104,6,105,6,106,6,107,6,108,6,109,6];if(e<1||e>t.length/2||Object.keys(h9.ByAtomicNumber).length*2!==t.length)throw new Error("atomT.length should be equal Element.ByAtomicNumber.length * 2");return t[e*2]}calculateGridCorners(e,t,n,i,r,s){const a=t*t,c=a*t,u=new R.Vector3,d=new R.Vector3,p=1e12;for(let S=0;S<c;S++)e[S]=p;const g=(t-1)/(i.x-n.x),v=(t-1)/(i.y-n.y),y=(t-1)/(i.z-n.z);for(let S=0,E=r.length;S<E;S++){const w=r[S],b=w.radius+s,T=(w.coord.x-b-n.x)*g,L=(w.coord.y-b-n.y)*v,C=(w.coord.z-b-n.z)*y,P=Math.floor(T),O=Math.floor(L),B=Math.floor(C);let U=Math.floor((w.coord.x+b-n.x)*g),I=Math.floor((w.coord.y+b-n.y)*v),z=Math.floor((w.coord.z+b-n.z)*y);U++,I++,z++,U=U<=t-1?U:t-1,I=I<=t-1?I:t-1,z=z<=t-1?z:t-1;for(let te=O;te<=I;te++){const oe=te*a;for(let ee=B;ee<=z;ee++){const k=ee*t;for(let X=P;X<=U;X++){const $=oe+k+X;this.getCornerCoord(n,i,X,te,ee,t,u),d.x=u.x-w.coord.x,d.y=u.y-w.coord.y,d.z=u.z-w.coord.z;const j=Math.sqrt(d.x*d.x+d.y*d.y+d.z*d.z)-b;j<e[$]&&(e[$]=j)}}}}}createVertexHash(e,t){if(this.hashLines=rt.allocateTyped(Int32Array,E2*2),this.hashLines===null)return-1;for(let n=0,i=0;n<E2;n++)this.hashLines[i++]=0,this.hashLines[i++]=-1;if(this.maxNumVertices=e,this.maxNumTriangles=t,this.numHashEtriesAllocated=e,this.hashEntries=rt.allocateTyped(Int32Array,2*this.numHashEtriesAllocated),this.hashEntries===null)return-1;for(let n=0,i=0;n<this.numHashEtriesAllocated;n++)this.hashEntries[i++]=-1,this.hashEntries[i++]=-1;return this.numHashEntryIndex=0,0}getNewHashEntry(){if(this.numHashEntryIndex<this.numHashEtriesAllocated){const e=this.numHashEntryIndex;return this.numHashEntryIndex++,e}return-1}addVertexToGeo(e,t){let n;const u=this.marCubeResoultion<<2,d=new R.Vector3,p=Math.floor(u*(t.x-this.vBoxMin.x)/(this.vBoxMax.x+.01-this.vBoxMin.x)),g=Math.floor(u*(t.y-this.vBoxMin.y)/(this.vBoxMax.y+.01-this.vBoxMin.y)),v=Math.floor(u*(t.z-this.vBoxMin.z)/(this.vBoxMax.z+.01-this.vBoxMin.z));let y=p*815851+v*37633+g*2453543;y&=E2-1;const S=y+y;if(this.vBoxMin!==null&&this.vBoxMax!==null)for(n=this.hashLines[S+1];n>=0;n=this.hashEntries[n*2+1]){const w=this.hashEntries[n*2+0];if(d.copy(e._vertices[w]),d.x-=t.x,d.y-=t.y,d.z-=t.z,d.x*d.x+d.y*d.y+d.z*d.z<1e-6)return w}if(e._numVertices>=this.maxNumVertices)return-1;const E=e._numVertices;if(e._vertices[E].copy(t),this.vBoxMin!==null&&this.vBoxMax!==null){if(n=this.getNewHashEntry(),n<0)return-1;const w=this.hashLines[S+1];this.hashLines[S+1]=n,this.hashEntries[n*2+0]=E,this.hashEntries[n*2+1]=w,this.hashLines[S+0]++}return e._numVertices++,E}modifyExcludedFromGeo(e,t,n,i,r,s){let a,c,u;function p(){u>0&&s[a]<0&&(s[a]=u),u>s[a]&&(s[a]=u)}const g=e*e,v=(e-1)/(i.x-n.x),y=(e-1)/(i.y-n.y),S=(e-1)/(i.z-n.z),E=t*2*(t*2),w=1/(e-1);for(let b=0;b<r._numVertices;b++){const T=r._vertices[b],L=t*1.1;let C=Math.floor((T.x-L-n.x)*v),P=Math.floor((T.y-L-n.y)*y),O=Math.floor((T.z-L-n.z)*S),B=Math.floor((T.x+L-n.x)*v),U=Math.floor((T.y+L-n.y)*y),I=Math.floor((T.z+L-n.z)*S);C=C>=0?C:0,P=P>=0?P:0,O=O>=0?O:0,B=B<=e-1?B:e-1,U=U<=e-1?U:e-1,I=I<=e-1?I:e-1;for(let z=P;z<=U;z++){const te=z*g;for(let oe=O;oe<=I;oe++){const ee=oe*e;for(let k=C;k<=B;k++){a=te+ee+k;let X=k*w;const $=n.x*(1-X)+i.x*X;X=z*w;const j=n.y*(1-X)+i.y*X;X=oe*w;const J=n.z*(1-X)+i.z*X,xe=$-T.x,de=j-T.y,fe=J-T.z,F=xe*xe+de*de+fe*fe;F<E&&(c=Math.sqrt(F),u=-(c-t),p())}}}}return 0}_innerBuild(){let e;const n={posRad:this._posRad,colors:this._colors,atoms:this._opts.atoms};this.complex=this._opts.parent,this.atoms=n.atoms,this.meshResolution=this._opts.gridSpacing,this.atomRadiusScale=this._opts.radScale,this.colorMode=this._opts.colorMode,this.probeRadius=this._opts.probeRadius,this.useVertexColors=!0,this.excludeProbe=this._opts.excludeProbe,this.visibilitySelector=this._opts.visibilitySelector,this.geoOut=null,this.hashLines=null,this.hashEntries=null,this.numHashEtriesAllocated=0,this.numHashEntryIndex=0,this.maxNumVertices=0,this.maxNumTriangles=0;const i=new Array(this.atoms.length);this.convertToAtomsColored(n,i);const r=this.vBoxMin=new R.Vector3,s=this.vBoxMax=new R.Vector3;this.getBoundingBox(i,r,s);const a=this.marCubeResoultion=this.meshResolution*4,c=a,u=c*c*c,d=rt.allocateTyped(Float32Array,u),p=this.probeRadius*this.atomRadiusScale;this.calculateGridCorners(d,c,r,s,i,p);const g=a-1,v=new sN;if(e=v.create(g),e<0)return e;const y=new R.Vector3;y.x=(s.x-r.x)/g,y.y=(s.y-r.y)/g,y.z=(s.z-r.z)/g;let S=this.getNumIntersectedCells(c,g,d,v),E=Math.floor(S*1.2),w=Math.floor(S*1.2*2);if(this.geoOut=new wC(E,w,this.useVertexColors),e=this.createVertexHash(E,w),e<0)return e;let b=p;if(this.excludeProbe&&(b=.01),this.voxelWorld=new l9(i.length,i,r,s,b),this.voxelWorld.createVoxels(),e=this.buildGeoFromCorners(a,r,s,d,y,v),this.excludeProbe){if(this.modifyExcludedFromGeo(c,p,r,s,this.geoOut,d),this.geoOut._vertices=null,this.geoOut._colors=null,this.geoOut._indices=null,this.geoOut._normals=null,this.geoOut._numVertices=0,this.geoOut._numTriangles=0,this.geoOut=null,S=this.getNumIntersectedCells(c,g,d,v),E=Math.floor(S*1.2),w=Math.floor(S*1.2*2),this.geoOut=new wC(E,w,this.useVertexColors),e=this.createVertexHash(E,w),e<0)return e;e=this.buildGeoFromCorners(c,r,s,d,y,v)}this.voxelWorld.buildNormals(this.geoOut._vertices.length,this.geoOut._vertices,this.geoOut._normals);let T=6.5;return this.excludeProbe&&(T-=1.5),this.useVertexColors&&this.voxelWorld.buildColors(this.geoOut._vertices.length,this.geoOut._vertices,this.geoOut._colors,T),this.voxelWorld.destroyVoxels(),this.voxelWorld=null,v.destroy(),e}},d9=f9;function p9(e,t){const n=document.createElement("div");if(n.className=t,typeof e=="string"){const i=document.createElement("span");i.style.fontSize="150%";const r=e.split(`
`);for(let s=0,a=r.length;s<a;++s){const c=document.createElement("span"),u=document.createTextNode(r[s]);c.appendChild(u),i.appendChild(c),s<a-1&&i.appendChild(document.createElement("br"))}n.appendChild(i)}else n.appendChild(e);return n.worldPos=new R.Vector3,n}var m9=class extends eo{constructor(e,t){super(),this._opts=t,this.items=[],this.needsUpdate=!1;let n=-50,i=-50;switch(t.horizontalAlign){case"left":n=0;break;case"right":n=-100;break;default:break}switch(t.verticalAlign){case"top":i=-100;break;case"bottom":i=0;break;default:break}const r=new R.Vector3(t.dx||0,t.dy||0,t.dz||0);this.userData={translation:`translate(${n}%, ${i}%)`,offset:r}}setItem(e,t,n){const i=this._opts,r=this.items[e]||p9(n,"label");r.worldPos.copy(t),r.style.textAlign=i.horizontalAlign,r.style.verticalAlign=i.verticalAlign,this.items[e]=r}setColor(e,t,n){const i=this.items[e];i.opts={color:t,background:n}}startUpdate(){return!0}finishUpdate(){this.needsUpdate=!0,this.dispatchEvent({type:"update"})}finalize(){this.finishUpdate()}raycast(){}setOpacity(){}getSubset(){return[]}},Ga={InstancedSpheresGeometry:qP,SimpleSpheresGeometry:x7,Simple2CCylindersGeometry:oA,Instanced2CCylindersGeometry:KP,ExtrudedObjectsGeometry:N7,ChunkedLinesGeometry:tN,TwoColorLinesGeometry:G7,CrossGeometry:W7,QuickSurfGeometry:J7,ContactSurfaceGeometry:r9,SSIsosurfaceGeometry:d9,LabelsGeometry:m9},g9=`float INSTANCED_SPRITE_OVERSCALE = 1.3;\r
\r
attribute vec3 normal;\r
\r
#ifdef NORMALS_TO_G_BUFFER\r
varying vec3 viewNormal;\r
#endif\r
#if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r
varying vec3 vNormal;\r
#endif\r
\r
#ifdef THICK_LINE\r
attribute vec4 position; // W contains vert pos or neg offset\r
#else\r
attribute vec3 position;\r
#endif\r
\r
varying vec3 vWorldPosition;\r
varying vec3 vViewPosition;\r
\r
#ifdef ATTR_ALPHA_COLOR\r
attribute float alphaColor;\r
varying float alphaCol;\r
#endif\r
\r
#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r
#if NUM_DIR_LIGHTS > 0\r
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\r
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\r
varying vec3 vDirectionalShadowNormal[ NUM_DIR_LIGHTS ];\r
#endif\r
#endif\r
\r
#ifdef ATTR_COLOR\r
attribute vec3 color;\r
varying vec3 vColor;\r
#endif\r
\r
#ifdef ATTR_COLOR2\r
attribute vec3 color2;\r
varying vec3 vColor2;\r
attribute vec2 uv;\r
#ifndef CYLINDER_SPRITE\r
varying vec2 vUv;\r
#endif\r
#endif\r
\r
#ifdef INSTANCED_POS\r
attribute vec4 offset;\r
#ifdef SPHERE_SPRITE\r
varying vec4 instOffset;\r
varying vec4 spritePosEye;\r
#endif\r
#endif\r
\r
#ifdef INSTANCED_MATRIX\r
attribute vec4 matVector1;\r
attribute vec4 matVector2;\r
attribute vec4 matVector3;\r
attribute vec4 invmatVector1;\r
attribute vec4 invmatVector2;\r
attribute vec4 invmatVector3;\r
\r
#ifdef CYLINDER_SPRITE\r
varying vec4 matVec1;\r
varying vec4 matVec2;\r
varying vec4 matVec3;\r
varying vec4 invmatVec1;\r
varying vec4 invmatVec2;\r
varying vec4 invmatVec3;\r
varying vec4 spritePosEye;\r
#endif\r
#endif\r
\r
uniform mat4 modelViewMatrix; // optional\r
uniform mat4 projectionMatrix; // optional\r
uniform mat3 normalMatrix; // optional\r
uniform mat4 modelMatrix; // optional\r
\r
#ifdef DASHED_LINE\r
attribute float lineDistance;\r
varying float vLineDistance;\r
#endif\r
\r
#ifdef THICK_LINE\r
attribute vec3 direction;\r
uniform mat4 projMatrixInv;\r
uniform vec2 viewport;\r
uniform float lineWidth;\r
\r
vec4 transform(vec4 coord){\r
return projectionMatrix * modelViewMatrix * coord;\r
}\r
\r
vec2 project(vec4 device){\r
vec3 device_normal = device.xyz/device.w;\r
vec2 clip_pos = (device_normal*0.5+0.5).xy;\r
return clip_pos * viewport;\r
}\r
\r
vec4 unproject(vec2 screen, float z, float w){\r
vec2 clip_pos = screen/viewport;\r
vec2 device_normal = clip_pos*2.0-1.0;\r
return vec4(device_normal*w, z, w);\r
}\r
#endif\r
\r
\r
/////////////////////////////////////////// Main ///////////////////////////////////////////////\r
void main() {\r
\r
#ifdef ATTR_ALPHA_COLOR\r
alphaCol = alphaColor;\r
#endif\r
\r
#ifdef INSTANCED_MATRIX\r
vec3 objectNormal = vec3(\r
dot(normal, matVector1.xyz),\r
dot(normal, matVector2.xyz),\r
dot(normal, matVector3.xyz));\r
#else\r
vec3 objectNormal = vec3( normal );\r
#endif\r
\r
vec3 transformedNormal = normalMatrix * objectNormal;\r
\r
#if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r
vNormal = normalize(transformedNormal);\r
#endif\r
\r
#ifdef NORMALS_TO_G_BUFFER\r
viewNormal = normalize(mat3(modelViewMatrix)*objectNormal);\r
#endif\r
\r
vec4 localPos = vec4(position.xyz, 1.0);\r
vec4 worldPos = modelMatrix * localPos;\r
vec4 mvPosition = modelViewMatrix * localPos;\r
\r
// make thick line offset\r
#ifdef THICK_LINE\r
// get screen pos\r
vec4 dPos = transform(vec4(position.xyz, 1.0));\r
vec2 sPos = project(dPos);\r
// move pos forward\r
vec3 position2 = position.xyz + direction.xyz * 0.5;\r
// get screen offset pos\r
vec4 dPos2 = transform(vec4(position2.xyz, 1.0));\r
vec2 sPos2 = project(dPos2);\r
// screen line direction\r
vec2 sDir = normalize(sPos2 - sPos);\r
// vertex offset (orthogonal to line direction)\r
vec2 offset1 = vec2(-sDir.y, sDir.x);\r
// move screen vertex\r
vec2 newPos = sPos + offset1 * position.w * lineWidth;\r
// get moved pos in view space\r
vec4 dNewPos = unproject(newPos, dPos.z, dPos.w);\r
mvPosition.xyz = (projMatrixInv * dNewPos).xyz;\r
#endif // THICK_LINE\r
\r
#ifdef INSTANCED_POS\r
#ifdef SPHERE_SPRITE\r
instOffset = offset;\r
\r
vec4 posEye = modelViewMatrix * vec4( offset.xyz, 1.0 );\r
float scale = length(modelViewMatrix[0]);\r
mvPosition = posEye + vec4( position.xyz * offset.w * scale * INSTANCED_SPRITE_OVERSCALE, 0.0 );\r
posEye.w = offset.w * scale;\r
\r
spritePosEye = posEye;\r
#else\r
localPos = vec4( offset.xyz + position.xyz * offset.w, 1.0 );\r
worldPos = modelMatrix * localPos;\r
mvPosition = modelViewMatrix * localPos;\r
#endif\r
#endif\r
\r
#ifdef INSTANCED_MATRIX\r
#ifdef CYLINDER_SPRITE\r
matVec1 = matVector1;\r
matVec2 = matVector2;\r
matVec3 = matVector3;\r
invmatVec1 = invmatVector1;\r
invmatVec2 = invmatVector2;\r
invmatVec3 = invmatVector3;\r
\r
// calculate eye coords of cylinder endpoints\r
vec4 v = vec4(0, -0.5, 0, 1);\r
vec4 p1 = modelViewMatrix * vec4(dot(v, matVector1), dot(v, matVector2), dot(v, matVector3), 1.0);\r
v.y = 0.5;\r
vec4 p2 = modelViewMatrix * vec4(dot(v, matVector1), dot(v, matVector2), dot(v, matVector3), 1.0);\r
\r
// sprite is placed at the center of cylinder\r
vec4 posEye;\r
posEye.xyz = mix(p1.xyz, p2.xyz, 0.5);\r
posEye.w = 1.0;\r
spritePosEye = posEye;\r
\r
// cylinder radius in eye space\r
float rad = length(modelViewMatrix[0]) * length(vec3(matVector1.x, matVector2.x, matVector3.x));\r
vec2 spriteSize;\r
#ifdef ORTHOGRAPHIC_CAMERA\r
// In ortho projection we skip z coordinate\r
// basic sprite size at screen plane (covers only cylinder axis)\r
vec2 spriteSizeScreen = abs(p2.xy - p1.xy);\r
\r
spriteSize = vec2(1.0, 1.0) * INSTANCED_SPRITE_OVERSCALE * (spriteSizeScreen + 2.0 * rad);\r
#else\r
// basic sprite size at screen plane (covers only cylinder axis)\r
vec2 spriteSizeScreen = abs(p2.xy / p2.z - p1.xy / p1.z);\r
\r
// full sprite size in eye coords\r
float minZ = min(abs(p1.z), abs(p2.z));\r
spriteSize = vec2(1.0, 1.0) * INSTANCED_SPRITE_OVERSCALE * abs(posEye.z) * (spriteSizeScreen + 2.0 * rad / minZ);\r
#endif\r
\r
mvPosition = posEye + vec4( position.xy * 0.5 * spriteSize, 0, 0 );\r
#else\r
localPos = vec4(dot(localPos, matVector1), dot(localPos, matVector2), dot(localPos, matVector3), 1.0);\r
worldPos = modelMatrix * localPos;\r
mvPosition = modelViewMatrix * localPos;\r
#endif\r
#endif\r
\r
gl_Position = projectionMatrix * mvPosition;\r
\r
vWorldPosition = worldPos.xyz;\r
vViewPosition = - mvPosition.xyz;\r
\r
#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r
#if NUM_DIR_LIGHTS > 0\r
vec4 worldPosition;\r
// see THREE.WebGLProgram.unrollLoops\r
#pragma unroll_loop_start\r
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * vec4(vWorldPosition, 1.0);\r
vDirectionalShadowNormal[ i ] = (directionalShadowMatrix[ i ] * (modelMatrix * vec4(objectNormal, 0.0))).xyz;\r
}\r
#pragma unroll_loop_end\r
#endif\r
#endif\r
\r
#ifdef ATTR_COLOR\r
vColor = color.xyz;\r
#endif\r
\r
#ifdef ATTR_COLOR2\r
vColor2 = color2;\r
#ifndef CYLINDER_SPRITE\r
vUv = uv;\r
#endif\r
#endif\r
\r
#ifdef DASHED_LINE\r
vLineDistance = lineDistance;\r
#endif\r
}\r
`,_9=`#if defined (NORMALS_TO_G_BUFFER)\r
#define fragColor gl_FragData[0]\r
#else\r
#define fragColor gl_FragColor\r
#endif\r
\r
#ifdef ATTR_ALPHA_COLOR\r
varying float alphaCol;\r
#endif\r
\r
#ifdef COLOR_FROM_POS\r
uniform mat4 world2colorMatrix;\r
#endif\r
\r
#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r
#if NUM_DIR_LIGHTS > 0\r
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\r
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ]; //only for sprites\r
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\r
varying vec3 vDirectionalShadowNormal[ NUM_DIR_LIGHTS ];\r
vec4 vDirLightWorldCoord[ NUM_DIR_LIGHTS ];\r
vec3 vDirLightWorldNormal[ NUM_DIR_LIGHTS ];\r
\r
#ifdef SHADOWMAP_PCF_RAND\r
// We use 4 instead uniform variable or define because this value is used in for(... i < value; ...) with\r
// unroll_loop and unroll_loop has pattern:\r
// /#pragma unroll_loop[\\s]+?for \\( int i \\= (\\d+)\\; i < (\\d+)\\; i \\+\\+ \\) \\{([\\s\\S]+?)(?=\\})\\}/g\r
uniform vec2 samplesKernel[4]; // 4 is length of _samplesKernel which is defined in UberMaterial.js\r
uniform sampler2D noiseTex;\r
uniform vec2 noiseTexelSize;\r
uniform vec2 srcTexelSize;\r
uniform mat4 projectionMatrix;\r
#endif\r
#endif\r
#endif\r
\r
#ifdef ATTR_COLOR\r
varying vec3 vColor;\r
#endif\r
\r
#ifdef ATTR_COLOR2\r
varying vec3 vColor2;\r
#ifndef CYLINDER_SPRITE\r
varying vec2 vUv;\r
#endif\r
#endif\r
\r
uniform vec3 diffuse;\r
uniform vec3 emissive;\r
uniform vec3 specular;\r
uniform float shininess;\r
uniform vec3 fixedColor;\r
uniform float opacity;\r
uniform float zClipValue;\r
uniform float clipPlaneValue;\r
\r
#ifdef NORMALS_TO_G_BUFFER\r
varying vec3 viewNormal;\r
#endif\r
\r
#define RECIPROCAL_PI 0.31830988618\r
#define saturate(a) clamp( a, 0.0, 1.0 )\r
\r
#ifdef USE_FOG\r
uniform vec3 fogColor;\r
uniform float fogAlpha;\r
uniform float fogNear;\r
uniform float fogFar;\r
#endif\r
\r
varying vec3 vWorldPosition; // world position of the pixel (invalid when INSTANCED_SPRITE is defined)\r
varying vec3 vViewPosition;\r
\r
#if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r
varying vec3 vNormal;\r
#endif\r
\r
/////////////////////////////////////////// ZSprites ////////////////////////////////////////////////\r
#if defined (SPHERE_SPRITE) || defined (CYLINDER_SPRITE)\r
uniform float nearPlaneValue;\r
#endif\r
\r
#ifdef SPHERE_SPRITE\r
varying vec4 spritePosEye;\r
#endif\r
\r
#if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r
uniform float zOffset;\r
\r
#if !defined(USE_LIGHTS) || !defined(SHADOWMAP) || !defined(SHADOWMAP_PCF_RAND) || !(NUM_DIR_LIGHTS > 0)\r
uniform mat4 projectionMatrix;\r
#endif\r
\r
float calcDepthForSprites(vec4 pixelPosEye, float zOffset, mat4 projMatrix) {\r
vec4 pixelPosScreen = projMatrix * pixelPosEye;\r
return 0.5 * (pixelPosScreen.z / pixelPosScreen.w + 1.0) + zOffset;\r
}\r
#endif\r
\r
#ifdef SPHERE_SPRITE\r
varying vec4 instOffset;\r
uniform mat4 modelMatrix;\r
uniform mat4 modelViewMatrix;\r
uniform mat4 invModelViewMatrix;\r
uniform mat3 normalMatrix;\r
\r
\r
bool intersect_ray_sphere(in vec3 origin, in vec3 ray, out vec3 point, out float frontFaced) {\r
\r
// intersect XZ-projected ray with circle\r
float a = dot(ray, ray);\r
float b = dot(ray, origin);\r
float c = dot(origin, origin) - 1.0;\r
float det = b * b - a * c;\r
if (det < 0.0) return false;\r
float t1 = (-b - sqrt(det)) / a;\r
float t2 = (-b + sqrt(det)) / a;\r
\r
// calculate both intersection points\r
vec3 p1 = origin + ray * t1;\r
vec3 p2 = origin + ray * t2;\r
\r
// choose nearest point inside frustum\r
#ifdef ORTHOGRAPHIC_CAMERA\r
// orthografic camera is used for dirLight sources. So in it for all spheres the point with smaller 't' is visible\r
// t1 is always smaller than t2 (from calculations)\r
point = p1;\r
frontFaced = 1.0;\r
return true;\r
#else\r
// for perspective camera first intersection can be in front of near plane. If not intersection is p1 else - p2\r
// t* = 0.0 corresponds to point of intersection near plane by the ray from camera to curPixel\r
if (t1 >= 0.0) {\r
point = p1;\r
frontFaced = 1.0;\r
return true;\r
}\r
if (t2 >= 0.0) {\r
point = p2;\r
frontFaced = -1.0;\r
return true;\r
}\r
#endif\r
\r
return false;\r
}\r
\r
bool get_sphere_point(in vec3 pixelPosEye, out vec3 point, out float frontFaced) {\r
vec3 origin, ray;\r
\r
#ifdef ORTHOGRAPHIC_CAMERA\r
// transform vector from sprite center to curPixel into sphere local coords\r
origin = pixelPosEye.xyz - spritePosEye.xyz;\r
origin = (invModelViewMatrix * vec4(origin, 0.0)).xyz / instOffset.w;\r
\r
// transform camera orientation vector into sphere local coords\r
ray = (invModelViewMatrix * vec4(0.0, 0.0, -1.0, 0.0)).xyz;\r
#else\r
// find point of intersection near plane by the ray from camera to curPixel\r
vec4 v = vec4(-(nearPlaneValue / pixelPosEye.z) * pixelPosEye, 1.0);\r
\r
// transform intersection point into sphere local coords\r
v = invModelViewMatrix * v;\r
origin = (v.xyz - instOffset.xyz) / instOffset.w;\r
\r
// transform vector from camera pos to curPixel into sphere local coords\r
ray = (invModelViewMatrix * vec4(pixelPosEye, 0.0)).xyz;\r
#endif\r
ray = normalize(ray);\r
\r
return intersect_ray_sphere(origin, ray, point, frontFaced);\r
}\r
#endif\r
\r
#ifdef CYLINDER_SPRITE\r
varying vec4 matVec1;\r
varying vec4 matVec2;\r
varying vec4 matVec3;\r
varying vec4 invmatVec1;\r
varying vec4 invmatVec2;\r
varying vec4 invmatVec3;\r
\r
uniform mat4 modelMatrix;\r
uniform mat4 modelViewMatrix;\r
uniform mat4 invModelViewMatrix;\r
uniform mat3 normalMatrix;\r
\r
varying vec4 spritePosEye;\r
\r
bool intersect_ray_cylinder(in vec3 origin, in vec3 ray, out vec3 point, out float frontFaced) {\r
\r
// intersect XZ-projected ray with circle\r
float a = dot(ray.xz, ray.xz);\r
float b = dot(ray.xz, origin.xz);\r
float c = dot(origin.xz, origin.xz) - 1.0;\r
float det = b * b - a * c;\r
if (det < 0.0) return false;\r
float t1 = (-b - sqrt(det)) / a;\r
float t2 = (-b + sqrt(det)) / a;\r
\r
// calculate both intersection points\r
vec3 p1 = origin + ray * t1;\r
vec3 p2 = origin + ray * t2;\r
\r
float halfHeight = 0.5;\r
\r
// choose nearest point\r
#ifdef ORTHOGRAPHIC_CAMERA\r
// orthografic camera is used for dirLight sources. So in it for all cylinders the point with smaller 't' is visible\r
// if it is not outside of cylinnder (t1 is always smaller than t2).\r
if (p1.y >= -halfHeight && p1.y <= halfHeight) {\r
point = p1;\r
frontFaced = 1.0;\r
return true;\r
}\r
if (p2.y >= -halfHeight && p2.y <= halfHeight) {\r
point = p2;\r
frontFaced = -1.0;\r
return true;\r
}\r
#else\r
// for perspective camera first intersection can be in front of near plane. If not intersection is p1 else - p2\r
// t* = 0.0 corresponds to point of intersection near plane by the ray from camera to curPixel\r
if (t1 >= 0.0 && p1.y >= -halfHeight && p1.y <= halfHeight) {\r
point = p1;\r
frontFaced = 1.0;\r
return true;\r
}\r
if (t2 >= 0.0 && p2.y >= -halfHeight && p2.y <= halfHeight) {\r
point = p2;\r
frontFaced = -1.0;\r
return true;\r
}\r
#endif\r
\r
return false;\r
}\r
\r
bool get_cylinder_point(in vec3 pixelPosEye, out vec3 point, out float frontFaced) {\r
vec3 origin, ray;\r
vec4 v;\r
\r
#ifdef ORTHOGRAPHIC_CAMERA\r
// transform vector from sprite center to curPixel into cylinder local coords\r
v = invModelViewMatrix * vec4(pixelPosEye.xyz - spritePosEye.xyz, 0.0);\r
origin = vec3(dot(v, invmatVec1), dot(v, invmatVec2), dot(v, invmatVec3));\r
\r
// transform camera orientation vector into cylinder local coords\r
v = invModelViewMatrix * vec4(0.0, 0.0, -1.0, 0.0);\r
ray = vec3(dot(v, invmatVec1), dot(v, invmatVec2), dot(v, invmatVec3));\r
#else\r
// find point of intersection near plane by the ray from camera to curPixel\r
v = vec4(-(nearPlaneValue / pixelPosEye.z) * pixelPosEye, 1.0);\r
\r
// transform intersection point into cylinder local coords\r
v = invModelViewMatrix * v;\r
origin = vec3(dot(v, invmatVec1), dot(v, invmatVec2), dot(v, invmatVec3));\r
\r
// transform vector from camera pos to curPixel into cylinder local coords\r
v = invModelViewMatrix * vec4(pixelPosEye, 0.0);\r
ray = vec3(dot(v, invmatVec1), dot(v, invmatVec2), dot(v, invmatVec3));\r
#endif\r
ray = normalize(ray);\r
\r
return intersect_ray_cylinder(origin, ray, point, frontFaced);\r
}\r
#endif\r
\r
///////////////////////////////////// Pack and unpack ///////////////////////////////////////////////\r
const float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)\r
const float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)\r
\r
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\r
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\r
\r
\r
const float ShiftRight8 = 1. / 256.;\r
\r
vec4 packDepthToRGBA( const in float v ) {\r
vec4 r = vec4( fract( v * PackFactors ), v );\r
r.yzw -= r.xyz * ShiftRight8; // tidy overflow\r
return r * PackUpscale;\r
}\r
\r
float unpackRGBAToDepth( const in vec4 v ) {\r
return dot( v, UnpackFactors );\r
}\r
\r
////////////////////////////////////////// All Lighting /////////////////////////////////////////////////\r
#ifdef TOON_SHADING\r
#define LOW_TOON_BORDER 0.0\r
#define MEDIUM_TOON_BORDER 0.7\r
#define HIGH_TOON_BORDER 1.0\r
\r
#define MEDIUM_TOON_RANGE 0.5\r
#define HIGH_TOON_RANGE 0.95\r
#endif\r
#if defined(USE_LIGHTS) && NUM_DIR_LIGHTS > 0\r
struct ReflectedLight {\r
vec3 directDiffuse;\r
vec3 directSpecular;\r
vec3 indirectDiffuse;\r
};\r
\r
struct BlinnPhongMaterial {\r
vec3 diffuseColor;\r
vec3 specularColor;\r
float specularShininess;\r
};\r
\r
struct GeometricContext {\r
vec3 normal;\r
vec3 viewDir;\r
};\r
\r
struct DirectionalLight {\r
vec3 direction;\r
vec3 color;\r
};\r
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\r
\r
struct DirectionalLightShadow {\r
vec2 shadowMapSize;\r
float shadowBias;\r
float shadowRadius;\r
};\r
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHTS ];\r
\r
uniform vec3 ambientLightColor;\r
\r
/////////////////////////////////////////// Shadowmap ////////////////////////////////////////////////\r
\r
#if defined(SHADOWMAP)\r
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\r
return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\r
}\r
\r
float getShadow( sampler2D shadowMap, DirectionalLightShadow dirLight, vec4 shadowCoord, vec3 vViewPosition, vec3 vNormal ) {\r
float shadow = 0.0;\r
\r
// When shadows for sprites will appear use here for them normals as it done for G-buffer\r
shadowCoord.xyz += dirLight.shadowBias * vNormal;\r
shadowCoord.xyz /= shadowCoord.w;\r
\r
bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\r
bool inFrustum = all( inFrustumVec );\r
bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\r
bool frustumTest = all( frustumTestVec );\r
\r
if ( frustumTest ) {\r
#ifdef SHADOWMAP_BASIC\r
shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\r
#endif\r
\r
#ifdef SHADOWMAP_PCF_SHARP\r
vec2 texelSize = vec2( 1.0 ) / dirLight.shadowMapSize;\r
\r
float dx0 = - texelSize.x * dirLight.shadowRadius;\r
float dy0 = - texelSize.y * dirLight.shadowRadius;\r
float dx1 = + texelSize.x * dirLight.shadowRadius;\r
float dy1 = + texelSize.y * dirLight.shadowRadius;\r
\r
shadow = (\r
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\r
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\r
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\r
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\r
texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\r
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\r
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\r
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\r
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\r
) * ( 1.0 / 9.0 );\r
#endif\r
\r
#ifdef SHADOWMAP_PCF_RAND\r
vec2 texelSize = vec2( 1.0 ) / dirLight.shadowMapSize;\r
\r
vec4 vUv = ((projectionMatrix * vec4(vViewPosition, 1.0)) + 1.0) / 2.0;\r
vec2 vUvNoise = vUv.xy / srcTexelSize * noiseTexelSize;\r
\r
vec2 noiseVec = normalize(texture2D(noiseTex, vUvNoise).rg);\r
mat2 mNoise = mat2(noiseVec.x, noiseVec.y, -noiseVec.y, noiseVec.x);\r
\r
vec2 offset;\r
#pragma unroll_loop_start\r
for ( int i = 0; i < 4; i ++ ) { // 4 is length of _samplesKernel which is defined in UberMaterial.js\r
offset = mNoise * ( normalize( samplesKernel[ i ]) * texelSize * dirLight.shadowRadius );\r
shadow += texture2DCompare( shadowMap, shadowCoord.xy + offset, shadowCoord.z );\r
}\r
#pragma unroll_loop_end\r
shadow /= float( 4 ); // 4 is length of _samplesKernel which is defined in UberMaterial.js\r
#endif\r
}\r
return shadow;//(shadow != 1.0) ? 0.5 : 1.0;//vec4(shadow, shadow, shadow, 1.0);\r
}\r
#endif\r
\r
/////////////////////////////////////////// Lighting /////////////////////////////////////////////////\r
\r
vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\r
return RECIPROCAL_PI * diffuseColor;\r
} // validated\r
\r
vec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\r
// Original approximation by Christophe Schlick '94\r
//;float fresnel = pow( 1.0 - dotLH, 5.0 );\r
// Optimized variant (presented by Epic at SIGGRAPH '13)\r
float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\r
return ( 1.0 - specularColor ) * fresnel + specularColor;\r
} // validated\r
\r
float G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\r
// geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\r
return 0.25;\r
}\r
\r
float D_BlinnPhong( const in float shininess, const in float dotNH ) {\r
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\r
}\r
\r
vec3 BRDF_Specular_BlinnPhong( const in DirectionalLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\r
vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\r
float dotNH = saturate(dot( geometry.normal, halfDir ));\r
float dotLH = saturate(dot( incidentLight.direction, halfDir ));\r
\r
vec3 F = F_Schlick( specularColor, dotLH );\r
float G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\r
float D = D_BlinnPhong( shininess, dotNH );\r
\r
return F * ( G * D );\r
} // validated\r
\r
void RE_Direct_BlinnPhong( const in DirectionalLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight, float penumbra ) {\r
\r
float dotNL = saturate( dot( geometry.normal, directLight.direction ));\r
#ifdef TOON_SHADING\r
if(dotNL < MEDIUM_TOON_RANGE){\r
dotNL = LOW_TOON_BORDER;\r
}\r
else if(dotNL < HIGH_TOON_RANGE){\r
dotNL = MEDIUM_TOON_BORDER;\r
}\r
else{\r
dotNL = HIGH_TOON_BORDER;\r
}\r
#endif\r
\r
vec3 irradiance = dotNL * directLight.color;\r
reflectedLight.directDiffuse += penumbra * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\r
reflectedLight.directSpecular += penumbra * irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess );\r
}\r
\r
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\r
reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\r
}\r
\r
vec3 calcLighting(const in GeometricContext geometry, const in BlinnPhongMaterial material, vec3 vViewPosition) {\r
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ));\r
vec3 irradiance = ambientLightColor;\r
\r
float shadowMask = 1.0;\r
// see THREE.WebGLProgram.unrollLoops\r
#pragma unroll_loop_start\r
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r
#ifdef SHADOWMAP\r
shadowMask = getShadow( directionalShadowMap[ i ], directionalLightShadows[ i ], vDirLightWorldCoord[ i ], vViewPosition, vDirLightWorldNormal[ i ] );\r
#endif\r
\r
if ( shadowMask > 0.0 ) RE_Direct_BlinnPhong( directionalLights[ i ], geometry, material, reflectedLight, shadowMask );\r
}\r
#pragma unroll_loop_end\r
\r
RE_IndirectDiffuse_BlinnPhong(irradiance, material, reflectedLight);\r
\r
return saturate(reflectedLight.indirectDiffuse + reflectedLight.directDiffuse + reflectedLight.directSpecular);\r
}\r
#endif\r
\r
/////////////////////////////////////////// Dashed Line ///////////////////////////////////////////////\r
#ifdef DASHED_LINE\r
uniform float dashedLineSize;\r
uniform float dashedLinePeriod;\r
varying float vLineDistance;\r
#endif\r
\r
/////////////////////////////////////////// Main ///////////////////////////////////////////////\r
void main() {\r
\r
#ifdef CLIP_PLANE\r
if (vViewPosition.z < clipPlaneValue) discard;\r
#endif\r
\r
#ifdef ZCLIP\r
if (vViewPosition.z < zClipValue) discard;\r
#endif\r
\r
#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r
#if NUM_DIR_LIGHTS > 0\r
// see THREE.WebGLProgram.unrollLoops\r
#pragma unroll_loop_start\r
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r
vDirLightWorldCoord[ i ] = vDirectionalShadowCoord[ i ];\r
vDirLightWorldNormal[ i ] = vDirectionalShadowNormal[ i ];\r
}\r
#pragma unroll_loop_end\r
#endif\r
#endif\r
\r
vec4 pixelPosWorld = vec4(vWorldPosition, 1.0);\r
vec4 pixelPosEye;\r
\r
#ifdef SPHERE_SPRITE\r
\r
vec3 viewNormalSprites;\r
float frontFaced = 1.0;\r
vec3 normal;\r
\r
/* quick-and-dirty method\r
normal.xy = ' + INSTANCED_SPRITE_OVERSCALE + ' * (2.0 * vUv - 1.0);\r
float r2 = dot(normal.xy, normal.xy);\r
if (r2 > 1.0) discard;\r
float normalZ = sqrt(1.0 - r2);\r
normal.z = normalZ;\r
normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\r
pixelPosEye = vec4(spritePosEye.xyz, 1.0);\r
pixelPosEye.z += spritePosEye.w * normalZ;\r
*/\r
\r
// ray-trace sphere surface\r
{\r
vec3 p;\r
if (!get_sphere_point(-vViewPosition, p, frontFaced)) discard;\r
vec4 v = vec4(instOffset.xyz + p * instOffset.w, 1.0);\r
pixelPosWorld = modelMatrix * v;\r
pixelPosEye = modelViewMatrix * v;\r
normal = normalize(normalMatrix * p);\r
#ifdef NORMALS_TO_G_BUFFER\r
viewNormalSprites = normalize(mat3(modelViewMatrix)*p);\r
#endif\r
\r
#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r
#if NUM_DIR_LIGHTS > 0\r
// see THREE.WebGLProgram.unrollLoops\r
#pragma unroll_loop_start\r
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r
vDirLightWorldCoord[ i ] = directionalShadowMatrix[ i ] * pixelPosWorld;\r
vDirLightWorldNormal[ i ] = (directionalShadowMatrix[ i ] * (modelMatrix * vec4(p, 0.0))).xyz;\r
}\r
#pragma unroll_loop_end\r
#endif\r
#endif\r
}\r
#endif\r
\r
#ifdef CYLINDER_SPRITE\r
vec3 normal;\r
vec3 viewNormalSprites;\r
float frontFaced = 1.0;\r
float cylinderY = 0.0;\r
\r
// ray-trace cylinder surface\r
{\r
vec3 p;\r
if (!get_cylinder_point(-vViewPosition, p, frontFaced)) discard;\r
\r
cylinderY = 0.5 * (p.y + 1.0);\r
\r
vec4 v = vec4(p, 1.0);\r
v = vec4(dot(v, matVec1), dot(v, matVec2), dot(v, matVec3), 1.0);\r
pixelPosWorld = modelMatrix * v;\r
pixelPosEye = modelViewMatrix * v;\r
\r
vec3 localNormal = normalize(vec3(p.x, 0.0, p.z));\r
normal = vec3(\r
dot(localNormal, matVec1.xyz),\r
dot(localNormal, matVec2.xyz),\r
dot(localNormal, matVec3.xyz));\r
#ifdef NORMALS_TO_G_BUFFER\r
viewNormalSprites = normalize(mat3(modelViewMatrix)*normal);\r
#endif\r
\r
#if defined(USE_LIGHTS) && defined(SHADOWMAP)\r
#if NUM_DIR_LIGHTS > 0\r
// see THREE.WebGLProgram.unrollLoops\r
#pragma unroll_loop_start\r
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\r
vDirLightWorldCoord[ i ] = directionalShadowMatrix[ i ] * pixelPosWorld;\r
vDirLightWorldNormal[ i ] = (directionalShadowMatrix[ i ] * (modelMatrix * vec4(normal, 0.0))).xyz;\r
}\r
#pragma unroll_loop_end\r
#endif\r
#endif\r
\r
normal = normalize(normalMatrix * normal);\r
}\r
#endif\r
\r
#ifdef ATTR_COLOR\r
vec3 vertexColor = vColor;\r
#else\r
vec3 vertexColor = vec3(1.0, 1.0, 1.0);\r
#endif\r
\r
#ifdef ATTR_COLOR2\r
#ifdef CYLINDER_SPRITE\r
float colorCoef = cylinderY; // cylinder parameter is calculated from ray-tracing\r
#else\r
float colorCoef = vUv.y; // cylinder parameter is interpolated as tex coord\r
#endif\r
// choose either color or color2\r
vertexColor = mix(vColor2, vColor, step(0.5, colorCoef));\r
#endif\r
\r
// negative red component is a special condition\r
if (vertexColor.x < 0.0) discard;\r
\r
#ifdef DASHED_LINE\r
if ( mod( vLineDistance, dashedLinePeriod ) > dashedLineSize ) discard;\r
#endif\r
\r
// transparency prepass writes only z, so we don't need to calc the color\r
#ifdef PREPASS_TRANSP\r
fragColor = vec4(1.0, 1.0, 1.0, 1.0);\r
#if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r
gl_FragDepthEXT = calcDepthForSprites(pixelPosEye, zOffset, projectionMatrix);\r
#endif\r
return;\r
#endif\r
\r
float totalOpacity = opacity;\r
\r
#ifdef ATTR_ALPHA_COLOR\r
totalOpacity *= alphaCol;\r
#endif\r
\r
// discard fully transparent pixels\r
if (totalOpacity == 0.0) discard;\r
\r
#ifdef FAKE_OPACITY\r
// discard pixels in checker pattern\r
vec2 dm_coord = floor(gl_FragCoord.xy);\r
dm_coord = fract(dm_coord * 0.5);\r
if (totalOpacity < 1.0 && (dm_coord.x < 0.5 ^^ dm_coord.y < 0.5)) discard;\r
vec4 diffuseColor = vec4(diffuse, 1.0);\r
#else\r
vec4 diffuseColor = vec4(diffuse, totalOpacity);\r
#endif\r
\r
float flipNormal;\r
#if !defined (SPHERE_SPRITE) && !defined (CYLINDER_SPRITE)\r
flipNormal = 1.0;\r
#ifdef DOUBLE_SIDED\r
flipNormal = float( gl_FrontFacing );\r
#endif\r
vec3 normal = normalize( vNormal ) * flipNormal;\r
#endif\r
\r
diffuseColor.rgb *= vertexColor;\r
\r
#if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r
gl_FragDepthEXT = calcDepthForSprites(pixelPosEye, zOffset, projectionMatrix);\r
#endif\r
\r
#ifdef NORMALS_TO_G_BUFFER\r
#if defined (SPHERE_SPRITE) || defined (CYLINDER_SPRITE)\r
vec3 viewNormaInColor = viewNormalSprites;\r
#else\r
vec3 viewNormaInColor = viewNormal;\r
float frontFaced = float( gl_FrontFacing );\r
#endif\r
// [-1, 1] -> [0, 1]\r
viewNormaInColor = 0.5 * viewNormaInColor + 0.5;\r
gl_FragData[1] = vec4(viewNormaInColor, frontFaced);\r
#endif\r
\r
#if defined(USE_LIGHTS) && NUM_DIR_LIGHTS > 0\r
vec3 viewDir;\r
#if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r
viewDir = -pixelPosEye.xyz;\r
#else\r
viewDir = vViewPosition;\r
#endif\r
GeometricContext geometry = GeometricContext(normal, normalize( viewDir ));\r
BlinnPhongMaterial material = BlinnPhongMaterial(diffuseColor.rgb, specular, shininess);\r
vec3 outgoingLight = calcLighting(geometry, material, viewDir);\r
#else\r
vec3 outgoingLight = diffuseColor.rgb;\r
#endif\r
\r
#ifdef COLOR_FROM_DEPTH\r
float depth = 0.0;\r
#if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r
gl_FragDepthEXT = calcDepthForSprites(pixelPosEye, zOffset, projectionMatrix);\r
depth = gl_FragDepthEXT;\r
#else\r
depth = gl_FragCoord.z;\r
#endif\r
fragColor = packDepthToRGBA(depth);\r
return;\r
#endif\r
\r
#ifdef COLOR_FROM_POS\r
fragColor = world2colorMatrix * pixelPosWorld;\r
#else\r
#ifdef OVERRIDE_COLOR\r
fragColor = vec4(fixedColor, diffuseColor.a);\r
#else\r
fragColor = vec4(outgoingLight, diffuseColor.a);//vec4(vNormal, 1.0);\r
#endif\r
\r
#ifdef USE_FOG\r
float viewDistance;\r
#if defined(SPHERE_SPRITE) || defined(CYLINDER_SPRITE)\r
viewDistance = abs(pixelPosEye.z);\r
#else\r
viewDistance = vViewPosition.z;\r
#endif\r
float fogFactor = smoothstep( fogNear, fogFar, viewDistance) * fogAlpha;\r
#ifdef FOG_TRANSPARENT\r
fragColor.a = fragColor.a * (1.0 - fogFactor);\r
#else\r
fragColor.rgb = mix( fragColor.rgb, fogColor, fogFactor );\r
#endif\r
#endif\r
\r
#endif\r
}\r
`,aN={precision:"mediump",init(e){this.precision=e.capabilities.getMaxPrecision("highp")}},lN=4,cN=4,v9=new Uint8Array([24,52,0,255,254,145,0,255,122,0,0,255,7,170,0,255,34,214,0,255,173,8,0,255,86,249,0,255,160,4,0,255,226,46,0,255,224,211,0,255,3,157,0,255,174,247,0,255,12,182,0,255,220,216,0,255,1,109,0,255,253,154,0,255]),y9=R.RepeatWrapping,x9=R.RepeatWrapping,S9=R.NearestFilter,b9=R.NearestFilter,M9=R.UVMapping,uN=new R.DataTexture(v9,lN,cN,R.RGBAFormat,R.UnsignedByteType,M9,y9,x9,b9,S9,1);uN.needsUpdate=!0;var Wp={noiseWidth:lN,noiseHeight:cN,noiseTexture:uN},w9=[new R.Vector2(-.541978,.840393),new R.Vector2(.125533,-.992089),new R.Vector2(.374329,.927296),new R.Vector2(-.105475,.994422)],A9=R.UniformsUtils.merge([R.UniformsLib.fog,R.UniformsLib.lights,{diffuse:{value:new R.Color(15658734)},opacity:{value:1},specular:{type:"c",value:new R.Color(1118481)},shininess:{type:"f",value:30},fixedColor:{type:"c",value:new R.Color(16777215)},zOffset:{type:"f",value:0},zClipValue:{type:"f",value:0},clipPlaneValue:{type:"f",value:0},nearPlaneValue:{type:"f",value:-.5},invModelViewMatrix:{type:"4fv",value:new R.Matrix4},world2colorMatrix:{type:"4fv",value:new R.Matrix4},dashedLineSize:{type:"f",value:.1},dashedLinePeriod:{type:"f",value:.2},projMatrixInv:{type:"4fv",value:new R.Matrix4},viewport:{type:"v2",value:new R.Vector2},lineWidth:{type:"f",value:2},fogAlpha:{type:"f",value:1},samplesKernel:{type:"v2v",value:null},noiseTex:{type:"t",value:null},noiseTexelSize:{type:"v2",value:null},srcTexelSize:{type:"v2",value:null}}]),E9=["shininess","opacity","zOffset","diffuse","specular","fixedColor","zClipCoef","zClipValue","clipPlaneValue","world2colorMatrix","dashedLineSize","dashedLinePeriod","projMatrixInv","viewport","lineWidth","fogAlpha","samplesKernel","noiseTex","noiseTexelSize","srcTexelSize"],T9={diffuse:new R.Color(16777215),specular:new R.Color(1118481),shininess:30,opacity:1,fixedColor:new R.Color(16777215),zOffset:0,zClipCoef:2,zClipValue:0,clipPlaneValue:0,world2colorMatrix:new R.Matrix4,dashedLineSize:.1,dashedLinePeriod:.3,projMatrixInv:new R.Matrix4,viewport:new R.Vector2(800,600),lineWidth:2,fogAlpha:1,samplesKernel:w9,noiseTex:Wp.noiseTexture,noiseTexelSize:new R.Vector2(1/Wp.noiseWidth,1/Wp.noiseHeight),srcTexelSize:new R.Vector2(1/800,1/600),copy(e){this.diffuse.copy(e.diffuse),this.specular.copy(e.specular),this.shininess=e.shininess,this.opacity=e.opacity,this.fixedColor.copy(e.fixedColor),this.zOffset=e.zOffset,this.zClipCoef=e.zClipCoef,this.zClipValue=e.zClipValue,this.clipPlaneValue=e.clipPlaneValue,this.world2colorMatrix.copy(e.world2colorMatrix),this.dashedLineSize=e.dashedLineSize,this.dashedLinePeriod=e.dashedLinePeriod,this.projMatrixInv=e.projMatrixInv,this.viewport=e.viewport,this.lineWidth=e.lineWidth,this.toonShading=e.toonShading,this.fogAlpha=e.fogAlpha,this.samplesKernel=e.samplesKernel,this.noiseTex=e.noiseTex,this.noiseTexelSize=e.noiseTexelSize,this.srcTexelSize=e.srcTexelSize}},hN=class mM extends R.RawShaderMaterial{constructor(t){super(t),this.fog=!0,this.instancedPos=!1,this.instancedMatrix=!1,this.attrColor=!1,this.attrColor2=!1,this.attrAlphaColor=!1,this.overrideColor=!1,this.sphereSprite=!1,this.cylinderSprite=!1,this.zClip=!1,this.clipPlane=!1,this.fakeOpacity=!1,this.prepassTransparancy=!1,this.colorFromPos=!1,this.shadowmap=!1,this.shadowmapType="random",this.colorFromDepth=!1,this.orthoCam=!1,this.dashedLine=!1,this.transparent=!0,this.thickLine=!1,this.fogTransparent=!1,this.normalsToGBuffer=!1,this.toonShading=!1,this.uberOptions=Object.create(mM.prototype.uberOptions),super.setValues({uniforms:R.UniformsUtils.clone(A9),vertexShader:this.precisionString()+g9,fragmentShader:this.precisionString()+_9,lights:!0,fog:!0,side:R.DoubleSide}),this.setValues(t)}precisionString(){const{precision:t}=aN;return`precision ${t} float;
precision ${t} int;
`}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=R.UniformsUtils.clone(t.uniforms),this.defines={...t.defines},this.extensions=t.extensions,this.fog=t.fog,this.instancedPos=t.instancedPos,this.instancedMatrix=t.instancedMatrix,this.attrColor=t.attrColor,this.attrColor2=t.attrColor2,this.attrAlphaColor=t.attrAlphaColor,this.overrideColor=t.overrideColor,this.sphereSprite=t.sphereSprite,this.cylinderSprite=t.cylinderSprite,this.zClip=t.zClip,this.clipPlane=t.clipPlane,this.fakeOpacity=t.fakeOpacity,this.colorFromPos=t.colorFromPos,this.shadowmap=t.shadowmap,this.shadowmapType=t.shadowmapType,this.colorFromDepth=t.colorFromDepth,this.orthoCam=t.orthoCam,this.prepassTransparancy=t.prepassTransparancy,this.dashedLine=t.dashedLine,this.thickLine=t.thickLine,this.fogTransparent=t.fogTransparent,this.normalsToGBuffer=t.normalsToGBuffer,this.toonShading=t.toonShading,this.uberOptions.copy(t.uberOptions),this}createInstance(){const t=new mM;return t.copy(this),t.uberOptions=Object.create(this.uberOptions),t}setValues(t){if(typeof t>"u")return;super.setValues(t);const n={},i={};this.fog&&(n.USE_FOG=1),this.instancedPos&&(n.INSTANCED_POS=1),this.instancedMatrix&&(n.INSTANCED_MATRIX=1),this.attrColor&&(n.ATTR_COLOR=1),this.attrColor2&&(n.ATTR_COLOR2=1),this.attrAlphaColor&&(n.ATTR_ALPHA_COLOR=1),this.overrideColor&&(n.OVERRIDE_COLOR=1),this.sphereSprite&&(n.SPHERE_SPRITE=1,i.fragDepth=!0),this.cylinderSprite&&(n.CYLINDER_SPRITE=1,i.fragDepth=!0),this.zClip&&(n.ZCLIP=1),this.clipPlane&&(n.CLIP_PLANE=1),this.fakeOpacity&&(n.FAKE_OPACITY=1),this.lights&&(n.USE_LIGHTS=1),this.colorFromPos&&(n.COLOR_FROM_POS=1),this.shadowmap&&(n.SHADOWMAP=1,this.shadowmapType==="pcf"?n.SHADOWMAP_PCF_SHARP=1:this.shadowmapType==="random"?n.SHADOWMAP_PCF_RAND=1:n.SHADOWMAP_BASIC=1),this.colorFromDepth&&(n.COLOR_FROM_DEPTH=1),this.orthoCam&&(n.ORTHOGRAPHIC_CAMERA=1),this.prepassTransparancy&&(n.PREPASS_TRANSP=1),this.dashedLine&&(n.DASHED_LINE=1),this.thickLine&&(n.THICK_LINE=1),this.fogTransparent&&(n.FOG_TRANSPARENT=1),this.normalsToGBuffer&&(i.drawBuffers=!0,n.NORMALS_TO_G_BUFFER=1),this.toonShading&&(n.TOON_SHADING=1),this.defines=n,this.extensions=i}setUberOptions(t){if(!(typeof t>"u"))for(const n in t)t.hasOwnProperty(n)&&(this.uberOptions[n]instanceof R.Color?this.uberOptions[n]=t[n].clone():this.uberOptions[n]=t[n])}clone(t){return t?this.createInstance():super.clone()}updateUniforms(){const t=this;E9.forEach(n=>{t.uniforms.hasOwnProperty(n)&&(t.uberOptions[n]instanceof R.Color||t.uberOptions[n]instanceof R.Matrix4?t.uniforms[n].value=t.uberOptions[n].clone():t.uniforms[n].value=t.uberOptions[n])})}};hN.prototype.uberOptions=T9;var Ja=hN;function gf(e){class t extends e{constructor(){super(...arguments),this.onBeforeRender=t.prototype.onBeforeRender}onBeforeRender(i,r,s,a,c,u){this._onBeforeRender(i,r,s,a,c,u),this._update()}_onBeforeRender(){}_update(){const{material:i}=this;i&&i instanceof Ja&&i.updateUniforms()}}return t}var AC=gf(R.Mesh),C9=class extends AC{constructor(){super(...arguments),this.castShadow=!0,this.receiveShadow=!0}_onBeforeRender(e,t,n,i,r,s){AC.prototype._onBeforeRender.call(this,e,t,n);const{material:a}=this;a&&a.uniforms.invModelViewMatrix&&(this.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,this.matrixWorld),a.uniforms.invModelViewMatrix.value.copy(this.modelViewMatrix).invert(),a.uniforms.nearPlaneValue.value=n.near,a.uniformsNeedUpdate=!0)}},fN=C9,EC=gf(R.Mesh),R9=class ox extends EC{constructor(t,n){super(t,n),this.castShadow=!0,this.receiveShadow=!0}static _mvLength=new R.Vector3;static _center=new R.Vector3;static _modelView=new R.Matrix4;_onBeforeRender(t,n,i){EC.prototype._onBeforeRender.call(this,t,n,i);const r=this.geometry,{material:s}=this;if(!r.zClip||!s.uberOptions)return;const a=.5,c=ox._modelView,u=ox._mvLength,d=ox._center;c.multiplyMatrices(this.matrixWorld,i.matrixWorldInverse);const p=u.setFromMatrixColumn(c,0).length();d.copy(r.boundingSphere.center),this.localToWorld(d),s.uberOptions.zClipValue=i.position.z-d.z-p*(a*r.boundingSphere.radius)}},L9=R9,P9=class extends R.Group{constructor(e,t){super(),this.geometry=e;const n=this;n.initialized=!1,this.geometry.addEventListener("update",()=>{n.update()})}init(){const{children:e}=this;for(let i=e.length-1;i>=0;--i)this.remove(e[i]);const{items:t,userData:n}=this.geometry;for(let i=0,r=t.length;i<r;++i){const s=t[i];if(!s)continue;const a=new rA(rt.shallowCloneNode(s));a.userData=We.default.clone(n);const c=a.getElement();c.style.visibility="visible",a.source=s,this.add(a)}this.initialized=!0}update(){if(!this.geometry.needsUpdate)return;const{children:e}=this;this.initialized||this.init();for(let t=0,n=e.length;t<n;++t){const i=e[t],r=i.source;i.position.copy(r.worldPos),i.userData.color=r.opts.color,i.userData.background=r.opts.background}}},N9=P9,I9=gf(R.Mesh),O9=class extends I9{constructor(e,t){super(e,t),this.castShadow=!0,this.receiveShadow=!0}},D9=O9,z9=gf(R.Mesh),T2=new R.Vector2,U9=class extends z9{_onBeforeRender(e,t,n,i,r,s){const{material:a}=this;a.uberOptions&&(a.uberOptions.projMatrixInv.copy(n.projectionMatrix).invert(),e.getSize(T2),a.uberOptions.viewport.set(T2.width,T2.height))}},dN=U9,B9=gf(R.Mesh),V9=class extends B9{constructor(){super(...arguments),this.castShadow=!0,this.receiveShadow=!0}},F9=V9,So={ZClipped:L9,ZSprite:fN,Text:N9,Line:gf(R.Line),LineSegments:gf(R.LineSegments),Mesh:D9,ThickLineMesh:dN,Instanced:F9};function A0(e,t){return function(n){n.setValues(e),n.setUberOptions(t)}}function TC(e,t){function n(i,r){return new Ga.Instanced2CCylindersGeometry(i,r,e,t)}return{Geometry:n,Object:e?So.ZSprite:So.Instanced,initMaterial:A0({instancedMatrix:!0,attrColor:!0,attrColor2:!0,attrAlphaColor:!0,cylinderSprite:e})}}function C2(e,t){const n=e.prototype instanceof QP,i=t.lineWidth||0;return{Geometry:e,Object:n?So.ThickLineMesh:So.LineSegments,initMaterial:A0({lights:!1,attrColor:!0,attrAlphaColor:!0,thickLine:n},{lineWidth:i})}}function k9(e){return{Geometry:e,Object:So.Mesh,initMaterial:A0({attrColor:!0,attrAlphaColor:!0})}}function R2(e,t,n,i){const r={wireframe:!!i.wireframe,fakeOpacity:n.now.isoSurfaceFakeOpacity,zClip:i.zClip};return{Geometry:e,Object:So.ZClipped,initMaterial:A0({attrColor:!0,attrAlphaColor:!1,wireframe:r.wireframe,fakeOpacity:r.fakeOpacity,zClip:r.zClip})}}var G9=class{static createSpheres(e,t){const n=t.now.zSprites;function i(r,s){return new Ga.InstancedSpheresGeometry(r,s,n)}return{Geometry:i,Object:n?So.ZSprite:So.Instanced,initMaterial:A0({instancedPos:!0,attrColor:!0,attrAlphaColor:!0,sphereSprite:n})}}static create2CClosedCylinders(e,t){return TC(!1,!1)}static create2CCylinders(e,t){return TC(t.now.zSprites,!0)}static create2CLines(e,t,n){return C2(Ga.TwoColorLinesGeometry,n)}static createCrosses(e,t,n){return C2(Ga.CrossGeometry,n)}static createExtrudedChains(e,t){return k9(Ga.ExtrudedObjectsGeometry)}static createChunkedLines(e,t,n){return C2(Ga.ChunkedLinesGeometry,n)}static createQuickSurface(e,t,n){return R2(Ga.QuickSurfGeometry,e,t,n)}static createContactSurface(e,t,n){return R2(Ga.ContactSurfaceGeometry,e,t,n)}static createSASSES(e,t,n){return R2(Ga.SSIsosurfaceGeometry,e,t,n)}static createLabels(e,t){return{Geometry:Ga.LabelsGeometry,Object:So.Text,initMaterial(){}}}},xs=G9,H9=class gM extends R.Object3D{static _inverseMatrix=new R.Matrix4;static _ray=new R.Ray;constructor(t,n,i,r){super(),this._geometry=t,this._geoParams=n;const s=i.createInstance();n.initMaterial(s),this._material=s,this._transforms=r.length>0?r:[new R.Matrix4];const a=this._createMeshes(t);for(let c=0,u=a.length;c<u;++c)this.add(a[c])}raycast(t,n){const i=gM._ray,r=gM._inverseMatrix,{children:s}=this;i.copy(t.ray);for(let a=0,c=s.length;a<c;++a){const u=s[a];if(!Xt.belongToSelectLayers(u))continue;u.updateMatrixWorld();const d=u.matrixWorld;r.copy(d).invert(),t.ray.copy(i).applyMatrix4(r);const p=[];this._geometry.raycast(t,p);for(let g=0,v=p.length;g<v;++g){const y=p[g];y.point&&(y.point.applyMatrix4(d),y.distance=i.origin.distanceTo(y.point)),y.object=u,n[n.length]=y}}t.ray.copy(i)}getSubset(t){const n=this._geometry.getSubset(t),i=[];let r=0;for(let s=0,a=n.length;s<a;++s){const c=this._createMeshes(n[s]);for(let u=0,d=c.length;u<d;++u)i[r++]=c[u]}return i}_createMeshes(t){const n=this._transforms,i=this._geoParams.Object,r=this._material,s=[];for(let a=0,c=n.length;a<c;++a){const u=new i(t,r);u.applyMatrix4(n[a]),s[a]=u}return s}},W9=H9;function X9(e,t){const n=[e].concat(t);return e.bind(...n)}var j9=class pN extends wf{constructor(t,n,i,r,s,a,c){if(super(),this.constructor===pN)throw new Error("Can not instantiate abstract class!");this._selection=n,this._mode=r,this._colorer=i,this._chunksIdc=n.chunks,this._polyComplexity=a,this._geo=new(X9(t.Geometry,this._makeGeoArgs())),this._mesh=new W9(this._geo,t,c,s),this.add(this._mesh),this._build()}_makeGeoArgs(){throw new Error("ChemGroup subclass must override _makeGeoArgs() method")}getSubset(t,n){n=n!==void 0?n:!1;const i=this._calcChunksList(t,n);return i.length===0?[]:this._mesh.getSubset(i)}_changeSubsetOpacity(t,n,i){const r=this._calcChunksList(t,i);r.length!==0&&this._geo.setOpacity(r,n)}enableSubset(t,n){n=n!==void 0?n:!0,this._changeSubsetOpacity(t,1,n)}disableSubset(t,n){n=n!==void 0?n:!0,this._changeSubsetOpacity(t,0,n)}},tS=j9,Y9=class extends tS{raycast(e,t){const{atoms:n}=this._selection,i=[];this._mesh.raycast(e,i);const r=this._chunksIdc;for(let s=0,a=i.length;s<a;++s){if(!i[s].hasOwnProperty("chunkIdx"))continue;const c=r[i[s].chunkIdx];c<n.length&&(i[s].atom=n[c],t.push(i[s]))}}_calcChunksList(e){const t=[],{atoms:n}=this._selection,i=this._chunksIdc;for(let r=0,s=i.length;r<s;++r)(n[i[r]].mask&e)!==0&&t.push(r);return t}},aA=Y9,q9=class extends aA{_makeGeoArgs(){return[this._selection.chunks.length,this._polyComplexity]}_build(){const e=this._selection.chunks,{atoms:t,parent:n}=this._selection,i=this._mode,r=this._colorer,s=this._geo;for(let a=0,c=e.length;a<c;++a){const u=t[e[a]];s.setItem(a,u.position,i.calcAtomRadius(u)),s.setColor(a,r.getAtomColor(u,n))}s.finalize()}updateToFrame(e){const t=this._selection.chunks,{atoms:n}=this._selection,i=this._mode,r=this._colorer,s=e.needsColorUpdate(r),a=this._geo;for(let c=0,u=t.length;c<u;++c){const d=n[t[c]];a.setItem(c,e.getAtomPos(t[c]),i.calcAtomRadius(d)),s&&a.setColor(c,e.getAtomColor(r,d))}a.finalize()}},lA=q9,$9=class extends lA{_makeGeoArgs(){const e=[],{atoms:t,chunks:n}=this._selection,i=n.length;for(let s=0;s<i;++s)e[s]=t[n[s]];const r=this._mode.getSurfaceOpts();return r.atoms=e,[i,r]}},Z9=$9,K9=class extends lA{_makeGeoArgs(){const e=[],{atoms:t,chunks:n}=this._selection,i=n.length;for(let s=0;s<i;++s)e[s]=t[n[s]];const r=this._mode.getSurfaceOpts();return r.atoms=e,r.selection=this._selection,r.colorMode=this._colorer,[i,r]}},Q9=K9;function J9(e){let t=e>>16&255,n=e>>8&255,i=e&255;return .2126*t+.7152*n+.0722*i>127?(t=t*3/10,n=n*3/10,i=i*3/10):(t=255-(255-t)*3/10,n=255-(255-n)*3/10,i=255-(255-i)*3/10),t<<16|n<<8|i}function ek(e){const t=e>>16&255,n=e>>8&255,i=e&255;return 255-t<<16|255-n<<8|255-i}function CC(e){return e.name.getNode()!==null?e.name.getNode():e.getVisualName()}var RC={none(e){return e},adjust:J9,inverse:ek};function Yy(e,t){let n;if(RC.hasOwnProperty(t))n=rt.hexColor(RC[t](e));else{const i=parseInt(t,16);!Number.isNaN(i)&&t.toLowerCase().startsWith("0x")?n=rt.hexColor(i):n="#000000"}return n}var LC={serial(e){return e.serial},name(e){return e.getVisualName()},elem(e){return e.element.name},residue(e){return e.residue.getType().getName()},sequence(e){return e.residue.getSequence()},chain(e){return e.residue.getChain().getName()},hetatm(e){return e.isHet()},water(e){return e.residue.getType().getName()==="HOH"||e.residue.getType().getName()==="WAT"}},PC=function(e,t){return t.replace(/\{\{(\s*\w+\s*)\}\}/g,n=>{let i=n.replace(/\s+/g,"");return i=i.substring(2,i.length-2).toLowerCase(),LC.hasOwnProperty(i)?LC[i](e):"null"})},tk=class extends aA{_makeGeoArgs(){const e=this._mode.getLabelOpts();return[this._selection.chunks.length,e]}_build(){const e=this._mode.getLabelOpts(),t=this._selection.chunks,{atoms:n,parent:i}=this._selection,r=this._colorer,s=this._geo;for(let a=0,c=t.length;a<c;++a){const u=n[t[a]],d=e.template?PC(u,e.template):CC(u);if(!d)continue;const p=r.getAtomColor(u,i),g=parseInt(Yy(p,e.fg).substring(1),16),v=e.showBg?parseInt(Yy(p,e.bg).substring(1),16):"transparent";s.setItem(a,u.position,d),s.setColor(a,g,v)}s.finalize()}updateToFrame(e){const t=this._mode.getLabelOpts(),n=this._selection.chunks,{atoms:i}=this._selection,r=this._colorer,s=this._geo,a=e.needsColorUpdate(r);for(let c=0,u=n.length;c<u;++c){const d=i[n[c]],p=t.template?PC(d,t.template):CC(d);if(!p)continue;const g=e.getAtomColor(r,d),v=parseInt(Yy(g,t.fg).substring(1),16),y=t.showBg?parseInt(Yy(g,t.bg).substring(1),16):"transparent";s.setItem(c,e.getAtomPos(n[c]),p),a&&s.setColor(c,v,y)}s.finalize()}},nk=tk;function NC(e,t,n,i){const r=Math.sin(e);return t.clone().multiplyScalar(Math.sin((1-i)*e)/r).addScaledVector(n,Math.sin(i*e)/r)}var ik=class extends aA{_buildInner(e,t){const n=this._selection.chunks,i=new R.Vector3,r=new R.Vector3,s=this._segmentsHeight,a=1/s,c=this._colorer,{cycles:u,parent:d}=this._selection;let p=0,g=n[p];for(let v=0,y=u.length;v<y;++v){const S=u[v],E=S.atoms,w=[],b=[],{center:T}=S,L=S.radius-e,C=E.length;let P=0;const O=E[C-1].position;let B=E[P].position;i.subVectors(O,T),r.subVectors(B,T);const U=r.clone().cross(i).normalize();for(;P<C;++P)b[P]=NC(i.angleTo(r),i,r,.5).normalize(),B=E[(P+1)%C].position,i.copy(r),r.subVectors(B,T);for(P=0;P<C;++P){if(E[P].index!==g)continue;const I=b[P],z=b[(P+1)%C],te=c.getAtomColor(E[P],d),oe=I.angleTo(z);for(let ee=0;ee<=s;++ee)w[ee]=NC(oe,I,z,ee*a).multiplyScalar(L).add(T);t(p++,te,w,T,U),g=n[p]}}}},mN=ik;function rk(e,t){const n=[];for(let i=0;i<t;++i){const r=-2*i/t*Math.PI;n.push(new R.Vector3(Math.cos(r)*e,Math.sin(r)*e,0))}return n}var{calcChunkMatrix:sk}=Xt,ok=class extends mN{_build(){const e=this._segmentsHeight,t=this._mode.getAromRadius(),n=new R.Vector2(t,t),i=this._mode.calcStickRadius()+2*t,r=new R.Vector3,s=[],a=this._geo;this._buildInner(i,(c,u,d,p,g)=>{for(let v=0;v<=e;++v){const y=d[v],S=y.clone().sub(p).cross(g);r.addVectors(y,S),s[v]=sk(y,r,g,n)}a.setItem(c,s),a.setColor(c,u)}),a.finalize()}_makeGeoArgs(){return this._segmentsHeight=this._polyComplexity,[rk(1,this._polyComplexity),this._segmentsHeight+1,this._selection.chunks.length]}},ak=ok,lk=class extends mN{_build(){const e=this._geo,t=this._mode.getAromaticOffset();this._buildInner(t,(n,i,r)=>{let s=r[0];for(let a=1;a<=this._segmentsHeight;++a){const c=r[a];e.setSegment(n,a-1,s,c),s=c}e.setColor(n,i)}),e.finalize()}_makeGeoArgs(){return this._segmentsHeight=this._mode.getAromaticArcChunks(),[this._selection.chunks.length,this._segmentsHeight,!0]}},ck=lk,uk=class extends tS{raycast(e,t){const{residues:n}=this._selection,i=[];this._mesh.raycast(e,i);const r=this._chunksIdc;for(let s=0,a=i.length;s<a;++s){if(!i[s].hasOwnProperty("chunkIdx"))continue;const c=r[i[s].chunkIdx];c<n.length&&(i[s].residue=n[c],t.push(i[s]))}}_calcChunksList(e){const t=[],{residues:n}=this._selection,i=this._chunksIdc;for(let r=0,s=i.length;r<s;++r)(n[i[r]]._mask&e)!==0&&t.push(r);return t}},gN=uk,hk=class extends gN{raycast(e,t){const{residues:n}=this._selection,i=[];this._mesh.raycast(e,i);const r=this._chunksIdc;for(let s=0,a=i.length;s<a;++s){if(!i[s].hasOwnProperty("chunkIdx"))continue;const c=r[Math.floor(i[s].chunkIdx/2)];c<n.length&&(i[s].residue=n[c],t.push(i[s]))}}_build(){const{residues:e,parent:t}=this._selection,n=this._colorer,i=this._geo,r=this._mode.calcStickRadius();let s=0;const a=this._selection.chunks;for(let c=0,u=a.length;c<u;++c){const d=e[a[c]],p=n.getResidueColor(d,t);this._processItem(s++,d._cylinders[0],d._cylinders[1],r,p)}i.finalize()}_calcChunksList(e){const t=[];let n=0;const{residues:i}=this._selection,r=this._chunksIdc;for(let s=0,a=r.length;s<a;++s)(i[r[s]]._mask&e)!==0&&(t[n++]=2*s,t[n++]=2*s+1);return t}updateToFrame(e){const t=e.getResidues(),{parent:n}=this._selection,i=this._colorer,r=this._geo,s=this._mode.calcStickRadius();let a=0;const c=this._selection.chunks;for(let u=0,d=c.length;u<d;++u){const p=t[c[u]],g=i.getResidueColor(p,n);this._processItem(a++,p._cylinders[0],p._cylinders[1],s,g)}r.finishUpdate()}},_N=hk,fk=class extends _N{_makeGeoArgs(){return[this._selection.chunks.length,this._polyComplexity]}_processItem(e,t,n,i,r){const s=this._geo;s.setItem(e,t,n,i),s.setColor(e,r,r)}},dk=fk,pk=class extends _N{_makeGeoArgs(){return[this._selection.chunks.length*2,this._polyComplexity]}_processItem(e,t,n,i,r){const s=this._geo;let a=e*2;s.setItem(a,t,i),s.setColor(a,r),a++,s.setItem(a,n,i),s.setColor(a,r)}},mk=pk,L2=Ts(690),{ResidueType:gk}=nr,_k=Xt.calcChunkMatrix;function IC(e,t){const n=(0,L2.Smooth)(e,{method:L2.Smooth.METHOD_CUBIC,clip:L2.Smooth.CLIP_CLAMP,cubicTension:t,scaleTo:1});return function(i,r){let s=r;s===null&&(s=function(c){return(c*(e.length-1-2)+1)/(e.length-1)});const a=n(s(i));return new R.Vector3(a[0],a[1],a[2])}}function R1(e,t,n,i){if(!i._isValid){e[n]=e[n-1],t[n]=t[n-1];return}const r=i._controlPoint;e[n]=[r.x,r.y,r.z];const s=r.clone().add(i._wingVector);t[n]=[s.x,s.y,s.z]}function vk(e,t,n,i){const r=(i._type.flags&gk.Flags.NUCLEIC)!==0,s=r?"C5'":"N",a=r?"C3'":"C";let c,u;if(i.forEachAtom(d=>{const p=d.getVisualName();!c&&p===s?c=d.position:!u&&p===a&&(u=d.position)}),c&&u||(c=i._firstAtom.position,u=i._lastAtom.position),c&&u){const d=u.clone().sub(c),p=i._wingVector,g=i._controlPoint,v=g.clone().add(p),y=g.clone().sub(d),S=y.clone().add(p);e[n]=[y.x,y.y,y.z],t[n]=[S.x,S.y,S.z],++n,e[n]=[y.x,y.y,y.z],t[n]=[S.x,S.y,S.z],++n,e[n]=[g.x,g.y,g.z],t[n]=[v.x,v.y,v.z],++n;const E=g.clone().add(d),w=E.clone().add(p);e[n]=[E.x,E.y,E.z],t[n]=[w.x,w.y,w.z],++n,e[n]=[E.x,E.y,E.z],t[n]=[w.x,w.y,w.z]}}function yk(e,t,n,i){const r=i.start,s=i.end;function a(S){return S>r&&e[S-1]._isValid?S-1:S}function c(S){return S<s&&e[S+1]._isValid?S+1:S}const u=[],d=[];let p=0;function g(S,E){const w=e[S]._controlPoint.clone().lerp(e[E]._controlPoint,-.25),b=w.clone().add(e[S]._wingVector);d[p]=[w.x,w.y,w.z],u[p++]=[b.x,b.y,b.z],d[p]=[w.x,w.y,w.z],u[p++]=[b.x,b.y,b.z]}const v=a(t),y=c(n);if(v===y)return vk(d,u,p,e[t]),{centerPoints:d,topPoints:u};t===v?g(t,c(t)):(R1(d,u,p++,e[a(v)]),R1(d,u,p++,e[v]));for(let S=t;S<=n;++S)R1(d,u,p++,e[S]);return y===c(y)?g(n,a(n)):(R1(d,u,p++,e[y]),R1(d,u,p,e[c(y)])),{centerPoints:d,topPoints:u}}var xk=class{constructor(e,t,n,i,r,s){const a=yk(e,t,n,s);this._topInterp=IC(a.topPoints,r),this._centerInterp=IC(a.centerPoints,r),this._shift=.5/(n-t+2),this._valueStep=(1-2*this._shift)/(2*(n-t+1)*(i-1)),this._segmentsCount=i}prepareMatrices(e,t,n){const i=this._segmentsCount,r=new Array(i),s=new R.Vector2(0,0),a=this._topInterp,c=this._centerInterp;let u=this._shift+this._valueStep*(i-1)*e;for(let d=0;d<i;++d){const p=Math.min(1,d/(i-1));s.lerpVectors(t,n,p);const g=a(u,null),v=c(u,null);u+=this._valueStep;const y=c(u,null);r[d]=_k(v.clone(),y.clone(),g.clone().sub(v),s)}return r}},Sk=xk;function bk(e,t){const n=[];for(let i=0;i<t;++i){const r=Math.PI/2-2*Math.PI*i/t;n.push(new R.Vector3(Math.cos(r)*e,Math.sin(r)*e,0))}return n}function OC(e,t,n,i,r,s){for(let a=0,c=e.length;a<c;++a){const u=e[a].arr,{boundaries:d}=e[a];for(let p=0,g=u.length;p<g;++p){const v=[u[p].start,u[p].end],y=new Sk(t,v[0],v[1],n,i,d);let S=null;const E=u[p].start*2,w=u[p].end*2+1;let b=r.getResidueRadius(t[0],0);for(let T=E;T<=w;++T){const L=t[T/2|0],C=r.getResidueRadius(L,T%2),P=r.getResidueRadius(L,1+T%2),O=y.prepareMatrices(T-v[0]*2,C,P);O.unshift(S===null?O[0]:S),s(L,O,C.x!==P.x||C.y!==P.y,C.x!==b.x||C.y!==b.y),S=O[n],b=P}}}}var Mk=class extends gN{_makeGeoArgs(){const e=this._mode.getHeightSegmentsRatio();return this._segmentsHeight=this._polyComplexity*e|0,[bk(1,this._polyComplexity),this._segmentsHeight+1,this._selection.chunks.length*2]}_build(){const{residues:e,parent:t}=this._selection,n=this._mode,i=this._colorer,r=n.getTension(),s=this._geo;let a=0;const c=[];OC(this._selection.subdivs,e,this._segmentsHeight,r,n,function(u,d){let p=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const v=i.getResidueColor(u,t);c[a]=u._index,s.setItem(a,d,p,g),s.setColor(a++,v)}),this._chunksIdc=c,s.finalize()}updateToFrame(e){const{parent:t}=this._selection,n=this._mode,i=this._colorer,r=n.getTension(),s=this._geo,a=e.getResidues();let c=0;const u=e.needsColorUpdate(i);OC(this._selection.subdivs,a,this._segmentsHeight,r,n,(d,p)=>{s.setItem(c,p),u&&s.setColor(c,i.getResidueColor(d,t)),c++}),s.finalize()}},wk=Mk,Ak=class extends tS{_makeGeoArgs(){const e=this._selection.subdivs;let t=0;for(let n=0,i=e.length;n<i;++n){const r=e[n].arr;for(let s=0,a=r.length;s<a;++s)t+=r[s].end-r[s].start}return[t,this._polyComplexity]}_build(){const{residues:e,parent:t}=this._selection,n=this._mode,i=this._colorer,r=this._geo;let s=0;const a=[],c=this._selection.subdivs,u=n.calcStickRadius();for(let d=0,p=c.length;d<p;++d){const g=c[d].arr;for(let v=0,y=g.length;v<y;++v){const S=g[v].start,E=g[v].end;let w=e[S];for(let b=S+1;b<=E;++b){const T=e[b];a[s]={first:w._index,second:T._index},r.setItem(s,w._controlPoint,T._controlPoint,u),r.setColor(s,i.getResidueColor(w,t),i.getResidueColor(T,t)),s++,w=T}}}this._chunksIdc=a,r.finalize()}updateToFrame(e){const t=e.getResidues(),{parent:n}=this._selection,i=this._mode,r=this._colorer,s=this._geo;let a=0;const c=this._selection.subdivs,u=i.calcStickRadius(),d=e.needsColorUpdate(r);for(let p=0,g=c.length;p<g;++p){const v=c[p].arr;for(let y=0,S=v.length;y<S;++y){const E=v[y].start,w=v[y].end;let b=t[E];for(let T=E+1;T<=w;++T){const L=t[T];s.setItem(a,b._controlPoint,L._controlPoint,u),d&&s.setColor(a,r.getResidueColor(b,n),r.getResidueColor(L,n)),a++,b=L}}}s.finalize()}raycast(e,t){const n=[],{residues:i}=this._selection;this._mesh.raycast(e,n);const r=this._chunksIdc;for(let s=0,a=n.length;s<a;++s){if(!n[s].hasOwnProperty("chunkIdx"))continue;const{chunkIdx:c}=n[s],u=r[Math.floor(c/2)],d=c%2===0?u.first:u.second;d<i.length&&(n[s].residue=i[d],t.push(n[s]))}}_calcChunksList(e){const t=[],n=this._chunksIdc,{residues:i}=this._selection;for(let r=0,s=n.length;r<s;++r){const a=n[r];i[a.first]._mask&e&&t.push(r*2),i[a.second]._mask&e&&t.push(r*2+1)}return t}},Ek=Ak;function Tk(e){return e<2?1:e}var Ck=class extends tS{_makeGeoArgs(){const e=this._mode.drawMultiorderBonds(),t=this._mode.showAromaticLoops(),n=this._selection.chunks,{bonds:i}=this._selection;let r=0;for(let s=0,a=n.length;s<a;++s)r+=this.getBondOrder(i[n[s]],e,t);return[r,this._polyComplexity]}getBondOrder(e,t,n){let i=1;return t&&(!n||e._type!==M0.BondType.AROMATIC)&&(i=Tk(e._order)),i}raycast(e,t){const{bonds:n}=this._selection,i=[];this._mesh.raycast(e,i);const r=this._chunksIdc;for(let s=0,a=i.length;s<a;++s){if(!i[s].hasOwnProperty("chunkIdx"))continue;const{chunkIdx:c}=i[s],u=r[Math.floor(c/2)];if(u<n.length){const d=n[u];i[s].atom=c%2===0?d._left:d._right,t.push(i[s])}}}_calcChunksList(e,t){const n=[],{bonds:i}=this._selection,r=this._chunksIdc;for(let s=0,a=r.length;s<a;++s){const c=i[r[s]];c._left.mask&e&&(!t||c._right.mask&e)&&n.push(2*s),c._right.mask&e&&(!t||c._left.mask&e)&&n.push(2*s+1)}return n}},vN=Ck,Rk=class extends vN{_build(){const e=this._selection.chunks,{bonds:t,parent:n}=this._selection,i=this._mode,r=this._colorer,s=this._geo,a=i.drawMultiorderBonds(),c=i.showAromaticLoops(),u=i.calcStickRadius(),d=i.calcSpaceFraction();let p;const g=new R.Vector3,v=new R.Vector3;let y=0;const S=[];for(let E=0,w=e.length;E<w;++E){const b=t[e[E]],T=b._left,L=b._right,C=T.position,P=L.position;p=b.calcNormalDir();const O=this.getBondOrder(b,a,c),B=2*Math.min(i.calcAtomRadius(T),i.calcAtomRadius(L))/O,U=a?Math.min(u,B*.5*(1-d)):u;for(let I=0;I<O;++I){const z=B*(O%2===0?((I/2|0)+.5)*(1-2*(I%2)):((I+1)/2|0)*(-1+2*(I%2)));S[y]=b._index,g.copy(C),g.addScaledVector(p,z),v.copy(P),v.addScaledVector(p,z),s.setItem(y,g,v,U),s.setColor(y++,r.getAtomColor(T,n),r.getAtomColor(L,n))}}s.finalize(),this._chunksIdc=S}updateToFrame(e){const t=this._selection.chunks,{bonds:n}=this._selection,i=this._mode,r=this._colorer,s=this._geo,a=i.drawMultiorderBonds(),c=i.showAromaticLoops(),u=i.calcStickRadius(),d=i.calcSpaceFraction();let p;const g=new R.Vector3,v=new R.Vector3;let y=0;const S=e.needsColorUpdate(r);for(let E=0,w=t.length;E<w;++E){const b=n[t[E]],T=b._left,L=b._right,C=e.getAtomPos(T.index).clone(),P=e.getAtomPos(L.index);p=b.calcNormalDir();const O=this.getBondOrder(b,a,c),B=2*Math.min(i.calcAtomRadius(T),i.calcAtomRadius(L))/O,U=a?Math.min(u,B*.5*(1-d)):u;for(let I=0;I<O;++I){const z=B*(O%2===0?((I/2|0)+.5)*(1-2*(I%2)):((I+1)/2|0)*(-1+2*(I%2)));g.copy(C),g.addScaledVector(p,z),v.copy(P),v.addScaledVector(p,z),s.setItem(y,g,v,U),S&&s.setColor(y,e.getAtomColor(r,T),e.getAtomColor(r,L)),y++}}s.finalize()}},Lk=Rk,Tp=.15,Pk=class extends vN{_build(){const e=this._selection.chunks,{bonds:t,parent:n}=this._selection,i=this._mode,r=this._colorer,s=this._geo,a=i.drawMultiorderBonds(),c=i.showAromaticLoops(),u=new R.Vector3,d=new R.Vector3,p=new R.Vector3;let g=0;const v=[];for(let y=0,S=e.length;y<S;++y){const E=t[e[y]],w=E._left,b=E._right,T=w.position,L=b.position,C=w.bonds.length===1,P=b.bonds.length===1;u.subVectors(L,T);const O=u.length(),B=E.calcNormalDir(),U=this.getBondOrder(E,a,c);for(let I=0;I<U;++I){d.copy(T),p.copy(L);let z=U%2===0?((I/2|0)+.5)*(1-2*(I%2)):((I+1)/2|0)*(-1+2*(I%2));v[g]=E._index,U===2&&!C&&!P&&(z-=.5,z*=-1),!C&&!P&&U>1&&z!==0&&(d.lerpVectors(T,L,Tp/O),p.lerpVectors(T,L,1-Tp/O)),z*=Tp,d.addScaledVector(B,z),p.addScaledVector(B,z),s.setItem(g,d,p),s.setColor(g++,r.getAtomColor(w,n),r.getAtomColor(b,n))}}s.finalize(),this._chunksIdc=v}updateToFrame(e){const t=this._selection.chunks,{bonds:n}=this._selection,i=this._mode,r=this._colorer,s=this._geo,a=i.drawMultiorderBonds(),c=i.showAromaticLoops(),u=new R.Vector3,d=new R.Vector3,p=new R.Vector3;let g=0;const v=e.needsColorUpdate(r);for(let y=0,S=t.length;y<S;++y){const E=n[t[y]],w=E._left,b=E._right,T=e.getAtomPos(w.index).clone(),L=e.getAtomPos(b.index),C=w.bonds.length===1,P=b.bonds.length===1;u.subVectors(L,T);const O=u.length(),B=E.calcNormalDir(),U=this.getBondOrder(E,a,c);for(let I=0;I<U;++I){d.copy(T),p.copy(L);let z=U%2===0?((I/2|0)+.5)*(1-2*(I%2)):((I+1)/2|0)*(-1+2*(I%2));U===2&&!C&&!P&&(z-=.5,z*=-1),!C&&!P&&U>1&&z!==0&&(d.lerpVectors(T,L,Tp/O),p.lerpVectors(T,L,1-Tp/O)),z*=Tp,d.addScaledVector(B,z),p.addScaledVector(B,z),s.setItem(g,d,p),v&&s.setColor(g,e.getAtomColor(r,w),e.getAtomColor(r,b)),g++}}s.finalize()}},Ss={AtomsSphereGroup:lA,AtomsSurfaceGroup:Z9,AtomsSASSESGroupStub:Q9,AtomsTextGroup:nk,AromaticTorusGroup:ak,AromaticLinesGroup:ck,NucleicCylindersGroup:dk,NucleicSpheresGroup:mk,ResiduesSubseqGroup:wk,ResiduesTraceGroup:Ek,BondsCylinderGroup:Lk,BondsLinesGroup:Pk},Nk=class extends wf{constructor(e,t,n,i,r,s,a,c){super();const u=this;this._complex=n,this._mode=r;const d=n.getAtoms(),p=n.getTransforms();n.forEachComponent(g=>{const v=[];let y=0;if(g.forEachAtom(E=>{u._checkAtom(E,a)&&(v[y++]=E.index)}),y===0)return;const S=new e(t,{atoms:d,chunks:v,parent:n},i,r,p,s,c);S._component=g,u.add(S)})}_checkAtom(e,t){return e.mask&t}getSubset(e,t){const n=[],{children:i}=this;let r=0;for(let s=0,a=i.length;s<a;++s)if(i[s].getSubset){const c=i[s].getSubset(e,t);for(let u=0,d=c.length;u<d;++u){const p=c[u];p._component=i[s]._component,n[r++]=p}}return n}},yN=Nk,Ik=class extends yN{_checkAtom(e,t){if(!(e.mask&t))return!1;const{bonds:n}=e;for(let i=0,r=n.length;i<r;++i)if(n[i]._left.mask&t&&n[i]._right.mask&t)return!1;return!0}},Ok=Ik,Dk=class extends wf{constructor(e,t,n,i,r,s,a,c){super();const u=this;this._complex=n;const d=n.getResidues(),p=n.getTransforms();n.forEachComponent(g=>{let v=0;const y=[];if(g.forEachResidue(E=>{u._checkResidue(E,a)&&(y[v++]=E._index)}),v===0)return;const S=new e(t,{residues:d,chunks:y,parent:n},i,r,p,s,c);S._component=g,u.add(S)})}checkResidue(e,t){return e._mask&t}getSubset(e,t){const n=[],{children:i}=this;let r=0;for(let s=0,a=i.length;s<a;++s)if(i[s].getSubset){const c=i[s].getSubset(e,t);for(let u=0,d=c.length;u<d;++u){const p=c[u];p._component=i[s]._component,n[r++]=p}}return n}},xN=Dk,zk=class extends xN{_checkResidue(e,t){return t&e._mask&&e._cylinders!==null}},Uk=zk,Bk=class extends wf{constructor(e,t,n,i,r,s,a,c){super();const u=this;this._complex=n;const d=n.getResidues(),p=n.getTransforms();n.forEachComponent(g=>{const v=g.getMaskedSubdivSequences(a);let y=0;const S=[];for(let w=0,b=v.length;w<b;++w){const T=v[w].arr;for(let L=0,C=T.length;L<C;++L)for(let P=T[L].start,O=T[L].end;P<=O;++P)S[y++]=d[P]._index}if(y===0)return;const E=new e(t,{residues:d,chunks:S,subdivs:v,parent:n},i,r,p,s,c);E._component=g,u.add(E)})}getSubset(e,t){const n=[],{children:i}=this;let r=0;for(let s=0,a=i.length;s<a;++s)if(i[s].getSubset){const c=i[s].getSubset(e,t);for(let u=0,d=c.length;u<d;++u){const p=c[u];p._component=i[s]._component,n[r++]=p}}return n}},Vk=Bk,Fk=class extends wf{constructor(e,t,n,i,r,s,a,c){super();const u=this;this._complex=n;const d=n.getBonds(),p=n.getTransforms();n.forEachComponent(g=>{const v=[];let y=0;if(g.forEachBond(E=>{const w=E._left,b=E._right;!(w.mask&a)||!(b.mask&a)||(v[y++]=E._index)}),y===0)return;const S=new e(t,{bonds:d,chunks:v,parent:n},i,r,p,s,c);S._component=g,u.add(S)})}getSubset(e,t){const n=[],{children:i}=this;let r=0;for(let s=0,a=i.length;s<a;++s)if(i[s].getSubset){const c=i[s].getSubset(e,t);for(let u=0,d=c.length;u<d;++u){const p=c[u];p._component=i[s]._component,n[r++]=p}}return n}},kk=Fk,Gk=class extends wf{constructor(e,t,n,i,r,s,a,c){super();const u=this;this._complex=n;const d=n.getAtoms(),p=n.getTransforms();r.showAromaticLoops()&&n.forEachComponent(g=>{const v=[];let y=0;const S=[];let E=0;g.forEachCycle(b=>{const T=b.atoms;let L=0;for(let C=0,P=T.length;C<P;++C)(T[C].mask&a)!==0&&(++L,v[y++]=T[C].index);L>0&&(S[E++]=b)});const w=new e(t,{cycles:S,atoms:d,chunks:v,parent:n},i,r,p,s,c);w._component=g,u.add(w)})}getSubset(e,t){const n=[],{children:i}=this;let r=0;for(let s=0,a=i.length;s<a;++s)if(i[s].getSubset){const c=i[s].getSubset(e,t);for(let u=0,d=c.length;u<d;++u){const p=c[u];p._component=i[s]._component,n[r++]=p}}return n}},bs={Atoms:yN,OrphanAtoms:Ok,Residues:xN,Nucleic:Uk,Subseqs:Vk,Bonds:kk,Aromatic:Gk};function Ms(e,t,n){return function(i,r,s,a,c,u){return new t(n,e,i,r,s,a,c,u)}}var Hk=class{static AtomsSpheres(e,t){return Ms(xs.createSpheres(e,t),bs.Atoms,Ss.AtomsSphereGroup)}static OrphanedAtomsCrosses(e,t,n){return Ms(xs.createCrosses(e,t,n),bs.OrphanAtoms,Ss.AtomsSphereGroup)}static BondsCylinders(e,t){return Ms(xs.create2CCylinders(e,t),bs.Bonds,Ss.BondsCylinderGroup)}static BondsLines(e,t,n){return Ms(xs.create2CLines(e,t,n),bs.Bonds,Ss.BondsLinesGroup)}static CartoonChains(e,t){return Ms(xs.createExtrudedChains(e,t),bs.Subseqs,Ss.ResiduesSubseqGroup)}static TraceChains(e,t){return Ms(xs.create2CClosedCylinders(e,t),bs.Subseqs,Ss.ResiduesTraceGroup)}static NucleicSpheres(e,t){return Ms(xs.createSpheres(e,t),bs.Nucleic,Ss.NucleicSpheresGroup)}static NucleicCylinders(e,t){return Ms(xs.create2CCylinders(e,t),bs.Nucleic,Ss.NucleicCylindersGroup)}static ALoopsTorus(e,t){return Ms(xs.createExtrudedChains(e,t),bs.Aromatic,Ss.AromaticTorusGroup)}static ALoopsLines(e,t,n){return Ms(xs.createChunkedLines(e,t,n),bs.Aromatic,Ss.AromaticLinesGroup)}static QuickSurfGeo(e,t,n){return Ms(xs.createQuickSurface(e,t,n),bs.Atoms,Ss.AtomsSurfaceGroup)}static ContactSurfaceGeo(e,t,n){return Ms(xs.createContactSurface(e,t,n),bs.Atoms,Ss.AtomsSurfaceGroup)}static SASSESSurfaceGeo(e,t,n){return Ms(xs.createSASSES(e,t,n),bs.Atoms,Ss.AtomsSASSESGroupStub)}static TextLabelsGeo(e,t){return Ms(xs.createLabels(e,t),bs.Atoms,Ss.AtomsTextGroup)}},Wk=Hk,nS=class SN{constructor(t){if(this.constructor===SN)throw new Error("Can not instantiate abstract class!");this.opts=We.default.merge(rt.deriveDeep(this.settings.now.modes[this.id],!0),t)}identify(){const t=rt.objectsDiff(this.opts,this.settings.now.modes[this.id]);return We.default.isEmpty(t)?this.id:[this.id,t]}buildGeometry(t,n,i,r){const s=this.opts.polyComplexity?this.opts.polyComplexity[this.settings.now.resolution]:0,a=this.depGroups,c=a.length,u=new Xt.RCGroup,d=this;for(let p=0;p<c;++p){let g=a[p],v={};We.default.isArray(g)&&(v=g[1].call(this),[g]=g);const y=new(Wk[g](null,this.settings,v))(t,n,d,s,i,r);y.children.length>0&&u.add(y)}return u}};w0(nS.prototype);nS.prototype.id="__";nS.prototype.depGroups=[];var ua=nS;function Xk(){return{lineWidth:this.opts.lineWidth}}var E0=class extends ua{static id="LN";constructor(e){super(e),this.depGroups=this.depGroups.slice(0);const t=this.depGroups;for(let n=0,i=t.length;n<i;++n)t[n]=[t[n],Xk]}drawMultiorderBonds(){return this.opts.multibond}calcAtomRadius(){return this.opts.atom}getAromaticOffset(){return this.opts.offsarom}getAromaticArcChunks(){return this.opts.chunkarom}showAromaticLoops(){return this.opts.showarom}};E0.prototype.id="LN";E0.prototype.name="Lines";E0.prototype.shortName="Lines";E0.prototype.depGroups=["ALoopsLines","BondsLines","OrphanedAtomsCrosses"];var jk=E0,T0=class extends ua{static id="LC";calcAtomRadius(e){return this.opts.bond}calcStickRadius(){return this.opts.bond}calcSpaceFraction(){return this.opts.space}getAromRadius(){return this.opts.aromrad}showAromaticLoops(){return this.opts.showarom}drawMultiorderBonds(){return this.opts.multibond}};T0.prototype.id="LC";T0.prototype.name="Licorice";T0.prototype.shortName="Licorice";T0.prototype.depGroups=["AtomsSpheres","BondsCylinders","ALoopsTorus"];var Yk=T0,C0=class extends ua{static id="BS";calcAtomRadius(e){return e.element.radius*this.opts.atom}calcStickRadius(){return this.opts.bond}getAromRadius(){return this.opts.aromrad}showAromaticLoops(){return this.opts.showarom}calcSpaceFraction(){return this.opts.space}drawMultiorderBonds(){return this.opts.multibond}};C0.prototype.id="BS";C0.prototype.name="Balls and Sticks";C0.prototype.shortName="Balls";C0.prototype.depGroups=["AtomsSpheres","BondsCylinders","ALoopsTorus"];var qk=C0,R0=class extends ua{static id="VW";calcAtomRadius(e){return e.element.radius}};R0.prototype.id="VW";R0.prototype.name="Van der Waals";R0.prototype.shortName="VDW";R0.prototype.depGroups=["AtomsSpheres"];var $k=R0,L0=class extends ua{static id="TR";calcStickRadius(){return this.opts.radius}};L0.prototype.id="TR";L0.prototype.name="Trace";L0.prototype.shortName="Trace";L0.prototype.depGroups=["TraceChains"];var Zk=L0,P0=class extends ua{static id="TU";getResidueRadius(e){return this.TUBE_RADIUS}getHeightSegmentsRatio(){return this.opts.heightSegmentsRatio}getTension(){return this.opts.tension}buildGeometry(e,t,n,i){const r=this.opts.radius;return this.TUBE_RADIUS=new R.Vector2(r,r),ua.prototype.buildGeometry.call(this,e,t,n,i)}};P0.prototype.id="TU";P0.prototype.name="Tube";P0.prototype.shortName="Tube";P0.prototype.depGroups=["CartoonChains"];var Kk=P0,N0=class extends ua{static id="CA";constructor(e){super(e),this.secCache={}}getResidueStartRadius(e){const t=e.getSecondary();if(!t||!t.generic)return this.TUBE_RADIUS;const n=this.secCache[t.generic];return n?t.term===e?n.start:n.center:this.TUBE_RADIUS}getResidueEndRadius(e){const t=e.getSecondary();if(t===null||!t.generic)return this.TUBE_RADIUS;const n=this.secCache[t.generic];return n?t.term===e?this.ARROW_END:n.center:this.TUBE_RADIUS}getResidueRadius(e,t){const n=this.getResidueStartRadius(e);if(t===0)return n;const i=this.getResidueEndRadius(e);return t===2?i:n.clone().lerp(i,t/2)}calcStickRadius(e){return this.opts.radius}getHeightSegmentsRatio(){return this.opts.heightSegmentsRatio}getTension(){return this.opts.tension}buildGeometry(e,t,n,i){const r=this.opts.radius,s=this.opts.depth;this.TUBE_RADIUS=new R.Vector2(r,r),this.ARROW_END=new R.Vector2(s,r);const a={},c=this.opts.ss;for(const u in c)a[u]={center:new R.Vector2(s,c[u].width),start:new R.Vector2(s,c[u].arrow)};return this.secCache=a,ua.prototype.buildGeometry.call(this,e,t,n,i)}};N0.prototype.id="CA";N0.prototype.name="Cartoon";N0.prototype.shortName="Cartoon";N0.prototype.depGroups=["CartoonChains","NucleicSpheres","NucleicCylinders"];var Qk=N0,{selectors:Jk}=nr;function eG(){return{wireframe:this.opts.wireframe,zClip:this.opts.zClip}}var cA=class extends ua{constructor(e){super(e),this.depGroups=this.depGroups.slice(0);const t=this.surfaceNames,n=this.depGroups;for(let i=0,r=t.length;i<r;++i)n[n.length]=[t[i],eG]}calcAtomRadius(e){return e.element.radius}getVisibilitySelector(){let e=null;if(this.opts.subset!==""){const t=Jk.parse(this.opts.subset);t.error||(e=t.selector)}return e}};cA.prototype.isSurface=!0;cA.prototype.surfaceNames=[];var uA=cA,I0=class extends uA{static id="QS";getSurfaceOpts(){return{useBeads:!1,isoValue:this.opts.isoValue,gaussLim:this.opts.gaussLim[this.settings.now.resolution],radScale:this.opts.scale,gridSpacing:this.opts.gridSpacing[this.settings.now.resolution],zClip:this.opts.zClip,visibilitySelector:this.getVisibilitySelector()}}};I0.prototype.id="QS";I0.prototype.name="Quick Surface";I0.prototype.shortName="Quick Surf";I0.prototype.surfaceNames=["QuickSurfGeo"];var tG=I0,Ef=class extends uA{constructor(e,t){super(t),this._excludeProbe=e}calcAtomRadius(e){return e.element.radius}getSurfaceOpts(){return{gridSpacing:this.opts.polyComplexity[this.settings.now.resolution],radScale:this._radScale,zClip:this.opts.zClip,visibilitySelector:this.getVisibilitySelector(),probeRadius:this.opts.probeRadius,excludeProbe:this._excludeProbe}}};Ef.prototype.id="SU";Ef.prototype.name="Surface";Ef.prototype.shortName="Surface";Ef.prototype.surfaceNames=["SASSESSurfaceGeo"];Ef.prototype._radScale=1;Ef.prototype._excludeProbe=!1;var bN=Ef,iS=class extends bN{static id="SA";constructor(e){super(!1,e)}};iS.prototype.id="SA";iS.prototype.name="Solvent Accessible Surface";iS.prototype.shortName="SAS";var nG=iS,rS=class extends bN{static id="SE";constructor(e){super(!0,e)}};rS.prototype.id="SE";rS.prototype.name="Solvent Excluded Surface";rS.prototype.shortName="SES";var iG=rS,hm=class extends uA{static id="CS";getSurfaceOpts(){return{probeRadius:this.opts.probeRadius,radScale:this.opts.polyComplexity[this.settings.now.resolution],scaleFactor:this.opts.polyComplexity[this.settings.now.resolution],gridSpacing:1/this.opts.polyComplexity[this.settings.now.resolution],isoValue:this.opts.isoValue,probePositions:this.opts.probePositions,zClip:this.opts.zClip,visibilitySelector:this.getVisibilitySelector()}}};hm.prototype.id="CS";hm.prototype.name="Contact Surface";hm.prototype.shortName="Contact Surf";hm.prototype.isSurface=!0;hm.prototype.surfaceNames=["ContactSurfaceGeo"];var rG=hm,O0=class extends ua{static id="TX";getTemplateOptions(){return this.opts.template}getLabelOpts(){return We.default.merge(this.opts,{colors:!0,adjustColor:!0,transparent:!0})}};O0.prototype.id="TX";O0.prototype.name="Text mode";O0.prototype.shortName="Text";O0.prototype.depGroups=["TextLabelsGeo"];var ax=new Af([jk,Yk,qk,$k,Zk,Kk,Qk,tG,nG,iG,rG,O0]);function DC(e,t,n){return e<=n?e<0?0:e:n}function sG(e,t,n){const i=1-n,r=e>>16&255,s=e>>8&255,a=e&255,c=t>>16&255,u=t>>8&255,d=t&255,p=i*r+n*c,g=i*s+n*u,v=i*a+n*d;return p<<16|g<<8|v}var hA=class{constructor(e,t){this.name=e||"Custom",this.id=t||"CP"}getElementColor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=this.elementColors[e];return n===void 0&&!t?this.defaultElementColor:n}getResidueColor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=this.residueColors[e];return n===void 0&&!t?this.defaultResidueColor:n}getChainColor(e){let t=e.charCodeAt(0);return t=((t<0?0:t>=256?t-256:t)&31)%this.chainColors.length,this.chainColors[t]}getSecondaryColor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=this.secondaryColors[e];return n===void 0&&!t?this.defaultSecondaryColor:n}getSequentialColor(e){const{colors:t}=this,n=t.length;return e<0?t[e%n+n]:t[e%n]}getGradientColor(e,t){const n=this.gradients[t];if(!n)return this.defaultNamedColor;const i=n.length,r=e*(i-1);let s=Math.floor(r);const a=DC(s+1,0,i-1);return s=DC(s,0,i-1),sG(n[s],n[a],r-s)}getNamedColor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=this.namedColors[e];return n===void 0&&!t?this.defaultNamedColor:n}};We.default.assign(hA.prototype,{colors:[16777215,16711680,65280,255,8421504],minRangeColor:0,midRangeColor:8355711,maxRangeColor:16777215,defaultElementColor:16777215,elementColors:{},defaultResidueColor:16777215,residueColors:{},chainColors:[16777215],defaultSecondaryColor:16777215,secondaryColors:{},defaultGradientColor:0,defaultNamedColor:16777215,namedColorsArray:[["indianred",13458524],["lightcoral",15761536],["salmon",16416882],["darksalmon",15308410],["lightsalmon",16752762],["crimson",14423100],["red",16711680],["firebrick",11674146],["darkred",9109504],["pink",16761035],["lightpink",16758465],["hotpink",16738740],["deeppink",16716947],["mediumvioletred",13047173],["palevioletred",14381203],["coral",16744272],["tomato",16737095],["orangered",16729344],["darkorange",16747520],["orange",16753920],["gold",16766720],["yellow",16776960],["lightyellow",16777184],["lemonchiffon",16775885],["lightgoldenrodyellow",16448210],["papayawhip",16773077],["moccasin",16770229],["peachpuff",16767673],["palegoldenrod",15657130],["khaki",15787660],["darkkhaki",12433259],["lavender",15132410],["thistle",14204888],["plum",14524637],["violet",15631086],["orchid",14315734],["fuchsia",16711935],["magenta",16711935],["mediumorchid",12211667],["mediumpurple",9662683],["rebeccapurple",6697881],["blueviolet",9055202],["darkviolet",9699539],["darkorchid",10040012],["darkmagenta",9109643],["purple",8388736],["indigo",4915330],["slateblue",6970061],["mediumslateblue",8087790],["darkslateblue",4734347],["greenyellow",11403055],["chartreuse",8388352],["lawngreen",8190976],["lime",65280],["limegreen",3329330],["palegreen",10025880],["lightgreen",9498256],["mediumspringgreen",64154],["springgreen",65407],["mediumseagreen",3978097],["seagreen",3050327],["forestgreen",2263842],["green",32768],["darkgreen",25600],["yellowgreen",10145074],["olivedrab",7048739],["olive",8421376],["darkolivegreen",5597999],["mediumaquamarine",6737322],["darkseagreen",9419919],["lightseagreen",2142890],["darkcyan",35723],["teal",32896],["aqua",65535],["cyan",65535],["lightcyan",14745599],["paleturquoise",11529966],["aquamarine",8388564],["turquoise",4251856],["mediumturquoise",4772300],["darkturquoise",52945],["cadetblue",6266528],["steelblue",4620980],["lightsteelblue",11584734],["powderblue",11591910],["lightblue",11393254],["skyblue",8900331],["lightskyblue",8900346],["deepskyblue",49151],["dodgerblue",2003199],["cornflowerblue",6591981],["royalblue",4286945],["blue",255],["mediumblue",205],["darkblue",139],["navy",128],["midnightblue",1644912],["cornsilk",16775388],["blanchedalmond",16772045],["bisque",16770244],["navajowhite",16768685],["wheat",16113331],["burlywood",14596231],["tan",13808780],["rosybrown",12357519],["sandybrown",16032864],["goldenrod",14329120],["darkgoldenrod",12092939],["peru",13468991],["chocolate",13789470],["saddlebrown",9127187],["sienna",10506797],["brown",10824234],["maroon",8388608],["white",16777215],["snow",16775930],["honeydew",15794160],["mintcream",16121850],["azure",15794175],["aliceblue",15792383],["ghostwhite",16316671],["whitesmoke",16119285],["seashell",16774638],["beige",16119260],["oldlace",16643558],["floralwhite",16775920],["ivory",16777200],["antiquewhite",16444375],["linen",16445670],["lavenderblush",16773365],["mistyrose",16770273],["gainsboro",14474460],["lightgray",13882323],["silver",12632256],["darkgray",11119017],["gray",8421504],["dimgray",6908265],["lightslategray",7833753],["slategray",7372944],["darkslategray",3100495],["black",0]],namedColors:{},gradients:{rainbow:[255,65535,65280,16776960,16711680],temp:[255,32767,16777215,16744192,16711680],hot:[16777215,16744192,16711680],cold:[16777215,32767,255],"blue-red":[255,16777215,16711680],reds:[16777215,16711680],blues:[16777215,255]}});var{namedColorsArray:zC,namedColors:oG}=hA.prototype;for(let e=0,{length:t}=zC;e<t;++e){const[n,i]=zC[e];oG[n]=i}var fA=hA,MN=new fA("CPK","CP");MN.elementColors={H:16777215,C:2105376,N:2121983,O:15605776,F:65280,P:8397055,S:16776960,CL:47872,FE:13684944,CO:13684944,NI:13684944,CU:13684944,BR:34816,I:21760};var aG=MN,Tf=new fA("Jmol","JM");Tf.colors=[255,22015,44031,65535,65451,65365,65280,5635840,11271936,16776960,16755456,16733440,16711680,16711765,16711851,16711935,11206911,5570815];Tf.elementColors={H:16777215,D:16777152,T:16777120,HE:14286847,LI:13402367,BE:12779264,B:16758197,C:9474192,N:3166456,O:16715021,F:9494608,NE:11789301,NA:11230450,MG:9109248,AL:12560038,SI:1578e4,P:16744448,S:16777008,CL:2093087,AR:8442339,K:9388244,CA:4062976,SC:15132390,TI:12567239,V:10921643,CR:9083335,MN:10255047,FE:14706227,CO:15765664,NI:5296208,CU:13140019,ZN:8224944,GA:12750735,GE:6721423,AS:12419299,SE:16752896,BR:10889513,KR:6076625,RB:7351984,SR:65280,Y:9764863,ZR:9756896,NB:7586505,MO:5551541,TC:3907230,RU:2396047,RH:687500,PD:27013,AG:12632256,CD:16767375,IN:10909043,SN:6717568,SB:10380213,TE:13924864,I:9699476,XE:4366e3,CS:5707663,BA:51456,LA:7394559,CE:16777159,PR:14286791,ND:13107143,PM:10747847,SM:9437127,EU:6422471,GD:4587463,TB:3211207,DY:2097095,HO:65436,ER:58997,TM:54354,YB:48952,LU:43812,HF:5096191,TA:5089023,W:2200790,RE:2522539,OS:2516630,IR:1528967,PT:13684960,AU:16765219,HG:12105936,TL:10900557,PB:5724513,BI:10375093,PO:11230208,AT:7688005,RN:4358806,FR:4325478,RA:32e3,AC:7384058,TH:47871,PA:41471,U:36863,NP:33023,PU:27647,AM:5528818,CM:7888099,BK:9064419,CF:10565332,ES:11739092,FM:11739066,MD:11734438,NO:12389767,LR:13041766,RF:13369433,DB:13697103,SG:14221381,BH:14680120,HS:15073326,MT:15400998};Tf.defaultResidueColor=12492910;Tf.residueColors={ALA:13158600,ARG:1334015,ASN:56540,ASP:15075850,CYS:15132160,GLN:56540,GLU:15075850,GLY:15461355,HIS:8553170,ILE:1016335,LEU:1016335,LYS:1334015,MET:15132160,PHE:3289770,PRO:14456450,SER:16422400,THR:16422400,TRP:11819700,TYR:3289770,VAL:1016335,A:10526975,C:16747595,G:16740464,I:8454143,T:10551200,U:16744576,DA:10526975,DC:16747595,DG:16740464,DI:8454143,DT:10551200,DU:16744576,"+A":10526975,"+C":16747595,"+G":16740464,"+I":8454143,"+T":10551200,"+U":16744576};Tf.chainColors=[4294967295,4290826495,4289789872,4294951112,4294967168,4294951167,4289786096,4294955120,4293951616,4294303411,4278239231,4291648604,4284927402,4288335154,4293821166,4278243025,4278255487,4282168177,4278190219,4290623339,4278215680,4286578688,4286611456,4286578816,4278222976,4290283019,4289864226];var L1=Ks.Type;Tf.secondaryColors={[L1.HELIX_ALPHA]:16711808,[L1.HELIX_PI]:6291584,[L1.HELIX_310]:10485888,[L1.STRAND]:16762880,[L1.TURN]:6324479,dna:11403518,rna:16580962};var lG=Tf,Jl=new fA("VMD","VM");Jl.colors=[255,16711680,6316128,16744448,16776960,8421427,10066329,65280,16777215,16751001,4243648,10879142,8447590,15099571,8408320,8421568];Jl.defaultElementColor=8408320;Jl.elementColors={H:16777215,C:4243391,N:255,O:16711680,P:8421427,S:16776960};Jl.defaultResidueColor=4243648;Jl.residueColors={ALA:255,ARG:16777215,ASN:8421427,ASP:16711680,CYS:16776960,GLN:16744448,GLU:16751001,GLY:16777215,HIS:4243648,ILE:65280,LEU:16751001,LYS:4243648,MET:16776960,PHE:10879142,PRO:8408064,SER:16776960,THR:15099571,TRP:10066329,TYR:65280,VAL:8421427,A:255,C:16744448,G:16776960,T:10879142,U:65280,DA:255,DC:16744448,DG:16776960,DT:10879142,DU:65280,"+A":255,"+C":16744448,"+G":16776960,"+T":10879142,"+U":65280,WAT:4243648,H2O:4243648,HOH:4243648};Jl.chainColors=[16777215].concat(Jl.colors);var Cp=Ks.Type;Jl.secondaryColors={[Cp.HELIX_ALPHA]:10879142,[Cp.HELIX_310]:255,[Cp.HELIX_PI]:16711680,[Cp.STRAND]:16776960,[Cp.BRIDGE]:8421427,[Cp.TURN]:4243648};var em=new Af([aG,lG,Jl]),wN=class AN{constructor(t){if(this.constructor===AN)throw new Error("Can not instantiate abstract class!");this.opts=We.default.merge(rt.deriveDeep(Pe.now.colorers[this.id],!0),t),this.palette=em.first}identify(){const t=rt.objectsDiff(this.opts,Pe.now.colorers[this.id]);return We.default.isEmpty(t)?this.id:[this.id,t]}};wN.prototype.id="__";var to=wN,sS=class extends to{static id="EL";getAtomColor(e,t){const n=e.element.name;return n==="C"&&this.opts.carbon>=0?this.opts.carbon:this.palette.getElementColor(n)}getResidueColor(e,t){return this.palette.defaultResidueColor}};sS.prototype.id="EL";sS.prototype.name="Element";sS.prototype.shortName="Element";var cG=sS,oS=class extends to{static id="RT";getAtomColor(e,t){return this.getResidueColor(e.residue,t)}getResidueColor(e,t){return this.palette.getResidueColor(e._type._name)}};oS.prototype.id="RT";oS.prototype.name="Residue Type";oS.prototype.shortName="Residue";var uG=oS,aS=class extends to{static id="SQ";getAtomColor(e,t){return this.getResidueColor(e.residue,t)}getResidueColor(e,t){const n=e._chain;if(n.minSequence===Number.POSITIVE_INFINITY&&n.maxSequence===Number.NEGATIVE_INFINITY)return this.palette.defaultNamedColor;const i=n.minSequence,r=n.maxSequence>i?n.maxSequence:i+1;return this.palette.getGradientColor((e._sequence-i)/(r-i),this.opts.gradient)}};aS.prototype.id="SQ";aS.prototype.name="Sequence";aS.prototype.shortName="Sequence";var hG=aS,lS=class extends to{static id="CH";getAtomColor(e,t){return this.getResidueColor(e.residue,t)}getResidueColor(e,t){return this.palette.getChainColor(e.getChain()._name)}};lS.prototype.id="CH";lS.prototype.name="Chain";lS.prototype.shortName="Chain";var fG=lS,cS=class extends to{static id="SS";getAtomColor(e,t){return this.getResidueColor(e.residue,t)}getResidueColor(e,t){if(e._type.flags&kn.Flags.DNA)return this.palette.getSecondaryColor("dna");if(e._type.flags&kn.Flags.RNA)return this.palette.getSecondaryColor("rna");const n=e.getSecondary();if(n){let i=this.palette.getSecondaryColor(n.type,!0);return i===void 0&&(i=this.palette.getSecondaryColor(n.generic)),i}return this.palette.defaultSecondaryColor}};cS.prototype.id="SS";cS.prototype.name="Secondary Structure";cS.prototype.shortName="Structure";var EN=cS,uS=class extends to{static id="UN";getAtomColor(e,t){return this.opts.color}getResidueColor(e,t){return this.opts.color}};uS.prototype.id="UN";uS.prototype.name="Uniform";uS.prototype.shortName="Uniform";var dG=uS,hS=class extends to{static id="CO";constructor(e){super(e);const t=mf.parse(this.opts.subset);this._subsetCached=t.error?mf.none():t.selector}getAtomColor(e,t){return this._subsetCached.includesAtom(e)?this.opts.color:this.opts.baseColor}getResidueColor(e,t){const n=this._subsetCached,i=e._atoms;for(let r=0,s=i.length;r<s;++r)if(!n.includesAtom(i[r]))return this.opts.baseColor;return this.opts.color}};hS.prototype.id="CO";hS.prototype.name="Conditional";hS.prototype.shortName="Conditional";var pG=hS,fS=class extends to{static id="CF";getAtomColor(e,t){return this.palette.getChainColor(String.fromCharCode(e.location))}getResidueColor(e,t){return this.palette.defaultResidueColor}};fS.prototype.id="CF";fS.prototype.name="Conformation";fS.prototype.shortName="Conformation";var mG=fS,dS=class extends to{static id="TM";getAtomColor(e,t){const{opts:n}=this;let i=1;return e.temperature&&n?(n.min===n.max?i=e.temperature>n.max?1:0:i=(e.temperature-n.min)/(n.max-n.min),this.palette.getGradientColor(i,n.gradient)):this.palette.defaultGradientColor}getResidueColor(e,t){const{opts:n}=this;if(!n)return this.palette.defaultGradientColor;if(e.temperature){let i=0;return n.min===n.max?i=e.temperature>n.max?1:0:i=(e.temperature-n.min)/(n.max-n.min),this.palette.getGradientColor(i,n.gradient)}return this.palette.defaultGradientColor}};dS.prototype.id="TM";dS.prototype.name="Temperature";dS.prototype.shortName="Temperature";var gG=dS,pS=class extends to{static id="OC";_getColorByOccupancy(e,t){if(e!==void 0){const n=1-e;return this.palette.getGradientColor(n,t.gradient)}return this.palette.defaultGradientColor}getAtomColor(e,t){const{opts:n}=this;return this._getColorByOccupancy(e.occupancy,n)}getResidueColor(e,t){const{opts:n}=this;return this._getColorByOccupancy(e.occupancy,n)}};pS.prototype.id="OC";pS.prototype.name="Occupancy";pS.prototype.shortName="Occupancy";var _G=pS,mS=class extends to{static id="HY";getAtomColor(e,t){return this.getResidueColor(e.residue,t)}getResidueColor(e,t){let n=this.palette.defaultResidueColor;return e._type.hydrophobicity!==void 0&&(n=this.palette.getGradientColor((e._type.hydrophobicity- -4.5)/(4.5- -4.5),this.opts.gradient)),n}};mS.prototype.id="HY";mS.prototype.name="Hydrophobicity";mS.prototype.shortName="Hydrophobicity";var vG=mS,gS=class extends to{static id="MO";getAtomColor(e,t){return this.getResidueColor(e.residue,t)}getResidueColor(e,t){const n=e._molecule,i=t.getMoleculeCount();return i>1?this.palette.getGradientColor((n.index-1)/(i-1),this.opts.gradient):this.palette.getGradientColor(0,this.opts.gradient)}};gS.prototype.id="MO";gS.prototype.name="Molecule";gS.prototype.shortName="Molecule";var yG=gS;function xG(e,t){const n=e>>16&255,i=e>>8&255,r=e&255,s=t*n,a=t*i,c=t*r;return s<<16|a<<8|c}var _S=class extends to{static id="CB";getAtomColor(e,t){const n=this.opts.color,i=xG(n,this.opts.factor);return e.flags&Ya.Flags.CARBON?n:i}getResidueColor(e,t){return this.opts.color}};_S.prototype.id="CB";_S.prototype.name="Carbon";_S.prototype.shortName="Carbon";var lx=new Af([cG,uG,hG,fG,EN,dG,pG,mG,gG,_G,vG,yG,_S]);function hr(e){return new R.Color(e,e,e)}var Xp=new Af([{id:"DF",name:"Diffuse",shortName:"Diffuse",uberOptions:{diffuse:hr(1),specular:hr(0),shininess:1,opacity:1},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!1,toonShading:!1}},{id:"SF",name:"Soft Plastic",shortName:"Soft",uberOptions:{diffuse:hr(1),specular:hr(.1),shininess:30,opacity:1},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!1,toonShading:!1}},{id:"PL",name:"Glossy Plastic",shortName:"Glossy",uberOptions:{diffuse:hr(.56),specular:hr(.28),shininess:100,opacity:1},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!1,toonShading:!1}},{id:"ME",name:"Metal",shortName:"Metal",uberOptions:{diffuse:hr(.56),specular:hr(.55),shininess:30,opacity:1},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!1,toonShading:!1}},{id:"TR",name:"Transparent",shortName:"Transparent",uberOptions:{diffuse:hr(1),specular:hr(0),shininess:1,opacity:.5},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!0,toonShading:!1}},{id:"GL",name:"Glass",shortName:"Glass",uberOptions:{diffuse:hr(.5),specular:hr(.65),shininess:100,opacity:.5},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!0,toonShading:!1}},{id:"BA",name:"Backdrop",shortName:"Backdrop",uberOptions:{diffuse:hr(1),specular:hr(0),shininess:1,opacity:1},values:{lights:!1,fog:!1,depthWrite:!1,transparent:!1,toonShading:!1}},{id:"TN",name:"Toon",shortName:"Toon",uberOptions:{diffuse:hr(1),specular:hr(0),shininess:1,opacity:1},values:{lights:!0,fog:!0,depthWrite:!0,transparent:!1,toonShading:!0}},{id:"FL",name:"Flat",shortName:"Flat",uberOptions:{diffuse:hr(1),specular:hr(0),shininess:0,opacity:1},values:{lights:!1,fog:!0,depthWrite:!0,transparent:!1}}]);function SG(e,t){const n=[];return e.traverse(i=>{for(let r=0;r<t.length;r++)if(i instanceof t[r]){n[n.length]=i;break}}),n}function dA(e,t,n){const i=e.material.createInstance();i.setValues(t);const r=new e.constructor(e.geometry,i);return r.material.needsUpdate=!0,r.applyMatrix4(e.matrix),r.layers.set(n),r}function D0(e,t,n){const i=SG(e,t);for(let r=0,s=i.length;r<s;++r){const a=i[r];a.parent&&n(a)}}function bG(e,t){const n=t.length;n<1||D0(e,[R.Mesh,R.LineSegments,R.Line],i=>{i.applyMatrix4(t[0]);for(let r=1;r<n;++r){const s=new i.constructor(i.geometry,i.material);i.parent.add(s),s.applyMatrix4(t[r])}})}var MG=(function(){const e={prepassTransparancy:!0,fakeOpacity:!1,transparent:!1,colorFromDepth:!1,lights:!1,shadowmap:!1,fog:!1};return function(t,n){n instanceof Ja&&D0(t,[R.Mesh,R.LineSegments],i=>{i.material.setValues({prepassTransparancy:!1,fakeOpacity:!1}),i.material.needsUpdate=!0,i.layers.set(Xt.LAYERS.TRANSPARENT);const r=dA(i,e,Xt.LAYERS.PREPASS_TRANSPARENT);i.parent.add(r)})}})(),wG=(function(){const e={colorFromPos:!0,transparent:!1,colorFromDepth:!1,lights:!1,shadowmap:!1,fog:!1,overrideColor:!1,fogTransparent:!1,attrColor:!1,attrColor2:!1,attrAlphaColor:!1,fakeOpacity:!1};return function(t,n){n instanceof Ja&&D0(t,[R.Mesh,R.LineSegments],i=>{const r=dA(i,e,Xt.LAYERS.COLOR_FROM_POSITION);i.parent.add(r)})}})(),AG=(function(){const e={colorFromDepth:!0,orthoCam:!0,lights:!1,shadowmap:!1,fog:!1};return function(t,n){n instanceof Ja&&D0(t,[R.Mesh,R.LineSegments],i=>{if(!i.receiveShadow&&i.material.shadowmap&&i.material.setValues({shadowmap:!1}),!i.material.lights||!i.castShadow||!Xt.belongToSelectLayers(i))return;const r=dA(i,e,Xt.LAYERS.SHADOWMAP);r.isShadowmapMesh=!0,i.parent.add(r)})}})();function EG(e,t){t instanceof Ja&&D0(e,[R.Mesh,R.LineSegments],n=>{n.isShadowmapMesh&&n.parent.remove(n)})}function TN(e,t){function n(i){i instanceof R.Mesh&&t(i);for(let r=0,s=i.children.length;r<s;r++)n(i.children[r])}n(e)}function TG(e){const t=e.geometry;if(t instanceof R.InstancedBufferGeometry){const n=t.attributes;for(const i in n)if(n.hasOwnProperty(i)&&n[i]instanceof R.InstancedBufferAttribute){const r=n[i];return(t.index?t.index.array.length/3:0)*r.array.length/r.itemSize}return 0}return t instanceof R.BufferGeometry?t.index?t.index.array.length/3:0:t.faces?t.faces.length:0}function CG(e){let t=0;return TN(e,n=>{t+=TG(n)}),t}var jp={applyTransformsToMeshes:bG,processTransparentMaterial:MG,processColFromPosMaterial:wG,createShadowmapMaterial:AG,removeShadowmapMaterial:EG,forEachMeshInGroup:TN,countTriangles:CG},{selectors:RG}=nr,LG=class{constructor(e,t,n,i){const r={clipPlane:Pe.now.draft.clipPlane,fogTransparent:Pe.now.bg.transparent,shadowmap:Pe.now.shadow.on,shadowmapType:Pe.now.shadow.type};this.index=e,this.mode=t,this.colorer=n,this.selector=i,this.selectorString="",this.count=0,this.material=new Ja,this.material.setValues(r),this.material.setUberOptions({fogAlpha:Pe.now.fogAlpha}),this.materialPreset=Xp.first,this.needsRebuild=!0,this.visible=!0,this.setMode(t)}markAtoms(e){return this.count=e.markAtoms(this.selector,1<<this.index),this.needsRebuild=!0,this.count}unmarkAtoms(e){e.clearAtomBits(1<<this.index),this.count=0}setMode(e){this.mode=e}setMaterialPreset(e){this.materialPreset=e,this.material.setUberOptions(e.uberOptions),this.material.setValues(e.values)}reset(){this.geo=null,this.selectionGeo=null}buildGeometry(e){return this.reset(),this.needsRebuild=!1,Pe.now.ao&&this.material.setValues({normalsToGBuffer:Pe.now.ao}),this.geo=this.mode.buildGeometry(e,this.colorer,1<<this.index,this.material),this.material.uberOptions.opacity<.99&&Pe.now.transparency==="prepass"&&jp.processTransparentMaterial(this.geo,this.material),this.geo.visible=this.visible,Xt.processObjRenderOrder(this.geo,this.materialPreset.id),jp.processColFromPosMaterial(this.geo,this.material),Pe.now.shadow.on&&jp.createShadowmapMaterial(this.geo,this.material),this.geo}buildSelectionGeometry(e){let t=null;if(this.geo&&"getSubset"in this.geo){const n=this.geo.getSubset(e);if(n&&n.length>0){t=new R.Group,t.matrixAutoUpdate=!1,t.matrix=this.geo.matrix;for(let i=0;i<n.length;i++){const r=n[i];t.add(r)}}}return t&&(t.visible=this.visible),this.selectionGeo=t,this.selectionGeo}compare(e){const t={},n=String(this.selector);(!e||n.valueOf()!==String(e.selector).valueOf())&&(t.selector=n);const i=this.mode.identify();(!e||Array.isArray(i)||i!==e.mode)&&(t.mode=i);const r=this.colorer.identify();return(!e||Array.isArray(r)||r!==e.colorer)&&(t.colorer=r),(!e||this.materialPreset.id!==e.material)&&(t.material=this.materialPreset.id),t}change(e,t,n,i){const r={};if(e.selector){const s=RG.parse(e.selector).selector,a=String(s);this.selectorString!==a&&(r.selector=a,this.selectorString=a,this.selector=s,this.markAtoms(t))}if(e.mode){const s=e.mode;We.default.isEqual(this.mode.identify(),s)||(r.mode=s,this.setMode(n))}if(e.colorer){const s=e.colorer;We.default.isEqual(this.colorer.identify(),s)||(r.colorer=s,this.colorer=i)}if(e.material){const s=e.material;We.default.isEqual(this.materialPreset.id,s)||(r.material=s,this.setMaterialPreset(Xp.get(e.material)))}return r}show(e){this.visible=e,this.geo&&(this.geo.visible=e),this.selectionGeo&&(this.selectionGeo.visible=e)}},_M=LG;function CN(e,t,n){const{children:i}=e;if(i)for(let r=0,s=i.length;r<s;++r){const a=i[r];a._component===t&&n(a),a instanceof Xt.RCGroup&&CN(a,t,n)}}function RN(){}var PG=class extends RN{constructor(e){super(),this._complexVisual=e,this._inProgress=!1}begin(){const e=this._complexVisual.getComplex();this._componentTransforms=[];for(let t=0;t<e._components.length;++t){const n=e._components[t];this._componentTransforms[n._index]=new R.Object3D}return this._inProgress=!0,!0}apply(){if(!this._inProgress)return;const e=this._complexVisual.getComplex();for(let t=0;t<e._components.length;++t)this._bakeComponentTransform(e._components[t]);e.onAtomPositionChanged(),this._resetComponentTransform(),this._complexVisual.finalizeEdit()}discard(){this._inProgress&&(this._resetComponentTransform(),this._complexVisual.finalizeEdit())}getAltObj(){const e={objects:[],pivot:new R.Vector3(0,0,0)},t=this._complexVisual,n=t.getSelectedComponent();if(n===null)return e;const i=this._complexVisual.getSelectionGeo(),r=1<<t.getSelectionBit();let s,a,c,u;for(CN(t,n,g=>{e.objects.push(g)}),s=0;s<i.children.length;++s)for(c=i.children[s],a=0;a<c.children.length;++a)u=c.children[a],u.hasOwnProperty("_component")&&u._component===n&&e.objects.push(u);e.objects.push(this._componentTransforms[n._index]);const d=new R.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),p=new R.Vector3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);return n.forEachResidue(g=>{const v=g._atoms;for(a=0;a<v.length;++a)v[a].mask&r&&(d.min(v[a].position),p.max(v[a].position))}),e.pivot.lerpVectors(d,p,.5),e}_bakeComponentTransform(e){const t=this._componentTransforms[e._index];t&&(!(t.position.x===0&&t.position.y===0&&t.position.z===0)||!(t.quaternion.x===0&&t.quaternion.y===0&&t.quaternion.z===0&&t.quaternion.w===1))&&(t.updateMatrix(),e.forEachResidue(n=>{const i=n._atoms;for(let r=0;r<i.length;++r)i[r].position.applyMatrix4(t.matrix)}))}_resetComponentTransform(){const e=this._complexVisual,t=this._complexVisual.getSelectionGeo();let n,i,r,s;for(n=0;n<this._componentTransforms.length;++n)s=this._componentTransforms[n],s.position.set(0,0,0),s.quaternion.set(0,0,0,1);for(n=0;n<e.children.length;++n)for(r=e.children[n],i=0;i<r.children.length;++i)s=r.children[i],s.hasOwnProperty("_component")&&(s.position.set(0,0,0),s.quaternion.set(0,0,0,1));for(n=0;n<t.children.length;++n)for(r=t.children[n],i=0;i<r.children.length;++i)s=r.children[i],s.hasOwnProperty("_component")&&(s.position.set(0,0,0),s.quaternion.set(0,0,0,1))}},NG=class extends RN{constructor(e){super(),this._complexVisual=e,this._inProgress=!1}begin(){const e=this._complexVisual,t=this._complexVisual.getSelectionGeo(),n=this._getSelectionBorderAtoms();if(n.length<1||n.length>2)return Qi.error("Can only edit fragments with one or two bound atoms."),!1;this._fragmentBoundAtoms=n;const i=1<<e.getSelectionBit();e.disableSubset(i,!0);for(let a=0;a<t.children.length;++a)t.children[a].visible=!1;const r=n[0].position.clone();n.length===2&&r.lerp(n[1].position,.5),this._fragmentGeo=new R.Group,e.add(this._fragmentGeo),this._fragmentGeo.position.copy(r),this._fragmentSelectionGeo=new R.Group,t.add(this._fragmentSelectionGeo),this._fragmentSelectionGeo.position.copy(r);const s=r.clone();s.negate();for(let a=0;a<e.children.length;++a){const c=e.children[a];if(!("getSubset"in c))continue;const u=new R.Group;this._fragmentGeo.add(u);const d=new R.Group;this._fragmentSelectionGeo.add(d);const p=c.getSubset(i,!0);for(let v=0;v<p.length;v++){const y=p[v];u.add(y),y.position.copy(s)}const g=c.getSubset(i,!0);for(let v=0;v<g.length;v++){const y=g[v];d.add(y),y.position.copy(s)}}return Xt.applySelectionMaterial(this._fragmentSelectionGeo),this._inProgress=!0,!0}apply(){if(!this._inProgress)return;const e=this._complexVisual,t=e.getSelectionBit(),n=this._fragmentGeo.position,i=this._fragmentGeo.matrix.clone();i.multiply(new R.Matrix4().makeTranslation(-n.x,-n.y,-n.z)),this._bakeAtomTransform(i,1<<t),e.enableSubset(1<<t,!0),e.getComplex().onAtomPositionChanged(),e.finalizeEdit()}discard(){if(!this._inProgress)return;const e=this._complexVisual,t=this._complexVisual.getSelectionGeo();this._fragmentGeo.parent.remove(this._fragmentGeo),e.enableSubset(1<<e.getSelectionBit(),!0);for(let n=0;n<t.children.length;++n){const i=t.children[n];i.visible?t.remove(i):i.visible=!0}e.finalizeEdit()}isFreeRotationAllowed(){return this._fragmentBoundAtoms.length<2}getAltObj(){const e={objects:[],pivot:new R.Vector3(0,0,0)};e.objects.push(this._fragmentGeo,this._fragmentSelectionGeo);const t=this._fragmentBoundAtoms;if(t.length===1){if(t[0].bonds.length===1){const n=t[0].bonds[0];e.axis=new R.Vector3().subVectors(n._right.position,n._left.position),e.axis.normalize(),e.axis.transformDirection(this._complexVisual.matrixWorld)}}else t.length===2&&(e.axis=new R.Vector3().subVectors(t[1].position,t[0].position),e.axis.normalize(),e.axis.transformDirection(this._complexVisual.matrixWorld));return e}_getSelectionBorderAtoms(){const e=this._complexVisual.getComplex(),t=1<<this._complexVisual.getSelectionBit(),n={};e.forEachBond(s=>{s._left.mask&t?(s._right.mask&t)===0&&(n[s._left.index]=1):s._right.mask&t&&(n[s._right.index]=1)});const i=[],r=Object.keys(n);for(let s=0,a=r.length;s<a;++s){const c=r[s];i.push(e._atoms[c])}return i}_bakeAtomTransform(e,t){this._complexVisual.getComplex().forEachAtom(n=>{n.mask&t&&n.position.applyMatrix4(e)})}},UC={ComponentEditor:PG,FragmentEditor:NG},{selectors:rs}=nr;function Rp(e,t){Array.isArray(t)||(t=[t]);const[n,i]=t;return new(e.get(n)||e.first)(i)}var LN=class vM extends f0{constructor(t,n){super(t,n),this._complex=n,this._reprList=[],this._repr=null,this._reprListChanged=!0,this._selectionBit=0,this._reprUsedBits=0,this._selectionCount=0,this._selectionGeometry=new R.Group}getBoundaries(){return this._complex.getBoundaries()}release(){this._selectionGeometry.parent&&this._selectionGeometry.remove(this._selectionGeometry),f0.prototype.release.call(this)}getComplex(){return this._complex}getSelectionCount(){return this._selectionCount}getSelectionGeo(){return this._selectionGeometry}getSelectionBit(){return this._selectionBit}getEditor(){return this._editor}resetReps(t){this._complex&&this._complex.clearAtomBits(-1),this._reprListChanged=!0,this._reprUsedBits=0,this._reprList.length=t.length;for(let n=0,i=t.length;n<i;++n){const r=t[n];let s,a;typeof r.selector=="string"?(a=r.selector,{selector:s}=rs.parse(a)):typeof r.selector>"u"?(a=Pe.now.presets.default[0].selector,{selector:s}=rs.parse(a)):({selector:s}=r,a=s.toString());const c=Rp(ax,r.mode),u=Rp(lx,r.colorer),d=Xp.get(r.material)||Xp.first;this._reprList[n]=new _M(n,c,u,s),this._reprList[n].setMaterialPreset(d),this._reprList[n].selectorString=a,this._complex&&this._complex.markAtoms(s,1<<n),this._reprUsedBits|=1<<n}this._repr=t.length>0?this._reprList[0]:null,this._selectionBit=t.length,this._reprUsedBits|=1<<this._selectionBit,this._selectionCount=0,this._complex&&this._complex.update()}repCount(){return this._reprList.length}repCurrent(t){return t>=0&&t<this._reprList.length?this._repr=this._reprList[t]:t=this._reprList.indexOf(this._repr),t}rep(t,n){if(!n&&(t===void 0||t instanceof Object)&&(n=t,t=this.repCurrent()),t<0||t>this._reprList.length)return Qi.error(`Rep ${t} does not exist!`),null;if(t===this._reprList.length){const s=this.repAdd(n);return Qi.warn(`Rep ${t} does not exist! New representation was created.`),{desc:s.desc,index:t,status:"created"}}const i=this._reprList[t],r={selector:i.selectorString,mode:i.mode.identify(),colorer:i.colorer.identify(),material:i.materialPreset.id};if(n){const s=i.change(n,this._complex,Rp(ax,n.mode),Rp(lx,n.colorer));if(!We.default.isEmpty(s)){i.needsRebuild=!0;for(const a in s)s.hasOwnProperty(a)&&(r[a]=s[a],Qi.debug(`rep[${t}].${a} changed to ${s[a]}`));return s.mode&&i.mode.isSurface&&(Pe.now.resolution==="ultra"||Pe.now.resolution==="high")&&(Qi.report('Surface resolution was changed to "medium" to avoid hang-ups.'),Pe.set("resolution","medium")),{desc:r,index:t,status:"changed"}}}return{desc:r,index:t,status:""}}repGet(t){return(t===void 0||t instanceof Object)&&(t=this.repCurrent()),t<0||t>=this._reprList.length?null:this._reprList[t]}_getFreeReprIdx(){let t=this._reprUsedBits;for(let n=0;n<=vM.NUM_REPRESENTATION_BITS;++n,t>>=1)if((t&1)===0)return n;return-1}repAdd(t){if(this._reprList.length>=vM.NUM_REPRESENTATION_BITS)return null;const n=this._getFreeReprIdx();if(n<0)return null;const i=this.buildSelectorFromMask(1<<this._selectionBit),r=Pe.now.presets.default[0],s=We.default.merge({selector:r.selector,mode:r.mode,colorer:r.colorer,material:r.material},t),a=typeof s.selector=="string"?rs.parse(s.selector).selector:s.selector,c=new _M(this._selectionBit,Rp(ax,s.mode),Rp(lx,s.colorer),a);return c.selectorString=a.toString(),c.setMaterialPreset(Xp.get(s.material)),c.markAtoms(this._complex),this._reprList.push(c),this._selectionBit=n,this._reprUsedBits|=1<<this._selectionBit,this._complex.markAtoms(i,1<<this._selectionBit),{desc:s,index:this._reprList.length-1}}repRemove(t){t===void 0&&(t=this.repCurrent());let n=this._reprList.length;if(t<0||t>=n||n<=1)return;const i=this._reprList[t];i.unmarkAtoms(this._complex),this._reprUsedBits&=~(1<<i.index),this._reprList.splice(t,1),i===this._repr&&(--n,t=t<n?t:n-1,this._repr=this._reprList[t]),this._reprListChanged=!0}repHide(t,n){n===void 0&&(n=!0),!(t<0||t>=this._reprList.length)&&this._reprList[t].show(!n)}select(t,n){n?this._selectionCount+=this._complex.markAtomsAdditionally(t,1<<this._selectionBit):this._selectionCount=this._complex.markAtoms(t,1<<this._selectionBit),this._complex.updateStructuresMask(),this.rebuildSelectionGeometry()}resetSelectionMask(){this._selectionCount!==0&&(this._selectionCount=0,this._complex&&this._complex.clearAtomBits(1<<this._selectionBit))}updateSelectionMask(t){const n=this,{atom:i}=t;let{residue:r,chain:s,molecule:a}=t;const c=1<<this._selectionBit,u=~c;if(i)r=i.residue,s=r._chain,a=r._molecule,i.mask&c?(i.mask&=u,r._mask&=u,s._mask&=u,a&&(a.mask&=u),this._selectionCount--):(i.mask|=c,this._selectionCount++,r.collectMask(),s.collectMask(),a&&a.collectMask());else if(r)s=r._chain,a=r._molecule,r._mask&c?(r._mask&=u,s._mask&=u,r.forEachAtom(d=>{d.mask&c&&(d.mask&=u,n._selectionCount--)})):(r._mask|=c,r.forEachAtom(d=>{d.mask&c||(d.mask|=c,n._selectionCount++)}),s.collectMask(),a&&a.collectMask());else if(s||a){const d=s||a;d._mask&c?(d._mask&=u,d.forEachResidue(p=>{p._mask&c&&(p._mask&=u,p.forEachAtom(g=>{g.mask&c&&(g.mask&=u,n._selectionCount--)}),p._mask&=u)})):(d._mask|=c,d.forEachResidue(p=>{if(!(p._mask&c)){p._mask|=c,p.forEachAtom(v=>{v.mask&c||(v.mask|=c,n._selectionCount++)});const g=s?p.getMolecule():p.getChain();g&&g.collectMask()}}))}else this.resetSelectionMask()}expandSelection(){const t=this,n=1<<this._selectionBit,i=1<<31;this._complex.forEachBond(s=>{s._left.mask&n?(s._right.mask&n)===0&&(s._right.mask|=i):s._right.mask&n&&(s._left.mask|=i)});const r=~i;this._complex.forEachAtom(s=>{s.mask&i&&(s.mask=s.mask&r|n,++t._selectionCount)}),this._complex.updateStructuresMask()}shrinkSelection(){const t=this,n=1<<this._selectionBit,i=1<<31;this._complex.forEachBond(s=>{s._left.mask&n?(s._right.mask&n)===0&&(s._left.mask|=i):s._right.mask&n&&(s._right.mask|=i)}),this._complex.forEachAtom(s=>{s.mask&n&&s.bonds.length===1&&(s.mask|=i)});const r=~(n|i);this._complex.forEachAtom(s=>{s.mask&i&&(s.mask&=r,--t._selectionCount)}),this._complex.updateStructuresMask()}getSelectedComponent(){const t=1<<this._selectionBit;let n=null,i=!1;return this._complex.forEachAtom(r=>{r.mask&t&&(n===null?n=r.residue._component:n!==r.residue._component&&(i=!0))}),i?null:n}getSelectionCenter(t,n,i){t.set(0,0,0);let r=0;return this._complex.forEachAtom(s=>{n(s,i)&&(t.add(s.position),r++)}),r===0?!1:(t.divideScalar(r),t.applyMatrix4(this.matrix),!0)}needsRebuild(){if(this._reprListChanged)return!0;const t=this._reprList;for(let n=0,i=t.length;n<i;++n)if(t[n].needsRebuild)return!0;return!1}rebuild(){const t=this;return Xt.clearTree(this),new Promise(n=>{const i=t._complex;if(!i){n();return}let r=!1;setTimeout(()=>{console.time("build");const s=t._reprList,a=em.get(Pe.now.palette)||em.first;let c=!1;for(let u=0,d=s.length;u<d;++u){const p=s[u];if(p.colorer.palette=a,p.needsRebuild){p.reset();try{p.buildGeometry(i)}catch(g){if(g instanceof rt.OutOfMemoryError)p.needsRebuild=!1,p.reset(),Qi.error(`Not enough memory to build geometry for representation ${p.index+1}`),r=!0;else throw g}}c=r||c||Xt.groupHasGeometryToRender(p.geo),p.geo&&t.add(p.geo)}t._reprListChanged=!1,console.timeEnd("build"),n()},10)})}setNeedsRebuild(){const t=this._reprList;for(let n=0,i=t.length;n<i;++n)t[n].needsRebuild=!0}rebuildSelectionGeometry(){const t=1<<this._selectionBit;Xt.clearTree(this._selectionGeometry);for(let n=0,i=this._reprList.length;n<i;++n){const r=this._reprList[n].buildSelectionGeometry(t);if(r){this._selectionGeometry.add(r);for(let s=0;s<r.children.length;s++){const a=r.children[s];if(this._editor&&this._editor._componentTransforms){const c=this._editor._componentTransforms[a._component._index];c&&(a.position.copy(c.position),a.quaternion.copy(c.quaternion))}}Xt.applySelectionMaterial(r)}}}_buildSelectorFromSortedLists(t,n,i){const r=this._complex;function s(c){const u=[];let d=0,p=NaN,g=NaN;for(let v=0,y=c.length;v<y;++v){const S=c[v];S===g+1?g=S:(Number.isNaN(p)||(u[d++]=new rs.Range(p,g)),p=g=S)}return Number.isNaN(p)||(u[d]=new rs.Range(p,g)),u}let a=null;if(i.length===r._chains.length)a=rs.all();else{let c;if(i.length>0&&(c=rs.chain(i),a=a?rs.or(a,c):c),Object.keys(n).length>0)for(const u in n)n.hasOwnProperty(u)&&(c=rs.and(rs.chain(u),rs.residx(s(n[u]))),a=a?rs.or(a,c):c);t.length>0&&(c=rs.serial(s(t)),a=a?rs.or(a,c):c),a||(a=rs.none())}return a}buildSelectorFromMask(t){const n=this._complex,i=[],r={},s=[];return n.forEachChain(a=>{a._mask&t&&i.push(a._name)}),n.forEachResidue(a=>{if(a._mask&t&&!(a._chain._mask&t)){const c=a._chain._name;c in r?r[c].push(a._index):r[c]=[a._index]}}),n.forEachAtom(a=>{a.mask&t&&!(a.residue._mask&t)&&s.push(a.serial)}),this._buildSelectorFromSortedLists(s,r,i)}forSelectedResidues(t){const n=1<<this._selectionBit;this._complex.forEachResidue(i=>{i._mask&n&&t(i)})}beginComponentEdit(){if(this._editor)return null;const t=new UC.ComponentEditor(this);return t.begin()?(this._editor=t,t):null}beginFragmentEdit(){if(this._editor)return null;const t=new UC.FragmentEditor(this);return t.begin()?(this._editor=t,t):null}finalizeEdit(){this._editor=null}setMaterialValues(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;for(let r=0,s=this._reprList.length;r<s;++r){const a=this._reprList[r];a.material.setValues(t),n&&a.geo.traverse(c=>{c instanceof R.Mesh&&(c.material.setValues(t),i!==void 0&&i(c),c.material.needsUpdate=!0)})}}setUberOptions(t){for(let n=0,i=this._reprList.length;n<i;++n)this._reprList[n].material.setUberOptions(t)}within(t,n){const i=this._complex.getVoxelWorld();if(i===null)return!1;const r=1<<this._selectionBit;return this._complex.markAtoms(t,r),i&&i.forEachAtomWithinDistFromMasked(this._complex,r,Number(n),s=>{s.mask|=r}),this._selectionCount=this._complex.countAtomsByMask(r),this._complex.updateStructuresMask(),this.buildSelectorFromMask(r)}};LN.NUM_REPRESENTATION_BITS=30;var ec=LN,IG=`varying vec3 pos;\r
\r
void main() {\r
// we're assuming local position is in [-0.5, 0.5]\r
// we need to offset it to be represented in RGB\r
pos = position.xyz + 0.5;\r
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r
}`,OG=`varying vec3 pos;\r
\r
void main() {\r
gl_FragColor = vec4(pos, 0.5);\r
}`,DG=`varying vec4 screenSpacePos;\r
\r
void main() {\r
screenSpacePos = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r
gl_Position = screenSpacePos;\r
}`,zG=`uniform mat4 projectionMatrix;\r
\r
// 3D volume texture\r
uniform vec3 volumeDim; // volume dimensions, pixels\r
uniform sampler2D tileTex; // tiled texture containing all Z-slices of a 3D data\r
uniform vec2 tileTexSize; // size of tiled texture, pixels\r
uniform vec2 tileStride; // UV stride between slices in tile tex, pixels\r
\r
uniform vec3 boxAngles;//value of angles({x: alpha, y:beta, z:gamma}) types 1 - if angle is obtuse, 0 - if acute\r
uniform vec3 delta; //Projection box delta's from non-orthogonal origin axes; {x: XY, y : XZ, z: YZ}\r
\r
uniform vec3 _isoLevel0;\r
uniform float _flipV;\r
uniform sampler2D _BFLeft;\r
uniform sampler2D _BFRight;\r
uniform sampler2D _FFLeft;\r
uniform sampler2D _FFRight;\r
uniform sampler2D _WFFLeft;\r
uniform sampler2D _WFFRight;\r
\r
varying vec4 screenSpacePos;\r
\r
#define NO_COLOR vec4(0., 0., 0., 0.)\r
\r
vec4 sample3DTexture(vec3 texCoord) {\r
// a pair of Z slices is determined by nearest slice border\r
float zSliceBorder = floor(texCoord.z * volumeDim.z + 0.5);\r
float zSliceNumber1 = max(zSliceBorder - 1.0, 0.0);\r
float zSliceNumber2 = min(zSliceBorder, volumeDim.z - 1.0);\r
\r
float rowTiles = floor(tileTexSize.x / tileStride.x);\r
\r
// calculate coords in tile texture for both slices\r
vec2 tileOffset = vec2(mod(zSliceNumber1, rowTiles), floor(zSliceNumber1 / rowTiles));\r
vec2 texCoordSlice1 = (texCoord.xy * volumeDim.xy + tileOffset * tileStride) / tileTexSize.xy;\r
tileOffset = vec2(mod(zSliceNumber2, rowTiles), floor(zSliceNumber2 / rowTiles));\r
vec2 texCoordSlice2 = (texCoord.xy * volumeDim.xy + tileOffset * tileStride) / tileTexSize.xy;\r
\r
// bilinear filtering\r
vec4 colorSlice1 = texture2D(tileTex, texCoordSlice1);\r
vec4 colorSlice2 = texture2D(tileTex, texCoordSlice2);\r
float weightSlice2 = texCoord.z * volumeDim.z - (zSliceNumber1 + 0.5);\r
return mix(colorSlice1, colorSlice2, weightSlice2);\r
}\r
\r
vec4 sample3DTextureInclined(vec3 boxCoord) { // delta:{ x: XY, y : XZ, z: YZ }\r
vec3 textCoord = boxCoord;\r
vec2 currDelta = mix(boxCoord.zz, vec2(1., 1.) - boxCoord.zz, boxAngles.yx) * delta.yz;\r
\r
textCoord.y = (boxCoord.y - currDelta.y) / (1. - delta.z);\r
if (textCoord.y < 0.0 || textCoord.y > 1.0)\r
return NO_COLOR;\r
\r
currDelta.x += mix(textCoord.y, 1.0 - textCoord.y, boxAngles.z) * delta.x;\r
\r
textCoord.x = (boxCoord.x - currDelta.x) / (1. - delta.x - delta.y);\r
if (textCoord.x < 0.0 || textCoord.x > 1.0)\r
return NO_COLOR;\r
\r
return sample3DTexture(textCoord);\r
}\r
\r
float CalcColor(vec3 iter, vec3 dir) {\r
float d = 1. / 128.;\r
vec3 dx = vec3(d, 0.0, 0.0);\r
vec3 dy = vec3(0.0, d, 0.0);\r
vec3 dz = vec3(0.0, 0.0, d);\r
\r
// #Opt: coordInc.x:(iter + dx).x > 1. ? 0.: sample3DTextureInclined(iter + dx).x,\r
vec3 coordInc = mix(\r
vec3(\r
sample3DTextureInclined(iter + dx).x,\r
sample3DTextureInclined(iter + dy).x,\r
sample3DTextureInclined(iter + dz).x\r
),\r
vec3(0. ,0. , 0.),\r
vec3(floor((iter + dx).x), floor((iter + dy).y), floor((iter + dz).z))\r
);\r
\r
// #Opt: coordDec.x:(iter - dx).x < 0. ? 0.: sample3DTextureInclined(iter - dx).x,\r
vec3 coordDec = mix(\r
vec3(0. ,0. , 0.),\r
vec3(\r
sample3DTextureInclined(iter - dx).x,\r
sample3DTextureInclined(iter - dy).x,\r
sample3DTextureInclined(iter - dz).x\r
),\r
vec3(ceil((iter - dx).x), ceil((iter - dy).y), ceil((iter - dz).z))\r
);\r
\r
vec3 N = normalize(coordInc - coordDec);\r
float dif = max(0.0, dot(N, dir));\r
return dif;\r
}\r
\r
vec3 AccuracyIso(vec3 left, vec3 right, float volLeft, float threshold) {\r
for (int i = 0; i < 5; i++) {\r
vec3 iterator = 0.5 * (left + right);\r
float vol = sample3DTextureInclined(iterator).r;\r
if ((volLeft - threshold) * (vol - threshold) < 0.)\r
right = iterator;\r
else\r
left = iterator;\r
}\r
return 0.5 * (left + right);\r
}\r
\r
vec3 CorrectIso(vec3 left, vec3 right, float tr) {\r
for (int j = 0; j < 5; j++) {\r
vec3 iterator = 0.5 * (left + right);\r
float vol = sample3DTextureInclined(iterator).r;\r
if (vol < tr)\r
right = iterator;\r
else\r
left = iterator;\r
}\r
return 0.5 * (left + right);\r
}\r
\r
vec4 GetIso1(vec3 start, vec3 back, float molDist, vec3 dir, float tr, int count) {\r
float vol, stepSize = (float(count) + 2.) / float(STEPS_COUNT);\r
vec3 step = stepSize * dir, iterator = start, left, right;\r
vec4 acc = NO_COLOR;\r
\r
for (int i = 0; i < STEPS_COUNT; i++) {\r
iterator = iterator + step;\r
vol = sample3DTextureInclined(iterator).r;\r
if (length(iterator - back) <= stepSize || (vol > tr))\r
break;\r
}\r
\r
if (vol > tr)\r
acc = vec4(CorrectIso(iterator, iterator - step, tr).xyz, 1.);\r
\r
return acc;\r
}\r
\r
float easeOut(float x0, float x1, float x) {\r
float t = clamp((x - x0) / (x1 - x0), 0.0, 1.0);\r
return 1.0 - (1.0 - t) * (1.0 - t);\r
}\r
\r
float easeIn(float x0, float x1, float x) {\r
float t = clamp((x - x0) / (x1 - x0), 0.0, 1.0);\r
return t * t;\r
}\r
\r
vec3 GetColSimple(float vol) {\r
float t = easeOut(_isoLevel0.x, _isoLevel0.y, vol);\r
float s = easeIn(_isoLevel0.y, _isoLevel0.z, vol);\r
return vec3(0.5, 0.6, 0.7) * (1.0 - t) + 2.0 * vec3(s, 0, 0);\r
}\r
\r
vec4 VolRender(vec3 start, vec3 back, float molDist, vec3 dir) {\r
vec4 acc = NO_COLOR, iso;\r
vec3 iterator = start, sumColor = vec3(0., 0., 0.);\r
float stepSize, alpha, sumAlpha = 0.0, vol, curStepSize, molD;\r
vec3 step, col, colOld, right;\r
float tr0 = _isoLevel0.x;\r
float dif, r, kd, finish;\r
int count = 0, stopMol = 0;\r
\r
for (int k = 0; k < 3; k++) {\r
stepSize = (float(k) + 2.) / float(STEPS_COUNT);\r
kd = 140. * tr0 * stepSize;\r
r = 1. - kd;\r
step = stepSize * dir;\r
iso = GetIso1(iterator, back, molDist, dir, tr0, k);\r
if (iso.a < 0.1 || length(iso.xyz - start) > molDist)\r
break;\r
iterator = iso.xyz;\r
dif = 1.;// CalcColor(iterator, dir);\r
colOld = GetColSimple(tr0);\r
curStepSize = stepSize;\r
for (int i = 0; i < STEPS_COUNT; i++) {\r
iterator = iterator + step;\r
molD = length(iterator - start);\r
vol = sample3DTextureInclined(iterator).r;\r
finish = distance(iterator, back) - stepSize;\r
if (finish < 0.0 || vol < tr0 || (sumAlpha > 0.97) || molD > molDist)\r
break;\r
alpha = (1. - r);\r
col = GetColSimple(vol);\r
vol = sample3DTextureInclined(iterator - 0.5 * step).r;\r
vec3 colMid = GetColSimple(vol);\r
sumColor += (1. - sumAlpha) * (colOld + 4.* colMid + col) * alpha / 6.;\r
sumAlpha += (1. - sumAlpha) * alpha;// *(1. - 1.0*dif*dif);\r
colOld = col;\r
} // for i\r
\r
if (finish < 0.0 || sumAlpha > 0.97)\r
break;\r
\r
if (molD > molDist) {\r
curStepSize = stepSize - (molD - molDist);\r
right = iterator - (molD - molDist) * dir;\r
vol = sample3DTextureInclined(right).r;\r
} else {\r
vec3 left = iterator - step;\r
right = CorrectIso(left, iterator, tr0);\r
curStepSize = distance(left, right);\r
vol = tr0;\r
}\r
\r
alpha = (1. - r) * curStepSize / stepSize;\r
dif = 1.;// CalcColor(right, dir);\r
col = GetColSimple(vol);\r
vol = sample3DTextureInclined(iterator - 0.5 * curStepSize / stepSize * step).r;\r
vec3 colMid = GetColSimple(vol);\r
sumColor += (1. - sumAlpha) * (colOld + 4. * colMid + col) * alpha / 6.;\r
sumAlpha += (1. - sumAlpha) * alpha;// *(1. - 1.0*dif*dif);\r
\r
if (molD > molDist)\r
break;\r
} // for k\r
acc.rgb = 1. * sumColor / sumAlpha;\r
acc.a = sumAlpha;\r
return acc;\r
}\r
\r
vec4 VolRender1(vec3 start, vec3 back, float molDist, vec3 dir) {\r
float stepSize = 1.0 / float(STEPS_COUNT);\r
float len = length(back - start);\r
vec3 step = stepSize * dir;\r
vec3 iterator = start;\r
float acc = 0.0;\r
\r
for (int i = 0; i < STEPS_COUNT; i++) {\r
if (float(i) * stepSize > len)\r
break;\r
iterator = iterator + step;\r
if (sample3DTextureInclined(iterator).r > _isoLevel0.x)\r
acc += 10. * sample3DTextureInclined(iterator).r / float(STEPS_COUNT);\r
}\r
\r
return vec4(1.,1.,1., acc);\r
}\r
\r
vec4 IsoRender(vec3 start, vec3 back, float molDist, vec3 dir) {\r
vec4 tst = GetIso1(start, back, 2., dir, _isoLevel0.x, 0);\r
vec4 col = NO_COLOR;\r
\r
if (length(tst.xyz - start) < molDist && tst.a > 0.1) {\r
float dif = CalcColor(tst.xyz, dir);\r
dif = 0.9 * dif * dif;\r
col = vec4(dif, dif, dif, 1);\r
}\r
return col;\r
}\r
\r
vec4 VolRender2(vec3 start, vec3 back, float molDist, vec3 dir) {\r
return sample3DTexture(start);\r
}\r
\r
void main() {\r
vec3 tc = screenSpacePos.xyz / screenSpacePos.w * 0.5 + 0.5;\r
\r
if (_flipV > 0.0) {\r
tc.y = 1.0 - tc.y;\r
}\r
\r
vec3 start;\r
vec3 back;\r
vec3 molBack;\r
if (projectionMatrix[0][2] < 0.0) {\r
start = texture2D(_FFLeft, tc.xy).xyz;\r
back = texture2D(_BFLeft, tc.xy).xyz;\r
molBack = texture2D(_WFFLeft, tc.xy).xyz;\r
} else {\r
start = texture2D(_FFRight, tc.xy).xyz;\r
back = texture2D(_BFRight, tc.xy).xyz;\r
molBack = texture2D(_WFFRight, tc.xy).xyz;\r
}\r
\r
vec3 dir = normalize(back - start);\r
\r
float molDist = 2.0;\r
if (length(molBack) > 0.001) {\r
molDist = distance(start, molBack);\r
}\r
\r
#ifdef ISO_MODE\r
gl_FragColor = IsoRender(start, back, molDist, dir);\r
#else\r
gl_FragColor = VolRender(start, back, molDist, dir);\r
#endif\r
}\r
`,UG=`varying vec4 volPos;\r
uniform float aspectRatio;\r
uniform float farZ;\r
uniform float tanHalfFOV;\r
uniform mat4 matWorld2Volume;\r
\r
void main() {\r
// rescale plane to fill in the whole far plane area seen from camera\r
vec3 pos = position.xyz;\r
pos.x = pos.x * tanHalfFOV * farZ * aspectRatio;\r
pos.y = pos.y * tanHalfFOV * farZ;\r
// common transformation\r
gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\r
// calc pos in volume CS\r
volPos = matWorld2Volume * modelMatrix * vec4(pos, 1.0);\r
// we're assuming local position is in [-0.5, 0.5]\r
// we need to offset it to be represented in RGB\r
volPos = volPos + 0.5;\r
volPos.w = 0.5;\r
}\r
`,BG=`varying vec4 volPos;\r
\r
void main() {\r
gl_FragColor = volPos;\r
}`,VG=R.UniformsUtils.merge([{volumeDim:{type:"v3",value:new R.Vector3(512,512,512)},tileTex:{type:"t",value:null},tileTexSize:{type:"v2",value:new R.Vector2(512,512)},tileStride:{type:"v2",value:new R.Vector2(512,512)},boxAngles:{type:"v3",value:new R.Vector3(1,1,1)},delta:{type:"v3",value:new R.Vector3(0,0,0)},_isoLevel0:{type:"v2",value:new R.Vector3(.5,.75,1)},_flipV:{type:"f",value:0},_BFLeft:{type:"t",value:null},_BFRight:{type:"t",value:null},_FFLeft:{type:"t",value:null},_FFRight:{type:"t",value:null},_WFFLeft:{type:"t",value:null},_WFFRight:{type:"t",value:null}}]);function PN(e,t){const n=R.UniformsUtils.clone(t);for(const i in e)n.hasOwnProperty(i)&&(n[i].value=e[i]);return n}function NN(e,t){return{uniforms:PN(e,{}),vertexShader:IG,fragmentShader:OG,transparent:!1,depthTest:!1,depthWrite:!1,side:t}}var FG=class extends R.ShaderMaterial{constructor(e){const t=NN(e,R.BackSide);super(t)}},IN=class{constructor(e,t,n,i){this.uniforms=PN(e,t),this.vertexShader=n,this.fragmentShader=i,this.transparent=!1,this.depthTest=!1,this.depthWrite=!1,this.side=R.FrontSide}},kG=class extends R.ShaderMaterial{constructor(e){const t=new IN(e,R.UniformsUtils.merge([{aspectRatio:{type:"f",value:0},farZ:{type:"f",value:0},tanHalfFOV:{type:"f",value:0},matWorld2Volume:{type:"4fv",value:new R.Matrix4}}]),UG,BG);super(t)}},GG=class extends R.ShaderMaterial{constructor(e){const t=NN(e,R.FrontSide);super(t)}},HG=class extends R.ShaderMaterial{constructor(e){const t=new IN(e,VG,DG,zG);t.transparent=!0,t.depthTest=!0,super(t),this.updateDefines()}updateDefines(){this.defines={ISO_MODE:Pe.now.modes.VD.isoMode,STEPS_COUNT:Pe.now.modes.VD.polyComplexity[Pe.now.resolution]*100},this.needsUpdate=!0}},mx={BackFacePosMaterial:FG,BackFacePosMaterialFarPlane:kG,FrontFacePosMaterial:GG,VolumeMaterial:HG},WG=class Ha extends R.Mesh{volumeInfo={};constructor(){const t=new R.BufferGeometry;super(t),this.clipPlane=new R.Plane;const n=new R.Vector3(.5,.5,.5);this.size=n,this.cullFlag=[!0,!0,!0,!0,!0,!0,!0,!0,!1,!1,!1,!1,!1,!1],this.faces=[{indices:[],norm:new R.Vector3(0,0,-1)},{indices:[],norm:new R.Vector3(0,0,1)},{indices:[],norm:new R.Vector3(0,-1,0)},{indices:[],norm:new R.Vector3(0,1,0)},{indices:[],norm:new R.Vector3(-1,0,0)},{indices:[],norm:new R.Vector3(1,0,0)},{indices:[],norm:new R.Vector3(0,0,0)}],this.vertices=[new R.Vector3(-n.x,-n.y,-n.z),new R.Vector3(-n.x,n.y,-n.z),new R.Vector3(n.x,-n.y,-n.z),new R.Vector3(n.x,n.y,-n.z),new R.Vector3(-n.x,-n.y,n.z),new R.Vector3(-n.x,n.y,n.z),new R.Vector3(n.x,-n.y,n.z),new R.Vector3(n.x,n.y,n.z),new R.Vector3(0,0,0),new R.Vector3(0,0,0),new R.Vector3(0,0,0),new R.Vector3(0,0,0),new R.Vector3(0,0,0),new R.Vector3(0,0,0)],t.setAttribute("position",new R.BufferAttribute(new Float32Array(this.vertices.length*3),3)),this.name="VolumeMesh"}static _corners=[[-1,-1,-1,0,4,8],[1,-1,-1,0,5,9],[1,1,-1,1,5,10],[-1,1,-1,1,4,11],[-1,-1,1,2,6,8],[1,-1,1,2,7,9],[1,1,1,3,7,10],[-1,1,1,3,6,11]];static _edges=[[0,1,0,-1,-1],[2,3,0,1,-1],[4,5,0,-1,1],[6,7,0,1,1],[0,3,-1,0,-1],[1,2,1,0,-1],[4,7,-1,0,1],[5,6,1,0,1],[0,4,-1,-1,0],[1,5,1,-1,0],[2,6,-1,1,0],[3,7,1,1,0]];static _edgeIntersections=(function(){const t=[];for(let n=0;n<12;++n)t.push(new R.Vector3);return t})();_updateVertices(){const t=Ha._corners,n=Ha._edges,i=Ha._edgeIntersections;let r;const s=this.clipPlane.normal,a=this.clipPlane.constant,c=this.vertices,{size:u}=this,d=[0,0,0,0,0,0,0,0],p=[1,1,1,1,1,1,1,1,1,1,1,1],g=new R.Vector3;let v=null;function y(){if(s.x===0)return 0;const O=-(s.dot(g)+a)/s.x;return-u.x<=O&&O<=u.x?(v.set(O,g.y,g.z),O===u.x?2:O===-u.x?-2:1):0}function S(){if(s.y===0)return 0;const O=-(s.dot(g)+a)/s.y;return-u.y<=O&&O<=u.y?(v.set(g.x,O,g.z),O===u.y?2:O===-u.y?-2:1):0}function E(){if(s.z===0)return 0;const O=-(s.dot(g)+a)/s.z;return-u.z<=O&&O<=u.z?(v.set(g.x,g.y,O),O===u.z?2:O===-u.z?-2:1):0}for(let O=0;O<12;++O){const B=n[O];v=i[O],g.set(B[2],B[3],B[4]),g.multiply(u);let U=0;B[2]===0&&(U=y()),B[3]===0&&(U=S()),B[4]===0&&(U=E()),U===-2?d[B[0]]=1:U===2?d[B[1]]=1:U===0&&(p[O]=0)}const w={indices:[],norm:s.clone().negate()};let b=8;for(r=0;r<8;++r)d[r]===1&&(c[b].set(t[r][0],t[r][1],t[r][2]).multiply(u),w.indices.push(b++),p[t[r][3]]=0,p[t[r][4]]=0,p[t[r][5]]=0);for(r=0;r<12;++r)p[r]===1&&(c[b].copy(i[r]),w.indices.push(b++));this.faces[6]=w;const T=new R.Vector3,L=new R.Vector3;for(this.clipPlane.coplanarPoint(L),r=0;r<c.length;++r)this.cullFlag[r]=!1,r<8?(T.subVectors(c[r],L),this.cullFlag[r]=s.dot(T)>=0):r<8+w.indices.length&&(this.cullFlag[r]=!0);const C=this.geometry.getAttribute("position");let P=0;for(r=0;r<c.length;++r)C.array[P++]=c[r].x,C.array[P++]=c[r].y,C.array[P++]=c[r].z;C.needsUpdate=!0}_collectVertices(t,n){let i;const r=this.vertices;for(t.indices=[],i=0;i<r.length;++i)this.cullFlag[i]&&n(r[i])&&t.indices.push(i)}_sortIndices(t,n){let i,r;const s=this.vertices,a=[],c=new R.Vector3;for(i=1;i<t.indices.length;++i)c.subVectors(s[t.indices[i]],s[t.indices[0]]),c.normalize(),c.cross(n),c.negate(),a[i]=t.norm.dot(c);for(i=1;i<t.indices.length-1;++i)for(r=i+1;r<t.indices.length;++r)if(a[r]<a[i]){let u=a[i];a[i]=a[r],a[r]=u,u=t.indices[i],t.indices[i]=t.indices[r],t.indices[r]=u}}_updateIndices(){let t,n,i;const r=this.vertices,{size:s}=this;this._collectVertices(this.faces[0],v=>v.z===-s.z),this._collectVertices(this.faces[1],v=>v.z===s.z),this._collectVertices(this.faces[2],v=>v.y===-s.y),this._collectVertices(this.faces[3],v=>v.y===s.y),this._collectVertices(this.faces[4],v=>v.x===-s.x),this._collectVertices(this.faces[5],v=>v.x===s.x);const a=new R.Vector3,c=new R.Vector3,u=new R.Vector3;for(n=0;n<this.faces.length;++n){if(i=this.faces[n],i.indices.length===0)continue;for(a.set(0,0,0),t=0;t<i.indices.length;++t)a.add(r[i.indices[t]]);a.multiplyScalar(1/i.indices.length),c.subVectors(r[i.indices[0]],a),c.normalize();const v=[];for(t=0;t<i.indices.length;++t)u.subVectors(r[i.indices[t]],a),v[t]=u.dot(c);for(t=1;t<i.indices.length;++t)if(v[t]<v[0]){let y=v[0];v[0]=v[t],v[t]=y,[y]=i.indices,i.indices[0]=i.indices[t],i.indices[t]=y}this._sortIndices(i,c)}let d=0;for(n=0;n<this.faces.length;++n)i=this.faces[n],i.indices.length>=3&&(d+=3*(i.indices.length-2));let p=0;const g=new Uint16Array(d);for(n=0;n<this.faces.length;++n)for(i=this.faces[n],t=0;t<i.indices.length-2;++t)g[p]=i.indices[0],g[p+1]=i.indices[t+1],g[p+2]=i.indices[t+2],p+=3;this.geometry.setIndex(new R.BufferAttribute(g,1))}setDataSource(t){const n=new mx.VolumeMaterial,i=t.getDimensions(),r=t.getTiledTextureStride(),s=t.buildTiledTexture(),a=t.getBox();n.uniforms.volumeDim.value.set(i[0],i[1],i[2]),n.uniforms.tileTex.value=s,n.uniforms.tileTexSize.value.set(s.image.width,s.image.height),n.uniforms.tileStride.value.set(r[0],r[1]),Object.assign(this.volumeInfo,t.getVolumeInfo());const c=this.volumeInfo;n.uniforms.delta.value.copy(c.delta),n.uniforms.boxAngles.value.set(c.obtuseAngle[0],c.obtuseAngle[1],c.obtuseAngle[2]),this.material=n,a.getSize(this.scale),a.getCenter(this.position)}_updateIsoLevel(){const{kSigma:t,kSigmaMed:n,kSigmaMax:i}=Pe.now.modes.VD,r=this.volumeInfo,s=r.dmean-r.dmin,a=r.dmax-r.dmin,c=u=>(s+u*r.sd)/a;this.material.uniforms._isoLevel0.value.set(c(t),c(n),c(i))}static _nearClipPlaneOffset=.2;static _pos=new R.Vector3;static _norm=new R.Vector3;static _norm4D=new R.Vector4;static _matrixWorldToLocal=new R.Matrix4;static _clipPlane=new R.Plane;rebuild(t){const n=Ha._nearClipPlaneOffset,i=Ha._pos,r=Ha._norm,s=Ha._norm4D,a=Ha._matrixWorldToLocal,c=Ha._clipPlane;this._updateIsoLevel(),t.getWorldDirection(r),t.getWorldPosition(i),i.addScaledVector(r,t.near+n),a.copy(this.matrixWorld).invert(),i.applyMatrix4(a),s.set(r.x,r.y,r.z,0),s.applyMatrix4(a),r.copy(s),r.normalize(),c.setFromNormalAndCoplanarPoint(r,i),this.clipPlane.equals(c)||(this.clipPlane=c.clone(),this._updateVertices(),this._updateIndices())}},XG=WG;function jG(e){const t=e.length,n=new Float32Array(t*3);for(let i=0;i<t;++i){const r=3*i,s=e[i];n[r]=s.x,n[r+1]=s.y,n[r+2]=s.z}return n}var YG=class ON{static _projectionTable={XY:["x",2],XZ:["y",1],YZ:["z",0]};constructor(t,n){const{delta:i}=n,{obtuseAngle:r}=n,s=new R.Vector3;t.getSize(s),s.multiplyScalar(.5);const a=this._getBaseVertices(i,r),c=new R.BufferGeometry,u=[];for(let v=0;v<4;v++)u.push(a[v].clone().multiply(s)),u.push(a[(v+1)%4].clone().multiply(s));const d=new R.Vector3(2*s.x*(1-i.x-i.y),0,0);for(let v=0;v<8;v++)u.push(u[v].clone().add(d));for(let v=0;v<4;v++)u.push(u[v*2].clone()),u.push(u[v*2+8].clone());const p=new R.Vector3;t.getCenter(p),u.forEach(v=>v.add(p));const g=jG(u);c.setAttribute("position",new R.BufferAttribute(g,3)),this._lines=new R.LineSegments(c,new R.LineBasicMaterial({color:16777215})),this._lines.layers.set(Xt.LAYERS.VOLUME)}_getBaseVertices(t,n){const i=ON._projectionTable,r=(s,a)=>{const c=t[i[s][0]];return(-.5*(a-1)+a*n[i[s][1]])*c};return[new R.Vector3(-1+2*(r("XZ",1)+r("XY",1)),-1+2*r("YZ",1),-1),new R.Vector3(-1+2*(r("XZ",-1)+r("XY",1)),-1+2*r("YZ",-1),1),new R.Vector3(-1+2*(r("XZ",-1)+r("XY",-1)),1-2*r("YZ",1),1),new R.Vector3(-1+2*(r("XZ",1)+r("XY",-1)),1-2*r("YZ",-1),-1)]}getMesh(){return this._lines}},qG=YG,$G=class{constructor(e,t,n){const i=this._initPlaneGeo(t,n),r=new mx.BackFacePosMaterialFarPlane;this._plane=new So.Mesh(i,r),this._plane.frustumCulled=!1,this._plane.doubleSided=!0;const s=new R.Matrix4;this._plane._onBeforeRender=function(a,c,u,d,p,g){const{material:v}=this;if(!e||!v)return;const y=new R.Vector4(0,0,-(u.far-.1),1);y.applyMatrix4(u.matrixWorld),this.matrix.identity(),this.matrix.makeTranslation(y.x,y.y,y.z),this.matrixWorld.copy(this.matrix),this.modelViewMatrix.multiplyMatrices(u.matrixWorldInverse,this.matrixWorld),this.normalMatrix.getNormalMatrix(this.modelViewMatrix);const S=e.matrixWorld;s.copy(S).invert(),v.uniforms.aspectRatio.value=u.aspect,v.uniforms.farZ.value=u.far,v.uniforms.tanHalfFOV.value=Math.tan(R.MathUtils.DEG2RAD*.5*u.fov),v.uniforms.matWorld2Volume.value=s},this._plane.layers.set(Xt.LAYERS.VOLUME_BFPLANE)}_initPlaneGeo(e,t){const n=new R.BufferGeometry;e=e||1,t=t||1;const i=new Float32Array([-.5*e,.5*t,0,.5*e,.5*t,0,-.5*e,-.5*t,0,.5*e,-.5*t,0]);return n.setAttribute("position",new R.BufferAttribute(i,3)),n.setIndex([0,2,1,2,3,1]),n}getMesh(){return this._plane}},ZG=$G,KG=class extends f0{constructor(e,t){super(e,t),this._mesh=new XG,this._mesh.setDataSource(t),this.add(this._mesh),this._frame=new qG(this.getBoundaries().boundingBox,this._mesh.volumeInfo),this.add(this._frame.getMesh()),this.showFrame(Pe.now.modes.VD.frame),this._farPlane=new ZG(this._mesh,2,2),this.add(this._farPlane.getMesh())}getBoundaries(){const e=this._dataSource.getBox(),t=new R.Sphere;return e.getBoundingSphere(t),{boundingBox:e,boundingSphere:t}}getMesh(){return this._mesh}showFrame(e){this._frame.getMesh().material.visible=e}},pA=KG,QG=class extends Af{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(e,["types"])}find(e){let t=[];if(e.type)t=this._dict.types[e.type.toLowerCase()]||[];else if(e.source)return this._list.filter(n=>n.canProbablyLoad&&n.canProbablyLoad(e.source));return[...t]}},JG=QG,vS=class extends eo{constructor(e,t){super(),this._source=e,this._options=t||{},this._abort=!1,this._agent=null}load(){return Promise.reject(new Error("Loading from this source is not implemented"))}abort(){this._abort=!0,this._agent&&this._agent.abort()}static extractName(e){}};w0(vS.prototype);var DN=class extends vS{constructor(e,t){super(e,t),t=this._options,this._binary=t.binary===!0}load(){return new Promise((e,t)=>{if(this._abort)throw new Error("Loading aborted");const n=this._source,i=this._agent=new FileReader;i.addEventListener("load",()=>{e(i.result)}),i.addEventListener("error",()=>{t(i.error)}),i.addEventListener("abort",()=>{t(new Error("Loading aborted"))}),i.addEventListener("progress",r=>{this.dispatchEvent(r)}),this._binary?i.readAsArrayBuffer(n):i.readAsText(n)})}static canProbablyLoad(e){return File&&e instanceof File||Blob&&e instanceof Blob}static extractName(e){return e&&e.name}};DN.types=["file","blob"];var eH=/^(https?|ftp):\/\//i,zN=class extends vS{constructor(e,t){super(e,t),t=this._options,this._binary=t.binary===!0}load(){return new Promise((e,t)=>{if(this._abort)throw new Error("Loading aborted");const n=this._source,i=this._agent=new XMLHttpRequest;i.addEventListener("load",()=>{i.status===200?e(i.response):t(new Error(`HTTP ${i.status} while fetching ${n}`))}),i.addEventListener("error",()=>{t(new Error("HTTP request failed"))}),i.addEventListener("abort",()=>{t(new Error("Loading aborted"))}),i.addEventListener("progress",r=>{this.dispatchEvent(r)}),i.open("GET",n),this._binary?i.responseType="arraybuffer":i.responseType="text",i.send()})}static canProbablyLoad(e){return We.default.isString(e)&&eH.test(e)}static extractName(e){if(e){const t=(e.indexOf("?")+1||e.lastIndexOf("#")+1||e.length+1)-1;return e.slice(e.lastIndexOf("/",t)+1,t)}}};zN.types=["url"];var UN=class extends vS{load(){return new Promise(e=>{if(this._abort)throw new Error("Loading aborted");e(this._source)})}static canProbablyLoad(e){return!1}};UN.types=["immediate"];var tH=new JG([DN,zN,UN]),nH=class extends Af{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(e,["formats","extensions"])}find(e){let t=[];return e.format?t=this._dict.formats[e.format.toLowerCase()]||[]:e.ext&&(t=this._dict.extensions[e.ext.toLowerCase()]||[]),t.length===0&&!e.format&&e.data?this._list.filter(n=>n.canProbablyParse&&n.canProbablyParse(e.data)):[...t]}},iH=nH,Qs=class{constructor(e,t){this._data=e,this._options=t||{},this._abort=!1}parseSync(){throw new Error("Parsing this type of data is not implemented")}parse(){return new Promise((e,t)=>{setTimeout(()=>{try{return this._abort?t(new Error("Parsing aborted")):e(this.parseSync())}catch(n){return t(n)}})})}getModel(){return this.model._parseHeader(this._data),this.model}abort(){this._abort=!0}};w0(Qs.prototype);var BN=class{constructor(){this.matrices=[],this._matrix=null,this._matrixIndex=-1}parse(e){let t=this._matrix;if(e.readString(12,18)===" SMTRY"){const n=e.readCharCode(19)-49,i=e.readString(20,80).trim().split(/\s+/),r=parseInt(i[0],10);(this._matrix===null||r!==this._matrixIndex)&&(this._matrixIndex=r,this._matrix=t=new R.Matrix4,this.matrices[this.matrices.length]=t);const{elements:s}=t;s[n]=parseFloat(i[1]),s[n+4]=parseFloat(i[2]),s[n+8]=parseFloat(i[3]),s[n+12]=parseFloat(i[4])}}};BN.prototype.id=290;var rH=BN,{Assembly:sH}=nr,VN=class{constructor(e){this._complex=e,this.assemblies=[],this._assembly=null,this._matrix=null,this._matrixIndex=-1}parse(e){let t=this._assembly,n=this._matrix;if(t&&e.readString(12,18)===" BIOMT"){const i=e.readCharCode(19)-49,r=e.readString(20,80).trim().split(/\s+/),s=parseInt(r[0],10);(this._matrix===null||s!==this._matrixIndex)&&(this._matrixIndex=s,this._matrix=n=new R.Matrix4,t.addMatrix(n));const{elements:a}=n;a[i]=parseFloat(r[1]),a[i+4]=parseFloat(r[2]),a[i+8]=parseFloat(r[3]),a[i+12]=parseFloat(r[4])}else if(t&&e.readString(35,41)==="CHAINS:"){const i=e.readString(42,80).split(",");for(let r=0,s=i.length;r<s;++r){const a=i[r].trim();a.length>0&&t.addChain(a)}}else e.readString(12,23)==="BIOMOLECULE:"&&(this._matrix=null,this._matrixIndex=-1,this._assembly=t=new sH(this._complex),this.assemblies.push(t))}};VN.prototype.id=350;var oH=VN,aH=class{constructor(e){this._data=e,this._start=0,this._nextCR=-1,this._nextLF=-1,this._next=-1,this._end=e.length,this.next()}readLine(){return this._data.slice(this._start,this._next)}readChar(e){return e=this._start+e-1,e<this._next?this._data[e]:" "}readCharCode(e){return e=this._start+e-1,e<this._next?this._data.charCodeAt(e):32}readString(e,t){const n=this._start+e-1,i=this._start+t;return this._data.slice(n,i<this._next?i:this._next)}readInt(e,t){return parseInt(this.readString(e,t),10)}readFloat(e,t){return parseFloat(this.readString(e,t))}end(){return this._start>=this._end}next(){const e=this._next+1;this._start=e<this._end?e:this._end,this._start>this._nextCR&&(this._nextCR=(this._data.indexOf("\r",this._start)+1||this._end+1)-1),this._start>this._nextLF&&(this._nextLF=(this._data.indexOf(`
`,this._start)+1||this._end+1)-1),this._next=this._nextCR+1<this._nextLF?this._nextCR:this._nextLF}},FN=aH,{Complex:lH,Element:BC,Helix:cH,Sheet:uH,Strand:hH,Bond:qy,Molecule:fH}=nr,dH=6;function pH(e){const t=e.trim().length===4;return e.slice(0,t?1:2).trim()}var mH=/^(HEADER\s|COMPND\s|REMARK\s|ATOM {2}|HETATM|MODEL )/i,gH={290:rH,350:oH},mA=class Oi extends Qs{constructor(t,n){super(t,n),this._complex=null,this._chain=null,this._residue=null,this._sheet=null,this._serialAtomMap=null,this._modelId=1,this._compaundFound=!1,this._biomoleculeFound=!1,this._allowedChainsIDs=null,this._lastMolId=-1,this._remarks={},this._remark=null,this._molecules=[],this._molecule=null,this._compndCurrToken="",this._options.fileType="pdb"}static canProbablyParse(t){return We.default.isString(t)&&mH.test(t)}_finalize(){this._fixBondsArray(),this._fixChains();const t=this._remarks[290];this._complex.symmetry=We.default.isUndefined(t)?[]:t.matrices;const n=this._remarks[350];this._complex.units=this._complex.units.concat(We.default.isUndefined(n)?[]:n.assemblies),this._finalizeMolecules(),this._complex.finalize({needAutoBonding:!0,detectAromaticLoops:this.settings.now.aromatic,enableEditing:this.settings.now.editing,serialAtomMap:this._serialAtomMap})}_finalizeMolecules(){const t={};let n;const i=this._complex._chains;for(n=0;n<i.length;++n){const r=i[n],s=r._name;t[s]=r}for(n=0;n<this._molecules.length;n++){const r=this._molecules[n];let s=[];for(let c=0;c<r._chains.length;c++){const u=t[r._chains[c]];s=s.concat(u._residues.slice())}const a=new fH(this._complex,r._name,n+1);a.residues=s,this._complex._molecules[n]=a}}_fixChains(){const t={},n=this._complex;for(let i=0;i<n._chains.length;i++){const r=n._chains[i];t[r._name.charCodeAt(0)]=r}}_fixBondsArray(){const t=this._serialAtomMap={},n=this._complex,i=n._atoms;for(let a=0,c=i.length;a<c;++a){const u=i[a];t[u.serial]=u}const r=n._bonds,{logger:s}=this;for(let a=0,c=r.length;a<c;++a){const u=r[a];u._right<u._left&&s.debug("_fixBondsArray: Logic error."),u._left=t[u._left]||null,u._right=t[u._right]||null}}_parseATOM(t){if(this._modelId!==1)return;const n=t.readCharCode(1)===72,i=n?t.readInt(7,11):t.readInt(6,11);let r=t.readString(13,16);const s=t.readChar(17),a=t.readString(18,20).trim(),c=t.readChar(22),u=t.readInt(23,26),d=t.readChar(27),p=t.readFloat(31,38),g=t.readFloat(39,46),v=t.readFloat(47,54),y=t.readFloat(55,60),S=t.readFloat(61,66),E=t.readString(77,78).trim()||pH(r),w=t.readInt(79,80)||0;if(this.settings.now.nowater&&(a==="HOH"||a==="WAT"))return;r=r.trim();const b=BC.getByName(E),T=BC.Role[r];let L=this._chain;(!L||L.getName()!==c)&&(this._chain=L=this._complex.getChain(c)||this._complex.addChain(c),this._residue=null);let C=this._residue;(!C||C.getSequence()!==u||C.getICode()!==d)&&(this._residue=C=L.addResidue(a,u,d));const P=new R.Vector3(p,g,v);C.addAtom(r,b,P,T,n,i,s,y,S,w)}_parseENDMDL(){this._modelId+=1}_parseCONECT(t){const n=t.readInt(7,11),i=t.readInt(12,16),r=t.readInt(17,21),s=t.readInt(22,26),a=t.readInt(27,31),c=this._complex;i&&i>n&&c.addBond(n,i,0,qy.BondType.UNKNOWN,!0),r&&r>n&&c.addBond(n,r,0,qy.BondType.UNKNOWN,!0),s&&s>n&&c.addBond(n,s,0,qy.BondType.UNKNOWN,!0),a&&a>n&&c.addBond(n,a,0,qy.BondType.UNKNOWN,!0)}_parseCOMPND(t){const n=t.readString(11,80),i=n.indexOf(":");if(this._compndCurrToken=i>0?n.substring(0,i).trim():this._compndCurrToken,this._compndCurrToken==="MOL_ID")this._molecule={_index:"",_chains:[]},this._molecule._index=parseInt(n.substring(i+1,n.indexOf(";")),10),this._molecules.push(this._molecule);else if(this._compndCurrToken==="MOLECULE"&&this._molecule!=null)this._molecule._name=n.substring(i+1,n.indexOf(";")).trim();else if(this._compndCurrToken==="CHAIN"&&this._molecule!=null){let r=n.substring(i+1,80).trim();const s=r[r.length-1];(s===";"||s===",")&&(r=r.slice(0,-1)),r=r.replace(/\s+/g,"");const a=r.split(",");this._molecule._chains=this._molecule._chains.concat(a)}}_parseREMARK(t){const n=t.readInt(8,10);let i=this._remarks[n];if(We.default.isUndefined(i)){const r=gH[n];We.default.isFunction(r)&&(this._remarks[n]=i=new r(this._complex))}We.default.isUndefined(i)||i.parse(t)}_parseHELIX(t){this._parseSTRUCTURE(t,[20,22,32,34],n=>{this._complex.addHelix(n),this._complex.structures.push(n)})}_parseSHEET(t){this._parseSTRUCTURE(t,[22,23,33,34],n=>{this._complex.addSheet(n)})}_parseSTRUCTURE(t,n,i){const d=t.readInt(8,10),p=t.readString(12,14).trim(),g=t.readString(41,70).trim(),v=t.readInt(72,76),y=t.readInt(39,40),S=t.readInt(15,16),E=t.readInt(42,45),w=t.readInt(57,60),b=t.readString(n[0],n[2]+1).charCodeAt(0),T=t.readString(n[2],n[2]+1).charCodeAt(0),L=t.readInt(n[1],n[1]+3);let C=t.readString(n[1]+4,n[1]+4),P=0;C.length>0&&(P=C.charCodeAt(0));const O=t.readInt(n[3],n[3]+3);C=t.readString(n[3]+4,n[3]+4);let B=0;C.length>0&&(B=C.charCodeAt(0));let U,I=this._sheet;if(t.readCharCode(1)===83){I!==null&&I.getName()!==p&&(I=null,this._sheet=null),I===null?(this._sheet=U=new uH(p,S),i(U)):U=I;const z=new hH(U,this._complex.getUnifiedSerial(b,L,P),this._complex.getUnifiedSerial(T,O,B),y,E,w);U.addStrand(z),this._complex.structures.push(z)}else U=new cH(y,this._complex.getUnifiedSerial(b,L,P),this._complex.getUnifiedSerial(T,O,B),d,p,g,v),i(U)}_parseHEADER(t){const{metadata:n}=this._complex;n.classification=t.readString(11,50).trim(),n.date=t.readString(51,59).trim();const i=t.readString(63,66).trim();n.id=i,i&&(this._complex.name=i),n.format="pdb"}_parseTITLE(t){const{metadata:n}=this._complex;n.title=n.title||[];const i=t.readInt(9,10)||1;n.title[i-1]=t.readString(11,80).trim()}static tagParsers={HEADER:Oi.prototype._parseHEADER,"TITLE ":Oi.prototype._parseTITLE,"ATOM ":Oi.prototype._parseATOM,HETATM:Oi.prototype._parseATOM,ENDMDL:Oi.prototype._parseENDMDL,CONECT:Oi.prototype._parseCONECT,COMPND:Oi.prototype._parseCOMPND,REMARK:Oi.prototype._parseREMARK,"HELIX ":Oi.prototype._parseHELIX,"SHEET ":Oi.prototype._parseSHEET,"ATOM 1":Oi.prototype._parseATOM,"ATOM 2":Oi.prototype._parseATOM,"ATOM 3":Oi.prototype._parseATOM,"ATOM 4":Oi.prototype._parseATOM,"ATOM 5":Oi.prototype._parseATOM,"ATOM 6":Oi.prototype._parseATOM,"ATOM 7":Oi.prototype._parseATOM,"ATOM 8":Oi.prototype._parseATOM,"ATOM 9":Oi.prototype._parseATOM};parseSync(){const t=new FN(this._data),n=this._complex=new lH;for(;!t.end();){const i=t.readString(1,dH),r=Oi.tagParsers[i];We.default.isFunction(r)&&r.call(this,t),t.next()}if(this._finalize(),this._serialAtomMap=null,this._sheet=null,this._residue=null,this._chain=null,this._complex=null,n.getAtomCount()===0)throw new Error("The data does not contain valid atoms");return n}};mA.formats=["pdb"];mA.extensions=[".pdb",".ent"];var _H=mA,{Complex:P2,Element:Lp,SGroup:vH,Bond:VC}=nr,yH={A:0,S:1,D:2,T:3},xH=/\s*<\?xml\b[^?>]*\?>\s*<(?:cml|molecule)\b/i,gA=class extends Qs{constructor(e,t){super(e,t),this._complex=null,this._residue=null,this._serialAtomMap=null,this._modelId=1,this._lastMolId=-1,this._readOnlyOneMolecule=!1,this._options.fileType="cml"}static canProbablyParse(e){return We.default.isString(e)&&xH.test(e)}_rebuidBondIndexes(e,t){const n=e.length;for(let i=0;i<n;i++){const r=e[i].id,s=t.length;for(let a=0;a<s;a++){const c=t[a].atomRefs2.split(" ");c[0]===r&&(t[a].start=i),c[1]===r&&(t[a].end=i)}}}_createSGroup(e,t){const n=new vH(e.id,e.fieldData,new R.Vector3(parseFloat(e.x),parseFloat(e.y),0),e.atomRefs,e);e.placement==="Relative"&&(n._center=new R.Vector3(0,0,0)),e.fieldName==="MDLBG_FRAGMENT_CHARGE"&&(n._charge=parseInt(e.fieldData,10)||0),e.fieldName==="MDLBG_FRAGMENT_COEFFICIENT"&&(n._repeat=parseInt(e.fieldData,10)||1),t.push(n)}_extractSGroup(e,t){if(Array.isArray(t)||(t=[]),e)if(Array.isArray(e)){const n=e.length;for(let i=0;i<n;i++)e[i].molecule&&(t=t.concat(this._extractSGroup(e[i].molecule))),this._createSGroup(e[i],t)}else e.molecule&&e.molecule&&(t=t.concat(this._extractSGroup(e.molecule))),this._createSGroup(e,t);return t}_extractSGroups(e,t){const n=this._extractSGroup(e),i=t.length;let r,s;for(r=0;r<i;r++){const S=t[r].id;for(s=0;s<n.length;s++)n[s]._atoms.split(" ")[0]===S&&(t[r].sgroupRef||(t[r].sgroupRef=[]),t[r].sgroupRef.push(n[s]))}let a={},c=null;const u=1e8,d=new R.Vector3(u,u,u),p=new R.Vector3(-u,-u,-u);function g(S){c=a[S],c&&n[s]._atoms.push(c.a)}function v(S){c=a[S],c&&(d.set(Math.min(d.x,c.x),Math.min(d.y,c.y),Math.min(d.z,c.z)),p.set(Math.max(p.x,c.x),Math.max(p.y,c.y),Math.max(p.z,c.z)),g(S))}for(r=0;r<t.length;r++)a[t[r].id]={},a[t[r].id].x=t[r].x2,t[r].x3&&(a[t[r].id].x=t[r].x3),a[t[r].id].x=parseFloat(a[t[r].id].x),a[t[r].id].y=t[r].y2,t[r].y3&&(a[t[r].id].y=t[r].y3),a[t[r].id].y=parseFloat(a[t[r].id].y),a[t[r].id].z="0.0",t[r].z3&&(a[t[r].id].z=t[r].z3),a[t[r].id].z=parseFloat(a[t[r].id].z),a[t[r].id].a=t[r];let y;for(s=0;s<n.length;s++)n[s]._center!==null?(d.set(u,u,u),p.set(-u,-u,-u),y=n[s]._atoms.split(" "),n[s]._atoms=[],y.forEach(v),n[s]._center.addVectors(d,p),n[s]._center.multiplyScalar(.5)):(y=n[s]._atoms.split(" "),n[s]._atoms=[],y.forEach(g));a=null}_traverseData(e){function t(r){return Object.prototype.toString.apply(r)==="[object Array]"}function n(r,s){if(r.nodeName==="#text"&&r.nodeValue.trim()==="")return;const a={};a.xmlNode=r;const c=s[r.nodeName];c?t(c)?s[r.nodeName].push(a):s[r.nodeName]=[c,a]:s[r.nodeName]=a;let u,d;if(r.attributes)for({length:u}=r.attributes,d=0;d<u;d++){const p=r.attributes[d];a[p.nodeName]=p.nodeValue}for({length:u}=r.childNodes,d=0;d<u;d++)n(r.childNodes[d],a)}const i={};return e.childNodes.length&&n(e.childNodes[0],i),i}_findSuitableMolecule(e,t){for(const n in e)if(n!=="xmlNode")if(n==="molecule"){if(e.molecule&&(e.molecule.atomArray&&e.molecule.atomArray.atom&&t.push(e),Array.isArray(e.molecule)))for(let i=0;i<e.molecule.length;i++)e.molecule[i].atomArray&&e.molecule[i].atomArray.atom&&t.push({molecule:e.molecule[i]})}else e[n]&&e[n]!==null&&typeof e[n]=="object"&&this._findSuitableMolecule(e[n],t)}_selectComponents(e){const t=new DOMParser().parseFromString(e,"application/xml"),n=this._traverseData(t);let i;const r=this;function s(u){let d=[];if(u.molecule&&u.molecule.atomArray&&u.molecule.atomArray.atom)Array.isArray(u.molecule.atomArray.atom)?d=u.molecule.atomArray.atom:d.push(u.molecule.atomArray.atom);else if(!u.molecule){const b={};return b.atomLabels=null,b.labelsCount=1,b}u.molecule.molecule&&r._extractSGroups(u.molecule.molecule,d);let p,g=d.length;for(let b=0;b<g;b++)p=d[b],p.edges=[];let v=[];u.molecule.bondArray&&u.molecule.bondArray.bond&&(Array.isArray(u.molecule.bondArray.bond)?v=u.molecule.bondArray.bond:v.push(u.molecule.bondArray.bond));let y;g=v.length,r._rebuidBondIndexes(d,v);function S(b){return y=v[b],p=d[y.start],!p||(p.edges.push(y.end),p=d[y.end],!p)?!1:(p.edges.push(y.start),!0)}for(let b=0;b<g;b++){if(!S(b))continue;const T=y.xmlNode.getAttribute("order"),L=parseInt(T,10);if(v[b].order=0,v[b].type=VC.BondType.UNKNOWN,L>1)v[b].order=L;else{const C=yH[T];C!==void 0&&(v[b].order=C,T==="A"&&(v[b].type=VC.BondType.AROMATIC))}}g=d.length;for(let b=0;b<g;b++)p=d[b],p.edges.sort();const E=r._breadWidthSearch(d,0),w={};return w.atoms=d,w.bonds=v,w.labels=E.atomLabels,w.count=Math.min(1,E.labelsCount),w.curr=-1,w.originalCML=t,w}n.cml?i=n.cml:i=n;const a=[],c=[];return this._findSuitableMolecule(i,c),this._readOnlyOneMolecule&&c.length>1&&c.splice(1,c.length-1),c.forEach(u=>{const d=s(u);d.atoms.length>0&&a.push(d)}),a}_packLabel(e,t){return(t<<16)+e}_unpackLabel(e){return{molId:e>>>16,compId:e&65535}}_breadWidthSearch(e,t){const n=new Array(e.length);let i;for(i=0;i<n.length;i++)n[i]=this._packLabel(0,t);const r=[];let s=0,a=e.length;for(;a>0;){s++;let u=-1;for(i=0;i<n.length;i++)if(this._unpackLabel(n[i]).compId===0){u=i;break}if(u<0)break;for(r.push(e[u]),n[u]=this._packLabel(s,t),a--;r.length>0;){const d=r.shift();if(d)for(let p=0;p<d.edges.length;p++)n[d.edges[p]]!==s&&(r.push(e[d.edges[p]]),n[d.edges[p]]=s,a--)}}const c={};return c.atomLabels=n,c.labelsCount=s,c}_parseBond(e,t,n,i){if(e>=0){const r=[Math.min(e,t),Math.max(e,t)];this._complex.addBond(r[0],r[1],n,i,!0)}}_fixBondsArray(){const e=this._serialAtomMap={},t=this._complex,n=t._atoms;for(let s=0,a=n.length;s<a;++s){const c=n[s];e[c.serial]=c}const i=t._bonds,{logger:r}=this;for(let s=0,a=i.length;s<a;++s){const c=i[s];c._right<c._left&&r.debug("_fixBondsArray: Logic error."),c._left=e[c._left]||null,c._right=e[c._right]||null}}_parseSet(e){const t=this._complex=new P2,n=e,i=n.curr,{atoms:r,labels:s}=n;let a=null,c,u;const d=r.length;function p(y){y.xmlNodeRef=a,a.x2&&(a.x3=a.x2,delete a.x2),a.y2&&(a.y3=a.y2,delete a.y2),a.z3||(a.z3="0.0"),a.complexAtom=y}let g={};const v=[];for(c=0;c<d;c++)v.push(c);for(v.sort((y,S)=>s[y]-s[S]),c=0;c<d;c++){const S=s[v[c]];if(this._unpackLabel(S).molId===this._unpackLabel(i).molId){a=r[v[c]];const E=a.elementType;if(a.sgroupRef){const w=a.sgroupRef.length;for(let b=0;b<w;++b)t._sgroups.push(a.sgroupRef[b])}if(a.x3||a.x2){const w=this._unpackLabel(S).compId,b=" ",T=w,L=" ";let C=w.toString();C.length===1&&(C=`0${C}`);const P=`N${C}`;let O=g[b];(!O||O.getName()!==b)&&(g[b]=O=this._complex.getChain(b)||this._complex.addChain(b),this._residue=null);let B=this._residue;(!B||B.getSequence()!==T||B.getICode()!==L)&&(this._residue=B=O.addResidue(P,T,L));let U=null;a.x3?U=new R.Vector3(parseFloat(a.x3),parseFloat(a.y3),parseFloat(a.z3)):a.x2&&(U=new R.Vector3(parseFloat(a.x2),parseFloat(a.y2),0));let I=Lp.ByName[a.elementType.toUpperCase()];I||(I=JSON.parse(JSON.stringify(Lp.ByName[Object.keys(Lp.ByName)[Object.keys(Lp.ByName).length-1]])),I.number+=1,I.name=a.elementType.toUpperCase(),I.fullName="Unknown",Lp.ByName[a.elementType.toUpperCase()]=I);const z=parseInt(a.id.replace(/[^0-9]/,""),10),te=B.addAtom(E,I,U,Lp.Role.SG,!0,z," ",1,0,0);a.hydrogenCount&&(te.hydrogenCount=parseInt(a.hydrogenCount,10)),a.mrvValence&&(te.valence=parseInt(a.mrvValence,10)),p(te)}}}for(g=null,c=0;c<n.bonds.length;c++){const y=n.bonds[c];if(this._unpackLabel(s[y.start]).molId===this._unpackLabel(i).molId&&this._unpackLabel(s[y.end]).molId===this._unpackLabel(i).molId){if(a=r[y.start],!a||!r[y.end])continue;this._parseBond(parseInt(a.id.replace(/[^0-9]/,""),10),parseInt(r[y.end].id.replace(/[^0-9]/,""),10),y.order,y.type)}}for(c=0;c<this._complex.getSGroupCount();c++){const y=this._complex.getSGroups()[c];for(u=0;u<y._atoms.length;u++)y._atoms[u]=y._atoms[u].complexAtom}for(c=0;c<d;c++)this._unpackLabel(s[c]).molId===this._unpackLabel(i).molId&&(a=r[c],a.complexAtom=null,delete a.complexAtom);return this._complex.originalCML=n.originalCML,this._fixBondsArray(),t.finalize({needAutoBonding:!1,detectAromaticLoops:this.settings.now.aromatic,enableEditing:this.settings.now.editing,serialAtomMap:this._serialAtomMap}),this._serialAtomMap=null,this._complex=null,t}parseSync(){const e=[],t=this;this._selectComponents(this._data).forEach(i=>{i.curr=2,i.count===0&&(i.count=1);for(let r=0;r<i.count;r++)i.curr=r+1,e.push(t._parseSet(i,!1))});let n=0;if(e.forEach(i=>{n+=i.getAtomCount()}),n<=0)throw new Error("The data does not contain valid atoms");if(e.length>1){const i=new P2;return i.joinComplexes(e),i.originalCML=e[0].originalCML,i}return e.length===1?e[0]:new P2}};gA.formats=["cml"];gA.extensions=[".cml"];var SH=gA,bH=Ts(660),FC=Ts.n(bH),{Complex:MH,Chain:wH,Atom:AH,Element:kC,Helix:EH,Sheet:TH,Strand:CH,Bond:RH,Assembly:LH,Molecule:PH}=nr,yM=class{constructor(e){this._original=Array.from(e),this._original.sort(),this._sum=0;for(let t=0;t<this._original.length;++t)this._sum+=this._original[t]}compare(e){const t=e.length;if(t!==this._original.length)return!1;let n=0,i;for(i=0;i<t;++i)n+=e[i];if(n!==this._sum)return!1;const r=Array.from(e);for(r.sort(),i=0;i<t;++i)if(r[i]!==this._original[i])return!1;return!0}};yM.prototype.constructor=yM;var gu=Ks.Type,NH=[gu.HELIX_PI,gu.BEND,gu.HELIX_ALPHA,gu.STRAND,gu.HELIX_310,gu.BRIDGE,gu.TURN,gu.COIL];function IH(e){return new Uint8Array(e,0,1)[0]}var yS=class extends Qs{constructor(e,t){super(e,t),this._options.fileType="mmtf"}static canProbablyParse(e){return We.default.isArrayBuffer(e)&&(IH(e)|1)===223}_onModel(e){}_onChain(e){if(e.modelIndex!==0)return;const t=new wH(this._complex,e.chainName);this._complex._chains[e.chainIndex]=t,t._index=e.chainIndex}_onGroup(e){if(e.modelIndex!==0||this.settings.now.nowater&&(e.groupName==="HOH"||e.groupName==="WAT"))return;const t=this._complex._chains[e.chainIndex],n=e.insCode.charCodeAt(0)?e.insCode:"",i=t.addResidue(e.groupName,e.groupId,n);i._index=e.groupIndex,this._updateSecStructure(this._complex,i,e)}_onAtom(e){if(e.modelIndex!==0)return;const t=e.altLoc.charCodeAt(0)?e.altLoc:"",n=new AH(e.groupIndex,e.atomName,kC.getByName(e.element.toUpperCase()),new R.Vector3(e.xCoord,e.yCoord,e.zCoord),kC.Role[e.atomName],!1,e.atomId,t,e.occupancy,e.bFactor,e.formalCharge);this._complex._atoms[e.atomIndex]=n,n.index=e.atomIndex,this._serialAtomMap[e.atomId]=n}_onBond(e){const t=Math.max(e.atomIndex1,e.atomIndex2);if(t>=this._complex._atoms.length)return;const n=Math.min(e.atomIndex1,e.atomIndex2);this._complex.addBond(this._complex._atoms[n],this._complex._atoms[t],e.bondOrder,RH.BondType.UNKNOWN,!0)}_updateSecStructure(e,t,n){const i=[3,-1,1,-1,5];if(!We.default.isUndefined(n)&&n.secStruct===this._ssType){t._secondary=this._ssStruct,this._ssStruct&&(this._ssStruct.term=t);return}if(!We.default.isUndefined(n)){const r=NH[n.secStruct];this._ssType=n.secStruct,this._ssStart=t;let s=null;switch(this._ssType){case-1:case 7:break;case 0:case 2:case 4:s=new EH(i[this._ssType],t,t,0,"","",0),e._helices.push(s);break;case 3:{const a=new TH("",0);e._sheets.push(a),s=new CH(a,t,t,0,null,null);break}default:r!==void 0&&(s=new Ks(r,t,t));break}this._ssStruct=s,t._secondary=s,s&&e.structures.push(s)}}_updateMolecules(e){const t=e.entityList;if(!t)return;const n=e.chainsPerModel[0];for(let i=0;i<t.length;i++){const r=t[i],s=r.chainIndexList;let a=[];for(let u=0;u<s.length;u++){const d=s[u];if(d>=n)continue;const p=this._complex._chains[d];a=a.concat(p._residues.slice())}const c=new PH(this._complex,r.description,i+1);c.residues=a,this._complex._molecules[i]=c}}_traverse(e){const t=this,{metadata:n}=this._complex;n.id=e.structureId,n.title=[],n.title[0]=e.title,n.date=e.releaseDate,n.format="mmtf";const i={onModel(r){t._onModel(r)},onChain(r){t._onChain(r)},onGroup(r){t._onGroup(r)},onAtom(r){t._onAtom(r)},onBond(r){t._onBond(r)}};this._ssType=-1,this._ssStruct=null,this._ssStart=null,FC().traverse(e,i),this._updateSecStructure(this._complex),this._updateMolecules(e)}_linkAtomsToResidues(){for(let e=0;e<this._complex._atoms.length;++e){const t=this._complex._atoms[e],n=this._complex._residues[t.residue];t.residue=n,n._atoms.push(t)}}_findSynonymousChains(){const e={};for(let t=0;t<this._complex._chains.length;++t){const n=this._complex._chains[t],i=n.getName();e.hasOwnProperty(i)||(e[i]=[]),e[i].push(n._index)}return e}_parseAssemblyInfo(e){let t,n,i;const r=[],{logger:s}=this;for(t=0;t<e.bioAssemblyList.length;++t){const a=e.bioAssemblyList[t];if(a.transformList.length===0)continue;const c=a.transformList[0].chainIndexList,u=new yM(c),d={};for(n=0;n<c.length;++n)d[this._complex._chains[c[n]].getName()]=1;const p=[];let g;for(g in d)d.hasOwnProperty(g)&&Array.prototype.push.apply(p,this._chainsByName[g]);u.compare(p)||s.debug("MMTF: Assembly is missing some of the synonymous chains. Skipping...");const v=new LH(this._complex);for(g in d)d.hasOwnProperty(g)&&v.addChain(g);for(v.addMatrix(new R.Matrix4().fromArray(a.transformList[0].matrix).transpose()),n=1;n<a.transformList.length;++n){const y=a.transformList[n];if(!u.compare(y.chainIndexList)){s.debug("MMTF: Chain lists differ for different transforms in one assembly. Skipping...");continue}const S=new R.Matrix4().fromArray(y.matrix).transpose();for(i=0;i<v.matrices.length&&!v.matrices[i].equals(S);++i);i===v.matrices.length&&v.addMatrix(S)}v.finalize(),r.push(v)}return r}_markHeteroAtoms(e){const t=e.chainsPerModel[0];for(let n=0;n<e.entityList.length;++n){const i=e.entityList[n];if(i.type!=="polymer")for(let r=0;r<i.chainIndexList.length;++r){const s=i.chainIndexList[r];if(s>=t)continue;const a=this._complex._chains[s];for(let c=0;c<a._residues.length;++c){const u=a._residues[c];for(let d=0;d<u._atoms.length;++d)u._atoms[d].het=!0}}}}_joinSynonymousChains(){let e,t;const n=[],i={};for(e=0;e<this._complex._chains.length;++e){const r=this._complex._chains[e],s=r.getName();if(!i.hasOwnProperty(s)){i[s]=r,r._index=n.length,n.push(r);continue}const a=i[s];for(t=0;t<r._residues.length;++t){const c=r._residues[t];a._residues.push(c),c._chain=a}}this._complex._chains=n}parseSync(){const e=FC().decode(this._data);return this._complex=new MH,this._serialAtomMap={},this._traverse(e),this._linkAtomsToResidues(),this._markHeteroAtoms(e),this._chainsByName=this._findSynonymousChains(),Array.prototype.push.apply(this._complex.units,this._parseAssemblyInfo(e)),this._joinSynonymousChains(),this._complex.finalize({needAutoBonding:!1,detectAromaticLoops:this.settings.now.aromatic,enableEditing:this.settings.now.editing,serialAtomMap:this._serialAtomMap}),this._complex}};yS.formats=["mmtf"];yS.extensions=[".mmtf"];yS.binary=!0;var OH=yS,DH=class kN extends Error{constructor(t,n,i){super(`data:${n}:${i}: ${t}`),Error.captureStackTrace&&Error.captureStackTrace(this,kN),this.name="ParsingError",this.parseLine=n,this.parseColumn=i}},sa=DH;function Yh(e){return e===32||e===10||e===13||e===9}function N2(e,t,n){const i=t.length;let r=-1;for(;n<i&&(r=t.charCodeAt(n),!(r===e||r===10));)++n;return r===e?n:-1}function zH(e){let t=0,n=0;const i=e.length;let r=NaN,s=!0,a=1,c=1,u,d=0;const p={};let g={},v=[],y=0,S="",E=[],w=0,b;function T(){let P;if((r===46||r===63)&&(t+1>=i||Yh(e.charCodeAt(t+1)))){++c,++t;return}if(s&&r===59){n=t;let B=0;do{if(n=N2(10,e,n+1),n===-1)throw new sa("Unterminated text block found",a,c);++B}while(n+1<i&&e.charCodeAt(n+1)!==r||n+1>=i);return P=e.substring(t+1,n).replace(/\r/g,""),t=n+2,a+=B,c=1,s=!1,P}if(r===39||r===34){n=t;do if(n=N2(r,e,n+1),n===-1)throw new sa("Unterminated quoted string found",a,c);while(n+1<i&&!Yh(e.charCodeAt(n+1)));return P=e.substring(t+1,n),c+=n-t+1,t=n+1,P}for(n=t;n<i&&!Yh(e.charCodeAt(n));)++n;P=e.substring(t,n),c+=n-t,t=n;const O=Number(P);return Number.isNaN(O)?P:O}function L(P){v[y++]=P}function C(P){const O=w%y;return E[O].push(P),++w,P}for(;t<=i;){if(r=e.charCodeAt(t),r!==13)if(r===10)s=!0,++a,c=1;else{if(!(r===32||r===9))if(r===35){if(t=N2(10,e,t+1),t===-1)break;continue}else if(d===0)if((r===68||r===100)&&e.substr(t+1,4).toLowerCase()==="ata_"){for(n=t+5,u=n;n<i&&!Yh(e.charCodeAt(n));)++n;if(c+=n-t,t=n,u<t){p[e.substring(u,t)]=g={},d=1;continue}else throw new sa("Data block name missing",a,c)}else{if(Number.isNaN(r))break;throw new sa(`Unexpected character in state ${d}`,a,c)}else if(d===1)if((r===68||r===100)&&e.substr(t+1,4).toLowerCase()==="ata_"){d=0;continue}else if(r===95){for(n=t+1,u=n;n<i&&!Yh(e.charCodeAt(n));)++n;if(c+=n-t,t=n,u<t){S=e.substring(u,t),d=2;continue}else throw new sa("Tag name missing",a,c)}else if((r===76||r===108)&&e.substr(t+1,4).toLowerCase()==="oop_"){if(t+=5,c+=5,t<i&&!Yh(e.charCodeAt(t)))throw new sa(`Unexpected character in state ${d}`,a,c);v=[],y=0,E=[],w=0,d=3;continue}else{if(Number.isNaN(r))break;throw new sa(`Unexpected character in state ${d}`,a,c)}else if(d===2){if(Number.isNaN(r))break;b=T(),We.default.set(g,S,b),d=1;continue}else if(d===3)if(r===95){for(n=t+1,u=n;n<i&&!Yh(e.charCodeAt(n));)++n;if(c+=n-t,t=n,u<t){L(e.substring(u,t));continue}else throw new sa("Tag name missing",a,c)}else{if(y>0){for(let P=0;P<y;++P)b=[],E[P]=b,We.default.set(g,v[P],b);d=4;continue}throw new sa("Data tags are missing inside a loop",a,c)}else if(d===4){(r===68||r===100)&&e.substr(t+1,4).toLowerCase()==="ata_"?d=0:r===95||(r===76||r===108)&&e.substr(t+1,4).toLowerCase()==="oop_"?d=1:Number.isNaN(r)?d=0:C(T());continue}else throw new sa(`Unexpected internal state ${d}`,a,c);s=!1,++c}++t}if(d===2)throw new sa(`Unexpected end of file in state ${d}`,a,c);return p}var{Complex:UH,Element:GC,Helix:BH,Sheet:VH,Strand:FH,Assembly:kH,Molecule:GH}=nr,I2=["auth_seq_id","Cartn_x","Cartn_y","Cartn_z","label_atom_id"],HH={helx:"helix",turn:"turn",strn:"strand"};function WH(e){const t=/[A-Za-z]+/.exec(e);return t?HH[t[0].toLowerCase()]:null}function en(e){return e==null||We.default.isArray(e)?e:[e]}function XH(e){const t=e.trim().length===4;return e.slice(0,t?1:2).trim()}var HC=class extends Error{constructor(e){super(),this.name="AtomDataError",this.message=e}};function jH(e){if(!e)return null;const t=en(e.id),{matrix:n,vector:i}=e;if(!t||!n||!i)return null;const r=[];for(let s=0,a=t.length;s<a;++s){const c=new R.Matrix4,{elements:u}=c;for(let d=0;d<3;++d){const p=n[d+1];u[d]=en(p[1])[s],u[d+4]=en(p[2])[s],u[d+8]=en(p[3])[s],u[d+12]=en(i[d+1])[s]}r[t[s]]=c}return r}function YH(e,t){e=We.default.isString(e)?e:`${e}`;const n=e.replace(/\)\s*\(/g,"!").replace(/[()']/g,"").split("!"),i=[];for(let c=0,u=n.length;c<u;++c){const d=n[c].split(","),p=[];let g=0;for(let v=0,y=d.length;v<y;++v){const S=d[v];if(S.includes("-")){const E=S.split("-");let w=parseInt(E[0],10);const b=parseInt(E[1],10);for(;w<=b;++w)p[g++]=t[w]}else p[g++]=t[S]}i.push(p)}const r=[];let s=0;function a(c,u){for(let d=0,p=i[c].length;d<p;++d){const g=u?u.clone():new R.Matrix4;g.multiplyMatrices(i[c][d],g),c===0?r[s++]=g:a(c-1,g)}}return a(i.length-1),r}var _A=class extends Qs{constructor(e,t){super(e,t),this.asymDict={},this.molecules=[],this._options.fileType="cif"}static canProbablyParse(e){return We.default.isString(e)&&/^\s*data_/i.test(e)}parseSync(){this.logger.info("Parsing CIF file..");const e=zH(this._data);return this._toComplex(e)}_toComplex(e){const t=new UH,n=e[Object.keys(e)[0]];return this._extractAtoms(t,n),this._extractSecondary(t,n),this._extractAssemblies(t,n),this._extractMolecules(t,n),this._extractMetadata(t,n),t.finalize({needAutoBonding:!0,detectAromaticLoops:this.settings.now.aromatic,enableEditing:this.settings.now.editing}),t}_extractMetadata(e,t){const{metadata:n}=e;n.id=t.entry.id,n.classification=t.struct_keywords.pdbx_keywords;const i=t.database_PDB_rev;n.date=i&&i.date_original?i.date_original:"",n.format="cif",n.title=[],n.title[0]=t.struct.title}_extractMolecules(e,t){const n=t.entity,i=en(n.pdbx_description),r=i.length;let s;for(s=0;s<r;s++)this.molecules[s]?this.molecules[s].name=i[s]:this.molecules[s]={name:i[s],residues:[]};const a=e.getMolecules();for(s=0;s<r;s++){const c=this.molecules[s];a[s]=new GH(e,c.name,s+1),a[s].residues=c.residues}}_extractAtoms(e,t){const n=t.atom_site;if(!n)throw new HC("CIF parsing error: atom_site is not specified!");for(let I=0,z=I2.length;I<z;++I)if(!n[I2[I]])throw new HC(`CIF parsing error: requires field ${I2[I]} not found!`);const{asymDict:i}=this,r=en(n.auth_seq_id),s=en(n.Cartn_x),a=en(n.Cartn_y),c=en(n.Cartn_z),u=en(n.label_atom_id),d=u.length,p=en(n.group_PDB)||[],g=en(n.auth_asym_id)||[],v=en(n.label_asym_id)||[],y=en(n.id)||[],S=en(n.pdbx_PDB_ins_code)||[],E=en(n.label_comp_id)||[],w=en(n.type_symbol)||[],b=en(n.B_iso_or_equiv)||[],T=en(n.occupancy)||[],L=en(n.pdbx_formal_charge)||[],C=en(n.label_alt_id)||[],P=en(n.pdbx_PDB_model_num)||[],O=en(n.label_entity_id)||[];let B=null,U=null;for(let I=0;I<d;++I){if((P[I]||1)!==1)continue;const z=String(g[I]||" ");(!B||B.getName()!==z)&&(B=e.getChain(z)||e.addChain(z)),i[String(v[I]||" ")]=z;const te=r[I],oe=String(S[I]||" "),ee=String(E[I]||"");if(!U||U.getSequence()!==te||U.getICode()!==oe){U=B.addResidue(ee,te,oe);const _e=O[I]-1;let Le=this.molecules[_e];Le||(this.molecules[_e]={name:"",residues:[]},Le=this.molecules[_e]),Le.residues.push(U)}const k=u[I],X=w[I]||XH(k),$=GC.getByName(X),j=GC.Role[k.trim()],J=new R.Vector3(s[I],a[I],c[I]),xe=p[I]==="HETATM"||!1,de=y[I]||I,fe=b[I]||0,F=T[I]||0,re=String(C[I]||""),ue=L[I]||0;U.addAtom(k,$,J,j,xe,de,re,F,fe,ue)}}_extractSecondary(e,t){t.struct_conf&&this._extractConfs(e,t.struct_conf),t.struct_sheet_range&&this._extractSheets(e,t.struct_sheet_range)}_extractSheets(e,t){const{asymDict:n}=this;if(!t.sheet_id||!t.id||!t.beg_label_seq_id||!t.end_label_seq_id||!t.beg_label_asym_id)return;const i=e._sheets;function r(v){const y=i.length;for(let S=0;S<y;++S)if(i[S]._name===v)return i[S];return i[y]=new VH(v,0),i[y]}const s=en(t.sheet_id),a=en(t.id),c=en(t.beg_auth_seq_id),u=en(t.end_auth_seq_id),d=en(t.beg_label_asym_id),p=en(t.pdbx_beg_PDB_ins_code)||[],g=en(t.pdbx_end_PDB_ins_code)||[];for(let v=0,y=a.length;v<y;++v){const S=e.getChain(n[d[v]]),E=r(s[v]),w=c[v],b=u[v],T=p[v]||" ",L=g[v]||" ",C=S.findResidue(w,T),P=S.findResidue(b,L);if(!C||!P)continue;const O=new FH(E,C[0],P[0],0,null,null),B=S.getResidues();for(let U=C[1];U<=P[1];++U)B[U]._secondary=O;E.addStrand(O),e.structures.push(O)}}_extractConfs(e,t){const{asymDict:n}=this;if(!t.conf_type_id||!t.beg_label_seq_id||!t.end_label_seq_id||!t.beg_label_asym_id)return;const i=en(t.conf_type_id),r=en(t.beg_auth_seq_id),s=en(t.pdbx_beg_PDB_ins_code)||[],a=en(t.end_auth_seq_id),c=en(t.pdbx_end_PDB_ins_code)||[],u=en(t.details)||[],d=en(t.pdbx_PDB_helix_length)||[],p=en(t.pdbx_PDB_helix_class)||[],g=en(t.id)||[],v=en(t.beg_label_asym_id);for(let y=0,S=i.length;y<S;++y){const E=WH(i[y]);if(!E)continue;const w=g[y]||i[y],b=e.getChain(n[v[y]]),T=r[y],L=a[y],C=s[y]||" ",P=c[y]||" ",O=b.findResidue(T,C),B=b.findResidue(L,P);if(!O||!B)continue;const U=u[y]||"",I=d[y]||0,z=p[y]||" ";let te;if(E==="helix"){const ee=e._helices.length;te=new BH(z,O[0],B[0],ee,w,U,I),e.addHelix(te),e.structures.push(te)}else E==="turn"?(te=new Ks(Ks.Type.TURN,O[0],B[0]),e.structures.push(te)):te=null;if(!te)continue;const oe=b.getResidues();for(let ee=O[1];ee<=B[1];++ee)oe[ee]._secondary=te}}_extractAssemblies(e,t){const{asymDict:n}=this,i=t.pdbx_struct_assembly_gen;if(!i)return;const r=en(i.assembly_id),s=en(i.oper_expression),a=en(i.asym_id_list);if(!r||!s||!a)return;const c=jH(t.pdbx_struct_oper_list);if(c)for(let u=0,d=r.length;u<d;++u){const p=new kH(e),g=YH(s[u],c),v=a[u].split(",");for(let y=0,S=v.length;y<S;++y){const E=v[y].trim();E.length>0&&p.addChain(n[E])}p.matrices=g,e.units.push(p)}}};_A.formats=["cif","mmcif"];_A.extensions=[".cif",".mmcif"];var qH=_A,Ln={singular:0,vector:1,array:2,buffer:3},$H=class{_xyz2crs=[];_origin=new R.Vector3(0,0,0);constructor(){this._header={},this._boxSize=new R.Vector3,this._boxStart=new R.Vector3,this._header.delta={},this._header.extent=[],this._header.nstart=[],this._header.grid=[],this._header.crs2xyz=[],this._header.cellDims=new R.Vector3,this._header.angles=[],this._header.origin=new R.Vector3(0,0,0),this._header.dmin=0,this._header.dmean=0,this._header.dmax=0}_typedCheck(){if(We.default.isTypedArray(this._buff))this._buff=this._buff.buffer;else if(!We.default.isArrayBuffer(this._buff))throw new TypeError("Expected ArrayBuffer or TypedArray")}_fillHeader(e,t){for(const n in e)if(e.hasOwnProperty(n))switch(e[n][0]){case Ln.singular:this._header[n]=t[e[n][1]][e[n][2]];break;case Ln.array:this._parseArray(this._header[n],t[e[n][1]],e[n][2]);break;case Ln.vector:this._parseVector(this._header[n],t[e[n][1]],e[n][2]);break;case Ln.buffer:this._header[n]=new Uint8Array(t[e[n][1]],[e[n][2]]*4,[e[n][3]]*4);break;default:break}}_parseVector(e,t,n){[e.x,e.y,e.z]=[t[n],t[n+1],t[n+2]]}_parseArray(e,t,n){e[0]=t[n],e[1]=t[n+1],e[2]=t[n+2]}_parseHeader(e){}_setAxisIndices(){}_setOrigins(){}_getAxis(){const e=this._header,t=e.cellDims.x/e.grid[0],n=e.cellDims.y/e.grid[1],i=e.cellDims.z/e.grid[2],[r,s,a]=e.angles,c=Math.cos(s),u=(Math.cos(r)-Math.cos(s)*Math.cos(a))/Math.sin(a),d=Math.sqrt(1-c*c-u*u);return[new R.Vector3(t,0,0),new R.Vector3(Math.cos(a)*n,Math.sin(a)*n,0),new R.Vector3(c*i,u*i,d*i)]}_getXYZdim(){return[this._header.extent[this._xyz2crs[0]],this._header.extent[this._xyz2crs[1]],this._header.extent[this._xyz2crs[2]]]}_getVolumeInfo(){const e=We.default.pick(this._header,["dmean","dmin","dmax","sd","delta"]);return e.obtuseAngle=this._header.angles.map(t=>+(t>=Math.PI/2)),e}_setBoxParams(e,t,n){let i=0,r=0;const[s,a,c]=this._header.angles;c>=Math.PI/2&&(i+=Math.abs(t.x)),a>=Math.PI/2&&(i+=Math.abs(n.x)),s>=Math.PI/2&&(r+=Math.abs(n.y)),this._boxStart=new R.Vector3(this._origin.x-i,this._origin.y-r,this._origin.z),this._boxSize=new R.Vector3(Math.abs(e.x)+Math.abs(t.x)+Math.abs(n.x),Math.abs(t.y)+Math.abs(n.y),Math.abs(n.z));const u=(d,p)=>Math.abs(d[p])/this._boxSize[p];this._header.delta.x=u(t,"x"),this._header.delta.y=u(n,"x"),this._header.delta.z=u(n,"y")}_getXYZbox(){return new R.Box3(this._boxStart.clone(),this._boxStart.clone().add(this._boxSize))}_toXYZData(){}parse(e){return this._parseHeader(e),this._setOrigins(),new HP(Float32Array,this._getXYZdim(),this._getXYZbox(),1,this._toXYZData(),this._getVolumeInfo())}},GN=$H,ZH={extent:[Ln.array,"u32",0],type:[Ln.singular,"u32",3],nstart:[Ln.array,"i32",4],grid:[Ln.array,"u32",7],cellDims:[Ln.vector,"f32",10],angles:[Ln.array,"f32",13],crs2xyz:[Ln.array,"i32",16],dmin:[Ln.singular,"f32",19],dmax:[Ln.singular,"f32",20],dmean:[Ln.singular,"f32",21],ispg:[Ln.singular,"u32",22],nsymbt:[Ln.singular,"u32",23],lksflg:[Ln.singular,"u32",24],customData:[Ln.buffer,"buffer",25,9],origin:[Ln.vector,"f32",34],map:[Ln.buffer,"buffer",52,1],machine:[Ln.singular,"u32",53],sd:[Ln.singular,"f32",54],nlabel:[Ln.singular,"f32",55],label:[Ln.buffer,"buffer",56,200]},KH=class extends GN{_parseHeader(e){this._buff=e,this._typedCheck();const t={};t.u32=new Uint32Array(this._buff,0,56),t.i32=new Int32Array(this._buff,0,56),t.f32=new Float32Array(this._buff,0,56),t.buffer=this._buff;const n=this._header;this._fillHeader(ZH,t),n.angles.forEach((i,r,s)=>{s[r]*=Math.PI/180})}_setAxisIndices(){const e=this._header;e.cellDims.x===0&&e.cellDims.y===0&&e.cellDims.z===0&&e.cellDims.set(1,1,1);const{crs2xyz:t}=this._header;t[0]===0&&t[1]===0&&t[2]===0&&(t[0]=1,t[1]=2,t[2]=3);const n=this._xyz2crs;n[t[0]-1]=0,n[t[1]-1]=1,n[t[2]-1]=2}_setOrigins(){const[e,t,n]=this._getAxis();this._setAxisIndices();const i=this._header,r=this._xyz2crs;if(i.origin.x===0&&i.origin.y===0&&i.origin.z===0?(this._origin.addScaledVector(e,i.nstart[r[0]]),this._origin.addScaledVector(t,i.nstart[r[1]]),this._origin.addScaledVector(n,i.nstart[r[2]])):this._origin=i.origin,e.multiplyScalar(i.extent[r[0]]-1),t.multiplyScalar(i.extent[r[1]]-1),n.multiplyScalar(i.extent[r[2]]-1),i.type===2)this._data=new Float32Array(this._buff,1024+i.nsymbt,i.extent[0]*i.extent[1]*i.extent[2]);else throw new Error(`CCP4: Unsupported format ${i.type}`);this._setBoxParams(e,t,n)}_toXYZData(){const e=this._header,t=this._data,n=this._xyz2crs,i=new Float32Array(t.length),r=this._getXYZdim(),s=r[0],a=r[1];let c=0;const u=[];let d,p,g;for(u[2]=0;u[2]<e.extent[2];u[2]++)for(u[1]=0;u[1]<e.extent[1];u[1]++)for(u[0]=0;u[0]<e.extent[0];u[0]++,c++)d=u[n[0]],p=u[n[1]],g=u[n[2]],i[d+s*(p+a*g)]=t[c];return i}},xS=class extends Qs{constructor(e,t){super(e,t),this._options.fileType="ccp4",this.model=new KH}static canProbablyParse(e){return!1}parseSync(){return this.model.parse(this._data)}};xS.formats=["ccp4"];xS.extensions=[".ccp4",".map",".mrc"];xS.binary=!0;var QH=xS,{Complex:JH,Element:eW,Molecule:tW}=nr,nW=class extends Qs{constructor(e,t){super(e,t),this._complex=null,this._atomsInf=null,this._options.fileType="xyz",this._fileName=t.name}static canProbablyParse(e){return We.default.isString(e)&&/^\s*\d+ *\n[^\n]*\n\s*\w{1,3}\s+-?\d/.test(e)}_parseToAtomsInf(e){const t=e.indexOf(`
`),n=parseInt(e.substring(0,t),10),i=e.indexOf(`
`,t+1);let r=e.slice(t+1,i).trim();r.length===0&&(r=this._fileName);const s=i+e.substring(i).search(/\S/);if(this._atomsInf=e.substring(s).split(/[\s,]*\n[\s,]*/),!Number.isNaN(n)&&this._atomsInf.length-1!==n){this._complex.error={message:"wrong number of atoms"};return}this._complex.metadata.format="xyz",this._complex.name=r}_parseAtomsInf(){const s=this._complex.addChain("A").addResidue("UNK",1," ");for(let c=0;c<this._atomsInf.length-1;c++){const u=this._atomsInf[c].split(/[\s,]+/);if(u.length!==4){this._complex.error={message:"missed parameters"};break}const d=c+1,p=u[0],g=new R.Vector3(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3])),v=eW.getByName(p);s.addAtom(p,v,g,void 0,!0,d," ",1,1,0)}const a=new tW(this._complex,this._complex.name,1);a.residues=s,this._complex._molecules[0]=a}parseSync(){const e=this._complex=new JH;if(this._parseToAtomsInf(this._data),this._parseAtomsInf(),this._complex.finalize({needAutoBonding:!0,detectAromaticLoops:this.settings.now.aromatic,enableEditing:this.settings.now.editing,serialAtomMap:this._serialAtomMap}),this._complex=null,this._atomsInf=null,e.error)throw new Error(e.error.message);return e}static formats=["xyz"];static extensions=[".xyz"]},iW=nW,{Complex:rW,Element:sW}=nr,vA=class extends Qs{constructor(e,t){super(e,t),this._options.fileType="pubchem+json"}static canProbablyParse(e){return We.default.isString(e)&&e[0]==="{"}parseSync(){return this.logger.info("Parsing PubChem JSON file..."),this._toComplex(JSON.parse(this._data))}_toComplex(e){const t=new rW,n=e.PC_Compounds&&e.PC_Compounds[0];return n&&(this._extractAtoms(t,n),t.finalize({needAutoBonding:!1,detectAromaticLoops:this.settings.now.aromatic,enableEditing:this.settings.now.editing})),t}_extractAtoms(e,t){let n=t.atoms&&t.atoms.aid,i=n&&t.atoms.element;if(!i||n.length!==i.length)throw new Error("Unable to parse atom elements");i=We.default.fromPairs(We.default.zip(n,i));const r={},s=t.coords&&t.coords[0],a=s&&s.conformers&&s.conformers[0],c=a&&a.x,u=a&&a.y,d=a&&a.z||[];if(n=s&&s.aid,!n||!c||!u)throw new Error("Coordinates are not found in the file");const p=e.addChain(" ").addResidue("UNK",1," ");for(let S=0,E=n.length;S<E;++S){const w=n[S],b=sW.ByAtomicNumber[i[w]],T=new R.Vector3(c[S],u[S],d[S]||0);r[w]=p.addAtom(b.name,b,T,void 0,!0,w," ",1,0,0)}const g=t.bonds&&t.bonds.aid1,v=t.bonds&&t.bonds.aid2,y=t.bonds&&t.bonds.order||[];if(!(!g||!v||g.length!==v.length))for(let S=0,E=g.length;S<E;++S)e.addBond(r[g[S]],r[v[S]],y[S]||1,0,!0)}};vA.formats=["pubchem","pubchem+json","pc"];vA.extensions=[".json"];var oW=vA,aW=class{constructor(e){this._strings=e.split(/\r?\n|\r/),this._currentStart=0,this._currentStringIndx=0}setStart(e){e>=this._strings.length?(this._currentStart=this._strings.length-1,this._currentStringIndx=this._strings.length-1):(this._currentStart=e,this._currentStringIndx=e)}getNextString(){return this._strings[++this._currentStringIndx]}getCurrentString(){return this._strings[this._currentStringIndx]}getStringFromStart(e){return this._currentStringIndx=this._currentStart+e,this._strings[this._currentStart+e]}findNextDataItem(){let e=this.getNextString(),t=!1;for(;!We.default.isUndefined(e)&&e.trim()!=="$$$$";){if(e.match(/>\s+<(.*)>/)){t=!0;break}e=this.getNextString()}return t}findNextCompoundStart(){let e=this.getCurrentString();for(;!We.default.isUndefined(e)&&e.trim()!=="$$$$";)e=this.getNextString();return this.setStart(++this._currentStringIndx),this.probablyHaveDataToParse()}probablyHaveDataToParse(){return this._currentStringIndx<this._strings.length-2}},{Complex:lW,Element:cW,Bond:jl,Molecule:uW}=nr,hW=[0,3,2,1,0,-1,-2,-3],fW=[0,1,2,3,1,1,1,2],dW=[jl.BondType.UNKNOWN,jl.BondType.COVALENT,jl.BondType.COVALENT,jl.BondType.COVALENT,jl.BondType.AROMATIC,jl.BondType.UNKNOWN,jl.BondType.AROMATIC,jl.BondType.AROMATIC],pW=/.*(M\s\sEND).*|.*(^$$$$).*|.*>\s+<(.+)>.*/,mW=/.*($$$$).*|.*>\s+<(.+)>.*/,O2={SDF:"sdf",MOL:"mol"},gW=["PUBCHEM_IUPAC_TRADITIONAL_NAME",/PUBCHEM_(.+)_NAME/,/(.+)name/,/(.+)NAME/],_W=["PUBCHEM_COMPOUND_CID","id","ID",/.*CID/,/.*ID/,/.*id/],vW=["msg","MSG","message","title","description","desc"],D2=["name","id","title"],yW={name:gW,id:_W,title:vW};function xW(e){if(!e)return"A";const t=[];for(;e;)t.push(65+e%26),e=Math.trunc(e/26);return t.length>1&&(t.reverse(),t[0]-=1),String.fromCharCode(...t)}var yA=class extends Qs{constructor(e,t){super(e,t),this._format="sdf",this._complex=null,this._chain=null,this._residue=null,this._molecules=null,this._metadata={},this._metadata.molecules=[],this._currentMolProps={},this._compoundIndx=-1,this._assemblies=[],this._atomsParsed=0,this._atomsIndexes=[]}canProbablyParse(e){return We.default.isString(e)&&pW.test(e)}_parseHeader(e){const t={};t.name=e.getStringFromStart(0),t.date=parseInt(e.getStringFromStart(1).substr(10,6).trim(),10).toString()||"",t.title=e.getStringFromStart(2),this._metadata.molecules.push(t)}_parseAtoms(e,t){let n,i=this._atomsParsed;const r=xW(this._compoundIndx),s="UNK",a=1;this._chain=this._complex.getChain(r)||this._complex.addChain(r),this._residue=this._chain.addResidue(s,a," ");for(let c=0;c<t;c++){n=e.getNextString(),i++;const u=parseFloat(n.substr(0,10)),d=parseFloat(n.substr(10,10)),p=parseFloat(n.substr(20,10)),g=hW[parseInt(n.substr(36,3),10)],v=new R.Vector3(u,d,p);let y=n.substr(31,3).trim().toUpperCase();const S=cW.getByName(y);this._atomsIndexes[y]||(this._atomsIndexes[y]=0),this._atomsIndexes[y]+=1,y+=this._atomsIndexes[y],this._residue.addAtom(y,S,v,void 0,!0,i," ",1,0,g)}}_parseBonds(e,t){let n;for(let i=0;i<t;i++){n=e.getNextString();let r=parseInt(n.substr(0,3),10)+this._atomsParsed,s=parseInt(n.substr(3,3),10)+this._atomsParsed;const a=parseInt(n.substr(6,3),10);r>s&&([r,s]=[s,r]),this._complex.addBond(r,s,fW[a]||1,dW[a]||jl.BondType.UNKNOWN,!0)}}_parseMOL(e){this._compoundIndx++,this._parseHeader(e);const t=e.getStringFromStart(3),n=parseInt(t.substr(0,3),10),i=parseInt(t.substr(3,3),10);this._parseAtoms(e,n),this._parseBonds(e,i),this._atomsParsed+=n,this._metadata.molecules[this._compoundIndx]._residues=[],this._metadata.molecules[this._compoundIndx]._residues.push(this._residue)}_parseDataItem(e){const t=e.getCurrentString();let n=[],i=e.getNextString();for(;i.trim()!=="";)n.push(i),i=e.getNextString();n.length===1&&([n]=n),this._currentMolProps[t.replace(/[<>]/g,"").trim()]=n}_parseCompound(e){if(this._parseMOL(e),this._format===O2.SDF){for(this._currentMolProps={};e.findNextDataItem();)this._parseDataItem(e);if(Object.keys(this._currentMolProps).length!==0){const t=this._metadata.molecules[this._compoundIndx];t.props=this._currentMolProps,this._tryToUpdateMoleculeData(t)}}}_fixBondsArray(){const e=this._serialAtomMap,t=this._complex._bonds;for(let n=0;n<t.length;n++){const i=t[n];i._right<i._left&&console.log("_fixBondsArray: Logic error."),i._left=e[i._left]||null,i._right=e[i._right]||null}}_buildAssemblies(){const e=this._complex._chains;if(e.length===1)return this._assemblies;for(let t=0;t<e.length;t++){const n=new Jw(this._complex),i=new R.Matrix4;n.addMatrix(i),n.addChain(e[t]._name),this._assemblies.push(n)}return this._assemblies}_buildMolecules(){this._complex._molecules=[];const{molecules:e}=this._metadata;for(let t=0;t<e.length;t++){const n=new uW(this._complex,e[t].name,t+1);n.residues=e[t]._residues,this._complex._molecules[t]=n}return this._complex._molecules}_searchTag(e,t){for(let n=0;n<t.length;n++)if(e instanceof RegExp&&e.test(t[n].tag)||e===t[n].tag)return t[n].data}_tryToFind(e,t){for(let n=0;n<e.length;n++){const i=this._searchTag(e[n],t);if(i)return i}}_tryToUpdateMoleculeData(e){let t=!1;for(let n=0;n<D2.length;n++){const i=yW[D2[n]],r=this._tryToFind(i,e.props);r&&(e[D2[n]]=r,t=!0)}return e.name=e.name||e.id,e.name.match(/^\d+$/)&&(e.name=`CID: ${e.name}`),t}_finalizeMetadata(){const{molecules:e}=this._metadata,{metadata:t}=this._complex,n=this._complex;if(e.length===1)n.name=e[0].name,t.title=e[0].title,t.date=e[0].date,t.properties=e[0].props;else if(e.length>1){t.molecules=[];for(let i=0;i<e.length;i++)t.molecules.push({name:e[i].name,date:e[i].date,title:e[i].title,properties:e[i].props})}}_finalize(){const e=this._serialAtomMap={},t=this._complex._atoms;for(let n=0;n<t.length;n++){const i=t[n];e[i.serial]=i}this._complex._finalizeBonds(),this._fixBondsArray(),this._finalizeMetadata(),this._buildAssemblies(),this._complex.units=this._complex.units.concat(this._assemblies),this._buildMolecules(),this._complex.finalize({needAutoBonding:!1,detectAromaticLoops:!1,enableEditing:!1,serialAtomMap:this._serialAtomMap})}defineFormat(e){let t;return mW.test(e)?t=O2.SDF:t=O2.MOL,t}parseSync(){const e=this._complex=new lW,t=new aW(this._data);this._format=this.defineFormat(this._data),e.metadata.format=this._format;do this._parseCompound(t);while(t.findNextCompoundStart());return this._finalize(),e}};yA.formats=["mol","sdf"];yA.extensions=[".mol",".sdf"];var SW={nstart:[Ln.array,"i16",0],extent:[Ln.array,"i16",3],grid:[Ln.array,"i16",6],cellDims:[Ln.vector,"i16",9],angles:[Ln.array,"i16",12],div:[Ln.singular,"i16",15],adder:[Ln.singular,"i16",16],scaleFactor:[Ln.singular,"i16",17]},bW=class extends GN{_parseHeader(e){this._buff=e,this._typedCheck();const t={};if(t.i16=new Int16Array(this._buff),t.i16[18]!==100)for(let i=0,r=t.i16.length;i<r;++i){const s=t.i16[i];t.i16[i]=(s&255)<<8|s>>8&255}if(t.i16[18]!==100)throw new Error("DSN6: Incorrect format ");const n=this._header;this._fillHeader(SW,t),n.cellDims.multiplyScalar(1/n.scaleFactor),n.angles.forEach((i,r,s)=>{s[r]*=Math.PI/180/n.scaleFactor}),n.div/=100}_setAxisIndices(){this._xyz2crs[0]=0,this._xyz2crs[1]=1,this._xyz2crs[2]=2}_setOrigins(){const e=this._header,[t,n,i]=this._getAxis();this._setAxisIndices(),this._origin.addScaledVector(t,e.nstart[0]),this._origin.addScaledVector(n,e.nstart[1]),this._origin.addScaledVector(i,e.nstart[2]),t.multiplyScalar(e.extent[0]),n.multiplyScalar(e.extent[1]),i.multiplyScalar(e.extent[2]),this._setBoxParams(t,n,i)}_pointCalculate(e,t,n,i,r,s,a){const c=this._header;if(r<c.extent[0]&&i<c.extent[1]&&n<c.extent[2]){const u=r+c.extent[0]*(i+c.extent[1]*n);e[u]=(t[s.counter]-c.adder)/c.div,++s.counter}else return s.counter+=8-a,!1;return!0}_blockCalculate(e,t,n,i,r,s){for(let a=0;a<8;++a){const c=8*n+a;for(let u=0;u<8;++u){const d=8*i+u;let p=!0,g=0;for(;p&&g<8;){const v=8*r+g;p=this._pointCalculate(e,t,c,d,v,s,g),g++}}}}_toXYZData(){const e=this._header,t=new Uint8Array(this._buff),n=new Float32Array(e.extent[0]*e.extent[1]*e.extent[2]),i=new R.Vector3(e.extent[0]/8,e.extent[1]/8,e.extent[2]/8),r={};r.counter=512;for(let s=0;s<i.z;++s)for(let a=0;a<i.y;++a)for(let c=0;c<i.x;++c)this._blockCalculate(n,t,s,a,c,r);return this._calculateInfoParams(n),n}_calculateInfoParams(e){this._header.dmean/=e.length;let t=0,n=e[0],i=e[0];for(let r=0;r<e.length;r++)t+=(this._header.dmean-e[r])**2,e[r]<n&&(n=e[r]),e[r]>i&&(i=e[r]);this._header.sd=Math.sqrt(t/e.length),this._header.dmax=i,this._header.dmin=n}},SS=class extends Qs{constructor(e,t){super(e,t),this._options.fileType="dsn6",this.model=new bW}static canParse(e,t){return e?e instanceof ArrayBuffer&&Qs.checkDataTypeOptions(t,"dsn6"):!1}static canProbablyParse(e){return!1}parseSync(){return this.model.parse(this._data)}};SS.formats=["dsn6"];SS.extensions=[".dsn6",".omap"];SS.binary=!0;var MW=SS,wW=class extends FN{constructor(e){super(e),this._next=-1,this.next()}getNext(){return this._next}},AW=wW,{Complex:EW,Element:WC,Molecule:TW}=nr,xA=class extends Qs{constructor(e,t){super(e,t),this._time=null,this._numAtoms=null,this._residueNumber=null,this._residueName="",this._atomName="",this._atomNumber=null,this._atomPosition=[],this._atomVelocity=[],this._complex=null,this._molecules=[],this._molecule=null,this._options.filetype="gro"}canProbablyParse(e){return We.default.isString(this._data)&&/^\s*[^\n]*\n\s*\d+ *\n\s*\d+[^\n\d]{3}\s*\w+\s*\d+\s*-?\d/.test(e)}_parseTitle(e){const{metadata:t}=this._complex;t.id=e.readLine().trim(),t.name=t.id.slice(t.id.lastIndexOf("\\")+1,t.id.lastIndexOf(".")),t.format="gro"}_parseNumberOfAtoms(e){if(this._numAtoms=e.readInt(0,e.getNext()),Number.isNaN(this._numAtoms))throw new Error("Line 2 is not representing atom number. Consider checking input file")}_parseAtom(e){this._residueNumber=e.readInt(1,5),this._residueName=e.readString(6,10).trim(),this._atomName=e.readString(11,15).trim(),this._atomNumber=e.readInt(16,20);const t=e.readFloat(21,28)*10,n=e.readFloat(29,36)*10,i=e.readFloat(37,45)*10;if(Number.isNaN(t)||Number.isNaN(n)||Number.isNaN(i)){this._complex.error={message:`Atom position is invalid in "${e.readLine()}"`};return}const r=WC.getByName(this._atomName[0]);if(r.fullName==="Unknown"){this._complex.error={message:`${this._atomName[0]} hasn't been recognised as an atom name.`};return}const s=WC.Role[this._atomName];let a=this._chain;a||(this._chain=a=this._complex.addChain("A"));let c=this._residue;(!c||c.getSequence()!==this._residueNumber)&&(this._residue=c=a.addResidue(this._residueName,this._residueNumber," ")),this._atomPosition=new R.Vector3(t,n,i),c.addAtom(this._atomName,r,this._atomPosition,s,!0,this._atomNumber," ",1,1,0)}_finalize(){const e=new TW(this._complex,this._complex.metadata.name,1);e.residues=this._chain._residues,e._chains=this._chain,this._complex._molecules[0]=e,this._molecules.push(e),this._complex.finalize({needAutoBonding:!0,detectAromaticLoops:this.settings.now.aromatic,enableEditing:this.settings.now.editing,serialAtomMap:this._serialAtomMap})}parseSync(){const e=this._complex=new EW,t=new AW(this._data);let n=0;for(this._parseTitle(t),t.next(),this._parseNumberOfAtoms(t),t.next(),n=0;n<this._numAtoms&&!t.end();++n)this._parseAtom(t),t.next();if(n<this._numAtoms&&(this._complex.error={message:"File ended unexpectedly."}),e.error)throw new Error(e.error.message);return this._finalize(),this._atomPosition=null,this._complex=null,this._molecules=null,this._molecule=null,e}};xA.formats=["gro"];xA.extensions=[".gro"];var CW=xA,{Complex:RW,Element:XC,Bond:Yl,Molecule:LW}=nr,PW={un:0,1:1,2:2,3:3,ar:1,am:1,nc:0,du:1},NW={un:Yl.BondType.UNKNOWN,1:Yl.BondType.COVALENT,2:Yl.BondType.COVALENT,3:Yl.BondType.COVALENT,ar:Yl.BondType.AROMATIC,am:Yl.BondType.COVALENT,nc:Yl.BondType.UNKNOWN,du:Yl.BondType.COVALENT},IW=/\d+$/,HN=/\s+/;function jC(e){return e.trim().split(HN)}var SA=class extends Qs{constructor(e,t){super(e,t),this._complex=null,this._chain=null,this._residue=null,this._compoundIndx=-1,this._molecules=[],this._molecule=null,this._currPosIdx=0,this._currStartIdx=0,this._serialAtomMap={},this._options.fileType="mol2"}_parseRawStrings(e){return e.split(/\r?\n|\r/)}_toStringFromStart(e,t){const n=this._currStartIdx+e;this._currPosIdx=n<t.length?n:this._currStartIdx}_toHeaderString(e,t){for(this._toStringFromStart(0,t);this._currPosIdx<t.length;){if(t[this._currPosIdx].match(`@<TRIPOS>${e}`))return;this._currPosIdx++}this._toStringFromStart(0,t)}_toStringFromHeader(e,t,n){this._toHeaderString(e,n);const i=this._currPosIdx+t;n[this._currPosIdx].match(`@<TRIPOS>${e}`)&&i<n.length&&(this._currPosIdx=i)}_setStart(e,t){e>=t.length?this._currStartIdx=this._currPosIdx=t.length-1:this._currStartIdx=this._currPosIdx=e}_probablyHaveDataToParse(e){return this._currPosIdx<e.length-2}_findNextCompoundStart(e){for(;this._currPosIdx<e.length&&e[this._currPosIdx].trim()!=="@<TRIPOS>MOLECULE>";)this._currPosIdx++;return this._setStart(++this._currPosIdx,e),this._probablyHaveDataToParse(e)}_parseMolecule(e){this._toHeaderString("MOLECULE",e);const{metadata:t}=this._complex;t.name=e[++this._currPosIdx],t.format="mol2",this._molecule={_index:"",_chains:[]},this._molecule._index=this._compoundIndx+1,this._molecules.push(this._molecule)}_parseAtoms(e,t){this._toHeaderString("ATOM",t);for(let n=0;n<e;n++){const i=jC(t[++this._currPosIdx]);if(i.length<6)throw new Error("MOL2 parsing error: Not enough information to create atom!");const r=parseInt(i[0],10),s=i[1],a=parseFloat(i[2]),c=parseFloat(i[3]),u=parseFloat(i[4]),d=i[5].split(".")[0].toUpperCase();let p=0;i.length>=9&&(p=parseFloat(i[8])||0);let g=this._chain;if(g||(this._chain=g=this._complex.getChain("A")||this._complex.addChain("A"),this._residue=null),!this._setResidue(i))continue;const v=!1,y=" ",S=1,E=0,w=XC.getByName(d),b=XC.Role[s],T=new R.Vector3(a,c,u);this._residue.addAtom(s,w,T,b,v,r,y,S,E,p)}}_setResidue(e){let t=1,n="UNK";if(e.length>=7&&(t=parseInt(e[6],10)),e.length>=8&&e[7]!=="<0>"&&(n=e[7].replace(IW,"")),this.settings.now.nowater&&(n==="HOH"||n==="WAT"))return!1;const i=this._residue,r=this._chain;return(!i||i.getSequence()!==t)&&(this._residue=r.addResidue(n,t,"A")),!0}_parseBonds(e,t){this._toHeaderString("BOND",t);for(let n=0;n<e;n++){const i=jC(t[++this._currPosIdx]);if(i.length<3)throw new Error("MOL2 parsing error: Missing information about bonds!");let r=parseInt(i[1],10),s=parseInt(i[2],10);const a=i[3];r>s&&([r,s]=[s,r]),this._complex.addBond(r,s,PW[a]||0,NW[a]||Yl.BondType.UNKNOWN,!0)}}_fixSerialAtoms(){const e=this._complex._atoms;for(let t=0;t<e.length;t++){const n=e[t];this._serialAtomMap[n.serial]=n}}_fixBondsArray(){const e=this._serialAtomMap,t=this._complex;if(Object.keys(e).length===0)throw new Error("MOL2 parsing error: Missing atom information!");const n=t._bonds;for(let i=0;i<n.length;i++){const r=n[i];r._left=e[r._left]||null,r._right=e[r._right]||null}}_finalizeMolecules(){const e=this._complex._chains[0];this._complex._molecules=[];for(let t=0;t<this._molecules.length;t++){const n=this._molecules[t],i=e._residues,r=new LW(this._complex,n._name,t+1);r.residues=i,this._complex._molecules[t]=r}}_finalize(){this._complex._finalizeBonds(),this._fixSerialAtoms(),this._fixBondsArray(),this._finalizeMolecules(),this._complex.finalize({needAutoBonding:!1,detectAromaticLoops:this.settings.now.aromatic,enableEditing:this.settings.now.editing,serialAtomMap:this._serialAtomMap})}_parseCompound(e){this._compoundIndx++,this._parseMolecule(e),this._toStringFromHeader("MOLECULE",2,e);const t=e[this._currPosIdx].trim().split(HN),n=t[0],i=t[1];this._parseAtoms(n,e),this._parseBonds(i,e)}parseSync(){const e=this._complex=new RW,t=this._parseRawStrings(this._data);do this._parseCompound(t);while(this._findNextCompoundStart(t));return this._finalize(),e}};SA.formats=["mol2"];SA.extensions=[".mol2",".ml2",".sy2"];var OW=new iH([_H,qH,OH,iW,SH,oW,yA,QH,MW,CW,SA]),DW=class extends Af{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(e,["formats"])}find(e){let t=[];return e.format&&(t=this._dict.formats[e.format.toLowerCase()]||[]),[...t]}},zW=DW,bA=class{constructor(e,t){this._source=e,this._options=t||{},this._abort=!1}exportSync(){throw new Error("Exporting to this source is not implemented")}export(){return new Promise((e,t)=>{setTimeout(()=>{try{return this._abort?t(new Error("Export aborted")):e(this.exportSync())}catch(n){return t(n)}})})}abort(){this._abort=!0}};w0(bA.prototype);var UW=class{constructor(){this._resultArray=[],this._currentStr=-1,this._tag=null,this._fixedNumeration=!1,this._numeration=!1,this._tagStrNum=0}getResult(){return this.writeString(`
`,81,81),this._resultArray.join("")}_currentStrLength(){const e=this._resultArray[this._currentStr];return e?e.length:0}newTag(e,t){e?this._tag=e:this._tag=null,We.default.isUndefined(t)?(this._numeration=!1,this._fixedNumeration=!1,this._tagStrNum=0):We.default.isNumber(t)?(this._tagStrNum=t,this._numeration=!0,this._fixedNumeration=!0):We.default.isBoolean(t)&&(this._tagStrNum=0,this._numeration=t,this._fixedNumeration=!1)}newString(e){this.writeString(`
`,81,81),this._currentStr++,this._resultArray.push(""),e?this.writeString(e,1,6):this._tag&&this.writeString(this._tag,1,6),this._numeration&&(this._fixedNumeration||this._tagStrNum++,this._tagStrNum!==1&&this.writeString(this._tagStrNum.toString(),10,8))}writeEntireString(e,t,n){t||(t=81);for(let i=0;i<e.length;i++)this._currentStrLength()===t&&i!==e.length-1&&(this.newString(),n&&this.writeString(n.tag,n.begin,n.end)),e[i]===`
`?this.newString():this.writeString(e[i])}writeString(e,t,n){let i=this._resultArray[this._currentStr],r;const s=i?i.length:0;if(We.default.isUndefined(e))return;We.default.isNumber(t)||(t=s+1),We.default.isNumber(n)||(n=s+e.length),We.default.isString(e)?r=e:r=e.toString();const a=t<n?n:t,c=t<n?t:n;if(r.length>Math.abs(t-n)+1&&(r=r.substr(0,Math.abs(t-n+1))),c>s+1)this._resultArray[this._currentStr]+=" ".repeat(c-s-1);else if(c<=s){const u=this._resultArray[this._currentStr];this._resultArray[this._currentStr]=u.slice(0,c-1)}if(n<t){const u=t-n+1;r=" ".repeat(u-r.length)+r}c===11&&this._numeration&&this._tagStrNum!==1&&(r=` ${r}`),this._resultArray[this._currentStr]+=r,i=this._resultArray[this._currentStr],a>i.length&&(this._resultArray[this._currentStr]+=" ".repeat(a-i.length))}writeBondsArray(e,t){const n=this._getSubArrays(e,4);for(let i=0;i<n.length;i++){this.newString(),this.writeString(t.serial,11,7);for(let r=0;r<n[i].length;r++){const s=n[i][r]._left.serial===t.serial?n[i][r]._right.serial:n[i][r]._left.serial;this.writeString(s,16+5*r,12+5*r)}}}_getSubArrays(e,t){const n=[];for(let i=0;i<e.length;i+=t)n.push(e.slice(i,i+t));return n}writeMatrix(e,t,n){for(let i=0;i<3;i++){this.newString(),this.writeString(n,14,18),this.writeString((i+1).toString(),19,19),this.writeString(t.toString(),23,20);for(let s=0;s<3;s++){const a=parseFloat(e.elements[i*4+s]).toFixed(6);this.writeString(a.toString(),33+s*10,24+s*10)}const r=parseFloat(e.elements[i*4+3]).toFixed(5);this.writeString(r.toString(),68,55)}}writeMatrices(e,t){if(!e)return;const n=new R.Matrix4;for(let i=0;i<e.length;i++)n.copy(e[i]).transpose(),this.writeMatrix(n,i+1,t)}},MA=class extends bA{constructor(e,t){super(e,t),this._tags=["HEADER","TITLE","COMPND","REMARK","HELIX","SHEET","ATOM and HETATM","CONECT"],this._result=null,this._tagExtractors={HEADER:this._extractHEADER,TITLE:this._extractTITLE,"ATOM and HETATM":this._extractATOM,CONECT:this._extractCONECT,COMPND:this._extractCOMPND,REMARK:this._extractREMARK,HELIX:this._extractHELIX,SHEET:this._extractSHEET},this._stringForRemark350=`COORDINATES FOR A COMPLETE MULTIMER REPRESENTING THE KNOWN
BIOLOGICALLY SIGNIFICANT OLIGOMERIZATION STATE OF THE
MOLECULE CAN BE GENERATED BY APPLYING BIOMT TRANSFORMATIONS
GIVEN BELOW. BOTH NON-CRYSTALLOGRAPHIC AND
CRYSTALLOGRAPHIC OPERATIONS ARE GIVEN.`,this._stringForRemark290=`CRYSTALLOGRAPHIC SYMMETRY TRANSFORMATIONS
THE FOLLOWING TRANSFORMATIONS OPERATE ON THE ATOM/HETATM
RECORDS IN THIS ENTRY TO PRODUCE CRYSTALLOGRAPHICALLY
RELATED MOLECULES.`}exportSync(){const e=new UW;if(!this._source)return this._result;for(let t=0;t<this._tags.length;t++){const n=this._tags[t],i=this._tagExtractors[n];We.default.isFunction(i)&&i.call(this,e)}return this._result=e.getResult(),this._result}_extractHEADER(e){if(!this._source.metadata)return;const{metadata:t}=this._source;e.newTag("HEADER"),e.newString(),t.classification&&e.writeString(t.classification,11,50),t.date&&e.writeString(t.date,51,59),t.id&&e.writeString(t.id,63,66)}_extractTITLE(e){if(!this._source.metadata)return;const{metadata:t}=this._source;if(t.title){e.newTag("TITLE",!0);for(let n=0;n<t.title.length;n++)e.newString(),e.writeString(t.title[n],11,80)}}_extractCONECT(e){if(!this._source._atoms)return;const t=this._source._atoms;e.newTag("CONECT");for(let n=0;n<t.length;n++){const i=t[n].bonds.filter(r=>r._fixed);i.length!==0&&e.writeBondsArray(i.reverse(),t[n])}}_extractSHEET(e){if(!this._source._sheets)return;e.newTag("SHEET");const t=this._source._sheets;for(let n=0;n<t.length;n++)if(t[n]._strands){const i=t[n]._strands;for(let r=0;r<i.length;r++)e.newString(),e.writeString(r+1,10,8),e.writeString(t[n]._name,14,12),e.writeString(i.length,16,15),e.writeString(i[r].init._type._name,18,20),e.writeString(i[r].init._chain._name,22,22),e.writeString(i[r].init._sequence,26,23),e.writeString(i[r].init._icode,27,27),e.writeString(i[r].term._type._name,29,31),e.writeString(i[r].init._chain._name,33,33),e.writeString(i[r].term._sequence,37,34),e.writeString(i[r].term._icode,38,38),e.writeString(i[r].sense,40,39)}}_extractHELIX(e){if(!this._source._helices)return;e.newTag("HELIX");const t=this._source._helices;for(let n=0;n<t.length;n++){const i=t[n],r=We.default.invert(PP);e.newString(),e.writeString(i.serial,10,8),e.writeString(i.name,14,12),e.writeString(i.init._type._name,16,18),e.writeString(i.init._chain._name,20,20),e.writeString(i.init._sequence,25,22),e.writeString(i.init._icode,26,26),e.writeString(i.term._type._name,28,30),e.writeString(i.term._chain._name,32,32),e.writeString(i.term._sequence,37,34),e.writeString(i.term._icode,38,38),e.writeString(r[i.type],40,39),e.writeString(i.comment,41,70),e.writeString(i.length,76,72)}}_extractATOM(e){if(!this._source._atoms)return;const t=this._source._atoms;for(let n=0;n<t.length;n++){const i=t[n].het?"HETATM":"ATOM";e.newString(i);const r=t[n].element.name.length>1||t[n].name.length>3?13:14;e.writeString(t[n].serial,11,7),e.writeString(t[n].name,r,16),e.writeString(String.fromCharCode(t[n].location),17,17),e.writeString(t[n].residue._type._name,20,18),e.writeString(t[n].residue._chain._name,22,22),e.writeString(t[n].residue._sequence,26,23),e.writeString(t[n].residue._icode,27,27),e.writeString(t[n].position.x.toFixed(3),38,31),e.writeString(t[n].position.y.toFixed(3),46,39),e.writeString(t[n].position.z.toFixed(3),54,47),e.writeString(t[n].occupancy.toFixed(2),60,55),e.writeString(t[n].temperature.toFixed(2),66,61),e.writeString(t[n].element.name,78,77),t[n].charge&&e.writeString(t[n].charge,79,80)}}_extractCOMPND(e){if(!this._source._molecules)return;const t=this._source._molecules;e.newTag("COMPND",!0);for(let n=0;n<t.length;n++){const i=this._getMoleculeChains(t[n]);e.newString(),e.writeString(`MOL_ID: ${t[n].index};`,11,80),e.newString(),e.writeString(`MOLECULE: ${t[n].name};`,11,80),e.newString(),e.writeString("CHAIN: ",11,18);const r=`${i.join(", ")};`;e.writeEntireString(r,81)}}_extractREMARK(e){this._Remark290(e),this._Remark350(e)}_Remark290(e){if(this._source.symmetry&&this._source.symmetry.length!==0){const t=this._source.symmetry;e.newTag("REMARK",290),e.newString(),e.newString(),e.writeEntireString(this._stringForRemark290),e.writeMatrices(t,"SMTRY"),e.newString(),e.newString(),e.writeString("REMARK: NULL",11,80)}}_Remark350(e){if(!this._source.units)return;const{units:t}=this._source;let n=0;e.newTag("REMARK",350),e.newString(),e.newString(),e.writeEntireString(this._stringForRemark350);const i=t.filter(r=>r instanceof Jw);for(let r=0;r<i.length;r++){e.newString(),e.newString(),n++,e.writeString(`BIOMOLECULE: ${n}`,11,80);const s=i[r].chains.join(", ");e.newString(),e.writeString("APPLY THE FOLLOWING TO CHAINS: "),e.writeEntireString(s,69,{tag:"AND CHAINS: ",begin:31,end:42});const{matrices:a}=i[r];e.writeMatrices(a,"BIOMT")}}_getMoleculeChains(e){function t(i){return i._chain._name}const n=e.residues.map(t);return n.filter((i,r)=>n.indexOf(i)===r)}};MA.formats=["pdb"];MA.SourceClass=iA;var Pp=3,P1=3,z2=4;function YC(e,t,n,i){n[i]=e[t],n[i+1]=e[t+1],n[i+2]=e[t+2]}function BW(e,t,n,i,r){n[i]=e[t],n[i+1]=e[t+1],n[i+2]=e[t+2],n[i+3]=r}var N1=new R.Vector4;function qC(e,t,n,i,r){N1.set(e[t],e[t+1],e[t+2],r.w),N1.applyMatrix4(r.matrix),n[i]=N1.x,n[i+1]=N1.y,n[i+2]=N1.z}function U2(e,t,n,i,r){if(!((t.array.length-t.start)/t.stride<n||(e.array.length-e.start)/e.stride<n))if(e.stride===t.stride)t.array.set(e.array,t.start);else{let s=t.start,a=e.start;for(let c=0;c<n;++c,s+=t.stride,a+=e.stride)i(e.array,a,t.array,s,r)}}var B2=class{constructor(){this.positions=null,this.normals=null,this.colors=null,this.indices=null,this.lastPos=0,this.lastNorm=0,this.lastCol=0,this.lastIdx=0}init(e,t){this.positions=new Float32Array(e*Pp),this.normals=new Float32Array(e*P1),this.colors=new Float32Array(e*z2),this.indices=new Int32Array(t)}setPositions(e,t,n,i){U2({array:e,start:t,stride:i},{array:this.positions,start:this.lastPos,stride:Pp},n,YC),this.lastPos+=n*Pp}setTransformedPositions(e,t,n,i,r){let s=this.lastPos,a=t;const c={matrix:r,w:1};for(let u=0;u<n;++u,a+=i,s+=Pp)qC(e,a,this.positions,s,c);this.lastPos+=n*Pp}setNormals(e,t,n,i){U2({array:e,start:t,stride:i},{array:this.normals,start:this.lastNorm,stride:P1},n,YC),this.lastNorm+=n*P1}setTransformedNormals(e,t,n,i,r){let s=this.lastNorm,a=t;const c={matrix:r,w:0};for(let u=0;u<n;++u,a+=i,s+=P1)qC(e,a,this.normals,s,c);this.lastNorm+=n*P1}setColors(e,t,n,i){U2({array:e,start:t,stride:i},{array:this.colors,start:this.lastCol,stride:z2},n,BW,1),this.lastCol+=n*z2}setIndices(e,t,n){this.indices.set(e,this.lastIdx),this.lastIdx+=n}setShiftedIndices(e,t,n){const i=e.map(r=>r+n);this.setIndices(i,0,t)}getVerticesNumber(){return this.lastPos/Pp}addInstance(e,t){const n=this.getVerticesNumber();this.setShiftedIndices(t.indices,t.indices.length,n);const i=t.itemSize;this.setTransformedPositions(t.positions,0,t.vertsCount,i.position,e),this.setTransformedNormals(t.normals,0,t.vertsCount,i.normal,e),this.setColors(t.colors,0,t.vertsCount,i.color)}},WN=class{constructor(){this.positions=null,this.normals=null,this.colors=null,this.indices=null,this.vertsCount=0,this.itemSize=null}init(e,t){const{attributes:n}=e;this.itemSize={position:n.position.itemSize,normal:n.normal.itemSize,color:n.color.itemSize}}},$C=class extends WN{init(e,t){super.init(e,t);const{attributes:{position:n,normal:i},index:r}=e;this.vertsCount=n.count,this.positions=n.array,this.normals=i.array,this.colors=new Float32Array(this.vertsCount*this.itemSize.color),this.indices=r.array}setColors(e){let t=0;for(let n=0,i=this.colors.length,r=this.itemSize.color;n<i;n+=r)this.colors[t++]=e.r,this.colors[t++]=e.g,this.colors[t++]=e.b}},VW=class extends WN{constructor(){super(),this._cutRawStart=0,this._cutRawEnd=0,this._facesPerSlice=0}init(e,t){super.init(e,t);const{attributes:{position:n},index:i}=e;this.vertsCount=n.count+t.addPerCylinder,this._facesPerSlice=t.addPerCylinder,this.positions=new Float32Array(this.vertsCount*n.itemSize),this.normals=new Float32Array(this.vertsCount*this.itemSize.normal),this.colors=new Float32Array(this.vertsCount*this.itemSize.color),this._extendVertices(e,t),this.indices=new Uint32Array(i.count),this._extendIndices(e,t)}_extendVertices(e,t){const{position:n}=e.attributes,{normal:i}=e.attributes,r=e.getGeoParams(),s=1;this._cutRawStart=s*r.radialSegments,this._cutRawEnd=this._cutRawStart+t.addPerCylinder;{let a=n.array.slice(0,this._cutRawEnd*n.itemSize);this.positions.set(a,0),a=i.array.slice(0,this._cutRawEnd*i.itemSize),this.normals.set(a,0)}{let a=n.array.slice(this._cutRawStart*n.itemSize,n.array.length);this.positions.set(a,this._cutRawEnd*n.itemSize),a=i.array.slice(this._cutRawStart*i.itemSize,i.array.length),this.normals.set(a,this._cutRawEnd*i.itemSize)}}_extendIndices(e,t){const{index:n}=e,i=t.addPerCylinder*6,r=t.addPerCylinder;let s=n.array.slice(i,n.count);s=s.map(a=>a+r),this.indices.set(n.array,0),this.indices.set(s,i)}_setColorRange(e,t,n,i){const r=i.length;for(let s=e;s<t;s+=r)n.set(i,s)}setColors(e,t){const n=this.itemSize.color,i=this._cutRawEnd*n,r=i*2;if(this._setColorRange(0,i,this.colors,e.toArray()),this._setColorRange(i,r,this.colors,t.toArray()),r<this.colors.length){const s=(this._facesPerSlice+1)*n,a=r+s;this._setColorRange(r,a,this.colors,t.toArray());const c=a+s;this._setColorRange(a,c,this.colors,e.toArray())}}},FW=class{constructor(){this._materials=[],this._models=[]}process(e){this._extractModelsAndMaterials(e);const t=this._flattenModels();return{name:e.name,models:t,materials:this._materials}}_extractModelsAndMaterials(e){const t=new R.Layers;t.set(Xt.LAYERS.DEFAULT),t.enable(Xt.LAYERS.TRANSPARENT),e.traverse(n=>{n instanceof R.Mesh&&n.layers.test(t)&&this.checkExportAbility(n)&&(n.geometry.type==="InstancedBufferGeometry"?this._collectInstancedGeoInfo(n):this._collectGeoInfo(n))})}_reworkIndices(e){for(let n=2;n<e.length;n+=3)e[n]*=-1,e[n]--}_flattenModels(){let e=0;function t(i){return i+e}const n=[];for(let i=0,r=this._models.length;i<r;i++){const s=this._models[i];let a=[],c=[],u=[],d=[];e=0;for(let p=0;p<s.length;p++){const g=s[p];a.push(g.indices.map(t)),e+=g.getVerticesNumber(),c.push(g.positions),u.push(g.normals),d.push(g.colors)}a=rt.mergeTypedArraysUnsafe(a),this._reworkIndices(a),c=rt.mergeTypedArraysUnsafe(c),u=rt.mergeTypedArraysUnsafe(u),d=rt.mergeTypedArraysUnsafe(d),n.push({indices:a,positions:c,normals:u,colors:d,verticesCount:e})}return n}checkExportAbility(e){return e.geometry.attributes.position.count===0?!1:e instanceof fN?(Qi.warn("Currently we cannot export 'sprites' modes, like BS, WV, LC. Please turn of settings 'zSprites' and try again"),!1):e instanceof dN?(Qi.warn("Currently we cannot export Lines mode"),!1):!0}_collectGeoInfo(e){const{geometry:{attributes:{position:t,color:n,normal:i},index:r},matrix:s}=e,a=new B2,c=t.count;a.init(c,r.count),s.isIdentity()?(a.setPositions(t.array,0,c,t.itemSize),a.setNormals(i.array,0,c,i.itemSize)):(a.setTransformedPositions(t.array,0,c,t.itemSize,s),a.setTransformedNormals(i.array,0,c,i.itemSize,s)),a.setColors(n.array,0,c,n.itemSize),a.setIndices(r.array,0,r.count);const u=this._collectMaterialInfo(e);this._addToPool(a,u)}_collectSpheresInfo(e){const{geometry:{attributes:{position:t,color:n},index:i},matrix:r}=e,s=new B2,a=e.geometry.instanceCount,c=t.count,u=i.count;s.init(a*c,a*u);const d=new $C;d.init(e.geometry);const p=new R.Matrix4,g=new R.Matrix4,v=new R.Color;for(let S=0;S<a;++S){const E=S*n.itemSize;v.fromArray(n.array,E),d.setColors(v),this._getSphereInstanceMatrix(e.geometry,S,p),g.multiplyMatrices(r,p),s.addInstance(g,d)}const y=this._collectMaterialInfo(e);this._addToPool(s,y)}_collectCylindersInfo(e){const{geometry:{attributes:{position:t,color:n,color2:i},index:r},matrix:s}=e,a=new B2,c=e.geometry.instanceCount,u=new $C;u.init(e.geometry);const d=this._gatherCylindersColoringInfo(e.geometry);let p=null;d.needToSplit>0&&(p=new VW,p.init(e.geometry,d));const g=d.addPerCylinder*d.needToSplit,v=t.count,y=r.count;a.init(c*v+g,c*y);const S=new R.Matrix4,E=new R.Matrix4,w=new R.Color,b=new R.Color;let T={};for(let C=0;C<c;++C){const P=C*n.itemSize;d.is2Colored[C]?(w.fromArray(i.array,P),b.fromArray(n.array,P),p&&(p.setColors(w,b),T=p)):(w.fromArray(n.array,P),u.setColors(w),T=u),this._getCylinderInstanceMatrix(e.geometry,C,S),E.multiplyMatrices(s,S),a.addInstance(E,T)}const L=this._collectMaterialInfo(e);this._addToPool(a,L)}_addToPool(e,t){const n=this._checkExistingMaterial(t);n<0?(this._models.push([e]),this._materials.push(t)):this._models[n].push(e)}_checkExistingMaterial(e){return We.default.findIndex(this._materials,t=>We.default.isEqual(t,e))}_gatherCylindersColoringInfo(e){const t=e.instanceCount,n=e.attributes.color.array,i=e.attributes.color2.array,r=e.attributes.color.itemSize,s=new Array(t);let a=0,c=0;for(let d=0;d<t;d++,c+=r){const p=Math.abs(n[c]-i[c])>1e-7||Math.abs(n[c+1]-i[c+1])>1e-7||Math.abs(n[c+2]-i[c+2])>1e-7;s[d]=p,a+=p}const u=e.getGeoParams().radialSegments;return{is2Colored:s,needToSplit:a,addPerCylinder:u}}_collectInstancedGeoInfo(e){e.geometry instanceof qP?this._collectSpheresInfo(e):e.geometry instanceof KP&&this._collectCylindersInfo(e)}_collectMaterialInfo(e){const{uberOptions:t}=e.material;return{diffuse:t.diffuse.toArray(),opacity:t.opacity,shininess:t.shininess,specular:t.specular.toArray()}}_getCylinderInstanceMatrix(e,t,n){const i=e.attributes.matVector1.array,r=e.attributes.matVector2.array,s=e.attributes.matVector3.array,a=t*4;n.set(i[a],i[a+1],i[a+2],i[a+3],r[a],r[a+1],r[a+2],r[a+3],s[a],s[a+1],s[a+2],s[a+3],0,0,0,1)}_getSphereInstanceMatrix(e,t,n){const{offset:i}=e.attributes,r=t*i.itemSize,s=i.array[r],a=i.array[r+1],c=i.array[r+2],u=i.array[r+3];n.set(u,0,0,s,0,u,0,a,0,0,u,c,0,0,0,1)}},kW=`
Definitions: {
Version: 100
Count: 3
ObjectType: "Model" {
Count: 1
}
ObjectType: "Geometry" {
Count: 1
}
ObjectType: "Material" {
Count: 1
}
ObjectType: "Pose" {
Count: 1
}
ObjectType: "GlobalSettings" {
Count: 1
}
} `,GW=`Properties60: {
Property: "QuaternionInterpolate", "bool", "",0
Property: "Visibility", "Visibility", "A",1
Property: "Lcl Translation", "Lcl Translation", "A",0.000000000000000,0.000000000000000,-1789.238037109375000
Property: "Lcl Rotation", "Lcl Rotation", "A",0.000009334667643,-0.000000000000000,0.000000000000000
Property: "Lcl Scaling", "Lcl Scaling", "A",1.000000000000000,1.000000000000000,1.000000000000000
Property: "RotationOffset", "Vector3D", "",0,0,0
Property: "RotationPivot", "Vector3D", "",0,0,0
Property: "ScalingOffset", "Vector3D", "",0,0,0
Property: "ScalingPivot", "Vector3D", "",0,0,0
Property: "TranslationActive", "bool", "",0
Property: "TranslationMin", "Vector3D", "",0,0,0
Property: "TranslationMax", "Vector3D", "",0,0,0
Property: "TranslationMinX", "bool", "",0
Property: "TranslationMinY", "bool", "",0
Property: "TranslationMinZ", "bool", "",0
Property: "TranslationMaxX", "bool", "",0
Property: "TranslationMaxY", "bool", "",0
Property: "TranslationMaxZ", "bool", "",0
Property: "RotationOrder", "enum", "",0
Property: "RotationSpaceForLimitOnly", "bool", "",0
Property: "AxisLen", "double", "",10
Property: "PreRotation", "Vector3D", "",0,0,0
Property: "PostRotation", "Vector3D", "",0,0,0
Property: "RotationActive", "bool", "",0
Property: "RotationMin", "Vector3D", "",0,0,0
Property: "RotationMax", "Vector3D", "",0,0,0
Property: "RotationMinX", "bool", "",0
Property: "RotationMinY", "bool", "",0
Property: "RotationMinZ", "bool", "",0
Property: "RotationMaxX", "bool", "",0
Property: "RotationMaxY", "bool", "",0
Property: "RotationMaxZ", "bool", "",0
Property: "RotationStiffnessX", "double", "",0
Property: "RotationStiffnessY", "double", "",0
Property: "RotationStiffnessZ", "double", "",0
Property: "MinDampRangeX", "double", "",0
Property: "MinDampRangeY", "double", "",0
Property: "MinDampRangeZ", "double", "",0
Property: "MaxDampRangeX", "double", "",0
Property: "MaxDampRangeY", "double", "",0
Property: "MaxDampRangeZ", "double", "",0
Property: "MinDampStrengthX", "double", "",0
Property: "MinDampStrengthY", "double", "",0
Property: "MinDampStrengthZ", "double", "",0
Property: "MaxDampStrengthX", "double", "",0
Property: "MaxDampStrengthY", "double", "",0
Property: "MaxDampStrengthZ", "double", "",0
Property: "PreferedAngleX", "double", "",0
Property: "PreferedAngleY", "double", "",0
Property: "PreferedAngleZ", "double", "",0
Property: "InheritType", "enum", "",0
Property: "ScalingActive", "bool", "",0
Property: "ScalingMin", "Vector3D", "",1,1,1
Property: "ScalingMax", "Vector3D", "",1,1,1
Property: "ScalingMinX", "bool", "",0
Property: "ScalingMinY", "bool", "",0
Property: "ScalingMinZ", "bool", "",0
Property: "ScalingMaxX", "bool", "",0
Property: "ScalingMaxY", "bool", "",0
Property: "ScalingMaxZ", "bool", "",0
Property: "GeometricTranslation", "Vector3D", "",0,0,0
Property: "GeometricRotation", "Vector3D", "",0,0,0
Property: "GeometricScaling", "Vector3D", "",1,1,1
Property: "LookAtProperty", "object", ""
Property: "UpVectorProperty", "object", ""
Property: "Show", "bool", "",1
Property: "NegativePercentShapeSupport", "bool", "",1
Property: "DefaultAttributeIndex", "int", "",0
Property: "Color", "Color", "A+",0,0,0
Property: "Size", "double", "",100
Property: "Look", "enum", "",1
}`,HW=`
LayerElementMaterial: 0 {
Version: 101
Name: ""
MappingInformationType: "AllSame"
ReferenceInformationType: "Direct"
Materials: 0
}`,WW=`
Layer: 0 {
Version: 100
LayerElement: {
Type: "LayerElementNormal"
TypedIndex: 0
}
LayerElement: {
Type: "LayerElementColor"
TypedIndex: 0
}
LayerElement: {
Type: "LayerElementMaterial"
TypedIndex: 0
}
}`,XW=`GlobalSettings: {
Version: 1000
Properties60: {
Property: "UpAxis", "int", "",1
Property: "UpAxisSign", "int", "",1
Property: "FrontAxis", "int", "",2
Property: "FrontAxisSign", "int", "",1
Property: "CoordAxis", "int", "",0
Property: "CoordAxisSign", "int", "",1
Property: "UnitScaleFactor", "double", "",1
}
}`,jW=class{constructor(){this._resultArray=[],this._info=null}getResult(e){return this._info=e,this._resultArray.push(this._writeHeader()),this._resultArray.push(this._writeDefinitions()),this._resultArray.push(this._writeObjects(e.models,e.materials)),this._resultArray.push(this._writeRelations()),this._resultArray.push(this._writeConnections()),this._info=null,this._resultArray.join("")}_writeHeader(){const n=new Date,i=1e3,r=`Miew FBX Exporter v${this._info.version}`;return`; FBX 6.1.0 project file
; Created by ${r} Copyright (c) 2015-2024 EPAM Systems, Inc.
; For support please contact miew@epam.com
; ----------------------------------------------------
FBXHeaderExtension: {
FBXHeaderVersion: 1003
FBXVersion: 6100
CreationTimeStamp: {
Version: ${i}
Year: ${n.getFullYear()}
Month: ${n.getMonth()+1}
Day: ${n.getDate()}
Hour: ${n.getHours()}
Minute: ${n.getMinutes()}
Second: ${n.getSeconds()}
Millisecond: ${n.getMilliseconds()}
}
Creator: "${r}"
OtherFlags: {
FlagPLE: 0
}
}
CreationTime: "${n}"
Creator: "${r}"
`}_writeDefinitions(){return`
; Object definitions
;------------------------------------------------------------------
${kW}
`}_models(){let t="";const{models:n}=this._info;for(let i=0;i<n.length;++i){const r=n[i],s=r.verticesCount;t+=`
Model: "Model::${this._info.name}_${i}", "Mesh" {
Version: 232
${GW}
${this._verticesIndices(r.positions,r.indices)}
${this._normalLayer(r.normals)}
${this._colorLayer(r.colors,s)}
${HW}
${WW}
}`}return t}_materials(){let t="";const{materials:n}=this._info;for(let i=0;i<n.length;++i){const r=n[i];t+=`
Material: "Material::${this._info.name}_${i}_default", "" {
Version: 102
ShadingModel: "lambert"
MultiLayer: 0
${this._materialProperties(r)}
}`}return t}_writeObjects(){return`
; Object properties
;------------------------------------------------------------------
Objects: {
${this._models()}
${this._materials()}
${XW}
}
`}_writeRelations(){let e="";for(let n=0;n<this._info.models.length;++n)e+=`
Model: "Model::${this._info.name}_${n}", "Mesh" {
}`;let t="";for(let n=0;n<this._info.materials.length;++n)t+=`
Material: "Material::${this._info.name}_${n}_default", "" {
}`;return`
; Object relations
;------------------------------------------------------------------
Relations: {
${e}
Model: "Model::Producer Perspective", "Camera" {
}
Model: "Model::Producer Top", "Camera" {
}
Model: "Model::Producer Bottom", "Camera" {
}
Model: "Model::Producer Front", "Camera" {
}
Model: "Model::Producer Back", "Camera" {
}
Model: "Model::Producer Right", "Camera" {
}
Model: "Model::Producer Left", "Camera" {
}
Model: "Model::Camera Switcher", "CameraSwitcher" {
}
${t}
}`}_writeConnections(){let e="";const{name:t}=this._info;for(let i=0;i<this._info.models.length;++i)e+=`
Connect: "OO", "Model::${t}_${i}", "Model::Scene"`;let n="";for(let i=0;i<this._info.materials.length;++i)n+=`
Connect: "OO", "Material::${t}_${i}_default", "Model::${t}_${i}"`;return`
; Object connections
;------------------------------------------------------------------
Connections: {
${e}
${n}
}`}_floatArrayToString(e){const t=[];for(let n=0;n<e.length;++n)t[n]=e[n].toFixed(6);return t.join(",")}_colorLayer(e,t){return`
LayerElementColor: 0 {
Version: 101
Name: ""
MappingInformationType: "ByVertice"
ReferenceInformationType: "Direct"
Colors: ${this._floatArrayToString(e)}
ColorIndex: ${[...Array(t).keys()]}
}`}_normalLayer(e){return`
LayerElementNormal: 0 {
Version: 101
Name: ""
MappingInformationType: "ByVertice"
ReferenceInformationType: "Direct"
Normals: ${this._floatArrayToString(e)}
}`}_verticesIndices(e,t){return`MultiLayer: 0
MultiTake: 1
Shading: Y
Culling: "CullingOff"
Vertices: ${this._floatArrayToString(e)}
PolygonVertexIndex: ${t}
GeometryVersion: 124`}_materialProperties(e){return`Properties60: {
Property: "ShadingModel", "KString", "", "Lambert"
Property: "MultiLayer", "bool", "",0
Property: "EmissiveColor", "ColorRGB", "",0,0,0
Property: "EmissiveFactor", "double", "",0.0000
Property: "AmbientColor", "ColorRGB", "",1,1,1
Property: "AmbientFactor", "double", "",0.0000
Property: "DiffuseColor", "ColorRGB", "",${e.diffuse}
Property: "DiffuseFactor", "double", "",1.0000
Property: "Bump", "Vector3D", "",0,0,0
Property: "TransparentColor", "ColorRGB", "",1,1,1
Property: "TransparencyFactor", "double", "",0.0000
Property: "SpecularColor", "ColorRGB", "",${e.specular}
Property: "SpecularFactor", "double", "",1.0000
Property: "ShininessExponent", "double", "",${e.shininess}
Property: "ReflectionColor", "ColorRGB", "",0,0,0
Property: "ReflectionFactor", "double", "",1
Property: "Ambient", "ColorRGB", "",1,1,1
Property: "Diffuse", "ColorRGB", "",${e.diffuse}
Property: "Specular", "ColorRGB", "",${e.specular}
Property: "Shininess", "double", "",${e.shininess}
Property: "Opacity", "double", "",${e.opacity}
Property: "Reflectivity", "double", "",0
}`}},wA=class extends bA{constructor(e,t){super(e,t),this._data=e,this._version=t.miewVersion||"0.0-UNSPECIFIED",this._extractor=new FW}exportSync(){const e=new jW;if(!this._source)return this._result;const t=this._extractor.process(this._data);return t.version=this._version,this._result=e.getResult(t),this._result}};wA.formats=["fbx"];wA.SourceClass=ec;var wu={loaders:tH,parsers:OW,exporters:new zW([MA,wA])},I1=new R.Color,YW=class{constructor(){this._width=0,this._height=0,this._widthHalf=0,this._heightHalf=0,this._vector=new R.Vector3,this._viewMatrix=new R.Matrix4,this._projectionMatrix=new R.Matrix4,this._domElement=document.createElement("div"),this._domElement.style.overflow="hidden",this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.zIndex="0",this._domElement.style.pointerEvents="none"}getElement(){return this._domElement}reset(){const e=this.getElement();for(;e.firstChild;)e.removeChild(e.firstChild)}setSize(e,t){this._width=e,this._height=t,this._widthHalf=this._width/2,this._heightHalf=this._height/2,this._domElement.style.width=`${e}px`,this._domElement.style.height=`${t}px`}_renderObject(e,t,n){function i(s,a,c){return I1.setHex(s),I1.lerp(a,c),`#${I1.getHexString()}`}function r(s){return I1.setHex(s),`#${I1.getHexString()}`}if(e instanceof rA){if(this._vector.setFromMatrixPosition(e.matrixWorld),e.userData!==void 0&&e.userData.offset!==void 0){const d=new R.Vector3(e.userData.offset.x,e.userData.offset.y,0);this._vector.add(d.multiplyScalar(e.matrixWorld.getMaxScaleOnAxis()))}this._vector.applyMatrix4(this._viewMatrix);const s=this._vector.z>-t.near?"hidden":"visible",a=1e4*(t.far- -this._vector.z)/(t.far-t.near),c=e.getElement();if(typeof n.fog>"u")c.style.color=r(e.userData.color),e.userData.background!=="transparent"&&(c.style.background=r(e.userData.background));else{const d=R.MathUtils.smoothstep(-this._vector.z,n.fog.near,n.fog.far);c.style.color=i(e.userData.color,n.fog.color,d),e.userData.background!=="transparent"&&(c.style.background=i(e.userData.background,n.fog.color,d))}this._vector.applyMatrix4(this._projectionMatrix);const u=`${e.userData!=={}?e.userData.translation:"translate(-50%, -50%) "}translate(${this._vector.x*this._widthHalf+this._widthHalf}px,${-this._vector.y*this._heightHalf+this._heightHalf}px)`;c.style.visibility=s,c.style.WebkitTransform=u,c.style.MozTransform=u,c.style.oTransform=u,c.style.transform=u,c.style.zIndex=Number(a).toFixed(0),c.parentNode!==this._domElement&&this._domElement.appendChild(c)}for(let s=0,a=e.children.length;s<a;s++)this._renderObject(e.children[s],t,n)}render(e,t){e.updateMatrixWorld(),t.parent===null&&t.updateMatrixWorld(),t.matrixWorldInverse.copy(t.matrixWorld).invert(),this._viewMatrix.copy(t.matrixWorldInverse),this._projectionMatrix.copy(t.projectionMatrix),this._renderObject(e,t,e)}},qW=YW;function XN(){try{if(window.top.location.href!==void 0)return window.top}catch{}return window}var AA=37,EA=38,TA=39,CA=40,ni={NONE:-1,ROTATE:0,TRANSLATE:1,SCALE:2,TRANSLATE_PIVOT:3},$W=.1,xM=new R.Quaternion,yu=new R.Matrix4;function tc(e,t,n,i){this.objects=e,[this.object]=e,this.camera=t,this.pivot=n,this.axis=new R.Vector3(0,0,1),this.options=i,this.lastRotation={axis:new R.Vector3,angle:0}}tc.prototype._rotate=(function(){const e=new R.Vector3,t=new R.Quaternion,n=new R.Vector3,i=new R.Matrix4;return function(r){const s=this.pivot.x===0&&this.pivot.y===0&&this.pivot.z===0;if(i.copy(this.object.matrix),s?i.multiply(yu.makeRotationFromQuaternion(r)):(i.multiply(yu.makeTranslation(this.pivot.x,this.pivot.y,this.pivot.z)),i.multiply(yu.makeRotationFromQuaternion(r)),i.multiply(yu.makeTranslation(-this.pivot.x,-this.pivot.y,-this.pivot.z))),i.decompose(e,t,n),!s)for(let a=0;a<this.objects.length;++a)this.objects[a].position.copy(e);for(let a=0;a<this.objects.length;++a)this.objects[a].quaternion.copy(t),this.objects[a].updateMatrix()}})();tc.prototype.setObjects=function(e){this.objects=e,[this.object]=e};tc.prototype.rotate=(function(){const e={axis:new R.Vector3,angle:0};return function(t,n,i,r){this.mouse2rotation(e,n,i,r),t.setFromAxisAngle(e.axis,e.angle),e.angle&&this._rotate(t),this.lastRotation=e}})();tc.prototype.translate=(function(){const e=new R.Vector3,t=new R.Vector3;return function(n){e.set(n.x/this.camera.projectionMatrix.elements[0],n.y/this.camera.projectionMatrix.elements[5],0);let i=e.length();e.normalize(),e.transformDirection(yu.copy(this.object.matrixWorld).invert()),t.copy(this.pivot),this.object.localToWorld(t),i*=Math.abs(t.z-this.camera.position.z),i/=this.object.matrixWorld.getMaxScaleOnAxis();for(let r=0;r<this.objects.length;++r)this.objects[r].translateOnAxis(e,i)}})();tc.prototype.update=(function(){const e=new R.Vector3;return function(t,n){if(Pe.now.autoRotation!==0)return Pe.now.autoRotationAxisFixed||this.lastRotation.axis.length()===0?e.set(0,1,0).transformDirection(yu.copy(this.object.matrixWorld).invert()):e.copy(this.lastRotation.axis),this._rotate(xM.setFromAxisAngle(e,Pe.now.autoRotation*t)),!0;if(this.options.intertia&&this.lastRotation.angle){const i=this.lastRotation.angle*(1-this.options.dynamicDampingFactor)**(40*n);if(Math.abs(i)<=this.options.intertiaThreshold)this.lastRotation.angle=0;else return this._rotate(xM.setFromAxisAngle(this.lastRotation.axis,i)),!0}return!1}})();tc.prototype.stop=function(){this.lastRotation.angle=0};tc.prototype.mouse2rotation=(function(){const e=new R.Vector3,t=new R.Vector3,n=new R.Vector3,i=new R.Vector3,r=new R.Vector3,s=new R.Vector3,a=new R.Vector2;return function(c,u,d,p){if(p)c.axis.copy(this.axis),c.angle=this.options.axisRotateFactor*(d.y-u.y);else{a.subVectors(d,u);const g=a.length();if(g===0)return;e.copy(this.pivot),this.object.localToWorld(e),t.subVectors(this.camera.position,e),n.copy(t).normalize(),i.copy(this.camera.up).normalize(),r.crossVectors(i,n).normalize(),i.setLength(a.y),r.setLength(a.x),s.copy(i.add(r)),c.axis.crossVectors(s,t),c.angle=-g*this.options.rotateFactor}c.axis.transformDirection(yu.copy(this.object.matrixWorld).invert()),c.angle<0&&(c.axis.negate(),c.angle=-c.angle)}})();function pn(e,t,n,i,r){eo.call(this);const s=this;this.object=e,this.objectPivot=t,this.camera=n,this.domElement=typeof i<"u"?i:document,this.getAltObj=r,this.enabled=!0,this.hotkeysEnabled=!0,this.screen={left:0,top:0,width:0,height:0},this.options={rotateFactor:Math.PI,axisRotateFactor:4*Math.PI,intertia:!0,dynamicDampingFactor:.1,intertiaThreshold:.001},this._state=ni.NONE,this._mousePrevPos=new R.Vector2,this._mouseCurPos=new R.Vector2,this._mainObj=new tc([this.object],this.camera,new R.Vector3(0,0,0),this.options),this._altObj=new tc([this.object],this.camera,new R.Vector3(0,0,0),this.options),this._affectedObj=this._mainObj,this._isAltObjFreeRotationAllowed=!0,this._isTranslationAllowed=!0,this._isKeysTranslatingObj=!1,this._pressedKeys=[],this._clock=new qx,this._clock.start(),this._lastUpdateTime=this._clock.getElapsedTime(),this._listeners=[{obj:s.domElement,type:"mousedown",handler(a){s.mousedown(a)}},{obj:s.domElement,type:"mouseup",handler(a){s.mouseup(a)}},{obj:s.domElement,type:"mousemove",handler(a){s.mousemove(a)}},{obj:s.domElement,type:"mousewheel",handler(a){s.mousewheel(a)}},{obj:s.domElement,type:"DOMMouseScroll",handler(a){s.mousewheel(a)}},{obj:s.domElement,type:"mouseout",handler(a){s.mouseup(a)}},{obj:s.domElement,type:"touchstart",handler(a){s.touchstartend(a)}},{obj:s.domElement,type:"touchend",handler(a){s.touchstartend(a)}},{obj:s.domElement,type:"touchmove",handler(a){s.touchmove(a)}},{obj:s.getKeyBindObject(),type:"keydown",handler(a){s.keydownup(a)}},{obj:s.getKeyBindObject(),type:"keyup",handler(a){s.keydownup(a)}},{obj:window,type:"resize",handler(){s.handleResize()}},{obj:window,type:"blur",handler(){s.resetKeys()}},{obj:s.domElement,type:"contextmenu",handler(a){s.contextmenu(a)}}];for(let a=0;a<this._listeners.length;a++){const c=this._listeners[a];c.obj.addEventListener(c.type,c.handler)}this.handleResize(),this.resetKeys(),this.update()}pn.prototype=Object.create(eo.prototype);pn.prototype.constructor=pn;pn.prototype.resetKeys=function(){this._pressedKeys[AA]=!1,this._pressedKeys[EA]=!1,this._pressedKeys[TA]=!1,this._pressedKeys[CA]=!1};pn.prototype.contextmenu=function(e){e.stopPropagation(),e.preventDefault()};pn.prototype.handleResize=function(){if(this.domElement===document)this.screen.left=0,this.screen.top=0,this.screen.width=window.innerWidth,this.screen.height=window.innerHeight;else{const e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}};pn.prototype.enable=function(e){this.enabled=e};pn.prototype.enableHotkeys=function(e){this.hotkeysEnabled=e};pn.prototype.allowTranslation=function(e){this._isTranslationAllowed=e};pn.prototype.allowAltObjFreeRotation=function(e){this._isAltObjFreeRotationAllowed=e};pn.prototype.keysTranslateObj=function(e){this._isKeysTranslatingObj=e};pn.prototype.isEditingAltObj=function(){return(this._state===ni.ROTATE||this._state===ni.TRANSLATE)&&this._affectedObj===this._altObj};pn.prototype.convertMouseToOnCircle=function(e,t,n){const i=Math.min(this.screen.width,this.screen.height);if(i===0){e.set(0,0);return}e.set((t-this.screen.width*.5-this.screen.left)/i,(.5*this.screen.height+this.screen.top-n)/i)};pn.prototype.convertMouseToViewport=function(e,t,n){if(this.screen.width===0||this.screen.height===0){e.set(0,0);return}e.set(2*(t-this.screen.width*.5-this.screen.left)/this.screen.width,2*(.5*this.screen.height+this.screen.top-n)/this.screen.height)};pn.prototype.stop=function(){this._mainObj.stop(),this._altObj.stop()};pn.prototype.rotateByMouse=(function(){const e=new R.Quaternion;return function(t){this._affectedObj.rotate(e,this._mousePrevPos,this._mouseCurPos,t),this.dispatchEvent({type:"change",action:"rotate",quaternion:e})}})();pn.prototype.rotate=function(e){this.object.quaternion.multiply(e),this.dispatchEvent({type:"change",action:"rotate",quaternion:e})};pn.prototype.getOrientation=function(){return this.object.quaternion};pn.prototype.setOrientation=function(e){this.object.quaternion.copy(e)};pn.prototype.translate=(function(){const e=new R.Vector2;return function(){e.subVectors(this._mouseCurPos,this._mousePrevPos),this._affectedObj.translate(e),this.dispatchEvent({type:"change",action:"translate"})}})();pn.prototype.getScale=function(){return this.object.scale.x};pn.prototype.setScale=function(e){this.object.scale.set(e,e,e)};pn.prototype.scale=function(e){e<=0||(this.setScale(this.object.scale.x*e),this.dispatchEvent({type:"change",action:"zoom",factor:e}))};pn.prototype.update=(function(){const e=new R.Vector2;return function(){const t=this._clock.getElapsedTime(),n=t-this._lastUpdateTime;if(this._state===ni.NONE){const i=t-this._lastMouseMoveTime;(this._mainObj.update(n,i)||this._altObj.update(n,i))&&this.dispatchEvent({type:"change",action:"auto"})}if(this._isKeysTranslatingObj){const i=Number(this._pressedKeys[TA])-Number(this._pressedKeys[AA]),r=Number(this._pressedKeys[EA])-Number(this._pressedKeys[CA]);if(i!==0||r!==0){const s=n,a=this.getAltObj();a.objects.length>0&&(this._altObj.setObjects(a.objects),this._altObj.pivot=a.pivot,"axis"in a?this._altObj.axis=a.axis.clone():this._altObj.axis.set(0,0,1),e.set(s*i,s*r),this._altObj.translate(e),this.dispatchEvent({type:"change",action:"translate"}))}}this._lastUpdateTime=t}})();pn.prototype.reset=function(){this._state=ni.NONE,this.object.quaternion.copy(xM.set(0,0,0,1))};pn.prototype.mousedown=function(e){if(!(this.enabled===!1||this._state!==ni.NONE)){if(e.preventDefault(),e.stopPropagation(),this._state===ni.NONE)if(e.button===0){this._affectedObj.stop();let t=!1;if(e.altKey){const n=this.getAltObj();t=n.objects.length>0,t&&(this._altObj.setObjects(n.objects),this._altObj.pivot=n.pivot,"axis"in n?this._altObj.axis=n.axis.clone():this._altObj.axis.set(0,0,1))}this._affectedObj=t?this._altObj:this._mainObj,this._state=t&&e.ctrlKey&&this._isTranslationAllowed?ni.TRANSLATE:ni.ROTATE}else e.button===2&&(this._state=ni.TRANSLATE_PIVOT);this._state===ni.ROTATE&&(this.convertMouseToOnCircle(this._mouseCurPos,e.pageX,e.pageY),this._mousePrevPos.copy(this._mouseCurPos)),(this._state===ni.TRANSLATE||this._state===ni.TRANSLATE_PIVOT)&&(this.convertMouseToViewport(this._mouseCurPos,e.pageX,e.pageY),this._mousePrevPos.copy(this._mouseCurPos))}};pn.prototype.mousemove=function(e){if(!(this.enabled===!1||this._state===ni.NONE))switch(e.preventDefault(),e.stopPropagation(),this._state){case ni.ROTATE:this._mousePrevPos.copy(this._mouseCurPos),this.convertMouseToOnCircle(this._mouseCurPos,e.pageX,e.pageY),this.rotateByMouse(e.altKey&&!this._isAltObjFreeRotationAllowed||e.shiftKey),this._lastMouseMoveTime=this._clock.getElapsedTime();break;case ni.TRANSLATE:this._mousePrevPos.copy(this._mouseCurPos),this.convertMouseToViewport(this._mouseCurPos,e.pageX,e.pageY),this.translate();break;case ni.TRANSLATE_PIVOT:this._mousePrevPos.copy(this._mouseCurPos),this.convertMouseToViewport(this._mouseCurPos,e.pageX,e.pageY),this.translatePivotByMouse();break;default:break}};pn.prototype.mousewheel=function(e){if(this.enabled===!1||!Pe.now.zooming||this._state!==ni.NONE||e.shiftKey)return;e.preventDefault();let t=0;e.wheelDelta?t=e.wheelDelta/40:e.detail&&(t=-e.detail/3);let n=1+t*.05;n=Math.max(n,.01),this.scale(n)};pn.prototype.mouseup=function(e){this.enabled===!1||this._state===ni.NONE||(e.preventDefault(),e.stopPropagation(),this._state=ni.NONE,this._clock.getElapsedTime()-this._lastMouseMoveTime>$W&&this._affectedObj.stop())};pn.prototype.touchstartend=function(e){if(this.enabled!==!1)switch(e.preventDefault(),e.stopPropagation(),e.touches.length){case 1:this._state=ni.ROTATE,this.convertMouseToOnCircle(this._mouseCurPos,e.touches[0].pageX,e.touches[0].pageY),this._mousePrevPos.copy(this._mouseCurPos);break;case 2:{this._mainObj.stop(),this._altObj.stop(),this._state=ni.SCALE;const t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY;this._touchDistanceCur=this._touchDistanceStart=Math.sqrt(t*t+n*n),this._scaleStart=this.object.scale.x;break}default:this._state=ni.NONE}};pn.prototype.touchmove=function(e){if(!(this.enabled===!1||this._state===ni.NONE))switch(e.preventDefault(),e.stopPropagation(),this._state){case ni.ROTATE:this._mousePrevPos.copy(this._mouseCurPos),this.convertMouseToOnCircle(this._mouseCurPos,e.touches[0].pageX,e.touches[0].pageY),this.rotateByMouse(!1),this._lastMouseMoveTime=this._clock.getElapsedTime();break;case ni.SCALE:if(Pe.now.zooming){const t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY;this._touchDistanceCur=Math.sqrt(t*t+n*n);const i=this._scaleStart*this._touchDistanceCur/this._touchDistanceStart/this.object.scale.x;this.scale(i)}break;default:}};pn.prototype.keydownup=function(e){if(!(this.enabled===!1||this.hotkeysEnabled===!1))switch(e.keyCode){case AA:case EA:case TA:case CA:this._pressedKeys[e.keyCode]=e.type==="keydown",e.preventDefault(),e.stopPropagation();break;default:}};pn.prototype.getKeyBindObject=function(){return XN()};pn.prototype.dispose=function(){for(let e=0;e<this._listeners.length;e++){const t=this._listeners[e];t.obj.removeEventListener(t.type,t.handler)}};pn.prototype.translatePivotByMouse=(function(){const e=new R.Vector2;return function(){e.subVectors(this._mouseCurPos,this._mousePrevPos),this.translatePivotInWorld(Pe.now.translationSpeed*e.x,Pe.now.translationSpeed*e.y,0)}})();pn.prototype.translatePivotInWorld=function(e,t,n){const i=this.objectPivot.position;i.applyMatrix4(this.object.matrixWorld),i.setX(i.x+e),i.setY(i.y+t),i.setZ(i.z+n),i.applyMatrix4(yu.copy(this.object.matrixWorld).invert()),this.dispatchEvent({type:"change",action:"translatePivot"})};pn.prototype.translatePivot=function(e,t,n){const i=this.objectPivot.position;i.setX(i.x+e),i.setY(i.y+t),i.setZ(i.z+n),this.dispatchEvent({type:"change",action:"translatePivot"})};pn.prototype.setPivot=function(e){this.objectPivot.position.copy(e),this.dispatchEvent({type:"change",action:"translatePivot"})};var ZW=pn;function Cs(e,t,n){eo.call(this);const i=this;this.gfxObj=e,this.camera=t,this.domElement=typeof n<"u"?n:document,this.screen={left:0,top:0,width:0,height:0},this._lastMousePos=new R.Vector2(0,0),this._mouseTotalDist=0,this._lastClickBeginTime=-1e3,this._lastClickPos=new R.Vector2(0,0),this._clickBeginTime=0,this._clock=new qx,this._clock.start(),this._listeners=[{obj:i.domElement,type:"mousedown",handler(r){i.mousedown(r)}},{obj:i.domElement,type:"mouseup",handler(r){i.mouseup(r)}},{obj:i.domElement,type:"mousemove",handler(r){i.mousemove(r)}},{obj:i.domElement,type:"touchstart",handler(r){i.touchstart(r)}},{obj:i.domElement,type:"touchend",handler(r){i.touchend(r)}},{obj:window,type:"resize",handler(){i.handleResize()}}];for(let r=0;r<this._listeners.length;r++){const s=this._listeners[r];s.obj.addEventListener(s.type,s.handler)}this.handleResize()}Cs.prototype=Object.create(eo.prototype);Cs.prototype.constructor=Cs;Cs.prototype.reset=function(){this.picked={},this.dispatchEvent({type:"newpick",obj:{}})};Cs.prototype.handleResize=function(){if(this.domElement===document)this.screen.left=0,this.screen.top=0,this.screen.width=window.innerWidth,this.screen.height=window.innerHeight;else{const e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}};Cs.prototype.pickObject=function(e){if(!this.gfxObj){this.picked={},this.dispatchEvent({type:"newpick",obj:{}});return}const{gfxObj:t}=this,n=new R.Raycaster;n.ray.origin.setFromMatrixPosition(this.camera.matrixWorld),n.ray.direction.set(e.x,e.y,.5).unproject(this.camera).sub(n.ray.origin).normalize();const i=Pe.now.draft.clipPlane&&this.clipPlaneValue?this.clipPlaneValue:1/0,r=Pe.now.fog&&this.fogFarValue?this.fogFarValue:1/0,s=n.intersectVisibleObject(t,this.camera,i,r);if(!s){this.picked={},this.dispatchEvent({type:"newpick",obj:{}});return}let a={};if(s.residue||s.atom){const c=s.residue||s.atom.residue;Pe.now.pick==="chain"?a={chain:c.getChain()}:Pe.now.pick==="molecule"?a={molecule:c.getMolecule()}:s.residue||Pe.now.pick==="residue"?a={residue:c}:s.atom&&(a={atom:s.atom})}this.picked=a,this.dispatchEvent({type:"newpick",obj:a})};Cs.prototype.getMouseInViewport=function(e,t){return new R.Vector2((e-this.screen.left)/this.screen.width*2-1,-(t-this.screen.top)/this.screen.height*2+1)};Cs.prototype.mousedown=function(e){e.preventDefault(),e.stopPropagation(),e.button===0&&(this._lastMousePos=this.getMouseInViewport(e.pageX,e.pageY),this._mouseTotalDist=0,this._clickBeginTime=this._clock.getElapsedTime())};Cs.prototype.mousemove=function(e){e.preventDefault(),e.stopPropagation();const t=this.getMouseInViewport(e.pageX,e.pageY);this._mouseTotalDist+=t.sub(this._lastMousePos).length()};Cs.prototype.mouseup=function(e){const t=this;if(e.preventDefault(),e.stopPropagation(),e.button===0&&this._mouseTotalDist<.01){const n=this._clock.getElapsedTime(),i=this.getMouseInViewport(e.pageX,e.pageY);if(n-this._lastClickBeginTime<.7&&new R.Vector2().subVectors(i,this._lastClickPos).length()<.01){this.dispatchEvent({type:"dblclick",obj:this.picked}),this._lastClickPos=i,this._lastClickBeginTime=-1e3;return}setTimeout(()=>{t.pickObject(i)},0),this._lastClickPos=i,this._lastClickBeginTime=this._clickBeginTime}};Cs.prototype.touchstart=function(e){e.preventDefault(),e.stopPropagation(),e.touches.length===1&&(this._lastTouchdownPos=this.getMouseInViewport(e.touches[0].pageX,e.touches[0].pageY))};Cs.prototype.touchend=function(e){const t=this;e.preventDefault(),e.stopPropagation(),e.touches.length===0&&e.changedTouches.length===1&&this.getMouseInViewport(e.changedTouches[0].pageX,e.changedTouches[0].pageY).sub(this._lastTouchdownPos).length()<.01&&setTimeout(()=>{t.pickObject(t._lastTouchdownPos)},0)};Cs.prototype.dispose=function(){for(let e=0;e<this._listeners.length;e++){const t=this._listeners[e];t.obj.removeEventListener(t.type,t.handler)}};var KW=Cs,QW=class{constructor(e,t){this._target=e,this._targetCamera=t,this._camera=new R.PerspectiveCamera(t.fov,t.aspect,1,100),this._object=new R.AxesHelper(1),this._scene=new R.Scene,this._scene.add(this._object),this._full=new R.Vector2,this._update()}_update(){const{fov:e}=this._targetCamera,t=this._camera;t.aspect=this._targetCamera.aspect,t.setMinimalFov(e),t.setDistanceToFit(1,e),t.updateProjectionMatrix(),this._object.quaternion.copy(this._target.quaternion)}render(e){this._update(),e.getSize(this._full);const t=this._full.width*.25,n=this._full.height*.25,{autoClear:i}=e;e.autoClear=!1,e.setViewport(0,0,t,n),e.clear(!1,!0,!1),e.render(this._scene,this._camera),e.setViewport(0,0,this._full.width,this._full.height),e.autoClear=i}},JW=QW,eX=12,tX=268435200,nX=8,iX=255,rX=12,sX=4293918720,oX=20,aX=1048575,lX=4026531840,cX=28,uX=1<<19,hX=1<<20,fX=1,dX=2,pX=["helix","strand"],ZC=["fs","ps","ns","us"];function mX(e,t){const n=t._residues,i=n.length,r=new Uint8Array(i),s=t._atoms;for(let u=0,d=e.length;u<d;++u){const p=s[u];r[p.residue._index]=e[u]}const a=[];let c=0;for(;c<i;){if(r[c]!==0){const u=c,d=r[c];for(;c<i-1&&r[c+1]===d&&n[c].isConnected(n[c+1]);)++c;a.push({start:u,end:c,type:pX[d-1]})}++c}return a}function V2(e){return e>=uX?e-hX:e}var gX=class jN{constructor(t,n,i){this._complex=t,this._secondary=null,this.isLoading=!1,this._framesRange={start:0,end:-1},this.frameIsReady=!1,this._buffer=null,this._frameRequest=null,this._callbacks=i,typeof n=="function"?(this._framesRequestLength=1,this._downloadDataFn=n):this.parseBinaryData(n,!0),this.reset(),this.setFrame(0)}_prepareBuffer(t,n){if(t==null&&(t=0),n==null&&(n=t+this._framesRequestLength),this._framesCount!==void 0&&(n=Math.min(this._framesCount-1,n)),this._downloadDataFn){const i=this,r=function(a){if(i.isLoading=!1,i._callbacks&&typeof i._callbacks.onLoadStatusChanged=="function"&&i._callbacks.onLoadStatusChanged(),i._buffer={data:a,state:"ready",start:t,end:n},i._frameRequest!==null){const c=i._frameRequest;i._frameRequest=null,i.setFrame(c)}},s=function(){i.isLoading=!1,i._callbacks&&typeof i._callbacks.onError=="function"&&i._callbacks.onError("Streaming failed")};this._buffer||(this._buffer={}),this._buffer.state="downloading",this.isLoading=!0,i._callbacks&&typeof i._callbacks.onLoadStatusChanged=="function"&&i._callbacks.onLoadStatusChanged(),this._downloadDataFn({start:t,end:n+1},r,s)}}_parseBuffer(){if(this._buffer&&this._buffer.state==="ready"){this._framesRange={start:this._buffer.start,end:this._buffer.end},this.parseBinaryData(this._buffer.data,!1);let t=(this._buffer.end+1)%this._framesCount;if(t>=this._framesCount&&(t=0),this._buffer={state:"none"},this._prepareBuffer(t,t+this._framesRequestLength),this._frameRequest!==null){const n=this._frameRequest;this._frameRequest=null,this.setFrame(n)}}}parseBinaryData(t){const n=new DataView(t);let i=0;const r=n.getUint32(i,!0);i+=4;const s=n.getUint32(i,!0);this._framesCount=s,this._framesRange.end=this._framesRange.end>0?Math.min(this._framesRange.end,s-1):s-1,i+=4,this._atomsCount=r;const a=1024*1024;this._framesRequestLength=Math.ceil(a/(r*8));const c=this._framesRange.end-this._framesRange.start+1;if(r!==this._complex._atoms.length||t.byteLength!==eX+c*r*8)throw new Error;const u=this._complex;let d=n.getUint32(i,!0),p=0;for(;d>1e3&&p<ZC.length-1;)d/=1e3,++p;this._timeStep=`${d.toString()} ${ZC[p]}`,i+=4;const g=[],v=new Float32Array(c*r*3);let y=0;const S=new Int8Array(r);for(let E=0;E<c;++E){for(let w=0;w<r;++w){const b=n.getUint32(i,!0);i+=4;const T=n.getUint32(i,!0);i+=4;const L=(T&lX)>>>cX,C=V2((T&tX)>>>nX>>0),P=V2(((T&iX)<<rX|(b&sX)>>>oX)>>0),O=V2((b&aX)>>0);S[w]=0,L>0&&L<4?S[w]=fX:L===4&&(S[w]=dX),v[y++]=C/100,v[y++]=P/100,v[y++]=O/100}g.push(mX(S,u))}this._secondaryData=g,this._data=v}nextFrame(){this.setFrame((this._currFrame+1)%this._framesCount)}needsColorUpdate(t){return t instanceof EN}getAtomColor(t,n){return t.getResidueColor(this._residues[n.residue._index],this._complex)}getResidueColor(t,n){return t.getResidueColor(this._residues[n._index],this._complex)}_updateSecondary(){let t;const n=this._residues;let i=n.length;for(t=0;t<i;++t)n[t]._secondary=null;const r=this._secondaryData[this._currFrame-this._framesRange.start];for(t=0,i=r.length;t<i;++t){const s=r[t],{start:a,end:c}=s,u={_start:n[a],_end:n[c],type:s.type,generic:s.generic};for(let d=a;d<=c;++d)n[d]._secondary=u}}reset(){const t=this._complex._residues,n=t.length;this._residues=new Array(n);const i=this._residues,r=function(){return this._secondary};for(let s=0;s<n;++s)i[s]={_type:t[s]._type,_isValid:t[s]._isValid,_controlPoint:null,_wingVector:null,_secondary:null,getSecondary:r}}setFrame(t){if(this.frameIsReady=!1,t>=this._framesRange.start&&t<=this._framesRange.end)this._currFrame=t,this._cachedResidues=!1,this._updateSecondary(),this.frameIsReady=!0;else if(this._frameRequest=t,!this._buffer)this._prepareBuffer(t);else{const n=this;switch(this._buffer.state){case"none":this._prepareBuffer(t);break;case"ready":n._parseBuffer();break;default:break}}}disableEvents(){this._callbacks=null}static _vec=new R.Vector3;getAtomPos(t){const n=jN._vec,i=this,r=i._data,s=(i._atomsCount*(i._currFrame-i._framesRange.start)+t)*3;return n.set(r[s],r[s+1],r[s+2]),n}getResidues(){return this._cachedResidues?this._residues:(this._complex.updateToFrame(this),this._residues)}},_X=gX,YN=class qN{constructor(t,n){if(this.constructor===qN)throw new Error("Can not instantiate abstract class!");this.params=t,this.opts=We.default.merge(rt.deriveDeep(Pe.now.objects[this.type],!0),n),this.needsRebuild=!1,this._mesh=null,this.id=null}identify(){const t={type:this.type,params:this.params},n=rt.objectsDiff(this.opts,Pe.now.modes[this.id]);return We.default.isEmpty(n)||(t.opts=n),t}toString(){return`o=${this.type},${this.params.join(",")}`+rt.compareOptionsWithDefaults(this.opts,Pe.defaults.objects[this.type])}getGeometry(){return this._mesh}destroy(){this._mesh&&Xt.destroyObject(this._mesh)}};YN.prototype.type="__";var vX=YN,gx=class extends vX{constructor(e,t){if(super(e,t),e.length<2)throw new Error("Wrong number of argumets on line object creation!");[this._id1,this._id2]=e}_getAtomFromName(e,t){const n=" - Wrong atom format it must be '#CHAIN_NAME.#RESIDUE_NUMBER.#ATOM_NAME' (e.g. 'A.38.CO1')",i=e.getAtomByFullname(t);if(!i)throw new Error(t+n);return i}build(e){const t=new R.BufferGeometry;this._atom1=this._getAtomFromName(e,this._id1),this._atom2=this._getAtomFromName(e,this._id2);const n=this._atom1.position,i=this._atom2.position,r=new Float32Array([n.x,n.y,n.z,i.x,i.y,i.z]);t.setAttribute("position",new R.BufferAttribute(r,3)),t.computeBoundingBox(),this._line=new So.Line(t,new Ja({lights:!1,overrideColor:!0,dashedLine:!0,fogTransparent:Pe.now.bg.transparent})),this._line.computeLineDistances(),this._line.material.setUberOptions({fixedColor:new R.Color(this.opts.color),dashedLineSize:this.opts.dashSize,dashedLinePeriod:this.opts.dashSize+this.opts.gapSize}),this._line.material.updateUniforms(),this._line.raycast=function(a,c){},this._mesh=this._line;const s=e.getTransforms();s.length>0&&(this._mesh=new R.Group,this._mesh.add(this._line),jp.applyTransformsToMeshes(this._mesh,s))}updateToFrame(e){if(!this._atom1||!this._atom2||!this._line)return;const t=this._line.geometry;t.vertices[0].copy(e.getAtomPos(this._atom1.index)),t.vertices[1].copy(e.getAtomPos(this._atom2.index)),this._line.computeLineDistances(),t.computeBoundingSphere(),t.verticesNeedUpdate=!0}};gx.prototype.constructor=gx;gx.prototype.type="line";var KC=gx,yX=`precision highp float;\r
\r
uniform sampler2D srcTex;\r
uniform vec2 srcTexSize;\r
uniform vec2 thickness;\r
varying vec2 vUv;\r
\r
#ifdef DEPTH_OUTLINE\r
uniform sampler2D srcDepthTex; //depthTexture\r
uniform vec3 color;\r
uniform float threshold;\r
#endif\r
\r
void main() {\r
\r
vec2 pixelSize = thickness / srcTexSize;\r
\r
#ifdef DEPTH_OUTLINE\r
float c00 = texture2D(srcDepthTex, vUv + vec2(-pixelSize.x,-pixelSize.y)).x;\r
float c01 = texture2D(srcDepthTex, vUv + vec2(0,-pixelSize.y)).x;\r
float c02 = texture2D(srcDepthTex, vUv + vec2(pixelSize.x,-pixelSize.y)).x;\r
float c10 = texture2D(srcDepthTex, vUv + vec2(-pixelSize.x,0)).x;\r
float c12 = texture2D(srcDepthTex, vUv + vec2(pixelSize.x,0)).x;\r
float c20 = texture2D(srcDepthTex, vUv + vec2(-pixelSize.x,pixelSize.y)).x;\r
float c21 = texture2D(srcDepthTex, vUv + vec2(0,pixelSize.y)).x;\r
float c22 = texture2D(srcDepthTex, vUv + vec2(pixelSize.x,pixelSize.y)).x;\r
\r
float horizEdge = - c00 - 2.0 * c01 - c02 + c20 + 2.0 * c21 + c22;\r
float vertEdge = - c00 - 2.0 * c10 - c20 + c02 + 2.0 * c12 + c22;\r
\r
float grad = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);\r
\r
gl_FragColor = ( grad > threshold ) ? vec4(color.rgb, 1.0) : gl_FragColor = texture2D(srcTex, vUv);\r
\r
#else\r
vec4 c00 = texture2D(srcTex, vUv + vec2(-pixelSize.x,-pixelSize.y));\r
vec4 c01 = texture2D(srcTex, vUv + vec2(0,-pixelSize.y));\r
vec4 c02 = texture2D(srcTex, vUv + vec2(pixelSize.x,-pixelSize.y));\r
vec4 c10 = texture2D(srcTex, vUv + vec2(-pixelSize.x,0));\r
vec4 c12 = texture2D(srcTex, vUv + vec2(pixelSize.x,0));\r
vec4 c20 = texture2D(srcTex, vUv + vec2(-pixelSize.x,pixelSize.y));\r
vec4 c21 = texture2D(srcTex, vUv + vec2(0,pixelSize.y));\r
vec4 c22 = texture2D(srcTex, vUv + vec2(pixelSize.x,pixelSize.y));\r
\r
vec4 horizEdge = - c00 - 2.0 * c01 - c02 + c20 + 2.0 * c21 + c22;\r
vec4 vertEdge = - c00 - 2.0 * c10 - c20 + c02 + 2.0 * c12 + c22;\r
\r
vec4 grad = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);\r
gl_FragColor = grad;\r
#endif\r
}\r
`,$N=class extends R.RawShaderMaterial{constructor(e){super(e);const t={uniforms:{srcTex:{type:"t",value:null},srcDepthTex:{type:"t",value:null},srcTexSize:{type:"v2",value:new R.Vector2(512,512)},color:{type:"v3",value:null},threshold:{type:"f",value:null},opacity:{type:"f",value:1},thickness:{type:"v2",value:new R.Vector2(1,1)}},vertexShader:Ru,fragmentShader:yX,transparent:!0,depthTest:!1,depthWrite:!1};this.setValues(t)}copy(e){super.copy(e),this.depth=e.depth}setValues(e){if(typeof e>"u")return;super.setValues(e);const t={};this.depth&&(t.DEPTH_OUTLINE=1),this.defines=t}};$N.prototype.depth=!1;var ZN=$N,xX=`precision highp float;\r
\r
// edge end finding algorithm parameters\r
#define FXAA_QUALITY_PS 8\r
#define FXAA_QUALITY_P0 1.0\r
#define FXAA_QUALITY_P1 1.5\r
#define FXAA_QUALITY_P2 2.0\r
#define FXAA_QUALITY_P3 2.0\r
#define FXAA_QUALITY_P4 2.0\r
#define FXAA_QUALITY_P5 2.0\r
#define FXAA_QUALITY_P6 4.0\r
#define FXAA_QUALITY_P7 12.0\r
// constants\r
float fxaaQualityEdgeThreshold = 0.125;\r
float fxaaQualityEdgeThresholdMin = 0.0625;\r
float fxaaQualitySubpix = 0.7; //0.65;\r
// global params\r
uniform sampler2D srcTex;\r
uniform vec2 srcTexelSize;\r
uniform vec3 bgColor;\r
// from vs\r
varying vec2 vUv;\r
//=====================================================================//\r
// calc luminance from rgb\r
//'float FxaaLuma(vec3 rgb) {return rgb.y * (0.587/0.299) + rgb.x; } // Lotte's idea about game luminance\r
float FxaaLuma(vec3 rgb) {return dot(rgb, vec3(0.299, 0.587, 0.114)); } // real luminance calculation\r
// for non-real scene rendering\r
// texture sampling by pixel position(coords) and offset(in pixels)\r
vec3 FxaaTex(sampler2D tex, vec2 pos, vec2 off, vec2 res ) {\r
#ifdef BG_TRANSPARENT\r
vec4 color = texture2D( tex, pos + off * res );\r
return mix(color.rgb, bgColor, 1.0 - color.a);\r
#else\r
return texture2D( tex, pos + off * res ).xyz;\r
#endif\r
}\r
vec3 FxaaTexTop(sampler2D tex, vec2 pos) {\r
#ifdef BG_TRANSPARENT\r
vec4 color = texture2D( tex, pos );\r
return mix(color.rgb, bgColor, 1.0 - color.a);\r
#else\r
return texture2D( tex, pos).xyz;\r
#endif\r
}\r
vec4 FxaaTexTopAlpha(sampler2D tex, vec2 pos) {\r
return texture2D( tex, pos);\r
}\r
\r
//=====================================================================//\r
void main() {\r
// renaming\r
vec2 posM = vUv;\r
// get luminance for neighbours\r
float lumaS = FxaaLuma(FxaaTex(srcTex, posM, vec2( 0.0, 1.0 ), srcTexelSize));\r
float lumaE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, 0.0 ), srcTexelSize));\r
float lumaN = FxaaLuma(FxaaTex(srcTex, posM, vec2( 0.0, -1.0 ), srcTexelSize));\r
float lumaW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, 0.0 ), srcTexelSize));\r
float lumaM = FxaaLuma(FxaaTexTop(srcTex, posM));\r
// find max and min luminance\r
float rangeMax = max(max(lumaN, lumaW), max(lumaE, max(lumaS, lumaM)));\r
float rangeMin = min(min(lumaN, lumaW), min(lumaE, min(lumaS, lumaM)));\r
// calc maximum non-edge range\r
float rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\r
float range = rangeMax - rangeMin;\r
float rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\r
// exit when luma contrast is small (is not edge)\r
if(range < rangeMaxClamped){\r
gl_FragColor = FxaaTexTopAlpha(srcTex, posM);\r
return;\r
}\r
float subpixRcpRange = 1.0/range;\r
// note: the sampling coordinates can be calculated in vertex shader but the approach doesn't affect performance\r
// visibly, thus we decided to leave calculation here for better readability.\r
// calc other neighbours luminance\r
float lumaNE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, -1.0 ), srcTexelSize));\r
float lumaSW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, 1.0 ), srcTexelSize));\r
float lumaSE = FxaaLuma(FxaaTex(srcTex, posM, vec2( 1.0, 1.0 ), srcTexelSize));\r
float lumaNW = FxaaLuma(FxaaTex(srcTex, posM, vec2( -1.0, -1.0 ), srcTexelSize));\r
/*--------------span calculation and subpix amount calulation-----------------*/\r
float lumaNS = lumaN + lumaS;\r
float lumaWE = lumaW + lumaE;\r
float subpixNSWE = lumaNS + lumaWE;\r
float edgeHorz1 = (-2.0 * lumaM) + lumaNS;\r
float edgeVert1 = (-2.0 * lumaM) + lumaWE;\r
/*--------------------------------------------------------------------------*/\r
float lumaNESE = lumaNE + lumaSE;\r
float lumaNWNE = lumaNW + lumaNE;\r
float edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\r
float edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\r
/*--------------------------------------------------------------------------*/\r
float lumaNWSW = lumaNW + lumaSW;\r
float lumaSWSE = lumaSW + lumaSE;\r
float edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\r
float edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\r
float edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\r
float edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\r
float edgeHorz = abs(edgeHorz3) + edgeHorz4;\r
float edgeVert = abs(edgeVert3) + edgeVert4;\r
/*--------------------subpix amount calulation------------------------------*/\r
float subpixNWSWNESE = lumaNWSW + lumaNESE;\r
float lengthSign = srcTexelSize.x;\r
bool horzSpan = edgeHorz >= edgeVert;\r
// debug code edge span visualization\r
/*' if (horzSpan)\r
gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);\r
else\r
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\r
return;*/\r
float subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\r
/*--------------------------------------------------------------------------*/\r
if(!horzSpan) lumaN = lumaW;\r
if(!horzSpan) lumaS = lumaE;\r
if(horzSpan) lengthSign = srcTexelSize.y;\r
float subpixB = (subpixA * (1.0/12.0)) - lumaM;\r
/*--------------------------------------------------------------------------*/\r
float gradientN = lumaN - lumaM;\r
float gradientS = lumaS - lumaM;\r
float lumaNN = lumaN + lumaM;\r
float lumaSS = lumaS + lumaM;\r
bool pairN = abs(gradientN) >= abs(gradientS);\r
float gradient = max(abs(gradientN), abs(gradientS));\r
if(pairN) lengthSign = -lengthSign;\r
float subpixC = clamp(abs(subpixB) * subpixRcpRange, 0.0, 1.0);\r
/*--------------------------------------------------------------------------*/\r
vec2 posB;\r
posB = posM;\r
vec2 offNP;\r
offNP.x = (!horzSpan) ? 0.0 : srcTexelSize.x;\r
offNP.y = ( horzSpan) ? 0.0 : srcTexelSize.y;\r
if(!horzSpan) posB.x += lengthSign * 0.5;\r
if( horzSpan) posB.y += lengthSign * 0.5;\r
/*--------------------------------------------------------------------------*/\r
vec2 posN;\r
posN = posB - offNP * FXAA_QUALITY_P0;\r
vec2 posP;\r
posP = posB + offNP * FXAA_QUALITY_P0;\r
float subpixD = ((-2.0)*subpixC) + 3.0;\r
float lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN));\r
float subpixE = subpixC * subpixC;\r
float lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP));\r
/*--------------------------------------------------------------------------*/\r
if(!pairN) lumaNN = lumaSS;\r
float gradientScaled = gradient * 1.0/4.0;\r
float lumaMM = lumaM - lumaNN * 0.5;\r
float subpixF = subpixD * subpixE;\r
bool lumaMLTZero = lumaMM < 0.0;\r
/*---------------------looped edge-end search-------------------------------*/\r
lumaEndN -= lumaNN * 0.5;\r
lumaEndP -= lumaNN * 0.5;\r
bool doneN = abs(lumaEndN) >= gradientScaled;\r
bool doneP = abs(lumaEndP) >= gradientScaled;\r
if(!doneN) posN -= offNP * FXAA_QUALITY_P1;\r
bool doneNP = (!doneN) || (!doneP);\r
if(!doneP) posP += offNP * FXAA_QUALITY_P1;\r
/*--------------------------------------------------------------------------*/\r
if(doneNP) {\r
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r
doneN = abs(lumaEndN) >= gradientScaled;\r
doneP = abs(lumaEndP) >= gradientScaled;\r
if(!doneN) posN -= offNP * FXAA_QUALITY_P2;\r
doneNP = (!doneN) || (!doneP);\r
if(!doneP) posP += offNP * FXAA_QUALITY_P2;\r
/*--------------------------------------------------------------------------*/\r
#if (FXAA_QUALITY_PS > 3)\r
if(doneNP) {\r
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r
doneN = abs(lumaEndN) >= gradientScaled;\r
doneP = abs(lumaEndP) >= gradientScaled;\r
if(!doneN) posN -= offNP * FXAA_QUALITY_P3;\r
doneNP = (!doneN) || (!doneP);\r
if(!doneP) posP += offNP * FXAA_QUALITY_P3;\r
/*--------------------------------------------------------------------------*/\r
#if (FXAA_QUALITY_PS > 4)\r
if(doneNP) {\r
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r
doneN = abs(lumaEndN) >= gradientScaled;\r
doneP = abs(lumaEndP) >= gradientScaled;\r
if(!doneN) posN -= offNP * FXAA_QUALITY_P4;\r
doneNP = (!doneN) || (!doneP);\r
if(!doneP) posP += offNP * FXAA_QUALITY_P4;\r
/*--------------------------------------------------------------------------*/\r
#if (FXAA_QUALITY_PS > 5)\r
if(doneNP) {\r
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r
doneN = abs(lumaEndN) >= gradientScaled;\r
doneP = abs(lumaEndP) >= gradientScaled;\r
if(!doneN) posN -= offNP * FXAA_QUALITY_P5;\r
doneNP = (!doneN) || (!doneP);\r
if(!doneP) posP += offNP * FXAA_QUALITY_P5;\r
/*--------------------------------------------------------------------------*/\r
#if (FXAA_QUALITY_PS > 6)\r
if(doneNP) {\r
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r
doneN = abs(lumaEndN) >= gradientScaled;\r
doneP = abs(lumaEndP) >= gradientScaled;\r
if(!doneN) posN -= offNP * FXAA_QUALITY_P6;\r
doneNP = (!doneN) || (!doneP);\r
if(!doneP) posP += offNP * FXAA_QUALITY_P6;\r
/*--------------------------------------------------------------------------*/\r
#if (FXAA_QUALITY_PS > 7)\r
if(doneNP) {\r
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(srcTex, posN.xy));\r
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(srcTex, posP.xy));\r
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\r
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\r
doneN = abs(lumaEndN) >= gradientScaled;\r
doneP = abs(lumaEndP) >= gradientScaled;\r
if(!doneN) posN -= offNP * FXAA_QUALITY_P7;\r
doneNP = (!doneN) || (!doneP);\r
if(!doneP) posP += offNP * FXAA_QUALITY_P7;\r
/*--------------------------------------------------------------------------*/\r
}\r
#endif\r
}\r
#endif\r
}\r
#endif\r
}\r
#endif\r
}\r
#endif\r
}\r
/*----------------calculate subpix offset due to edge ends-------------------*/\r
float dstN = posM.x - posN.x;\r
float dstP = posP.x - posM.x;\r
if(!horzSpan) dstN = posM.y - posN.y;\r
if(!horzSpan) dstP = posP.y - posM.y;\r
/*--------------------------------------------------------------------------*/\r
bool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\r
float spanLength = (dstP + dstN);\r
bool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\r
float spanLengthRcp = 1.0 / spanLength;\r
/*--------------------------------------------------------------------------*/\r
bool directionN = dstN < dstP;\r
float dst = min(dstN, dstP);\r
bool goodSpan = directionN ? goodSpanN : goodSpanP;\r
float subpixG = subpixF * subpixF;\r
float pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\r
float subpixH = subpixG * fxaaQualitySubpix;\r
/*-----------------calc texture offest using subpix-------------------------*/\r
float pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\r
float pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\r
\r
float offset = pixelOffsetSubpix * lengthSign;\r
#ifdef BG_TRANSPARENT\r
// get original texel\r
vec4 rgbaA = FxaaTexTopAlpha(srcTex, posM);\r
// calc step to blended texel\r
vec2 step = sign((!horzSpan) ? vec2 (offset, 0.0) : vec2 (0.0, offset));\r
// get neighboring texel\r
vec4 rgbaB = FxaaTexTopAlpha(srcTex, posM + step * srcTexelSize);\r
// calc blend factor from offset\r
float f = (!horzSpan) ? offset / srcTexelSize.x : offset / srcTexelSize.y;\r
f = abs(f);\r
// calc alpha (special formula to emulate blending with bg)\r
gl_FragColor.a = 1.0 - mix(1.0 - rgbaA.a, 1.0 - rgbaB.a, f);\r
// calc color (special formula to emulate blending with bg)\r
gl_FragColor.rgb = mix(rgbaA.rgb * rgbaA.a, rgbaB.rgb * rgbaB.a, f) / gl_FragColor.a;\r
#else\r
if(!horzSpan) {\r
posM.x += offset;\r
} else {\r
posM.y += offset;\r
}\r
gl_FragColor = FxaaTexTopAlpha(srcTex, posM);\r
#endif\r
return;\r
}\r
`,KN=class extends R.RawShaderMaterial{constructor(e){super(e),this.setValues.call(this,{uniforms:{srcTex:{type:"t",value:null},srcTexelSize:{type:"v2",value:new R.Vector2(1/512,1/512)},bgColor:{type:"c",value:new R.Color(16777215)}},vertexShader:Ru,fragmentShader:xX,transparent:!1,depthTest:!1,depthWrite:!1}),this.setValues(e)}copy(e){super.copy(e),this.depth=e.depth}setValues(e){if(typeof e>"u")return;super.setValues(e);const t={};this.bgTransparent&&(t.BG_TRANSPARENT=1),this.defines=t}};KN.prototype.bgTransparent=!1;var SX=KN,bX=`precision highp float;\r
#define EPSILON 0.0000001\r
\r
#define MAX_SAMPLES_COUNT 32\r
uniform vec3 samplesKernel[MAX_SAMPLES_COUNT];\r
uniform sampler2D noiseTexture;\r
uniform vec2 noiseTexelSize;\r
uniform sampler2D diffuseTexture;\r
uniform sampler2D depthTexture;\r
uniform sampler2D normalTexture;\r
uniform vec2 srcTexelSize;\r
uniform vec2 camNearFar;\r
uniform mat4 projMatrix;\r
\r
uniform float aspectRatio;\r
uniform float tanHalfFOV;\r
\r
uniform float kernelRadius;\r
uniform float depthThreshold;\r
uniform float factor;\r
\r
varying vec2 vUv;\r
\r
float CalcViewZ(vec2 screenPos)\r
{\r
float depth = texture2D(depthTexture, screenPos).x;\r
// [0, 1]->[-1, 1]\r
float clipedZ = 2.0 * depth - 1.0;\r
// see THREE.js camera.makeFrustum for projection details\r
return (-projMatrix[3][2] / (clipedZ + projMatrix[2][2]));\r
}\r
\r
vec3 ViewPosFromDepth(vec2 screenPos)\r
{\r
vec3 viewPos;\r
viewPos.z = CalcViewZ(screenPos);\r
//[0, 1]->[-1, 1]\r
vec2 projPos = 2.0 * screenPos - 1.0;\r
// reconstruct viewposition in right-handed sc with z to viewer\r
viewPos.xy = vec2(\r
projPos.x * aspectRatio * tanHalfFOV * abs(viewPos.z),\r
projPos.y * tanHalfFOV * abs(viewPos.z)\r
);\r
return viewPos;\r
}\r
\r
void main() {\r
vec3 viewPos = ViewPosFromDepth(vUv);\r
// remap coordinates to prevent noise exture rescale\r
vec2 vUvNoise = vUv / srcTexelSize * noiseTexelSize;\r
vec4 normalData = texture2D(normalTexture, vUv);\r
// return for background fragments (their normals are zero vectors)\r
if (length(normalData.rgb) < EPSILON) {\r
// 0.0 in alpha component means that it is background fragment\r
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\r
return;\r
}\r
//[0, 1] -> [-1, 1]\r
vec3 normal = (normalData.rgb * 2.0 - 1.0);\r
// normalData.a store 1.0 if normal was build for frontfaced surface\r
// and 0.0 in other case\r
if (normalData.a < EPSILON) {\r
normal *= -1.0;\r
}\r
// get random vector for sampling sphere rotation\r
vec3 randN = texture2D(noiseTexture, vUvNoise).rgb * 2.0 - 1.0;\r
randN = normalize(randN);\r
// build TBN (randomly rotated around normal)\r
vec3 tangent = normalize(randN - normal * dot(randN, normal));\r
vec3 bitangent = cross(tangent, normal);\r
mat3 TBN = mat3(tangent, bitangent, normal);\r
// calc AO value\r
float AO = 0.0;\r
for (int i = 0 ; i < MAX_SAMPLES_COUNT ; i++) {\r
// rotate sampling kernel around normal\r
vec3 reflectedSample = TBN * samplesKernel[i];\r
// get sample\r
vec3 samplePos = viewPos + reflectedSample * kernelRadius;\r
\r
// project sample to screen to get sample's screen pos\r
vec4 SampleScrPos = vec4(samplePos, 1.0);\r
// eye -> clip\r
SampleScrPos = projMatrix * SampleScrPos;\r
// normalize\r
SampleScrPos.xy /= SampleScrPos.w;\r
//[-1, 1] -> [0, 1]\r
SampleScrPos.xy = (SampleScrPos.xy + vec2(1.0)) * 0.5;\r
\r
// get view z for sample projected to the objct surface\r
float sampleDepth = CalcViewZ(SampleScrPos.xy);\r
// calc occlusion made by object surface at the sample\r
AO += step(samplePos.z, sampleDepth);\r
}\r
// calc result AO-map color\r
AO = 1.0 - max(0.0, AO / float(MAX_SAMPLES_COUNT) * factor);\r
// write value to AO-map\r
gl_FragColor = vec4(AO, AO, AO, 1.0);\r
}\r
`,MX=[new R.Vector3(.295184,.077723,.068429),new R.Vector3(-.271976,-.365221,.838363),new R.Vector3(.547713,.467576,.488515),new R.Vector3(.662808,-.031733,.584758),new R.Vector3(-.025717,.218955,.657094),new R.Vector3(-.310153,-.365223,.370701),new R.Vector3(-.101407,-.006313,.747665),new R.Vector3(-.769138,.360399,.086847),new R.Vector3(-.271988,-.27514,.905353),new R.Vector3(.09674,-.566901,.700151),new R.Vector3(.562872,-.735136,.094647),new R.Vector3(.379877,.359278,.190061),new R.Vector3(.519064,-.023055,.405068),new R.Vector3(-.301036,.114696,.088885),new R.Vector3(-.282922,.598305,.487214),new R.Vector3(-.181859,.25167,.679702),new R.Vector3(-.191463,-.635818,.512919),new R.Vector3(-.293655,.427423,.078921),new R.Vector3(-.267983,.680534,.13288),new R.Vector3(.139611,.319637,.477439),new R.Vector3(-.352086,.31104,.653913),new R.Vector3(.321032,.805279,.487345),new R.Vector3(.073516,.820734,.414183),new R.Vector3(-.155324,.589983,.41146),new R.Vector3(.335976,.170782,.527627),new R.Vector3(.46346,-.355658,.167689),new R.Vector3(.222654,.59655,.769406),new R.Vector3(.922138,-.04207,.147555),new R.Vector3(-.72705,-.329192,.369826),new R.Vector3(-.090731,.53382,.463767),new R.Vector3(-.323457,-.876559,.238524),new R.Vector3(-.663277,-.372384,.342856)],wX=class extends R.RawShaderMaterial{constructor(){super(),this.setValues.call(this,{uniforms:{noiseTexture:{type:"t",value:Wp.noiseTexture},noiseTexelSize:{type:"v2",value:new R.Vector2(1/Wp.noiseWidth,1/Wp.noiseHeight)},diffuseTexture:{type:"t",value:null},normalTexture:{type:"t",value:null},depthTexture:{type:"t",value:null},srcTexelSize:{type:"v2",value:new R.Vector2(1/512,1/512)},camNearFar:{type:"v2",value:new R.Vector2(1,10)},projMatrix:{type:"mat4",value:new R.Matrix4},aspectRatio:{type:"f",value:0},tanHalfFOV:{type:"f",value:0},samplesKernel:{type:"v3v",value:MX},kernelRadius:{type:"f",value:1},depthThreshold:{type:"f",value:1},factor:{type:"f",value:1}},vertexShader:Ru,fragmentShader:bX,transparent:!1,depthTest:!1,depthWrite:!1})}},AX=wX,EX=`precision highp float;\r
#define EPSILON 0.0000001\r
\r
#define MAX_SAMPLES_COUNT 5\r
uniform float samplesOffsets[MAX_SAMPLES_COUNT];\r
uniform sampler2D aoMap;\r
uniform sampler2D depthTexture;\r
uniform vec2 srcTexelSize;\r
\r
varying vec2 vUv;\r
\r
void main() {\r
float x = vUv.x;\r
float y = vUv.y;\r
vec4 res = vec4(0.0);\r
res.a = texture2D(aoMap, vec2(x, y )).a;\r
// return for background fragments (0.0 in alpha component means that it is background fragment)\r
if (res.a < EPSILON) {\r
gl_FragColor = res;\r
return;\r
}\r
\r
float pixelDepth = texture2D(depthTexture, vec2(x, y)).x;\r
float weightSum = 0.0;\r
for (int i = 0; i < MAX_SAMPLES_COUNT; ++i) {\r
if (texture2D(aoMap, vec2(x + samplesOffsets[i] * srcTexelSize.x, y )).a < EPSILON) {\r
continue;\r
}\r
vec2 samplePos = vec2(x + samplesOffsets[i] * srcTexelSize.x, y);\r
float depth = texture2D(depthTexture, samplePos).x;\r
float weight = (1.0 / (0.0001 + abs(depth - pixelDepth)));\r
res.rgb += texture2D(aoMap, vec2(x + samplesOffsets[i] * srcTexelSize.x, y )).rgb * weight;\r
weightSum += weight;\r
}\r
res.rgb = res.rgb / weightSum;\r
gl_FragColor = res;\r
}\r
`,TX=[-2,-1,0,1,2],CX=class extends R.RawShaderMaterial{constructor(){super(),this.setValues.call(this,{uniforms:{depthTexture:{type:"t",value:null},srcTexelSize:{type:"v2",value:new R.Vector2(1/512,1/512)},aoMap:{type:"t",value:null},samplesOffsets:{type:"fv1",value:TX}},vertexShader:Ru,fragmentShader:EX,transparent:!1,depthTest:!1,depthWrite:!1})}},RX=CX,LX=`precision highp float;\r
#define EPSILON 0.0000001\r
\r
#define MAX_SAMPLES_COUNT 5\r
uniform float samplesOffsets[MAX_SAMPLES_COUNT];\r
uniform sampler2D diffuseTexture;\r
uniform sampler2D aoMap;\r
uniform sampler2D depthTexture;\r
uniform vec2 srcTexelSize;\r
\r
uniform mat4 projMatrix;\r
uniform float aspectRatio;\r
uniform float tanHalfFOV;\r
\r
#ifdef USE_FOG\r
uniform vec2 fogNearFar;\r
uniform vec4 fogColor;\r
#endif\r
varying vec2 vUv;\r
\r
float CalcViewZ(vec2 screenPos)\r
{\r
float depth = texture2D(depthTexture, screenPos).x;\r
// [0, 1]->[-1, 1]\r
float clipedZ = 2.0 * depth - 1.0;\r
// see THREE.js camera.makeFrustum for projection details\r
return (-projMatrix[3][2] / (clipedZ + projMatrix[2][2]));\r
}\r
\r
vec3 ViewPosFromDepth(vec2 screenPos)\r
{\r
vec3 viewPos;\r
viewPos.z = CalcViewZ(screenPos);\r
//[0, 1]->[-1, 1]\r
vec2 projPos = 2.0 * screenPos - 1.0;\r
// reconstruct viewposition in right-handed sc with z to viewer\r
viewPos.xy = vec2(\r
projPos.x * aspectRatio * tanHalfFOV * abs(viewPos.z),\r
projPos.y * tanHalfFOV * abs(viewPos.z)\r
);\r
return viewPos;\r
}\r
\r
void main() {\r
vec3 viewPos = ViewPosFromDepth(vUv);\r
float x = vUv.x;\r
float y = vUv.y;\r
vec4 color = texture2D(diffuseTexture, vec2(x, y));\r
vec4 res = vec4(0.0);\r
res.a = texture2D(aoMap, vec2(x, y )).a;\r
// return for background fragments (0.0 in alpha component means that it is background fragment)\r
if (res.a < EPSILON) {\r
gl_FragColor = color;\r
return;\r
}\r
\r
float pixelDepth = texture2D(depthTexture, vec2(x, y)).x;\r
float weightSum = 0.0;\r
for (int i = 0; i < MAX_SAMPLES_COUNT; ++i) {\r
if (texture2D(aoMap, vec2(x, y + samplesOffsets[i] * srcTexelSize.y)).a < EPSILON) {\r
continue;\r
}\r
vec2 samplePos = vec2(x, y + samplesOffsets[i] * srcTexelSize.y);\r
float depth = texture2D(depthTexture, samplePos).x;\r
float weight = (1.0 / (0.0001 + abs(depth - pixelDepth)));\r
res.rgb += texture2D(aoMap, vec2(x, y + samplesOffsets[i] * srcTexelSize.y)).rgb * weight;\r
weightSum += weight;\r
}\r
res.rgb /= weightSum;\r
\r
#if defined(USE_FOG) && !defined(FOG_TRANSPARENT)\r
// Add fog to the result value\r
// Proper way to get an image with fog and ao requires formula:\r
// gl_FragColor = fragColor*AO*(1-fogFactor) + fogColor*fogFactor\r
// But we have already fogged molecule to add AO too. Let's split the straight formula into our real steps!\r
// We have: AO, fogFactor, fogColor,\r
// color = fragColor*(1-fogFactor) + fogColor*fogFactor (it comes from diffuseTexture,\r
// where molecule has been already drawn with fog)\r
// Transform:\r
// fragColor*AO*(1-fogFactor) + fogColor*fogFactor =\r
// = [fragColor*(1-fogFactor) = color - fogColor*fogFactor] =\r
// = (color - fogColor*fogFactor)*AO + fogColor*fogFactor =\r
// = color*AO + fogColor*fogFactor*(1 - AO)\r
// Result: gl_FragColor = color*AO + fogColor*fogFactor*(1 - AO)\r
float fogFactor = smoothstep(fogNearFar.x, fogNearFar.y, - viewPos.z) * fogColor.a;\r
gl_FragColor.rgb = color.rgb * res.rgb + fogColor.rgb * fogFactor *(vec3(1.0, 1.0, 1.0) - res.rgb);\r
#else\r
gl_FragColor.rgb = color.rgb * res.rgb;\r
#endif\r
gl_FragColor.a = color.a;\r
}\r
`,PX=[-2,-1,0,1,2],RA=class extends R.RawShaderMaterial{constructor(e){super(e),this.setValues.call(this,{uniforms:{diffuseTexture:{type:"t",value:null},depthTexture:{type:"t",value:null},srcTexelSize:{type:"v2",value:new R.Vector2(1/512,1/512)},aoMap:{type:"t",value:null},samplesOffsets:{type:"fv1",value:PX},projMatrix:{type:"mat4",value:new R.Matrix4},aspectRatio:{type:"f",value:0},tanHalfFOV:{type:"f",value:0},fogNearFar:{type:"v2",value:new R.Vector2(100,100)},fogColor:{type:"v4",value:new R.Vector4(0,.5,0,1)}},vertexShader:Ru,fragmentShader:LX,transparent:!1,depthTest:!1,depthWrite:!1}),this.setValues(e)}setValues(e){if(typeof e>"u")return;super.setValues(e);const t={};this.useFog&&(t.USE_FOG=1),this.fogTransparent&&(t.FOG_TRANSPARENT=1),this.defines=t}};RA.prototype.useFog=!0;RA.prototype.fogTransparent=!1;var NX=RA,IX=`precision highp float;\r
\r
uniform sampler2D srcL;\r
uniform sampler2D srcR;\r
varying vec2 vUv;\r
\r
void main() {\r
vec4 l = texture2D(srcL, vUv);\r
vec4 r = texture2D(srcR, vUv);\r
gl_FragColor = vec4(l.r, r.g, r.b, 1.0);\r
}\r
`,OX=class extends R.RawShaderMaterial{constructor(){super();const e={uniforms:{srcL:{type:"t",value:null},srcR:{type:"t",value:null}},vertexShader:Ru,fragmentShader:IX,transparent:!1,depthTest:!1,depthWrite:!1};this.setValues(e)}},DX=OX,zX=class{constructor(){this.position=new R.Vector3(0,0,0),this.scale=1,this.orientation=new R.Quaternion(0,0,0,1)}set(e,t,n){this.position=e,this.scale=t,this.orientation=n}},UX=1.5,BX=class{setup(e,t){this._startTime=void 0,this._endTime=void 0,this._isPaused=!1,this._srcView=e,this._dstView=t,this._isMoving=!1}isMoving(){return this._isMoving}wasStarted(){return typeof this._startTime<"u"&&typeof this._endTime<"u"}start(){this._startTime=Date.now();const e=Pe.now.interpolateViews?UX*1e3:0;this._endTime=this._startTime+e,this._isMoving=!0}getCurrentView(){if(typeof this._srcView>"u"||typeof this._dstView>"u"||!this._isMoving||!this.wasStarted())return{success:!1};let e=this.createView();const t=Date.now();if(t>this._endTime)return e=this._dstView,this.reset(),{success:!0,view:e};const n=(t-this._startTime)/(this._endTime-this._startTime);return e.position.copy(this._srcView.position),e.position.lerp(this._dstView.position,n),e.scale=(1-n)*this._srcView.scale+n*this._dstView.scale,e.orientation.copy(this._srcView.orientation),e.orientation.slerp(this._dstView.orientation,n),{success:!0,view:e}}reset(){this._startTime=this._endTime=0,this._isMoving=!1}pause(){this._isPaused||(this.setup(this.getCurrentView().view,this._dstView),this._isPaused=!0)}resume(){this._isPaused=!1}createView(){return new zX}},VX=4e3,FX="Cnt";function kX(e,t){const n=e.length,i=[];for(let r=0,s=0;s<n;r++,s+=t)i[r]=e.slice(s,s+t);return i}function ga(e,t){this.context=e,this._opts=We.default.merge({path:"/"},t)}w0(ga.prototype);ga.prototype.removeCookie=function(e){const t=this._toCount(e);let n=this._getSimpleCookie(t);if(!n){this._removeSimpleCookie(e);return}this._removeSimpleCookie(t),n=parseInt(n,10);for(let i=0;i<n;++i)this._removeSimpleCookie(e+i)};ga.prototype.setCookie=function(e,t){this.removeCookie(e),t=encodeURIComponent(t);const n=kX(t,VX-e.length-1),i=n.length;if(i===1){this._setSimpleCookie(e,t);return}const r=this._toCount(e);this._setSimpleCookie(r,i.toString());for(let s=0;s<i;++s)this._setSimpleCookie(e+s,n[s])};ga.prototype.getCookie=function(e){const t=this._toCount(e);let n=this._getSimpleCookie(t);if(!n)return this._getSimpleCookie(e);n=parseInt(n,10);const i=[];for(let r=0;r<n;++r)i[r]=this._getSimpleCookie(e+r);return i.join("")};ga.prototype._toCount=function(e){return e+FX};ga.prototype._removeSimpleCookie=function(e){document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`};ga.prototype._getExpirationDate=function(){const e=new Date;return e.setFullYear(e.getFullYear()+10),e};ga.prototype._setSimpleCookie=function(e,t){document.cookie=`${e}=${t};expires=${this._getExpirationDate().toUTCString()};path=${this._opts.path}`};ga.prototype._getSimpleCookie=function(e){const t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):""};ga.prototype._exists=function(e){return document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`))};var GX=ga;function HX(e){function t(s){s.style.display="",s.style.cursor="pointer",s.style.left="calc(50% - 50px)",s.style.width="100px",s.textContent="ENTER VR";let a=null;function c(){a.removeEventListener("end",c),s.textContent="ENTER VR",a=null}function u(d){d.addEventListener("end",c),e._gfx.renderer.xr.setReferenceSpaceType("local"),e._gfx.renderer.xr.setSession(d),s.textContent="EXIT VR",a=d}s.onmouseenter=function(){s.style.opacity="1.0"},s.onmouseleave=function(){s.style.opacity="0.5"},s.onclick=function(){a===null?(navigator.xr.requestSession("immersive-vr",{optionalFeatures:["local-floor","bounded-floor"]}).then(u),e.moveSceneBehindHeadset()):a.end()}}function n(s){s.style.display="",s.style.cursor="auto",s.style.left="calc(50% - 75px)",s.style.width="150px",s.textContent="VR NOT FOUND",s.onmouseenter=null,s.onmouseleave=null,s.onclick=null}function i(s){s.style.position="absolute",s.style.bottom="20px",s.style.padding="12px 6px",s.style.border="1px solid #fff",s.style.borderRadius="4px",s.style.background="transparent",s.style.color="#fff",s.style.font="normal 13px sans-serif",s.style.textAlign="center",s.style.opacity="0.5",s.style.outline="none",s.style.zIndex="999"}if("xr"in navigator){const s=document.createElement("button");return s.style.display="none",i(s),navigator.xr.isSessionSupported("immersive-vr").then(a=>a?t(s):n(s)),s}const r=document.createElement("a");return r.href="https://webvr.info",r.innerHTML="WEBXR NOT SUPPORTED",r.style.left="calc(50% - 90px)",r.style.width="180px",r.style.textDecoration="none",i(r),r}var WX=class{constructor(e){this._mainCamera=new R.PerspectiveCamera,this._button=null,this._onToggle=e,this._molContainer=new Xt.RCGroup,this._user=new Xt.RCGroup,this._scalingPivot=new R.Object3D,this._user.add(this._scalingPivot),this._controller1=null,this._controller2=null,this._pressedGripsCounter=0,this._distance=0,this._gfx=null}startScalingByControllers(){this._distance=this._controller1.position.distanceTo(this._controller2.position),Xt.getMiddlePoint(this._controller1.position,this._controller2.position,this._scalingPivot.position),this._scalingPivot.scale.set(1,1,1),this._scalingPivot.updateMatrix(),this._scalingPivot.updateMatrixWorld(),this._scalingPivot.addSavingWorldTransform(this._molContainer)}stopScalingByControllers(){this._gfx.scene.addSavingWorldTransform(this._molContainer)}handleGripsDown(e){this._pressedGripsCounter++,this._pressedGripsCounter===2?this.startScalingByControllers():this._pressedGripsCounter===1&&e.target.addSavingWorldTransform(this._molContainer)}handleGripsUp(e){this._pressedGripsCounter--,this._pressedGripsCounter===1?(this.stopScalingByControllers(),(e.target===this._controller1?this._controller2:this._controller1).addSavingWorldTransform(this._molContainer)):this._pressedGripsCounter===0&&this._gfx.scene.addSavingWorldTransform(this._molContainer)}enable(e){if(!e){Qi.warn("WebVR couldn't be enabled, because gfx is not defined");return}this._gfx=e;const{renderer:t,camera:n}=e;if(!t)throw new Error("No renderer is available to toggle WebVR");if(!n)throw new Error("No camera is available to toggle WebVR");t.xr.enabled=!0,this._button?this._button.style.display="block":(this._button=HX(this),document.body.appendChild(this._button)),this._mainFog=Pe.now.fog,Pe.set("fog",!1),this._plugVRNodesIntoScene(e,t),this._setControllersListeners(),this._onToggle&&this._onToggle(!0)}_plugVRNodesIntoScene(e,t){this._mainCamera.copy(e.camera),e.scene.add(this._user),e.scene.add(this._molContainer),this._molContainer.add(e.root),this._controller1=t.xr.getController(0),this._controller2=t.xr.getController(1);const n=this._createControllerMesh();this._controller1.add(n),this._controller2.add(n.clone()),this._user.add(this._controller1),this._user.add(this._controller2)}_setControllersListeners(){this._controller1.addEventListener("selectstart",e=>{this.handleGripsDown(e)}),this._controller1.addEventListener("selectend",e=>{this.handleGripsUp(e)}),this._controller2.addEventListener("selectstart",e=>{this.handleGripsDown(e)}),this._controller2.addEventListener("selectend",e=>{this.handleGripsUp(e)}),this._controller1.addEventListener("squeezestart",e=>{this.handleGripsDown(e)}),this._controller1.addEventListener("squeezeend",e=>{this.handleGripsUp(e)}),this._controller2.addEventListener("squeezestart",e=>{this.handleGripsDown(e)}),this._controller2.addEventListener("squeezeend",e=>{this.handleGripsUp(e)})}disable(){if(!this._gfx)return;const{renderer:e,camera:t}=this._gfx;if(!e)throw new Error("No renderer is available to toggle WebVR");e.setAnimationLoop(null);const n=e.xr.getSession();n&&n.end(),e.xr.enabled=!1,this._button&&(this._button.style.display="none"),Pe.set("fog",this._mainFog),this._unplugVRNodesFromScene(t),this._onToggle&&this._onToggle(!1)}_unplugVRNodesFromScene(e){this._mainCamera&&e&&e.copy(this._mainCamera);const t=this._molContainer.children[0];t&&this._gfx.scene.add(t),this._molContainer.parent.remove(this._molContainer),this._user&&this._gfx.scene.remove(this._user),this._molContainer=null,this._user=null,this._scalingPivot=null,this._user=null,this._controller1=null,this._controller2=null}_createControllerMesh(){const e=new R.CylinderGeometry(.04,.04,.3),t=new Ja({lights:!1,overrideColor:!0});t.setUberOptions({fixedColor:new R.Color(4474111)}),t.updateUniforms();const n=new R.Mesh(e,t);return n.rotateX(-Math.PI/2),n}updateMoleculeScale(){if(!this._controller1||!this._controller2)return;const e=this;if(e._pressedGripsCounter===2){Xt.getMiddlePoint(e._controller1.position,e._controller2.position,e._scalingPivot.position);const t=e._controller1.position.distanceTo(e._controller2.position),n=t/e._distance;e._scalingPivot.scale.multiplyScalar(n),e._distance=t}}moveSceneBehindHeadset(){const e=this._gfx,{camera:t}=e,n=this._molContainer;n.matrix.identity(),n.position.set(0,0,-4),n.updateMatrix(),n.matrixWorld.multiplyMatrices(t.matrixWorld,n.matrix),e.scene.addSavingWorldTransform(n),this._onToggle&&this._onToggle(!0)}getCanvas(){const e=this._gfx;return e&&e.renderer?e.renderer.domElement:null}},XX=`precision highp float;\r
\r
varying vec2 vUv;\r
uniform sampler2D srcTex;\r
uniform vec3 aberration;\r
\r
void main() {\r
vec2 uv = vUv * 2.0 - 1.0;\r
\r
gl_FragColor.r = texture2D(srcTex, 0.5 * (uv * aberration[0] + 1.0)).r;\r
gl_FragColor.g = texture2D(srcTex, 0.5 * (uv * aberration[1] + 1.0)).g;\r
gl_FragColor.b = texture2D(srcTex, 0.5 * (uv * aberration[2] + 1.0)).b;\r
gl_FragColor.a = 1.0;\r
}`,{selectors:_x,Atom:jX,Residue:YX,Chain:qX,Molecule:$X}=nr,Mi={COMPLEX:0,COMPONENT:1,FRAGMENT:2},SM="Could not find suitable loader for this source",ZX="Could not find suitable parser for this source";R.ColorManagement.enabled=!1;var{createElement:$y}=rt;function KX(e,t,n){e.near=t-n*Pe.now.fogNearFactor,e.far=t+n*Pe.now.fogFarFactor}function QC(e){const t=e.lastIndexOf(".");return t>=0&&(e=e.substr(0,t)),e}function QX(e){let t=!1;return e.forEachComponent(n=>{n.forEachResidue(i=>{i._isValid&&(t=!0)})}),t}function JC(e,t,n){n!==void 0?e.debug(`${t}... ${Math.floor(n*100)}%`):e.debug(`${t}...`)}function bS(){return Pe.now.fogColorEnable?Pe.now.fogColor:Pe.now.bg.color}function Ge(e){eo.call(this),this._opts=We.default.merge({settingsCookie:"settings",cookiePath:"/"},e),this._gfx=null,this._interpolator=new BX,this._container=e&&e.container||document.getElementById("miew-container")||We.default.head(document.getElementsByClassName("miew-container"))||document.body,this._containerRoot=this._container,this._running=!1,this._halting=!1,this._building=!1,this._needRender=!0,this._hotKeysEnabled=!0,this.settings=Pe;const t=Qi;t.console=!1,t.level="info",this.logger=t,this._cookies=new GX(this),this.restoreSettings(),e&&e.settings&&this.settings.set(e.settings),this._spinner=null,this._loading=[],this._animInterval=null,this._visuals={},this._curVisualName=null,this._objects=[],this._sourceWindow=null,this.reset(),this._repr&&t.debug(`Selected ${this._repr.mode.name} mode with ${this._repr.colorer.name} colorer.`);const n=this;Ge.registeredPlugins.forEach(i=>{i.call(n)}),this._initOnSettingsChanged()}Ge.prototype=Object.create(eo.prototype);Ge.prototype.constructor=Ge;Ge.prototype.getMaxRepresentationCount=function(){return ec.NUM_REPRESENTATION_BITS};function LA(e,t){const n=e;for(;n.firstChild;)n.removeChild(n.firstChild);n.appendChild(t)}Ge.prototype._updateShadowCamera=(function(){const e=new R.Matrix4,t=new R.Vector3,n={center:new R.Vector3,halfSize:new R.Vector3};return function(){this._gfx.scene.updateMatrixWorld();for(let i=0;i<this._gfx.scene.children.length;i++)if(this._gfx.scene.children[i].type==="DirectionalLight"){const r=this._gfx.scene.children[i];e.copy(r.shadow.camera.matrixWorldInverse),this.getOBB(e,n),t.subVectors(r.target.position,r.position),r.position.subVectors(n.center,t),r.target.position.copy(n.center),r.shadow.bias=.09,r.shadow.camera.bottom=-n.halfSize.y,r.shadow.camera.top=n.halfSize.y,r.shadow.camera.right=n.halfSize.x,r.shadow.camera.left=-n.halfSize.x,r.shadow.camera.near=t.length()-n.halfSize.z,r.shadow.camera.far=t.length()+n.halfSize.z,r.shadow.camera.updateProjectionMatrix()}}})();Ge.prototype.init=function(){const e=this._container,t=rt.createElement("div",{class:"miew-canvas"});LA(e,t),this._container=t;const n=document.createDocumentFragment();if(n.appendChild(this._msgMode=$y("div",{class:"mode-message overlay"},$y("p",{},"COMPONENT EDIT MODE"))),n.appendChild(this._msgAtomInfo=$y("div",{class:"atom-info overlay"},$y("p",{},""))),e.appendChild(n),this._gfx!==null)return!0;const i=this;this._showMessage("Viewer is being initialized...");try{this._initGfx(),this._initListeners(),this._spinner=new cV({lines:13,length:28,width:14,radius:42,color:"#fff",zIndex:700});const s=XN();s.addEventListener("keydown",c=>{i._onKeyDown(c)}),s.addEventListener("keyup",c=>{i._onKeyUp(c)}),this._objectControls=new ZW(this._gfx.root,this._gfx.pivot,this._gfx.camera,this._gfx.renderer.domElement,()=>i._getAltObj()),this._objectControls.addEventListener("change",c=>{switch(Pe.now.shadow.on&&i._updateShadowCamera(),c.action){case"rotate":i.dispatchEvent({type:"rotate",quaternion:c.quaternion});break;case"zoom":i.dispatchEvent({type:"zoom",factor:c.factor});break;default:i.dispatchEvent({type:c.action})}i.dispatchEvent({type:"transform"}),i._needRender=!0});const a=this._gfx;this._picker=new KW(a.root,a.camera,a.renderer.domElement),this._picker.addEventListener("newpick",c=>{i._onPick(c)}),this._picker.addEventListener("dblclick",c=>{i.center(c)})}catch(s){if(s.name==="TypeError"&&s.message==="Cannot read property 'getExtension' of null")this._showMessage("Could not create WebGL context.");else if(s.message.search(/webgl/i)>1)this._showMessage(s.message);else throw this._showMessage("Viewer initialization failed."),s;return!1}const r=this._opts&&this._opts.load;if(r){const s=this._opts&&this._opts.type;this.load(r,{fileType:s,keepRepsInfo:!0})}return!0};Ge.prototype.term=function(){this._showMessage("Viewer has been terminated."),this._loading.forEach(e=>{e.cancel()}),this._loading.length=0,this.halt(),this._gfx=null};Ge.prototype._showMessage=function(e){const t=document.createElement("div");t.setAttribute("class","miew-message"),t.appendChild(document.createElement("p")).appendChild(document.createTextNode(e)),LA(this._container,t)};Ge.prototype._showCanvas=function(){LA(this._container,this._gfx.renderer.domElement)};Ge.prototype._requestAnimationFrame=function(e){const{xr:t}=this._gfx.renderer;if(t&&t.enabled){this._gfx.renderer.setAnimationLoop(e);return}requestAnimationFrame(e)};function QN(e){return e.getExtension("EXT_frag_depth")}function JN(e){return e.getExtension("WEBGL_depth_texture")&&e.getExtension("WEBGL_draw_buffers")}Ge.prototype._initGfx=function(){const e={width:this._container.clientWidth,height:this._container.clientHeight},t={preserveDrawingBuffer:!0,alpha:!0,premultipliedAlpha:!1};Pe.now.antialias&&(t.antialias=!0),e.renderer2d=new qW,e.renderer=new R.WebGL1Renderer(t),e.renderer.shadowMap.enabled=Pe.now.shadow.on,e.renderer.shadowMap.autoUpdate=!1,e.renderer.shadowMap.type=R.PCFShadowMap,aN.init(e.renderer),QN(e.renderer.getContext())||Pe.set("zSprites",!1),JN(e.renderer.getContext())||Pe.set("ao",!1),e.renderer.autoClear=!1,e.renderer.setPixelRatio(window.devicePixelRatio),e.renderer.setSize(e.width,e.height),e.renderer.setClearColor(Pe.now.bg.color,+!Pe.now.bg.transparent),e.renderer.clearColor(),e.renderer2d.setSize(e.width,e.height),e.camera=new R.PerspectiveCamera(Pe.now.camFov,e.width/e.height,Pe.now.camNear,Pe.now.camFar),e.camera.setMinimalFov(Pe.now.camFov),e.camera.position.z=Pe.now.camDistance,e.camera.updateProjectionMatrix(),e.camera.layers.set(Xt.LAYERS.DEFAULT),e.camera.layers.enable(Xt.LAYERS.VOLUME),e.camera.layers.enable(Xt.LAYERS.VOLUME_BFPLANE),e.stereoCam=new R.StereoCamera,e.scene=new R.Scene;const n=bS();e.scene.fog=new R.Fog(n,Pe.now.camNear,Pe.now.camFar),e.root=new Xt.RCGroup,e.scene.add(e.root),e.pivot=new Xt.RCGroup,e.root.add(e.pivot),e.selectionScene=new R.Scene,e.selectionRoot=new R.Group,e.selectionRoot.matrixAutoUpdate=!1,e.selectionScene.add(e.selectionRoot),e.selectionPivot=new R.Group,e.selectionPivot.matrixAutoUpdate=!1,e.selectionRoot.add(e.selectionPivot);const i=new R.DirectionalLight(16777215,.45);i.position.set(0,.414,1),i.layers.enable(Xt.LAYERS.TRANSPARENT),i.castShadow=!0,i.shadow.bias=.09,i.shadow.radius=Pe.now.shadow.radius,i.shadow.camera.layers.set(Xt.LAYERS.SHADOWMAP);const r=e.renderer.getPixelRatio(),s=Math.max(e.width,e.height)*r;i.shadow.mapSize.width=s,i.shadow.mapSize.height=s,i.target.position.set(0,0,0),e.scene.add(i),e.scene.add(i.target);const a=new R.AmbientLight(6710886);a.layers.enable(Xt.LAYERS.TRANSPARENT),e.scene.add(a),e.axes=new JW(e.root,e.camera);const c=e.width*r,u=e.height*r;e.offscreenBuf=new R.WebGLRenderTarget(c,u,{minFilter:R.LinearFilter,magFilter:R.NearestFilter,format:R.RGBAFormat,depthBuffer:!0}),e.renderer.getContext().getExtension("WEBGL_depth_texture")&&(e.offscreenBuf.depthTexture=new R.DepthTexture,e.offscreenBuf.depthTexture.type=R.UnsignedShortType),e.offscreenBuf2=new R.WebGLRenderTarget(c,u,{minFilter:R.LinearFilter,magFilter:R.LinearFilter,format:R.RGBAFormat,depthBuffer:!1}),e.offscreenBuf3=new R.WebGLRenderTarget(c,u,{minFilter:R.LinearFilter,magFilter:R.LinearFilter,format:R.RGBAFormat,depthBuffer:!1}),e.offscreenBuf4=new R.WebGLRenderTarget(c,u,{minFilter:R.LinearFilter,magFilter:R.LinearFilter,format:R.RGBAFormat,depthBuffer:!1}),e.volBFTex=e.offscreenBuf3,e.volFFTex=e.offscreenBuf4,e.volWFFTex=e.offscreenBuf,e.renderer.getContext().getExtension("OES_texture_float")?(e.offscreenBuf5=new R.WebGLRenderTarget(c,u,{minFilter:R.LinearFilter,magFilter:R.LinearFilter,format:R.RGBAFormat,type:R.FloatType,depthBuffer:!1}),e.offscreenBuf6=new R.WebGLRenderTarget(c,u,{minFilter:R.LinearFilter,magFilter:R.LinearFilter,format:R.RGBAFormat,type:R.FloatType,depthBuffer:!1}),e.offscreenBuf7=new R.WebGLRenderTarget(c,u,{minFilter:R.LinearFilter,magFilter:R.LinearFilter,format:R.RGBAFormat,type:R.FloatType,depthBuffer:!0}),e.volBFTex=e.offscreenBuf5,e.volFFTex=e.offscreenBuf6,e.volWFFTex=e.offscreenBuf7):this.logger.warn("Device doesn't support OES_texture_float extension"),e.stereoBufL=new R.WebGLRenderTarget(c,u,{minFilter:R.LinearFilter,magFilter:R.LinearFilter,format:R.RGBAFormat,depthBuffer:!1}),e.stereoBufR=new R.WebGLRenderTarget(c,u,{minFilter:R.LinearFilter,magFilter:R.LinearFilter,format:R.RGBAFormat,depthBuffer:!1}),this._gfx=e,this._showCanvas(),this._embedWebXR(Pe.now.stereo==="WEBVR"),this._container.appendChild(e.renderer2d.getElement());const d=new mV;d.domElement.style.position="absolute",d.domElement.style.right="0",d.domElement.style.bottom="0",this._container.appendChild(d.domElement),this._fps=d,this._fps.show(Pe.now.fps)};Ge.prototype._initListeners=function(){const e=this;window.addEventListener("resize",()=>{e._onResize()})};Ge.prototype._makeUniqueVisualName=function(e){if(!e)return Math.random().toString();let t=e,n=1;for(;this._visuals.hasOwnProperty(t);)t=`${e} (${n.toString()})`,n++;return t};Ge.prototype._addVisual=function(e){if(!e)return null;const t=this._makeUniqueVisualName(e.name);return e.name=t,this._visuals[t]=e,this._gfx.pivot.add(e),e.getSelectionGeo&&this._gfx.selectionPivot.add(e.getSelectionGeo()),t};Ge.prototype._removeVisual=function(e){let t="",n=null;e instanceof f0?({name:t}=e,n=e):typeof e=="string"&&(t=e,n=this._visuals[t]),!(!n||!this._visuals.hasOwnProperty(t)||this._visuals[t]!==n)&&(t===this._curVisualName&&(this._curVisualName=void 0),delete this._visuals[t],n.release(),this._needRender=!0)};Ge.prototype._forEachVisual=function(e){for(const t in this._visuals)this._visuals.hasOwnProperty(t)&&e(this._visuals[t])};Ge.prototype._releaseAllVisuals=function(){if(!(!this._gfx||!this._gfx.pivot)){for(const e in this._visuals)this._visuals.hasOwnProperty(e)&&this._visuals[e].release();this._visuals={}}};Ge.prototype._forEachComplexVisual=function(e){if(!(!this._gfx||!this._gfx.pivot))for(const t in this._visuals)this._visuals.hasOwnProperty(t)&&this._visuals[t]instanceof ec&&e(this._visuals[t])};Ge.prototype._getComplexVisual=function(e){e=e||this._curVisualName;let t=null,n=null;return this._forEachComplexVisual(i=>{t=i,i.name===e&&(n=i)}),n||t};Ge.prototype._getVolumeVisual=function(){let e=null;return this._forEachVisual(t=>{t instanceof pA&&(e=t)}),e};Ge.prototype._getVisualForComplex=function(e){if(!e)return null;let t=null;return this._forEachComplexVisual(n=>{n.getComplex()===e&&(t=n)}),t};Ge.prototype.getVisuals=function(){return Object.keys(this._visuals)};Ge.prototype.getComplexVisualsCount=function(){let e=0;return this._forEachComplexVisual(()=>e++),e};Ge.prototype.getCurrentVisual=function(){return this._curVisualName};Ge.prototype.setCurrentVisual=function(e){this._visuals[e]&&(this._curVisualName=e)};Ge.prototype.run=function(){if(!this._running){if(this._running=!0,this._halting){this._halting=!1;return}this._objectControls.enable(!0),this._interpolator.resume(),this._requestAnimationFrame(()=>this._onTick())}};Ge.prototype.halt=function(){this._running&&(this._discardComponentEdit(),this._discardFragmentEdit(),this._objectControls.enable(!1),this._interpolator.pause(),this._halting=!0)};Ge.prototype.enableHotKeys=function(e){this._hotKeysEnabled=e,this._objectControls.enableHotkeys(e)};Ge.prototype._onResize=function(){const e=this._gfx;e&&(this._needRender=!0,e.width=this._container.clientWidth,e.height=this._container.clientHeight,e.camera.aspect=e.width/e.height,e.camera.setMinimalFov(Pe.now.camFov),e.camera.updateProjectionMatrix(),e.renderer.setSize(e.width,e.height),e.renderer2d.setSize(e.width,e.height),this.dispatchEvent({type:"resize"}))};Ge.prototype._resizeOffscreenBuffers=function(e,t,n){const i=this._gfx;n=n||"NONE";const r=n==="NONE"||n==="ANAGLYPH",s=r?1:.5;i.offscreenBuf.setSize(s*e,t),i.offscreenBuf2.setSize(s*e,t),i.offscreenBuf3.setSize(s*e,t),i.offscreenBuf4.setSize(s*e,t),i.offscreenBuf5&&i.offscreenBuf5.setSize(s*e,t),i.offscreenBuf6&&i.offscreenBuf6.setSize(s*e,t),i.offscreenBuf7&&i.offscreenBuf7.setSize(s*e,t),r&&(i.stereoBufL.setSize(e,t),i.stereoBufR.setSize(e,t))};Ge.prototype._onTick=function(){if(this._halting){this._running=!1,this._halting=!1;return}this._fps.update(),this._requestAnimationFrame(()=>this._onTick()),this._onUpdate(),this._needRender&&(this._onRender(),this._needRender=!Pe.now.suspendRender||Pe.now.stereo==="WEBVR")};Ge.prototype._getBSphereRadius=function(){let e=0;return this._forEachVisual(t=>{e=Math.max(e,t.getBoundaries().boundingSphere.radius)}),e*this._objectControls.getScale()};Ge.prototype.getOBB=(function(){const e=new R.Sphere,t=new R.Box3,n=new R.Box3,i=new R.Matrix4,r=[new R.Vector3,new R.Vector3,new R.Vector3,new R.Vector3];return function(s,a){n.makeEmpty(),this._forEachVisual(d=>{e.copy(d.getBoundaries().boundingSphere),e.applyMatrix4(d.matrixWorld).applyMatrix4(s),e.getBoundingBox(t),n.union(t)}),n.getCenter(a.center),i.copy(s).invert(),a.center.applyMatrix4(i);const{min:c}=n,{max:u}=n;r[0].set(c.x,c.y,c.z),r[1].set(u.x,c.y,c.z),r[2].set(c.x,u.y,c.z),r[3].set(c.x,c.y,u.z);for(let d=0,p=r.length;d<p;d++)r[d].applyMatrix4(i);a.halfSize.set(Math.abs(r[0].x-r[1].x),Math.abs(r[0].y-r[2].y),Math.abs(r[0].z-r[3].z)).multiplyScalar(.5)}})();Ge.prototype._updateFog=function(){const e=this._gfx;if(Pe.now.fog){if(typeof e.scene.fog>"u"||e.scene.fog===null){const t=bS();e.scene.fog=new R.Fog(t),this._setUberMaterialValues({fog:Pe.now.fog})}KX(e.scene.fog,e.camera.position.z,this._getBSphereRadius())}else e.scene.fog&&(e.scene.fog=void 0,this._setUberMaterialValues({fog:Pe.now.fog}))};Ge.prototype._onUpdate=function(){this.isScriptingCommandAvailable!==void 0&&this.isScriptingCommandAvailable()&&!this._building&&this.callNextCmd(),this._objectControls.update(),this._forEachComplexVisual(e=>{e.getComplex().update()}),Pe.now.autobuild&&!this._loading.length&&!this._building&&this._needRebuild()&&this.rebuild(),!this._loading.length&&!this._building&&!this._needRebuild()&&this._updateView(),this._updateFog(),this._gfx.renderer.xr.enabled&&this.webVR.updateMoleculeScale()};Ge.prototype._onRender=function(){const e=this._gfx;e.scene.updateMatrixWorld(),e.camera.updateMatrixWorld(),this._clipPlaneUpdateValue(this._getBSphereRadius()),this._fogFarUpdateValue(),e.renderer.setRenderTarget(null),e.renderer.clear(),this._renderFrame(Pe.now.stereo)};Ge.prototype._renderFrame=(function(){const e=new DX,t=new R.Vector2;return function(n){const i=this._gfx,{renderer:r}=i;r.getSize(t),n!=="NONE"&&(i.camera.focus=i.camera.position.z,i.stereoCam.aspect=1,n==="ANAGLYPH"?i.stereoCam.update(i.camera):i.stereoCam.updateHalfSized(i.camera,Pe.now.camFov));const s=i.renderer.getPixelRatio();switch(this._resizeOffscreenBuffers(t.width*s,t.height*s,n),this._renderShadowMap(),n){case"WEBVR":case"NONE":this._renderScene(i.camera,!1);break;case"SIMPLE":case"DISTORTED":r.setScissorTest(!0),r.setScissor(0,0,t.width/2,t.height),r.setViewport(0,0,t.width/2,t.height),this._renderScene(this._gfx.stereoCam.cameraL,n==="DISTORTED"),r.setScissor(t.width/2,0,t.width/2,t.height),r.setViewport(t.width/2,0,t.width/2,t.height),this._renderScene(this._gfx.stereoCam.cameraR,n==="DISTORTED"),r.setScissorTest(!1);break;case"ANAGLYPH":this._renderScene(this._gfx.stereoCam.cameraL,!1,i.stereoBufL),this._renderScene(this._gfx.stereoCam.cameraR,!1,i.stereoBufR),r.setRenderTarget(null),e.uniforms.srcL.value=i.stereoBufL.texture,e.uniforms.srcR.value=i.stereoBufR.texture,i.renderer.renderScreenQuad(e);break;default:}i.renderer2d.render(i.scene,i.camera),Pe.now.axes&&i.axes&&!i.renderer.xr.enabled&&i.axes.render(r)}})();Ge.prototype._onBgColorChanged=function(){const e=this._gfx,t=bS();e&&(e.scene.fog&&e.scene.fog.color.set(t),e.renderer.setClearColor(Pe.now.bg.color,+!Pe.now.bg.transparent)),this._needRender=!0};Ge.prototype._onFogColorChanged=function(){const e=this._gfx,t=bS();e&&e.scene.fog&&e.scene.fog.color.set(t),this._needRender=!0};Ge.prototype._setUberMaterialValues=function(e){this._gfx.root.traverse(t=>{(t instanceof R.Mesh||t instanceof R.LineSegments||t instanceof R.Line)&&t.material instanceof Ja&&(t.material.setValues(e),t.material.needsUpdate=!0)})};Ge.prototype._enableMRT=function(e,t,n){const i=this._gfx,r=i.renderer.getContext(),s=r.getExtension("WEBGL_draw_buffers"),{properties:a}=i.renderer;if(!e){s.drawBuffersWEBGL([r.COLOR_ATTACHMENT0,null]);return}i.renderer.setRenderTarget(n);const c=a.get(n.texture).__webglTexture;r.bindTexture(r.TEXTURE_2D,c),i.renderer.setRenderTarget(t);const u=a.get(t).__webglFramebuffer,d=a.get(t.texture).__webglTexture;r.bindFramebuffer(r.FRAMEBUFFER,u),u.width=t.width,u.height=t.height,r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,d,0),r.framebufferTexture2D(r.FRAMEBUFFER,s.COLOR_ATTACHMENT1_WEBGL,r.TEXTURE_2D,c,0),s.drawBuffersWEBGL([r.COLOR_ATTACHMENT0,s.COLOR_ATTACHMENT1_WEBGL])};Ge.prototype._renderScene=(function(){return function(e,t,n){t=t||!1,n=n||null;const i=this._gfx;if(i.renderer.setClearColor(Pe.now.bg.color,+!Pe.now.bg.transparent),i.renderer.setRenderTarget(n),i.renderer.clear(),i.renderer.xr.enabled){i.renderer.render(i.scene,e);return}i.renderer.setClearColor(0,0),i.renderer.setRenderTarget(i.offscreenBuf4),i.renderer.clearColor(),i.renderer.setClearColor(Pe.now.bg.color,+!Pe.now.bg.transparent),i.renderer.setRenderTarget(i.offscreenBuf),i.renderer.clear();const r=this._getComplexVisual()!==null,s=this._getVolumeVisual(),a=r&&Pe.now.ao;a&&this._enableMRT(!0,i.offscreenBuf,i.offscreenBuf4),Pe.now.transparency==="prepass"?this._renderWithPrepassTransparency(e,i.offscreenBuf):Pe.now.transparency==="standard"&&(i.renderer.setRenderTarget(i.offscreenBuf),i.renderer.render(i.scene,e)),a&&this._enableMRT(!1,null,null);const c=r&&Pe.now.outline.on,u=r&&Pe.now.fxaa,d=s!==null&&s.getMesh().material!=null;let p=a||c||d||u||t?i.offscreenBuf2:n,g=i.offscreenBuf;a?(this._performAO(g,i.offscreenBuf4,i.offscreenBuf.depthTexture,p,i.offscreenBuf3,i.offscreenBuf2),!u&&!t&&!d&&!c&&(g=p,p=n,i.renderer.setRenderTarget(p),i.renderer.renderScreenQuadFromTex(g.texture,1))):(i.renderer.setRenderTarget(p),i.renderer.renderScreenQuadFromTex(g.texture,1)),c&&(g=p,p=d||u||t?i.offscreenBuf3:n,g!=null&&this._renderOutline(e,i.offscreenBuf,g,p)),this._renderSelection(e,i.offscreenBuf,p),d&&(i.renderer.setRenderTarget(i.offscreenBuf),i.renderer.renderScreenQuadFromTex(p.texture,1),p=i.offscreenBuf,this._renderVolume(s,e,p,i.volBFTex,i.volFFTex,i.volWFFTex),!u&&!t&&(i.renderer.setRenderTarget(n),i.renderer.renderScreenQuadFromTex(p.texture,1))),g=p,u&&(p=t?i.offscreenBuf4:n,this._performFXAA(g,p),g=p),t&&(p=n,this._performDistortion(g,p,!0))}})();Ge.prototype._performDistortion=(function(){const e=new R.Scene,t=new R.OrthographicCamera(-1,1,1,-1,-500,1e3),n=new R.RawShaderMaterial({uniforms:{srcTex:{type:"t",value:null},aberration:{type:"fv3",value:new R.Vector3(1)}},vertexShader:Ru,fragmentShader:XX,transparent:!1,depthTest:!1,depthWrite:!1}),i=Xt.buildDistorionMesh(10,10,Pe.now.debug.stereoBarrel);return e.add(new So.Mesh(i,n)),function(r,s,a){this._gfx.renderer.setRenderTarget(s),this._gfx.renderer.clear(),a?(n.uniforms.srcTex.value=r.texture,n.uniforms.aberration.value.set(.995,1,1.01),this._gfx.renderer.render(e,t)):this._gfx.renderer.renderScreenQuadFromTexWithDistortion(r,Pe.now.debug.stereoBarrel)}})();Ge.prototype._renderOutline=(function(){const e=new ZN({depth:!0});return function(t,n,i,r){const s=this._gfx;e.uniforms.srcTex.value=i.texture,e.uniforms.srcDepthTex.value=n.depthTexture,e.uniforms.srcTexSize.value.set(n.width,n.height),e.uniforms.color.value=new R.Color(Pe.now.outline.color),e.uniforms.threshold.value=Pe.now.outline.threshold,e.uniforms.thickness.value=new R.Vector2(Pe.now.outline.thickness,Pe.now.outline.thickness),s.renderer.setRenderTarget(r),s.renderer.renderScreenQuad(e)}})();Ge.prototype._renderShadowMap=(function(){const e={minFilter:R.NearestFilter,magFilter:R.NearestFilter,format:R.RGBAFormat};return function(){if(!Pe.now.shadow.on)return;const t=this._gfx,n=t.renderer.getRenderTarget(),i=t.renderer.getActiveCubeFace(),r=t.renderer.getActiveMipmapLevel(),s=t.renderer.state;s.setBlending(R.NoBlending),s.buffers.color.setClear(1,1,1,1),s.buffers.depth.setTest(!0),s.setScissorTest(!1);for(let a=0;a<t.scene.children.length;a++)if(t.scene.children[a].type==="DirectionalLight"){const c=t.scene.children[a];c.shadow.map==null&&(c.shadow.map=new R.WebGLRenderTarget(c.shadow.mapSize.width,c.shadow.mapSize.height,e),c.shadow.camera.updateProjectionMatrix()),c.shadow.updateMatrices(c),t.renderer.setRenderTarget(c.shadow.map),t.renderer.clear(),t.renderer.render(t.scene,c.shadow.camera)}t.renderer.setRenderTarget(n,i,r)}})();Ge.prototype._hasSelectionToRender=function(){const e=this._gfx.selectionPivot;for(let t=0;t<e.children.length;t++)if(e.children[t].children.length>0)return!0;return!1};Ge.prototype._renderSelection=(function(){const e=new ZN;return function(t,n,i){const r=this,s=r._gfx;s.renderer.setClearColor("black",0),s.renderer.setRenderTarget(n),s.renderer.clear(!0,!1,!1),r._hasSelectionToRender()?(s.selectionRoot.matrix=s.root.matrix,s.selectionPivot.matrix=s.pivot.matrix,s.renderer.render(s.selectionScene,t)):s.renderer.renderDummyQuad(),s.renderer.setRenderTarget(i),s.renderer.renderScreenQuadFromTex(n.texture,.6),e.uniforms.srcTex.value=n.texture,e.uniforms.srcTexSize.value.set(n.width,n.height),s.renderer.renderScreenQuad(e)}})();Ge.prototype._checkVolumeRenderingSupport=function(e){if(!e)return!1;const t=this._gfx,n=t.renderer.getRenderTarget();t.renderer.setRenderTarget(e);const i=t.renderer.getContext(),r=i.checkFramebufferStatus(i.FRAMEBUFFER);return t.renderer.setRenderTarget(n),r!==i.FRAMEBUFFER_COMPLETE?(this.logger.warn("Device doesn't support electron density rendering"),!1):!0};Ge.prototype._renderVolume=(function(){const e=new mx.BackFacePosMaterial,t=new mx.FrontFacePosMaterial,n=new R.Matrix4().makeTranslation(.5,.5,.5),i=new R.Matrix4;let r;return function(s,a,c,u,d,p){const g=this._gfx;if(typeof r>"u"&&(r=this._checkVolumeRenderingSupport(u)),!r)return;const v=s.getMesh();v.rebuild(g.camera),g.renderer.setClearColor("black",0),g.renderer.setRenderTarget(u),g.renderer.clear(),g.renderer.setRenderTarget(d),g.renderer.clear(),g.renderer.setRenderTarget(p),g.renderer.clear(),g.renderer.setRenderTarget(u),a.layers.set(Xt.LAYERS.VOLUME_BFPLANE),g.renderer.render(g.scene,a),a.layers.set(Xt.LAYERS.VOLUME),g.scene.overrideMaterial=e,g.renderer.render(g.scene,a),g.renderer.setRenderTarget(d),a.layers.set(Xt.LAYERS.VOLUME),g.scene.overrideMaterial=t,g.renderer.render(g.scene,a),g.scene.overrideMaterial=null,a.layers.set(Xt.LAYERS.DEFAULT),i.copy(v.matrixWorld).invert(),Ja.prototype.uberOptions.world2colorMatrix.multiplyMatrices(n,i),a.layers.set(Xt.LAYERS.COLOR_FROM_POSITION),g.renderer.setRenderTarget(p),g.renderer.render(g.scene,a);const y=v.material;y.uniforms._BFRight.value=u.texture,y.uniforms._FFRight.value=d.texture,y.uniforms._WFFRight.value=p.texture,a.layers.set(Xt.LAYERS.VOLUME),g.renderer.setRenderTarget(c),g.renderer.render(g.scene,a),a.layers.set(Xt.LAYERS.DEFAULT)}})();Ge.prototype._renderWithPrepassTransparency=(function(){return function(e,t){const n=this._gfx;n.renderer.setRenderTarget(t),e.layers.set(Xt.LAYERS.DEFAULT),n.renderer.render(n.scene,e),e.layers.set(Xt.LAYERS.PREPASS_TRANSPARENT),n.renderer.getContext().colorMask(!1,!1,!1,!1),n.renderer.render(n.scene,e),n.renderer.getContext().colorMask(!0,!0,!0,!0),e.layers.set(Xt.LAYERS.TRANSPARENT),n.renderer.render(n.scene,e),e.layers.set(Xt.LAYERS.DEFAULT)}})();Ge.prototype._performFXAA=(function(){const e=new SX;return function(t,n){if(typeof t>"u"||typeof n>"u")return;const i=this._gfx;i.renderer.setClearColor(Pe.now.bg.color,+!Pe.now.bg.transparent),i.renderer.setRenderTarget(n),i.renderer.clear(),e.uniforms.srcTex.value=t.texture,e.uniforms.srcTexelSize.value.set(1/t.width,1/t.height),e.uniforms.bgColor.value.set(Pe.now.bg.color),e.bgTransparent!==Pe.now.bg.transparent&&(e.setValues({bgTransparent:Pe.now.bg.transparent}),e.needsUpdate=!0),i.renderer.renderScreenQuad(e)}})();Ge.prototype._performAO=(function(){const e=new AX,t=new RX,n=new NX,i=new R.Vector3;return function(r,s,a,c,u,d){if(!r||!s||!a||!c||!u||!d)return;const p=this._gfx,g=Math.tan(R.MathUtils.DEG2RAD*.5*p.camera.fov);e.uniforms.diffuseTexture.value=r.texture,e.uniforms.depthTexture.value=a,e.uniforms.normalTexture.value=s.texture,e.uniforms.srcTexelSize.value.set(1/r.width,1/r.height),e.uniforms.camNearFar.value.set(p.camera.near,p.camera.far),e.uniforms.projMatrix.value=p.camera.projectionMatrix,e.uniforms.aspectRatio.value=p.camera.aspect,e.uniforms.tanHalfFOV.value=g,p.root.matrix.extractScale(i),e.uniforms.kernelRadius.value=Pe.now.debug.ssaoKernelRadius*i.x,e.uniforms.depthThreshold.value=2*this._getBSphereRadius(),e.uniforms.factor.value=Pe.now.debug.ssaoFactor,p.renderer.setRenderTarget(d),p.renderer.renderScreenQuad(e),t.uniforms.aoMap.value=d.texture,t.uniforms.srcTexelSize.value.set(1/d.width,1/d.height),t.uniforms.depthTexture.value=a,p.renderer.setRenderTarget(u),p.renderer.renderScreenQuad(t),n.uniforms.aoMap.value=u.texture,n.uniforms.diffuseTexture.value=r.texture,n.uniforms.srcTexelSize.value.set(1/u.width,1/u.height),n.uniforms.depthTexture.value=a,n.uniforms.projMatrix.value=p.camera.projectionMatrix,n.uniforms.aspectRatio.value=p.camera.aspect,n.uniforms.tanHalfFOV.value=g;const{fog:v}=p.scene;v&&(n.uniforms.fogNearFar.value.set(v.near,v.far),n.uniforms.fogColor.value.set(v.color.r,v.color.g,v.color.b,Pe.now.fogAlpha)),(n.useFog!==Pe.now.fog||n.fogTransparent!==Pe.now.bg.transparent)&&(n.setValues({useFog:Pe.now.fog,fogTransparent:Pe.now.bg.transparent}),n.needsUpdate=!0),p.renderer.setRenderTarget(c),p.renderer.renderScreenQuad(n)}})();Ge.prototype.reset=function(){this._picker&&this._picker.reset(),this._lastPick=null,this._releaseAllVisuals(),this._setEditMode(Mi.COMPLEX),this._resetObjects(),this._gfx&&(Xt.clearTree(this._gfx.pivot),this._gfx.renderer2d.reset()),this.setNeedRender()};Ge.prototype._resetScene=function(){this._objectControls.reset(),this._objectControls.allowTranslation(!0),this._objectControls.allowAltObjFreeRotation(!0),this.resetReps(),this.resetPivot(),this.rebuildAll()};Ge.prototype.resetView=function(){this._picker&&this._picker.reset(),this._setEditMode(Mi.COMPLEX),this._resetScene(),this._forEachComplexVisual(e=>{e.updateSelectionMask({}),e.rebuildSelectionGeometry()})};Ge.prototype._export=function(e){const t=We.default.head(wu.exporters.find({format:e}));if(!t)return this.logger.error("Could not find suitable exporter for this source"),Promise.reject(new Error("Could not find suitable exporter for this source"));if(this.dispatchEvent({type:"exporting"}),this._visuals[this._curVisualName]instanceof ec){let n=null;return t.SourceClass===ec?n=this._visuals[this._curVisualName]:t.SourceClass===iA&&(n=this._visuals[this._curVisualName]._complex),new t(n,{miewVersion:Ge.VERSION}).export().then(i=>i)}return this._visuals[this._curVisualName]instanceof pA?Promise.reject(new Error("Sorry, exporter for volume data not implemented yet")):Promise.reject(new Error("Unexpected format of data"))};var JX=/^(?:(pdb|cif|ccp4|dsn6):\s*)?(\d[a-z\d]{3})$/i,ej=/^(?:pc|pubchem):\s*([a-z]+)$/i,tj=/^([a-z][a-z\d\-+.]*):/i;function nj(e,t){if(!We.default.isString(e))return e;const n=JX.exec(e);if(n){let[,r="pdb",s]=n;switch(r=r.toLowerCase(),s=s.toUpperCase(),r){case"pdb":e=`https://files.rcsb.org/download/${s}.pdb`;break;case"cif":e=`https://files.rcsb.org/download/${s}.cif`;break;case"ccp4":e=`https://www.ebi.ac.uk/pdbe/coordinates/files/${s.toLowerCase()}.ccp4`;break;case"dsn6":e=`https://edmaps.rcsb.org/maps/${s.toLowerCase()}_2fofc.dsn6`;break;default:throw new Error("Unexpected data format shortcut")}return t.fileType=r,t.fileName=`${s}.${r}`,t.sourceType="url",e}const i=ej.exec(e);if(i){const r=i[1].toLowerCase();return e=`https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/${r}/JSON?record_type=3d`,t.fileType="pubchem",t.fileName=`${r}.json`,t.sourceType="url",e}return(t.sourceType==="url"||t.sourceType===void 0)&&(t.sourceType="url",tj.test(e)||(e=rt.resolveURL(e))),e}function ij(e){let{binary:t}=e;if(e.fileType!==void 0){const n=We.default.head(wu.parsers.find({format:e.fileType}));if(n)t=n.binary||!1;else throw new Error("Could not find suitable parser for this format")}if(t===void 0&&e.fileExt!==void 0){const n=We.default.head(wu.parsers.find({ext:e.fileExt}));n&&(t=n.binary||!1)}e.fileExt!==void 0&&e.fileExt.toLowerCase()===".man"&&(e.binary=!0,e.animation=!0),t!==void 0&&e.binary!==void 0&&e.binary!==t&&e.context.logger.warn("Overriding incorrect binary mode"),e.binary=t||!1}function rj(e,t,n){return new Promise(i=>{if(n.shouldCancel())throw new Error("Operation cancelled");n.notify({type:"fetching"}),e=nj(e,t);const r=We.default.head(wu.loaders.find({type:t.sourceType,source:e}));if(!r)throw new Error(SM);const s=t.fileName||r.extractName(e);if(s){const[u,d]=rt.splitFileName(s);We.default.defaults(t,{name:u,fileExt:d,fileName:s})}ij(t);let a=We.default.get(t,"preset.expression");if(!We.default.isUndefined(a)&&(a=JSON.parse(a),a&&a.settings)){const u=["singleUnit"];for(let d=0,p=u.length;d<p;++d){const g=u[d],v=We.default.get(a.settings,g);We.default.isUndefined(v)||Pe.set(g,v)}}const c=new r(e,t);c.context=t.context,n.addEventListener("cancel",()=>c.abort()),c.addEventListener("progress",u=>{u.lengthComputable&&u.total>0?JC(c.logger,"Fetching",u.loaded/u.total):JC(c.logger,"Fetching")}),console.time("fetch"),i(c.load().then(u=>(console.timeEnd("fetch"),t.context.logger.info("Fetching finished"),n.notify({type:"fetchingDone",data:u}),u)).catch(u=>{throw console.timeEnd("fetch"),t.context.logger.debug(u.message),u.stack&&t.context.logger.debug(u.stack),t.context.logger.error("Fetching failed"),n.notify({type:"fetchingDone",error:u}),u}))})}function sj(e,t,n){if(n.shouldCancel())return Promise.reject(new Error("Operation cancelled"));n.notify({type:"parsing"});const i=We.default.head(wu.parsers.find({format:t.fileType,ext:t.fileExt,data:e}));if(!i)return Promise.reject(new Error("Could not find suitable parser"));const r=new i(e,t);return r.context=t.context,n.addEventListener("cancel",()=>r.abort()),console.time("parse"),r.parse().then(s=>(console.timeEnd("parse"),n.notify({type:"parsingDone",data:s}),s)).catch(s=>{throw console.timeEnd("parse"),t.error=s,t.context.logger.debug(s.message),s.stack&&t.context.logger.debug(s.stack),t.context.logger.error("Parsing failed"),n.notify({type:"parsingDone",error:s}),s})}Ge.prototype.load=function(e,t){t=We.default.merge({},t,{context:this}),this.settings.now.use.multiFile||(this._loading.length&&(this._loading.forEach(r=>{r.cancel()}),this._loading.length=0),t.animation||this.reset(!0)),this._interpolator.reset(),this.dispatchEvent({type:"loading",options:t,source:e});const n=new kV;this._loading.push(n),n.addEventListener("notification",r=>{this.dispatchEvent(r.slaveEvent)}),this._spinner.spin(this._container);const i=r=>{const s=this._loading.indexOf(n);return s!==-1&&this._loading.splice(s,1),this._spinner.stop(),this._refreshTitle(),n.notify({type:"loadingDone",anything:r}),r};return rj(e,t,n).then(r=>sj(r,t,n)).then(r=>i(this._onLoad(r,t))).catch(r=>{throw this.logger.error("Could not load data"),this.logger.debug(r),i(r)})};Ge.prototype.unload=function(e){this._removeVisual(e||this.getCurrentVisual()),this.resetPivot(),Pe.now.shadow.on&&this._updateShadowCamera()};Ge.prototype._startAnimation=function(e){this._stopAnimation();const t=this,n=this._getComplexVisual();if(n===null){this.logger.error("Unable to start animation - no molecule is loaded.");return}try{this._frameInfo=new _X(n.getComplex(),e,{onLoadStatusChanged(){t.dispatchEvent({type:"mdPlayerStateChanged",state:{isPlaying:t._isAnimating,isLoading:t._frameInfo?t._frameInfo.isLoading:!0}})},onError(i){t._stopAnimation(),t.logger.error(i)}})}catch{this.logger.error("Animation file does not fit to current complex!");return}this._continueAnimation()};Ge.prototype._pauseAnimation=function(){this._animInterval!==null&&(this._isAnimating=!1,clearInterval(this._animInterval),this._animInterval=null,this._frameInfo&&this.dispatchEvent({type:"mdPlayerStateChanged",state:{isPlaying:this._isAnimating,isLoading:this._frameInfo.isLoading}}))};Ge.prototype._continueAnimation=function(){this._isAnimating=!0;let e=1e3/Pe.now.maxfps;e=Number.isNaN(e)?0:e;const t=this,{pivot:n}=t._gfx,i=this._getComplexVisual();i&&(i.resetSelectionMask(),i.rebuildSelectionGeometry(),this._msgAtomInfo.style.opacity=0),this._animInterval=setInterval(()=>{if(t.dispatchEvent({type:"mdPlayerStateChanged",state:{isPlaying:t._isAnimating,isLoading:t._frameInfo.isLoading}}),t._frameInfo.frameIsReady){n.updateToFrame(t._frameInfo),t._updateObjsToFrame(t._frameInfo),t._refreshTitle(` Frame ${t._frameInfo._currFrame} of ${t._frameInfo._framesCount} time interval - ${t._frameInfo._timeStep}`);try{t._frameInfo.nextFrame()}catch{t.logger.error("Error during animation"),t._stopAnimation();return}t._needRender=!0}},e)};Ge.prototype._stopAnimation=function(){this._animInterval!==null&&(clearInterval(this._animInterval),this._frameInfo.disableEvents(),this._frameInfo=null,this._animInterval=null,this.dispatchEvent({type:"mdPlayerStateChanged",state:null}))};Ge.prototype._onLoad=function(e,t){const n=this._gfx;let i=null;if(t.animation)return this._refreshTitle(),this._startAnimation(e),null;if(this._stopAnimation(),(!t||!t.keepRepsInfo)&&(this._opts.reps=null,this._opts._objects=null),e.id==="Complex"){const r=e;t.fileName?r.name=r.name||QC(t.fileName).toUpperCase():t.amberFileName?r.name=r.name||QC(t.amberFileName).toUpperCase():r.name=`Dynamic ${t.fileType} molecule`,i=this._addVisual(new ec(r.name,r)),this._curVisualName=i;const s=this.info();if(this.logger.info(`Parsed ${t.fileName} (${s.atoms} atoms, ${s.bonds} bonds, ${s.residues} residues, ${s.chains} chains).`),We.default.isNumber(this._opts.unit)&&r.setCurrentUnit(this._opts.unit),!t.preset)if(Pe.now.autoPreset)switch(t.fileType){case"cml":this.resetReps("small");break;case"pdb":case"mmtf":case"cif":QX(r)?this.resetReps("macro"):this.resetReps("small");break;default:this.resetReps("default");break}else this.resetReps("default")}else e.id==="Volume"&&(this.resetEd(),i=this._onLoadEd(e));return n.camera.updateProjectionMatrix(),this._updateFog(),n.root.resetTransform(),this.resetPivot(),this._objectControls.setScale(Pe.now.radiusToFit/this._getBSphereRadius()),this._resetObjects(),Pe.now.autoResolution&&this._tweakResolution(),Pe.now.shadow.on&&this._updateShadowCamera(),this._opts.view&&(this.view(this._opts.view),delete this._opts.view),this._refreshTitle(),i};Ge.prototype.resetEd=function(){this._edLoader&&(this._edLoader.abort(),this._edLoader=null),this._removeVisual(this._getVolumeVisual()),this._needRender=!0};Ge.prototype.loadEd=function(e){this.resetEd();const t=We.default.head(wu.loaders.find({source:e}));if(!t)return this.logger.error(SM),Promise.reject(new Error(SM));const n=this._edLoader=new t(e,{binary:!0});return n.context=this,n.load().then(i=>{const r=We.default.head(wu.parsers.find({format:"ccp4"}));if(!r)throw new Error(ZX);const s=new r(i);return s.context=this,s.parse().then(a=>{this._onLoadEd(a)})}).catch(i=>{this.logger.error("Could not load ED data"),this.logger.debug(i)})};Ge.prototype._onLoadEd=function(e){e.normalize();const t=new pA("volume",e);t.getMesh().layers.set(Xt.LAYERS.VOLUME);const n=this._addVisual(t);return this._needRender=!0,n};Ge.prototype._needRebuild=function(){let e=!1;return this._forEachComplexVisual(t=>{e=e||t.needsRebuild()}),e};Ge.prototype._rebuildObjects=function(){const e=this,t=this._gfx;let n,i;const r=[];for(n=0;n<t.pivot.children.length;++n){const s=t.pivot.children[n];s instanceof f0||r.push(s)}for(n=0;n<r.length;++n)r[n].parent.remove(r[n]);setTimeout(()=>{const s=e._objects;for(n=0,i=s.length;n<i;++n){const a=s[n];a.needsRebuild&&a.build(),a.getGeometry()&&t.pivot.add(a.getGeometry())}},10)};Ge.prototype.changeUnit=function(e,t){const n=this._getComplexVisual(t);if(!n)throw new Error("There is no complex to change!");function i(){const r=n?n.getComplex().getCurrentUnit():0;return`Current unit: ${r} (${r>0?`Bio molecule ${r}`:"Asymmetric unit"})`}return e===void 0||(We.default.isString(e)&&(e=Math.max(parseInt(e,10),0)),n.getComplex().setCurrentUnit(e)&&(this._resetScene(),this._updateInfoPanel())),i()};Ge.prototype.rebuild=function(){if(this._building){this.logger.warn("Miew.rebuild(): already building!");return}this._building=!0,this.dispatchEvent({type:"rebuilding"}),this._rebuildObjects(),this._gfx.renderer2d.reset();const e=[];this._forEachComplexVisual(n=>{n.needsRebuild()&&e.push(n.rebuild().then(()=>new Promise(i=>{n.rebuildSelectionGeometry(),i()})))});const t=this;this._spinner.spin(this._container),Promise.all(e).then(()=>{t._spinner.stop(),t._needRender=!0,t._refreshTitle(),this.dispatchEvent({type:"buildingDone"}),t._building=!1})};Ge.prototype.rebuildAll=function(){this._forEachComplexVisual(e=>{e.setNeedsRebuild()})};Ge.prototype._refreshTitle=function(e){let t;e=e===void 0?"":e;const n=this._getComplexVisual();if(n){t=n.getComplex().name;const i=n.repGet(n.repCurrent());t+=i?` – ${i.mode.name} Mode`:""}else t=Object.keys(this._visuals).length>0?"Unknown":"No Data";t+=e,this.dispatchEvent({type:"titleChanged",data:t})};Ge.prototype.setNeedRender=function(){this._needRender=!0};Ge.prototype._extractRepresentation=function(){const e=[];this._forEachComplexVisual(t=>{if(t.getSelectionCount()===0)return;const n=t.buildSelectorFromMask(1<<t.getSelectionBit()),i=Pe.now.presets.default,r=t.repAdd({selector:n,mode:i[0].mode.id,colorer:i[0].colorer.id,material:i[0].material.id});if(!r){t.repCount()===ec.NUM_REPRESENTATION_BITS&&this.logger.warn(`Number of representations is limited to ${ec.NUM_REPRESENTATION_BITS}`);return}this.dispatchEvent({type:"repAdded",index:r.index,name:t.name}),t.repCurrent(r.index),e.push(t.name)}),e.length>0&&this.logger.report(`New representation from selection for complexes: ${e.join(", ")}`)};Ge.prototype._setReps=function(e){e=e||this._opts&&this._opts.reps||[],this._forEachComplexVisual(t=>t.resetReps(e))};Ge.prototype.applyPreset=function(e){const{presets:t}=Pe.now,n=[e||Pe.defaults.preset,Pe.defaults.preset,Object.keys(t)[0]];let i=null;for(let r=0;!i&&r<n.length;++r)Pe.set("preset",n[r]),i=t[Pe.now.preset],i||this.logger.warn(`Unknown preset "${Pe.now.preset}"`);this._setReps(i)};Ge.prototype.resetReps=function(e){const t=this._opts&&this._opts.reps;t?this._setReps(t):this.applyPreset(e)};Ge.prototype.repCount=function(e){const t=this._getComplexVisual(e);return t?t.repCount():0};Ge.prototype.repCurrent=function(e,t){const n=this._getComplexVisual(t),i=n?n.repCurrent(e):-1;return e&&i!==e&&this.logger.warn(`Representation ${e} was not found. Current rep remains unchanged.`),i};Ge.prototype.rep=function(e,t){const n=this._getComplexVisual("");if(!n)return null;const i=n.rep(e,t);return i.status==="created"?this.dispatchEvent({type:"repAdded",index:i.index,name:n.name}):i.status==="changed"&&this.dispatchEvent({type:"repChanged",index:i.index,name:n.name}),i.desc};Ge.prototype.repGet=function(e,t){const n=this._getComplexVisual(t);return n?n.repGet(e):null};Ge.prototype.repAdd=function(e,t){const n=this._getComplexVisual(t);if(!n)return-1;const i=n.repAdd(e);return i?(this.dispatchEvent({type:"repAdded",index:i.index,name:t}),i.index):-1};Ge.prototype.repRemove=function(e,t){const n=this._getComplexVisual(t);n&&(n.repRemove(e),this.dispatchEvent({type:"repRemoved",index:e,name:t}))};Ge.prototype.repHide=function(e,t,n){this._needRender=!0;const i=this._getComplexVisual(n);return i?i.repHide(e,t):null};Ge.prototype._setEditMode=function(e){this._editMode=e;const t=this._msgMode;if(t&&(t.style.opacity=e===Mi.COMPLEX?0:1,e!==Mi.COMPLEX)){const n=t.getElementsByTagName("p")[0];n.innerHTML=e===Mi.COMPONENT?"COMPONENT EDIT MODE":"FRAGMENT EDIT MODE"}this.dispatchEvent({type:"editModeChanged",data:e===Mi.COMPLEX})};Ge.prototype._enterComponentEditMode=function(){if(this._editMode!==Mi.COMPLEX)return;const e=[];this._forEachComplexVisual(t=>{const n=t.beginComponentEdit();n&&e.push(n)}),e!==[]&&(this._editors=e,this.logger.info("COMPONENT EDIT MODE -- ON"),this._setEditMode(Mi.COMPONENT),this._objectControls.keysTranslateObj(!0))};Ge.prototype._applyComponentEdit=function(){if(this._editMode===Mi.COMPONENT){this._objectControls.stop(),this._objectControls.keysTranslateObj(!1);for(let e=0;e<this._editors.length;++e)this._editors[e].apply();this._editors=[],this.logger.info("COMPONENT EDIT MODE -- OFF (applied)"),this._setEditMode(Mi.COMPLEX),this.rebuildAll()}};Ge.prototype._discardComponentEdit=function(){if(this._editMode===Mi.COMPONENT){this._objectControls.stop(),this._objectControls.keysTranslateObj(!1);for(let e=0;e<this._editors.length;++e)this._editors[e].discard();this._editors=[],this.logger.info("COMPONENT EDIT MODE -- OFF (discarded)"),this._setEditMode(Mi.COMPLEX),this._needRender=!0,this.rebuildAll()}};Ge.prototype._enterFragmentEditMode=function(){if(this._editMode!==Mi.COMPLEX)return;const e=[];if(this._forEachComplexVisual(n=>{n instanceof ec&&n.getSelectionCount()>0&&e.push(n)}),e.length!==1)return;const t=e[0].beginFragmentEdit();t&&(this._editors=[t],this.logger.info("FRAGMENT EDIT MODE -- ON (single bond)"),this._setEditMode(Mi.FRAGMENT),this._objectControls.allowTranslation(!1),this._objectControls.allowAltObjFreeRotation(t.isFreeRotationAllowed()),this._needRender=!0)};Ge.prototype._applyFragmentEdit=function(){if(this._editMode===Mi.FRAGMENT){this._objectControls.stop();for(let e=0;e<this._editors.length;++e)this._editors[e].apply();this._editors=[],this.logger.info("FRAGMENT EDIT MODE -- OFF (applied)"),this._setEditMode(Mi.COMPLEX),this._objectControls.allowTranslation(!0),this._objectControls.allowAltObjFreeRotation(!0),this.rebuildAll()}};Ge.prototype._discardFragmentEdit=function(){if(this._editMode===Mi.FRAGMENT){this._objectControls.stop();for(let e=0;e<this._editors.length;++e)this._editors[e].discard();this._editors=[],this.logger.info("FRAGMENT EDIT MODE -- OFF (discarded)"),this._setEditMode(Mi.COMPLEX),this._objectControls.allowTranslation(!0),this._objectControls.allowAltObjFreeRotation(!0),this._needRender=!0}};Ge.prototype._onPick=function(e){if(!Pe.now.picking||this._animInterval!==null||this._editMode===Mi.FRAGMENT||this._objectControls.isEditingAltObj())return;let t=null;e.obj.atom?(t=e.obj.atom.residue.getChain().getComplex(),this._lastPick=e.obj.atom):e.obj.residue?(t=e.obj.residue.getChain().getComplex(),this._lastPick=e.obj.residue):e.obj.chain?(t=e.obj.chain.getComplex(),this._lastPick=e.obj.chain):e.obj.molecule?(t=e.obj.molecule.complex,this._lastPick=e.obj.molecule):this._lastPick=null;function n(i){i.updateSelectionMask(e.obj),i.rebuildSelectionGeometry()}if(t){const i=this._getVisualForComplex(t);i&&(n(i),this._needRender=!0)}else this._forEachComplexVisual(n),this._needRender=!0;this._updateInfoPanel(),this.dispatchEvent(e)};Ge.prototype._onKeyDown=function(e){if(!(!this._running||!this._hotKeysEnabled)){if(Pe.now.editing)switch(e.code){case"KeyC":this._enterComponentEditMode();break;case"KeyF":this._enterFragmentEditMode();break;case"KeyA":switch(this._editMode){case Mi.COMPONENT:this._applyComponentEdit();break;case Mi.FRAGMENT:this._applyFragmentEdit();break;default:break}break;case"KeyD":switch(this._editMode){case Mi.COMPONENT:this._discardComponentEdit();break;case Mi.FRAGMENT:this._discardFragmentEdit();break;default:break}break;default:}switch(e.code){case"NumpadAdd":e.altKey&&(e.preventDefault(),e.stopPropagation(),this._forEachComplexVisual(t=>{t.expandSelection(),t.rebuildSelectionGeometry()}),this._updateInfoPanel(),this._needRender=!0);break;case"NumpadSubtract":e.altKey&&(e.preventDefault(),e.stopPropagation(),this._forEachComplexVisual(t=>{t.shrinkSelection(),t.rebuildSelectionGeometry()}),this._updateInfoPanel(),this._needRender=!0);break;default:}}};Ge.prototype._onKeyUp=function(e){!this._running||!this._hotKeysEnabled||e.code==="KeyX"&&this._extractRepresentation()};Ge.prototype._updateInfoPanel=function(){const e=this._msgAtomInfo.getElementsByTagName("p")[0];let t,n,i=0;for(this._forEachComplexVisual(u=>{i+=u.getSelectionCount()});e.firstChild;)e.removeChild(e.firstChild);if(i===0){this._msgAtomInfo.style.opacity=0;return}let r=`${String(i)} atom${i!==1?"s":""} selected`;this._lastPick!==null&&(r+=", the last pick:");let s="",a="",c="";if(this._lastPick instanceof jX){t=this._lastPick,n=t.residue,a=t.name;const u=t.location!==32?String.fromCharCode(t.location):"";s=`${t.element.fullName} #${t.serial}${u}: ${n._chain._name}.${n._type._name}${n._sequence}${n._icode.trim()}.`,s+=a,c=`Coord: (${t.position.x.toFixed(2).toString()}, ${t.position.y.toFixed(2).toString()}, ${t.position.z.toFixed(2).toString()})`}else this._lastPick instanceof YX?(n=this._lastPick,s=`${n._type._fullName}: ${n._chain._name}.${n._type._name}${n._sequence}${n._icode.trim()}`):this._lastPick instanceof qX?s=`chain ${this._lastPick._name}`:this._lastPick instanceof $X&&(s=`molecule ${this._lastPick._name}`);e.appendChild(document.createTextNode(r)),s!==""&&(e.appendChild(document.createElement("br")),e.appendChild(document.createTextNode(s))),c!==""&&(e.appendChild(document.createElement("br")),e.appendChild(document.createTextNode(c))),this._msgAtomInfo.style.opacity=1};Ge.prototype._getAltObj=function(){if(this._editors){let e=null;for(let t=0;t<this._editors.length;++t){const n=this._editors[t].getAltObj();if(n.objects.length>0){if(e){e=null;break}e=n}}if(e)return e}return{objects:[],pivot:new R.Vector3(0,0,0)}};Ge.prototype.resetPivot=(function(){const e=new R.Box3,t=new R.Vector3;return function(){e.makeEmpty(),this._forEachVisual(n=>{e.union(n.getBoundaries().boundingBox)}),e.getCenter(t),this._objectControls.setPivot(t.negate()),this.dispatchEvent({type:"transform"})}})();Ge.prototype.setPivotResidue=(function(){const e=new R.Vector3;return function(t){const n=this._getVisualForComplex(t.getChain().getComplex());if(n){if(t._controlPoint)e.copy(t._controlPoint);else{let i=0,r=0,s=0;const a=t._atoms.length;for(let c=0;c<a;++c){const u=t._atoms[c].position;i+=u.x/a,r+=u.y/a,s+=u.z/a}e.set(i,r,s)}e.applyMatrix4(n.matrix).negate(),this._objectControls.setPivot(e),this.dispatchEvent({type:"transform"})}}})();Ge.prototype.setPivotAtom=(function(){const e=new R.Vector3;return function(t){const n=this._getVisualForComplex(t.residue.getChain().getComplex());n&&(e.copy(t.position),e.applyMatrix4(n.matrix).negate(),this._objectControls.setPivot(e),this.dispatchEvent({type:"transform"}))}})();Ge.prototype.getSelectionCenter=(function(){const e=new R.Vector3(0,0,0);return function(t,n,i){t.set(0,0,0);let r=0;return this._forEachComplexVisual(s=>{s.getSelectionCenter(e,n,i||s.getSelectionBit())&&(t.add(e),r++)}),r===0?!1:(t.divideScalar(r),t.negate(),!0)}})();Ge.prototype.setPivotSubset=(function(){const e=new R.Vector3(0,0,0);function t(i,r){return i.mask&1<<r}function n(i,r){return r.selector.includesAtom(i)}return function(i){const r=i?n:t;this.getSelectionCenter(e,r,i)?(this._objectControls.setPivot(e),this.dispatchEvent({type:"transform"})):this.logger.warn("selection is empty. Center operation not performed")}})();Ge.prototype.screenshot=function(e,t){const n=this._gfx,i=n.renderer.domElement.width,r=n.renderer.domElement.height;function s(d){return Math.tan(R.MathUtils.degToRad(.5*d))}function a(d){return R.MathUtils.radToDeg(Math.atan(d))*2}function c(){let d;if(rt.getBrowser()===rt.browserType.SAFARI){const p=document.createElement("canvas"),g=p.getContext("2d");p.width=e===void 0?i:e,p.height=t===void 0?r:t,g.drawImage(n.renderer.domElement,0,0,p.width,p.height),d=p.toDataURL("image/png")}else d=n.renderer.domElement.toDataURL("image/png");return d}t=t||e;let u;if(e===void 0&&t===void 0||e===i&&t===r)u=c();else{const d=n.camera.aspect,p=n.camera.fov,g=s(n.camera.fov)*Math.min(n.width,n.height)/n.height,v=e/t;n.renderer.setPixelRatio(1),n.camera.aspect=v,n.camera.fov=a(g/Math.min(v,1)),n.camera.updateProjectionMatrix(),n.renderer.setDrawingBufferSize(e,t,1),this._renderFrame(Pe.now.stereo),u=c(),n.renderer.setPixelRatio(window.devicePixelRatio),n.camera.aspect=d,n.camera.fov=p,n.camera.updateProjectionMatrix(),n.renderer.setDrawingBufferSize(n.width,n.height,window.devicePixelRatio),this._needRender=!0}return u};Ge.prototype.screenshotSave=function(e,t,n){const i=this.screenshot(t,n);rt.shotDownload(i,e)};Ge.prototype.save=function(e){this._export(e.fileType).then(t=>{const n=this._visuals[this._curVisualName]._complex.name;rt.download(t,n,e.fileType),this._refreshTitle(),this.dispatchEvent({type:"exportingDone"})}).catch(t=>{this.logger.error("Could not export data"),this.logger.debug(t),this._refreshTitle(),this.dispatchEvent({type:"exportingDone",error:t})})};Ge.prototype._tweakResolution=function(){const e=[["poor",100],["low",500],["medium",1e3],["high",5e3],["ultra",Number.MAX_VALUE]];let t=0;if(this._forEachComplexVisual(n=>{t+=n.getComplex().getAtomCount()}),t>0){const n=this._gfxScore*1e6/t;for(let i=0;i<e.length;++i)if(n<e[i][1]){this._autoChangeResolution(e[i][0]);break}}};Ge.prototype._autoChangeResolution=function(e){e!==Pe.now.resolution&&this.logger.report(`Your rendering resolution was changed to "${e}" for best performance.`),Pe.now.resolution=e};Ge.prototype.saveSettings=function(){this._cookies.setCookie(this._opts.settingsCookie,JSON.stringify(this.settings.getDiffs(!0)))};Ge.prototype.restoreSettings=function(){try{const e=this._cookies.getCookie(this._opts.settingsCookie),t=e?JSON.parse(e):{};this.settings.applyDiffs(t,!0)}catch(e){this.logger.error(`Cookies parse error: ${e.message}`)}};Ge.prototype.resetSettings=function(){this.settings.reset()};Ge.prototype.setOptions=function(e){typeof e=="string"&&(e=Ge.options.fromAttr(e)),e.reps&&(this._opts.reps=null),We.default.merge(this._opts,e),e.settings&&this.set(e.settings),this._opts._objects=e._objects,this._resetObjects(),e.load&&this.load(e.load,{fileType:e.type}),e.preset&&(Pe.now.preset=e.preset),e.reps&&this.resetReps(e.preset),this._opts.view&&(this.view(this._opts.view),delete this._opts.view);const t=this._getComplexVisual();t&&(t.getComplex().resetCurrentUnit(),We.default.isNumber(e.unit)&&t.getComplex().setCurrentUnit(e.unit),this.resetView(),this.rebuildAll())};Ge.prototype.info=function(e){const t=this._getComplexVisual(e);if(!t)return{};const n=t.getComplex(),{metadata:i}=n;return{id:i.id||n.name||"UNKNOWN",title:i.title&&i.title.join(" ")||"UNKNOWN DATA",atoms:n.getAtomCount(),bonds:n.getBondCount(),residues:n.getResidueCount(),chains:n.getChainCount()}};Ge.prototype.addObject=function(e,t){let n=null;if(e.type===KC.prototype.type&&(n=KC),n===null)throw new Error(`Unknown scene object type - ${e.type}`);try{const i=new n(e.params,e.opts);this._addSceneObject(i)}catch(i){if(!t)this.logger.debug(`Error during scene object creation: ${i.message}`);else throw i}this._needRender=!0};Ge.prototype._addSceneObject=function(e){const t=this._getComplexVisual();e.build&&t&&(e.build(t.getComplex()),this._gfx.pivot.add(e.getGeometry()));const n=this._objects;n[n.length]=e};Ge.prototype._updateObjsToFrame=function(e){const t=this._objects;for(let n=0,i=t.length;n<i;++n)t[n].updateToFrame&&t[n].updateToFrame(e)};Ge.prototype._resetObjects=function(){const e=this._opts._objects;if(this._objects=[],e)for(let t=0,n=e.length;t<n;++t)this.addObject(e[t],!1)};Ge.prototype.removeObject=function(e){const t=this._objects[e];if(!t)throw new Error(`Scene object with index ${e} does not exist`);t.destroy(),this._objects.splice(e,1),this._needRender=!0};Ge.prototype.getURL=function(e){return qw.toURL(this.getState(We.default.defaults(e,{compact:!0,settings:!1,view:!1})))};Ge.prototype.getScript=function(e){return qw.toScript(this.getState(We.default.defaults(e,{compact:!0,settings:!0,view:!0})))};Ge.prototype._compareReps=function(e,t){const n={};let i=0;e&&(i=e.repCount());const r=Pe.defaults.presets[Pe.now.preset];let s=t;r===void 0||r.length>i?(s=!1,n.preset="empty"):Pe.now.preset!==Pe.defaults.preset&&(n.preset=Pe.now.preset);const a=[];let c=!0;for(let u=0,d=i;u<d;++u)a[u]=e.repGet(u).compare(s?r[u]:null),We.default.isEmpty(a[u])||(c=!1);return c||(n.reps=a),n};Ge.prototype.getState=function(e){const t={};e=We.default.defaults(e,{compact:!0,settings:!1,view:!1});const n=this._getComplexVisual();if(n!==null){const a=n.getComplex(),{metadata:c}=a;c.id&&(t.load=(c.format?`${c.format}:`:"")+c.id);const u=a.getCurrentUnit();u!==1&&(t.unit=u)}const i=this._compareReps(n,e.compact);i.preset&&(t.preset=i.preset),i.reps&&(t.reps=i.reps);const r=this._objects,s=[];for(let a=0,c=r.length;a<c;++a)s[a]=r[a].identify();if(r.length>0&&(t._objects=s),e.view&&(t.view=this.view()),e.settings){const a=this.settings.getDiffs(!1);We.default.isEmpty(a)||(t.settings=a)}return t};Ge.prototype.get=function(e,t){return Pe.get(e,t)};Ge.prototype._clipPlaneUpdateValue=function(e){const t=Math.max(this._gfx.camera.position.z-e*Pe.now.draft.clipPlaneFactor,Pe.now.camNear),n={clipPlaneValue:t};this._forEachComplexVisual(i=>{i.setUberOptions(n)});for(let i=0,r=this._objects.length;i<r;++i){const s=this._objects[i];s._line&&s._line.material.setUberOptions(n)}this._picker!==null&&(this._picker.clipPlaneValue=t)};Ge.prototype._fogFarUpdateValue=function(){this._picker!==null&&(this._gfx.scene.fog?this._picker.fogFarValue=this._gfx.scene.fog.far:this._picker.fogFarValue=void 0)};Ge.prototype._updateShadowmapMeshes=function(e){this._forEachComplexVisual(t=>{const n=t._reprList;for(let i=0,r=n.length;i<r;++i){const s=n[i];e(s.geo,s.material)}})};Ge.prototype._updateMaterials=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;this._forEachComplexVisual(i=>i.setMaterialValues(e,t,n));for(let i=0,r=this._objects.length;i<r;++i){const s=this._objects[i];s._line&&(s._line.material.setValues(e),s._line.material.needsUpdate=!0)}};Ge.prototype._fogAlphaChanged=function(){this._forEachComplexVisual(e=>{e.setUberOptions({fogAlpha:Pe.now.fogAlpha})})};Ge.prototype._embedWebXR=function(){if(Pe.now.stereo!=="WEBVR"){this.webVR&&this.webVR.disable(),this.webVR=null;return}this.webVR||(this.webVR=new WX(()=>{this._requestAnimationFrame(()=>this._onTick()),this._needRender=!0,this._onResize()})),this.webVR.enable(this._gfx)};Ge.prototype._initOnSettingsChanged=function(){const e=(t,n)=>{t=We.default.isArray(t)?t:[t],t.forEach(i=>{this.settings.addEventListener(`change:${i}`,n)})};e("modes.VD.frame",()=>{const t=this._getVolumeVisual();t!==null&&(t.showFrame(Pe.now.modes.VD.frame),this._needRender=!0)}),e("modes.VD.isoMode",()=>{const t=this._getVolumeVisual();t!==null&&(t.getMesh().material.updateDefines(),this._needRender=!0)}),e("bg.color",()=>{this._onBgColorChanged()}),e("ao",()=>{if(Pe.now.ao&&!JN(this._gfx.renderer.getContext()))this.logger.warn("Your device or browser does not support ao"),Pe.set("ao",!1);else{const t={normalsToGBuffer:Pe.now.ao};this._setUberMaterialValues(t)}}),e("zSprites",()=>{Pe.now.zSprites&&!QN(this._gfx.renderer.getContext())&&(this.logger.warn("Your device or browser does not support zSprites"),Pe.set("zSprites",!1)),this.rebuildAll()}),e("fogColor",()=>{this._onFogColorChanged()}),e("fogColorEnable",()=>{this._onFogColorChanged()}),e("bg.transparent",t=>{const n=this._gfx;n&&n.renderer.setClearColor(Pe.now.bg.color,+!Pe.now.bg.transparent),this._updateMaterials({fogTransparent:t.value}),this.rebuildAll()}),e("draft.clipPlane",t=>{this._updateMaterials({clipPlane:t.value}),this.rebuildAll()}),e("shadow.on",t=>{const n={shadowmap:t.value,shadowmapType:Pe.now.shadow.type},i=this._gfx;i&&(i.renderer.shadowMap.enabled=!!n.shadowmap),this._updateMaterials(n,!0),n.shadowmap?(this._updateShadowCamera(),this._updateShadowmapMeshes(jp.createShadowmapMaterial)):this._updateShadowmapMeshes(jp.removeShadowmapMaterial),this._needRender=!0}),e("shadow.type",t=>{Pe.now.shadow.on&&(this._updateMaterials({shadowmapType:t.value},!0),this._needRender=!0)}),e("shadow.radius",t=>{for(let n=0;n<this._gfx.scene.children.length;n++)if(this._gfx.scene.children[n].shadow!==void 0){const i=this._gfx.scene.children[n];i.shadow.radius=t.value,this._needRender=!0}}),e("fps",()=>{this._fps.show(Pe.now.fps)}),e(["fog","fogNearFactor","fogFarFactor"],()=>{this._updateFog(),this._needRender=!0}),e("fogAlpha",()=>{const{fogAlpha:t}=Pe.now;(t<0||t>1)&&this.logger.warn("fogAlpha must belong range [0,1]"),this._fogAlphaChanged(),this._needRender=!0}),e("autoResolution",t=>{t.value&&!this._gfxScore&&this.logger.warn("Benchmarks are missed, autoresolution will not work! Autoresolution should be set during miew startup.")}),e("stereo",()=>{this._embedWebXR(Pe.now.stereo==="WEBVR"),this._needRender=!0}),e(["transparency","palette"],()=>{this.rebuildAll()}),e("resolution",()=>{this.rebuildAll();const t=this._getVolumeVisual();t&&(t.getMesh().material.updateDefines(),this._needRender=!0)}),e(["axes","fxaa","ao","outline.on","outline.color","outline.threshold","outline.thickness"],()=>{this._needRender=!0})};Ge.prototype.set=function(e,t){Pe.set(e,t)};Ge.prototype.select=function(e,t){const n=this._getComplexVisual();if(!n)return;let i=e;We.default.isString(e)&&(i=_x.parse(e).selector),n.select(i,t),this._lastPick=null,this._updateInfoPanel(),this._needRender=!0};var F2="1";Ge.prototype.view=function(e){const t=this,{pivot:n}=this._gfx;let i=[];const r="ZXY";function s(){const c=n.position,u=t._objectControls.getScale()/Pe.now.radiusToFit,d=new R.Euler;return d.setFromQuaternion(t._objectControls.getOrientation(),r),i=[c.x,c.y,c.z,u,d.x,d.y,d.z],F2+rt.arrayToBase64(i,Float32Array)}function a(){e.length===40&&(e=`0${e}`);const c=e[0];if(i=rt.arrayFromBase64(e.substr(1),Float32Array),c!==F2)if(c==="0")i[3]/=8;else{t.logger.warn(`Encoded view version mismatch, stored as ${c} vs ${F2} expected`);return}const u=t._interpolator,d=u.createView();d.position.copy(n.position),d.scale=t._objectControls.getScale(),d.orientation.copy(t._objectControls.getOrientation());const p=u.createView();p.position.set(i[0],i[1],i[2]),t._getComplexVisual()&&p.position.sub(t._getComplexVisual().position),p.scale=i[3],p.orientation.setFromEuler(new R.Euler(i[4],i[5],i[6],r)),u.setup(d,p)}return typeof e>"u"?s():(a(),e)};Ge.prototype._updateView=function(){const e=this,{pivot:t}=this._gfx,n=this._interpolator;if(n.wasStarted()||n.start(),!n.isMoving())return;const i=n.getCurrentView();if(i.success){const r=i.view;t.position.copy(r.position),e._objectControls.setScale(r.scale*Pe.now.radiusToFit),e._objectControls.setOrientation(r.orientation),this.dispatchEvent({type:"transform"}),e._needRender=!0}};Ge.prototype.translate=function(e,t,n){this._objectControls.translatePivot(e,t,n),this.dispatchEvent({type:"transform"}),this._needRender=!0};Ge.prototype.rotate=function(e,t,n){this._objectControls.rotate(new R.Quaternion().setFromEuler(new R.Euler(e,t,n,"XYZ"))),this.dispatchEvent({type:"transform"}),this._needRender=!0};Ge.prototype.scale=function(e){if(e<=0)throw new RangeError("Scale should be greater than zero");this._objectControls.scale(e),this.dispatchEvent({type:"transform"}),this._needRender=!0};Ge.prototype.center=function(e){if(e===void 0){this.setPivotSubset(),this._needRender=!0;return}if(e.obj!==void 0&&("atom"in e.obj||"residue"in e.obj)){"atom"in e.obj?this.setPivotAtom(e.obj.atom):this.setPivotResidue(e.obj.residue),this._needRender=!0;return}if(e.obj===void 0&&e!==""){const t=_x.parse(e);if(t.error===void 0){this.setPivotSubset(t),this._needRender=!0;return}}this.resetPivot(),this._needRender=!0};Ge.prototype.within=function(e,t){const n=this._getComplexVisual();if(!n)return _x.None();e instanceof String&&(e=_x.parse(e));const i=n.within(e,t);return i&&(n.rebuildSelectionGeometry(),this._needRender=!0),i};Ge.prototype.projected=function(e,t){const n=this._getComplexVisual(t);if(!n)return!1;const i=n.getComplex().getAtomByFullname(e);if(i===null)return!1;const r=i.position.clone();return this._gfx.pivot.updateMatrixWorldRecursive(),this._gfx.camera.updateMatrixWorldRecursive(),this._gfx.pivot.localToWorld(r),r.project(this._gfx.camera),{x:(r.x+1)*.5*this._gfx.width,y:(1-r.y)*.5*this._gfx.height}};Ge.prototype.dssp=function(e){const t=this._getComplexVisual(e);t&&(t.getComplex().dssp(),t._reprList.forEach(n=>{(n.mode.id==="CA"||n.colorer.id==="SS")&&(n.needsRebuild=!0)}))};Ge.prototype.exportCML=function(){const e=this;function t(s){const a=new R.Vector3,c=new R.Vector3,u=new R.Vector3;s.extractBasis(a,c,u),a.normalize(),c.normalize(),u.normalize();const d=new R.Matrix4;return d.identity(),d.makeBasis(a,c,u),d}function n(s){const{root:a}=e._gfx,c=t(a.matrixWorld),u=new R.Vector4(0,0,0,0),d=new R.Vector4(0,0,0,0);let p=null,g=null;s.forEachAtom(v=>{v.xmlNodeRef&&v.xmlNodeRef.xmlNode&&(p=v.xmlNodeRef.xmlNode,g=v.position,u.set(g.x,g.y,g.z,1),u.applyMatrix4(c),p.setAttribute("x3",u.x.toString()),p.setAttribute("y3",u.y.toString()),p.setAttribute("z3",u.z.toString()),p.removeAttribute("x2"),p.removeAttribute("y2"))}),s.forEachSGroup(v=>{if(v.xmlNodeRef&&v.xmlNodeRef.xmlNode){p=v.xmlNodeRef.xmlNode,g=v.getPosition(),u.set(g.x,g.y,g.z,1);const y=v.getCentralPoint();y===null?u.applyMatrix4(c):(d.set(y.x,y.y,y.z,0),u.add(d),u.applyMatrix4(c),d.set(y.x,y.y,y.z,1),d.applyMatrix4(c),u.sub(d)),p.setAttribute("x",u.x.toString()),p.setAttribute("y",u.y.toString()),p.setAttribute("z",u.z.toString())}})}const i=e._getComplexVisual(),r=i?i.getComplex():null;return r&&r.originalCML?(n(r),new XMLSerializer().serializeToString(r.originalCML)):null};Ge.prototype.motm=function(){Pe.set({fogColorEnable:!0,fogColor:0,outline:{on:!0,threshold:.01},bg:{color:16777215}}),this._forEachComplexVisual(e=>{const t=[],n=e.getComplex(),i=em.get(Pe.now.palette);for(let r=0;r<n.getChainCount();r++){const s=n._chains[r]._name,a=i.getChainColor(s);t[r]={selector:`chain ${s}`,mode:"VW",colorer:["CB",{color:a,factor:.9}],material:"FL"}}e.resetReps(t)})};Ge.prototype.VERSION="0.11.1";We.default.assign(Ge,{VERSION:Ge.prototype.VERSION,registeredPlugins:[],chem:nr,io:wu,modes:ax,colorers:lx,materials:Xp,palettes:em,options:qw,settings:Pe,utils:rt,gfx:{Representation:_M},thirdParty:{lodash:We.default,three:R}});var Cf=Ge,bu=Ts(89),PA={$help:["Rendering mode shortcut"," BS - balls and sticks mode"," LN - lines mode"," LC - licorice mode"," VW - van der waals mode"," TR - trace mode"," TU - tube mode"," CA - cartoon mode"," SA - isosurface mode"," QS - quick surface mode"," SE - solvent excluded mode"," TX - text mode"],BS:{$help:[" Balls and sticks"," aromrad = <number> #aromatic radius"," atom = <number> #atom radius"," bond = <number> #bond radius"," multibond = <bool> #use multibond"," showarom = <bool> #show aromatic",` space = <number> #space value
`]},CA:{$help:[" Cartoon"," arrow = <number> #arrow size"," depth = <number> #depth of surface"," heightSegmentsRatio = <number>"," radius = <number> #tube radius"," tension = <number> #",` width = <number> #secondary width
`]},LN:{$help:[" Lines"," atom = <number> #atom radius"," chunkarom = <number>"," multibond = <bool> #use multibond"," showarom = <bool> #show aromatic",` offsarom = <number>
`]},LC:{$help:[" Licorice"," aromrad = <number> #aromatic radius"," bond = <number> #bond radius"," multibond = <bool> #use multibond"," showarom = <bool> #show aromatic",` space = <number> #space value
`]},VW:{$help:[" Van der Waals",` nothing
`]},TR:{$help:[" Trace",` radius = <number> #tube radius
`]},TU:{$help:[" Tube"," heightSegmentsRatio = <number>"," radius = <number> #tube radius",` tension = <number>
`]},SA:{$help:[" Surface",` zClip = <bool> #clip z plane
`]},QS:{$help:[" Quick surface"," isoValue = <number>"," scale = <number>"," wireframe = <bool>",` zClip = <bool> #clip z plane
`]},SE:{$help:[" Solvent excluded surface",` zClip = <bool> #clip z plane
`]},TX:{$help:[" Text mode",' template = <format string> string that can include "{{ id }}"'," it will be replaced by value, id can be one of next:",` serial, name, type, sequence, residue, chain, hetatm, water
`,' horizontalAlign = <string> {"left", "right", "center"}',' verticalAlign = <string> {"top", "bottom", "middle"}'," dx = <number> #offset along x"," dy = <number> #offset along y"," dz = <number> #offset along z"," fg = <string> #text color modificator"," could be keyword, named color or hex"," fg = <string> #back color modificator"," could be keyword, named color or hex"," showBg = <bool> #if set show background"," plate under text"]}},NA={$help:["Coloring mode shortcut"," EL - color by element"," CH - color by chain"," SQ - color by sequence"," RT - color by residue type"," SS - color by secondary structure"," UN - uniform"],UN:{$help:["Parameters of coloring modes customization"," Uniform",` color = <number|color> #RGB->HEX->dec
`],color:{$help:Object.keys(em.get(Pe.now.palette).namedColors).sort().join(`
`)}}},eI={$help:["Material shortcut"," DF - diffuse"," TR - transparent"," SF - soft plastic"," PL - glossy plastic"," ME - metal"," GL - glass"]},e3={$help:["Short (packed) representation description as a set of variables"," s=<EXPRESSION>"," selector property"," m=<MODE_ID>[!<PARAMETER>:<VALUE>[,...]]"," render mode property"," c=<COLORER_ID>[!<PARAMETER>:<VALUE>[,...]]"," color mode property"," mt=<MATERIAL_ID>"," material property"],s:{$help:"Selection expression string as it is in menu->representations->selection"},m:PA,c:NA,mt:eI},t3={$help:["Parameters of rendering modes customization: modes","Parameters of colorer customization: colorers","Autobuild: autobuild = (<number>|<bool>)"],modes:PA,colorers:NA},k2={$help:["help (<cmd name>| <path to property>)","You can get detailed information about command options",` using "help cmd.opt.opt.[...]"
`," you can use one line comments"," everything started from (#|//) will be skipped",` Example: >build //some comment
`,"List of available commands:"],reset:{$help:["Reload current object, delete all representations"," Nothing will work until load new object"]},load:{$help:["load (<PDBID>|<URL>|-f [<*.NC FILE URL STRING>])"," Load new pdb object from selected source"],PDBID:{$help:"pdb id in remote molecule database"},URL:{$help:"url to source file"},f:{$help:["open file system dialog to fetch local file","optionally you can determine trajectory file","via URL for *.top model"]}},clear:{$help:"No args. Clear terminal"},add:{$help:["add [<REP_NAME>] [<DESCRIPTION>]"," Add new item to representation set with"," default or <DESCRIPTION> params"],REP_NAME:{$help:"Identifier string [_,a-z,A-Z,0-9] can not start from digit"},DESCRIPTION:e3},rep:{$help:["rep [<REP_NAME>|<REP_INDEX>] [<DESCRIPTION>]"," set current representation by name or index"," edit current representation by <DESCRIPTION>"],REP_NAME:{$help:["Identifier string [_,a-z,A-Z,0-9] can not start from digit","Must be declared before"]},REP_INDEX:{$help:"Index of available representation"},DESCRIPTION:e3},remove:{$help:["remove (<REP_NAME>|<REP_INDEX>)","Remove representation by name or index"],REP_NAME:{$help:["Identifier string [_,a-z,A-Z,0-9] can not start from digit","Must be declared before"]},REP_INDEX:{$help:"Index of available representation"}},selector:{$help:["selector <EXPRESSION>"," set selector from EXPRESSION to current representation"],EXPRESSION:{$help:"Selection expression string as it is in menu->representations->selection"}},mode:{$help:["mode <MODE_ID> [<PARAMETER>=<VALUE>...]"," set rendering mode and apply parameters to current representation"],MODE_ID:PA},color:{$help:["color <COLORER_ID> [<PARAMETER>=<VALUE>...]"," set colorer and apply parameters to current representation"],COLORER_ID:NA},material:{$help:["material <MATERIAL_ID>"," set material to current representation"],MATERIAL_ID:eI},build:{$help:"build help str",add:{$help:"build.add",new:{$help:["add.new","add.new new line 1","add.new new line 2","add.new new line 3"]}},del:{$help:"build.del"}},list:{$help:["list [-e|-s|<REP_NAME>|<REP_INDEX>]","Print representations if no args print list of representations"," -e expand list and show all representations"," -s show all user-registered selectors"," <REP_NAME>|<REP_INDEX> show only current representation"]},hide:{$help:["hide (<REP_NAME>|<REP_INDEX>)","Hide representation referenced in args"]},show:{$help:["show (<REP_NAME>|<REP_INDEX>)","Show representation referenced in args"]},get:{$help:["get <PARAMETER>","Print <PARAMETER> value"," <PARAMETER> - path to option use get.PARAMETER to get more info"],PARAMETER:t3},set:{$help:["set <PARAMETER> <VALUE>","Set <PARAMETER> with <VALUE>"," <PARAMETER> - path to option use set.PARAMETER to get more info"],PARAMETER:t3},set_save:{$help:["set_save","Save current settings to cookie"]},set_restore:{$help:["set_restore","Load and apply settings from cookie"]},set_reset:{$help:["set_reset","Reset current settings to the defaults"]},preset:{$help:["preset [<PRESET>]","Reset current representation or set preset to <PRESET>"],PRESET:{$help:["default","wire","small","macro"]}},unit:{$help:["unit [<unit_id>]","Change current biological structure view. Zero <unit_id> value means asymmetric unit,","positive values set an assembly with corresponding number.","Being called with no parameters command prints current unit information."]},view:{$help:["view [<ENCODED_VIEW>]","Get current encoded view or set if ENCODED_VIEW placed as argument"],ENCODED_VIEW:{$help:["encoded view matrix string (binary code)"]}},rotate:{$help:["rotate (x|y|z) [<DEGREES>] [(x|y|z) [<DEGREES>]]...","Rotate scene"]},scale:{$help:["scale <SCALE>","Scale scene"]},select:{$help:["select <SELECTOR_STRING> [as <SELECTOR_NAME>]","Select atoms using selector defined in SELECTOR_STRING"," and if SELECTOR_NAME is defined register it in viewer"," you can use it later as a complex selector"]},within:{$help:["within <DISTANCE> of <SELECTOR_STRING> as <SELECTOR_NAME>","Build within named selector"," DISTANCE <number>"," SELECTOR_STRING <string(selection language)>"," SELECTOR_NAME <identifier>"]},url:{$help:["url [-s] [-v]","Report URL encoded scene"," if -s set that include settings in the URL"," if -v set that include view in the URL"]},screenshot:{$help:["screenshot [<WIDTH> [<HEIGHT>]]","Make a screenshot of the scene"," WIDTH <number> in pixels"," HEIGHT <number> in pixels, equal to WIDTH by default"]},line:{$help:["line <first_atom_path> <second_atom_path> [<PARAMETER>=<VALUE>]","Draw dashed line between two specified atoms"]},removeobj:{$help:["removeobj <id>","Remove scene object by its index. Indices could be obtained by <listobj> command"]},listobj:{$help:["listobj","Display the list of all existing scene objects"]}},{chem:{selectors:IA},modes:oj,colorers:aj,materials:lj,palettes:n3,options:cj,settings:Zy}=Cf;function uj(){}var tI=(function(){const e=new uj;return function(){return e}})(),hj=class{constructor(){this.representationMap={},this.representationID={}}get(e){return this.representationMap[e]||this.representationID[e]||"<no name>"}add(e,t){if(e===-1)return"Can not create representation: there is no data";if(t!==void 0)if(!this.representationMap.hasOwnProperty(e))this.representationMap[e.toString()]=t,this.representationID[t]=e.toString();else return"This name has already existed, registered without name";return`Representation ${e} successfully added`}remove(e){e&&this.representationID.hasOwnProperty(e)&&(delete this.representationMap[this.representationID[e]],delete this.representationID[e]);const t=Object.keys(this.representationID).sort();for(const n in t)if(t.hasOwnProperty(n)){const i=t[n];i>e&&(this.representationID[i-1]=this.representationID[i],this.representationMap[this.representationID[i]]-=1,delete this.representationID[i])}}clear(){this.representationMap={},this.representationID={}}},fj=new hj;function vx(e){const t={s:"selector",m:"mode",c:"colorer",mt:"material",mode:"modes",color:"colorers",colorer:"colorers",select:"selector",material:"materials",selector:"selector"}[e];return t===void 0?e:t}var dj=class{list(e,t,n){let i="";if(e&&t!==void 0&&(n===void 0||n==="-e")){const r=e.repCount();for(let s=0;s<r;s++)i+=this.listRep(e,t,s,n)}return i}listRep(e,t,n,i){let r="";const s=e.repGet(n);if(!s)return Qi.warn(`Rep ${n} does not exist!`),r;const a=n,c=t.get(a),{mode:u,colorer:d}=s,p=s.selectorString,g=s.materialPreset;return r+=`#${a} : ${u.name}${c==="<no name>"?"":`, ${c}`}
`,i!==void 0&&(r+=` selection : "${p}"
`,r+=` mode : (${u.id}), ${u.name}
`,r+=` colorer : (${d.id}), ${d.name}
`,r+=` material : (${g.id}), ${g.name}
`),r}listSelector(e,t){let n="";for(const i in t)t.hasOwnProperty(i)&&(n+=`${i} : "${t[i]}"
`);return n}listObjs(e){const t=e._objects;if(!t||!Array.isArray(t)||t.length===0)return"There are no objects on the scene";const n=[];for(let i=0,r=t.length;i<r;++i)n[i]=`${i}: ${t[i].toString()}`;return n.join(`
`)}joinHelpStr(e){return e instanceof Array?e.join(`
`):e}help(e){if(We.default.isUndefined(e))return`${this.joinHelpStr(k2.$help)}
${We.default.slice(We.default.sortBy(We.default.keys(k2)),1).join(", ")}
`;const t=We.default.get(k2,e);return We.default.isUndefined(t)?this.help():`${this.joinHelpStr(t.$help)}
`}load(e,t){if(e===void 0||t===void 0||t==="-f")return;e.awaitWhileCMDisInProcess();const n=()=>e.finishAwaitingCMDInProcess();e.load(t).then(n,n)}checkArg(e,t,n){if(e!==void 0&&t!==void 0){if(vx(e)==="selector"){const a=IA.parse(t);if(a.error!==void 0)throw{message:a.error};return n!==void 0&&n?a.selector:t}const i={colorers:aj,modes:oj,materials:lj};let r=e,s;for(;r!==s;)s=r,r=vx(s);if(i[r].get(t)===void 0)throw{message:`${t} is not existed in ${r}`};return t}return tI}propagateProp(e,t){if(e!==void 0){let n={};const i=cj.adapters[typeof We.default.get(Zy.defaults,e)];if(i===void 0)throw{message:`${e} is not existed`};if((e.endsWith(".color")||e.endsWith(".baseColor")||e.endsWith(".EL.carbon"))&&typeof t!="number"&&(t=n3.get(Zy.now.palette).getNamedColor(t)),e.endsWith(".fg")||e.endsWith(".bg"))if(typeof t!="number"){const r=n3.get(Zy.now.palette).getNamedColor(t,!0);r!==void 0&&(t=`0x${r.toString(16)}`)}else t=`0x${t.toString(16)}`;if(e.endsWith(".template")&&(t=t.replace(/\\n/g,`
`)),t!==void 0&&i(t)!==t&&i(t)!==t>0)throw n={message:`${e} must be a "${typeof We.default.get(Zy.defaults,e)}"`},n}return t}unquoteString(e){return rt.unquoteString(e)}},pj=new dj;function mj(e,t){const n={};return n[e]=t,n}function MS(e){if(e instanceof this.constructor)return e;e instanceof Array?this._values=e.slice(0):e?this._values=[e]:this._values=[]}MS.prototype.append=function(e){const t=this._values;return t[t.length]=e,this};MS.prototype.remove=function(e){const t=this._values,n=t.indexOf(e);return n>=0&&t.splice(n,1),this};MS.prototype.toJSO=function(e,t,n){const i={},r=this._values;for(let s=0,a=r.length;s<a;++s)We.default.set(i,r[s].id,e.propagateProp(`${vx(t)}.${n}.${r[s].id}`,r[s].val));return i};function gj(e,t){this.id=e,this.val=t}var Rs=Object.create({});Rs.Arg=gj;Rs.ArgList=MS;Rs.miew=null;Rs.echo=null;Rs.representations=fj;Rs.utils=pj;Rs._=We.default;Rs.CreateObjectPair=mj;Rs.keyRemap=vx;Rs.Context=IA.Context;Rs.ClearContext=IA.ClearContext;Rs.NULL=tI;Rs.notimplemented=function(){return this.NULL};Cf.prototype.script=function(e,t,n){bu.parser.yy.miew=this,bu.parser.yy.echo=t,bu.parser.yy.error=n,this.cmdQueue===void 0&&(this.cmdQueue=[]),this.commandInAction===void 0&&(this.commandInAction=!1),this.cmdQueue=this.cmdQueue.concat(e.split(`
`))};Cf.prototype.awaitWhileCMDisInProcess=function(){this.commandInAction=!0};Cf.prototype.finishAwaitingCMDInProcess=function(){this.commandInAction=!1};Cf.prototype.isScriptingCommandAvailable=function(){return this.commandInAction!==void 0&&!this.commandInAction&&this.cmdQueue!==void 0&&this.cmdQueue.length>0};Cf.prototype.callNextCmd=function(){if(this.isScriptingCommandAvailable()){const e=this.cmdQueue.shift(),t={};t.success=!1;try{bu.parser.parse(e),t.success=!0}catch(n){t.error=n.message,bu.parser.yy.error(t.error),this.finishAwaitingCMDInProcess()}return t}return""};bu.parser.yy=Rs;bu.parser.yy.parseError=bu.parser.parseError;var _j=Cf,vj=fP.A,yj={536:e=>{e.exports=function(t){var n=[];return n.toString=function(){return this.map((function(i){var r="",s=i[5]!==void 0;return i[4]&&(r+="@supports (".concat(i[4],") {")),i[2]&&(r+="@media ".concat(i[2]," {")),s&&(r+="@layer".concat(i[5].length>0?" ".concat(i[5]):""," {")),r+=t(i),s&&(r+="}"),i[2]&&(r+="}"),i[4]&&(r+="}"),r})).join("")},n.i=function(i,r,s,a,c){typeof i=="string"&&(i=[[null,i,void 0]]);var u={};if(s)for(var d=0;d<this.length;d++){var p=this[d][0];p!=null&&(u[p]=!0)}for(var g=0;g<i.length;g++){var v=[].concat(i[g]);s&&u[v[0]]||(c!==void 0&&(v[5]===void 0||(v[1]="@layer".concat(v[5].length>0?" ".concat(v[5]):""," {").concat(v[1],"}")),v[5]=c),r&&(v[2]&&(v[1]="@media ".concat(v[2]," {").concat(v[1],"}")),v[2]=r),a&&(v[4]?(v[1]="@supports (".concat(v[4],") {").concat(v[1],"}"),v[4]=a):v[4]="".concat(a)),n.push(v))}},n}},784:e=>{e.exports=function(t){var n=t[1],i=t[3];if(!i)return n;if(typeof btoa=="function"){var r=btoa(unescape(encodeURIComponent(JSON.stringify(i)))),s="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(r),a="/*# ".concat(s," */");return[n].concat([a]).join(`
`)}return[n].join(`
`)}},32:(e,t,n)=>{n.d(t,{A:()=>u,z:()=>c});var i=n(784),r=n.n(i),s=n(536),a=n.n(s)()(r());a.push([e.id,`.DVOOardsIBZOO3FaW5Nw {
width: 100%;
height: 100%;
}
`,"",{version:3,sources:["webpack://./src/Viewer.module.scss"],names:[],mappings:"AAAA;EACE,WAAW;EACX,YAAY;AACd",sourcesContent:[`.root {\r
width: 100%;\r
height: 100%;\r
}\r
`],sourceRoot:""}]);var c="DVOOardsIBZOO3FaW5Nw";const u=a},920:(e,t,n)=>{n.d(t,{A:()=>c});var i=n(784),r=n.n(i),s=n(536),a=n.n(s)()(r());a.push([e.id,`@keyframes spinner-line-fade-more {
0%, 100% {
opacity: 0; /* minimum opacity */
}
1% {
opacity: 1;
}
}
@keyframes spinner-line-fade-quick {
0%, 39%, 100% {
opacity: 0.25; /* minimum opacity */
}
40% {
opacity: 1;
}
}
@keyframes spinner-line-fade-default {
0%, 100% {
opacity: 0.22; /* minimum opacity */
}
1% {
opacity: 1;
}
}
@keyframes spinner-line-shrink {
0%, 25%, 100% {
/* minimum scale and opacity */
transform: scale(0.5);
opacity: 0.25;
}
26% {
transform: scale(1);
opacity: 1;
}
}
.miew-canvas > canvas {
display: block;
width: 100%;
height: 100%;
}
.miew-container,
.miew-canvas {
width: 100%;
height: 100%;
overflow: hidden;
position: relative;
}
.miew-message {
/* trick for centered error-reporting*/
background-color: #ccc;
display: table;
width: 100%;
height: 100%;
}
.miew-message p {
display: table-cell;
vertical-align: middle;
text-align: center;
font-size: large;
}
.mode-message {
position: absolute;
top: 10px;
right: 10px;
border-radius: 4px;
color: silver;
background-color: rgba(64, 64, 64, 0.75);
display: flex;
align-items: left;
justify-content: left;
opacity: 0;
}
.atom-info {
margin: 10px;
text-align: left;
}
.overlay {
pointer-events: none;
}
`,"",{version:3,sources:["webpack://./../miew/dist/Miew.css"],names:[],mappings:"AAAA;EACE;IACE,UAAU,EAAE,oBAAoB;EAClC;EACA;IACE,UAAU;EACZ;AACF;;AAEA;EACE;IACE,aAAa,EAAE,oBAAoB;EACrC;EACA;IACE,UAAU;EACZ;AACF;;AAEA;EACE;IACE,aAAa,EAAE,oBAAoB;EACrC;EACA;IACE,UAAU;EACZ;AACF;;AAEA;EACE;IACE,8BAA8B;IAC9B,qBAAqB;IACrB,aAAa;EACf;EACA;IACE,mBAAmB;IACnB,UAAU;EACZ;AACF;;AAEA;EACE,cAAc;EACd,WAAW;EACX,YAAY;AACd;;AAEA;;EAEE,WAAW;EACX,YAAY;EACZ,gBAAgB;EAChB,kBAAkB;AACpB;;AAEA;EACE,sCAAsC;EACtC,sBAAsB;EACtB,cAAc;EACd,WAAW;EACX,YAAY;AACd;;AAEA;IACI,mBAAmB;IACnB,sBAAsB;IACtB,kBAAkB;IAClB,gBAAgB;EAClB;;AAEF;EACE,kBAAkB;EAClB,SAAS;EACT,WAAW;EACX,kBAAkB;EAClB,aAAa;EACb,wCAAwC;EACxC,aAAa;EACb,iBAAiB;EACjB,qBAAqB;EACrB,UAAU;AACZ;;AAEA;EACE,YAAY;EACZ,gBAAgB;AAClB;;AAEA;EACE,oBAAoB;AACtB",sourcesContent:[`@keyframes spinner-line-fade-more {
0%, 100% {
opacity: 0; /* minimum opacity */
}
1% {
opacity: 1;
}
}
@keyframes spinner-line-fade-quick {
0%, 39%, 100% {
opacity: 0.25; /* minimum opacity */
}
40% {
opacity: 1;
}
}
@keyframes spinner-line-fade-default {
0%, 100% {
opacity: 0.22; /* minimum opacity */
}
1% {
opacity: 1;
}
}
@keyframes spinner-line-shrink {
0%, 25%, 100% {
/* minimum scale and opacity */
transform: scale(0.5);
opacity: 0.25;
}
26% {
transform: scale(1);
opacity: 1;
}
}
.miew-canvas > canvas {\r
display: block;\r
width: 100%;\r
height: 100%;\r
}
.miew-container,\r
.miew-canvas {\r
width: 100%;\r
height: 100%;\r
overflow: hidden;\r
position: relative;\r
}
.miew-message {\r
/* trick for centered error-reporting*/\r
background-color: #ccc;\r
display: table;\r
width: 100%;\r
height: 100%;\r
}
.miew-message p {\r
display: table-cell;\r
vertical-align: middle;\r
text-align: center;\r
font-size: large;\r
}
.mode-message {\r
position: absolute;\r
top: 10px;\r
right: 10px;\r
border-radius: 4px;\r
color: silver;\r
background-color: rgba(64, 64, 64, 0.75);\r
display: flex;\r
align-items: left;\r
justify-content: left;\r
opacity: 0;\r
}
.atom-info {\r
margin: 10px;\r
text-align: left;\r
}
.overlay {\r
pointer-events: none;\r
}\r
`],sourceRoot:""}]);const c=a},591:e=>{var t=[];function n(s){for(var a=-1,c=0;c<t.length;c++)if(t[c].identifier===s){a=c;break}return a}function i(s,a){for(var c={},u=[],d=0;d<s.length;d++){var p=s[d],g=a.base?p[0]+a.base:p[0],v=c[g]||0,y="".concat(g," ").concat(v);c[g]=v+1;var S=n(y),E={css:p[1],media:p[2],sourceMap:p[3],supports:p[4],layer:p[5]};if(S!==-1)t[S].references++,t[S].updater(E);else{var w=r(E,a);a.byIndex=d,t.splice(d,0,{identifier:y,updater:w,references:1})}u.push(y)}return u}function r(s,a){var c=a.domAPI(a);return c.update(s),function(u){if(u){if(u.css===s.css&&u.media===s.media&&u.sourceMap===s.sourceMap&&u.supports===s.supports&&u.layer===s.layer)return;c.update(s=u)}else c.remove()}}e.exports=function(s,a){var c=i(s=s||[],a=a||{});return function(u){u=u||[];for(var d=0;d<c.length;d++){var p=n(c[d]);t[p].references--}for(var g=i(u,a),v=0;v<c.length;v++){var y=n(c[v]);t[y].references===0&&(t[y].updater(),t.splice(y,1))}c=g}}},128:e=>{var t={};e.exports=function(n,i){var r=(function(s){if(t[s]===void 0){var a=document.querySelector(s);if(window.HTMLIFrameElement&&a instanceof window.HTMLIFrameElement)try{a=a.contentDocument.head}catch{a=null}t[s]=a}return t[s]})(n);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(i)}},51:e=>{e.exports=function(t){var n=document.createElement("style");return t.setAttributes(n,t.attributes),t.insert(n,t.options),n}},855:(e,t,n)=>{e.exports=function(i){var r=n.nc;r&&i.setAttribute("nonce",r)}},740:e=>{e.exports=function(t){if(typeof document>"u")return{update:function(){},remove:function(){}};var n=t.insertStyleElement(t);return{update:function(i){(function(r,s,a){var c="";a.supports&&(c+="@supports (".concat(a.supports,") {")),a.media&&(c+="@media ".concat(a.media," {"));var u=a.layer!==void 0;u&&(c+="@layer".concat(a.layer.length>0?" ".concat(a.layer):""," {")),c+=a.css,u&&(c+="}"),a.media&&(c+="}"),a.supports&&(c+="}");var d=a.sourceMap;d&&typeof btoa<"u"&&(c+=`
/*# sourceMappingURL=data:application/json;base64,`.concat(btoa(unescape(encodeURIComponent(JSON.stringify(d))))," */")),s.styleTagTransform(c,r,s.options)})(n,t,i)},remove:function(){(function(i){if(i.parentNode===null)return!1;i.parentNode.removeChild(i)})(n)}}}},656:e=>{e.exports=function(t,n){if(n.styleSheet)n.styleSheet.cssText=t;else{for(;n.firstChild;)n.removeChild(n.firstChild);n.appendChild(document.createTextNode(t))}}}},i3={};function oi(e){var t=i3[e];if(t!==void 0)return t.exports;var n=i3[e]={id:e,exports:{}};return yj[e](n,n.exports,oi),n.exports}oi.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return oi.d(t,{a:t}),t},oi.d=(e,t)=>{for(var n in t)oi.o(t,n)&&!oi.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},oi.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),oi.nc=void 0;var nI={};oi.d(nI,{A:()=>Tj});var xj=(r3={default:()=>vj},G2={},oi.d(G2,r3),G2),r3,G2,Ky=(e=>{var t={};return oi.d(t,e),t})({default:()=>ht.default,useLayoutEffect:()=>ht.useLayoutEffect,useRef:()=>ht.useRef}),Sj=oi(591),iI=oi.n(Sj),bj=oi(740),rI=oi.n(bj),Mj=oi(128),sI=oi.n(Mj),wj=oi(855),oI=oi.n(wj),Aj=oi(51),aI=oi.n(Aj),Ej=oi(656),lI=oi.n(Ej),B1=oi(32),Np={};Np.styleTagTransform=lI(),Np.setAttributes=oI(),Np.insert=sI().bind(null,"head"),Np.domAPI=rI(),Np.insertStyleElement=aI(),iI()(B1.A,Np),B1.A&&B1.A.locals&&B1.A.locals;var Qy=oi(920),Ip={};function Tj(e){let{onInit:t,options:n}=e;const i=(0,Ky.useRef)(),r=(0,Ky.useRef)();return(0,Ky.useLayoutEffect)((()=>{const s={axes:!1,fps:!1,...n?.settings};return(function(a,c,u){if(!a.current){const d=new xj.default(c);d.init()&&(a.current=d,d.run(),typeof u=="function"&&u(d))}})(i,{...n,container:r.current,settings:s},t),()=>(function(a){a.current&&a.current.term(),a.current=null})(i)}),[t,n]),Ky.default.createElement("div",{className:B1.z,ref:r},"Viewer")}Ip.styleTagTransform=lI(),Ip.setAttributes=oI(),Ip.insert=sI().bind(null,"head"),Ip.domAPI=rI(),Ip.insertStyleElement=aI(),iI()(Qy.A,Ip),Qy.A&&Qy.A.locals&&Qy.A.locals;var Cj=nI.A;function Rj(e){let t=e,n=!1;const i=new Set;return{getState(){return t},updateState(r){t=typeof r=="function"?r(t):r},setState(r){this.updateState(r),i.forEach(s=>s(t))},initialize(r){n||(t=r,n=!0)},subscribe(r){return i.add(r),()=>i.delete(r)}}}function Lj(e,t,n){const i=[],r=[],s={};for(const a of e){const c=a.position||t;s[c]=s[c]||0,s[c]+=1,s[c]<=n?r.push(a):i.push(a)}return{notifications:r,queue:i}}var Pj=()=>Rj({notifications:[],queue:[],defaultPosition:"bottom-right",limit:5}),z0=Pj();function fm(e,t){const n=e.getState(),i=Lj(t([...n.notifications,...n.queue]),n.defaultPosition,n.limit);e.setState({notifications:i.notifications,queue:i.queue,limit:n.limit,defaultPosition:n.defaultPosition})}function Nj(e,t=z0){const n=e.id||h3();return fm(t,i=>e.id&&i.some(r=>r.id===e.id)?i:[...i,{...e,id:n}]),n}function Ij(e,t=z0){return fm(t,n=>n.filter(i=>i.id===e?(i.onClose?.(i),!1):!0)),e}function Oj(e,t=z0){return fm(t,n=>n.map(i=>i.id===e.id?{...i,...e}:i)),e.id}function Dj(e=z0){fm(e,()=>[])}function zj(e=z0){fm(e,t=>t.slice(0,e.getState().limit))}var Uj={show:Nj,hide:Ij,update:Oj,clean:Dj,cleanQueue:zj,updateState:fm};function Bj(e){return(0,Ue.jsx)(Ue.Fragment,{children:(0,Ue.jsx)("div",{className:"moleculeViewerMenu",children:(0,Ue.jsxs)(Ue.Fragment,{children:[(0,Ue.jsxs)(Zl,{ta:"center",children:["Атом: ",e.selectedAtom.name," (",e.selectedAtom.serial,")"]}),(0,Ue.jsx)(v0,{my:"sm"}),(0,Ue.jsxs)(Zl,{ta:"center",children:["Положение X: ",e.selectedAtom.position.x]}),(0,Ue.jsxs)(Zl,{ta:"center",children:["Положение Y: ",e.selectedAtom.position.y]}),(0,Ue.jsxs)(Zl,{ta:"center",children:["Положение Z: ",e.selectedAtom.position.z]})]})})})}var Vj=(e,t,n,i=100)=>{let r;const s=new ResizeObserver(()=>{t(),r&&window.clearTimeout(r),r=window.setTimeout(()=>{n()},i)});return s.observe(e),()=>s.disconnect()};function Fj(e){const t=Za(),{colorScheme:n}=b4(),[i,r]=(0,ht.useState)(null),s=(0,ht.useRef)(null),[a,c]=(0,ht.useState)(!1),[u,d]=(0,ht.useState)(e.moleculeData),p=T=>{r(T),T&&u&&T.load(u,{sourceType:"immediate",fileType:"xyz"}).then(()=>{e.selectedAtom&&e.setSelectedAtom(null)}).catch(L=>{L.message!="Operation cancelled"&&Uj.show({color:"orange",radius:"md",title:"Ошибка при отображении молекулы",message:"Проверте правильность написания кода молекулы, в нем содержатся ошибки",icon:(0,Ue.jsx)(RO,{}),style:{paddingLeft:"5px"}})}),T.setOptions({settings:{bg:{color:t.colors.secondaryDark[7]},fogAlpha:.7,axes:!0}})},g=(0,ht.useMemo)(()=>(0,Ue.jsx)(Cj,{onInit:p}),[u]);(0,ht.useEffect)(()=>{if(s.current&&i){const T=Vj(s.current,y,S);return i.removeEventListener("newpick"),i.addEventListener("newpick",v),()=>{T(),i.removeEventListener("newpick")}}},[s,i]),(0,ht.useEffect)(()=>{if(i){if(!e.selectedAtom){i.select("");return}i.select("serial "+e.selectedAtom.serial,!1),i._msgAtomInfo.style.opacity=0,i._msgAtomInfo.style.height="0px",i._msgAtomInfo.style.overflow="hidden"}},[e.selectedAtom,i]),(0,ht.useEffect)(()=>{i&&i.setOptions({settings:{bg:{color:t.colors.secondaryDark[7]}}})},[n]);const v=T=>{i&&(T.obj.atom?e.setSelectedAtom(T.obj.atom):e.setSelectedAtom(null))},y=()=>{c(!0)},S=()=>{i._onResize(),i._picker.handleResize(),setTimeout(()=>{c(!1)},50)},E=()=>{document.body.style.overflow="hidden"},w=()=>{document.body.style.overflow="auto"},b=()=>{e.moleculeData!=u?d(e.moleculeData):i&&i.resetView()};return(0,Ue.jsxs)("div",{ref:s,className:"moleculeViewer",children:[(0,Ue.jsxs)("div",{style:{width:"100%",height:"100%",backgroundColor:t.colors.secondaryDark[7],borderRadius:"5px",overflow:"hidden"},onMouseEnter:E,onMouseLeave:w,children:[g,a&&u&&(0,Ue.jsx)("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:t.colors.secondaryDark[7],opacity:.5,zIndex:10},children:(0,Ue.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:(0,Ue.jsx)(PO,{size:80})})})]}),e.selectedAtom&&(0,Ue.jsx)(bx,{className:"atomEditor",radius:"md",p:"md",children:(0,Ue.jsx)(Bj,{selectedAtom:e.selectedAtom,miew:i})}),(0,Ue.jsx)("div",{style:{position:"absolute",left:"10px",top:"10px",display:"flex",zIndex:5,width:"auto"},children:(0,Ue.jsx)(nm,{onClick:b,children:(0,Ue.jsx)(kO,{color:"white",size:25})})})]})}function kj(e){const[t,n]=(0,ht.useState)(e.data?.data.text),[i,r]=(0,ht.useState)(null),s=Za();return(0,Ue.jsxs)(Ue.Fragment,{children:[(0,Ue.jsxs)("div",{className:"experimentButtons",children:[(0,Ue.jsxs)(cf,{color:"secondary",onClick:()=>{},children:[(0,Ue.jsx)(IO,{style:{marginRight:"10px"}}),(0,Ue.jsx)(Zl,{c:"contrast",children:"Сохранить"})]}),(0,Ue.jsxs)(cf,{color:"contrast",onClick:()=>{},children:[(0,Ue.jsx)(HO,{style:{marginRight:"10px",stroke:"var(--mantine-color-secondary-filled)"}}),(0,Ue.jsx)(Zl,{c:"secondary",children:"Отменить"})]})]}),(0,Ue.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"90vh"},children:[(0,Ue.jsx)(v0,{style:{margin:"10px"}}),(0,Ue.jsxs)(dR,{style:{flex:1,gap:"5px"},children:[(0,Ue.jsx)($2,{minSize:200,defaultSize:500,children:(0,Ue.jsxs)(vo,{variant:"outline",style:{height:"100%",display:"flex",flexDirection:"column"},radius:"lg",defaultValue:"code",classNames:{panel:"tabPanel"},children:[(0,Ue.jsxs)(vo.List,{children:[(0,Ue.jsx)(vo.Tab,{value:"code",leftSection:(0,Ue.jsx)(DO,{size:12}),children:"Код"}),(0,Ue.jsx)(vo.Tab,{value:"list",leftSection:(0,Ue.jsx)(VO,{size:12}),children:"Список"})]}),(0,Ue.jsx)(vo.Panel,{value:"code",children:(0,Ue.jsx)(WO,{text:t||"",onTextChange:a=>{n(a),e.setData({text:a})}})}),(0,Ue.jsx)(vo.Panel,{value:"list",children:(0,Ue.jsx)(Ue.Fragment,{})})]})}),(0,Ue.jsx)(pR,{children:(0,Ue.jsx)(OM,{style:{height:"100%",background:s.colors.dark[4],borderRadius:"5px"},children:(0,Ue.jsx)(UO,{size:12})})}),(0,Ue.jsx)($2,{style:{flexShrink:0},minSize:200,children:(0,Ue.jsx)(Fj,{moleculeData:e.data?e.data.data.text:"",selectedAtom:i,setSelectedAtom:r})})]})]})]})}var Gj=e=>{window.parent.postMessage({type:"plugin-update",data:e},"*")},s3=m3({key:"my-app-color-scheme"}),o3={colors:{primaryDark:Wl("#212529"),primaryLight:Wl("#f1f3f5"),secondaryDark:Wl("#484d53"),secondaryLight:Wl("#b9bec4"),contrastDark:Wl("#f1f3f5"),contrastLight:Wl("#212529"),secondaryContrastDark:Wl("#b9bec4"),secondaryContrastLight:Wl("#484d53"),primary:h1({name:"primary",dark:"primaryDark",light:"primaryLight"}),secondary:h1({name:"secondary",dark:"secondaryDark",light:"secondaryLight"}),contrast:h1({name:"contrast",dark:"contrastDark",light:"contrastLight"}),secondaryContrast:h1({name:"secondaryContrast",dark:"secondaryContrastDark",light:"secondaryContrastLight"}),accent:h1({name:"accent",dark:"blue",light:"blue"})}},Hj=e=>{const[t,n]=(0,ht.useState)(),[i,r]=(0,ht.useState)("dark");return(0,ht.useEffect)(()=>{window.addEventListener("message",s=>{const{type:a,data:c}=s.data;console.log(s.data),n(c.taskData),r(c.theme)})},[e.mode]),e.mode==="List"?(0,Ue.jsx)(X2,{colorSchemeManager:s3,theme:o3,forceColorScheme:i,children:(0,Ue.jsx)(VI,{data:t})}):(0,Ue.jsx)(X2,{colorSchemeManager:s3,theme:o3,forceColorScheme:i,children:(0,Ue.jsx)(kj,{data:t,setData:Gj})})},Wj=new URLSearchParams(window.location.search).get("mode")=="List"?"List":"Editor",a3=document.getElementById("root");a3&&zI.createRoot(a3).render((0,Ue.jsx)(Hj,{mode:Wj}));window.parent!==window&&window.parent.postMessage({type:"plugin-ready"},"*");</script>
<style rel="stylesheet" crossorigin>:root{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light dark;color:#ffffffde;font-synthesis:none;text-rendering:optimizelegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:system-ui,Avenir,Helvetica,Arial,sans-serif;font-weight:400;line-height:1.5}@media (prefers-color-scheme:dark){:root{--lightningcss-light: ;--lightningcss-dark:initial}}::-webkit-scrollbar{width:4px;height:4px}@font-face{font-family:Quicking;src:url(/Quicking.otf)format("opentype");font-weight:400;font-style:normal}:root{--mantine-color-body:var(--mantine-color-primary-filled)!important}:root,:host{color-scheme:var(--mantine-color-scheme)}*,:before,:after{box-sizing:border-box}input,button,textarea,select{font:inherit}button,select{text-transform:none}body,:host{font-family:var(--mantine-font-family);font-size:var(--mantine-font-size-md);line-height:var(--mantine-line-height);background-color:var(--mantine-color-body);color:var(--mantine-color-text);-webkit-font-smoothing:var(--mantine-webkit-font-smoothing);-moz-osx-font-smoothing:var(--mantine-moz-font-smoothing);margin:0}@media screen and (device-width<=31.25em){body,:host{-webkit-text-size-adjust:100%}}@media (prefers-reduced-motion:reduce){[data-respect-reduced-motion] [data-reduce-motion]{transition:none;animation:none}}[data-mantine-color-scheme=light] .mantine-light-hidden,[data-mantine-color-scheme=dark] .mantine-dark-hidden{display:none}.mantine-focus-auto:focus-visible,.mantine-focus-always:focus{outline:2px solid var(--mantine-primary-color-filled);outline-offset:calc(.125rem * var(--mantine-scale))}.mantine-focus-never:focus{outline:none}.mantine-active:active{transform:translateY(calc(.0625rem * var(--mantine-scale)))}fieldset:disabled .mantine-active:active{transform:none}:where([dir=rtl]) .mantine-rotate-rtl{transform:rotate(180deg)}:root,:host{--mantine-z-index-app:100;--mantine-z-index-modal:200;--mantine-z-index-popover:300;--mantine-z-index-overlay:400;--mantine-z-index-max:9999;--mantine-scale:1;--mantine-cursor-type:default;--mantine-webkit-font-smoothing:antialiased;--mantine-moz-font-smoothing:grayscale;--mantine-color-white:#fff;--mantine-color-black:#000;--mantine-line-height:1.55;--mantine-font-family:-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji;--mantine-font-family-monospace:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;--mantine-font-family-headings:-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji;--mantine-heading-font-weight:700;--mantine-heading-text-wrap:wrap;--mantine-radius-default:calc(.5rem * var(--mantine-scale));--mantine-primary-color-filled:var(--mantine-color-blue-filled);--mantine-primary-color-filled-hover:var(--mantine-color-blue-filled-hover);--mantine-primary-color-light:var(--mantine-color-blue-light);--mantine-primary-color-light-hover:var(--mantine-color-blue-light-hover);--mantine-primary-color-light-color:var(--mantine-color-blue-light-color);--mantine-breakpoint-xs:36em;--mantine-breakpoint-sm:48em;--mantine-breakpoint-md:62em;--mantine-breakpoint-lg:75em;--mantine-breakpoint-xl:88em;--mantine-spacing-xs:calc(.625rem * var(--mantine-scale));--mantine-spacing-sm:calc(.75rem * var(--mantine-scale));--mantine-spacing-md:calc(1rem * var(--mantine-scale));--mantine-spacing-lg:calc(1.25rem * var(--mantine-scale));--mantine-spacing-xl:calc(2rem * var(--mantine-scale));--mantine-font-size-xs:calc(.75rem * var(--mantine-scale));--mantine-font-size-sm:calc(.875rem * var(--mantine-scale));--mantine-font-size-md:calc(1rem * var(--mantine-scale));--mantine-font-size-lg:calc(1.125rem * var(--mantine-scale));--mantine-font-size-xl:calc(1.25rem * var(--mantine-scale));--mantine-line-height-xs:1.4;--mantine-line-height-sm:1.45;--mantine-line-height-md:1.55;--mantine-line-height-lg:1.6;--mantine-line-height-xl:1.65;--mantine-shadow-xs:0 calc(.0625rem * var(--mantine-scale)) calc(.1875rem * var(--mantine-scale)) #0000000d, 0 calc(.0625rem * var(--mantine-scale)) calc(.125rem * var(--mantine-scale)) #0000001a;--mantine-shadow-sm:0 calc(.0625rem * var(--mantine-scale)) calc(.1875rem * var(--mantine-scale)) #0000000d, #0000000d 0 calc(.625rem * var(--mantine-scale)) calc(.9375rem * var(--mantine-scale)) calc(-.3125rem * var(--mantine-scale)), #0000000a 0 calc(.4375rem * var(--mantine-scale)) calc(.4375rem * var(--mantine-scale)) calc(-.3125rem * var(--mantine-scale));--mantine-shadow-md:0 calc(.0625rem * var(--mantine-scale)) calc(.1875rem * var(--mantine-scale)) #0000000d, #0000000d 0 calc(1.25rem * var(--mantine-scale)) calc(1.5625rem * var(--mantine-scale)) calc(-.3125rem * var(--mantine-scale)), #0000000a 0 calc(.625rem * var(--mantine-scale)) calc(.625rem * var(--mantine-scale)) calc(-.3125rem * var(--mantine-scale));--mantine-shadow-lg:0 calc(.0625rem * var(--mantine-scale)) calc(.1875rem * var(--mantine-scale)) #0000000d, #0000000d 0 calc(1.75rem * var(--mantine-scale)) calc(1.4375rem * var(--mantine-scale)) calc(-.4375rem * var(--mantine-scale)), #0000000a 0 calc(.75rem * var(--mantine-scale)) calc(.75rem * var(--mantine-scale)) calc(-.4375rem * var(--mantine-scale));--mantine-shadow-xl:0 calc(.0625rem * var(--mantine-scale)) calc(.1875rem * var(--mantine-scale)) #0000000d, #0000000d 0 calc(2.25rem * var(--mantine-scale)) calc(1.75rem * var(--mantine-scale)) calc(-.4375rem * var(--mantine-scale)), #0000000a 0 calc(1.0625rem * var(--mantine-scale)) calc(1.0625rem * var(--mantine-scale)) calc(-.4375rem * var(--mantine-scale));--mantine-radius-xs:calc(.125rem * var(--mantine-scale));--mantine-radius-sm:calc(.25rem * var(--mantine-scale));--mantine-radius-md:calc(.5rem * var(--mantine-scale));--mantine-radius-lg:calc(1rem * var(--mantine-scale));--mantine-radius-xl:calc(2rem * var(--mantine-scale));--mantine-font-weight-regular:400;--mantine-font-weight-medium:600;--mantine-font-weight-bold:700;--mantine-primary-color-0:var(--mantine-color-blue-0);--mantine-primary-color-1:var(--mantine-color-blue-1);--mantine-primary-color-2:var(--mantine-color-blue-2);--mantine-primary-color-3:var(--mantine-color-blue-3);--mantine-primary-color-4:var(--mantine-color-blue-4);--mantine-primary-color-5:var(--mantine-color-blue-5);--mantine-primary-color-6:var(--mantine-color-blue-6);--mantine-primary-color-7:var(--mantine-color-blue-7);--mantine-primary-color-8:var(--mantine-color-blue-8);--mantine-primary-color-9:var(--mantine-color-blue-9);--mantine-color-dark-0:#c9c9c9;--mantine-color-dark-1:#b8b8b8;--mantine-color-dark-2:#828282;--mantine-color-dark-3:#696969;--mantine-color-dark-4:#424242;--mantine-color-dark-5:#3b3b3b;--mantine-color-dark-6:#2e2e2e;--mantine-color-dark-7:#242424;--mantine-color-dark-8:#1f1f1f;--mantine-color-dark-9:#141414;--mantine-color-gray-0:#f8f9fa;--mantine-color-gray-1:#f1f3f5;--mantine-color-gray-2:#e9ecef;--mantine-color-gray-3:#dee2e6;--mantine-color-gray-4:#ced4da;--mantine-color-gray-5:#adb5bd;--mantine-color-gray-6:#868e96;--mantine-color-gray-7:#495057;--mantine-color-gray-8:#343a40;--mantine-color-gray-9:#212529;--mantine-color-red-0:#fff5f5;--mantine-color-red-1:#ffe3e3;--mantine-color-red-2:#ffc9c9;--mantine-color-red-3:#ffa8a8;--mantine-color-red-4:#ff8787;--mantine-color-red-5:#ff6b6b;--mantine-color-red-6:#fa5252;--mantine-color-red-7:#f03e3e;--mantine-color-red-8:#e03131;--mantine-color-red-9:#c92a2a;--mantine-color-pink-0:#fff0f6;--mantine-color-pink-1:#ffdeeb;--mantine-color-pink-2:#fcc2d7;--mantine-color-pink-3:#faa2c1;--mantine-color-pink-4:#f783ac;--mantine-color-pink-5:#f06595;--mantine-color-pink-6:#e64980;--mantine-color-pink-7:#d6336c;--mantine-color-pink-8:#c2255c;--mantine-color-pink-9:#a61e4d;--mantine-color-grape-0:#f8f0fc;--mantine-color-grape-1:#f3d9fa;--mantine-color-grape-2:#eebefa;--mantine-color-grape-3:#e599f7;--mantine-color-grape-4:#da77f2;--mantine-color-grape-5:#cc5de8;--mantine-color-grape-6:#be4bdb;--mantine-color-grape-7:#ae3ec9;--mantine-color-grape-8:#9c36b5;--mantine-color-grape-9:#862e9c;--mantine-color-violet-0:#f3f0ff;--mantine-color-violet-1:#e5dbff;--mantine-color-violet-2:#d0bfff;--mantine-color-violet-3:#b197fc;--mantine-color-violet-4:#9775fa;--mantine-color-violet-5:#845ef7;--mantine-color-violet-6:#7950f2;--mantine-color-violet-7:#7048e8;--mantine-color-violet-8:#6741d9;--mantine-color-violet-9:#5f3dc4;--mantine-color-indigo-0:#edf2ff;--mantine-color-indigo-1:#dbe4ff;--mantine-color-indigo-2:#bac8ff;--mantine-color-indigo-3:#91a7ff;--mantine-color-indigo-4:#748ffc;--mantine-color-indigo-5:#5c7cfa;--mantine-color-indigo-6:#4c6ef5;--mantine-color-indigo-7:#4263eb;--mantine-color-indigo-8:#3b5bdb;--mantine-color-indigo-9:#364fc7;--mantine-color-blue-0:#e7f5ff;--mantine-color-blue-1:#d0ebff;--mantine-color-blue-2:#a5d8ff;--mantine-color-blue-3:#74c0fc;--mantine-color-blue-4:#4dabf7;--mantine-color-blue-5:#339af0;--mantine-color-blue-6:#228be6;--mantine-color-blue-7:#1c7ed6;--mantine-color-blue-8:#1971c2;--mantine-color-blue-9:#1864ab;--mantine-color-cyan-0:#e3fafc;--mantine-color-cyan-1:#c5f6fa;--mantine-color-cyan-2:#99e9f2;--mantine-color-cyan-3:#66d9e8;--mantine-color-cyan-4:#3bc9db;--mantine-color-cyan-5:#22b8cf;--mantine-color-cyan-6:#15aabf;--mantine-color-cyan-7:#1098ad;--mantine-color-cyan-8:#0c8599;--mantine-color-cyan-9:#0b7285;--mantine-color-teal-0:#e6fcf5;--mantine-color-teal-1:#c3fae8;--mantine-color-teal-2:#96f2d7;--mantine-color-teal-3:#63e6be;--mantine-color-teal-4:#38d9a9;--mantine-color-teal-5:#20c997;--mantine-color-teal-6:#12b886;--mantine-color-teal-7:#0ca678;--mantine-color-teal-8:#099268;--mantine-color-teal-9:#087f5b;--mantine-color-green-0:#ebfbee;--mantine-color-green-1:#d3f9d8;--mantine-color-green-2:#b2f2bb;--mantine-color-green-3:#8ce99a;--mantine-color-green-4:#69db7c;--mantine-color-green-5:#51cf66;--mantine-color-green-6:#40c057;--mantine-color-green-7:#37b24d;--mantine-color-green-8:#2f9e44;--mantine-color-green-9:#2b8a3e;--mantine-color-lime-0:#f4fce3;--mantine-color-lime-1:#e9fac8;--mantine-color-lime-2:#d8f5a2;--mantine-color-lime-3:#c0eb75;--mantine-color-lime-4:#a9e34b;--mantine-color-lime-5:#94d82d;--mantine-color-lime-6:#82c91e;--mantine-color-lime-7:#74b816;--mantine-color-lime-8:#66a80f;--mantine-color-lime-9:#5c940d;--mantine-color-yellow-0:#fff9db;--mantine-color-yellow-1:#fff3bf;--mantine-color-yellow-2:#ffec99;--mantine-color-yellow-3:#ffe066;--mantine-color-yellow-4:#ffd43b;--mantine-color-yellow-5:#fcc419;--mantine-color-yellow-6:#fab005;--mantine-color-yellow-7:#f59f00;--mantine-color-yellow-8:#f08c00;--mantine-color-yellow-9:#e67700;--mantine-color-orange-0:#fff4e6;--mantine-color-orange-1:#ffe8cc;--mantine-color-orange-2:#ffd8a8;--mantine-color-orange-3:#ffc078;--mantine-color-orange-4:#ffa94d;--mantine-color-orange-5:#ff922b;--mantine-color-orange-6:#fd7e14;--mantine-color-orange-7:#f76707;--mantine-color-orange-8:#e8590c;--mantine-color-orange-9:#d9480f;--mantine-h1-font-size:calc(2.125rem * var(--mantine-scale));--mantine-h1-line-height:1.3;--mantine-h1-font-weight:700;--mantine-h2-font-size:calc(1.625rem * var(--mantine-scale));--mantine-h2-line-height:1.35;--mantine-h2-font-weight:700;--mantine-h3-font-size:calc(1.375rem * var(--mantine-scale));--mantine-h3-line-height:1.4;--mantine-h3-font-weight:700;--mantine-h4-font-size:calc(1.125rem * var(--mantine-scale));--mantine-h4-line-height:1.45;--mantine-h4-font-weight:700;--mantine-h5-font-size:calc(1rem * var(--mantine-scale));--mantine-h5-line-height:1.5;--mantine-h5-font-weight:700;--mantine-h6-font-size:calc(.875rem * var(--mantine-scale));--mantine-h6-line-height:1.5;--mantine-h6-font-weight:700}:root[data-mantine-color-scheme=dark],:host([data-mantine-color-scheme=dark]){--mantine-color-scheme:dark;--mantine-primary-color-contrast:var(--mantine-color-white);--mantine-color-bright:var(--mantine-color-white);--mantine-color-text:var(--mantine-color-dark-0);--mantine-color-body:var(--mantine-color-dark-7);--mantine-color-error:var(--mantine-color-red-8);--mantine-color-placeholder:var(--mantine-color-dark-3);--mantine-color-anchor:var(--mantine-color-blue-4);--mantine-color-default:var(--mantine-color-dark-6);--mantine-color-default-hover:var(--mantine-color-dark-5);--mantine-color-default-color:var(--mantine-color-white);--mantine-color-default-border:var(--mantine-color-dark-4);--mantine-color-dimmed:var(--mantine-color-dark-2);--mantine-color-disabled:var(--mantine-color-dark-6);--mantine-color-disabled-color:var(--mantine-color-dark-3);--mantine-color-disabled-border:var(--mantine-color-dark-4);--mantine-color-dark-text:var(--mantine-color-dark-4);--mantine-color-dark-filled:var(--mantine-color-dark-8);--mantine-color-dark-filled-hover:var(--mantine-color-dark-9);--mantine-color-dark-light:#0a0a0a;--mantine-color-dark-light-hover:#0e0e0e;--mantine-color-dark-light-color:var(--mantine-color-dark-0);--mantine-color-dark-outline:var(--mantine-color-dark-4);--mantine-color-dark-outline-hover:#4242420d;--mantine-color-gray-text:var(--mantine-color-gray-4);--mantine-color-gray-filled:var(--mantine-color-gray-8);--mantine-color-gray-filled-hover:var(--mantine-color-gray-9);--mantine-color-gray-light:#111315;--mantine-color-gray-light-hover:#171a1d;--mantine-color-gray-light-color:var(--mantine-color-gray-0);--mantine-color-gray-outline:var(--mantine-color-gray-4);--mantine-color-gray-outline-hover:#ced4da0d;--mantine-color-red-text:var(--mantine-color-red-4);--mantine-color-red-filled:var(--mantine-color-red-8);--mantine-color-red-filled-hover:var(--mantine-color-red-9);--mantine-color-red-light:#651515;--mantine-color-red-light-hover:#8d1d1d;--mantine-color-red-light-color:var(--mantine-color-red-0);--mantine-color-red-outline:var(--mantine-color-red-4);--mantine-color-red-outline-hover:#ff87870d;--mantine-color-pink-text:var(--mantine-color-pink-4);--mantine-color-pink-filled:var(--mantine-color-pink-8);--mantine-color-pink-filled-hover:var(--mantine-color-pink-9);--mantine-color-pink-light:#530f27;--mantine-color-pink-light-hover:#741536;--mantine-color-pink-light-color:var(--mantine-color-pink-0);--mantine-color-pink-outline:var(--mantine-color-pink-4);--mantine-color-pink-outline-hover:#f783ac0d;--mantine-color-grape-text:var(--mantine-color-grape-4);--mantine-color-grape-filled:var(--mantine-color-grape-8);--mantine-color-grape-filled-hover:var(--mantine-color-grape-9);--mantine-color-grape-light:#43174e;--mantine-color-grape-light-hover:#5e206d;--mantine-color-grape-light-color:var(--mantine-color-grape-0);--mantine-color-grape-outline:var(--mantine-color-grape-4);--mantine-color-grape-outline-hover:#da77f20d;--mantine-color-violet-text:var(--mantine-color-violet-4);--mantine-color-violet-filled:var(--mantine-color-violet-8);--mantine-color-violet-filled-hover:var(--mantine-color-violet-9);--mantine-color-violet-light:#301f62;--mantine-color-violet-light-hover:#432b89;--mantine-color-violet-light-color:var(--mantine-color-violet-0);--mantine-color-violet-outline:var(--mantine-color-violet-4);--mantine-color-violet-outline-hover:#9775fa0d;--mantine-color-indigo-text:var(--mantine-color-indigo-4);--mantine-color-indigo-filled:var(--mantine-color-indigo-8);--mantine-color-indigo-filled-hover:var(--mantine-color-indigo-9);--mantine-color-indigo-light:#1b2864;--mantine-color-indigo-light-hover:#26378b;--mantine-color-indigo-light-color:var(--mantine-color-indigo-0);--mantine-color-indigo-outline:var(--mantine-color-indigo-4);--mantine-color-indigo-outline-hover:#748ffc0d;--mantine-color-blue-text:var(--mantine-color-blue-4);--mantine-color-blue-filled:var(--mantine-color-blue-8);--mantine-color-blue-filled-hover:var(--mantine-color-blue-9);--mantine-color-blue-light:#0c3256;--mantine-color-blue-light-hover:#114678;--mantine-color-blue-light-color:var(--mantine-color-blue-0);--mantine-color-blue-outline:var(--mantine-color-blue-4);--mantine-color-blue-outline-hover:#4dabf70d;--mantine-color-cyan-text:var(--mantine-color-cyan-4);--mantine-color-cyan-filled:var(--mantine-color-cyan-8);--mantine-color-cyan-filled-hover:var(--mantine-color-cyan-9);--mantine-color-cyan-light:#063943;--mantine-color-cyan-light-hover:#08505d;--mantine-color-cyan-light-color:var(--mantine-color-cyan-0);--mantine-color-cyan-outline:var(--mantine-color-cyan-4);--mantine-color-cyan-outline-hover:#3bc9db0d;--mantine-color-teal-text:var(--mantine-color-teal-4);--mantine-color-teal-filled:var(--mantine-color-teal-8);--mantine-color-teal-filled-hover:var(--mantine-color-teal-9);--mantine-color-teal-light:#04402e;--mantine-color-teal-light-hover:#065940;--mantine-color-teal-light-color:var(--mantine-color-teal-0);--mantine-color-teal-outline:var(--mantine-color-teal-4);--mantine-color-teal-outline-hover:#38d9a90d;--mantine-color-green-text:var(--mantine-color-green-4);--mantine-color-green-filled:var(--mantine-color-green-8);--mantine-color-green-filled-hover:var(--mantine-color-green-9);--mantine-color-green-light:#16451f;--mantine-color-green-light-hover:#1e612b;--mantine-color-green-light-color:var(--mantine-color-green-0);--mantine-color-green-outline:var(--mantine-color-green-4);--mantine-color-green-outline-hover:#69db7c0d;--mantine-color-lime-text:var(--mantine-color-lime-4);--mantine-color-lime-filled:var(--mantine-color-lime-8);--mantine-color-lime-filled-hover:var(--mantine-color-lime-9);--mantine-color-lime-light:#2e4a07;--mantine-color-lime-light-hover:#406809;--mantine-color-lime-light-color:var(--mantine-color-lime-0);--mantine-color-lime-outline:var(--mantine-color-lime-4);--mantine-color-lime-outline-hover:#a9e34b0d;--mantine-color-yellow-text:var(--mantine-color-yellow-4);--mantine-color-yellow-filled:var(--mantine-color-yellow-8);--mantine-color-yellow-filled-hover:var(--mantine-color-yellow-9);--mantine-color-yellow-light:#733c00;--mantine-color-yellow-light-hover:#a15300;--mantine-color-yellow-light-color:var(--mantine-color-yellow-0);--mantine-color-yellow-outline:var(--mantine-color-yellow-4);--mantine-color-yellow-outline-hover:#ffd43b0d;--mantine-color-orange-text:var(--mantine-color-orange-4);--mantine-color-orange-filled:var(--mantine-color-orange-8);--mantine-color-orange-filled-hover:var(--mantine-color-orange-9);--mantine-color-orange-light:#6d2408;--mantine-color-orange-light-hover:#98320b;--mantine-color-orange-light-color:var(--mantine-color-orange-0);--mantine-color-orange-outline:var(--mantine-color-orange-4);--mantine-color-orange-outline-hover:#ffa94d0d}:root[data-mantine-color-scheme=light],:host([data-mantine-color-scheme=light]){--mantine-color-scheme:light;--mantine-primary-color-contrast:var(--mantine-color-white);--mantine-color-bright:var(--mantine-color-black);--mantine-color-text:#000;--mantine-color-body:#fff;--mantine-color-error:var(--mantine-color-red-6);--mantine-color-placeholder:var(--mantine-color-gray-5);--mantine-color-anchor:var(--mantine-color-blue-6);--mantine-color-default:var(--mantine-color-white);--mantine-color-default-hover:var(--mantine-color-gray-0);--mantine-color-default-color:var(--mantine-color-black);--mantine-color-default-border:var(--mantine-color-gray-4);--mantine-color-dimmed:var(--mantine-color-gray-6);--mantine-color-disabled:var(--mantine-color-gray-2);--mantine-color-disabled-color:var(--mantine-color-gray-5);--mantine-color-disabled-border:var(--mantine-color-gray-3);--mantine-color-dark-text:var(--mantine-color-dark-filled);--mantine-color-dark-filled:var(--mantine-color-dark-6);--mantine-color-dark-filled-hover:var(--mantine-color-dark-7);--mantine-color-dark-light:var(--mantine-color-dark-1);--mantine-color-dark-light-hover:var(--mantine-color-dark-2);--mantine-color-dark-light-color:var(--mantine-color-dark-9);--mantine-color-dark-outline:var(--mantine-color-dark-6);--mantine-color-dark-outline-hover:#2e2e2e0d;--mantine-color-gray-text:var(--mantine-color-gray-filled);--mantine-color-gray-filled:var(--mantine-color-gray-6);--mantine-color-gray-filled-hover:var(--mantine-color-gray-7);--mantine-color-gray-light:var(--mantine-color-gray-1);--mantine-color-gray-light-hover:var(--mantine-color-gray-2);--mantine-color-gray-light-color:var(--mantine-color-gray-9);--mantine-color-gray-outline:var(--mantine-color-gray-6);--mantine-color-gray-outline-hover:#868e960d;--mantine-color-red-text:var(--mantine-color-red-filled);--mantine-color-red-filled:var(--mantine-color-red-6);--mantine-color-red-filled-hover:var(--mantine-color-red-7);--mantine-color-red-light:var(--mantine-color-red-1);--mantine-color-red-light-hover:var(--mantine-color-red-2);--mantine-color-red-light-color:var(--mantine-color-red-9);--mantine-color-red-outline:var(--mantine-color-red-6);--mantine-color-red-outline-hover:#fa52520d;--mantine-color-pink-text:var(--mantine-color-pink-filled);--mantine-color-pink-filled:var(--mantine-color-pink-6);--mantine-color-pink-filled-hover:var(--mantine-color-pink-7);--mantine-color-pink-light:var(--mantine-color-pink-1);--mantine-color-pink-light-hover:var(--mantine-color-pink-2);--mantine-color-pink-light-color:var(--mantine-color-pink-9);--mantine-color-pink-outline:var(--mantine-color-pink-6);--mantine-color-pink-outline-hover:#e649800d;--mantine-color-grape-text:var(--mantine-color-grape-filled);--mantine-color-grape-filled:var(--mantine-color-grape-6);--mantine-color-grape-filled-hover:var(--mantine-color-grape-7);--mantine-color-grape-light:var(--mantine-color-grape-1);--mantine-color-grape-light-hover:var(--mantine-color-grape-2);--mantine-color-grape-light-color:var(--mantine-color-grape-9);--mantine-color-grape-outline:var(--mantine-color-grape-6);--mantine-color-grape-outline-hover:#be4bdb0d;--mantine-color-violet-text:var(--mantine-color-violet-filled);--mantine-color-violet-filled:var(--mantine-color-violet-6);--mantine-color-violet-filled-hover:var(--mantine-color-violet-7);--mantine-color-violet-light:var(--mantine-color-violet-1);--mantine-color-violet-light-hover:var(--mantine-color-violet-2);--mantine-color-violet-light-color:var(--mantine-color-violet-9);--mantine-color-violet-outline:var(--mantine-color-violet-6);--mantine-color-violet-outline-hover:#7950f20d;--mantine-color-indigo-text:var(--mantine-color-indigo-filled);--mantine-color-indigo-filled:var(--mantine-color-indigo-6);--mantine-color-indigo-filled-hover:var(--mantine-color-indigo-7);--mantine-color-indigo-light:var(--mantine-color-indigo-1);--mantine-color-indigo-light-hover:var(--mantine-color-indigo-2);--mantine-color-indigo-light-color:var(--mantine-color-indigo-9);--mantine-color-indigo-outline:var(--mantine-color-indigo-6);--mantine-color-indigo-outline-hover:#4c6ef50d;--mantine-color-blue-text:var(--mantine-color-blue-filled);--mantine-color-blue-filled:var(--mantine-color-blue-6);--mantine-color-blue-filled-hover:var(--mantine-color-blue-7);--mantine-color-blue-light:var(--mantine-color-blue-1);--mantine-color-blue-light-hover:var(--mantine-color-blue-2);--mantine-color-blue-light-color:var(--mantine-color-blue-9);--mantine-color-blue-outline:var(--mantine-color-blue-6);--mantine-color-blue-outline-hover:#228be60d;--mantine-color-cyan-text:var(--mantine-color-cyan-filled);--mantine-color-cyan-filled:var(--mantine-color-cyan-6);--mantine-color-cyan-filled-hover:var(--mantine-color-cyan-7);--mantine-color-cyan-light:var(--mantine-color-cyan-1);--mantine-color-cyan-light-hover:var(--mantine-color-cyan-2);--mantine-color-cyan-light-color:var(--mantine-color-cyan-9);--mantine-color-cyan-outline:var(--mantine-color-cyan-6);--mantine-color-cyan-outline-hover:#15aabf0d;--mantine-color-teal-text:var(--mantine-color-teal-filled);--mantine-color-teal-filled:var(--mantine-color-teal-6);--mantine-color-teal-filled-hover:var(--mantine-color-teal-7);--mantine-color-teal-light:var(--mantine-color-teal-1);--mantine-color-teal-light-hover:var(--mantine-color-teal-2);--mantine-color-teal-light-color:var(--mantine-color-teal-9);--mantine-color-teal-outline:var(--mantine-color-teal-6);--mantine-color-teal-outline-hover:#12b8860d;--mantine-color-green-text:var(--mantine-color-green-filled);--mantine-color-green-filled:var(--mantine-color-green-6);--mantine-color-green-filled-hover:var(--mantine-color-green-7);--mantine-color-green-light:var(--mantine-color-green-1);--mantine-color-green-light-hover:var(--mantine-color-green-2);--mantine-color-green-light-color:var(--mantine-color-green-9);--mantine-color-green-outline:var(--mantine-color-green-6);--mantine-color-green-outline-hover:#40c0570d;--mantine-color-lime-text:var(--mantine-color-lime-filled);--mantine-color-lime-filled:var(--mantine-color-lime-6);--mantine-color-lime-filled-hover:var(--mantine-color-lime-7);--mantine-color-lime-light:var(--mantine-color-lime-1);--mantine-color-lime-light-hover:var(--mantine-color-lime-2);--mantine-color-lime-light-color:var(--mantine-color-lime-9);--mantine-color-lime-outline:var(--mantine-color-lime-6);--mantine-color-lime-outline-hover:#82c91e0d;--mantine-color-yellow-text:var(--mantine-color-yellow-filled);--mantine-color-yellow-filled:var(--mantine-color-yellow-6);--mantine-color-yellow-filled-hover:var(--mantine-color-yellow-7);--mantine-color-yellow-light:var(--mantine-color-yellow-1);--mantine-color-yellow-light-hover:var(--mantine-color-yellow-2);--mantine-color-yellow-light-color:var(--mantine-color-yellow-9);--mantine-color-yellow-outline:var(--mantine-color-yellow-6);--mantine-color-yellow-outline-hover:#fab0050d;--mantine-color-orange-text:var(--mantine-color-orange-filled);--mantine-color-orange-filled:var(--mantine-color-orange-6);--mantine-color-orange-filled-hover:var(--mantine-color-orange-7);--mantine-color-orange-light:var(--mantine-color-orange-1);--mantine-color-orange-light-hover:var(--mantine-color-orange-2);--mantine-color-orange-light-color:var(--mantine-color-orange-9);--mantine-color-orange-outline:var(--mantine-color-orange-6);--mantine-color-orange-outline-hover:#fd7e140d}.m_d57069b5{--scrollarea-scrollbar-size:calc(.75rem * var(--mantine-scale));position:relative;overflow:hidden}.m_d57069b5:where([data-autosize]) .m_b1336c6{min-width:min-content}.m_c0783ff9{scrollbar-width:none;overscroll-behavior:var(--scrollarea-over-scroll-behavior);-ms-overflow-style:none;-webkit-overflow-scrolling:touch;width:100%;height:100%}.m_c0783ff9::-webkit-scrollbar{display:none}.m_c0783ff9:where([data-scrollbars=xy],[data-scrollbars=y]):where([data-offset-scrollbars=xy],[data-offset-scrollbars=y],[data-offset-scrollbars=present]):where([data-vertical-hidden]){padding-inline:0}.m_c0783ff9:where([data-scrollbars=xy],[data-scrollbars=y]):where([data-offset-scrollbars=xy],[data-offset-scrollbars=y],[data-offset-scrollbars=present]):not([data-vertical-hidden]){padding-inline-start:unset;padding-inline-end:var(--scrollarea-scrollbar-size)}.m_c0783ff9:where([data-scrollbars=xy],[data-scrollbars=x]):where([data-offset-scrollbars=xy],[data-offset-scrollbars=x],[data-offset-scrollbars=present]):where([data-horizontal-hidden]){padding-bottom:0}.m_c0783ff9:where([data-scrollbars=xy],[data-scrollbars=x]):where([data-offset-scrollbars=xy],[data-offset-scrollbars=x],[data-offset-scrollbars=present]):not([data-horizontal-hidden]){padding-bottom:var(--scrollarea-scrollbar-size)}.m_f8f631dd{min-width:100%;display:table}.m_c44ba933{-webkit-user-select:none;user-select:none;touch-action:none;box-sizing:border-box;padding:calc(var(--scrollarea-scrollbar-size) / 5);background-color:#0000;flex-direction:row;transition:background-color .15s,opacity .15s;display:flex}@media (hover:hover){:where([data-mantine-color-scheme=light]) .m_c44ba933:hover{background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=light]) .m_c44ba933:hover>.m_d8b5e363{background-color:#00000080}:where([data-mantine-color-scheme=dark]) .m_c44ba933:hover{background-color:var(--mantine-color-dark-8)}:where([data-mantine-color-scheme=dark]) .m_c44ba933:hover>.m_d8b5e363{background-color:#ffffff80}}@media (hover:none){:where([data-mantine-color-scheme=light]) .m_c44ba933:active{background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=light]) .m_c44ba933:active>.m_d8b5e363{background-color:#00000080}:where([data-mantine-color-scheme=dark]) .m_c44ba933:active{background-color:var(--mantine-color-dark-8)}:where([data-mantine-color-scheme=dark]) .m_c44ba933:active>.m_d8b5e363{background-color:#ffffff80}}.m_c44ba933:where([data-hidden],[data-state=hidden]){display:none}.m_c44ba933:where([data-orientation=vertical]){width:var(--scrollarea-scrollbar-size);top:0;bottom:var(--sa-corner-width);inset-inline-end:0}.m_c44ba933:where([data-orientation=horizontal]){height:var(--scrollarea-scrollbar-size);bottom:0;flex-direction:column;inset-inline-start:0;inset-inline-end:var(--sa-corner-width)}.m_d8b5e363{border-radius:var(--scrollarea-scrollbar-size);opacity:var(--thumb-opacity);flex:1;transition:background-color .15s;position:relative;overflow:hidden}.m_d8b5e363:before{content:"";width:100%;height:100%;min-width:calc(2.75rem * var(--mantine-scale));min-height:calc(2.75rem * var(--mantine-scale));position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}:where([data-mantine-color-scheme=light]) .m_d8b5e363{background-color:#0006}:where([data-mantine-color-scheme=dark]) .m_d8b5e363{background-color:#fff6}.m_21657268{opacity:0;inset-inline-end:0;transition:opacity .15s;display:block;position:absolute;bottom:0}:where([data-mantine-color-scheme=light]) .m_21657268{background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_21657268{background-color:var(--mantine-color-dark-8)}.m_21657268:where([data-hovered]){opacity:1}.m_21657268:where([data-hidden]){display:none}.m_b1336c6{min-width:100%}.m_87cf2631{cursor:pointer;appearance:none;font-size:var(--mantine-font-size-md);text-align:left;color:inherit;touch-action:manipulation;-webkit-tap-highlight-color:transparent;background-color:#0000;border:0;padding:0;text-decoration:none}:where([dir=rtl]) .m_87cf2631{text-align:right}.m_515a97f8{clip:rect(0 0 0 0);height:calc(.0625rem * var(--mantine-scale));width:calc(.0625rem * var(--mantine-scale));margin:calc(-.0625rem * var(--mantine-scale));white-space:nowrap;border:0;padding:0;position:absolute;overflow:hidden}.m_1b7284a3{--paper-radius:var(--mantine-radius-default);-webkit-tap-highlight-color:transparent;touch-action:manipulation;border-radius:var(--paper-radius);box-shadow:var(--paper-shadow);background-color:var(--mantine-color-body);outline:0;text-decoration:none;display:block}[data-mantine-color-scheme=light] .m_1b7284a3{--paper-border-color:var(--mantine-color-gray-3)}[data-mantine-color-scheme=dark] .m_1b7284a3{--paper-border-color:var(--mantine-color-dark-4)}.m_1b7284a3:where([data-with-border]){border:calc(.0625rem * var(--mantine-scale)) solid var(--paper-border-color)}.m_9814e45f{background:var(--overlay-bg,#0009);-webkit-backdrop-filter:var(--overlay-filter);backdrop-filter:var(--overlay-filter);border-radius:var(--overlay-radius,0);z-index:var(--overlay-z-index);position:absolute;inset:0}.m_9814e45f:where([data-fixed]){position:fixed}.m_9814e45f:where([data-center]){justify-content:center;align-items:center;display:flex}.m_38a85659{border:1px solid var(--popover-border-color);padding:var(--mantine-spacing-sm) var(--mantine-spacing-md);box-shadow:var(--popover-shadow,none);border-radius:var(--popover-radius,var(--mantine-radius-default));position:absolute}.m_38a85659:where([data-fixed]){position:fixed}.m_38a85659:focus{outline:none}:where([data-mantine-color-scheme=light]) .m_38a85659{--popover-border-color:var(--mantine-color-gray-2);background-color:var(--mantine-color-white)}:where([data-mantine-color-scheme=dark]) .m_38a85659{--popover-border-color:var(--mantine-color-dark-4);background-color:var(--mantine-color-dark-6)}.m_a31dc6c1{background-color:inherit;border:1px solid var(--popover-border-color);z-index:1}.m_3d7bc908{position:fixed;inset:0}.m_5ae2e3c{--loader-size-xs:calc(1.125rem * var(--mantine-scale));--loader-size-sm:calc(1.375rem * var(--mantine-scale));--loader-size-md:calc(2.25rem * var(--mantine-scale));--loader-size-lg:calc(2.75rem * var(--mantine-scale));--loader-size-xl:calc(3.625rem * var(--mantine-scale));--loader-size:var(--loader-size-md);--loader-color:var(--mantine-primary-color-filled)}@keyframes m_5d2b3b9d{0%{opacity:0;transform:scale(.6)}50%,to{transform:scale(1)}}.m_7a2bd4cd{width:var(--loader-size);height:var(--loader-size);gap:calc(var(--loader-size) / 5);display:flex;position:relative}.m_870bb79{background:var(--loader-color);border-radius:calc(.125rem * var(--mantine-scale));flex:1;animation:1.2s cubic-bezier(0,.5,.5,1) infinite m_5d2b3b9d}.m_870bb79:first-of-type{animation-delay:-240ms}.m_870bb79:nth-of-type(2){animation-delay:-120ms}.m_870bb79:nth-of-type(3){animation-delay:0}@keyframes m_aac34a1{0%,to{opacity:1;transform:scale(1)}50%{opacity:.5;transform:scale(.6)}}.m_4e3f22d7{justify-content:center;align-items:center;gap:calc(var(--loader-size) / 10);width:var(--loader-size);height:var(--loader-size);display:flex;position:relative}.m_870c4af{width:calc(var(--loader-size) / 3 - var(--loader-size) / 15);height:calc(var(--loader-size) / 3 - var(--loader-size) / 15);background:var(--loader-color);border-radius:50%;animation:.8s linear infinite m_aac34a1}.m_870c4af:nth-child(2){animation-delay:.4s}@keyframes m_f8e89c4b{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.m_b34414df{width:var(--loader-size);height:var(--loader-size);display:inline-block}.m_b34414df:after{content:"";width:var(--loader-size);height:var(--loader-size);border-radius:calc(625rem * var(--mantine-scale));border-width:calc(var(--loader-size) / 8);border-style:solid;border-color:var(--loader-color) var(--loader-color) var(--loader-color) transparent;animation:1.2s linear infinite m_f8e89c4b;display:block}.m_8d3f4000{--ai-size-xs:calc(1.125rem * var(--mantine-scale));--ai-size-sm:calc(1.375rem * var(--mantine-scale));--ai-size-md:calc(1.75rem * var(--mantine-scale));--ai-size-lg:calc(2.125rem * var(--mantine-scale));--ai-size-xl:calc(2.75rem * var(--mantine-scale));--ai-size-input-xs:calc(1.875rem * var(--mantine-scale));--ai-size-input-sm:calc(2.25rem * var(--mantine-scale));--ai-size-input-md:calc(2.625rem * var(--mantine-scale));--ai-size-input-lg:calc(3.125rem * var(--mantine-scale));--ai-size-input-xl:calc(3.75rem * var(--mantine-scale));--ai-size:var(--ai-size-md);--ai-color:var(--mantine-color-white);-webkit-user-select:none;user-select:none;width:var(--ai-size);height:var(--ai-size);min-width:var(--ai-size);min-height:var(--ai-size);border-radius:var(--ai-radius,var(--mantine-radius-default));background:var(--ai-bg,var(--mantine-primary-color-filled));color:var(--ai-color,var(--mantine-color-white));border:var(--ai-bd,calc(.0625rem * var(--mantine-scale)) solid transparent);cursor:pointer;justify-content:center;align-items:center;line-height:1;display:inline-flex;position:relative;overflow:hidden}@media (hover:hover){.m_8d3f4000:hover:where(:not([data-loading],:disabled,[data-disabled])){background-color:var(--ai-hover,var(--mantine-primary-color-filled-hover));color:var(--ai-hover-color,var(--ai-color))}}@media (hover:none){.m_8d3f4000:active:where(:not([data-loading],:disabled,[data-disabled])){background-color:var(--ai-hover,var(--mantine-primary-color-filled-hover));color:var(--ai-hover-color,var(--ai-color))}}.m_8d3f4000[data-loading]{cursor:not-allowed}.m_8d3f4000[data-loading] .m_8d3afb97{opacity:0;transform:translateY(100%)}.m_8d3f4000:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){cursor:not-allowed;border:calc(.0625rem * var(--mantine-scale)) solid transparent;color:var(--mantine-color-disabled-color);background:var(--mantine-color-disabled)}.m_8d3f4000:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])):active{transform:none}.m_302b9fb1{inset:calc(-.0625rem * var(--mantine-scale));border-radius:var(--ai-radius,var(--mantine-radius-default));justify-content:center;align-items:center;display:flex;position:absolute}:where([data-mantine-color-scheme=light]) .m_302b9fb1{background-color:#ffffff26}:where([data-mantine-color-scheme=dark]) .m_302b9fb1{background-color:#00000026}.m_1a0f1b21{--ai-border-width:calc(.0625rem * var(--mantine-scale));display:flex}.m_1a0f1b21 :where(*):focus{z-index:1;position:relative}.m_1a0f1b21[data-orientation=horizontal]{flex-direction:row}.m_1a0f1b21[data-orientation=horizontal] .m_8d3f4000:not(:only-child):first-child,.m_1a0f1b21[data-orientation=horizontal] .m_437b6484:not(:only-child):first-child{border-inline-end-width:calc(var(--ai-border-width) / 2);border-start-end-radius:0;border-end-end-radius:0}.m_1a0f1b21[data-orientation=horizontal] .m_8d3f4000:not(:only-child):last-child,.m_1a0f1b21[data-orientation=horizontal] .m_437b6484:not(:only-child):last-child{border-inline-start-width:calc(var(--ai-border-width) / 2);border-start-start-radius:0;border-end-start-radius:0}.m_1a0f1b21[data-orientation=horizontal] .m_8d3f4000:not(:only-child):not(:first-child):not(:last-child),.m_1a0f1b21[data-orientation=horizontal] .m_437b6484:not(:only-child):not(:first-child):not(:last-child){border-inline-width:calc(var(--ai-border-width) / 2);border-radius:0}.m_1a0f1b21[data-orientation=vertical]{flex-direction:column}.m_1a0f1b21[data-orientation=vertical] .m_8d3f4000:not(:only-child):first-child,.m_1a0f1b21[data-orientation=vertical] .m_437b6484:not(:only-child):first-child{border-bottom-width:calc(var(--ai-border-width) / 2);border-end-end-radius:0;border-end-start-radius:0}.m_1a0f1b21[data-orientation=vertical] .m_8d3f4000:not(:only-child):last-child,.m_1a0f1b21[data-orientation=vertical] .m_437b6484:not(:only-child):last-child{border-top-width:calc(var(--ai-border-width) / 2);border-start-start-radius:0;border-start-end-radius:0}.m_1a0f1b21[data-orientation=vertical] .m_8d3f4000:not(:only-child):not(:first-child):not(:last-child),.m_1a0f1b21[data-orientation=vertical] .m_437b6484:not(:only-child):not(:first-child):not(:last-child){border-bottom-width:calc(var(--ai-border-width) / 2);border-top-width:calc(var(--ai-border-width) / 2);border-radius:0}.m_8d3afb97{justify-content:center;align-items:center;width:100%;height:100%;transition:transform .15s,opacity .1s;display:flex}.m_437b6484{--section-height-xs:calc(1.125rem * var(--mantine-scale));--section-height-sm:calc(1.375rem * var(--mantine-scale));--section-height-md:calc(1.75rem * var(--mantine-scale));--section-height-lg:calc(2.125rem * var(--mantine-scale));--section-height-xl:calc(2.75rem * var(--mantine-scale));--section-height-input-xs:calc(1.875rem * var(--mantine-scale));--section-height-input-sm:calc(2.25rem * var(--mantine-scale));--section-height-input-md:calc(2.625rem * var(--mantine-scale));--section-height-input-lg:calc(3.125rem * var(--mantine-scale));--section-height-input-xl:calc(3.75rem * var(--mantine-scale));--section-padding-x-xs:calc(.375rem * var(--mantine-scale));--section-padding-x-sm:calc(.5rem * var(--mantine-scale));--section-padding-x-md:calc(.625rem * var(--mantine-scale));--section-padding-x-lg:calc(.75rem * var(--mantine-scale));--section-padding-x-xl:calc(1rem * var(--mantine-scale));--section-height:var(--section-height-sm);--section-padding-x:var(--section-padding-x-sm);--section-color:var(--mantine-color-white);font-weight:var(--mantine-font-weight-medium);border-radius:var(--section-radius,var(--mantine-radius-default));width:auto;font-size:var(--section-fz,var(--mantine-font-size-sm));background:var(--section-bg,var(--mantine-primary-color-filled));border:var(--section-bd,calc(.0625rem * var(--mantine-scale)) solid transparent);color:var(--section-color,var(--mantine-color-white));height:var(--section-height,var(--section-height-sm));padding-inline:var(--section-padding-x,var(--section-padding-x-sm));vertical-align:middle;justify-content:center;align-items:center;line-height:1;display:inline-flex}.m_86a44da5{--cb-size-xs:calc(1.125rem * var(--mantine-scale));--cb-size-sm:calc(1.375rem * var(--mantine-scale));--cb-size-md:calc(1.75rem * var(--mantine-scale));--cb-size-lg:calc(2.125rem * var(--mantine-scale));--cb-size-xl:calc(2.75rem * var(--mantine-scale));--cb-size:var(--cb-size-md);--cb-icon-size:70%;--cb-radius:var(--mantine-radius-default);-webkit-user-select:none;user-select:none;width:var(--cb-size);height:var(--cb-size);min-width:var(--cb-size);min-height:var(--cb-size);border-radius:var(--cb-radius);justify-content:center;align-items:center;line-height:1;display:inline-flex;position:relative}:where([data-mantine-color-scheme=light]) .m_86a44da5{color:var(--mantine-color-gray-7)}:where([data-mantine-color-scheme=dark]) .m_86a44da5{color:var(--mantine-color-dark-1)}.m_86a44da5[data-disabled],.m_86a44da5:disabled{cursor:not-allowed;opacity:.6}@media (hover:hover){:where([data-mantine-color-scheme=light]) .m_220c80f2:where(:not([data-disabled],:disabled)):hover{background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_220c80f2:where(:not([data-disabled],:disabled)):hover{background-color:var(--mantine-color-dark-6)}}@media (hover:none){:where([data-mantine-color-scheme=light]) .m_220c80f2:where(:not([data-disabled],:disabled)):active{background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_220c80f2:where(:not([data-disabled],:disabled)):active{background-color:var(--mantine-color-dark-6)}}.m_4081bf90{flex-direction:row;flex-wrap:var(--group-wrap,wrap);justify-content:var(--group-justify,flex-start);align-items:var(--group-align,center);gap:var(--group-gap,var(--mantine-spacing-md));display:flex}.m_4081bf90:where([data-grow])>*{max-width:var(--group-child-width);flex-grow:1}.m_615af6c9{line-height:1;font-weight:var(--mantine-font-weight-regular);font-size:var(--mantine-font-size-md);margin:0;padding:0}.m_b5489c3c{padding:var(--mb-padding,var(--mantine-spacing-md));background-color:var(--mantine-color-body);z-index:1000;min-height:calc(3.75rem * var(--mantine-scale));justify-content:space-between;align-items:center;padding-inline-end:calc(var(--mb-padding,var(--mantine-spacing-md)) - calc(.3125rem * var(--mantine-scale)));transition:padding-inline-end .1s;display:flex;position:sticky;top:0}.m_60c222c7{width:100%;z-index:var(--mb-z-index);pointer-events:none;position:fixed;top:0;bottom:0}.m_fd1ab0aa{pointer-events:all;box-shadow:var(--mb-shadow,var(--mantine-shadow-xl))}.m_fd1ab0aa [data-mantine-scrollbar]{z-index:1001}[data-offset-scrollbars] .m_fd1ab0aa:has([data-mantine-scrollbar]) .m_b5489c3c{padding-inline-end:calc(var(--mb-padding,var(--mantine-spacing-md)) + calc(.3125rem * var(--mantine-scale)))}.m_606cb269{margin-inline-start:auto}.m_5df29311{padding:var(--mb-padding,var(--mantine-spacing-md));padding-top:var(--mb-padding,var(--mantine-spacing-md))}.m_5df29311:where(:not(:only-child)){padding-top:0}.m_6c018570{margin-top:var(--input-margin-top,0rem);margin-bottom:var(--input-margin-bottom,0rem);--input-height-xs:calc(1.875rem * var(--mantine-scale));--input-height-sm:calc(2.25rem * var(--mantine-scale));--input-height-md:calc(2.625rem * var(--mantine-scale));--input-height-lg:calc(3.125rem * var(--mantine-scale));--input-height-xl:calc(3.75rem * var(--mantine-scale));--input-padding-y-xs:calc(.3125rem * var(--mantine-scale));--input-padding-y-sm:calc(.375rem * var(--mantine-scale));--input-padding-y-md:calc(.5rem * var(--mantine-scale));--input-padding-y-lg:calc(.625rem * var(--mantine-scale));--input-padding-y-xl:calc(.8125rem * var(--mantine-scale));--input-height:var(--input-height-sm);--input-radius:var(--mantine-radius-default);--input-cursor:text;--input-text-align:left;--input-line-height:calc(var(--input-height) - calc(.125rem * var(--mantine-scale)));--input-padding:calc(var(--input-height) / 3);--input-padding-inline-start:var(--input-padding);--input-padding-inline-end:var(--input-padding);--input-placeholder-color:var(--mantine-color-placeholder);--input-color:var(--mantine-color-text);--input-disabled-bg:var(--mantine-color-disabled);--input-disabled-color:var(--mantine-color-disabled-color);--input-left-section-size:var(--input-left-section-width,calc(var(--input-height) - calc(.125rem * var(--mantine-scale))));--input-right-section-size:var(--input-right-section-width,calc(var(--input-height) - calc(.125rem * var(--mantine-scale))));--input-size:var(--input-height);--section-y:calc(.0625rem * var(--mantine-scale));--left-section-start:calc(.0625rem * var(--mantine-scale));--left-section-border-radius:var(--input-radius) 0 0 var(--input-radius);--right-section-end:calc(.0625rem * var(--mantine-scale));--right-section-border-radius:0 var(--input-radius) var(--input-radius) 0;position:relative}.m_6c018570[data-variant=unstyled]{--input-padding:0;--input-padding-y:0;--input-padding-inline-start:0;--input-padding-inline-end:0}.m_6c018570[data-pointer]{--input-cursor:pointer}.m_6c018570[data-multiline]{--input-padding-y-xs:calc(.28125rem * var(--mantine-scale));--input-padding-y-sm:calc(.34375rem * var(--mantine-scale));--input-padding-y-md:calc(.4375rem * var(--mantine-scale));--input-padding-y-lg:calc(.59375rem * var(--mantine-scale));--input-padding-y-xl:calc(.8125rem * var(--mantine-scale));--input-size:auto;--input-line-height:var(--mantine-line-height)}.m_6c018570[data-with-left-section]{--input-padding-inline-start:var(--input-left-section-size)}.m_6c018570[data-with-right-section]{--input-padding-inline-end:var(--input-right-section-size)}.m_6c018570[data-size=xs] .m_6c018570[data-with-right-section]:has([data-combined-clear-section]){--input-padding-inline-end:calc(2.5625rem * var(--mantine-scale))}.m_6c018570[data-size=sm] .m_6c018570[data-with-right-section]:has([data-combined-clear-section]){--input-padding-inline-end:calc(3.125rem * var(--mantine-scale))}.m_6c018570[data-size=md] .m_6c018570[data-with-right-section]:has([data-combined-clear-section]){--input-padding-inline-end:calc(3.75rem * var(--mantine-scale))}.m_6c018570[data-size=lg] .m_6c018570[data-with-right-section]:has([data-combined-clear-section]){--input-padding-inline-end:calc(4.5rem * var(--mantine-scale))}.m_6c018570[data-size=xl] .m_6c018570[data-with-right-section]:has([data-combined-clear-section]){--input-padding-inline-end:calc(5.5625rem * var(--mantine-scale))}[data-mantine-color-scheme=light] .m_6c018570[data-variant=default]{--input-bd:var(--mantine-color-gray-4);--input-bg:var(--mantine-color-white);--input-bd-focus:var(--mantine-primary-color-filled)}[data-mantine-color-scheme=light] .m_6c018570[data-variant=filled]{--input-bd:transparent;--input-bg:var(--mantine-color-gray-1);--input-bd-focus:var(--mantine-primary-color-filled)}[data-mantine-color-scheme=light] .m_6c018570[data-variant=unstyled]{--input-bd:transparent;--input-bg:transparent;--input-bd-focus:transparent}[data-mantine-color-scheme=dark] .m_6c018570[data-variant=default]{--input-bd:var(--mantine-color-dark-4);--input-bg:var(--mantine-color-dark-6);--input-bd-focus:var(--mantine-primary-color-filled)}[data-mantine-color-scheme=dark] .m_6c018570[data-variant=filled]{--input-bd:transparent;--input-bg:var(--mantine-color-dark-5);--input-bd-focus:var(--mantine-primary-color-filled)}[data-mantine-color-scheme=dark] .m_6c018570[data-variant=unstyled]{--input-bd:transparent;--input-bg:transparent;--input-bd-focus:transparent}[data-mantine-color-scheme] .m_6c018570[data-error]:not([data-variant=unstyled]){--input-bd:var(--mantine-color-error)}[data-mantine-color-scheme] .m_6c018570[data-error]{--input-color:var(--mantine-color-error);--input-placeholder-color:var(--mantine-color-error);--input-section-color:var(--mantine-color-error)}:where([dir=rtl]) .m_6c018570{--input-text-align:right;--left-section-border-radius:0 var(--input-radius) var(--input-radius) 0;--right-section-border-radius:var(--input-radius) 0 0 var(--input-radius)}.m_8fb7ebe7{-webkit-tap-highlight-color:transparent;appearance:none;resize:var(--input-resize,none);width:100%;text-align:var(--input-text-align);color:var(--input-color);border:calc(.0625rem * var(--mantine-scale)) solid var(--input-bd);background-color:var(--input-bg);font-family:var(--input-font-family,var(--mantine-font-family));height:var(--input-size);min-height:var(--input-height);line-height:var(--input-line-height);font-size:var(--_input-fz,var(--input-fz,var(--mantine-font-size-md)));border-radius:var(--input-radius);padding-inline-start:var(--input-padding-inline-start);padding-inline-end:var(--input-padding-inline-end);padding-top:var(--input-padding-y,0rem);padding-bottom:var(--input-padding-y,0rem);cursor:var(--input-cursor);overflow:var(--input-overflow);transition:border-color .1s;display:block}.m_8fb7ebe7[data-no-overflow]{--input-overflow:hidden}.m_8fb7ebe7[data-monospace]{--input-font-family:var(--mantine-font-family-monospace);--_input-fz:calc(var(--input-fz) - calc(.125rem * var(--mantine-scale)))}.m_8fb7ebe7:focus,.m_8fb7ebe7:focus-within{--input-bd:var(--input-bd-focus);outline:none}[data-error] .m_8fb7ebe7:focus,[data-error] .m_8fb7ebe7:focus-within{--input-bd:var(--mantine-color-error)}.m_8fb7ebe7::placeholder{color:var(--input-placeholder-color);opacity:1}.m_8fb7ebe7::-webkit-inner-spin-button{appearance:none}.m_8fb7ebe7::-webkit-outer-spin-button{appearance:none}.m_8fb7ebe7::-webkit-search-decoration{appearance:none}.m_8fb7ebe7::-webkit-search-cancel-button{appearance:none}.m_8fb7ebe7::-webkit-search-results-button{appearance:none}.m_8fb7ebe7::-webkit-search-results-decoration{appearance:none}.m_8fb7ebe7[type=number]{-moz-appearance:textfield}.m_8fb7ebe7:disabled,.m_8fb7ebe7[data-disabled]{cursor:not-allowed;opacity:.6;background-color:var(--input-disabled-bg);color:var(--input-disabled-color)}.m_8fb7ebe7:has(input:disabled){cursor:not-allowed;opacity:.6;background-color:var(--input-disabled-bg);color:var(--input-disabled-color)}.m_8fb7ebe7[readonly]{caret-color:#0000}.m_82577fc2{pointer-events:var(--section-pointer-events);z-index:1;inset-inline-start:var(--section-start);inset-inline-end:var(--section-end);bottom:var(--section-y);top:var(--section-y);width:var(--section-size);border-radius:var(--section-border-radius);color:var(--input-section-color,var(--mantine-color-dimmed));justify-content:center;align-items:center;display:flex;position:absolute}.m_82577fc2[data-position=right]{--section-pointer-events:var(--input-right-section-pointer-events);--section-end:var(--right-section-end);--section-size:var(--input-right-section-size);--section-border-radius:var(--right-section-border-radius)}.m_6c018570[data-size=xs] .m_82577fc2[data-position=right]:has([data-combined-clear-section]){--section-size:calc(2.5625rem * var(--mantine-scale))}.m_6c018570[data-size=sm] .m_82577fc2[data-position=right]:has([data-combined-clear-section]){--section-size:calc(3.125rem * var(--mantine-scale))}.m_6c018570[data-size=md] .m_82577fc2[data-position=right]:has([data-combined-clear-section]){--section-size:calc(3.75rem * var(--mantine-scale))}.m_6c018570[data-size=lg] .m_82577fc2[data-position=right]:has([data-combined-clear-section]){--section-size:calc(4.5rem * var(--mantine-scale))}.m_6c018570[data-size=xl] .m_82577fc2[data-position=right]:has([data-combined-clear-section]){--section-size:calc(5.5625rem * var(--mantine-scale))}.m_82577fc2[data-position=left]{--section-pointer-events:var(--input-left-section-pointer-events);--section-start:var(--left-section-start);--section-size:var(--input-left-section-size);--section-border-radius:var(--left-section-border-radius)}.m_88bacfd0{color:var(--input-placeholder-color,var(--mantine-color-placeholder))}[data-error] .m_88bacfd0{--input-placeholder-color:var(--input-color,var(--mantine-color-placeholder))}.m_46b77525{line-height:var(--mantine-line-height)}.m_8fdc1311{font-weight:var(--mantine-font-weight-medium);overflow-wrap:break-word;cursor:default;-webkit-tap-highlight-color:transparent;font-size:var(--input-label-size,var(--mantine-font-size-sm));display:inline-block}.m_78a94662{color:var(--input-asterisk-color,var(--mantine-color-error))}.m_8f816625,.m_fe47ce59{word-wrap:break-word;margin:0;padding:0;line-height:1.2;display:block}.m_8f816625{color:var(--mantine-color-error);font-size:var(--input-error-size,calc(var(--mantine-font-size-sm) - calc(.125rem * var(--mantine-scale))))}.m_fe47ce59{color:var(--mantine-color-dimmed);font-size:var(--input-description-size,calc(var(--mantine-font-size-sm) - calc(.125rem * var(--mantine-scale))))}.m_8bffd616{display:flex}.m_96b553a6{--transition-duration:.15s;z-index:0;transition-property:transform,width,height;transition-duration:0s;transition-timing-function:ease;position:absolute;top:0;left:0}.m_96b553a6:where([data-initialized]){transition-duration:var(--transition-duration)}.m_96b553a6:where([data-hidden]){display:none}.m_9bdbb667{--accordion-radius:var(--mantine-radius-default)}.m_df78851f{overflow-wrap:break-word}.m_4ba554d4{padding:var(--mantine-spacing-md);padding-top:calc(var(--mantine-spacing-xs) / 2)}.m_8fa820a0{width:100%;margin:0;padding:0}.m_4ba585b8{width:100%;padding-inline:var(--mantine-spacing-md);opacity:1;cursor:pointer;color:var(--mantine-color-bright);background-color:#0000;flex-direction:row-reverse;align-items:center;display:flex}.m_4ba585b8:where([data-chevron-position=left]){flex-direction:row;padding-inline-start:0}.m_4ba585b8:where(:disabled,[data-disabled]){opacity:.4;cursor:not-allowed}@media (hover:hover){:where([data-mantine-color-scheme=light]) .m_6939a5e9:where(:not(:disabled,[data-disabled])):hover,:where([data-mantine-color-scheme=light]) .m_4271d21b:where(:not(:disabled,[data-disabled])):hover{background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_6939a5e9:where(:not(:disabled,[data-disabled])):hover,:where([data-mantine-color-scheme=dark]) .m_4271d21b:where(:not(:disabled,[data-disabled])):hover{background-color:var(--mantine-color-dark-6)}}@media (hover:none){:where([data-mantine-color-scheme=light]) .m_6939a5e9:where(:not(:disabled,[data-disabled])):active,:where([data-mantine-color-scheme=light]) .m_4271d21b:where(:not(:disabled,[data-disabled])):active{background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_6939a5e9:where(:not(:disabled,[data-disabled])):active,:where([data-mantine-color-scheme=dark]) .m_4271d21b:where(:not(:disabled,[data-disabled])):active{background-color:var(--mantine-color-dark-6)}}.m_df3ffa0f{color:inherit;font-weight:var(--mantine-font-weight-regular);text-overflow:ellipsis;padding-top:var(--mantine-spacing-sm);padding-bottom:var(--mantine-spacing-sm);flex:1;overflow:hidden}.m_3f35ae96{transition:transform var(--accordion-transition-duration,.2s) ease;width:var(--accordion-chevron-size,calc(.9375rem * var(--mantine-scale)));min-width:var(--accordion-chevron-size,calc(.9375rem * var(--mantine-scale)));justify-content:flex-start;align-items:center;display:flex;transform:rotate(0)}.m_3f35ae96:where([data-rotate]){transform:rotate(180deg)}.m_3f35ae96:where([data-position=left]){margin-inline-start:var(--mantine-spacing-md);margin-inline-end:var(--mantine-spacing-md)}.m_9bd771fe{justify-content:center;align-items:center;margin-inline-end:var(--mantine-spacing-sm);display:flex}.m_9bd771fe:where([data-chevron-position=left]){margin-inline-start:var(--mantine-spacing-lg);margin-inline-end:0}:where([data-mantine-color-scheme=light]) .m_9bd7b098{--item-border-color:var(--mantine-color-gray-3);--item-filled-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_9bd7b098{--item-border-color:var(--mantine-color-dark-4);--item-filled-color:var(--mantine-color-dark-6)}.m_fe19b709{border-bottom:1px solid var(--item-border-color)}.m_1f921b3b{border:1px solid var(--item-border-color);transition:background-color .15s}.m_1f921b3b:where([data-active]){background-color:var(--item-filled-color)}.m_1f921b3b:first-of-type,.m_1f921b3b:first-of-type>[data-accordion-control]{border-start-start-radius:var(--accordion-radius);border-start-end-radius:var(--accordion-radius)}.m_1f921b3b:last-of-type,.m_1f921b3b:last-of-type>[data-accordion-control]{border-end-end-radius:var(--accordion-radius);border-end-start-radius:var(--accordion-radius)}.m_1f921b3b+.m_1f921b3b{border-top:0}.m_2cdf939a{border-radius:var(--accordion-radius)}.m_2cdf939a:where([data-active]){background-color:var(--item-filled-color)}.m_9f59b069{background-color:var(--item-filled-color);border-radius:var(--accordion-radius);border:calc(.0625rem * var(--mantine-scale)) solid transparent;transition:background-color .15s}.m_9f59b069[data-active]{border-color:var(--item-border-color)}:where([data-mantine-color-scheme=light]) .m_9f59b069[data-active]{background-color:var(--mantine-color-white)}:where([data-mantine-color-scheme=dark]) .m_9f59b069[data-active]{background-color:var(--mantine-color-dark-7)}.m_9f59b069+.m_9f59b069{margin-top:var(--mantine-spacing-md)}.m_7f854edf{z-index:var(--affix-z-index);inset-inline-start:var(--affix-left);inset-inline-end:var(--affix-right);top:var(--affix-top);bottom:var(--affix-bottom);position:fixed}.m_66836ed3{--alert-radius:var(--mantine-radius-default);--alert-bg:var(--mantine-primary-color-light);--alert-bd:calc(.0625rem * var(--mantine-scale)) solid transparent;--alert-color:var(--mantine-primary-color-light-color);padding:var(--mantine-spacing-md) var(--mantine-spacing-md);border-radius:var(--alert-radius);background-color:var(--alert-bg);border:var(--alert-bd);color:var(--alert-color);position:relative;overflow:hidden}.m_a5d60502{display:flex}.m_667c2793{gap:var(--mantine-spacing-xs);flex-direction:column;flex:1;display:flex}.m_6a03f287{font-size:var(--mantine-font-size-sm);font-weight:var(--mantine-font-weight-bold);justify-content:space-between;align-items:center;display:flex}.m_6a03f287:where([data-with-close-button]){padding-inline-end:var(--mantine-spacing-md)}.m_698f4f23{text-overflow:ellipsis;display:block;overflow:hidden}.m_667f2a6a{width:calc(1.25rem * var(--mantine-scale));height:calc(1.25rem * var(--mantine-scale));margin-inline-end:var(--mantine-spacing-md);margin-top:calc(.0625rem * var(--mantine-scale));justify-content:flex-start;align-items:center;line-height:1;display:flex}.m_7fa78076{text-overflow:ellipsis;font-size:var(--mantine-font-size-sm);overflow:hidden}:where([data-mantine-color-scheme=light]) .m_7fa78076{color:var(--mantine-color-black)}:where([data-mantine-color-scheme=dark]) .m_7fa78076{color:var(--mantine-color-white)}.m_7fa78076:where([data-variant=filled]){color:var(--alert-color)}.m_7fa78076:where([data-variant=white]){color:var(--mantine-color-black)}.m_87f54839{width:calc(1.25rem * var(--mantine-scale));height:calc(1.25rem * var(--mantine-scale));color:var(--alert-color)}.m_b6d8b162{-webkit-tap-highlight-color:transparent;font-size:var(--text-fz,var(--mantine-font-size-md));line-height:var(--text-lh,var(--mantine-line-height-md));font-weight:var(--mantine-font-weight-regular);margin:0;padding:0;text-decoration:none}.m_b6d8b162:where([data-truncate]){text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.m_b6d8b162:where([data-truncate=start]){text-align:right;direction:rtl}:where([dir=rtl]) .m_b6d8b162:where([data-truncate=start]){text-align:left;direction:ltr}.m_b6d8b162:where([data-variant=gradient]){background-image:var(--text-gradient);-webkit-text-fill-color:transparent;-webkit-background-clip:text;background-clip:text}.m_b6d8b162:where([data-line-clamp]){text-overflow:ellipsis;-webkit-line-clamp:var(--text-line-clamp);-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.m_b6d8b162:where([data-inherit]){line-height:inherit;font-weight:inherit;font-size:inherit}.m_b6d8b162:where([data-inline]){line-height:1}.m_849cf0da{color:var(--mantine-color-anchor);appearance:none;cursor:pointer;background-color:#0000;border:none;margin:0;padding:0;text-decoration:none;display:inline}@media (hover:hover){.m_849cf0da:where([data-underline=hover]):hover{text-decoration:underline}}@media (hover:none){.m_849cf0da:where([data-underline=hover]):active{text-decoration:underline}}.m_849cf0da:where([data-underline=not-hover]){text-decoration:underline}@media (hover:hover){.m_849cf0da:where([data-underline=not-hover]):hover{text-decoration:none}}@media (hover:none){.m_849cf0da:where([data-underline=not-hover]):active{text-decoration:none}}.m_849cf0da:where([data-underline=always]){text-decoration:underline}.m_849cf0da:where([data-variant=gradient]),.m_849cf0da:where([data-variant=gradient]):hover{text-decoration:none}.m_849cf0da:where([data-line-clamp]){display:-webkit-box}.m_48204f9b{width:var(--slider-size);height:var(--slider-size);-webkit-user-select:none;user-select:none;border-radius:100%;justify-content:center;align-items:center;display:flex;position:relative}.m_48204f9b:focus-within{outline:2px solid var(--mantine-primary-color-filled);outline-offset:calc(.125rem * var(--mantine-scale))}.m_48204f9b{--slider-size:calc(3.75rem * var(--mantine-scale));--thumb-size:calc(var(--slider-size) / 5)}:where([data-mantine-color-scheme=light]) .m_48204f9b{background-color:var(--mantine-color-gray-1)}:where([data-mantine-color-scheme=dark]) .m_48204f9b{background-color:var(--mantine-color-dark-5)}.m_bb9cdbad{inset:calc(.0625rem * var(--mantine-scale));border-radius:var(--slider-size);pointer-events:none;position:absolute}.m_481dd586{width:calc(.125rem * var(--mantine-scale));transform:rotate(var(--angle));position:absolute;top:0;bottom:0;left:calc(50% - 1px)}.m_481dd586:before{content:"";top:calc(var(--thumb-size) / 3);left:calc(.03125rem * var(--mantine-scale));width:calc(.0625rem * var(--mantine-scale));height:calc(var(--thumb-size) / 1.5);position:absolute;transform:translate(-50%,-50%)}:where([data-mantine-color-scheme=light]) .m_481dd586:before{background-color:var(--mantine-color-gray-4)}:where([data-mantine-color-scheme=dark]) .m_481dd586:before{background-color:var(--mantine-color-dark-3)}.m_481dd586[data-label]:after{min-width:calc(1.125rem * var(--mantine-scale));text-align:center;content:attr(data-label);top:calc(-1.5rem * var(--mantine-scale));left:calc(-.4375rem * var(--mantine-scale));transform:rotate(calc(360deg - var(--angle)));font-size:var(--mantine-font-size-xs);position:absolute}.m_bc02ba3d{height:100%;width:calc(.1875rem * var(--mantine-scale));pointer-events:none;outline:none;position:absolute;inset-block:0;inset-inline:calc(50% - 1.5px) 0}.m_bc02ba3d:before{content:"";height:min(var(--thumb-size), calc(var(--slider-size) / 2));width:calc(.1875rem * var(--mantine-scale));position:absolute;top:0;right:0}:where([data-mantine-color-scheme=light]) .m_bc02ba3d:before{background-color:var(--mantine-color-gray-7)}:where([data-mantine-color-scheme=dark]) .m_bc02ba3d:before{background-color:var(--mantine-color-dark-1)}.m_bb8e875b{font-size:var(--mantine-font-size-xs)}.m_89ab340[data-resizing]{--app-shell-transition-duration:0s!important}.m_89ab340[data-disabled]{--app-shell-header-offset:0rem!important;--app-shell-navbar-offset:0rem!important;--app-shell-aside-offset:0rem!important;--app-shell-footer-offset:0rem!important}.m_89ab340[data-mode=static]{grid-template-columns:var(--app-shell-navbar-width,0) 1fr var(--app-shell-aside-width,0);grid-template-rows:auto 1fr auto;height:100%;display:grid;position:relative;overflow:auto}[data-mantine-color-scheme=light] .m_89ab340{--app-shell-border-color:var(--mantine-color-gray-3)}[data-mantine-color-scheme=dark] .m_89ab340{--app-shell-border-color:var(--mantine-color-dark-4)}.m_45252eee,.m_9cdde9a,.m_3b16f56b,.m_8983817,.m_3840c879{transition-duration:var(--app-shell-transition-duration);transition-timing-function:var(--app-shell-transition-timing-function)}.m_45252eee,.m_9cdde9a{top:var(--app-shell-header-offset,0rem);height:calc(100dvh - var(--app-shell-header-offset,0rem) - var(--app-shell-footer-offset,0rem));background-color:var(--mantine-color-body);flex-direction:column;transition-property:transform,top,height;display:flex;position:fixed}:where([data-mode=static]) .m_45252eee,:where([data-mode=static]) .m_9cdde9a{position:var(--app-shell-navbar-position,fixed);grid-row:var(--app-shell-navbar-grid-row,auto);height:100%}:where([data-layout=alt]) .m_45252eee,:where([data-layout=alt]) .m_9cdde9a{height:100dvh;top:0}:where([data-mode=static][data-layout=alt]) .m_45252eee,:where([data-mode=static][data-layout=alt]) .m_9cdde9a{grid-row:1/-1;height:100%}.m_45252eee{width:var(--app-shell-navbar-width);transform:var(--app-shell-navbar-transform);z-index:var(--app-shell-navbar-z-index);transition-property:transform,top,height;inset-inline-start:0}:where([data-mode=static]) .m_45252eee{grid-column:var(--app-shell-navbar-grid-column,auto);display:var(--app-shell-navbar-display,flex)}:where([dir=rtl]) .m_45252eee{transform:var(--app-shell-navbar-transform-rtl)}.m_45252eee:where([data-with-border]){border-inline-end:1px solid var(--app-shell-border-color)}.m_9cdde9a{width:var(--app-shell-aside-width);transform:var(--app-shell-aside-transform);z-index:var(--app-shell-aside-z-index);inset-inline-end:0}:where([data-mode=static]) .m_9cdde9a{position:var(--app-shell-aside-position,fixed);grid-column:var(--app-shell-aside-grid-column,auto);grid-row:var(--app-shell-aside-grid-row,auto);display:var(--app-shell-aside-display,flex)}:where([dir=rtl]) .m_9cdde9a{transform:var(--app-shell-aside-transform-rtl)}.m_9cdde9a:where([data-with-border]){border-inline-start:1px solid var(--app-shell-border-color)}:where([data-mode=static][data-layout=alt]) .m_9cdde9a{grid-row:1/-1}:where([data-scroll-locked]) .m_9cdde9a{visibility:var(--app-shell-aside-scroll-locked-visibility)}.m_8983817{padding-inline-start:calc(var(--app-shell-navbar-offset,0rem) + var(--app-shell-padding));padding-inline-end:calc(var(--app-shell-aside-offset,0rem) + var(--app-shell-padding));padding-top:calc(var(--app-shell-header-offset,0rem) + var(--app-shell-padding));padding-bottom:calc(var(--app-shell-footer-offset,0rem) + var(--app-shell-padding));min-height:100dvh;transition-property:padding}:where([data-mode=static]) .m_8983817{padding-inline-start:var(--app-shell-padding);padding-inline-end:var(--app-shell-padding);padding-top:var(--app-shell-padding);padding-bottom:var(--app-shell-padding);grid-column:var(--app-shell-main-column-start,1) / var(--app-shell-main-column-end,-1);grid-row:var(--app-shell-main-grid-row,2);min-height:auto}.m_3b16f56b,.m_3840c879{background-color:var(--mantine-color-body);transition-property:transform,margin-inline-start,margin-inline-end;position:fixed;inset-inline:0}:where([data-mode=static]) .m_3b16f56b,:where([data-mode=static]) .m_3840c879{position:var(--app-shell-header-position,fixed);grid-column:var(--app-shell-header-grid-column,auto)}:where([data-layout=alt]) .m_3b16f56b,:where([data-layout=alt]) .m_3840c879{margin-inline-start:var(--app-shell-navbar-offset,0rem);margin-inline-end:var(--app-shell-aside-offset,0rem)}:where([data-mode=static][data-layout=alt]) .m_3b16f56b,:where([data-mode=static][data-layout=alt]) .m_3840c879{grid-column:var(--app-shell-main-column-start,1) / var(--app-shell-main-column-end,-1);margin-inline:0}.m_3b16f56b{height:var(--app-shell-header-height);background-color:var(--mantine-color-body);transform:var(--app-shell-header-transform);z-index:var(--app-shell-header-z-index);top:0}:where([data-mode=static]) .m_3b16f56b{grid-row:var(--app-shell-header-grid-row,auto)}.m_3b16f56b:where([data-with-border]){border-bottom:1px solid var(--app-shell-border-color)}.m_3840c879{height:calc(var(--app-shell-footer-height) + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom);transform:var(--app-shell-footer-transform);z-index:var(--app-shell-footer-z-index);bottom:0}:where([data-mode=static]) .m_3840c879{position:var(--app-shell-footer-position,fixed);grid-column:var(--app-shell-footer-grid-column,auto);grid-row:var(--app-shell-footer-grid-row,auto)}:where([data-mode=static][data-layout=alt]) .m_3840c879{grid-column:var(--app-shell-main-column-start,1) / var(--app-shell-main-column-end,-1)}.m_3840c879:where([data-with-border]){border-top:1px solid var(--app-shell-border-color)}.m_6dcfc7c7{flex-grow:0}.m_6dcfc7c7:where([data-grow]){flex-grow:1}.m_71ac47fc{--ar-ratio:1;max-width:100%}.m_71ac47fc>:where(:not(style)){aspect-ratio:var(--ar-ratio);width:100%}.m_71ac47fc>:where(img,video){object-fit:cover}.m_88b62a41{--combobox-padding:calc(.25rem * var(--mantine-scale));padding:var(--combobox-padding)}.m_88b62a41:has([data-mantine-scrollbar]) .m_985517d8{max-width:calc(100% + var(--combobox-padding))}.m_88b62a41[data-composed]{padding-inline-end:0}.m_88b62a41[data-hidden]{display:none}.m_88b62a41,.m_b2821a6e{--combobox-option-padding-xs:calc(.25rem * var(--mantine-scale)) calc(.5rem * var(--mantine-scale));--combobox-option-padding-sm:calc(.375rem * var(--mantine-scale)) calc(.625rem * var(--mantine-scale));--combobox-option-padding-md:calc(.5rem * var(--mantine-scale)) calc(.75rem * var(--mantine-scale));--combobox-option-padding-lg:calc(.625rem * var(--mantine-scale)) calc(1rem * var(--mantine-scale));--combobox-option-padding-xl:calc(.875rem * var(--mantine-scale)) calc(1.25rem * var(--mantine-scale));--combobox-option-padding:var(--combobox-option-padding-sm)}.m_92253aa5{padding:var(--combobox-option-padding);font-size:var(--combobox-option-fz,var(--mantine-font-size-sm));border-radius:var(--mantine-radius-default);color:inherit;cursor:pointer;overflow-wrap:break-word;background-color:#0000}.m_92253aa5:where([data-combobox-selected]){background-color:var(--mantine-primary-color-filled);color:var(--mantine-color-white)}.m_92253aa5:where([data-combobox-disabled]){cursor:not-allowed;opacity:.35}@media (hover:hover){:where([data-mantine-color-scheme=light]) .m_92253aa5:hover:where(:not([data-combobox-selected],[data-combobox-disabled])){background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_92253aa5:hover:where(:not([data-combobox-selected],[data-combobox-disabled])){background-color:var(--mantine-color-dark-7)}}@media (hover:none){:where([data-mantine-color-scheme=light]) .m_92253aa5:active:where(:not([data-combobox-selected],[data-combobox-disabled])){background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_92253aa5:active:where(:not([data-combobox-selected],[data-combobox-disabled])){background-color:var(--mantine-color-dark-7)}}.m_985517d8{margin-inline:calc(var(--combobox-padding) * -1);margin-top:calc(var(--combobox-padding) * -1);width:calc(100% + var(--combobox-padding) * 2);border-top-width:0;margin-bottom:var(--combobox-padding);border-inline-width:0;border-end-end-radius:0;border-end-start-radius:0;position:relative}:where([data-mantine-color-scheme=light]) .m_985517d8,:where([data-mantine-color-scheme=light]) .m_985517d8:focus{border-color:var(--mantine-color-gray-2)}:where([data-mantine-color-scheme=dark]) .m_985517d8,:where([data-mantine-color-scheme=dark]) .m_985517d8:focus{border-color:var(--mantine-color-dark-4)}:where([data-mantine-color-scheme=light]) .m_985517d8{background-color:var(--mantine-color-white)}:where([data-mantine-color-scheme=dark]) .m_985517d8{background-color:var(--mantine-color-dark-7)}.m_2530cd1d{font-size:var(--combobox-option-fz,var(--mantine-font-size-sm));text-align:center;padding:var(--combobox-option-padding);color:var(--mantine-color-dimmed)}.m_858f94bd,.m_82b967cb{font-size:var(--combobox-option-fz,var(--mantine-font-size-sm));margin-inline:calc(var(--combobox-padding) * -1);padding:var(--combobox-option-padding);border:0 solid #0000}:where([data-mantine-color-scheme=light]) .m_858f94bd,:where([data-mantine-color-scheme=light]) .m_82b967cb{border-color:var(--mantine-color-gray-2)}:where([data-mantine-color-scheme=dark]) .m_858f94bd,:where([data-mantine-color-scheme=dark]) .m_82b967cb{border-color:var(--mantine-color-dark-4)}.m_82b967cb{border-top-width:calc(.0625rem * var(--mantine-scale));margin-top:var(--combobox-padding);margin-bottom:calc(var(--combobox-padding) * -1)}.m_858f94bd{border-bottom-width:calc(.0625rem * var(--mantine-scale));margin-bottom:var(--combobox-padding);margin-top:calc(var(--combobox-padding) * -1)}.m_254f3e4f:has(.m_2bb2e9e5:only-child){display:none}.m_2bb2e9e5{color:var(--mantine-color-dimmed);font-size:calc(var(--combobox-option-fz,var(--mantine-font-size-sm)) * .85);padding:var(--combobox-option-padding);font-weight:var(--mantine-font-weight-medium);align-items:center;display:flex;position:relative}.m_2bb2e9e5:after{content:"";height:calc(.0625rem * var(--mantine-scale));flex:1;margin-inline-start:var(--mantine-spacing-xs);inset-inline:0}:where([data-mantine-color-scheme=light]) .m_2bb2e9e5:after{background-color:var(--mantine-color-gray-2)}:where([data-mantine-color-scheme=dark]) .m_2bb2e9e5:after{background-color:var(--mantine-color-dark-4)}.m_2bb2e9e5:only-child{display:none}.m_2943220b{--combobox-chevron-size-xs:calc(.875rem * var(--mantine-scale));--combobox-chevron-size-sm:calc(1.125rem * var(--mantine-scale));--combobox-chevron-size-md:calc(1.25rem * var(--mantine-scale));--combobox-chevron-size-lg:calc(1.5rem * var(--mantine-scale));--combobox-chevron-size-xl:calc(1.75rem * var(--mantine-scale));--combobox-chevron-size:var(--combobox-chevron-size-sm)}:where([data-mantine-color-scheme=light]) .m_2943220b{--_combobox-chevron-color:var(--combobox-chevron-color,var(--mantine-color-gray-6))}:where([data-mantine-color-scheme=dark]) .m_2943220b{--_combobox-chevron-color:var(--combobox-chevron-color,var(--mantine-color-dark-3))}.m_2943220b{width:var(--combobox-chevron-size);height:var(--combobox-chevron-size);color:var(--_combobox-chevron-color)}.m_2943220b:where([data-error]){color:var(--combobox-chevron-color,var(--mantine-color-error))}.m_390b5f4{align-items:center;gap:calc(.5rem * var(--mantine-scale));display:flex}.m_390b5f4:where([data-reverse]){justify-content:space-between}.m_8ee53fc2{opacity:.4;width:.8em;min-width:.8em;height:.8em}:where([data-combobox-selected]) .m_8ee53fc2{opacity:1}.m_a530ee0a{width:.8em;min-width:.8em;height:.8em}.m_5f75b09e{--label-lh-xs:calc(1rem * var(--mantine-scale));--label-lh-sm:calc(1.25rem * var(--mantine-scale));--label-lh-md:calc(1.5rem * var(--mantine-scale));--label-lh-lg:calc(1.875rem * var(--mantine-scale));--label-lh-xl:calc(2.25rem * var(--mantine-scale));--label-lh:var(--label-lh-sm)}.m_5f75b09e[data-label-position=left]{--label-order:1;--label-offset-end:var(--mantine-spacing-sm);--label-offset-start:0}.m_5f75b09e[data-label-position=right]{--label-order:2;--label-offset-end:0;--label-offset-start:var(--mantine-spacing-sm)}.m_5f6e695e{-webkit-tap-highlight-color:transparent;display:flex}.m_d3ea56bb{--label-cursor:var(--mantine-cursor-type);-webkit-tap-highlight-color:transparent;font-size:var(--label-fz,var(--mantine-font-size-sm));line-height:var(--label-lh);cursor:var(--label-cursor);flex-direction:column;order:var(--label-order);display:inline-flex}fieldset:disabled .m_d3ea56bb,.m_d3ea56bb[data-disabled]{--label-cursor:not-allowed}.m_8ee546b8{cursor:var(--label-cursor);color:inherit;padding-inline-start:var(--label-offset-start);padding-inline-end:var(--label-offset-end)}fieldset:disabled .m_8ee546b8,.m_8ee546b8:where([data-disabled]){color:var(--mantine-color-disabled-color)}.m_328f68c0{margin-top:calc(var(--mantine-spacing-xs) / 2);cursor:default;padding-inline-start:var(--label-offset-start);padding-inline-end:var(--label-offset-end)}.m_8e8a99cc{margin-top:calc(var(--mantine-spacing-xs) / 2);padding-inline-start:var(--label-offset-start);padding-inline-end:var(--label-offset-end)}.m_26775b0a{--card-radius:var(--mantine-radius-default);border-radius:var(--card-radius);cursor:pointer;width:100%;display:block}.m_26775b0a :where(*){cursor:inherit}.m_26775b0a:where([data-with-border]){border:calc(.0625rem * var(--mantine-scale)) solid transparent}:where([data-mantine-color-scheme=light]) .m_26775b0a:where([data-with-border]){border-color:var(--mantine-color-gray-3)}:where([data-mantine-color-scheme=dark]) .m_26775b0a:where([data-with-border]){border-color:var(--mantine-color-dark-4)}.m_5e5256ee{--checkbox-size-xs:calc(1rem * var(--mantine-scale));--checkbox-size-sm:calc(1.25rem * var(--mantine-scale));--checkbox-size-md:calc(1.5rem * var(--mantine-scale));--checkbox-size-lg:calc(1.875rem * var(--mantine-scale));--checkbox-size-xl:calc(2.25rem * var(--mantine-scale));--checkbox-size:var(--checkbox-size-sm);--checkbox-color:var(--mantine-primary-color-filled)}.m_5e5256ee:where([data-variant=filled]){--checkbox-icon-color:var(--mantine-color-white)}.m_5e5256ee:where([data-variant=outline]){--checkbox-icon-color:var(--checkbox-color)}.m_5e5256ee{border:calc(.0625rem * var(--mantine-scale)) solid transparent;width:var(--checkbox-size);min-width:var(--checkbox-size);height:var(--checkbox-size);min-height:var(--checkbox-size);border-radius:var(--checkbox-radius,var(--mantine-radius-default));cursor:var(--mantine-cursor-type);-webkit-tap-highlight-color:transparent;justify-content:center;align-items:center;transition:border-color .1s,background-color .1s;display:flex;position:relative}:where([data-mantine-color-scheme=light]) .m_5e5256ee{background-color:var(--mantine-color-white);border-color:var(--mantine-color-gray-4)}:where([data-mantine-color-scheme=dark]) .m_5e5256ee{background-color:var(--mantine-color-dark-6);border-color:var(--mantine-color-dark-4)}.m_5e5256ee[data-indeterminate],.m_5e5256ee[data-checked]{background-color:var(--checkbox-color);border-color:var(--checkbox-color)}.m_5e5256ee[data-indeterminate]>.m_1b1c543a,.m_5e5256ee[data-checked]>.m_1b1c543a{opacity:1;color:var(--checkbox-icon-color);transform:none}.m_5e5256ee[data-disabled]{cursor:not-allowed;border-color:var(--mantine-color-disabled-border);background-color:var(--mantine-color-disabled)}[data-mantine-color-scheme=light] .m_5e5256ee[data-disabled][data-checked]>.m_1b1c543a{color:var(--mantine-color-gray-5)}[data-mantine-color-scheme=dark] .m_5e5256ee[data-disabled][data-checked]>.m_1b1c543a{color:var(--mantine-color-dark-3)}.m_76e20374[data-indeterminate]:not([data-disabled]),.m_76e20374[data-checked]:not([data-disabled]){border-color:var(--checkbox-color);background-color:#0000}.m_76e20374[data-indeterminate]:not([data-disabled])>.m_1b1c543a,.m_76e20374[data-checked]:not([data-disabled])>.m_1b1c543a{color:var(--checkbox-icon-color);opacity:1;transform:none}.m_1b1c543a{color:#0000;pointer-events:none;width:60%;transform:translateY(calc(.3125rem * var(--mantine-scale))) scale(.5);opacity:1;transition:transform .1s,opacity .1s;display:block}.m_bf2d988c{--checkbox-size-xs:calc(1rem * var(--mantine-scale));--checkbox-size-sm:calc(1.25rem * var(--mantine-scale));--checkbox-size-md:calc(1.5rem * var(--mantine-scale));--checkbox-size-lg:calc(1.875rem * var(--mantine-scale));--checkbox-size-xl:calc(2.25rem * var(--mantine-scale));--checkbox-size:var(--checkbox-size-sm);--checkbox-color:var(--mantine-primary-color-filled)}.m_bf2d988c:where([data-variant=filled]){--checkbox-icon-color:var(--mantine-color-white)}.m_bf2d988c:where([data-variant=outline]){--checkbox-icon-color:var(--checkbox-color)}.m_26062bec{width:var(--checkbox-size);height:var(--checkbox-size);order:1;position:relative}.m_26062bec:where([data-label-position=left]){order:2}.m_26063560{appearance:none;border:calc(.0625rem * var(--mantine-scale)) solid transparent;width:var(--checkbox-size);height:var(--checkbox-size);border-radius:var(--checkbox-radius,var(--mantine-radius-default));cursor:var(--mantine-cursor-type);-webkit-tap-highlight-color:transparent;margin:0;padding:0;transition:border-color .1s,background-color .1s;display:block}:where([data-mantine-color-scheme=light]) .m_26063560{background-color:var(--mantine-color-white);border-color:var(--mantine-color-gray-4)}:where([data-mantine-color-scheme=dark]) .m_26063560{background-color:var(--mantine-color-dark-6);border-color:var(--mantine-color-dark-4)}.m_26063560:where([data-with-error-styles][data-error]){border-color:var(--mantine-color-error)}.m_26063560[data-indeterminate],.m_26063560:checked{background-color:var(--checkbox-color);border-color:var(--checkbox-color)}.m_26063560[data-indeterminate]+.m_bf295423,.m_26063560:checked+.m_bf295423{opacity:1;transform:none}.m_26063560:disabled{cursor:not-allowed;border-color:var(--mantine-color-disabled-border);background-color:var(--mantine-color-disabled)}.m_26063560:disabled+.m_bf295423{color:var(--mantine-color-disabled-color)}.m_215c4542+.m_bf295423{color:var(--checkbox-color)}.m_215c4542[data-indeterminate]:not(:disabled),.m_215c4542:checked:not(:disabled){border-color:var(--checkbox-color);background-color:#0000}.m_215c4542[data-indeterminate]:not(:disabled)+.m_bf295423,.m_215c4542:checked:not(:disabled)+.m_bf295423{color:var(--checkbox-icon-color);opacity:1;transform:none}.m_bf295423{width:60%;color:var(--checkbox-icon-color);pointer-events:none;transform:translateY(calc(.3125rem * var(--mantine-scale))) scale(.5);opacity:0;margin:auto;transition:transform .1s,opacity .1s;position:absolute;inset:0}.m_11def92b{--ag-spacing:var(--mantine-spacing-sm);--ag-offset:calc(var(--ag-spacing) * -1);padding-inline-start:var(--ag-spacing);display:flex}.m_f85678b6{--avatar-size-xs:calc(1rem * var(--mantine-scale));--avatar-size-sm:calc(1.625rem * var(--mantine-scale));--avatar-size-md:calc(2.375rem * var(--mantine-scale));--avatar-size-lg:calc(3.5rem * var(--mantine-scale));--avatar-size-xl:calc(5.25rem * var(--mantine-scale));--avatar-size:var(--avatar-size-md);--avatar-radius:calc(62.5rem * var(--mantine-scale));--avatar-bg:var(--mantine-color-gray-light);--avatar-bd:calc(.0625rem * var(--mantine-scale)) solid transparent;--avatar-color:var(--mantine-color-gray-light-color);--avatar-placeholder-fz:calc(var(--avatar-size) / 2.5);-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none;border-radius:var(--avatar-radius);width:var(--avatar-size);height:var(--avatar-size);min-width:var(--avatar-size);padding:0;text-decoration:none;display:block;position:relative;overflow:hidden}.m_f85678b6:where([data-within-group]){border:2px solid var(--mantine-color-body);background:var(--mantine-color-body);margin-inline-start:var(--ag-offset)}.m_11f8ac07{object-fit:cover;width:100%;height:100%;display:block}.m_104cd71f{font-weight:var(--mantine-font-weight-bold);-webkit-user-select:none;user-select:none;border-radius:var(--avatar-radius);width:100%;height:100%;font-size:var(--avatar-placeholder-fz);background:var(--avatar-bg);border:var(--avatar-bd);color:var(--avatar-color);justify-content:center;align-items:center;display:flex}.m_104cd71f>[data-avatar-placeholder-icon]{width:70%;height:70%}.m_2ce0de02{border-radius:var(--bi-radius,0);background-position:50%;background-size:cover;border:0;width:100%;text-decoration:none;display:block}.m_347db0ec{--badge-height-xs:calc(1rem * var(--mantine-scale));--badge-height-sm:calc(1.125rem * var(--mantine-scale));--badge-height-md:calc(1.25rem * var(--mantine-scale));--badge-height-lg:calc(1.625rem * var(--mantine-scale));--badge-height-xl:calc(2rem * var(--mantine-scale));--badge-fz-xs:calc(.5625rem * var(--mantine-scale));--badge-fz-sm:calc(.625rem * var(--mantine-scale));--badge-fz-md:calc(.6875rem * var(--mantine-scale));--badge-fz-lg:calc(.8125rem * var(--mantine-scale));--badge-fz-xl:calc(1rem * var(--mantine-scale));--badge-padding-x-xs:calc(.375rem * var(--mantine-scale));--badge-padding-x-sm:calc(.5rem * var(--mantine-scale));--badge-padding-x-md:calc(.625rem * var(--mantine-scale));--badge-padding-x-lg:calc(.75rem * var(--mantine-scale));--badge-padding-x-xl:calc(1rem * var(--mantine-scale));--badge-height:var(--badge-height-md);--badge-fz:var(--badge-fz-md);--badge-padding-x:var(--badge-padding-x-md);--badge-radius:calc(62.5rem * var(--mantine-scale));--badge-lh:calc(var(--badge-height) - calc(.125rem * var(--mantine-scale)));--badge-color:var(--mantine-color-white);--badge-bg:var(--mantine-primary-color-filled);--badge-border-width:calc(.0625rem * var(--mantine-scale));--badge-bd:var(--badge-border-width) solid transparent;-webkit-tap-highlight-color:transparent;font-size:var(--badge-fz);border-radius:var(--badge-radius);height:var(--badge-height);line-height:var(--badge-lh);padding:0 var(--badge-padding-x);text-transform:uppercase;width:fit-content;font-weight:var(--mantine-font-weight-bold);letter-spacing:calc(.015625rem * var(--mantine-scale));cursor:default;text-overflow:ellipsis;color:var(--badge-color);background:var(--badge-bg);border:var(--badge-bd);justify-content:center;align-items:center;text-decoration:none;display:inline-grid;overflow:hidden}.m_347db0ec:where([data-with-left-section],[data-variant=dot]){grid-template-columns:auto 1fr}.m_347db0ec:where([data-with-right-section]){grid-template-columns:1fr auto}.m_347db0ec:where([data-with-left-section][data-with-right-section],[data-variant=dot][data-with-right-section]){grid-template-columns:auto 1fr auto}.m_347db0ec:where([data-block]){width:100%;display:flex}.m_347db0ec:where([data-circle]){padding-inline:calc(.125rem * var(--mantine-scale));width:var(--badge-height);display:flex}.m_fbd81e3d{--badge-dot-size:calc(var(--badge-height) / 3.4)}:where([data-mantine-color-scheme=light]) .m_fbd81e3d{background-color:var(--mantine-color-white);border-color:var(--mantine-color-gray-4);color:var(--mantine-color-black)}:where([data-mantine-color-scheme=dark]) .m_fbd81e3d{background-color:var(--mantine-color-dark-5);border-color:var(--mantine-color-dark-5);color:var(--mantine-color-white)}.m_fbd81e3d:before{content:"";width:var(--badge-dot-size);height:var(--badge-dot-size);border-radius:var(--badge-dot-size);background-color:var(--badge-dot-color);margin-inline-end:var(--badge-dot-size);display:block}.m_5add502a{white-space:nowrap;text-overflow:ellipsis;text-align:center;cursor:inherit;overflow:hidden}.m_91fdda9b{--badge-section-margin:calc(var(--mantine-spacing-xs) / 2);max-height:calc(var(--badge-height) - var(--badge-border-width) * 2);justify-content:center;align-items:center;display:inline-flex}.m_91fdda9b:where([data-position=left]){margin-inline-end:var(--badge-section-margin)}.m_91fdda9b:where([data-position=right]){margin-inline-start:var(--badge-section-margin)}.m_ddec01c0{--blockquote-border:3px solid var(--bq-bd);border-inline-start:var(--blockquote-border);padding:var(--mantine-spacing-xl) calc(2.375rem * var(--mantine-scale));border-start-end-radius:var(--bq-radius);border-end-end-radius:var(--bq-radius);margin:0;position:relative}:where([data-mantine-color-scheme=light]) .m_ddec01c0{background-color:var(--bq-bg-light)}:where([data-mantine-color-scheme=dark]) .m_ddec01c0{background-color:var(--bq-bg-dark)}.m_dde7bd57{--blockquote-icon-offset:calc(var(--bq-icon-size) / -2);color:var(--bq-bd);background-color:var(--mantine-color-body);top:var(--blockquote-icon-offset);width:var(--bq-icon-size);height:var(--bq-icon-size);border-radius:var(--bq-icon-size);justify-content:center;align-items:center;display:flex;position:absolute;inset-inline-start:var(--blockquote-icon-offset)}.m_dde51a35{margin-top:var(--mantine-spacing-md);opacity:.6;font-size:85%;display:block}.m_8b3717df{flex-wrap:wrap;align-items:center;display:flex}.m_f678d540{white-space:nowrap;-webkit-tap-highlight-color:transparent;line-height:1}.m_3b8f2208{margin-inline:var(--bc-separator-margin,var(--mantine-spacing-xs));justify-content:center;align-items:center;line-height:1;display:flex}:where([data-mantine-color-scheme=light]) .m_3b8f2208{color:var(--mantine-color-gray-7)}:where([data-mantine-color-scheme=dark]) .m_3b8f2208{color:var(--mantine-color-dark-2)}.m_fea6bf1a{--burger-size-xs:calc(.75rem * var(--mantine-scale));--burger-size-sm:calc(1.125rem * var(--mantine-scale));--burger-size-md:calc(1.5rem * var(--mantine-scale));--burger-size-lg:calc(2.125rem * var(--mantine-scale));--burger-size-xl:calc(2.625rem * var(--mantine-scale));--burger-size:var(--burger-size-md);--burger-line-size:calc(var(--burger-size) / 12);width:calc(var(--burger-size) + var(--mantine-spacing-xs));height:calc(var(--burger-size) + var(--mantine-spacing-xs));padding:calc(var(--mantine-spacing-xs) / 2);cursor:pointer}:where([data-mantine-color-scheme=light]) .m_fea6bf1a{--burger-color:var(--mantine-color-black)}:where([data-mantine-color-scheme=dark]) .m_fea6bf1a{--burger-color:var(--mantine-color-white)}.m_d4fb9cad{-webkit-user-select:none;user-select:none;position:relative}.m_d4fb9cad,.m_d4fb9cad:before,.m_d4fb9cad:after{width:var(--burger-size);height:var(--burger-line-size);background-color:var(--burger-color);outline:calc(.0625rem * var(--mantine-scale)) solid transparent;transition-property:background-color,transform;transition-duration:var(--burger-transition-duration,.3s);transition-timing-function:var(--burger-transition-timing-function,ease);display:block}.m_d4fb9cad:before,.m_d4fb9cad:after{content:"";position:absolute;inset-inline-start:0}.m_d4fb9cad:before{top:calc(var(--burger-size) / -3)}.m_d4fb9cad:after{top:calc(var(--burger-size) / 3)}.m_d4fb9cad[data-opened]{background-color:#0000}.m_d4fb9cad[data-opened]:before{transform:translateY(calc(var(--burger-size) / 3)) rotate(45deg)}.m_d4fb9cad[data-opened]:after{transform:translateY(calc(var(--burger-size) / -3)) rotate(-45deg)}.m_77c9d27d{--button-height-xs:calc(1.875rem * var(--mantine-scale));--button-height-sm:calc(2.25rem * var(--mantine-scale));--button-height-md:calc(2.625rem * var(--mantine-scale));--button-height-lg:calc(3.125rem * var(--mantine-scale));--button-height-xl:calc(3.75rem * var(--mantine-scale));--button-height-compact-xs:calc(1.375rem * var(--mantine-scale));--button-height-compact-sm:calc(1.625rem * var(--mantine-scale));--button-height-compact-md:calc(1.875rem * var(--mantine-scale));--button-height-compact-lg:calc(2.125rem * var(--mantine-scale));--button-height-compact-xl:calc(2.5rem * var(--mantine-scale));--button-padding-x-xs:calc(.875rem * var(--mantine-scale));--button-padding-x-sm:calc(1.125rem * var(--mantine-scale));--button-padding-x-md:calc(1.375rem * var(--mantine-scale));--button-padding-x-lg:calc(1.625rem * var(--mantine-scale));--button-padding-x-xl:calc(2rem * var(--mantine-scale));--button-padding-x-compact-xs:calc(.4375rem * var(--mantine-scale));--button-padding-x-compact-sm:calc(.5rem * var(--mantine-scale));--button-padding-x-compact-md:calc(.625rem * var(--mantine-scale));--button-padding-x-compact-lg:calc(.75rem * var(--mantine-scale));--button-padding-x-compact-xl:calc(.875rem * var(--mantine-scale));--button-height:var(--button-height-sm);--button-padding-x:var(--button-padding-x-sm);--button-color:var(--mantine-color-white);-webkit-user-select:none;user-select:none;font-weight:var(--mantine-font-weight-medium);text-align:center;cursor:pointer;border-radius:var(--button-radius,var(--mantine-radius-default));width:auto;line-height:1;font-size:var(--button-fz,var(--mantine-font-size-sm));background:var(--button-bg,var(--mantine-primary-color-filled));border:var(--button-bd,calc(.0625rem * var(--mantine-scale)) solid transparent);color:var(--button-color,var(--mantine-color-white));height:var(--button-height,var(--button-height-sm));padding-inline:var(--button-padding-x,var(--button-padding-x-sm));vertical-align:middle;display:inline-block;position:relative;overflow:hidden}.m_77c9d27d:where([data-block]){width:100%;display:block}.m_77c9d27d:where([data-with-left-section]){padding-inline-start:calc(var(--button-padding-x) / 1.5)}.m_77c9d27d:where([data-with-right-section]){padding-inline-end:calc(var(--button-padding-x) / 1.5)}.m_77c9d27d:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){cursor:not-allowed;border:calc(.0625rem * var(--mantine-scale)) solid transparent;color:var(--mantine-color-disabled-color);background:var(--mantine-color-disabled);transform:none}.m_77c9d27d:before{content:"";pointer-events:none;inset:calc(-.0625rem * var(--mantine-scale));border-radius:var(--button-radius,var(--mantine-radius-default));opacity:0;filter:blur(12px);transition:transform .15s,opacity .1s;position:absolute;transform:translateY(-100%)}:where([data-mantine-color-scheme=light]) .m_77c9d27d:before{background-color:#ffffff26}:where([data-mantine-color-scheme=dark]) .m_77c9d27d:before{background-color:#00000026}.m_77c9d27d:where([data-loading]){cursor:not-allowed;transform:none}.m_77c9d27d:where([data-loading]):before{opacity:1;transform:translateY(0)}.m_77c9d27d:where([data-loading]) .m_80f1301b{opacity:0;transform:translateY(100%)}@media (hover:hover){.m_77c9d27d:hover:where(:not([data-loading],:disabled,[data-disabled])){background-color:var(--button-hover,var(--mantine-primary-color-filled-hover));color:var(--button-hover-color,var(--button-color))}}@media (hover:none){.m_77c9d27d:active:where(:not([data-loading],:disabled,[data-disabled])){background-color:var(--button-hover,var(--mantine-primary-color-filled-hover));color:var(--button-hover-color,var(--button-color))}}.m_80f1301b{align-items:center;justify-content:var(--button-justify,center);height:100%;transition:transform .15s,opacity .1s;display:flex;overflow:visible}.m_811560b9{white-space:nowrap;opacity:1;text-box-trim:trim-both;text-box-edge:cap alphabetic;align-items:center;height:100%;display:flex;overflow:hidden}.m_811560b9:where([data-loading]){opacity:.2}.m_a74036a{align-items:center;display:flex}.m_a74036a:where([data-position=left]){margin-inline-end:var(--mantine-spacing-xs)}.m_a74036a:where([data-position=right]){margin-inline-start:var(--mantine-spacing-xs)}.m_a25b86ee{position:absolute;top:50%;left:50%}.m_80d6d844{--button-border-width:calc(.0625rem * var(--mantine-scale));display:flex}.m_80d6d844 :where(.m_77c9d27d):focus{z-index:1;position:relative}.m_80d6d844[data-orientation=horizontal]{flex-direction:row}.m_80d6d844[data-orientation=horizontal] .m_77c9d27d:not(:only-child):first-child,.m_80d6d844[data-orientation=horizontal] .m_70be2a01:not(:only-child):first-child{border-inline-end-width:calc(var(--button-border-width) / 2);border-start-end-radius:0;border-end-end-radius:0}.m_80d6d844[data-orientation=horizontal] .m_77c9d27d:not(:only-child):last-child,.m_80d6d844[data-orientation=horizontal] .m_70be2a01:not(:only-child):last-child{border-inline-start-width:calc(var(--button-border-width) / 2);border-start-start-radius:0;border-end-start-radius:0}.m_80d6d844[data-orientation=horizontal] .m_77c9d27d:not(:only-child):not(:first-child):not(:last-child),.m_80d6d844[data-orientation=horizontal] .m_70be2a01:not(:only-child):not(:first-child):not(:last-child){border-inline-width:calc(var(--button-border-width) / 2);border-radius:0}.m_80d6d844[data-orientation=vertical]{flex-direction:column}.m_80d6d844[data-orientation=vertical] .m_77c9d27d:not(:only-child):first-child,.m_80d6d844[data-orientation=vertical] .m_70be2a01:not(:only-child):first-child{border-bottom-width:calc(var(--button-border-width) / 2);border-end-end-radius:0;border-end-start-radius:0}.m_80d6d844[data-orientation=vertical] .m_77c9d27d:not(:only-child):last-child,.m_80d6d844[data-orientation=vertical] .m_70be2a01:not(:only-child):last-child{border-top-width:calc(var(--button-border-width) / 2);border-start-start-radius:0;border-start-end-radius:0}.m_80d6d844[data-orientation=vertical] .m_77c9d27d:not(:only-child):not(:first-child):not(:last-child),.m_80d6d844[data-orientation=vertical] .m_70be2a01:not(:only-child):not(:first-child):not(:last-child){border-bottom-width:calc(var(--button-border-width) / 2);border-top-width:calc(var(--button-border-width) / 2);border-radius:0}.m_70be2a01{--section-height-xs:calc(1.875rem * var(--mantine-scale));--section-height-sm:calc(2.25rem * var(--mantine-scale));--section-height-md:calc(2.625rem * var(--mantine-scale));--section-height-lg:calc(3.125rem * var(--mantine-scale));--section-height-xl:calc(3.75rem * var(--mantine-scale));--section-height-compact-xs:calc(1.375rem * var(--mantine-scale));--section-height-compact-sm:calc(1.625rem * var(--mantine-scale));--section-height-compact-md:calc(1.875rem * var(--mantine-scale));--section-height-compact-lg:calc(2.125rem * var(--mantine-scale));--section-height-compact-xl:calc(2.5rem * var(--mantine-scale));--section-padding-x-xs:calc(.875rem * var(--mantine-scale));--section-padding-x-sm:calc(1.125rem * var(--mantine-scale));--section-padding-x-md:calc(1.375rem * var(--mantine-scale));--section-padding-x-lg:calc(1.625rem * var(--mantine-scale));--section-padding-x-xl:calc(2rem * var(--mantine-scale));--section-padding-x-compact-xs:calc(.4375rem * var(--mantine-scale));--section-padding-x-compact-sm:calc(.5rem * var(--mantine-scale));--section-padding-x-compact-md:calc(.625rem * var(--mantine-scale));--section-padding-x-compact-lg:calc(.75rem * var(--mantine-scale));--section-padding-x-compact-xl:calc(.875rem * var(--mantine-scale));--section-height:var(--section-height-sm);--section-padding-x:var(--section-padding-x-sm);--section-color:var(--mantine-color-white);font-weight:var(--mantine-font-weight-medium);border-radius:var(--section-radius,var(--mantine-radius-default));width:auto;font-size:var(--section-fz,var(--mantine-font-size-sm));background:var(--section-bg,var(--mantine-primary-color-filled));border:var(--section-bd,calc(.0625rem * var(--mantine-scale)) solid transparent);color:var(--section-color,var(--mantine-color-white));height:var(--section-height,var(--section-height-sm));padding-inline:var(--section-padding-x,var(--section-padding-x-sm));vertical-align:middle;justify-content:center;align-items:center;line-height:1;display:inline-flex}.m_e615b15f{--card-padding:var(--mantine-spacing-md);padding:var(--card-padding);color:var(--mantine-color-text);display:flex;position:relative;overflow:hidden}.m_e615b15f:where([data-orientation=horizontal]){flex-direction:row}.m_e615b15f:where([data-orientation=vertical]){flex-direction:column}:where([data-mantine-color-scheme=light]) .m_e615b15f{background-color:var(--mantine-color-white)}:where([data-mantine-color-scheme=dark]) .m_e615b15f{background-color:var(--mantine-color-dark-6)}.m_599a2148{margin-inline:calc(var(--card-padding) * -1);display:block}:where([data-mantine-color-scheme=light]) .m_599a2148{--border-color:var(--mantine-color-gray-3)}:where([data-mantine-color-scheme=dark]) .m_599a2148{--border-color:var(--mantine-color-dark-4)}.m_599a2148:where([data-orientation=vertical]):first-child{margin-top:calc(var(--card-padding) * -1);border-top:none!important}.m_599a2148:where([data-orientation=vertical]):last-child{margin-bottom:calc(var(--card-padding) * -1);border-bottom:none!important}.m_599a2148:where([data-orientation=vertical])[data-inherit-padding]{padding-inline:var(--card-padding)}.m_599a2148:where([data-orientation=vertical])[data-with-border]{border-top:1px solid var(--border-color);border-bottom:1px solid var(--border-color)}.m_599a2148:where([data-orientation=vertical])+.m_599a2148:where([data-orientation=vertical]){border-top:none!important}.m_599a2148:where([data-orientation=horizontal]){margin-block:calc(var(--card-padding) * -1);margin-inline:0}.m_599a2148:where([data-orientation=horizontal]):first-child{margin-inline-start:calc(var(--card-padding) * -1);border-inline-start:none!important}.m_599a2148:where([data-orientation=horizontal]):last-child{margin-inline-end:calc(var(--card-padding) * -1);border-inline-end:none!important}.m_599a2148:where([data-orientation=horizontal])[data-inherit-padding]{padding-block:var(--card-padding)}.m_599a2148:where([data-orientation=horizontal])[data-with-border]{border-inline-start:1px solid var(--border-color);border-inline-end:1px solid var(--border-color)}.m_599a2148:where([data-orientation=horizontal])+.m_599a2148:where([data-orientation=horizontal]){border-inline-start:none!important}.m_4451eb3a{justify-content:center;align-items:center;display:flex}.m_4451eb3a:where([data-inline]){display:inline-flex}.m_f59ffda3{--chip-size-xs:calc(1.4375rem * var(--mantine-scale));--chip-size-sm:calc(1.75rem * var(--mantine-scale));--chip-size-md:calc(2rem * var(--mantine-scale));--chip-size-lg:calc(2.25rem * var(--mantine-scale));--chip-size-xl:calc(2.5rem * var(--mantine-scale));--chip-icon-size-xs:calc(.5625rem * var(--mantine-scale));--chip-icon-size-sm:calc(.75rem * var(--mantine-scale));--chip-icon-size-md:calc(.875rem * var(--mantine-scale));--chip-icon-size-lg:calc(1rem * var(--mantine-scale));--chip-icon-size-xl:calc(1.125rem * var(--mantine-scale));--chip-padding-xs:calc(1rem * var(--mantine-scale));--chip-padding-sm:calc(1.25rem * var(--mantine-scale));--chip-padding-md:calc(1.5rem * var(--mantine-scale));--chip-padding-lg:calc(1.75rem * var(--mantine-scale));--chip-padding-xl:calc(2rem * var(--mantine-scale));--chip-checked-padding-xs:calc(.5125rem * var(--mantine-scale));--chip-checked-padding-sm:calc(.625rem * var(--mantine-scale));--chip-checked-padding-md:calc(.73125rem * var(--mantine-scale));--chip-checked-padding-lg:calc(.84375rem * var(--mantine-scale));--chip-checked-padding-xl:calc(.98125rem * var(--mantine-scale));--chip-spacing-xs:calc(.625rem * var(--mantine-scale));--chip-spacing-sm:calc(.75rem * var(--mantine-scale));--chip-spacing-md:calc(1rem * var(--mantine-scale));--chip-spacing-lg:calc(1.25rem * var(--mantine-scale));--chip-spacing-xl:calc(1.375rem * var(--mantine-scale));--chip-size:var(--chip-size-sm);--chip-icon-size:var(--chip-icon-size-sm);--chip-padding:var(--chip-padding-sm);--chip-spacing:var(--chip-spacing-sm);--chip-checked-padding:var(--chip-checked-padding-sm);--chip-bg:var(--mantine-primary-color-filled);--chip-hover:var(--mantine-primary-color-filled-hover);--chip-color:var(--mantine-color-white);--chip-bd:calc(.0625rem * var(--mantine-scale)) solid transparent}.m_be049a53{-webkit-user-select:none;user-select:none;border-radius:var(--chip-radius,1000rem);height:var(--chip-size);font-size:var(--chip-fz,var(--mantine-font-size-sm));line-height:calc(var(--chip-size) - calc(.125rem * var(--mantine-scale)));padding-inline:var(--chip-padding);cursor:pointer;white-space:nowrap;-webkit-tap-highlight-color:transparent;border:calc(.0625rem * var(--mantine-scale)) solid transparent;color:var(--mantine-color-text);text-box-trim:trim-both;text-box-edge:cap alphabetic;align-items:center;display:inline-flex}.m_be049a53:where([data-checked]){padding-inline:var(--chip-checked-padding)}.m_be049a53:where([data-disabled]){cursor:not-allowed;background-color:var(--mantine-color-disabled);color:var(--mantine-color-disabled-color)}:where([data-mantine-color-scheme=light]) .m_3904c1af:not([data-disabled]){background-color:var(--mantine-color-white);border:1px solid var(--mantine-color-gray-3)}:where([data-mantine-color-scheme=dark]) .m_3904c1af:not([data-disabled]){background-color:var(--mantine-color-dark-6);border:1px solid var(--mantine-color-dark-4)}@media (hover:hover){:where([data-mantine-color-scheme=light]) .m_3904c1af:not([data-disabled]):hover{background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_3904c1af:not([data-disabled]):hover{background-color:var(--mantine-color-dark-5)}}@media (hover:none){:where([data-mantine-color-scheme=light]) .m_3904c1af:not([data-disabled]):active{background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_3904c1af:not([data-disabled]):active{background-color:var(--mantine-color-dark-5)}}.m_3904c1af:not([data-disabled]):where([data-checked]){--chip-icon-color:var(--chip-color);border:var(--chip-bd)}@media (hover:hover){.m_3904c1af:not([data-disabled]):where([data-checked]):hover{background-color:var(--chip-hover)}}@media (hover:none){.m_3904c1af:not([data-disabled]):where([data-checked]):active{background-color:var(--chip-hover)}}.m_fa109255:not([data-disabled]),.m_f7e165c3:not([data-disabled]){border:calc(.0625rem * var(--mantine-scale)) solid transparent;color:var(--mantine-color-text)}:where([data-mantine-color-scheme=light]) .m_fa109255:not([data-disabled]),:where([data-mantine-color-scheme=light]) .m_f7e165c3:not([data-disabled]){background-color:var(--mantine-color-gray-1)}:where([data-mantine-color-scheme=dark]) .m_fa109255:not([data-disabled]),:where([data-mantine-color-scheme=dark]) .m_f7e165c3:not([data-disabled]){background-color:var(--mantine-color-dark-5)}@media (hover:hover){:where([data-mantine-color-scheme=light]) .m_fa109255:not([data-disabled]):hover,:where([data-mantine-color-scheme=light]) .m_f7e165c3:not([data-disabled]):hover{background-color:var(--mantine-color-gray-2)}:where([data-mantine-color-scheme=dark]) .m_fa109255:not([data-disabled]):hover,:where([data-mantine-color-scheme=dark]) .m_f7e165c3:not([data-disabled]):hover{background-color:var(--mantine-color-dark-4)}}@media (hover:none){:where([data-mantine-color-scheme=light]) .m_fa109255:not([data-disabled]):active,:where([data-mantine-color-scheme=light]) .m_f7e165c3:not([data-disabled]):active{background-color:var(--mantine-color-gray-2)}:where([data-mantine-color-scheme=dark]) .m_fa109255:not([data-disabled]):active,:where([data-mantine-color-scheme=dark]) .m_f7e165c3:not([data-disabled]):active{background-color:var(--mantine-color-dark-4)}}.m_fa109255:not([data-disabled]):where([data-checked]),.m_f7e165c3:not([data-disabled]):where([data-checked]){--chip-icon-color:var(--chip-color);color:var(--chip-color);background-color:var(--chip-bg)}@media (hover:hover){.m_fa109255:not([data-disabled]):where([data-checked]):hover,.m_f7e165c3:not([data-disabled]):where([data-checked]):hover{background-color:var(--chip-hover)}}@media (hover:none){.m_fa109255:not([data-disabled]):where([data-checked]):active,.m_f7e165c3:not([data-disabled]):where([data-checked]):active{background-color:var(--chip-hover)}}.m_9ac86df9{width:calc(var(--chip-icon-size) + (var(--chip-spacing) / 1.5));max-width:calc(var(--chip-icon-size) + (var(--chip-spacing) / 1.5));height:var(--chip-icon-size);align-items:center;display:flex;overflow:hidden}.m_d6d72580{width:var(--chip-icon-size);height:var(--chip-icon-size);color:var(--chip-icon-color,inherit);display:block}.m_bde07329{opacity:0;width:0;height:0;margin:0;padding:0}.m_bde07329:focus-visible+.m_be049a53{outline:2px solid var(--mantine-primary-color-filled);outline-offset:calc(.125rem * var(--mantine-scale))}.m_b183c0a2{font-family:var(--mantine-font-family-monospace);line-height:var(--mantine-line-height);padding:2px calc(var(--mantine-spacing-xs) / 2);border-radius:var(--mantine-radius-sm);font-size:var(--mantine-font-size-xs);margin:0;overflow:auto}:where([data-mantine-color-scheme=light]) .m_b183c0a2{background-color:var(--code-bg,var(--mantine-color-gray-0))}:where([data-mantine-color-scheme=dark]) .m_b183c0a2{background-color:var(--code-bg,var(--mantine-color-dark-6))}.m_b183c0a2[data-block]{padding:var(--mantine-spacing-xs)}.m_de3d2490{--cs-size:calc(1.75rem * var(--mantine-scale));--cs-radius:calc(62.5rem * var(--mantine-scale));-webkit-tap-highlight-color:transparent;appearance:none;width:var(--cs-size);height:var(--cs-size);min-width:var(--cs-size);min-height:var(--cs-size);border-radius:var(--cs-radius);color:inherit;border:none;line-height:1;text-decoration:none;display:block;position:relative}[data-mantine-color-scheme=light] .m_de3d2490{--alpha-overlay-color:var(--mantine-color-gray-3);--alpha-overlay-bg:var(--mantine-color-white)}[data-mantine-color-scheme=dark] .m_de3d2490{--alpha-overlay-color:var(--mantine-color-dark-4);--alpha-overlay-bg:var(--mantine-color-dark-7)}.m_862f3d1b{border-radius:var(--cs-radius);position:absolute;inset:0}.m_98ae7f22{border-radius:var(--cs-radius);z-index:1;box-shadow:#0000001a 0 0 0 calc(.0625rem * var(--mantine-scale)) inset, #00000026 0 0 calc(.25rem * var(--mantine-scale)) inset;position:absolute;inset:0}.m_95709ac0{border-radius:var(--cs-radius);background-size:calc(.5rem * var(--mantine-scale)) calc(.5rem * var(--mantine-scale));background-position:0 0, 0 calc(.25rem * var(--mantine-scale)), calc(.25rem * var(--mantine-scale)) calc(-.25rem * var(--mantine-scale)), calc(-.25rem * var(--mantine-scale)) 0;background-image:linear-gradient(45deg, var(--alpha-overlay-color) 25%, transparent 25%), linear-gradient(-45deg, var(--alpha-overlay-color) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--alpha-overlay-color) 75%), linear-gradient(-45deg, var(--alpha-overlay-bg) 75%, var(--alpha-overlay-color) 75%);position:absolute;inset:0}.m_93e74e3{border-radius:var(--cs-radius);z-index:2;justify-content:center;align-items:center;display:flex;position:absolute;inset:0}.m_fee9c77{--cp-width-xs:calc(11.25rem * var(--mantine-scale));--cp-width-sm:calc(12.5rem * var(--mantine-scale));--cp-width-md:calc(15rem * var(--mantine-scale));--cp-width-lg:calc(17.5rem * var(--mantine-scale));--cp-width-xl:calc(20rem * var(--mantine-scale));--cp-preview-size-xs:calc(1.625rem * var(--mantine-scale));--cp-preview-size-sm:calc(2.125rem * var(--mantine-scale));--cp-preview-size-md:calc(2.625rem * var(--mantine-scale));--cp-preview-size-lg:calc(3.125rem * var(--mantine-scale));--cp-preview-size-xl:calc(3.375rem * var(--mantine-scale));--cp-thumb-size-xs:calc(.5rem * var(--mantine-scale));--cp-thumb-size-sm:calc(.75rem * var(--mantine-scale));--cp-thumb-size-md:calc(1rem * var(--mantine-scale));--cp-thumb-size-lg:calc(1.25rem * var(--mantine-scale));--cp-thumb-size-xl:calc(1.375rem * var(--mantine-scale));--cp-saturation-height-xs:calc(6.25rem * var(--mantine-scale));--cp-saturation-height-sm:calc(6.875rem * var(--mantine-scale));--cp-saturation-height-md:calc(7.5rem * var(--mantine-scale));--cp-saturation-height-lg:calc(8.75rem * var(--mantine-scale));--cp-saturation-height-xl:calc(10rem * var(--mantine-scale));--cp-preview-size:var(--cp-preview-size-sm);--cp-thumb-size:var(--cp-thumb-size-sm);--cp-saturation-height:var(--cp-saturation-height-sm);--cp-width:var(--cp-width-sm);--cp-body-spacing:var(--mantine-spacing-sm);width:var(--cp-width);padding:calc(.0625rem * var(--mantine-scale))}.m_fee9c77:where([data-full-width]){width:100%}.m_9dddfbac{width:var(--cp-preview-size);height:var(--cp-preview-size)}.m_bffecc3e{padding-top:calc(var(--cp-body-spacing) / 2);display:flex}.m_3283bb96{flex:1}.m_3283bb96:not(:only-child){margin-inline-end:var(--mantine-spacing-xs)}.m_40d572ba{border:2px solid var(--mantine-color-white);width:var(--cp-thumb-size);height:var(--cp-thumb-size);border-radius:var(--cp-thumb-size);left:calc(var(--thumb-x-offset) - var(--cp-thumb-size) / 2);top:calc(var(--thumb-y-offset) - var(--cp-thumb-size) / 2);position:absolute;overflow:hidden;box-shadow:0 0 1px #0009}.m_d8ee6fd8{margin:calc(.125rem * var(--mantine-scale));cursor:pointer;padding-bottom:calc(var(--cp-swatch-size) - calc(.25rem * var(--mantine-scale)));flex:0 0 calc(var(--cp-swatch-size) - calc(.25rem * var(--mantine-scale)));height:unset!important;width:unset!important;min-width:0!important;min-height:0!important}.m_5711e686{margin-top:calc(.3125rem * var(--mantine-scale));margin-inline:calc(-.125rem * var(--mantine-scale));flex-wrap:wrap;display:flex}.m_5711e686:only-child{margin-top:0}.m_202a296e{--cp-thumb-size-xs:calc(.5rem * var(--mantine-scale));--cp-thumb-size-sm:calc(.75rem * var(--mantine-scale));--cp-thumb-size-md:calc(1rem * var(--mantine-scale));--cp-thumb-size-lg:calc(1.25rem * var(--mantine-scale));--cp-thumb-size-xl:calc(1.375rem * var(--mantine-scale));-webkit-tap-highlight-color:transparent;height:var(--cp-saturation-height);border-radius:var(--mantine-radius-sm);margin:calc(var(--cp-thumb-size) / 2);position:relative}.m_202a296e:where([data-focus-ring=auto]):focus:focus-visible .m_40d572ba,.m_202a296e:where([data-focus-ring=always]):focus .m_40d572ba{outline:2px solid var(--mantine-color-blue-filled)}.m_11b3db02{border-radius:var(--mantine-radius-sm);inset:calc(var(--cp-thumb-size) * -1 / 2 - calc(.0625rem * var(--mantine-scale)));position:absolute}.m_d856d47d{--cp-thumb-size-xs:calc(.5rem * var(--mantine-scale));--cp-thumb-size-sm:calc(.75rem * var(--mantine-scale));--cp-thumb-size-md:calc(1rem * var(--mantine-scale));--cp-thumb-size-lg:calc(1.25rem * var(--mantine-scale));--cp-thumb-size-xl:calc(1.375rem * var(--mantine-scale));--cp-thumb-size:var(--cp-thumb-size,calc(.75rem * var(--mantine-scale)));height:calc(var(--cp-thumb-size) + calc(.125rem * var(--mantine-scale)));margin-inline:calc(var(--cp-thumb-size) / 2);outline:none;position:relative}.m_d856d47d+.m_d856d47d{margin-top:calc(.375rem * var(--mantine-scale))}.m_d856d47d:where([data-focus-ring=auto]):focus:focus-visible .m_40d572ba,.m_d856d47d:where([data-focus-ring=always]):focus .m_40d572ba{outline:2px solid var(--mantine-color-blue-filled)}:where([data-mantine-color-scheme=light]) .m_d856d47d{--slider-checkers:var(--mantine-color-gray-3)}:where([data-mantine-color-scheme=dark]) .m_d856d47d{--slider-checkers:var(--mantine-color-dark-4)}.m_8f327113{top:0;bottom:0;inset-inline:calc(var(--cp-thumb-size) * -1 / 2 - calc(.0625rem * var(--mantine-scale)));border-radius:10000rem;position:absolute}.m_b077c2bc{--ci-eye-dropper-icon-size-xs:calc(.875rem * var(--mantine-scale));--ci-eye-dropper-icon-size-sm:calc(1rem * var(--mantine-scale));--ci-eye-dropper-icon-size-md:calc(1.125rem * var(--mantine-scale));--ci-eye-dropper-icon-size-lg:calc(1.25rem * var(--mantine-scale));--ci-eye-dropper-icon-size-xl:calc(1.375rem * var(--mantine-scale));--ci-eye-dropper-icon-size:var(--ci-eye-dropper-icon-size-sm)}.m_66a028b5{--ci-button-size-xs:calc(1.375rem * var(--mantine-scale));--ci-button-size-sm:calc(1.625rem * var(--mantine-scale));--ci-button-size-md:calc(1.75rem * var(--mantine-scale));--ci-button-size-lg:calc(2rem * var(--mantine-scale));--ci-button-size-xl:calc(2.5rem * var(--mantine-scale));--ci-button-size:var(--ci-button-size-sm);width:var(--ci-button-size);height:var(--ci-button-size);min-width:var(--ci-button-size);min-height:var(--ci-button-size)}.m_c5ccdcab{--ci-preview-size-xs:calc(1rem * var(--mantine-scale));--ci-preview-size-sm:calc(1.125rem * var(--mantine-scale));--ci-preview-size-md:calc(1.375rem * var(--mantine-scale));--ci-preview-size-lg:calc(1.75rem * var(--mantine-scale));--ci-preview-size-xl:calc(2.25rem * var(--mantine-scale));--ci-preview-size:var(--ci-preview-size-sm)}.m_5ece2cd7{padding:calc(.5rem * var(--mantine-scale))}.m_7485cace{--container-size-xs:calc(33.75rem * var(--mantine-scale));--container-size-sm:calc(45rem * var(--mantine-scale));--container-size-md:calc(60rem * var(--mantine-scale));--container-size-lg:calc(71.25rem * var(--mantine-scale));--container-size-xl:calc(82.5rem * var(--mantine-scale));--container-size:var(--container-size-md)}.m_7485cace:where([data-strategy=block]){max-width:var(--container-size);padding-inline:var(--mantine-spacing-md);margin-inline:auto}.m_7485cace:where([data-strategy=block]):where([data-fluid]){max-width:100%}.m_7485cace:where([data-strategy=grid]){grid-template-columns:1fr min(100%, var(--container-size)) 1fr;margin-inline:auto;display:grid}.m_7485cace:where([data-strategy=grid])>*{grid-column:2}.m_7485cace:where([data-strategy=grid])>[data-breakout]{grid-column:1/-1}.m_7485cace:where([data-strategy=grid])>[data-breakout]>[data-container]{max-width:var(--container-size);margin-inline:auto}.m_e2125a27{--dialog-size-xs:calc(10rem * var(--mantine-scale));--dialog-size-sm:calc(12.5rem * var(--mantine-scale));--dialog-size-md:calc(21.25rem * var(--mantine-scale));--dialog-size-lg:calc(25rem * var(--mantine-scale));--dialog-size-xl:calc(31.25rem * var(--mantine-scale));--dialog-size:var(--dialog-size-md);width:var(--dialog-size);max-width:calc(100vw - var(--mantine-spacing-xl) * 2);min-height:calc(3.125rem * var(--mantine-scale));position:relative}.m_5abab665{top:calc(var(--mantine-spacing-md) / 2);position:absolute;inset-inline-end:calc(var(--mantine-spacing-md) / 2)}.m_3eebeb36{--divider-size-xs:calc(.0625rem * var(--mantine-scale));--divider-size-sm:calc(.125rem * var(--mantine-scale));--divider-size-md:calc(.1875rem * var(--mantine-scale));--divider-size-lg:calc(.25rem * var(--mantine-scale));--divider-size-xl:calc(.3125rem * var(--mantine-scale));--divider-size:var(--divider-size-xs)}:where([data-mantine-color-scheme=light]) .m_3eebeb36{--divider-color:var(--mantine-color-gray-3)}:where([data-mantine-color-scheme=dark]) .m_3eebeb36{--divider-color:var(--mantine-color-dark-4)}.m_3eebeb36:where([data-orientation=horizontal]){border-top:var(--divider-size) var(--divider-border-style,solid) var(--divider-color)}.m_3eebeb36:where([data-orientation=vertical]){border-inline-start:var(--divider-size) var(--divider-border-style,solid) var(--divider-color);align-self:stretch;height:auto}.m_3eebeb36:where([data-with-label]){border:0}.m_9e365f20{font-size:var(--mantine-font-size-xs);color:var(--mantine-color-dimmed);white-space:nowrap;align-items:center;display:flex}.m_9e365f20:where([data-position=left]):before,.m_9e365f20:where([data-position=right]):after{display:none}.m_9e365f20:before{content:"";height:calc(.0625rem * var(--mantine-scale));border-top:var(--divider-size) var(--divider-border-style,solid) var(--divider-color);flex:1;margin-inline-end:var(--mantine-spacing-xs)}.m_9e365f20:after{content:"";height:calc(.0625rem * var(--mantine-scale));border-top:var(--divider-size) var(--divider-border-style,solid) var(--divider-color);flex:1;margin-inline-start:var(--mantine-spacing-xs)}.m_f11b401e{--drawer-size-xs:calc(20rem * var(--mantine-scale));--drawer-size-sm:calc(23.75rem * var(--mantine-scale));--drawer-size-md:calc(27.5rem * var(--mantine-scale));--drawer-size-lg:calc(38.75rem * var(--mantine-scale));--drawer-size-xl:calc(48.75rem * var(--mantine-scale));--drawer-size:var(--drawer-size-md);--drawer-offset:0rem}.m_5a7c2c9{z-index:1000}.m_b8a05bbd{flex:var(--drawer-flex,0 0 var(--drawer-size));height:var(--drawer-height,calc(100% - var(--drawer-offset) * 2));margin:var(--drawer-offset);max-width:calc(100% - var(--drawer-offset) * 2);max-height:calc(100% - var(--drawer-offset) * 2);overflow-y:auto}.m_b8a05bbd[data-hidden]{pointer-events:none;opacity:0!important}.m_31cd769a{justify-content:var(--drawer-justify,flex-start);align-items:var(--drawer-align,flex-start);display:flex}.m_e9408a47{padding:var(--mantine-spacing-lg);padding-top:var(--mantine-spacing-xs);border-radius:var(--fieldset-radius,var(--mantine-radius-default));min-inline-size:auto}.m_84c9523a{border:calc(.0625rem * var(--mantine-scale)) solid}:where([data-mantine-color-scheme=light]) .m_84c9523a{border-color:var(--mantine-color-gray-3);background-color:var(--mantine-color-white)}:where([data-mantine-color-scheme=dark]) .m_84c9523a{border-color:var(--mantine-color-dark-4);background-color:var(--mantine-color-dark-7)}.m_ef274e49{border:calc(.0625rem * var(--mantine-scale)) solid}:where([data-mantine-color-scheme=light]) .m_ef274e49{border-color:var(--mantine-color-gray-3);background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_ef274e49{border-color:var(--mantine-color-dark-4);background-color:var(--mantine-color-dark-6)}.m_eda993d3{border:0;border-radius:0;padding:0}.m_90794832{font-size:var(--mantine-font-size-sm)}.m_74ca27fe{margin-bottom:var(--mantine-spacing-sm);padding:0}.m_df020499{z-index:var(--floating-window-z-index);position:fixed}.m_8478a6da{container:mantine-grid/inline-size}.m_410352e9{--grid-overflow:visible;--grid-column-gap:var(--grid-gap);--grid-row-gap:var(--grid-gap);overflow:var(--grid-overflow)}.m_dee7bd2f{justify-content:var(--grid-justify);align-items:var(--grid-align);gap:var(--grid-row-gap) var(--grid-column-gap);flex-wrap:wrap;display:flex}.m_96bdd299{--col-flex-grow:0;--col-offset:0rem;flex-shrink:0;order:var(--col-order);flex-basis:var(--col-flex-basis);width:var(--col-width);max-width:var(--col-max-width);flex-grow:var(--col-flex-grow);align-self:var(--col-align-self);margin-inline-start:var(--col-offset)}.m_bcb3f3c2{color:var(--mantine-color-black)}:where([data-mantine-color-scheme=light]) .m_bcb3f3c2{background-color:var(--mark-bg-light)}:where([data-mantine-color-scheme=dark]) .m_bcb3f3c2{background-color:var(--mark-bg-dark)}.m_9e117634{object-fit:var(--image-object-fit,cover);border-radius:var(--image-radius,0);width:100%;display:block}@keyframes m_885901b1{0%{opacity:.6;transform:scale(0)}to{opacity:0;transform:scale(2.8)}}.m_e5262200{--indicator-size:calc(.625rem * var(--mantine-scale));--indicator-color:var(--mantine-primary-color-filled);display:block;position:relative}.m_e5262200:where([data-inline]){display:inline-block}.m_760d1fb1{top:var(--indicator-top);left:var(--indicator-left);right:var(--indicator-right);bottom:var(--indicator-bottom);transform:translate(var(--indicator-translate-x), var(--indicator-translate-y));min-width:var(--indicator-size);height:var(--indicator-size);border-radius:var(--indicator-radius,1000rem);z-index:var(--indicator-z-index,200);font-size:var(--mantine-font-size-xs);background-color:var(--indicator-color);color:var(--indicator-text-color,var(--mantine-color-white));white-space:nowrap;justify-content:center;align-items:center;display:flex;position:absolute}.m_760d1fb1:before{content:"";background-color:var(--indicator-color);border-radius:var(--indicator-radius,1000rem);z-index:-1;position:absolute;inset:0}.m_760d1fb1:where([data-with-label]){padding-inline:calc(var(--mantine-spacing-xs) / 2)}.m_760d1fb1:where([data-with-border]){border:2px solid var(--mantine-color-body)}.m_760d1fb1[data-processing]:before{animation:1s linear infinite m_885901b1}.m_dc6f14e2{--kbd-fz-xs:calc(.625rem * var(--mantine-scale));--kbd-fz-sm:calc(.75rem * var(--mantine-scale));--kbd-fz-md:calc(.875rem * var(--mantine-scale));--kbd-fz-lg:calc(1rem * var(--mantine-scale));--kbd-fz-xl:calc(1.25rem * var(--mantine-scale));--kbd-fz:var(--kbd-fz-sm);font-family:var(--mantine-font-family-monospace);line-height:var(--mantine-line-height);font-weight:var(--mantine-font-weight-bold);font-size:var(--kbd-fz);border-radius:var(--mantine-radius-sm);border:calc(.0625rem * var(--mantine-scale)) solid;border-bottom-width:calc(.1875rem * var(--mantine-scale));text-align:center;unicode-bidi:embed;padding:.12em .45em}:where([data-mantine-color-scheme=light]) .m_dc6f14e2{border-color:var(--mantine-color-gray-3);color:var(--mantine-color-gray-7);background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_dc6f14e2{border-color:var(--mantine-color-dark-4);color:var(--mantine-color-dark-0);background-color:var(--mantine-color-dark-6)}.m_abbac491{--list-fz:var(--mantine-font-size-md);--list-lh:var(--mantine-line-height-md);--list-marker-gap:var(--mantine-spacing-lg);font-size:var(--list-fz);line-height:var(--list-lh);margin:0;padding:0;padding-inline-start:var(--list-marker-gap);list-style-position:outside}.m_abbac491[data-type=none]{--list-marker-gap:0}.m_abbac491:where([data-with-padding]){padding-inline-start:calc(var(--list-marker-gap) + var(--mantine-spacing-md))}.m_abb6bec2{white-space:normal;line-height:var(--list-lh)}.m_abb6bec2:where([data-with-icon]){list-style:none}.m_abb6bec2:where([data-with-icon]) .m_75cd9f71{--li-direction:row;--li-align:center}.m_abb6bec2:where(:not(:first-of-type)){margin-top:var(--list-spacing,0)}.m_abb6bec2:where([data-centered]){line-height:1}.m_75cd9f71{flex-direction:var(--li-direction,column);align-items:var(--li-align,flex-start);white-space:normal;display:inline-flex}.m_60f83e5b{vertical-align:middle;margin-inline-end:var(--mantine-spacing-sm);display:inline-block}.m_6e45937b{z-index:var(--lo-z-index);justify-content:center;align-items:center;display:flex;position:absolute;inset:0;overflow:hidden}.m_e8eb006c{z-index:calc(var(--lo-z-index) + 1);position:relative}.m_df587f17{z-index:var(--lo-z-index)}@keyframes m_55dc625a{0%{transform:translate(0)}to{transform:translateX(calc(-100% / var(--marquee-repeat,4) - var(--marquee-gap,var(--mantine-spacing-md)) / var(--marquee-repeat,4)))}}@keyframes m_cdef532c{0%{transform:translateY(0)}to{transform:translateY(calc(-100% / var(--marquee-repeat,4) - var(--marquee-gap,var(--mantine-spacing-md)) / var(--marquee-repeat,4)))}}.m_7dc7d3cd{--_fade-color:var(--marquee-fade-color,var(--mantine-color-body));--_fade-size:var(--marquee-fade-size,5%);max-width:100%;max-height:100%;display:flex;position:relative;overflow:hidden}.m_7dc7d3cd:where([data-orientation=horizontal]){flex-direction:row}.m_7dc7d3cd:where([data-orientation=vertical]){flex-direction:column}.m_7dc7d3cd[data-fade-edges]:before,.m_7dc7d3cd[data-fade-edges]:after{content:"";z-index:1;pointer-events:none;position:absolute}.m_7dc7d3cd[data-orientation=horizontal][data-fade-edges]:before,.m_7dc7d3cd[data-orientation=horizontal][data-fade-edges]:after{width:var(--_fade-size);top:0;bottom:0}.m_7dc7d3cd[data-orientation=horizontal][data-fade-edges]:before{background:linear-gradient(to right, var(--_fade-color), transparent);left:0}.m_7dc7d3cd[data-orientation=horizontal][data-fade-edges]:after{background:linear-gradient(to left, var(--_fade-color), transparent);right:0}.m_7dc7d3cd[data-orientation=vertical][data-fade-edges]:before,.m_7dc7d3cd[data-orientation=vertical][data-fade-edges]:after{height:var(--_fade-size);left:0;right:0}.m_7dc7d3cd[data-orientation=vertical][data-fade-edges]:before{background:linear-gradient(to bottom, var(--_fade-color), transparent);top:0}.m_7dc7d3cd[data-orientation=vertical][data-fade-edges]:after{background:linear-gradient(to top, var(--_fade-color), transparent);bottom:0}.m_1f9675ae{gap:var(--marquee-gap,var(--mantine-spacing-md));animation-duration:var(--marquee-duration,40s);animation-timing-function:linear;animation-iteration-count:infinite;display:flex}.m_7dc7d3cd[data-orientation=horizontal]>.m_1f9675ae{flex-direction:row;animation-name:m_55dc625a}.m_7dc7d3cd[data-orientation=vertical]>.m_1f9675ae{flex-direction:column;animation-name:m_cdef532c}.m_7dc7d3cd[data-reverse]>.m_1f9675ae{animation-direction:reverse}.m_7dc7d3cd[data-pause-on-hover]:hover>.m_1f9675ae{animation-play-state:paused}.m_3a9900f4{gap:var(--marquee-gap,var(--mantine-spacing-md));flex-shrink:0;display:flex}.m_7dc7d3cd[data-orientation=horizontal] .m_3a9900f4{flex-direction:row}.m_7dc7d3cd[data-orientation=vertical] .m_3a9900f4{flex-direction:column}.m_dc9b7c9f{padding:calc(.25rem * var(--mantine-scale))}.m_9bfac126{color:var(--mantine-color-dimmed);font-weight:var(--mantine-font-weight-medium);font-size:var(--mantine-font-size-xs);padding:calc(var(--mantine-spacing-xs) / 2) var(--mantine-spacing-sm);cursor:default}.m_efdf90cb{margin-top:calc(.25rem * var(--mantine-scale));margin-bottom:calc(.25rem * var(--mantine-scale));border-top:calc(.0625rem * var(--mantine-scale)) solid}:where([data-mantine-color-scheme=light]) .m_efdf90cb{border-color:var(--mantine-color-gray-2)}:where([data-mantine-color-scheme=dark]) .m_efdf90cb{border-color:var(--mantine-color-dark-4)}.m_99ac2aa1{font-size:var(--mantine-font-size-sm);width:100%;padding:calc(var(--mantine-spacing-xs) / 1.5) var(--mantine-spacing-sm);border-radius:var(--popover-radius,var(--mantine-radius-default));color:var(--menu-item-color,var(--mantine-color-text));-webkit-user-select:none;user-select:none;align-items:center;display:flex}.m_99ac2aa1:where([data-disabled],:disabled){color:var(--mantine-color-disabled-color);opacity:.6;cursor:not-allowed}:where([data-mantine-color-scheme=light]) .m_99ac2aa1:where(:hover,:focus):where(:not(:disabled,[data-disabled])){background-color:var(--menu-item-hover,var(--mantine-color-gray-1))}:where([data-mantine-color-scheme=dark]) .m_99ac2aa1:where(:hover,:focus):where(:not(:disabled,[data-disabled])){background-color:var(--menu-item-hover,var(--mantine-color-dark-4))}.m_99ac2aa1:where([data-sub-menu-item]){padding-inline-end:calc(.3125rem * var(--mantine-scale))}.m_5476e0d3{flex:1}.m_8b75e504{justify-content:center;align-items:center;display:flex}.m_8b75e504:where([data-position=left]){margin-inline-end:var(--mantine-spacing-xs)}.m_8b75e504:where([data-position=right]){margin-inline-start:var(--mantine-spacing-xs)}.m_b85b0bed{transform:rotate(-90deg)}:where([dir=rtl]) .m_b85b0bed{transform:rotate(90deg)}.m_9df02822{--modal-size-xs:calc(20rem * var(--mantine-scale));--modal-size-sm:calc(23.75rem * var(--mantine-scale));--modal-size-md:calc(27.5rem * var(--mantine-scale));--modal-size-lg:calc(38.75rem * var(--mantine-scale));--modal-size-xl:calc(48.75rem * var(--mantine-scale));--modal-size:var(--modal-size-md);--modal-y-offset:5dvh;--modal-x-offset:5vw}.m_9df02822[data-full-screen]{--modal-border-radius:0!important}.m_9df02822[data-full-screen] .m_54c44539{--modal-content-flex:0 0 100%;--modal-content-max-height:auto;--modal-content-height:100dvh}.m_9df02822[data-full-screen] .m_1f958f16{--modal-inner-y-offset:0;--modal-inner-x-offset:0}.m_9df02822[data-centered] .m_1f958f16{--modal-inner-align:center}.m_d0e2b9cd{border-start-start-radius:var(--modal-radius,var(--mantine-radius-default));border-start-end-radius:var(--modal-radius,var(--mantine-radius-default))}.m_54c44539{flex:var(--modal-content-flex,0 0 var(--modal-size));max-width:100%;max-height:var(--modal-content-max-height,calc(100dvh - var(--modal-y-offset) * 2));height:var(--modal-content-height,auto);overflow-y:auto}.m_54c44539[data-full-screen]{border-radius:0}.m_54c44539[data-hidden]{pointer-events:none;opacity:0!important}.m_1f958f16{justify-content:center;align-items:var(--modal-inner-align,flex-start);padding-top:var(--modal-inner-y-offset,var(--modal-y-offset));padding-bottom:var(--modal-inner-y-offset,var(--modal-y-offset));padding-inline:var(--modal-inner-x-offset,var(--modal-x-offset));display:flex}.m_7cda1cd6{--pill-fz-xs:calc(.625rem * var(--mantine-scale));--pill-fz-sm:calc(.75rem * var(--mantine-scale));--pill-fz-md:calc(.875rem * var(--mantine-scale));--pill-fz-lg:calc(1rem * var(--mantine-scale));--pill-fz-xl:calc(1.125rem * var(--mantine-scale));--pill-height-xs:calc(1.125rem * var(--mantine-scale));--pill-height-sm:calc(1.375rem * var(--mantine-scale));--pill-height-md:calc(1.5625rem * var(--mantine-scale));--pill-height-lg:calc(1.75rem * var(--mantine-scale));--pill-height-xl:calc(2rem * var(--mantine-scale));--pill-fz:var(--pill-fz-sm);--pill-height:var(--pill-height-sm);font-size:var(--pill-fz);height:var(--pill-height);border-radius:var(--pill-radius,1000rem);white-space:nowrap;-webkit-user-select:none;user-select:none;flex:0;align-items:center;max-width:100%;padding-inline:.8em;line-height:1;display:inline-flex}:where([data-mantine-color-scheme=dark]) .m_7cda1cd6{background-color:var(--mantine-color-dark-7);color:var(--mantine-color-dark-0)}:where([data-mantine-color-scheme=light]) .m_7cda1cd6{color:var(--mantine-color-black)}.m_7cda1cd6:where([data-with-remove]:not(:has(button:disabled))){padding-inline-end:0}.m_7cda1cd6:where([data-disabled],:has(button:disabled)){cursor:not-allowed}:where([data-mantine-color-scheme=light]) .m_44da308b{background-color:var(--mantine-color-gray-1)}:where([data-mantine-color-scheme=light]) .m_44da308b:where([data-disabled],:has(button:disabled)){background-color:var(--mantine-color-disabled)}:where([data-mantine-color-scheme=light]) .m_e3a01f8{background-color:var(--mantine-color-white)}:where([data-mantine-color-scheme=light]) .m_e3a01f8:where([data-disabled],:has(button:disabled)){background-color:var(--mantine-color-disabled)}.m_1e0e6180{cursor:inherit;text-overflow:ellipsis;text-box-trim:trim-both;text-box-edge:cap alphabetic;align-items:center;height:100%;display:flex;overflow:hidden}.m_ae386778{color:inherit;font-size:inherit;height:100%;min-height:unset;min-width:2em;width:unset;border-radius:0;border-start-end-radius:var(--pill-radius,50%);border-end-end-radius:var(--pill-radius,50%);flex:0;padding-inline:.1em .3em}.m_7cda1cd6[data-disabled]>.m_ae386778,.m_ae386778:disabled{cursor:not-allowed;background-color:#0000;width:.8em;min-width:.8em;padding:0;display:none}.m_7cda1cd6[data-disabled]>.m_ae386778>svg,.m_ae386778:disabled>svg{display:none}.m_ae386778>svg{pointer-events:none}.m_1dcfd90b{--pg-gap-xs:calc(.375rem * var(--mantine-scale));--pg-gap-sm:calc(.5rem * var(--mantine-scale));--pg-gap-md:calc(.625rem * var(--mantine-scale));--pg-gap-lg:calc(.75rem * var(--mantine-scale));--pg-gap-xl:calc(.75rem * var(--mantine-scale));--pg-gap:var(--pg-gap-sm);align-items:center;gap:var(--pg-gap);flex-wrap:wrap;display:flex}.m_45c4369d{appearance:none;min-width:calc(6.25rem * var(--mantine-scale));font-size:inherit;height:1.6em;color:inherit;background-color:#0000;border:0;flex:1;padding:0}.m_45c4369d::placeholder{color:var(--input-placeholder-color);opacity:1}.m_45c4369d:where([data-type=hidden],[data-type=auto]){height:calc(.0625rem * var(--mantine-scale));width:calc(.0625rem * var(--mantine-scale));pointer-events:none;opacity:0;position:absolute;top:0;left:0}.m_45c4369d:focus{outline:none}.m_45c4369d:where([data-type=auto]:focus){visibility:visible;opacity:1;height:1.6em;position:static}.m_45c4369d:where([data-pointer]:not([data-disabled],:disabled)){cursor:pointer}.m_45c4369d:where([data-disabled],:disabled){cursor:not-allowed}.m_f0824112{--nl-bg:var(--mantine-primary-color-light);--nl-hover:var(--mantine-primary-color-light-hover);--nl-color:var(--mantine-primary-color-light-color);width:100%;padding:8px var(--mantine-spacing-sm);-webkit-user-select:none;user-select:none;align-items:center;display:flex}@media (hover:hover){:where([data-mantine-color-scheme=light]) .m_f0824112:hover{background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_f0824112:hover{background-color:var(--mantine-color-dark-6)}}@media (hover:none){:where([data-mantine-color-scheme=light]) .m_f0824112:active{background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_f0824112:active{background-color:var(--mantine-color-dark-6)}}.m_f0824112:where([data-disabled]){opacity:.4;pointer-events:none}.m_f0824112:where([data-active],[aria-current=page]){background-color:var(--nl-bg);color:var(--nl-color)}@media (hover:hover){.m_f0824112:where([data-active],[aria-current=page]):hover{background-color:var(--nl-hover)}}@media (hover:none){.m_f0824112:where([data-active],[aria-current=page]):active{background-color:var(--nl-hover)}}.m_f0824112:where([data-active],[aria-current=page]) .m_57492dcc{--description-opacity:.9;--description-color:var(--nl-color)}.m_690090b5{justify-content:center;align-items:center;transition:transform .15s;display:flex}.m_690090b5>svg{display:block}.m_690090b5:where([data-position=left]){margin-inline-end:var(--mantine-spacing-sm)}.m_690090b5:where([data-position=right]){margin-inline-start:var(--mantine-spacing-sm)}.m_690090b5:where([data-rotate]){transform:rotate(90deg)}.m_1f6ac4c4{font-size:var(--mantine-font-size-sm)}.m_f07af9d2{text-overflow:ellipsis;flex:1;overflow:hidden}.m_f07af9d2:where([data-no-wrap]){white-space:nowrap}.m_57492dcc{font-size:var(--mantine-font-size-xs);opacity:var(--description-opacity,1);color:var(--description-color,var(--mantine-color-dimmed));text-overflow:ellipsis;display:block;overflow:hidden}:where([data-no-wrap]) .m_57492dcc{white-space:nowrap}.m_e17b862f{padding-inline-start:var(--nl-offset,var(--mantine-spacing-lg))}.m_1fd8a00b{transform:rotate(-90deg)}.m_a513464{--notification-radius:var(--mantine-radius-default);--notification-color:var(--mantine-primary-color-filled);box-sizing:border-box;padding-inline-start:calc(1.375rem * var(--mantine-scale));padding-inline-end:var(--mantine-spacing-xs);padding-top:var(--mantine-spacing-xs);padding-bottom:var(--mantine-spacing-xs);border-radius:var(--notification-radius);box-shadow:var(--mantine-shadow-lg);align-items:center;display:flex;position:relative;overflow:hidden}.m_a513464:before{content:"";width:calc(.375rem * var(--mantine-scale));top:var(--notification-radius);bottom:var(--notification-radius);border-radius:var(--notification-radius);background-color:var(--notification-color);display:block;position:absolute;inset-inline-start:calc(.25rem * var(--mantine-scale))}:where([data-mantine-color-scheme=light]) .m_a513464{background-color:var(--mantine-color-white)}:where([data-mantine-color-scheme=dark]) .m_a513464{background-color:var(--mantine-color-dark-6)}.m_a513464:where([data-with-icon]):before{display:none}:where([data-mantine-color-scheme=light]) .m_a513464:where([data-with-border]){border:1px solid var(--mantine-color-gray-3)}:where([data-mantine-color-scheme=dark]) .m_a513464:where([data-with-border]){border:1px solid var(--mantine-color-dark-4)}.m_a4ceffb{box-sizing:border-box;width:calc(1.75rem * var(--mantine-scale));height:calc(1.75rem * var(--mantine-scale));border-radius:calc(1.75rem * var(--mantine-scale));background-color:var(--notification-color);color:var(--mantine-color-white);justify-content:center;align-items:center;margin-inline-end:var(--mantine-spacing-md);display:flex}.m_b0920b15{margin-inline-end:var(--mantine-spacing-md)}.m_a49ed24{flex:1;margin-inline-end:var(--mantine-spacing-xs);overflow:hidden}.m_3feedf16{margin-bottom:calc(.125rem * var(--mantine-scale));text-overflow:ellipsis;font-size:var(--mantine-font-size-sm);line-height:var(--mantine-line-height-sm);font-weight:var(--mantine-font-weight-medium);overflow:hidden}:where([data-mantine-color-scheme=light]) .m_3feedf16{color:var(--mantine-color-gray-9)}:where([data-mantine-color-scheme=dark]) .m_3feedf16{color:var(--mantine-color-white)}.m_3d733a3a{font-size:var(--mantine-font-size-sm);line-height:var(--mantine-line-height-sm);text-overflow:ellipsis;overflow:hidden}:where([data-mantine-color-scheme=light]) .m_3d733a3a{color:var(--mantine-color-black)}:where([data-mantine-color-scheme=dark]) .m_3d733a3a{color:var(--mantine-color-dark-0)}:where([data-mantine-color-scheme=light]) .m_3d733a3a:where([data-with-title]){color:var(--mantine-color-gray-6)}:where([data-mantine-color-scheme=dark]) .m_3d733a3a:where([data-with-title]){color:var(--mantine-color-dark-2)}@media (hover:hover){:where([data-mantine-color-scheme=light]) .m_919a4d88:hover{background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_919a4d88:hover{background-color:var(--mantine-color-dark-8)}}@media (hover:none){:where([data-mantine-color-scheme=light]) .m_919a4d88:active{background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_919a4d88:active{background-color:var(--mantine-color-dark-8)}}.m_e2f5cd4e{--ni-right-section-width-xs:calc(1.0625rem * var(--mantine-scale));--ni-right-section-width-sm:calc(1.5rem * var(--mantine-scale));--ni-right-section-width-md:calc(1.6875rem * var(--mantine-scale));--ni-right-section-width-lg:calc(1.9375rem * var(--mantine-scale));--ni-right-section-width-xl:calc(2.125rem * var(--mantine-scale))}.m_95e17d22{--ni-chevron-size-xs:calc(.625rem * var(--mantine-scale));--ni-chevron-size-sm:calc(.875rem * var(--mantine-scale));--ni-chevron-size-md:calc(1rem * var(--mantine-scale));--ni-chevron-size-lg:calc(1.125rem * var(--mantine-scale));--ni-chevron-size-xl:calc(1.25rem * var(--mantine-scale));--ni-chevron-size:var(--ni-chevron-size-sm);width:100%;height:calc(var(--input-height) - calc(.125rem * var(--mantine-scale)));max-width:calc(var(--ni-chevron-size) * 1.7);flex-direction:column;margin-inline-start:auto;display:flex}.m_80b4b171{--control-border:1px solid var(--input-bd);--control-radius:calc(var(--input-radius) - calc(.0625rem * var(--mantine-scale)));width:100%;height:calc(var(--input-height) / 2 - calc(.0625rem * var(--mantine-scale)));border-inline-start:var(--control-border);color:var(--mantine-color-text);cursor:pointer;background-color:#0000;flex:0 0 50%;justify-content:center;align-items:center;padding:0;display:flex}.m_80b4b171:where(:disabled){cursor:not-allowed;opacity:.6;color:var(--mantine-color-disabled-color);background-color:#0000}.m_e2f5cd4e[data-error] :where(.m_80b4b171){color:var(--mantine-color-error)}@media (hover:hover){:where([data-mantine-color-scheme=light]) .m_80b4b171:hover{background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_80b4b171:hover{background-color:var(--mantine-color-dark-4)}}@media (hover:none){:where([data-mantine-color-scheme=light]) .m_80b4b171:active{background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_80b4b171:active{background-color:var(--mantine-color-dark-4)}}.m_80b4b171:where(:first-of-type){border-radius:0;border-start-end-radius:var(--control-radius)}.m_80b4b171:last-of-type{border-radius:0;border-end-end-radius:var(--control-radius)}.m_f62ab2af{contain:layout style;gap:var(--ol-gap,var(--mantine-spacing-xs));flex-wrap:wrap;display:flex}.m_4addd315{--pagination-control-size-xs:calc(1.375rem * var(--mantine-scale));--pagination-control-size-sm:calc(1.625rem * var(--mantine-scale));--pagination-control-size-md:calc(2rem * var(--mantine-scale));--pagination-control-size-lg:calc(2.375rem * var(--mantine-scale));--pagination-control-size-xl:calc(2.75rem * var(--mantine-scale));--pagination-control-size-input-xs:calc(1.875rem * var(--mantine-scale));--pagination-control-size-input-sm:calc(2.25rem * var(--mantine-scale));--pagination-control-size-input-md:calc(2.625rem * var(--mantine-scale));--pagination-control-size-input-lg:calc(3.125rem * var(--mantine-scale));--pagination-control-size-input-xl:calc(3.75rem * var(--mantine-scale));--pagination-control-size:var(--pagination-control-size-md);--pagination-control-fz:var(--mantine-font-size-md);--pagination-active-bg:var(--mantine-primary-color-filled)}.m_326d024a{border:calc(.0625rem * var(--mantine-scale)) solid;cursor:pointer;color:var(--mantine-color-text);height:var(--pagination-control-size);min-width:var(--pagination-control-size);font-size:var(--pagination-control-fz);border-radius:var(--pagination-control-radius,var(--mantine-radius-default));justify-content:center;align-items:center;line-height:1;display:flex}.m_326d024a:where([data-with-padding]){padding:calc(var(--pagination-control-size) / 4)}.m_326d024a:where(:disabled,[data-disabled]){cursor:not-allowed;opacity:.4}:where([data-mantine-color-scheme=light]) .m_326d024a{border-color:var(--mantine-color-gray-4);background-color:var(--mantine-color-white)}@media (hover:hover){:where([data-mantine-color-scheme=light]) .m_326d024a:hover:where(:not(:disabled,[data-disabled])){background-color:var(--mantine-color-gray-0)}}@media (hover:none){:where([data-mantine-color-scheme=light]) .m_326d024a:active:where(:not(:disabled,[data-disabled])){background-color:var(--mantine-color-gray-0)}}:where([data-mantine-color-scheme=dark]) .m_326d024a{border-color:var(--mantine-color-dark-4);background-color:var(--mantine-color-dark-6)}@media (hover:hover){:where([data-mantine-color-scheme=dark]) .m_326d024a:hover:where(:not(:disabled,[data-disabled])){background-color:var(--mantine-color-dark-5)}}@media (hover:none){:where([data-mantine-color-scheme=dark]) .m_326d024a:active:where(:not(:disabled,[data-disabled])){background-color:var(--mantine-color-dark-5)}}.m_326d024a:where([data-active]){background-color:var(--pagination-active-bg);border-color:var(--pagination-active-bg);color:var(--pagination-active-color,var(--mantine-color-white))}@media (hover:hover){.m_326d024a:where([data-active]):hover{background-color:var(--pagination-active-bg)}}@media (hover:none){.m_326d024a:where([data-active]):active{background-color:var(--pagination-active-bg)}}.m_4ad7767d{height:var(--pagination-control-size);min-width:var(--pagination-control-size);pointer-events:none;justify-content:center;align-items:center;display:flex}.m_f61ca620{--psi-button-size-xs:calc(1.375rem * var(--mantine-scale));--psi-button-size-sm:calc(1.625rem * var(--mantine-scale));--psi-button-size-md:calc(1.75rem * var(--mantine-scale));--psi-button-size-lg:calc(2rem * var(--mantine-scale));--psi-button-size-xl:calc(2.5rem * var(--mantine-scale));--psi-icon-size-xs:calc(1rem * var(--mantine-scale));--psi-icon-size-sm:calc(1.25rem * var(--mantine-scale));--psi-icon-size-md:calc(1.375rem * var(--mantine-scale));--psi-icon-size-lg:calc(1.5rem * var(--mantine-scale));--psi-icon-size-xl:calc(1.75rem * var(--mantine-scale));--psi-button-size:var(--psi-button-size-sm);--psi-icon-size:var(--psi-icon-size-sm)}.m_ccf8da4c{position:relative;overflow:hidden}.m_f2d85dd2{font-family:var(--mantine-font-family);font-size:inherit;line-height:var(--mantine-line-height);width:100%;height:100%;color:inherit;background-color:#0000;border:0;outline:0;padding-inline-start:var(--input-padding-inline-start);padding-inline-end:var(--input-padding-inline-end);position:absolute;inset:0}.m_ccf8da4c[data-disabled] .m_f2d85dd2,.m_f2d85dd2:disabled{cursor:not-allowed}.m_f2d85dd2::placeholder{color:var(--input-placeholder-color);opacity:1}.m_f2d85dd2::-ms-reveal{display:none}.m_b1072d44{width:var(--psi-button-size);height:var(--psi-button-size);min-width:var(--psi-button-size);min-height:var(--psi-button-size)}.m_b1072d44:disabled{display:none}.m_f1cb205a{--pin-input-size-xs:calc(1.875rem * var(--mantine-scale));--pin-input-size-sm:calc(2.25rem * var(--mantine-scale));--pin-input-size-md:calc(2.625rem * var(--mantine-scale));--pin-input-size-lg:calc(3.125rem * var(--mantine-scale));--pin-input-size-xl:calc(3.75rem * var(--mantine-scale));--pin-input-size:var(--pin-input-size-sm)}.m_cb288ead{width:var(--pin-input-size);height:var(--pin-input-size)}@keyframes m_81a374bd{0%{background-position:0 0}to{background-position:calc(2.5rem * var(--mantine-scale)) 0}}@keyframes m_e0fb7a86{0%{background-position:0 0}to{background-position:0 calc(2.5rem * var(--mantine-scale))}}.m_db6d6462{--progress-radius:var(--mantine-radius-default);--progress-size:var(--progress-size-md);--progress-size-xs:calc(.1875rem * var(--mantine-scale));--progress-size-sm:calc(.3125rem * var(--mantine-scale));--progress-size-md:calc(.5rem * var(--mantine-scale));--progress-size-lg:calc(.75rem * var(--mantine-scale));--progress-size-xl:calc(1rem * var(--mantine-scale));height:var(--progress-size);border-radius:var(--progress-radius);display:flex;position:relative;overflow:hidden}:where([data-mantine-color-scheme=light]) .m_db6d6462{background-color:var(--mantine-color-gray-2)}:where([data-mantine-color-scheme=dark]) .m_db6d6462{background-color:var(--mantine-color-dark-4)}.m_db6d6462:where([data-orientation=vertical]){height:auto;width:var(--progress-size);flex-direction:column-reverse}.m_2242eb65{background-color:var(--progress-section-color);height:100%;width:var(--progress-section-size);background-size:calc(1.25rem * var(--mantine-scale)) calc(1.25rem * var(--mantine-scale));transition:width var(--progress-transition-duration,.1s) ease;justify-content:center;align-items:center;display:flex;overflow:hidden}.m_2242eb65:where([data-striped]){background-image:linear-gradient(45deg,#ffffff26 25%,#0000 25% 50%,#ffffff26 50% 75%,#0000 75%,#0000)}.m_2242eb65:where([data-animated]){animation:1s linear infinite m_81a374bd}.m_2242eb65:where(:last-of-type){border-radius:0;border-start-end-radius:var(--progress-radius);border-end-end-radius:var(--progress-radius)}.m_2242eb65:where(:first-of-type){border-radius:0;border-start-start-radius:var(--progress-radius);border-end-start-radius:var(--progress-radius)}.m_db6d6462:where([data-orientation=vertical]) .m_2242eb65{width:100%;height:var(--progress-section-size);transition:height var(--progress-transition-duration,.1s) ease}.m_db6d6462:where([data-orientation=vertical]) .m_2242eb65:where([data-striped]){background-image:linear-gradient(135deg,#ffffff26 25%,#0000 25% 50%,#ffffff26 50% 75%,#0000 75%,#0000)}.m_db6d6462:where([data-orientation=vertical]) .m_2242eb65:where([data-animated]){animation:1s linear infinite m_e0fb7a86}.m_db6d6462:where([data-orientation=vertical]) .m_2242eb65:where(:last-of-type){border-radius:0;border-start-start-radius:var(--progress-radius);border-start-end-radius:var(--progress-radius)}.m_db6d6462:where([data-orientation=vertical]) .m_2242eb65:where(:first-of-type){border-radius:0;border-end-end-radius:var(--progress-radius);border-end-start-radius:var(--progress-radius)}.m_91e40b74{color:var(--progress-label-color,var(--mantine-color-white));-webkit-user-select:none;user-select:none;white-space:nowrap;text-overflow:ellipsis;font-weight:700;font-size:min(calc(var(--progress-size) * .65), calc(1.125rem * var(--mantine-scale)));padding-inline:calc(.25rem * var(--mantine-scale));line-height:1;overflow:hidden}.m_db6d6462:where([data-orientation=vertical]) .m_91e40b74{writing-mode:vertical-rl}.m_9dc8ae12{--card-radius:var(--mantine-radius-default);border-radius:var(--card-radius);cursor:pointer;width:100%;display:block}.m_9dc8ae12 :where(*){cursor:inherit}.m_9dc8ae12:where([data-with-border]){border:calc(.0625rem * var(--mantine-scale)) solid transparent}:where([data-mantine-color-scheme=light]) .m_9dc8ae12:where([data-with-border]){border-color:var(--mantine-color-gray-3)}:where([data-mantine-color-scheme=dark]) .m_9dc8ae12:where([data-with-border]){border-color:var(--mantine-color-dark-4)}.m_717d7ff6{--radio-size-xs:calc(1rem * var(--mantine-scale));--radio-size-sm:calc(1.25rem * var(--mantine-scale));--radio-size-md:calc(1.5rem * var(--mantine-scale));--radio-size-lg:calc(1.875rem * var(--mantine-scale));--radio-size-xl:calc(2.25rem * var(--mantine-scale));--radio-icon-size-xs:calc(.375rem * var(--mantine-scale));--radio-icon-size-sm:calc(.5rem * var(--mantine-scale));--radio-icon-size-md:calc(.625rem * var(--mantine-scale));--radio-icon-size-lg:calc(.875rem * var(--mantine-scale));--radio-icon-size-xl:calc(1rem * var(--mantine-scale));--radio-icon-size:var(--radio-icon-size-sm);--radio-size:var(--radio-size-sm);--radio-color:var(--mantine-primary-color-filled);--radio-icon-color:var(--mantine-color-white);border:calc(.0625rem * var(--mantine-scale)) solid transparent;width:var(--radio-size);min-width:var(--radio-size);height:var(--radio-size);min-height:var(--radio-size);border-radius:var(--radio-radius,10000px);cursor:var(--mantine-cursor-type);-webkit-tap-highlight-color:transparent;justify-content:center;align-items:center;transition:border-color .1s,background-color .1s;display:flex;position:relative}:where([data-mantine-color-scheme=light]) .m_717d7ff6{background-color:var(--mantine-color-white);border-color:var(--mantine-color-gray-4)}:where([data-mantine-color-scheme=dark]) .m_717d7ff6{background-color:var(--mantine-color-dark-6);border-color:var(--mantine-color-dark-4)}.m_717d7ff6[data-checked]{background-color:var(--radio-color);border-color:var(--radio-color)}.m_717d7ff6[data-checked]>.m_3e4da632{opacity:1;color:var(--radio-icon-color);transform:none}.m_717d7ff6[data-disabled]{cursor:not-allowed;background-color:var(--mantine-color-disabled);border-color:var(--mantine-color-disabled-border)}.m_717d7ff6[data-disabled][data-checked]>.m_3e4da632{color:var(--mantine-color-disabled-color)}.m_2980836c[data-checked]:not([data-disabled]){border-color:var(--radio-color);background-color:#0000}.m_2980836c[data-checked]:not([data-disabled])>.m_3e4da632{color:var(--radio-color);opacity:1;transform:none}.m_3e4da632{width:var(--radio-icon-size);height:var(--radio-icon-size);color:#0000;pointer-events:none;transform:translateY(calc(.3125rem * var(--mantine-scale))) scale(.5);opacity:1;transition:transform .1s,opacity .1s;display:block}.m_f3f1af94{--radio-size-xs:calc(1rem * var(--mantine-scale));--radio-size-sm:calc(1.25rem * var(--mantine-scale));--radio-size-md:calc(1.5rem * var(--mantine-scale));--radio-size-lg:calc(1.875rem * var(--mantine-scale));--radio-size-xl:calc(2.25rem * var(--mantine-scale));--radio-size:var(--radio-size-sm);--radio-icon-size-xs:calc(.375rem * var(--mantine-scale));--radio-icon-size-sm:calc(.5rem * var(--mantine-scale));--radio-icon-size-md:calc(.625rem * var(--mantine-scale));--radio-icon-size-lg:calc(.875rem * var(--mantine-scale));--radio-icon-size-xl:calc(1rem * var(--mantine-scale));--radio-icon-size:var(--radio-icon-size-sm);--radio-icon-color:var(--mantine-color-white)}.m_89c4f5e4{width:var(--radio-size);height:var(--radio-size);order:1;position:relative}.m_89c4f5e4:where([data-label-position=left]){order:2}.m_f3ed6b2b{color:var(--radio-icon-color);opacity:var(--radio-icon-opacity,0);translate:-50% -50%;transform:var(--radio-icon-transform,scale(.2) translateY(calc(.625rem * var(--mantine-scale))));pointer-events:none;width:var(--radio-icon-size);height:var(--radio-icon-size);transition:opacity .1s,transform .2s;position:absolute;top:50%;left:50%}.m_8a3dbb89{border:calc(.0625rem * var(--mantine-scale)) solid;appearance:none;width:var(--radio-size);height:var(--radio-size);border-radius:var(--radio-radius,var(--radio-size));cursor:var(--mantine-cursor-type);-webkit-tap-highlight-color:transparent;justify-content:center;align-items:center;margin:0;transition-property:background-color,border-color;transition-duration:.1s;transition-timing-function:ease;display:flex;position:relative}:where([data-mantine-color-scheme=light]) .m_8a3dbb89{background-color:var(--mantine-color-white);border-color:var(--mantine-color-gray-4)}:where([data-mantine-color-scheme=dark]) .m_8a3dbb89{background-color:var(--mantine-color-dark-6);border-color:var(--mantine-color-dark-4)}.m_8a3dbb89:checked{background-color:var(--radio-color,var(--mantine-primary-color-filled));border-color:var(--radio-color,var(--mantine-primary-color-filled))}.m_8a3dbb89:checked+.m_f3ed6b2b{--radio-icon-opacity:1;--radio-icon-transform:scale(1)}.m_8a3dbb89:disabled{cursor:not-allowed;background-color:var(--mantine-color-disabled);border-color:var(--mantine-color-disabled-border)}.m_8a3dbb89:disabled+.m_f3ed6b2b{--radio-icon-color:var(--mantine-color-disabled-color)}.m_8a3dbb89:where([data-with-error-styles][data-error]){border-color:var(--mantine-color-error)}.m_1bfe9d39+.m_f3ed6b2b{--radio-icon-color:var(--radio-color)}.m_1bfe9d39:checked:not(:disabled){border-color:var(--radio-color);background-color:#0000}.m_1bfe9d39:checked:not(:disabled)+.m_f3ed6b2b{--radio-icon-color:var(--radio-color);--radio-icon-opacity:1;--radio-icon-transform:none}.m_f8d312f2{--rating-size-xs:calc(.875rem * var(--mantine-scale));--rating-size-sm:calc(1.125rem * var(--mantine-scale));--rating-size-md:calc(1.25rem * var(--mantine-scale));--rating-size-lg:calc(1.75rem * var(--mantine-scale));--rating-size-xl:calc(2rem * var(--mantine-scale));width:max-content;display:flex}.m_f8d312f2:where(:has(input:disabled)){pointer-events:none}.m_61734bb7{transition:transform .1s;position:relative}.m_61734bb7:where([data-active]){z-index:1;transform:scale(1.1)}.m_5662a89a{width:var(--rating-size);height:var(--rating-size);display:block}:where([data-mantine-color-scheme=light]) .m_5662a89a{fill:var(--mantine-color-gray-3);stroke:var(--mantine-color-gray-3)}:where([data-mantine-color-scheme=dark]) .m_5662a89a{fill:var(--mantine-color-dark-3);stroke:var(--mantine-color-dark-3)}.m_5662a89a:where([data-filled]){fill:var(--rating-color);stroke:var(--rating-color)}.m_211007ba{white-space:nowrap;opacity:0;-webkit-tap-highlight-color:transparent;width:0;height:0;position:absolute;overflow:hidden}.m_211007ba:focus-visible+label{outline:2px solid var(--mantine-primary-color-filled);outline-offset:calc(.125rem * var(--mantine-scale))}.m_21342ee4{cursor:pointer;z-index:var(--rating-item-z-index,0);-webkit-tap-highlight-color:transparent;display:block;position:absolute;top:0;left:0}.m_21342ee4:where([data-read-only]){cursor:default}.m_21342ee4:where(:last-of-type){position:relative}.m_fae05d6a{clip-path:var(--rating-symbol-clip-path)}.m_1b3c8819{--tooltip-radius:var(--mantine-radius-default);padding:calc(var(--mantine-spacing-xs) / 2) var(--mantine-spacing-xs);pointer-events:none;font-size:var(--mantine-font-size-sm);white-space:nowrap;border-radius:var(--tooltip-radius);position:absolute}:where([data-mantine-color-scheme=light]) .m_1b3c8819{background-color:var(--tooltip-bg,var(--mantine-color-gray-9));color:var(--tooltip-color,var(--mantine-color-white))}:where([data-mantine-color-scheme=dark]) .m_1b3c8819{background-color:var(--tooltip-bg,var(--mantine-color-gray-2));color:var(--tooltip-color,var(--mantine-color-black))}.m_1b3c8819:where([data-multiline]){white-space:normal}.m_1b3c8819:where([data-fixed]){position:fixed}.m_f898399f{background-color:inherit;z-index:1;border:0}.m_b32e4812{width:var(--rp-size);height:var(--rp-size);min-width:var(--rp-size);min-height:var(--rp-size);--rp-transition-duration:0s;position:relative}.m_d43b5134{width:var(--rp-size);height:var(--rp-size);min-width:var(--rp-size);min-height:var(--rp-size);transform:rotate(calc(var(--rp-start-angle,270deg) - 360deg))}.m_b1ca1fbf{stroke:var(--curve-color,var(--rp-curve-root-color));transition:stroke-dashoffset var(--rp-transition-duration) ease, stroke-dasharray var(--rp-transition-duration) ease, stroke var(--rp-transition-duration)}[data-mantine-color-scheme=light] .m_b1ca1fbf{--rp-curve-root-color:var(--mantine-color-gray-2)}[data-mantine-color-scheme=dark] .m_b1ca1fbf{--rp-curve-root-color:var(--mantine-color-dark-4)}.m_b23f9dc4{top:50%;inset-inline:var(--rp-label-offset);position:absolute;transform:translateY(-50%)}.m_bc8f275{--scroller-control-size:calc(3.125rem * var(--mantine-scale));--scroller-background-color:var(--mantine-color-body);align-items:center;max-width:100%;display:flex;position:relative;overflow:hidden}.m_ee44dece{scrollbar-width:none;-ms-overflow-style:none;-webkit-user-select:none;user-select:none;flex:1;overflow:auto hidden}.m_ee44dece::-webkit-scrollbar{display:none}.m_ee44dece[data-draggable]{cursor:grab}.m_53e4f606{white-space:nowrap;display:inline-flex}.m_47754fc8{width:var(--scroller-control-size);height:var(--scroller-control-size)}.m_53e526ea{width:var(--scroller-control-size);z-index:1;color:var(--mantine-color-dimmed);opacity:1;pointer-events:auto;align-items:center;transition:opacity .2s,color .15s;display:flex;position:absolute;top:0;bottom:0}.m_53e526ea:hover{color:var(--mantine-color-text)}.m_53e526ea:where([data-position=start]){background:linear-gradient(to right, var(--scroller-background-color) 40%, transparent);justify-content:flex-start;inset-inline-start:0}.m_53e526ea:where([data-position=start]) .m_47754fc8{transform:rotate(90deg)}.m_53e526ea:where([data-position=end]){background:linear-gradient(to left, var(--scroller-background-color) 40%, transparent);justify-content:flex-end;inset-inline-end:0}.m_53e526ea:where([data-position=end]) .m_47754fc8{transform:rotate(-90deg)}.m_53e526ea:where([data-hidden]){opacity:0;pointer-events:none}.m_cf365364{--sc-padding-xs:calc(.125rem * var(--mantine-scale)) calc(.375rem * var(--mantine-scale));--sc-padding-sm:calc(.1875rem * var(--mantine-scale)) calc(.625rem * var(--mantine-scale));--sc-padding-md:calc(.25rem * var(--mantine-scale)) calc(.875rem * var(--mantine-scale));--sc-padding-lg:calc(.4375rem * var(--mantine-scale)) calc(1rem * var(--mantine-scale));--sc-padding-xl:calc(.625rem * var(--mantine-scale)) calc(1.25rem * var(--mantine-scale));--sc-transition-duration:.2s;--sc-padding:var(--sc-padding-sm);--sc-transition-timing-function:ease;--sc-font-size:var(--mantine-font-size-sm);border-radius:var(--sc-radius,var(--mantine-radius-default));width:auto;padding:calc(.25rem * var(--mantine-scale));flex-direction:row;display:inline-flex;position:relative;overflow:hidden}.m_cf365364:where([data-full-width]){display:flex}.m_cf365364:where([data-orientation=vertical]){flex-direction:column;width:max-content;display:flex}.m_cf365364:where([data-orientation=vertical]):where([data-full-width]){width:auto}:where([data-mantine-color-scheme=light]) .m_cf365364{background-color:var(--mantine-color-gray-1)}:where([data-mantine-color-scheme=dark]) .m_cf365364{background-color:var(--mantine-color-dark-8)}.m_9e182ccd{z-index:1;border-radius:calc(var(--sc-radius,var(--mantine-radius-default)) - 4px);display:block;position:absolute}:where([data-mantine-color-scheme=light]) .m_9e182ccd{box-shadow:var(--sc-shadow,none);background-color:var(--sc-color,var(--mantine-color-white))}:where([data-mantine-color-scheme=dark]) .m_9e182ccd{box-shadow:none;background-color:var(--sc-color,var(--mantine-color-dark-5))}.m_1738fcb2{-webkit-tap-highlight-color:transparent;font-weight:var(--mantine-font-weight-medium);text-align:center;white-space:nowrap;text-overflow:ellipsis;-webkit-user-select:none;user-select:none;border-radius:calc(var(--sc-radius,var(--mantine-radius-default)) - 4px);font-size:var(--sc-font-size);padding:var(--sc-padding);transition:color var(--sc-transition-duration) var(--sc-transition-timing-function);cursor:pointer;outline:var(--segmented-control-outline,none);display:block;overflow:hidden}:where([data-mantine-color-scheme=light]) .m_1738fcb2{color:var(--mantine-color-gray-7)}:where([data-mantine-color-scheme=dark]) .m_1738fcb2{color:var(--mantine-color-dark-1)}.m_1738fcb2:where([data-read-only]){cursor:default}fieldset:disabled .m_1738fcb2,.m_1738fcb2:where([data-disabled]){cursor:not-allowed;color:var(--mantine-color-disabled-color)}:where([data-mantine-color-scheme=light]) .m_1738fcb2:where([data-active]){color:var(--sc-label-color,var(--mantine-color-black))}:where([data-mantine-color-scheme=dark]) .m_1738fcb2:where([data-active]){color:var(--sc-label-color,var(--mantine-color-white))}.m_cf365364:where([data-initialized]) .m_1738fcb2:where([data-active]):before{display:none}.m_1738fcb2:where([data-active]):before{content:"";z-index:0;border-radius:calc(var(--sc-radius,var(--mantine-radius-default)) - 4px);position:absolute;inset:0}:where([data-mantine-color-scheme=light]) .m_1738fcb2:where([data-active]):before{box-shadow:var(--sc-shadow,none);background-color:var(--sc-color,var(--mantine-color-white))}:where([data-mantine-color-scheme=dark]) .m_1738fcb2:where([data-active]):before{box-shadow:none;background-color:var(--sc-color,var(--mantine-color-dark-5))}@media (hover:hover){:where([data-mantine-color-scheme=light]) .m_1738fcb2:where(:not([data-disabled],[data-active],[data-read-only])):hover{color:var(--mantine-color-black)}:where([data-mantine-color-scheme=dark]) .m_1738fcb2:where(:not([data-disabled],[data-active],[data-read-only])):hover{color:var(--mantine-color-white)}}@media (hover:none){:where([data-mantine-color-scheme=light]) .m_1738fcb2:where(:not([data-disabled],[data-active],[data-read-only])):active{color:var(--mantine-color-black)}:where([data-mantine-color-scheme=dark]) .m_1738fcb2:where(:not([data-disabled],[data-active],[data-read-only])):active{color:var(--mantine-color-white)}}@media (hover:hover){fieldset:disabled .m_1738fcb2:hover{color:var(--mantine-color-disabled-color)!important}}@media (hover:none){fieldset:disabled .m_1738fcb2:active{color:var(--mantine-color-disabled-color)!important}}.m_1714d588{white-space:nowrap;opacity:0;width:0;height:0;position:absolute;overflow:hidden}.m_1714d588[data-focus-ring=auto]:focus:focus-visible+.m_1738fcb2,.m_1714d588[data-focus-ring=always]:focus+.m_1738fcb2{--segmented-control-outline:2px solid var(--mantine-primary-color-filled)}.m_69686b9b{z-index:2;transition:border-color var(--sc-transition-duration) var(--sc-transition-timing-function);flex:1;position:relative}.m_cf365364[data-with-items-borders] :where(.m_69686b9b):before{content:"";top:0;bottom:0;background-color:var(--separator-color);width:calc(.0625rem * var(--mantine-scale));transition:background-color var(--sc-transition-duration) var(--sc-transition-timing-function);position:absolute;inset-inline-start:0}.m_69686b9b[data-orientation=vertical]:before{top:0;inset-inline:0;height:calc(.0625rem * var(--mantine-scale));width:auto;bottom:auto}:where([data-mantine-color-scheme=light]) .m_69686b9b{--separator-color:var(--mantine-color-gray-3)}:where([data-mantine-color-scheme=dark]) .m_69686b9b{--separator-color:var(--mantine-color-dark-4)}.m_69686b9b:first-of-type:before,[data-mantine-color-scheme] .m_69686b9b[data-active]:before,[data-mantine-color-scheme] .m_69686b9b[data-active]+.m_69686b9b:before{--separator-color:transparent}.m_78882f40{z-index:2;position:relative}.m_fa528724{--scp-filled-segment-color:var(--mantine-primary-color-filled);--scp-transition-duration:0s;--scp-thickness:calc(.75rem * var(--mantine-scale))}:where([data-mantine-color-scheme=light]) .m_fa528724{--scp-empty-segment-color:var(--mantine-color-gray-2)}:where([data-mantine-color-scheme=dark]) .m_fa528724{--scp-empty-segment-color:var(--mantine-color-dark-4)}.m_fa528724{width:fit-content;position:relative}.m_62e9e7e2{transform:var(--scp-rotation);display:block;overflow:hidden}.m_c573fb6f{transition:stroke-dashoffset var(--scp-transition-duration) ease, stroke-dasharray var(--scp-transition-duration) ease, stroke var(--scp-transition-duration)}.m_4fa340f2{text-align:center;z-index:1;margin:0;padding:0;position:absolute;inset-inline:0}.m_4fa340f2:where([data-position=bottom]){padding-inline:calc(var(--scp-thickness) * 2);bottom:0}.m_4fa340f2:where([data-position=bottom]):where([data-orientation=down]){top:0;bottom:auto}.m_4fa340f2:where([data-position=center]){padding-inline:calc(var(--scp-thickness) * 3);top:50%;transform:translateY(-50%)}.m_925c2d2c{container:simple-grid/inline-size}.m_2415a157{grid-template-columns:repeat(var(--sg-cols), minmax(0, 1fr));grid-auto-rows:var(--sg-auto-rows,auto);gap:var(--sg-spacing-y) var(--sg-spacing-x);display:grid}.m_2415a157[data-auto-cols=auto-fill]{grid-template-columns:repeat(auto-fill, minmax(var(--sg-min-col-width), 1fr))}.m_2415a157[data-auto-cols=auto-fit]{grid-template-columns:repeat(auto-fit, minmax(var(--sg-min-col-width), 1fr))}@keyframes m_299c329c{0%,to{opacity:.4}50%{opacity:1}}.m_18320242{height:var(--skeleton-height,auto);width:var(--skeleton-width,100%);border-radius:var(--skeleton-radius,var(--mantine-radius-default));position:relative;transform:translateZ(0)}.m_18320242:where([data-animate]):after{animation:1.5s linear infinite m_299c329c}.m_18320242:where([data-visible]){overflow:hidden}.m_18320242:where([data-visible]):before{content:"";z-index:10;background-color:var(--mantine-color-body);position:absolute;inset:0}.m_18320242:where([data-visible]):after{content:"";z-index:11;position:absolute;inset:0}:where([data-mantine-color-scheme=light]) .m_18320242:where([data-visible]):after{background-color:var(--mantine-color-gray-3)}:where([data-mantine-color-scheme=dark]) .m_18320242:where([data-visible]):after{background-color:var(--mantine-color-dark-4)}.m_dd36362e{--slider-size-xs:calc(.25rem * var(--mantine-scale));--slider-size-sm:calc(.375rem * var(--mantine-scale));--slider-size-md:calc(.5rem * var(--mantine-scale));--slider-size-lg:calc(.625rem * var(--mantine-scale));--slider-size-xl:calc(.75rem * var(--mantine-scale));--slider-size:var(--slider-size-md);--slider-radius:calc(62.5rem * var(--mantine-scale));--slider-color:var(--mantine-primary-color-filled);--slider-track-disabled-bg:var(--mantine-color-disabled);-webkit-tap-highlight-color:transparent;height:calc(var(--slider-size) * 2);padding-inline:var(--slider-size);touch-action:none;outline:none;flex-direction:column;align-items:center;display:flex;position:relative}[data-mantine-color-scheme=light] .m_dd36362e{--slider-track-bg:var(--mantine-color-gray-2)}[data-mantine-color-scheme=dark] .m_dd36362e{--slider-track-bg:var(--mantine-color-dark-4)}.m_dd36362e[data-orientation=vertical]{width:calc(var(--slider-size) * 2);height:calc(12.5rem * var(--mantine-scale));padding-inline:0;padding-block:var(--slider-size)}.m_c9357328{top:calc(-2.25rem * var(--mantine-scale));font-size:var(--mantine-font-size-xs);color:var(--mantine-color-white);padding:calc(var(--mantine-spacing-xs) / 2);border-radius:var(--mantine-radius-sm);white-space:nowrap;pointer-events:none;-webkit-user-select:none;user-select:none;touch-action:none;position:absolute}:where([data-mantine-color-scheme=light]) .m_c9357328{background-color:var(--mantine-color-gray-9)}:where([data-mantine-color-scheme=dark]) .m_c9357328{background-color:var(--mantine-color-dark-4)}:where(.m_dd36362e[data-orientation=vertical]) .m_c9357328{top:auto;inset-inline-start:calc(100% + 8px)}.m_c9a9a60a{height:var(--slider-thumb-size);width:var(--slider-thumb-size);border:calc(.25rem * var(--mantine-scale)) solid;cursor:pointer;border-radius:var(--slider-radius);z-index:3;-webkit-user-select:none;user-select:none;touch-action:none;outline-offset:calc(.125rem * var(--mantine-scale));top:50%;left:var(--slider-thumb-offset);justify-content:center;align-items:center;transition:box-shadow .1s,transform .1s;display:flex;position:absolute;transform:translate(-50%,-50%)}:where([dir=rtl]) .m_c9a9a60a{left:auto;right:calc(var(--slider-thumb-offset) - var(--slider-thumb-size))}fieldset:disabled .m_c9a9a60a,.m_c9a9a60a:where([data-disabled]){display:none}.m_c9a9a60a:where([data-dragging]){box-shadow:var(--mantine-shadow-sm);transform:translate(-50%,-50%)scale(1.05)}:where([data-mantine-color-scheme=light]) .m_c9a9a60a{color:var(--slider-color);border-color:var(--slider-color);background-color:var(--mantine-color-white)}:where([data-mantine-color-scheme=dark]) .m_c9a9a60a{color:var(--mantine-color-white);border-color:var(--mantine-color-white);background-color:var(--slider-color)}:where(.m_dd36362e[data-orientation=vertical]) .m_c9a9a60a{top:auto;left:50%;right:auto;bottom:var(--slider-thumb-offset);transform:translate(-50%,50%)}:where(.m_dd36362e[data-orientation=vertical]) .m_c9a9a60a:where([data-dragging]){transform:translate(-50%,50%)scale(1.05)}:where([dir=rtl]) :where(.m_dd36362e[data-orientation=vertical]) .m_c9a9a60a{left:50%;right:auto}.m_a8645c2{width:100%;height:calc(var(--slider-size) * 2);cursor:pointer;align-items:center;display:flex}fieldset:disabled .m_a8645c2,.m_a8645c2:where([data-disabled]){cursor:not-allowed}:where(.m_dd36362e[data-orientation=vertical]) .m_a8645c2{width:calc(var(--slider-size) * 2);flex-direction:column;height:100%}.m_c9ade57f{width:100%;height:var(--slider-size);position:relative}.m_c9ade57f:where([data-inverted]:not([data-disabled])){--track-bg:var(--slider-color)}fieldset:disabled .m_c9ade57f:where([data-inverted]),.m_c9ade57f:where([data-inverted][data-disabled]){--track-bg:var(--slider-track-disabled-bg)}.m_c9ade57f:before{content:"";border-radius:var(--slider-radius);top:0;bottom:0;inset-inline:calc(var(--slider-size) * -1);background-color:var(--track-bg,var(--slider-track-bg));z-index:0;position:absolute}:where(.m_dd36362e[data-orientation=vertical]) .m_c9ade57f{width:var(--slider-size);height:100%}:where(.m_dd36362e[data-orientation=vertical]) .m_c9ade57f:before{inset-inline:0;top:calc(var(--slider-size) * -1);bottom:calc(var(--slider-size) * -1)}.m_38aeed47{z-index:1;background-color:var(--slider-color);border-radius:var(--slider-radius);width:var(--slider-bar-width);top:0;bottom:0;position:absolute;inset-inline-start:var(--slider-bar-offset)}.m_38aeed47:where([data-inverted]){background-color:var(--slider-track-bg)}fieldset:disabled .m_38aeed47:where(:not([data-inverted])),.m_38aeed47:where([data-disabled]:not([data-inverted])){background-color:var(--mantine-color-disabled-color)}:where(.m_dd36362e[data-orientation=vertical]) .m_38aeed47{top:auto;bottom:var(--slider-bar-offset);width:100%;height:var(--slider-bar-width);inset-inline-start:0}.m_b7b0423a{inset-inline-start:calc(var(--mark-offset) - var(--slider-size) / 2);z-index:2;pointer-events:none;height:0;position:absolute;top:0}:where(.m_dd36362e[data-orientation=vertical]) .m_b7b0423a{inset-inline-start:0;top:auto;bottom:calc(var(--mark-offset) + var(--slider-size) / 2);width:0;height:0}.m_dd33bc19{border:calc(.125rem * var(--mantine-scale)) solid;height:var(--slider-size);width:var(--slider-size);border-radius:calc(62.5rem * var(--mantine-scale));background-color:var(--mantine-color-white);pointer-events:none}:where([data-mantine-color-scheme=light]) .m_dd33bc19{border-color:var(--mantine-color-gray-2)}:where([data-mantine-color-scheme=dark]) .m_dd33bc19{border-color:var(--mantine-color-dark-4)}.m_dd33bc19:where([data-filled]){border-color:var(--slider-color)}.m_dd33bc19:where([data-filled]):where([data-disabled]){border-color:var(--mantine-color-disabled-border)}.m_68c77a5b{transform:translate(calc(-50% + var(--slider-size) / 2), calc(var(--mantine-spacing-xs) / 2));font-size:var(--mantine-font-size-sm);white-space:nowrap;cursor:pointer;-webkit-user-select:none;user-select:none}:where([data-mantine-color-scheme=light]) .m_68c77a5b{color:var(--mantine-color-gray-6)}:where([data-mantine-color-scheme=dark]) .m_68c77a5b{color:var(--mantine-color-dark-2)}:where(.m_dd36362e[data-orientation=vertical]) .m_68c77a5b{transform:translate(calc(var(--slider-size) + var(--mantine-spacing-xs) / 2), calc(-50% - var(--slider-size) / 2))}.m_559cce2d{position:relative}.m_559cce2d:where([data-has-spoiler]){margin-bottom:calc(1.5rem * var(--mantine-scale))}.m_b912df4e{transition:max-height var(--spoiler-transition-duration,.2s) ease;flex-direction:column;display:flex;overflow:hidden}.m_b9131032{inset-inline-start:0;height:calc(1.5rem * var(--mantine-scale));position:absolute;top:100%}.m_6d731127{align-items:var(--stack-align,stretch);justify-content:var(--stack-justify,flex-start);gap:var(--stack-gap,var(--mantine-spacing-md));flex-direction:column;display:flex}.m_cbb4ea7e{--stepper-icon-size-xs:calc(2.125rem * var(--mantine-scale));--stepper-icon-size-sm:calc(2.25rem * var(--mantine-scale));--stepper-icon-size-md:calc(2.625rem * var(--mantine-scale));--stepper-icon-size-lg:calc(3rem * var(--mantine-scale));--stepper-icon-size-xl:calc(3.25rem * var(--mantine-scale));--stepper-icon-size:var(--stepper-icon-size-md);--stepper-color:var(--mantine-primary-color-filled);--stepper-content-padding:var(--mantine-spacing-md);--stepper-spacing:var(--mantine-spacing-md);--stepper-radius:calc(62.5rem * var(--mantine-scale));--stepper-fz:var(--mantine-font-size-md);--stepper-outline-thickness:calc(.125rem * var(--mantine-scale))}[data-mantine-color-scheme=light] .m_cbb4ea7e{--stepper-outline-color:var(--mantine-color-gray-2)}[data-mantine-color-scheme=dark] .m_cbb4ea7e{--stepper-outline-color:var(--mantine-color-dark-5)}.m_aaf89d0b{flex-wrap:nowrap;align-items:center;display:flex}.m_aaf89d0b:where([data-wrap]){gap:var(--mantine-spacing-md) 0;flex-wrap:wrap}.m_aaf89d0b:where([data-orientation=vertical]){flex-direction:column}.m_aaf89d0b:where([data-orientation=vertical]):where([data-icon-position=left]){align-items:flex-start}.m_aaf89d0b:where([data-orientation=vertical]):where([data-icon-position=right]){align-items:flex-end}.m_aaf89d0b:where([data-orientation=horizontal]){flex-direction:row}.m_2a371ac9{height:var(--stepper-outline-thickness);margin-inline:var(--mantine-spacing-md);background-color:var(--stepper-outline-color);flex:1;transition:background-color .15s}.m_2a371ac9:where([data-active]){background-color:var(--stepper-color)}.m_78da155d{padding-top:var(--stepper-content-padding)}.m_cbb57068{--step-color:var(--stepper-color);cursor:default;display:flex}.m_cbb57068:where([data-allow-click]){cursor:pointer}.m_cbb57068:where([data-icon-position=left]){flex-direction:row}.m_cbb57068:where([data-icon-position=right]){flex-direction:row-reverse}.m_f56b1e2c{align-items:center}.m_833edb7e{--separator-spacing:calc(var(--mantine-spacing-xs) / 2);min-height:calc(var(--stepper-icon-size) + var(--mantine-spacing-xl) + var(--separator-spacing));margin-top:var(--separator-spacing);justify-content:flex-start;overflow:hidden}.m_833edb7e:where(:first-of-type){margin-top:0}.m_833edb7e:where(:last-of-type){min-height:auto}.m_833edb7e:where(:last-of-type) .m_6496b3f3{display:none}.m_818e70b{position:relative}.m_6496b3f3{top:calc(var(--stepper-icon-size) + var(--separator-spacing));border-inline-start:var(--stepper-outline-thickness) solid var(--stepper-outline-color);height:100vh;position:absolute;inset-inline-start:calc(var(--stepper-icon-size) / 2)}.m_6496b3f3:where([data-active]){border-color:var(--stepper-color)}.m_1959ad01{height:var(--stepper-icon-size);width:var(--stepper-icon-size);min-height:var(--stepper-icon-size);min-width:var(--stepper-icon-size);border-radius:var(--stepper-radius);font-size:var(--stepper-fz);border:var(--stepper-outline-thickness) solid var(--stepper-outline-color);background-color:var(--stepper-outline-color);justify-content:center;align-items:center;font-weight:700;transition:background-color .15s,border-color .15s;display:flex;position:relative}:where([data-mantine-color-scheme=light]) .m_1959ad01{color:var(--mantine-color-gray-7)}:where([data-mantine-color-scheme=dark]) .m_1959ad01{color:var(--mantine-color-dark-1)}.m_1959ad01:where([data-progress]){border-color:var(--step-color)}.m_1959ad01:where([data-completed]){color:var(--stepper-icon-color,var(--mantine-color-white));background-color:var(--step-color);border-color:var(--step-color)}.m_8faaac38{display:flex}.m_a79331dc{color:var(--stepper-icon-color,var(--mantine-color-white));justify-content:center;align-items:center;display:flex;position:absolute;inset:0}.m_1956aa2a{flex-direction:column;display:flex}.m_1956aa2a:where([data-icon-position=left]){margin-inline-start:var(--mantine-spacing-sm)}.m_1956aa2a:where([data-icon-position=right]){text-align:right;margin-inline-end:var(--mantine-spacing-sm)}:where([dir=rtl]) .m_1956aa2a:where([data-icon-position=right]){text-align:left}.m_12051f6c{font-weight:var(--mantine-font-weight-medium);font-size:var(--stepper-fz);line-height:1}.m_164eea74{margin-top:calc(var(--stepper-spacing) / 3);margin-bottom:calc(var(--stepper-spacing) / 3);font-size:calc(var(--stepper-fz) - calc(.125rem * var(--mantine-scale)));color:var(--mantine-color-dimmed);line-height:1}.m_5f93f3bb{--switch-height-xs:calc(1rem * var(--mantine-scale));--switch-height-sm:calc(1.25rem * var(--mantine-scale));--switch-height-md:calc(1.5rem * var(--mantine-scale));--switch-height-lg:calc(1.875rem * var(--mantine-scale));--switch-height-xl:calc(2.25rem * var(--mantine-scale));--switch-width-xs:calc(2rem * var(--mantine-scale));--switch-width-sm:calc(2.375rem * var(--mantine-scale));--switch-width-md:calc(2.875rem * var(--mantine-scale));--switch-width-lg:calc(3.5rem * var(--mantine-scale));--switch-width-xl:calc(4.5rem * var(--mantine-scale));--switch-thumb-size-xs:calc(.75rem * var(--mantine-scale));--switch-thumb-size-sm:calc(.875rem * var(--mantine-scale));--switch-thumb-size-md:calc(1.125rem * var(--mantine-scale));--switch-thumb-size-lg:calc(1.375rem * var(--mantine-scale));--switch-thumb-size-xl:calc(1.75rem * var(--mantine-scale));--switch-label-font-size-xs:calc(.3125rem * var(--mantine-scale));--switch-label-font-size-sm:calc(.375rem * var(--mantine-scale));--switch-label-font-size-md:calc(.4375rem * var(--mantine-scale));--switch-label-font-size-lg:calc(.5625rem * var(--mantine-scale));--switch-label-font-size-xl:calc(.6875rem * var(--mantine-scale));--switch-track-label-padding-xs:calc(.125rem * var(--mantine-scale));--switch-track-label-padding-sm:calc(.15625rem * var(--mantine-scale));--switch-track-label-padding-md:calc(.1875rem * var(--mantine-scale));--switch-track-label-padding-lg:calc(.1875rem * var(--mantine-scale));--switch-track-label-padding-xl:calc(.21875rem * var(--mantine-scale));--switch-height:var(--switch-height-sm);--switch-width:var(--switch-width-sm);--switch-thumb-size:var(--switch-thumb-size-sm);--switch-label-font-size:var(--switch-label-font-size-sm);--switch-track-label-padding:var(--switch-track-label-padding-sm);--switch-radius:calc(62.5rem * var(--mantine-scale));--switch-color:var(--mantine-primary-color-filled);--switch-disabled-color:var(--mantine-color-disabled);position:relative}.m_926b4011{opacity:0;white-space:nowrap;width:100%;height:100%;margin:0;padding:0;position:absolute;overflow:hidden}.m_9307d992{-webkit-tap-highlight-color:transparent;cursor:var(--switch-cursor,var(--mantine-cursor-type));border-radius:var(--switch-radius);background-color:var(--switch-bg);height:var(--switch-height);min-width:var(--switch-width);appearance:none;font-size:var(--switch-label-font-size);font-weight:var(--mantine-font-weight-medium);order:var(--switch-order,1);-webkit-user-select:none;user-select:none;z-index:0;color:var(--switch-text-color);align-items:center;margin:0;line-height:0;transition:background-color .15s,border-color .15s;display:flex;position:relative;overflow:hidden}.m_9307d992:where([data-without-labels]){width:var(--switch-width)}.m_926b4011:focus-visible+.m_9307d992{outline:2px solid var(--mantine-primary-color-filled);outline-offset:calc(.125rem * var(--mantine-scale))}.m_926b4011:checked+.m_9307d992{--switch-bg:var(--switch-color);--switch-text-color:var(--mantine-color-white)}.m_926b4011:disabled+.m_9307d992,.m_926b4011[data-disabled]+.m_9307d992{--switch-bg:var(--switch-disabled-color);--switch-cursor:not-allowed}[data-mantine-color-scheme=light] .m_9307d992{--switch-bg:var(--mantine-color-gray-3);--switch-text-color:var(--mantine-color-gray-6)}[data-mantine-color-scheme=dark] .m_9307d992{--switch-bg:var(--mantine-color-dark-5);--switch-text-color:var(--mantine-color-dark-1)}.m_9307d992[data-label-position=left]{--switch-order:2}.m_93039a1d{z-index:1;border-radius:var(--switch-radius);background-color:var(--switch-thumb-bg,var(--mantine-color-white));height:var(--switch-thumb-size);width:var(--switch-thumb-size);transition:inset-inline-start .15s;display:flex;position:absolute;inset-inline-start:var(--switch-thumb-start,var(--switch-track-label-padding))}.m_93039a1d:where([data-with-thumb-indicator]):before{content:"";background-color:var(--switch-bg);border-radius:var(--switch-radius);width:40%;height:40%;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.m_93039a1d>*{margin:auto}.m_926b4011:checked+*>.m_93039a1d{--switch-thumb-start:calc(100% - var(--switch-thumb-size) - var(--switch-track-label-padding))}.m_926b4011:disabled+*>.m_93039a1d,.m_926b4011[data-disabled]+*>.m_93039a1d{--switch-thumb-bg:var(--switch-thumb-bg-disabled)}[data-mantine-color-scheme=light] .m_93039a1d{--switch-thumb-bg-disabled:var(--mantine-color-gray-0)}[data-mantine-color-scheme=dark] .m_93039a1d{--switch-thumb-bg-disabled:var(--mantine-color-dark-3)}.m_8277e082{height:100%;min-width:calc(var(--switch-width) - var(--switch-thumb-size));padding-inline:var(--switch-track-label-padding);place-content:center;margin-inline-start:calc(var(--switch-thumb-size) + var(--switch-track-label-padding));transition:margin .15s;display:grid}.m_926b4011:checked+*>.m_8277e082{margin-inline-start:0;margin-inline-end:calc(var(--switch-thumb-size) + var(--switch-track-label-padding))}.m_b23fa0ef{border-collapse:collapse;border-spacing:0;width:100%;line-height:var(--mantine-line-height);font-size:var(--mantine-font-size-sm);table-layout:var(--table-layout,auto);caption-side:var(--table-caption-side,bottom);border:none}:where([data-mantine-color-scheme=light]) .m_b23fa0ef{--table-hover-color:var(--mantine-color-gray-1);--table-striped-color:var(--mantine-color-gray-0);--table-border-color:var(--mantine-color-gray-3)}:where([data-mantine-color-scheme=dark]) .m_b23fa0ef{--table-hover-color:var(--mantine-color-dark-5);--table-striped-color:var(--mantine-color-dark-6);--table-border-color:var(--mantine-color-dark-4)}.m_b23fa0ef:where([data-with-table-border]){border:calc(.0625rem * var(--mantine-scale)) solid var(--table-border-color)}.m_b23fa0ef:where([data-tabular-nums]){font-variant-numeric:tabular-nums}.m_b23fa0ef:where([data-variant=vertical]) :where(.m_4e7aa4f3){font-weight:var(--mantine-font-weight-medium)}:where([data-mantine-color-scheme=light]) .m_b23fa0ef:where([data-variant=vertical]) :where(.m_4e7aa4f3){background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_b23fa0ef:where([data-variant=vertical]) :where(.m_4e7aa4f3){background-color:var(--mantine-color-dark-6)}.m_4e7aa4f3{text-align:left}:where([dir=rtl]) .m_4e7aa4f3{text-align:right}.m_4e7aa4fd{background-color:#0000;border-bottom:none}@media (hover:hover){.m_4e7aa4fd:hover:where([data-hover]){background-color:var(--tr-hover-bg)}}@media (hover:none){.m_4e7aa4fd:active:where([data-hover]){background-color:var(--tr-hover-bg)}}.m_4e7aa4fd:where([data-with-row-border]){border-bottom:calc(.0625rem * var(--mantine-scale)) solid var(--table-border-color)}.m_4e7aa4ef,.m_4e7aa4f3{padding:var(--table-vertical-spacing) var(--table-horizontal-spacing,var(--mantine-spacing-xs))}.m_4e7aa4ef:where([data-with-column-border]:not(:first-child)),.m_4e7aa4f3:where([data-with-column-border]:not(:first-child)){border-inline-start:calc(.0625rem * var(--mantine-scale)) solid var(--table-border-color)}.m_4e7aa4ef:where([data-with-column-border]:not(:last-child)),.m_4e7aa4f3:where([data-with-column-border]:not(:last-child)){border-inline-end:calc(.0625rem * var(--mantine-scale)) solid var(--table-border-color)}.m_b2404537>:where(tr):where([data-with-row-border]:last-of-type){border-bottom:none}.m_b2404537>:where(tr):where([data-striped=odd]:nth-of-type(odd)),.m_b2404537>:where(tr):where([data-striped=even]:nth-of-type(2n)){background-color:var(--table-striped-color)}.m_b2404537>:where(tr)[data-hover]{--tr-hover-bg:var(--table-highlight-on-hover-color,var(--table-hover-color))}.m_b242d975{top:var(--table-sticky-header-offset,0);z-index:3}.m_b242d975:where([data-sticky]){position:sticky}.m_b242d975:where([data-sticky]) :where(.m_4e7aa4f3){top:var(--table-sticky-header-offset,0);background-color:var(--mantine-color-body);position:sticky}:where([data-with-table-border]) .m_b242d975[data-sticky]{top:var(--table-sticky-header-offset,0);z-index:4;border-top:none;position:sticky}:where([data-with-table-border]) .m_b242d975[data-sticky]:before{content:"";left:0;top:calc(-.03125rem * var(--mantine-scale));width:100%;height:calc(.0625rem * var(--mantine-scale));background-color:var(--table-border-color);z-index:5;display:block;position:absolute}:where([data-with-table-border]) .m_b242d975[data-sticky] .m_4e7aa4f3:first-child{border-top:none}.m_9e5a3ac7{color:var(--mantine-color-dimmed)}.m_9e5a3ac7:where([data-side=top]){margin-bottom:var(--mantine-spacing-xs)}.m_9e5a3ac7:where([data-side=bottom]){margin-top:var(--mantine-spacing-xs)}.m_a100c15{overflow-x:var(--table-overflow)}.m_62259741{min-width:var(--table-min-width);max-height:var(--table-max-height)}.m_bcaa9990{--toc-depth-offset:.8em;flex-direction:column;display:flex}.m_375a65ef{font-size:var(--toc-size,var(--mantine-font-size-md));border-radius:var(--toc-radius,var(--mantine-radius-default));padding:.3em .8em;padding-left:max(calc(var(--depth-offset) * var(--toc-depth-offset)), .8em);display:block}@media (hover:hover){:where([data-mantine-color-scheme=light]) .m_375a65ef:where(:hover):where(:not([data-variant=none])){background-color:var(--mantine-color-gray-1)}:where([data-mantine-color-scheme=dark]) .m_375a65ef:where(:hover):where(:not([data-variant=none])){background-color:var(--mantine-color-dark-5)}}@media (hover:none){:where([data-mantine-color-scheme=light]) .m_375a65ef:where(:active):where(:not([data-variant=none])){background-color:var(--mantine-color-gray-1)}:where([data-mantine-color-scheme=dark]) .m_375a65ef:where(:active):where(:not([data-variant=none])){background-color:var(--mantine-color-dark-5)}}.m_375a65ef:where([data-active]){background-color:var(--toc-bg);color:var(--toc-color)}[data-mantine-color-scheme=light] .m_89d60db1{--tab-border-color:var(--mantine-color-gray-3)}[data-mantine-color-scheme=dark] .m_89d60db1{--tab-border-color:var(--mantine-color-dark-4)}.m_89d60db1{display:var(--tabs-display);flex-direction:var(--tabs-flex-direction);--tabs-list-direction:row;--tabs-panel-grow:unset;--tabs-display:block;--tabs-flex-direction:row;--tabs-list-border-width:0;--tabs-list-border-size:0 0 var(--tabs-list-border-width) 0;--tabs-list-gap:unset;--tabs-list-line-bottom:0;--tabs-list-line-top:unset;--tabs-list-line-start:0;--tabs-list-line-end:0;--tab-radius:var(--tabs-radius) var(--tabs-radius) 0 0;--tab-border-width:0 0 var(--tabs-list-border-width) 0}.m_89d60db1[data-inverted]{--tabs-list-line-bottom:unset;--tabs-list-line-top:0;--tab-radius:0 0 var(--tabs-radius) var(--tabs-radius);--tab-border-width:var(--tabs-list-border-width) 0 0 0}.m_89d60db1[data-inverted] .m_576c9d4:before{top:0;bottom:unset}.m_89d60db1[data-orientation=vertical]{--tabs-list-line-start:unset;--tabs-list-line-end:0;--tabs-list-line-top:0;--tabs-list-line-bottom:0;--tabs-list-border-size:0 var(--tabs-list-border-width) 0 0;--tab-border-width:0 var(--tabs-list-border-width) 0 0;--tab-radius:var(--tabs-radius) 0 0 var(--tabs-radius);--tabs-list-direction:column;--tabs-panel-grow:1;--tabs-display:flex}[dir=rtl] .m_89d60db1[data-orientation=vertical]{--tabs-list-border-size:0 0 0 var(--tabs-list-border-width);--tab-border-width:0 0 0 var(--tabs-list-border-width);--tab-radius:0 var(--tabs-radius) var(--tabs-radius) 0}.m_89d60db1[data-orientation=vertical][data-placement=right]{--tabs-flex-direction:row-reverse;--tabs-list-line-start:0;--tabs-list-line-end:unset;--tabs-list-border-size:0 0 0 var(--tabs-list-border-width);--tab-border-width:0 0 0 var(--tabs-list-border-width);--tab-radius:0 var(--tabs-radius) var(--tabs-radius) 0}[dir=rtl] .m_89d60db1[data-orientation=vertical][data-placement=right]{--tabs-list-border-size:0 var(--tabs-list-border-width) 0 0;--tab-border-width:0 var(--tabs-list-border-width) 0 0;--tab-radius:var(--tabs-radius) 0 0 var(--tabs-radius)}.m_89d60db1[data-variant=default]{--tabs-list-border-width:calc(.125rem * var(--mantine-scale))}[data-mantine-color-scheme=light] .m_89d60db1[data-variant=default]{--tab-hover-color:var(--mantine-color-gray-0)}[data-mantine-color-scheme=dark] .m_89d60db1[data-variant=default]{--tab-hover-color:var(--mantine-color-dark-6)}.m_89d60db1[data-variant=outline]{--tabs-list-border-width:calc(.0625rem * var(--mantine-scale))}.m_89d60db1[data-variant=pills]{--tabs-list-gap:calc(var(--mantine-spacing-sm) / 2)}[data-mantine-color-scheme=light] .m_89d60db1[data-variant=pills]{--tab-hover-color:var(--mantine-color-gray-0)}[data-mantine-color-scheme=dark] .m_89d60db1[data-variant=pills]{--tab-hover-color:var(--mantine-color-dark-6)}.m_89d33d6d{justify-content:var(--tabs-justify,flex-start);flex-wrap:wrap;flex-direction:var(--tabs-list-direction);gap:var(--tabs-list-gap);display:flex}.m_89d33d6d:where([data-grow]) .m_4ec4dce6{flex:1}.m_b0c91715{flex-grow:var(--tabs-panel-grow)}.m_4ec4dce6{padding:var(--mantine-spacing-xs) var(--mantine-spacing-md);font-size:var(--mantine-font-size-sm);white-space:nowrap;z-index:0;-webkit-user-select:none;user-select:none;align-items:center;line-height:1;display:flex;position:relative}.m_4ec4dce6:where(:disabled,[data-disabled]){opacity:.5;cursor:not-allowed}.m_4ec4dce6:focus{z-index:1}.m_fc420b1f{justify-content:center;align-items:center;display:flex}.m_fc420b1f:where([data-position=left]:not(:only-child)){margin-inline-end:var(--mantine-spacing-xs)}.m_fc420b1f:where([data-position=right]:not(:only-child)){margin-inline-start:var(--mantine-spacing-xs)}.m_42bbd1ae{text-align:center;flex:1}.m_576c9d4{position:relative}.m_576c9d4:before{content:"";border:1px solid var(--tab-border-color);bottom:var(--tabs-list-line-bottom);inset-inline-start:var(--tabs-list-line-start);inset-inline-end:var(--tabs-list-line-end);top:var(--tabs-list-line-top);position:absolute}.m_539e827b{border-radius:var(--tab-radius);border-width:var(--tab-border-width);background-color:#0000;border-style:solid;border-color:#0000}.m_539e827b:where([data-active]){border-color:var(--tabs-color)}@media (hover:hover){.m_539e827b:hover{background-color:var(--tab-hover-color)}.m_539e827b:hover:where(:not([data-active])){border-color:var(--tab-border-color)}}@media (hover:none){.m_539e827b:active{background-color:var(--tab-hover-color)}.m_539e827b:active:where(:not([data-active])){border-color:var(--tab-border-color)}}@media (hover:hover){.m_539e827b:disabled:hover,.m_539e827b[data-disabled]:hover{background-color:#0000}}@media (hover:none){.m_539e827b:disabled:active,.m_539e827b[data-disabled]:active{background-color:#0000}}.m_6772fbd5{position:relative}.m_6772fbd5:before{content:"";border-color:var(--tab-border-color);border-width:var(--tabs-list-border-size);bottom:var(--tabs-list-line-bottom);inset-inline-start:var(--tabs-list-line-start);inset-inline-end:var(--tabs-list-line-end);top:var(--tabs-list-line-top);border-style:solid;position:absolute}.m_b59ab47c{border-top:calc(.0625rem * var(--mantine-scale)) solid transparent;border-bottom:calc(.0625rem * var(--mantine-scale)) solid transparent;border-right:calc(.0625rem * var(--mantine-scale)) solid transparent;border-left:calc(.0625rem * var(--mantine-scale)) solid transparent;border-top-color:var(--tab-border-top-color);border-bottom-color:var(--tab-border-bottom-color);border-radius:var(--tab-radius);--tab-border-bottom-color:transparent;--tab-border-top-color:transparent;--tab-border-inline-end-color:transparent;--tab-border-inline-start-color:transparent;position:relative}.m_b59ab47c:where([data-active]):before{content:"";background-color:var(--tab-border-color);bottom:var(--tab-before-bottom,calc(-.0625rem * var(--mantine-scale)));left:var(--tab-before-left,calc(-.0625rem * var(--mantine-scale)));right:var(--tab-before-right,auto);top:var(--tab-before-top,auto);width:calc(.0625rem * var(--mantine-scale));height:calc(.0625rem * var(--mantine-scale));position:absolute}.m_b59ab47c:where([data-active]):after{content:"";background-color:var(--tab-border-color);bottom:var(--tab-after-bottom,calc(-.0625rem * var(--mantine-scale)));right:var(--tab-after-right,calc(-.0625rem * var(--mantine-scale)));left:var(--tab-after-left,auto);top:var(--tab-after-top,auto);width:calc(.0625rem * var(--mantine-scale));height:calc(.0625rem * var(--mantine-scale));position:absolute}.m_b59ab47c:where([data-active]){border-top-color:var(--tab-border-top-color);border-bottom-color:var(--tab-border-bottom-color);border-inline-start-color:var(--tab-border-inline-start-color);border-inline-end-color:var(--tab-border-inline-end-color);--tab-border-top-color:var(--tab-border-color);--tab-border-inline-start-color:var(--tab-border-color);--tab-border-inline-end-color:var(--tab-border-color);--tab-border-bottom-color:var(--mantine-color-body)}.m_b59ab47c:where([data-active])[data-inverted]{--tab-border-bottom-color:var(--tab-border-color);--tab-border-top-color:var(--mantine-color-body);--tab-before-bottom:auto;--tab-before-top:calc(-.0625rem * var(--mantine-scale));--tab-after-bottom:auto;--tab-after-top:calc(-.0625rem * var(--mantine-scale))}.m_b59ab47c:where([data-active])[data-orientation=vertical][data-placement=left]{--tab-border-inline-end-color:var(--mantine-color-body);--tab-border-inline-start-color:var(--tab-border-color);--tab-border-bottom-color:var(--tab-border-color);--tab-before-right:calc(-.0625rem * var(--mantine-scale));--tab-before-left:auto;--tab-before-bottom:auto;--tab-before-top:calc(-.0625rem * var(--mantine-scale));--tab-after-left:auto;--tab-after-right:calc(-.0625rem * var(--mantine-scale))}[dir=rtl] .m_b59ab47c:where([data-active])[data-orientation=vertical][data-placement=left]{--tab-before-right:auto;--tab-before-left:calc(-.0625rem * var(--mantine-scale));--tab-after-left:calc(-.0625rem * var(--mantine-scale));--tab-after-right:auto}.m_b59ab47c:where([data-active])[data-orientation=vertical][data-placement=right]{--tab-border-inline-start-color:var(--mantine-color-body);--tab-border-inline-end-color:var(--tab-border-color);--tab-border-bottom-color:var(--tab-border-color);--tab-before-left:calc(-.0625rem * var(--mantine-scale));--tab-before-right:auto;--tab-before-bottom:auto;--tab-before-top:calc(-.0625rem * var(--mantine-scale));--tab-after-right:auto;--tab-after-left:calc(-.0625rem * var(--mantine-scale))}[dir=rtl] .m_b59ab47c:where([data-active])[data-orientation=vertical][data-placement=right]{--tab-before-left:auto;--tab-before-right:calc(-.0625rem * var(--mantine-scale));--tab-after-right:calc(-.0625rem * var(--mantine-scale));--tab-after-left:auto}.m_c3381914{border-radius:var(--tabs-radius);background-color:var(--tab-bg);color:var(--tab-color);--tab-bg:transparent;--tab-color:inherit}@media (hover:hover){.m_c3381914:not([data-disabled]):hover{--tab-bg:var(--tab-hover-color)}}@media (hover:none){.m_c3381914:not([data-disabled]):active{--tab-bg:var(--tab-hover-color)}}.m_c3381914[data-active][data-active]{--tab-bg:var(--tabs-color);--tab-color:var(--tabs-text-color,var(--mantine-color-white))}@media (hover:hover){.m_c3381914[data-active][data-active]:hover{--tab-bg:var(--tabs-color)}}@media (hover:none){.m_c3381914[data-active][data-active]:active{--tab-bg:var(--tabs-color)}}.m_7341320d{--ti-size-xs:calc(1.125rem * var(--mantine-scale));--ti-size-sm:calc(1.375rem * var(--mantine-scale));--ti-size-md:calc(1.75rem * var(--mantine-scale));--ti-size-lg:calc(2.125rem * var(--mantine-scale));--ti-size-xl:calc(2.75rem * var(--mantine-scale));--ti-size:var(--ti-size-md);-webkit-user-select:none;user-select:none;width:var(--ti-size);height:var(--ti-size);min-width:var(--ti-size);min-height:var(--ti-size);border-radius:var(--ti-radius,var(--mantine-radius-default));background:var(--ti-bg,var(--mantine-primary-color-filled));color:var(--ti-color,var(--mantine-color-white));border:var(--ti-bd,1px solid transparent);justify-content:center;align-items:center;line-height:1;display:inline-flex;position:relative}.m_43657ece{--offset:calc(var(--tl-bullet-size) / 2 + var(--tl-line-width) / 2);--tl-bullet-size:calc(1.25rem * var(--mantine-scale));--tl-line-width:calc(.25rem * var(--mantine-scale));--tl-radius:calc(62.5rem * var(--mantine-scale));--tl-color:var(--mantine-primary-color-filled)}.m_43657ece:where([data-align=left]){padding-inline-start:var(--offset)}.m_43657ece:where([data-align=right]){padding-inline-end:var(--offset)}.m_2ebe8099{font-weight:var(--mantine-font-weight-medium);margin-bottom:calc(var(--mantine-spacing-xs) / 2);line-height:1}.m_436178ff{--item-border:var(--tl-line-width) var(--tli-border-style,solid) var(--item-border-color);color:var(--mantine-color-text);position:relative}.m_436178ff:before{content:"";pointer-events:none;top:0;left:var(--timeline-line-left,0);right:var(--timeline-line-right,0);bottom:calc(var(--mantine-spacing-xl) * -1);border-inline-start:var(--item-border);display:var(--timeline-line-display,none);position:absolute}.m_43657ece[data-align=left] .m_436178ff:before{--timeline-line-left:calc(var(--tl-line-width) * -1);--timeline-line-right:auto}[dir=rtl] .m_43657ece[data-align=left] .m_436178ff:before,.m_43657ece[data-align=right] .m_436178ff:before{--timeline-line-left:auto;--timeline-line-right:calc(var(--tl-line-width) * -1)}[dir=rtl] .m_43657ece[data-align=right] .m_436178ff:before{--timeline-line-left:calc(var(--tl-line-width) * -1);--timeline-line-right:auto}.m_43657ece:where([data-align=left]) .m_436178ff{text-align:left;padding-inline-start:var(--offset)}.m_43657ece:where([data-align=right]) .m_436178ff{text-align:right;padding-inline-end:var(--offset)}:where([data-mantine-color-scheme=light]) .m_436178ff{--item-border-color:var(--mantine-color-gray-3)}:where([data-mantine-color-scheme=dark]) .m_436178ff{--item-border-color:var(--mantine-color-dark-4)}.m_436178ff:where([data-line-active]):before{border-color:var(--tli-color,var(--tl-color))}.m_436178ff:where(:not(:last-of-type)){--timeline-line-display:block}.m_436178ff:where(:not(:first-of-type)){margin-top:var(--mantine-spacing-xl)}.m_8affcee1{width:var(--tl-bullet-size);height:var(--tl-bullet-size);border-radius:var(--tli-radius,var(--tl-radius));border:var(--tl-line-width) solid;background-color:var(--mantine-color-body);color:var(--mantine-color-text);justify-content:center;align-items:center;display:flex;position:absolute;top:0}:where([data-mantine-color-scheme=light]) .m_8affcee1{border-color:var(--mantine-color-gray-3)}:where([data-mantine-color-scheme=dark]) .m_8affcee1{border-color:var(--mantine-color-dark-4)}.m_43657ece:where([data-align=left]) .m_8affcee1{left:calc((var(--tl-bullet-size) / 2 + var(--tl-line-width) / 2) * -1);right:auto}:where([dir=rtl]) .m_43657ece:where([data-align=left]) .m_8affcee1,.m_43657ece:where([data-align=right]) .m_8affcee1{left:auto;right:calc((var(--tl-bullet-size) / 2 + var(--tl-line-width) / 2) * -1)}:where([dir=rtl]) .m_43657ece:where([data-align=right]) .m_8affcee1{left:calc((var(--tl-bullet-size) / 2 + var(--tl-line-width) / 2) * -1);right:auto}.m_8affcee1:where([data-with-child]){border-width:var(--tl-line-width)}:where([data-mantine-color-scheme=light]) .m_8affcee1:where([data-with-child]){background-color:var(--mantine-color-gray-3)}:where([data-mantine-color-scheme=dark]) .m_8affcee1:where([data-with-child]){background-color:var(--mantine-color-dark-4)}.m_8affcee1:where([data-active]){border-color:var(--tli-color,var(--tl-color));background-color:var(--mantine-color-white);color:var(--tl-icon-color,var(--mantine-color-white))}.m_8affcee1:where([data-active]):where([data-with-child]){background-color:var(--tli-color,var(--tl-color));color:var(--tl-icon-color,var(--mantine-color-white))}.m_43657ece:where([data-align=left]) .m_540e8f41{text-align:left;padding-inline-start:var(--offset)}:where([dir=rtl]) .m_43657ece:where([data-align=left]) .m_540e8f41{text-align:right}.m_43657ece:where([data-align=right]) .m_540e8f41{text-align:right;padding-inline-end:var(--offset)}:where([dir=rtl]) .m_43657ece:where([data-align=right]) .m_540e8f41{text-align:left}.m_8a5d1357{font-weight:var(--title-fw);font-size:var(--title-fz);line-height:var(--title-lh);font-family:var(--mantine-font-family-headings);text-wrap:var(--title-text-wrap,var(--mantine-heading-text-wrap));margin:0}.m_8a5d1357:where([data-line-clamp]){text-overflow:ellipsis;-webkit-line-clamp:var(--title-line-clamp);-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.m_f698e191{--level-offset:var(--mantine-spacing-lg);--tree-line-width:calc(.0625rem * var(--mantine-scale));--tree-line-color:var(--mantine-color-default-border);-webkit-user-select:none;user-select:none;margin:0;padding:0}.m_75f3ecf{margin:0;padding:0}.m_f6970eb1{cursor:pointer;outline:0;margin:0;padding:0;list-style:none}.m_f6970eb1:focus-visible>.m_dc283425{outline:2px solid var(--mantine-primary-color-filled);outline-offset:calc(.125rem * var(--mantine-scale))}.m_dc283425{padding-inline-start:var(--label-offset);position:relative}:where([data-mantine-color-scheme=light]) .m_dc283425:where([data-selected]){background-color:var(--mantine-color-gray-1)}:where([data-mantine-color-scheme=dark]) .m_dc283425:where([data-selected]){background-color:var(--mantine-color-dark-5)}.m_dc283425:where([data-dragging]){opacity:.4}.m_dc283425:where([data-drag-over=before]):before{content:"";top:calc(-.0625rem * var(--mantine-scale));height:calc(.125rem * var(--mantine-scale));background-color:var(--mantine-primary-color-filled);pointer-events:none;z-index:1;position:absolute;inset-inline-start:var(--label-offset,0);inset-inline-end:0}.m_dc283425:where([data-drag-over=after]):after{content:"";bottom:calc(-.0625rem * var(--mantine-scale));height:calc(.125rem * var(--mantine-scale));background-color:var(--mantine-primary-color-filled);pointer-events:none;z-index:1;position:absolute;inset-inline-start:var(--label-offset,0);inset-inline-end:0}.m_dc283425:where([data-drag-over=inside]){background-color:var(--mantine-primary-color-light)}:where([data-with-lines]) .m_f6970eb1{position:relative}:where([data-with-lines]) .m_75f3ecf>.m_f6970eb1:before{content:"";top:calc(.75rem * var(--mantine-scale));width:calc(var(--level-offset) / 2);border-top:var(--tree-line-width) solid var(--tree-line-color);pointer-events:none;height:0;position:absolute;inset-inline-start:calc(var(--label-offset) - var(--level-offset) / 2)}:where([data-with-lines]) .m_75f3ecf>.m_f6970eb1:after{content:"";top:0;bottom:0;border-inline-start:var(--tree-line-width) solid var(--tree-line-color);pointer-events:none;width:0;position:absolute;inset-inline-start:calc(var(--label-offset) - var(--level-offset) / 2)}:where([data-with-lines]) .m_75f3ecf>.m_f6970eb1:last-child:after{height:calc(.75rem * var(--mantine-scale));bottom:auto}.m_d08caa0 :first-child{margin-top:0}.m_d08caa0 :last-child{margin-bottom:0}.m_d08caa0 :where(h1,h2,h3,h4,h5,h6){margin-bottom:var(--mantine-spacing-xs);text-wrap:var(--mantine-heading-text-wrap);font-family:var(--mantine-font-family-headings)}.m_d08caa0 :where(h1){margin-top:calc(1.5 * var(--mantine-spacing-xl));font-size:var(--mantine-h1-font-size);line-height:var(--mantine-h1-line-height);font-weight:var(--mantine-h1-font-weight)}.m_d08caa0 :where(h2){margin-top:var(--mantine-spacing-xl);font-size:var(--mantine-h2-font-size);line-height:var(--mantine-h2-line-height);font-weight:var(--mantine-h2-font-weight)}.m_d08caa0 :where(h3){margin-top:calc(.8 * var(--mantine-spacing-xl));font-size:var(--mantine-h3-font-size);line-height:var(--mantine-h3-line-height);font-weight:var(--mantine-h3-font-weight)}.m_d08caa0 :where(h4){margin-top:calc(.8 * var(--mantine-spacing-xl));font-size:var(--mantine-h4-font-size);line-height:var(--mantine-h4-line-height);font-weight:var(--mantine-h4-font-weight)}.m_d08caa0 :where(h5){margin-top:calc(.5 * var(--mantine-spacing-xl));font-size:var(--mantine-h5-font-size);line-height:var(--mantine-h5-line-height);font-weight:var(--mantine-h5-font-weight)}.m_d08caa0 :where(h6){margin-top:calc(.5 * var(--mantine-spacing-xl));font-size:var(--mantine-h6-font-size);line-height:var(--mantine-h6-line-height);font-weight:var(--mantine-h6-font-weight)}.m_d08caa0 :where(img){max-width:100%;margin-bottom:var(--mantine-spacing-xs)}.m_d08caa0 :where(p){margin-top:0;margin-bottom:var(--mantine-spacing-lg)}:where([data-mantine-color-scheme=light]) .m_d08caa0 :where(mark){background-color:var(--mantine-color-yellow-2);color:inherit}:where([data-mantine-color-scheme=dark]) .m_d08caa0 :where(mark){background-color:var(--mantine-color-yellow-5);color:var(--mantine-color-black)}.m_d08caa0 :where(a){color:var(--mantine-color-anchor);text-decoration:none}@media (hover:hover){.m_d08caa0 :where(a):hover{text-decoration:underline}}@media (hover:none){.m_d08caa0 :where(a):active{text-decoration:underline}}.m_d08caa0 :where(hr){margin-top:var(--mantine-spacing-md);margin-bottom:var(--mantine-spacing-md);border:0;border-top:calc(.0625rem * var(--mantine-scale)) solid}:where([data-mantine-color-scheme=light]) .m_d08caa0 :where(hr){border-color:var(--mantine-color-gray-3)}:where([data-mantine-color-scheme=dark]) .m_d08caa0 :where(hr){border-color:var(--mantine-color-dark-3)}.m_d08caa0 :where(pre){padding:var(--mantine-spacing-xs);line-height:var(--mantine-line-height);margin:0;margin-top:var(--mantine-spacing-md);margin-bottom:var(--mantine-spacing-md);font-family:var(--mantine-font-family-monospace);font-size:var(--mantine-font-size-xs);border-radius:var(--mantine-radius-sm);overflow-x:auto}:where([data-mantine-color-scheme=light]) .m_d08caa0 :where(pre){background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_d08caa0 :where(pre){background-color:var(--mantine-color-dark-8)}.m_d08caa0 :where(pre) :where(code){color:inherit;background-color:#0000;border:0;border-radius:0;padding:0}.m_d08caa0 :where(kbd){--kbd-fz:calc(.75rem * var(--mantine-scale));--kbd-padding:calc(.1875rem * var(--mantine-scale)) calc(.3125rem * var(--mantine-scale));font-family:var(--mantine-font-family-monospace);line-height:var(--mantine-line-height);font-weight:var(--mantine-font-weight-bold);padding:var(--kbd-padding);font-size:var(--kbd-fz);border-radius:var(--mantine-radius-sm);border:calc(.0625rem * var(--mantine-scale)) solid;border-bottom-width:calc(.1875rem * var(--mantine-scale))}:where([data-mantine-color-scheme=light]) .m_d08caa0 :where(kbd){border-color:var(--mantine-color-gray-3);color:var(--mantine-color-gray-7);background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_d08caa0 :where(kbd){border-color:var(--mantine-color-dark-3);color:var(--mantine-color-dark-0);background-color:var(--mantine-color-dark-5)}.m_d08caa0 :where(code){line-height:var(--mantine-line-height);padding:calc(.0625rem * var(--mantine-scale)) calc(.3125rem * var(--mantine-scale));border-radius:var(--mantine-radius-sm);font-family:var(--mantine-font-family-monospace);font-size:var(--mantine-font-size-xs)}:where([data-mantine-color-scheme=light]) .m_d08caa0 :where(code){background-color:var(--mantine-color-gray-0);color:var(--mantine-color-black)}:where([data-mantine-color-scheme=dark]) .m_d08caa0 :where(code){background-color:var(--mantine-color-dark-5);color:var(--mantine-color-white)}.m_d08caa0 :where(ul,ol):not([data-type=taskList]){margin-bottom:var(--mantine-spacing-md);padding-inline-start:var(--mantine-spacing-xl);list-style-position:outside}.m_d08caa0 :where(table){border-collapse:collapse;caption-side:bottom;width:100%;margin-bottom:var(--mantine-spacing-md)}:where([data-mantine-color-scheme=light]) .m_d08caa0 :where(table){--table-border-color:var(--mantine-color-gray-3)}:where([data-mantine-color-scheme=dark]) .m_d08caa0 :where(table){--table-border-color:var(--mantine-color-dark-4)}.m_d08caa0 :where(table) :where(caption){margin-top:var(--mantine-spacing-xs);font-size:var(--mantine-font-size-sm);color:var(--mantine-color-dimmed)}.m_d08caa0 :where(table) :where(th){text-align:left;font-weight:700;font-size:var(--mantine-font-size-sm);padding:var(--mantine-spacing-xs) var(--mantine-spacing-sm)}.m_d08caa0 :where(table) :where(thead th){border-bottom:calc(.0625rem * var(--mantine-scale)) solid;border-color:var(--table-border-color)}.m_d08caa0 :where(table) :where(tfoot th){border-top:calc(.0625rem * var(--mantine-scale)) solid;border-color:var(--table-border-color)}.m_d08caa0 :where(table) :where(td){padding:var(--mantine-spacing-xs) var(--mantine-spacing-sm);border-bottom:calc(.0625rem * var(--mantine-scale)) solid;border-color:var(--table-border-color);font-size:var(--mantine-font-size-sm)}.m_d08caa0 :where(table) :where(tr:last-of-type td){border-bottom:0}.m_d08caa0 :where(blockquote){font-size:var(--mantine-font-size-lg);line-height:var(--mantine-line-height);margin:var(--mantine-spacing-md) 0;border-radius:var(--mantine-radius-sm);padding:var(--mantine-spacing-md) var(--mantine-spacing-lg)}:where([data-mantine-color-scheme=light]) .m_d08caa0 :where(blockquote){background-color:var(--mantine-color-gray-0)}:where([data-mantine-color-scheme=dark]) .m_d08caa0 :where(blockquote){background-color:var(--mantine-color-dark-8)}.experimentButtons{text-wrap:nowrap;flex-flow:row;justify-content:right;gap:20px;width:fit-content;margin-left:auto;display:flex}.MoleculeEdit{height:100%;display:flex}.MoleculeEditWrapper{background-color:var(--mantine-color-secondary-filled);min-width:0;min-height:0;flex:1!important;display:flex!important}.MoleculeEditLineNumber{height:100%;padding-top:calc(1px + var(--input-padding-y,0rem));padding-bottom:calc(1px + var(--input-padding-y,0rem));letter-spacing:0;white-space:pre-line;scrollbar-width:none;overscroll-behavior:none;cursor:default;font-family:Fira Code,Courier New,Courier,monospace;font-size:14px;line-height:1.5;overflow:scroll}.MoleculeEditInput{letter-spacing:0;white-space:pre;word-wrap:normal;overscroll-behavior:none;background-color:var(--mantine-color-secondary-filled);font-family:Fira Code,Courier New,Courier,monospace;font-size:14px;line-height:1.5;overflow:auto;border-radius:0!important}.Separator{width:10px}.moleculeInput{height:250px}.moleculeInputWrapper,.moleculeInputWrapper>*{height:100%}.tabPanel{border-left:1px solid var(--tab-border-color);border-right:1px solid var(--tab-border-color);border-bottom:1px solid var(--tab-border-color);padding:10px;flex:1!important}.moleculeViewer{box-sizing:border-box;overscroll-behavior:contain;touch-action:none;width:100%;min-width:0;height:100%;position:relative;overflow:auto}.atomEditor{border-radius:md;position:absolute;top:10px;right:10px}.atomEditor *{width:100%;height:auto}
/*$vite$:1*/</style>
</head>
<body>
<div id="root"></div>
</body>
</html>