var Fq=Object.defineProperty;var Dk=n=>{throw TypeError(n)};var Uq=(n,e,t)=>e in n?Fq(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Ci=(n,e,t)=>Uq(n,typeof e!="symbol"?e+"":e,t),DT=(n,e,t)=>e.has(n)||Dk("Cannot "+t);var Ve=(n,e,t)=>(DT(n,e,"read from private field"),t?t.call(n):e.get(n)),zn=(n,e,t)=>e.has(n)?Dk("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),ln=(n,e,t,i)=>(DT(n,e,"write to private field"),i?i.call(n,t):e.set(n,t),t),zr=(n,e,t)=>(DT(n,e,"access private method"),t);var L_=(n,e,t,i)=>({set _(r){ln(n,e,r,t)},get _(){return Ve(n,e,i)}});function Vq(n,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in n)){const s=Object.getOwnPropertyDescriptor(i,r);s&&Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();function KR(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var sV={exports:{}},XE={},oV={exports:{}},wn={};/**
 * @license React
 * react.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Q0=Symbol.for("react.element"),zq=Symbol.for("react.portal"),Hq=Symbol.for("react.fragment"),Gq=Symbol.for("react.strict_mode"),jq=Symbol.for("react.profiler"),Wq=Symbol.for("react.provider"),Kq=Symbol.for("react.context"),Xq=Symbol.for("react.forward_ref"),qq=Symbol.for("react.suspense"),Yq=Symbol.for("react.memo"),$q=Symbol.for("react.lazy"),Lk=Symbol.iterator;function Jq(n){return n===null||typeof n!="object"?null:(n=Lk&&n[Lk]||n["@@iterator"],typeof n=="function"?n:null)}var aV={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},lV=Object.assign,cV={};function bm(n,e,t){this.props=n,this.context=e,this.refs=cV,this.updater=t||aV}bm.prototype.isReactComponent={};bm.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,e,"setState")};bm.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function uV(){}uV.prototype=bm.prototype;function XR(n,e,t){this.props=n,this.context=e,this.refs=cV,this.updater=t||aV}var qR=XR.prototype=new uV;qR.constructor=XR;lV(qR,bm.prototype);qR.isPureReactComponent=!0;var kk=Array.isArray,hV=Object.prototype.hasOwnProperty,YR={current:null},dV={key:!0,ref:!0,__self:!0,__source:!0};function fV(n,e,t){var i,r={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)hV.call(e,i)&&!dV.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(a===1)r.children=t;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];r.children=l}if(n&&n.defaultProps)for(i in a=n.defaultProps,a)r[i]===void 0&&(r[i]=a[i]);return{$$typeof:Q0,type:n,key:s,ref:o,props:r,_owner:YR.current}}function Qq(n,e){return{$$typeof:Q0,type:n.type,key:e,ref:n.ref,props:n.props,_owner:n._owner}}function $R(n){return typeof n=="object"&&n!==null&&n.$$typeof===Q0}function Zq(n){var e={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(t){return e[t]})}var Bk=/\/+/g;function LT(n,e){return typeof n=="object"&&n!==null&&n.key!=null?Zq(""+n.key):e.toString(36)}function fw(n,e,t,i,r){var s=typeof n;(s==="undefined"||s==="boolean")&&(n=null);var o=!1;if(n===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(n.$$typeof){case Q0:case zq:o=!0}}if(o)return o=n,r=r(o),n=i===""?"."+LT(o,0):i,kk(r)?(t="",n!=null&&(t=n.replace(Bk,"$&/")+"/"),fw(r,e,t,"",function(c){return c})):r!=null&&($R(r)&&(r=Qq(r,t+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(Bk,"$&/")+"/")+n)),e.push(r)),1;if(o=0,i=i===""?".":i+":",kk(n))for(var a=0;a<n.length;a++){s=n[a];var l=i+LT(s,a);o+=fw(s,e,t,l,r)}else if(l=Jq(n),typeof l=="function")for(n=l.call(n),a=0;!(s=n.next()).done;)s=s.value,l=i+LT(s,a++),o+=fw(s,e,t,l,r);else if(s==="object")throw e=String(n),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function k_(n,e,t){if(n==null)return n;var i=[],r=0;return fw(n,i,"","",function(s){return e.call(t,s,r++)}),i}function eY(n){if(n._status===-1){var e=n._result;e=e(),e.then(function(t){(n._status===0||n._status===-1)&&(n._status=1,n._result=t)},function(t){(n._status===0||n._status===-1)&&(n._status=2,n._result=t)}),n._status===-1&&(n._status=0,n._result=e)}if(n._status===1)return n._result.default;throw n._result}var Ts={current:null},pw={transition:null},tY={ReactCurrentDispatcher:Ts,ReactCurrentBatchConfig:pw,ReactCurrentOwner:YR};function pV(){throw Error("act(...) is not supported in production builds of React.")}wn.Children={map:k_,forEach:function(n,e,t){k_(n,function(){e.apply(this,arguments)},t)},count:function(n){var e=0;return k_(n,function(){e++}),e},toArray:function(n){return k_(n,function(e){return e})||[]},only:function(n){if(!$R(n))throw Error("React.Children.only expected to receive a single React element child.");return n}};wn.Component=bm;wn.Fragment=Hq;wn.Profiler=jq;wn.PureComponent=XR;wn.StrictMode=Gq;wn.Suspense=qq;wn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=tY;wn.act=pV;wn.cloneElement=function(n,e,t){if(n==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+n+".");var i=lV({},n.props),r=n.key,s=n.ref,o=n._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=YR.current),e.key!==void 0&&(r=""+e.key),n.type&&n.type.defaultProps)var a=n.type.defaultProps;for(l in e)hV.call(e,l)&&!dV.hasOwnProperty(l)&&(i[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)i.children=t;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];i.children=a}return{$$typeof:Q0,type:n.type,key:r,ref:s,props:i,_owner:o}};wn.createContext=function(n){return n={$$typeof:Kq,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},n.Provider={$$typeof:Wq,_context:n},n.Consumer=n};wn.createElement=fV;wn.createFactory=function(n){var e=fV.bind(null,n);return e.type=n,e};wn.createRef=function(){return{current:null}};wn.forwardRef=function(n){return{$$typeof:Xq,render:n}};wn.isValidElement=$R;wn.lazy=function(n){return{$$typeof:$q,_payload:{_status:-1,_result:n},_init:eY}};wn.memo=function(n,e){return{$$typeof:Yq,type:n,compare:e===void 0?null:e}};wn.startTransition=function(n){var e=pw.transition;pw.transition={};try{n()}finally{pw.transition=e}};wn.unstable_act=pV;wn.useCallback=function(n,e){return Ts.current.useCallback(n,e)};wn.useContext=function(n){return Ts.current.useContext(n)};wn.useDebugValue=function(){};wn.useDeferredValue=function(n){return Ts.current.useDeferredValue(n)};wn.useEffect=function(n,e){return Ts.current.useEffect(n,e)};wn.useId=function(){return Ts.current.useId()};wn.useImperativeHandle=function(n,e,t){return Ts.current.useImperativeHandle(n,e,t)};wn.useInsertionEffect=function(n,e){return Ts.current.useInsertionEffect(n,e)};wn.useLayoutEffect=function(n,e){return Ts.current.useLayoutEffect(n,e)};wn.useMemo=function(n,e){return Ts.current.useMemo(n,e)};wn.useReducer=function(n,e,t){return Ts.current.useReducer(n,e,t)};wn.useRef=function(n){return Ts.current.useRef(n)};wn.useState=function(n){return Ts.current.useState(n)};wn.useSyncExternalStore=function(n,e,t){return Ts.current.useSyncExternalStore(n,e,t)};wn.useTransition=function(){return Ts.current.useTransition()};wn.version="18.3.1";oV.exports=wn;var V=oV.exports;const at=KR(V),mV=Vq({__proto__:null,default:at},[V]);/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var nY=V,iY=Symbol.for("react.element"),rY=Symbol.for("react.fragment"),sY=Object.prototype.hasOwnProperty,oY=nY.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,aY={key:!0,ref:!0,__self:!0,__source:!0};function gV(n,e,t){var i,r={},s=null,o=null;t!==void 0&&(s=""+t),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(i in e)sY.call(e,i)&&!aY.hasOwnProperty(i)&&(r[i]=e[i]);if(n&&n.defaultProps)for(i in e=n.defaultProps,e)r[i]===void 0&&(r[i]=e[i]);return{$$typeof:iY,type:n,key:s,ref:o,props:r,_owner:oY.current}}XE.Fragment=rY;XE.jsx=gV;XE.jsxs=gV;sV.exports=XE;var S=sV.exports,yV={exports:{}},go={},vV={exports:{}},_V={};/**
 * @license React
 * scheduler.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(n){function e(G,$){var te=G.length;G.push($);e:for(;0<te;){var ue=te-1>>>1,ve=G[ue];if(0<r(ve,$))G[ue]=$,G[te]=ve,te=ue;else break e}}function t(G){return G.length===0?null:G[0]}function i(G){if(G.length===0)return null;var $=G[0],te=G.pop();if(te!==$){G[0]=te;e:for(var ue=0,ve=G.length,be=ve>>>1;ue<be;){var he=2*(ue+1)-1,Pe=G[he],Oe=he+1,Ce=G[Oe];if(0>r(Pe,te))Oe<ve&&0>r(Ce,Pe)?(G[ue]=Ce,G[Oe]=te,ue=Oe):(G[ue]=Pe,G[he]=te,ue=he);else if(Oe<ve&&0>r(Ce,te))G[ue]=Ce,G[Oe]=te,ue=Oe;else break e}}return $}function r(G,$){var te=G.sortIndex-$.sortIndex;return te!==0?te:G.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,h=null,f=3,m=!1,y=!1,_=!1,v=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function A(G){for(var $=t(c);$!==null;){if($.callback===null)i(c);else if($.startTime<=G)i(c),$.sortIndex=$.expirationTime,e(l,$);else break;$=t(c)}}function T(G){if(_=!1,A(G),!y)if(t(l)!==null)y=!0,ie(L);else{var $=t(c);$!==null&&de(T,$.startTime-G)}}function L(G,$){y=!1,_&&(_=!1,g(I),I=-1),m=!0;var te=f;try{for(A($),h=t(l);h!==null&&(!(h.expirationTime>$)||G&&!k());){var ue=h.callback;if(typeof ue=="function"){h.callback=null,f=h.priorityLevel;var ve=ue(h.expirationTime<=$);$=n.unstable_now(),typeof ve=="function"?h.callback=ve:h===t(l)&&i(l),A($)}else i(l);h=t(l)}if(h!==null)var be=!0;else{var he=t(c);he!==null&&de(T,he.startTime-$),be=!1}return be}finally{h=null,f=te,m=!1}}var D=!1,R=null,I=-1,M=5,C=-1;function k(){return!(n.unstable_now()-C<M)}function B(){if(R!==null){var G=n.unstable_now();C=G;var $=!0;try{$=R(!0,G)}finally{$?O():(D=!1,R=null)}}else D=!1}var O;if(typeof w=="function")O=function(){w(B)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,le=X.port2;X.port1.onmessage=B,O=function(){le.postMessage(null)}}else O=function(){v(B,0)};function ie(G){R=G,D||(D=!0,O())}function de(G,$){I=v(function(){G(n.unstable_now())},$)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(G){G.callback=null},n.unstable_continueExecution=function(){y||m||(y=!0,ie(L))},n.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<G?Math.floor(1e3/G):5},n.unstable_getCurrentPriorityLevel=function(){return f},n.unstable_getFirstCallbackNode=function(){return t(l)},n.unstable_next=function(G){switch(f){case 1:case 2:case 3:var $=3;break;default:$=f}var te=f;f=$;try{return G()}finally{f=te}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(G,$){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var te=f;f=G;try{return $()}finally{f=te}},n.unstable_scheduleCallback=function(G,$,te){var ue=n.unstable_now();switch(typeof te=="object"&&te!==null?(te=te.delay,te=typeof te=="number"&&0<te?ue+te:ue):te=ue,G){case 1:var ve=-1;break;case 2:ve=250;break;case 5:ve=1073741823;break;case 4:ve=1e4;break;default:ve=5e3}return ve=te+ve,G={id:u++,callback:$,priorityLevel:G,startTime:te,expirationTime:ve,sortIndex:-1},te>ue?(G.sortIndex=te,e(c,G),t(l)===null&&G===t(c)&&(_?(g(I),I=-1):_=!0,de(T,te-ue))):(G.sortIndex=ve,e(l,G),y||m||(y=!0,ie(L))),G},n.unstable_shouldYield=k,n.unstable_wrapCallback=function(G){var $=f;return function(){var te=f;f=$;try{return G.apply(this,arguments)}finally{f=te}}}})(_V);vV.exports=_V;var lY=vV.exports;/**
 * @license React
 * react-dom.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var cY=V,po=lY;function Qe(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t]);return"Minified React error #"+n+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var xV=new Set,Yy={};function Wd(n,e){qp(n,e),qp(n+"Capture",e)}function qp(n,e){for(Yy[n]=e,n=0;n<e.length;n++)xV.add(e[n])}var Ql=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ZC=Object.prototype.hasOwnProperty,uY=/^[: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]*$/,Ok={},Fk={};function hY(n){return ZC.call(Fk,n)?!0:ZC.call(Ok,n)?!1:uY.test(n)?Fk[n]=!0:(Ok[n]=!0,!1)}function dY(n,e,t,i){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function fY(n,e,t,i){if(e===null||typeof e>"u"||dY(n,e,t,i))return!0;if(i)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function bs(n,e,t,i,r,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Nr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){Nr[n]=new bs(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];Nr[e]=new bs(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){Nr[n]=new bs(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){Nr[n]=new bs(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){Nr[n]=new bs(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){Nr[n]=new bs(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){Nr[n]=new bs(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){Nr[n]=new bs(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){Nr[n]=new bs(n,5,!1,n.toLowerCase(),null,!1,!1)});var JR=/[\-:]([a-z])/g;function QR(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var e=n.replace(JR,QR);Nr[e]=new bs(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(JR,QR);Nr[e]=new bs(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(JR,QR);Nr[e]=new bs(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){Nr[n]=new bs(n,1,!1,n.toLowerCase(),null,!1,!1)});Nr.xlinkHref=new bs("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){Nr[n]=new bs(n,1,!1,n.toLowerCase(),null,!0,!0)});function ZR(n,e,t,i){var r=Nr.hasOwnProperty(e)?Nr[e]:null;(r!==null?r.type!==0:i||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(fY(e,t,r,i)&&(t=null),i||r===null?hY(e)&&(t===null?n.removeAttribute(e):n.setAttribute(e,""+t)):r.mustUseProperty?n[r.propertyName]=t===null?r.type===3?!1:"":t:(e=r.attributeName,i=r.attributeNamespace,t===null?n.removeAttribute(e):(r=r.type,t=r===3||r===4&&t===!0?"":""+t,i?n.setAttributeNS(i,e,t):n.setAttribute(e,t))))}var dc=cY.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,B_=Symbol.for("react.element"),Jf=Symbol.for("react.portal"),Qf=Symbol.for("react.fragment"),eP=Symbol.for("react.strict_mode"),eM=Symbol.for("react.profiler"),wV=Symbol.for("react.provider"),EV=Symbol.for("react.context"),tP=Symbol.for("react.forward_ref"),tM=Symbol.for("react.suspense"),nM=Symbol.for("react.suspense_list"),nP=Symbol.for("react.memo"),Hc=Symbol.for("react.lazy"),AV=Symbol.for("react.offscreen"),Uk=Symbol.iterator;function xg(n){return n===null||typeof n!="object"?null:(n=Uk&&n[Uk]||n["@@iterator"],typeof n=="function"?n:null)}var Ti=Object.assign,kT;function Zg(n){if(kT===void 0)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);kT=e&&e[1]||""}return`
`+kT+n}var BT=!1;function OT(n,e){if(!n||BT)return"";BT=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(c){var i=c}Reflect.construct(n,[],e)}else{try{e.call()}catch(c){i=c}n.call(e.prototype)}else{try{throw Error()}catch(c){i=c}n()}}catch(c){if(c&&i&&typeof c.stack=="string"){for(var r=c.stack.split(`
`),s=i.stack.split(`
`),o=r.length-1,a=s.length-1;1<=o&&0<=a&&r[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(r[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||r[o]!==s[a]){var l=`
`+r[o].replace(" at new "," at ");return n.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{BT=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?Zg(n):""}function pY(n){switch(n.tag){case 5:return Zg(n.type);case 16:return Zg("Lazy");case 13:return Zg("Suspense");case 19:return Zg("SuspenseList");case 0:case 2:case 15:return n=OT(n.type,!1),n;case 11:return n=OT(n.type.render,!1),n;case 1:return n=OT(n.type,!0),n;default:return""}}function iM(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case Qf:return"Fragment";case Jf:return"Portal";case eM:return"Profiler";case eP:return"StrictMode";case tM:return"Suspense";case nM:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case EV:return(n.displayName||"Context")+".Consumer";case wV:return(n._context.displayName||"Context")+".Provider";case tP:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case nP:return e=n.displayName||null,e!==null?e:iM(n.type)||"Memo";case Hc:e=n._payload,n=n._init;try{return iM(n(e))}catch{}}return null}function mY(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return iM(e);case 8:return e===eP?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Tu(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function SV(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function gY(n){var e=SV(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var r=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function O_(n){n._valueTracker||(n._valueTracker=gY(n))}function TV(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=SV(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function qw(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function rM(n,e){var t=e.checked;return Ti({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function Vk(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=Tu(e.value!=null?e.value:t),n._wrapperState={initialChecked:i,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function bV(n,e){e=e.checked,e!=null&&ZR(n,"checked",e,!1)}function sM(n,e){bV(n,e);var t=Tu(e.value),i=e.type;if(t!=null)i==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(i==="submit"||i==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?oM(n,e.type,t):e.hasOwnProperty("defaultValue")&&oM(n,e.type,Tu(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function zk(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function oM(n,e,t){(e!=="number"||qw(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var ey=Array.isArray;function wp(n,e,t,i){if(n=n.options,e){e={};for(var r=0;r<t.length;r++)e["$"+t[r]]=!0;for(t=0;t<n.length;t++)r=e.hasOwnProperty("$"+n[t].value),n[t].selected!==r&&(n[t].selected=r),r&&i&&(n[t].defaultSelected=!0)}else{for(t=""+Tu(t),e=null,r=0;r<n.length;r++){if(n[r].value===t){n[r].selected=!0,i&&(n[r].defaultSelected=!0);return}e!==null||n[r].disabled||(e=n[r])}e!==null&&(e.selected=!0)}}function aM(n,e){if(e.dangerouslySetInnerHTML!=null)throw Error(Qe(91));return Ti({},e,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function Hk(n,e){var t=e.value;if(t==null){if(t=e.children,e=e.defaultValue,t!=null){if(e!=null)throw Error(Qe(92));if(ey(t)){if(1<t.length)throw Error(Qe(93));t=t[0]}e=t}e==null&&(e=""),t=e}n._wrapperState={initialValue:Tu(t)}}function CV(n,e){var t=Tu(e.value),i=Tu(e.defaultValue);t!=null&&(t=""+t,t!==n.value&&(n.value=t),e.defaultValue==null&&n.defaultValue!==t&&(n.defaultValue=t)),i!=null&&(n.defaultValue=""+i)}function Gk(n){var e=n.textContent;e===n._wrapperState.initialValue&&e!==""&&e!==null&&(n.value=e)}function MV(n){switch(n){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function lM(n,e){return n==null||n==="http://www.w3.org/1999/xhtml"?MV(e):n==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var F_,IV=function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,t,i,r){MSApp.execUnsafeLocalFunction(function(){return n(e,t,i,r)})}:n}(function(n,e){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=e;else{for(F_=F_||document.createElement("div"),F_.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=F_.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function $y(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var fy={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},yY=["Webkit","ms","Moz","O"];Object.keys(fy).forEach(function(n){yY.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),fy[e]=fy[n]})});function RV(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||fy.hasOwnProperty(n)&&fy[n]?(""+e).trim():e+"px"}function PV(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=RV(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var vY=Ti({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function cM(n,e){if(e){if(vY[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Qe(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Qe(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Qe(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Qe(62))}}function uM(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var hM=null;function iP(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var dM=null,Ep=null,Ap=null;function jk(n){if(n=tv(n)){if(typeof dM!="function")throw Error(Qe(280));var e=n.stateNode;e&&(e=QE(e),dM(n.stateNode,n.type,e))}}function NV(n){Ep?Ap?Ap.push(n):Ap=[n]:Ep=n}function DV(){if(Ep){var n=Ep,e=Ap;if(Ap=Ep=null,jk(n),e)for(n=0;n<e.length;n++)jk(e[n])}}function LV(n,e){return n(e)}function kV(){}var FT=!1;function BV(n,e,t){if(FT)return n(e,t);FT=!0;try{return LV(n,e,t)}finally{FT=!1,(Ep!==null||Ap!==null)&&(kV(),DV())}}function Jy(n,e){var t=n.stateNode;if(t===null)return null;var i=QE(t);if(i===null)return null;t=i[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(n=n.type,i=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!i;break e;default:n=!1}if(n)return null;if(t&&typeof t!="function")throw Error(Qe(231,e,typeof t));return t}var fM=!1;if(Ql)try{var wg={};Object.defineProperty(wg,"passive",{get:function(){fM=!0}}),window.addEventListener("test",wg,wg),window.removeEventListener("test",wg,wg)}catch{fM=!1}function _Y(n,e,t,i,r,s,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(t,c)}catch(u){this.onError(u)}}var py=!1,Yw=null,$w=!1,pM=null,xY={onError:function(n){py=!0,Yw=n}};function wY(n,e,t,i,r,s,o,a,l){py=!1,Yw=null,_Y.apply(xY,arguments)}function EY(n,e,t,i,r,s,o,a,l){if(wY.apply(this,arguments),py){if(py){var c=Yw;py=!1,Yw=null}else throw Error(Qe(198));$w||($w=!0,pM=c)}}function Kd(n){var e=n,t=n;if(n.alternate)for(;e.return;)e=e.return;else{n=e;do e=n,e.flags&4098&&(t=e.return),n=e.return;while(n)}return e.tag===3?t:null}function OV(n){if(n.tag===13){var e=n.memoizedState;if(e===null&&(n=n.alternate,n!==null&&(e=n.memoizedState)),e!==null)return e.dehydrated}return null}function Wk(n){if(Kd(n)!==n)throw Error(Qe(188))}function AY(n){var e=n.alternate;if(!e){if(e=Kd(n),e===null)throw Error(Qe(188));return e!==n?null:n}for(var t=n,i=e;;){var r=t.return;if(r===null)break;var s=r.alternate;if(s===null){if(i=r.return,i!==null){t=i;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===t)return Wk(r),n;if(s===i)return Wk(r),e;s=s.sibling}throw Error(Qe(188))}if(t.return!==i.return)t=r,i=s;else{for(var o=!1,a=r.child;a;){if(a===t){o=!0,t=r,i=s;break}if(a===i){o=!0,i=r,t=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===t){o=!0,t=s,i=r;break}if(a===i){o=!0,i=s,t=r;break}a=a.sibling}if(!o)throw Error(Qe(189))}}if(t.alternate!==i)throw Error(Qe(190))}if(t.tag!==3)throw Error(Qe(188));return t.stateNode.current===t?n:e}function FV(n){return n=AY(n),n!==null?UV(n):null}function UV(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var e=UV(n);if(e!==null)return e;n=n.sibling}return null}var VV=po.unstable_scheduleCallback,Kk=po.unstable_cancelCallback,SY=po.unstable_shouldYield,TY=po.unstable_requestPaint,Fi=po.unstable_now,bY=po.unstable_getCurrentPriorityLevel,rP=po.unstable_ImmediatePriority,zV=po.unstable_UserBlockingPriority,Jw=po.unstable_NormalPriority,CY=po.unstable_LowPriority,HV=po.unstable_IdlePriority,qE=null,ja=null;function MY(n){if(ja&&typeof ja.onCommitFiberRoot=="function")try{ja.onCommitFiberRoot(qE,n,void 0,(n.current.flags&128)===128)}catch{}}var da=Math.clz32?Math.clz32:PY,IY=Math.log,RY=Math.LN2;function PY(n){return n>>>=0,n===0?32:31-(IY(n)/RY|0)|0}var U_=64,V_=4194304;function ty(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function Qw(n,e){var t=n.pendingLanes;if(t===0)return 0;var i=0,r=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~r;a!==0?i=ty(a):(s&=o,s!==0&&(i=ty(s)))}else o=t&~r,o!==0?i=ty(o):s!==0&&(i=ty(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0<e;)t=31-da(e),r=1<<t,i|=n[t],e&=~r;return i}function NY(n,e){switch(n){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function DY(n,e){for(var t=n.suspendedLanes,i=n.pingedLanes,r=n.expirationTimes,s=n.pendingLanes;0<s;){var o=31-da(s),a=1<<o,l=r[o];l===-1?(!(a&t)||a&i)&&(r[o]=NY(a,e)):l<=e&&(n.expiredLanes|=a),s&=~a}}function mM(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function GV(){var n=U_;return U_<<=1,!(U_&4194240)&&(U_=64),n}function UT(n){for(var e=[],t=0;31>t;t++)e.push(n);return e}function Z0(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-da(e),n[e]=t}function LY(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var i=n.eventTimes;for(n=n.expirationTimes;0<t;){var r=31-da(t),s=1<<r;e[r]=0,i[r]=-1,n[r]=-1,t&=~s}}function sP(n,e){var t=n.entangledLanes|=e;for(n=n.entanglements;t;){var i=31-da(t),r=1<<i;r&e|n[i]&e&&(n[i]|=e),t&=~r}}var Jn=0;function jV(n){return n&=-n,1<n?4<n?n&268435455?16:536870912:4:1}var WV,oP,KV,XV,qV,gM=!1,z_=[],uu=null,hu=null,du=null,Qy=new Map,Zy=new Map,Wc=[],kY="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Xk(n,e){switch(n){case"focusin":case"focusout":uu=null;break;case"dragenter":case"dragleave":hu=null;break;case"mouseover":case"mouseout":du=null;break;case"pointerover":case"pointerout":Qy.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zy.delete(e.pointerId)}}function Eg(n,e,t,i,r,s){return n===null||n.nativeEvent!==s?(n={blockedOn:e,domEventName:t,eventSystemFlags:i,nativeEvent:s,targetContainers:[r]},e!==null&&(e=tv(e),e!==null&&oP(e)),n):(n.eventSystemFlags|=i,e=n.targetContainers,r!==null&&e.indexOf(r)===-1&&e.push(r),n)}function BY(n,e,t,i,r){switch(e){case"focusin":return uu=Eg(uu,n,e,t,i,r),!0;case"dragenter":return hu=Eg(hu,n,e,t,i,r),!0;case"mouseover":return du=Eg(du,n,e,t,i,r),!0;case"pointerover":var s=r.pointerId;return Qy.set(s,Eg(Qy.get(s)||null,n,e,t,i,r)),!0;case"gotpointercapture":return s=r.pointerId,Zy.set(s,Eg(Zy.get(s)||null,n,e,t,i,r)),!0}return!1}function YV(n){var e=jh(n.target);if(e!==null){var t=Kd(e);if(t!==null){if(e=t.tag,e===13){if(e=OV(t),e!==null){n.blockedOn=e,qV(n.priority,function(){KV(t)});return}}else if(e===3&&t.stateNode.current.memoizedState.isDehydrated){n.blockedOn=t.tag===3?t.stateNode.containerInfo:null;return}}}n.blockedOn=null}function mw(n){if(n.blockedOn!==null)return!1;for(var e=n.targetContainers;0<e.length;){var t=yM(n.domEventName,n.eventSystemFlags,e[0],n.nativeEvent);if(t===null){t=n.nativeEvent;var i=new t.constructor(t.type,t);hM=i,t.target.dispatchEvent(i),hM=null}else return e=tv(t),e!==null&&oP(e),n.blockedOn=t,!1;e.shift()}return!0}function qk(n,e,t){mw(n)&&t.delete(e)}function OY(){gM=!1,uu!==null&&mw(uu)&&(uu=null),hu!==null&&mw(hu)&&(hu=null),du!==null&&mw(du)&&(du=null),Qy.forEach(qk),Zy.forEach(qk)}function Ag(n,e){n.blockedOn===e&&(n.blockedOn=null,gM||(gM=!0,po.unstable_scheduleCallback(po.unstable_NormalPriority,OY)))}function e0(n){function e(r){return Ag(r,n)}if(0<z_.length){Ag(z_[0],n);for(var t=1;t<z_.length;t++){var i=z_[t];i.blockedOn===n&&(i.blockedOn=null)}}for(uu!==null&&Ag(uu,n),hu!==null&&Ag(hu,n),du!==null&&Ag(du,n),Qy.forEach(e),Zy.forEach(e),t=0;t<Wc.length;t++)i=Wc[t],i.blockedOn===n&&(i.blockedOn=null);for(;0<Wc.length&&(t=Wc[0],t.blockedOn===null);)YV(t),t.blockedOn===null&&Wc.shift()}var Sp=dc.ReactCurrentBatchConfig,Zw=!0;function FY(n,e,t,i){var r=Jn,s=Sp.transition;Sp.transition=null;try{Jn=1,aP(n,e,t,i)}finally{Jn=r,Sp.transition=s}}function UY(n,e,t,i){var r=Jn,s=Sp.transition;Sp.transition=null;try{Jn=4,aP(n,e,t,i)}finally{Jn=r,Sp.transition=s}}function aP(n,e,t,i){if(Zw){var r=yM(n,e,t,i);if(r===null)YT(n,e,i,e1,t),Xk(n,i);else if(BY(r,n,e,t,i))i.stopPropagation();else if(Xk(n,i),e&4&&-1<kY.indexOf(n)){for(;r!==null;){var s=tv(r);if(s!==null&&WV(s),s=yM(n,e,t,i),s===null&&YT(n,e,i,e1,t),s===r)break;r=s}r!==null&&i.stopPropagation()}else YT(n,e,i,null,t)}}var e1=null;function yM(n,e,t,i){if(e1=null,n=iP(i),n=jh(n),n!==null)if(e=Kd(n),e===null)n=null;else if(t=e.tag,t===13){if(n=OV(e),n!==null)return n;n=null}else if(t===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;n=null}else e!==n&&(n=null);return e1=n,null}function $V(n){switch(n){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(bY()){case rP:return 1;case zV:return 4;case Jw:case CY:return 16;case HV:return 536870912;default:return 16}default:return 16}}var iu=null,lP=null,gw=null;function JV(){if(gw)return gw;var n,e=lP,t=e.length,i,r="value"in iu?iu.value:iu.textContent,s=r.length;for(n=0;n<t&&e[n]===r[n];n++);var o=t-n;for(i=1;i<=o&&e[t-i]===r[s-i];i++);return gw=r.slice(n,1<i?1-i:void 0)}function yw(n){var e=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&e===13&&(n=13)):n=e,n===10&&(n=13),32<=n||n===13?n:0}function H_(){return!0}function Yk(){return!1}function yo(n){function e(t,i,r,s,o){this._reactName=t,this._targetInst=r,this.type=i,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in n)n.hasOwnProperty(a)&&(t=n[a],this[a]=t?t(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?H_:Yk,this.isPropagationStopped=Yk,this}return Ti(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():typeof t.returnValue!="unknown"&&(t.returnValue=!1),this.isDefaultPrevented=H_)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=H_)},persist:function(){},isPersistent:H_}),e}var Cm={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},cP=yo(Cm),ev=Ti({},Cm,{view:0,detail:0}),VY=yo(ev),VT,zT,Sg,YE=Ti({},ev,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:uP,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Sg&&(Sg&&n.type==="mousemove"?(VT=n.screenX-Sg.screenX,zT=n.screenY-Sg.screenY):zT=VT=0,Sg=n),VT)},movementY:function(n){return"movementY"in n?n.movementY:zT}}),$k=yo(YE),zY=Ti({},YE,{dataTransfer:0}),HY=yo(zY),GY=Ti({},ev,{relatedTarget:0}),HT=yo(GY),jY=Ti({},Cm,{animationName:0,elapsedTime:0,pseudoElement:0}),WY=yo(jY),KY=Ti({},Cm,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),XY=yo(KY),qY=Ti({},Cm,{data:0}),Jk=yo(qY),YY={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},$Y={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"},JY={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function QY(n){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(n):(n=JY[n])?!!e[n]:!1}function uP(){return QY}var ZY=Ti({},ev,{key:function(n){if(n.key){var e=YY[n.key]||n.key;if(e!=="Unidentified")return e}return n.type==="keypress"?(n=yw(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?$Y[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:uP,charCode:function(n){return n.type==="keypress"?yw(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?yw(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),e$=yo(ZY),t$=Ti({},YE,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Qk=yo(t$),n$=Ti({},ev,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:uP}),i$=yo(n$),r$=Ti({},Cm,{propertyName:0,elapsedTime:0,pseudoElement:0}),s$=yo(r$),o$=Ti({},YE,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),a$=yo(o$),l$=[9,13,27,32],hP=Ql&&"CompositionEvent"in window,my=null;Ql&&"documentMode"in document&&(my=document.documentMode);var c$=Ql&&"TextEvent"in window&&!my,QV=Ql&&(!hP||my&&8<my&&11>=my),Zk=" ",eB=!1;function ZV(n,e){switch(n){case"keyup":return l$.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ez(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Zf=!1;function u$(n,e){switch(n){case"compositionend":return ez(e);case"keypress":return e.which!==32?null:(eB=!0,Zk);case"textInput":return n=e.data,n===Zk&&eB?null:n;default:return null}}function h$(n,e){if(Zf)return n==="compositionend"||!hP&&ZV(n,e)?(n=JV(),gw=lP=iu=null,Zf=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return QV&&e.locale!=="ko"?null:e.data;default:return null}}var d$={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 tB(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e==="input"?!!d$[n.type]:e==="textarea"}function tz(n,e,t,i){NV(i),e=t1(e,"onChange"),0<e.length&&(t=new cP("onChange","change",null,t,i),n.push({event:t,listeners:e}))}var gy=null,t0=null;function f$(n){dz(n,0)}function $E(n){var e=np(n);if(TV(e))return n}function p$(n,e){if(n==="change")return e}var nz=!1;if(Ql){var GT;if(Ql){var jT="oninput"in document;if(!jT){var nB=document.createElement("div");nB.setAttribute("oninput","return;"),jT=typeof nB.oninput=="function"}GT=jT}else GT=!1;nz=GT&&(!document.documentMode||9<document.documentMode)}function iB(){gy&&(gy.detachEvent("onpropertychange",iz),t0=gy=null)}function iz(n){if(n.propertyName==="value"&&$E(t0)){var e=[];tz(e,t0,n,iP(n)),BV(f$,e)}}function m$(n,e,t){n==="focusin"?(iB(),gy=e,t0=t,gy.attachEvent("onpropertychange",iz)):n==="focusout"&&iB()}function g$(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return $E(t0)}function y$(n,e){if(n==="click")return $E(e)}function v$(n,e){if(n==="input"||n==="change")return $E(e)}function _$(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var va=typeof Object.is=="function"?Object.is:_$;function n0(n,e){if(va(n,e))return!0;if(typeof n!="object"||n===null||typeof e!="object"||e===null)return!1;var t=Object.keys(n),i=Object.keys(e);if(t.length!==i.length)return!1;for(i=0;i<t.length;i++){var r=t[i];if(!ZC.call(e,r)||!va(n[r],e[r]))return!1}return!0}function rB(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function sB(n,e){var t=rB(n);n=0;for(var i;t;){if(t.nodeType===3){if(i=n+t.textContent.length,n<=e&&i>=e)return{node:t,offset:e-n};n=i}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=rB(t)}}function rz(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?rz(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function sz(){for(var n=window,e=qw();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=qw(n.document)}return e}function dP(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function x$(n){var e=sz(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&rz(t.ownerDocument.documentElement,t)){if(i!==null&&dP(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var r=t.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!n.extend&&s>i&&(r=i,i=s,s=r),r=sB(t,s);var o=sB(t,i);r&&o&&(n.rangeCount!==1||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),n.removeAllRanges(),s>i?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t<e.length;t++)n=e[t],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var w$=Ql&&"documentMode"in document&&11>=document.documentMode,ep=null,vM=null,yy=null,_M=!1;function oB(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;_M||ep==null||ep!==qw(i)||(i=ep,"selectionStart"in i&&dP(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),yy&&n0(yy,i)||(yy=i,i=t1(vM,"onSelect"),0<i.length&&(e=new cP("onSelect","select",null,e,t),n.push({event:e,listeners:i}),e.target=ep)))}function G_(n,e){var t={};return t[n.toLowerCase()]=e.toLowerCase(),t["Webkit"+n]="webkit"+e,t["Moz"+n]="moz"+e,t}var tp={animationend:G_("Animation","AnimationEnd"),animationiteration:G_("Animation","AnimationIteration"),animationstart:G_("Animation","AnimationStart"),transitionend:G_("Transition","TransitionEnd")},WT={},oz={};Ql&&(oz=document.createElement("div").style,"AnimationEvent"in window||(delete tp.animationend.animation,delete tp.animationiteration.animation,delete tp.animationstart.animation),"TransitionEvent"in window||delete tp.transitionend.transition);function JE(n){if(WT[n])return WT[n];if(!tp[n])return n;var e=tp[n],t;for(t in e)if(e.hasOwnProperty(t)&&t in oz)return WT[n]=e[t];return n}var az=JE("animationend"),lz=JE("animationiteration"),cz=JE("animationstart"),uz=JE("transitionend"),hz=new Map,aB="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function ju(n,e){hz.set(n,e),Wd(e,[n])}for(var KT=0;KT<aB.length;KT++){var XT=aB[KT],E$=XT.toLowerCase(),A$=XT[0].toUpperCase()+XT.slice(1);ju(E$,"on"+A$)}ju(az,"onAnimationEnd");ju(lz,"onAnimationIteration");ju(cz,"onAnimationStart");ju("dblclick","onDoubleClick");ju("focusin","onFocus");ju("focusout","onBlur");ju(uz,"onTransitionEnd");qp("onMouseEnter",["mouseout","mouseover"]);qp("onMouseLeave",["mouseout","mouseover"]);qp("onPointerEnter",["pointerout","pointerover"]);qp("onPointerLeave",["pointerout","pointerover"]);Wd("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Wd("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Wd("onBeforeInput",["compositionend","keypress","textInput","paste"]);Wd("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Wd("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Wd("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ny="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(" "),S$=new Set("cancel close invalid load scroll toggle".split(" ").concat(ny));function lB(n,e,t){var i=n.type||"unknown-event";n.currentTarget=t,EY(i,e,void 0,n),n.currentTarget=null}function dz(n,e){e=(e&4)!==0;for(var t=0;t<n.length;t++){var i=n[t],r=i.event;i=i.listeners;e:{var s=void 0;if(e)for(var o=i.length-1;0<=o;o--){var a=i[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==s&&r.isPropagationStopped())break e;lB(r,a,c),s=l}else for(o=0;o<i.length;o++){if(a=i[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==s&&r.isPropagationStopped())break e;lB(r,a,c),s=l}}}if($w)throw n=pM,$w=!1,pM=null,n}function ai(n,e){var t=e[SM];t===void 0&&(t=e[SM]=new Set);var i=n+"__bubble";t.has(i)||(fz(e,n,2,!1),t.add(i))}function qT(n,e,t){var i=0;e&&(i|=4),fz(t,n,i,e)}var j_="_reactListening"+Math.random().toString(36).slice(2);function i0(n){if(!n[j_]){n[j_]=!0,xV.forEach(function(t){t!=="selectionchange"&&(S$.has(t)||qT(t,!1,n),qT(t,!0,n))});var e=n.nodeType===9?n:n.ownerDocument;e===null||e[j_]||(e[j_]=!0,qT("selectionchange",!1,e))}}function fz(n,e,t,i){switch($V(e)){case 1:var r=FY;break;case 4:r=UY;break;default:r=aP}t=r.bind(null,e,t,n),r=void 0,!fM||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(r=!0),i?r!==void 0?n.addEventListener(e,t,{capture:!0,passive:r}):n.addEventListener(e,t,!0):r!==void 0?n.addEventListener(e,t,{passive:r}):n.addEventListener(e,t,!1)}function YT(n,e,t,i,r){var s=i;if(!(e&1)&&!(e&2)&&i!==null)e:for(;;){if(i===null)return;var o=i.tag;if(o===3||o===4){var a=i.stateNode.containerInfo;if(a===r||a.nodeType===8&&a.parentNode===r)break;if(o===4)for(o=i.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===r||l.nodeType===8&&l.parentNode===r))return;o=o.return}for(;a!==null;){if(o=jh(a),o===null)return;if(l=o.tag,l===5||l===6){i=s=o;continue e}a=a.parentNode}}i=i.return}BV(function(){var c=s,u=iP(t),h=[];e:{var f=hz.get(n);if(f!==void 0){var m=cP,y=n;switch(n){case"keypress":if(yw(t)===0)break e;case"keydown":case"keyup":m=e$;break;case"focusin":y="focus",m=HT;break;case"focusout":y="blur",m=HT;break;case"beforeblur":case"afterblur":m=HT;break;case"click":if(t.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=$k;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=HY;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=i$;break;case az:case lz:case cz:m=WY;break;case uz:m=s$;break;case"scroll":m=VY;break;case"wheel":m=a$;break;case"copy":case"cut":case"paste":m=XY;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=Qk}var _=(e&4)!==0,v=!_&&n==="scroll",g=_?f!==null?f+"Capture":null:f;_=[];for(var w=c,A;w!==null;){A=w;var T=A.stateNode;if(A.tag===5&&T!==null&&(A=T,g!==null&&(T=Jy(w,g),T!=null&&_.push(r0(w,T,A)))),v)break;w=w.return}0<_.length&&(f=new m(f,y,null,t,u),h.push({event:f,listeners:_}))}}if(!(e&7)){e:{if(f=n==="mouseover"||n==="pointerover",m=n==="mouseout"||n==="pointerout",f&&t!==hM&&(y=t.relatedTarget||t.fromElement)&&(jh(y)||y[Zl]))break e;if((m||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,m?(y=t.relatedTarget||t.toElement,m=c,y=y?jh(y):null,y!==null&&(v=Kd(y),y!==v||y.tag!==5&&y.tag!==6)&&(y=null)):(m=null,y=c),m!==y)){if(_=$k,T="onMouseLeave",g="onMouseEnter",w="mouse",(n==="pointerout"||n==="pointerover")&&(_=Qk,T="onPointerLeave",g="onPointerEnter",w="pointer"),v=m==null?f:np(m),A=y==null?f:np(y),f=new _(T,w+"leave",m,t,u),f.target=v,f.relatedTarget=A,T=null,jh(u)===c&&(_=new _(g,w+"enter",y,t,u),_.target=A,_.relatedTarget=v,T=_),v=T,m&&y)t:{for(_=m,g=y,w=0,A=_;A;A=Sf(A))w++;for(A=0,T=g;T;T=Sf(T))A++;for(;0<w-A;)_=Sf(_),w--;for(;0<A-w;)g=Sf(g),A--;for(;w--;){if(_===g||g!==null&&_===g.alternate)break t;_=Sf(_),g=Sf(g)}_=null}else _=null;m!==null&&cB(h,f,m,_,!1),y!==null&&v!==null&&cB(h,v,y,_,!0)}}e:{if(f=c?np(c):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var L=p$;else if(tB(f))if(nz)L=v$;else{L=g$;var D=m$}else(m=f.nodeName)&&m.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(L=y$);if(L&&(L=L(n,c))){tz(h,L,t,u);break e}D&&D(n,f,c),n==="focusout"&&(D=f._wrapperState)&&D.controlled&&f.type==="number"&&oM(f,"number",f.value)}switch(D=c?np(c):window,n){case"focusin":(tB(D)||D.contentEditable==="true")&&(ep=D,vM=c,yy=null);break;case"focusout":yy=vM=ep=null;break;case"mousedown":_M=!0;break;case"contextmenu":case"mouseup":case"dragend":_M=!1,oB(h,t,u);break;case"selectionchange":if(w$)break;case"keydown":case"keyup":oB(h,t,u)}var R;if(hP)e:{switch(n){case"compositionstart":var I="onCompositionStart";break e;case"compositionend":I="onCompositionEnd";break e;case"compositionupdate":I="onCompositionUpdate";break e}I=void 0}else Zf?ZV(n,t)&&(I="onCompositionEnd"):n==="keydown"&&t.keyCode===229&&(I="onCompositionStart");I&&(QV&&t.locale!=="ko"&&(Zf||I!=="onCompositionStart"?I==="onCompositionEnd"&&Zf&&(R=JV()):(iu=u,lP="value"in iu?iu.value:iu.textContent,Zf=!0)),D=t1(c,I),0<D.length&&(I=new Jk(I,n,null,t,u),h.push({event:I,listeners:D}),R?I.data=R:(R=ez(t),R!==null&&(I.data=R)))),(R=c$?u$(n,t):h$(n,t))&&(c=t1(c,"onBeforeInput"),0<c.length&&(u=new Jk("onBeforeInput","beforeinput",null,t,u),h.push({event:u,listeners:c}),u.data=R))}dz(h,e)})}function r0(n,e,t){return{instance:n,listener:e,currentTarget:t}}function t1(n,e){for(var t=e+"Capture",i=[];n!==null;){var r=n,s=r.stateNode;r.tag===5&&s!==null&&(r=s,s=Jy(n,t),s!=null&&i.unshift(r0(n,s,r)),s=Jy(n,e),s!=null&&i.push(r0(n,s,r))),n=n.return}return i}function Sf(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function cB(n,e,t,i,r){for(var s=e._reactName,o=[];t!==null&&t!==i;){var a=t,l=a.alternate,c=a.stateNode;if(l!==null&&l===i)break;a.tag===5&&c!==null&&(a=c,r?(l=Jy(t,s),l!=null&&o.unshift(r0(t,l,a))):r||(l=Jy(t,s),l!=null&&o.push(r0(t,l,a)))),t=t.return}o.length!==0&&n.push({event:e,listeners:o})}var T$=/\r\n?/g,b$=/\u0000|\uFFFD/g;function uB(n){return(typeof n=="string"?n:""+n).replace(T$,`
`).replace(b$,"")}function W_(n,e,t){if(e=uB(e),uB(n)!==e&&t)throw Error(Qe(425))}function n1(){}var xM=null,wM=null;function EM(n,e){return n==="textarea"||n==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var AM=typeof setTimeout=="function"?setTimeout:void 0,C$=typeof clearTimeout=="function"?clearTimeout:void 0,hB=typeof Promise=="function"?Promise:void 0,M$=typeof queueMicrotask=="function"?queueMicrotask:typeof hB<"u"?function(n){return hB.resolve(null).then(n).catch(I$)}:AM;function I$(n){setTimeout(function(){throw n})}function $T(n,e){var t=e,i=0;do{var r=t.nextSibling;if(n.removeChild(t),r&&r.nodeType===8)if(t=r.data,t==="/$"){if(i===0){n.removeChild(r),e0(e);return}i--}else t!=="$"&&t!=="$?"&&t!=="$!"||i++;t=r}while(t);e0(e)}function fu(n){for(;n!=null;n=n.nextSibling){var e=n.nodeType;if(e===1||e===3)break;if(e===8){if(e=n.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return n}function dB(n){n=n.previousSibling;for(var e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="$"||t==="$!"||t==="$?"){if(e===0)return n;e--}else t==="/$"&&e++}n=n.previousSibling}return null}var Mm=Math.random().toString(36).slice(2),Ua="__reactFiber$"+Mm,s0="__reactProps$"+Mm,Zl="__reactContainer$"+Mm,SM="__reactEvents$"+Mm,R$="__reactListeners$"+Mm,P$="__reactHandles$"+Mm;function jh(n){var e=n[Ua];if(e)return e;for(var t=n.parentNode;t;){if(e=t[Zl]||t[Ua]){if(t=e.alternate,e.child!==null||t!==null&&t.child!==null)for(n=dB(n);n!==null;){if(t=n[Ua])return t;n=dB(n)}return e}n=t,t=n.parentNode}return null}function tv(n){return n=n[Ua]||n[Zl],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function np(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(Qe(33))}function QE(n){return n[s0]||null}var TM=[],ip=-1;function Wu(n){return{current:n}}function di(n){0>ip||(n.current=TM[ip],TM[ip]=null,ip--)}function ri(n,e){ip++,TM[ip]=n.current,n.current=e}var bu={},is=Wu(bu),Us=Wu(!1),Ed=bu;function Yp(n,e){var t=n.type.contextTypes;if(!t)return bu;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in t)r[s]=e[s];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=r),r}function Vs(n){return n=n.childContextTypes,n!=null}function i1(){di(Us),di(is)}function fB(n,e,t){if(is.current!==bu)throw Error(Qe(168));ri(is,e),ri(Us,t)}function pz(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(Qe(108,mY(n)||"Unknown",r));return Ti({},t,i)}function r1(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||bu,Ed=is.current,ri(is,n),ri(Us,Us.current),!0}function pB(n,e,t){var i=n.stateNode;if(!i)throw Error(Qe(169));t?(n=pz(n,e,Ed),i.__reactInternalMemoizedMergedChildContext=n,di(Us),di(is),ri(is,n)):di(Us),ri(Us,t)}var Nl=null,ZE=!1,JT=!1;function mz(n){Nl===null?Nl=[n]:Nl.push(n)}function N$(n){ZE=!0,mz(n)}function Ku(){if(!JT&&Nl!==null){JT=!0;var n=0,e=Jn;try{var t=Nl;for(Jn=1;n<t.length;n++){var i=t[n];do i=i(!0);while(i!==null)}Nl=null,ZE=!1}catch(r){throw Nl!==null&&(Nl=Nl.slice(n+1)),VV(rP,Ku),r}finally{Jn=e,JT=!1}}return null}var rp=[],sp=0,s1=null,o1=0,Ro=[],Po=0,Ad=null,Fl=1,Ul="";function Lh(n,e){rp[sp++]=o1,rp[sp++]=s1,s1=n,o1=e}function gz(n,e,t){Ro[Po++]=Fl,Ro[Po++]=Ul,Ro[Po++]=Ad,Ad=n;var i=Fl;n=Ul;var r=32-da(i)-1;i&=~(1<<r),t+=1;var s=32-da(e)+r;if(30<s){var o=r-r%5;s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,Fl=1<<32-da(e)+r|t<<r|i,Ul=s+n}else Fl=1<<s|t<<r|i,Ul=n}function fP(n){n.return!==null&&(Lh(n,1),gz(n,1,0))}function pP(n){for(;n===s1;)s1=rp[--sp],rp[sp]=null,o1=rp[--sp],rp[sp]=null;for(;n===Ad;)Ad=Ro[--Po],Ro[Po]=null,Ul=Ro[--Po],Ro[Po]=null,Fl=Ro[--Po],Ro[Po]=null}var lo=null,oo=null,gi=!1,la=null;function yz(n,e){var t=Lo(5,null,null,0);t.elementType="DELETED",t.stateNode=e,t.return=n,e=n.deletions,e===null?(n.deletions=[t],n.flags|=16):e.push(t)}function mB(n,e){switch(n.tag){case 5:var t=n.type;return e=e.nodeType!==1||t.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(n.stateNode=e,lo=n,oo=fu(e.firstChild),!0):!1;case 6:return e=n.pendingProps===""||e.nodeType!==3?null:e,e!==null?(n.stateNode=e,lo=n,oo=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(t=Ad!==null?{id:Fl,overflow:Ul}:null,n.memoizedState={dehydrated:e,treeContext:t,retryLane:1073741824},t=Lo(18,null,null,0),t.stateNode=e,t.return=n,n.child=t,lo=n,oo=null,!0):!1;default:return!1}}function bM(n){return(n.mode&1)!==0&&(n.flags&128)===0}function CM(n){if(gi){var e=oo;if(e){var t=e;if(!mB(n,e)){if(bM(n))throw Error(Qe(418));e=fu(t.nextSibling);var i=lo;e&&mB(n,e)?yz(i,t):(n.flags=n.flags&-4097|2,gi=!1,lo=n)}}else{if(bM(n))throw Error(Qe(418));n.flags=n.flags&-4097|2,gi=!1,lo=n}}}function gB(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;lo=n}function K_(n){if(n!==lo)return!1;if(!gi)return gB(n),gi=!0,!1;var e;if((e=n.tag!==3)&&!(e=n.tag!==5)&&(e=n.type,e=e!=="head"&&e!=="body"&&!EM(n.type,n.memoizedProps)),e&&(e=oo)){if(bM(n))throw vz(),Error(Qe(418));for(;e;)yz(n,e),e=fu(e.nextSibling)}if(gB(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(Qe(317));e:{for(n=n.nextSibling,e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="/$"){if(e===0){oo=fu(n.nextSibling);break e}e--}else t!=="$"&&t!=="$!"&&t!=="$?"||e++}n=n.nextSibling}oo=null}}else oo=lo?fu(n.stateNode.nextSibling):null;return!0}function vz(){for(var n=oo;n;)n=fu(n.nextSibling)}function $p(){oo=lo=null,gi=!1}function mP(n){la===null?la=[n]:la.push(n)}var D$=dc.ReactCurrentBatchConfig;function Tg(n,e,t){if(n=t.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(t._owner){if(t=t._owner,t){if(t.tag!==1)throw Error(Qe(309));var i=t.stateNode}if(!i)throw Error(Qe(147,n));var r=i,s=""+n;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(o){var a=r.refs;o===null?delete a[s]:a[s]=o},e._stringRef=s,e)}if(typeof n!="string")throw Error(Qe(284));if(!t._owner)throw Error(Qe(290,n))}return n}function X_(n,e){throw n=Object.prototype.toString.call(e),Error(Qe(31,n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n))}function yB(n){var e=n._init;return e(n._payload)}function _z(n){function e(g,w){if(n){var A=g.deletions;A===null?(g.deletions=[w],g.flags|=16):A.push(w)}}function t(g,w){if(!n)return null;for(;w!==null;)e(g,w),w=w.sibling;return null}function i(g,w){for(g=new Map;w!==null;)w.key!==null?g.set(w.key,w):g.set(w.index,w),w=w.sibling;return g}function r(g,w){return g=yu(g,w),g.index=0,g.sibling=null,g}function s(g,w,A){return g.index=A,n?(A=g.alternate,A!==null?(A=A.index,A<w?(g.flags|=2,w):A):(g.flags|=2,w)):(g.flags|=1048576,w)}function o(g){return n&&g.alternate===null&&(g.flags|=2),g}function a(g,w,A,T){return w===null||w.tag!==6?(w=rb(A,g.mode,T),w.return=g,w):(w=r(w,A),w.return=g,w)}function l(g,w,A,T){var L=A.type;return L===Qf?u(g,w,A.props.children,T,A.key):w!==null&&(w.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===Hc&&yB(L)===w.type)?(T=r(w,A.props),T.ref=Tg(g,w,A),T.return=g,T):(T=Sw(A.type,A.key,A.props,null,g.mode,T),T.ref=Tg(g,w,A),T.return=g,T)}function c(g,w,A,T){return w===null||w.tag!==4||w.stateNode.containerInfo!==A.containerInfo||w.stateNode.implementation!==A.implementation?(w=sb(A,g.mode,T),w.return=g,w):(w=r(w,A.children||[]),w.return=g,w)}function u(g,w,A,T,L){return w===null||w.tag!==7?(w=dd(A,g.mode,T,L),w.return=g,w):(w=r(w,A),w.return=g,w)}function h(g,w,A){if(typeof w=="string"&&w!==""||typeof w=="number")return w=rb(""+w,g.mode,A),w.return=g,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case B_:return A=Sw(w.type,w.key,w.props,null,g.mode,A),A.ref=Tg(g,null,w),A.return=g,A;case Jf:return w=sb(w,g.mode,A),w.return=g,w;case Hc:var T=w._init;return h(g,T(w._payload),A)}if(ey(w)||xg(w))return w=dd(w,g.mode,A,null),w.return=g,w;X_(g,w)}return null}function f(g,w,A,T){var L=w!==null?w.key:null;if(typeof A=="string"&&A!==""||typeof A=="number")return L!==null?null:a(g,w,""+A,T);if(typeof A=="object"&&A!==null){switch(A.$$typeof){case B_:return A.key===L?l(g,w,A,T):null;case Jf:return A.key===L?c(g,w,A,T):null;case Hc:return L=A._init,f(g,w,L(A._payload),T)}if(ey(A)||xg(A))return L!==null?null:u(g,w,A,T,null);X_(g,A)}return null}function m(g,w,A,T,L){if(typeof T=="string"&&T!==""||typeof T=="number")return g=g.get(A)||null,a(w,g,""+T,L);if(typeof T=="object"&&T!==null){switch(T.$$typeof){case B_:return g=g.get(T.key===null?A:T.key)||null,l(w,g,T,L);case Jf:return g=g.get(T.key===null?A:T.key)||null,c(w,g,T,L);case Hc:var D=T._init;return m(g,w,A,D(T._payload),L)}if(ey(T)||xg(T))return g=g.get(A)||null,u(w,g,T,L,null);X_(w,T)}return null}function y(g,w,A,T){for(var L=null,D=null,R=w,I=w=0,M=null;R!==null&&I<A.length;I++){R.index>I?(M=R,R=null):M=R.sibling;var C=f(g,R,A[I],T);if(C===null){R===null&&(R=M);break}n&&R&&C.alternate===null&&e(g,R),w=s(C,w,I),D===null?L=C:D.sibling=C,D=C,R=M}if(I===A.length)return t(g,R),gi&&Lh(g,I),L;if(R===null){for(;I<A.length;I++)R=h(g,A[I],T),R!==null&&(w=s(R,w,I),D===null?L=R:D.sibling=R,D=R);return gi&&Lh(g,I),L}for(R=i(g,R);I<A.length;I++)M=m(R,g,I,A[I],T),M!==null&&(n&&M.alternate!==null&&R.delete(M.key===null?I:M.key),w=s(M,w,I),D===null?L=M:D.sibling=M,D=M);return n&&R.forEach(function(k){return e(g,k)}),gi&&Lh(g,I),L}function _(g,w,A,T){var L=xg(A);if(typeof L!="function")throw Error(Qe(150));if(A=L.call(A),A==null)throw Error(Qe(151));for(var D=L=null,R=w,I=w=0,M=null,C=A.next();R!==null&&!C.done;I++,C=A.next()){R.index>I?(M=R,R=null):M=R.sibling;var k=f(g,R,C.value,T);if(k===null){R===null&&(R=M);break}n&&R&&k.alternate===null&&e(g,R),w=s(k,w,I),D===null?L=k:D.sibling=k,D=k,R=M}if(C.done)return t(g,R),gi&&Lh(g,I),L;if(R===null){for(;!C.done;I++,C=A.next())C=h(g,C.value,T),C!==null&&(w=s(C,w,I),D===null?L=C:D.sibling=C,D=C);return gi&&Lh(g,I),L}for(R=i(g,R);!C.done;I++,C=A.next())C=m(R,g,I,C.value,T),C!==null&&(n&&C.alternate!==null&&R.delete(C.key===null?I:C.key),w=s(C,w,I),D===null?L=C:D.sibling=C,D=C);return n&&R.forEach(function(B){return e(g,B)}),gi&&Lh(g,I),L}function v(g,w,A,T){if(typeof A=="object"&&A!==null&&A.type===Qf&&A.key===null&&(A=A.props.children),typeof A=="object"&&A!==null){switch(A.$$typeof){case B_:e:{for(var L=A.key,D=w;D!==null;){if(D.key===L){if(L=A.type,L===Qf){if(D.tag===7){t(g,D.sibling),w=r(D,A.props.children),w.return=g,g=w;break e}}else if(D.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===Hc&&yB(L)===D.type){t(g,D.sibling),w=r(D,A.props),w.ref=Tg(g,D,A),w.return=g,g=w;break e}t(g,D);break}else e(g,D);D=D.sibling}A.type===Qf?(w=dd(A.props.children,g.mode,T,A.key),w.return=g,g=w):(T=Sw(A.type,A.key,A.props,null,g.mode,T),T.ref=Tg(g,w,A),T.return=g,g=T)}return o(g);case Jf:e:{for(D=A.key;w!==null;){if(w.key===D)if(w.tag===4&&w.stateNode.containerInfo===A.containerInfo&&w.stateNode.implementation===A.implementation){t(g,w.sibling),w=r(w,A.children||[]),w.return=g,g=w;break e}else{t(g,w);break}else e(g,w);w=w.sibling}w=sb(A,g.mode,T),w.return=g,g=w}return o(g);case Hc:return D=A._init,v(g,w,D(A._payload),T)}if(ey(A))return y(g,w,A,T);if(xg(A))return _(g,w,A,T);X_(g,A)}return typeof A=="string"&&A!==""||typeof A=="number"?(A=""+A,w!==null&&w.tag===6?(t(g,w.sibling),w=r(w,A),w.return=g,g=w):(t(g,w),w=rb(A,g.mode,T),w.return=g,g=w),o(g)):t(g,w)}return v}var Jp=_z(!0),xz=_z(!1),a1=Wu(null),l1=null,op=null,gP=null;function yP(){gP=op=l1=null}function vP(n){var e=a1.current;di(a1),n._currentValue=e}function MM(n,e,t){for(;n!==null;){var i=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),n===t)break;n=n.return}}function Tp(n,e){l1=n,gP=op=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(Bs=!0),n.firstContext=null)}function Vo(n){var e=n._currentValue;if(gP!==n)if(n={context:n,memoizedValue:e,next:null},op===null){if(l1===null)throw Error(Qe(308));op=n,l1.dependencies={lanes:0,firstContext:n}}else op=op.next=n;return e}var Wh=null;function _P(n){Wh===null?Wh=[n]:Wh.push(n)}function wz(n,e,t,i){var r=e.interleaved;return r===null?(t.next=t,_P(e)):(t.next=r.next,r.next=t),e.interleaved=t,ec(n,i)}function ec(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var Gc=!1;function xP(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ez(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Kl(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function pu(n,e,t){var i=n.updateQueue;if(i===null)return null;if(i=i.shared,On&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,ec(n,t)}return r=i.interleaved,r===null?(e.next=e,_P(i)):(e.next=r.next,r.next=e),i.interleaved=e,ec(n,t)}function vw(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,sP(n,t)}}function vB(n,e){var t=n.updateQueue,i=n.alternate;if(i!==null&&(i=i.updateQueue,t===i)){var r=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?r=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?r=s=e:s=s.next=e}else r=s=e;t={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function c1(n,e,t,i){var r=n.updateQueue;Gc=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var u=n.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(s!==null){var h=r.baseState;o=0,u=c=l=null,a=s;do{var f=a.lane,m=a.eventTime;if((i&f)===f){u!==null&&(u=u.next={eventTime:m,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=n,_=a;switch(f=e,m=t,_.tag){case 1:if(y=_.payload,typeof y=="function"){h=y.call(m,h,f);break e}h=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=_.payload,f=typeof y=="function"?y.call(m,h,f):y,f==null)break e;h=Ti({},h,f);break e;case 2:Gc=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,f=r.effects,f===null?r.effects=[a]:f.push(a))}else m={eventTime:m,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=m,l=h):u=u.next=m,o|=f;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;f=a,a=f.next,f.next=null,r.lastBaseUpdate=f,r.shared.pending=null}}while(!0);if(u===null&&(l=h),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=u,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);Td|=o,n.lanes=o,n.memoizedState=h}}function _B(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;e<n.length;e++){var i=n[e],r=i.callback;if(r!==null){if(i.callback=null,i=t,typeof r!="function")throw Error(Qe(191,r));r.call(i)}}}var nv={},Wa=Wu(nv),o0=Wu(nv),a0=Wu(nv);function Kh(n){if(n===nv)throw Error(Qe(174));return n}function wP(n,e){switch(ri(a0,e),ri(o0,n),ri(Wa,nv),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:lM(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=lM(e,n)}di(Wa),ri(Wa,e)}function Qp(){di(Wa),di(o0),di(a0)}function Az(n){Kh(a0.current);var e=Kh(Wa.current),t=lM(e,n.type);e!==t&&(ri(o0,n),ri(Wa,t))}function EP(n){o0.current===n&&(di(Wa),di(o0))}var xi=Wu(0);function u1(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var QT=[];function AP(){for(var n=0;n<QT.length;n++)QT[n]._workInProgressVersionPrimary=null;QT.length=0}var _w=dc.ReactCurrentDispatcher,ZT=dc.ReactCurrentBatchConfig,Sd=0,Si=null,nr=null,pr=null,h1=!1,vy=!1,l0=0,L$=0;function Hr(){throw Error(Qe(321))}function SP(n,e){if(e===null)return!1;for(var t=0;t<e.length&&t<n.length;t++)if(!va(n[t],e[t]))return!1;return!0}function TP(n,e,t,i,r,s){if(Sd=s,Si=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,_w.current=n===null||n.memoizedState===null?F$:U$,n=t(i,r),vy){s=0;do{if(vy=!1,l0=0,25<=s)throw Error(Qe(301));s+=1,pr=nr=null,e.updateQueue=null,_w.current=V$,n=t(i,r)}while(vy)}if(_w.current=d1,e=nr!==null&&nr.next!==null,Sd=0,pr=nr=Si=null,h1=!1,e)throw Error(Qe(300));return n}function bP(){var n=l0!==0;return l0=0,n}function La(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return pr===null?Si.memoizedState=pr=n:pr=pr.next=n,pr}function zo(){if(nr===null){var n=Si.alternate;n=n!==null?n.memoizedState:null}else n=nr.next;var e=pr===null?Si.memoizedState:pr.next;if(e!==null)pr=e,nr=n;else{if(n===null)throw Error(Qe(310));nr=n,n={memoizedState:nr.memoizedState,baseState:nr.baseState,baseQueue:nr.baseQueue,queue:nr.queue,next:null},pr===null?Si.memoizedState=pr=n:pr=pr.next=n}return pr}function c0(n,e){return typeof e=="function"?e(n):e}function eb(n){var e=zo(),t=e.queue;if(t===null)throw Error(Qe(311));t.lastRenderedReducer=n;var i=nr,r=i.baseQueue,s=t.pending;if(s!==null){if(r!==null){var o=r.next;r.next=s.next,s.next=o}i.baseQueue=r=s,t.pending=null}if(r!==null){s=r.next,i=i.baseState;var a=o=null,l=null,c=s;do{var u=c.lane;if((Sd&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),i=c.hasEagerState?c.eagerState:n(i,c.action);else{var h={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=h,o=i):l=l.next=h,Si.lanes|=u,Td|=u}c=c.next}while(c!==null&&c!==s);l===null?o=i:l.next=a,va(i,e.memoizedState)||(Bs=!0),e.memoizedState=i,e.baseState=o,e.baseQueue=l,t.lastRenderedState=i}if(n=t.interleaved,n!==null){r=n;do s=r.lane,Si.lanes|=s,Td|=s,r=r.next;while(r!==n)}else r===null&&(t.lanes=0);return[e.memoizedState,t.dispatch]}function tb(n){var e=zo(),t=e.queue;if(t===null)throw Error(Qe(311));t.lastRenderedReducer=n;var i=t.dispatch,r=t.pending,s=e.memoizedState;if(r!==null){t.pending=null;var o=r=r.next;do s=n(s,o.action),o=o.next;while(o!==r);va(s,e.memoizedState)||(Bs=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),t.lastRenderedState=s}return[s,i]}function Sz(){}function Tz(n,e){var t=Si,i=zo(),r=e(),s=!va(i.memoizedState,r);if(s&&(i.memoizedState=r,Bs=!0),i=i.queue,CP(Mz.bind(null,t,i,n),[n]),i.getSnapshot!==e||s||pr!==null&&pr.memoizedState.tag&1){if(t.flags|=2048,u0(9,Cz.bind(null,t,i,r,e),void 0,null),vr===null)throw Error(Qe(349));Sd&30||bz(t,e,r)}return r}function bz(n,e,t){n.flags|=16384,n={getSnapshot:e,value:t},e=Si.updateQueue,e===null?(e={lastEffect:null,stores:null},Si.updateQueue=e,e.stores=[n]):(t=e.stores,t===null?e.stores=[n]:t.push(n))}function Cz(n,e,t,i){e.value=t,e.getSnapshot=i,Iz(e)&&Rz(n)}function Mz(n,e,t){return t(function(){Iz(e)&&Rz(n)})}function Iz(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!va(n,t)}catch{return!0}}function Rz(n){var e=ec(n,1);e!==null&&fa(e,n,1,-1)}function xB(n){var e=La();return typeof n=="function"&&(n=n()),e.memoizedState=e.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:c0,lastRenderedState:n},e.queue=n,n=n.dispatch=O$.bind(null,Si,n),[e.memoizedState,n]}function u0(n,e,t,i){return n={tag:n,create:e,destroy:t,deps:i,next:null},e=Si.updateQueue,e===null?(e={lastEffect:null,stores:null},Si.updateQueue=e,e.lastEffect=n.next=n):(t=e.lastEffect,t===null?e.lastEffect=n.next=n:(i=t.next,t.next=n,n.next=i,e.lastEffect=n)),n}function Pz(){return zo().memoizedState}function xw(n,e,t,i){var r=La();Si.flags|=n,r.memoizedState=u0(1|e,t,void 0,i===void 0?null:i)}function eA(n,e,t,i){var r=zo();i=i===void 0?null:i;var s=void 0;if(nr!==null){var o=nr.memoizedState;if(s=o.destroy,i!==null&&SP(i,o.deps)){r.memoizedState=u0(e,t,s,i);return}}Si.flags|=n,r.memoizedState=u0(1|e,t,s,i)}function wB(n,e){return xw(8390656,8,n,e)}function CP(n,e){return eA(2048,8,n,e)}function Nz(n,e){return eA(4,2,n,e)}function Dz(n,e){return eA(4,4,n,e)}function Lz(n,e){if(typeof e=="function")return n=n(),e(n),function(){e(null)};if(e!=null)return n=n(),e.current=n,function(){e.current=null}}function kz(n,e,t){return t=t!=null?t.concat([n]):null,eA(4,4,Lz.bind(null,e,n),t)}function MP(){}function Bz(n,e){var t=zo();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&SP(e,i[1])?i[0]:(t.memoizedState=[n,e],n)}function Oz(n,e){var t=zo();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&SP(e,i[1])?i[0]:(n=n(),t.memoizedState=[n,e],n)}function Fz(n,e,t){return Sd&21?(va(t,e)||(t=GV(),Si.lanes|=t,Td|=t,n.baseState=!0),e):(n.baseState&&(n.baseState=!1,Bs=!0),n.memoizedState=t)}function k$(n,e){var t=Jn;Jn=t!==0&&4>t?t:4,n(!0);var i=ZT.transition;ZT.transition={};try{n(!1),e()}finally{Jn=t,ZT.transition=i}}function Uz(){return zo().memoizedState}function B$(n,e,t){var i=gu(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},Vz(n))zz(e,t);else if(t=wz(n,e,t,i),t!==null){var r=Es();fa(t,n,i,r),Hz(t,e,i)}}function O$(n,e,t){var i=gu(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(Vz(n))zz(e,r);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(r.hasEagerState=!0,r.eagerState=a,va(a,o)){var l=e.interleaved;l===null?(r.next=r,_P(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}t=wz(n,e,r,i),t!==null&&(r=Es(),fa(t,n,i,r),Hz(t,e,i))}}function Vz(n){var e=n.alternate;return n===Si||e!==null&&e===Si}function zz(n,e){vy=h1=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function Hz(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,sP(n,t)}}var d1={readContext:Vo,useCallback:Hr,useContext:Hr,useEffect:Hr,useImperativeHandle:Hr,useInsertionEffect:Hr,useLayoutEffect:Hr,useMemo:Hr,useReducer:Hr,useRef:Hr,useState:Hr,useDebugValue:Hr,useDeferredValue:Hr,useTransition:Hr,useMutableSource:Hr,useSyncExternalStore:Hr,useId:Hr,unstable_isNewReconciler:!1},F$={readContext:Vo,useCallback:function(n,e){return La().memoizedState=[n,e===void 0?null:e],n},useContext:Vo,useEffect:wB,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,xw(4194308,4,Lz.bind(null,e,n),t)},useLayoutEffect:function(n,e){return xw(4194308,4,n,e)},useInsertionEffect:function(n,e){return xw(4,2,n,e)},useMemo:function(n,e){var t=La();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=La();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=B$.bind(null,Si,n),[i.memoizedState,n]},useRef:function(n){var e=La();return n={current:n},e.memoizedState=n},useState:xB,useDebugValue:MP,useDeferredValue:function(n){return La().memoizedState=n},useTransition:function(){var n=xB(!1),e=n[0];return n=k$.bind(null,n[1]),La().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=Si,r=La();if(gi){if(t===void 0)throw Error(Qe(407));t=t()}else{if(t=e(),vr===null)throw Error(Qe(349));Sd&30||bz(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,wB(Mz.bind(null,i,s,n),[n]),i.flags|=2048,u0(9,Cz.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=La(),e=vr.identifierPrefix;if(gi){var t=Ul,i=Fl;t=(i&~(1<<32-da(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=l0++,0<t&&(e+="H"+t.toString(32)),e+=":"}else t=L$++,e=":"+e+"r"+t.toString(32)+":";return n.memoizedState=e},unstable_isNewReconciler:!1},U$={readContext:Vo,useCallback:Bz,useContext:Vo,useEffect:CP,useImperativeHandle:kz,useInsertionEffect:Nz,useLayoutEffect:Dz,useMemo:Oz,useReducer:eb,useRef:Pz,useState:function(){return eb(c0)},useDebugValue:MP,useDeferredValue:function(n){var e=zo();return Fz(e,nr.memoizedState,n)},useTransition:function(){var n=eb(c0)[0],e=zo().memoizedState;return[n,e]},useMutableSource:Sz,useSyncExternalStore:Tz,useId:Uz,unstable_isNewReconciler:!1},V$={readContext:Vo,useCallback:Bz,useContext:Vo,useEffect:CP,useImperativeHandle:kz,useInsertionEffect:Nz,useLayoutEffect:Dz,useMemo:Oz,useReducer:tb,useRef:Pz,useState:function(){return tb(c0)},useDebugValue:MP,useDeferredValue:function(n){var e=zo();return nr===null?e.memoizedState=n:Fz(e,nr.memoizedState,n)},useTransition:function(){var n=tb(c0)[0],e=zo().memoizedState;return[n,e]},useMutableSource:Sz,useSyncExternalStore:Tz,useId:Uz,unstable_isNewReconciler:!1};function na(n,e){if(n&&n.defaultProps){e=Ti({},e),n=n.defaultProps;for(var t in n)e[t]===void 0&&(e[t]=n[t]);return e}return e}function IM(n,e,t,i){e=n.memoizedState,t=t(i,e),t=t==null?e:Ti({},e,t),n.memoizedState=t,n.lanes===0&&(n.updateQueue.baseState=t)}var tA={isMounted:function(n){return(n=n._reactInternals)?Kd(n)===n:!1},enqueueSetState:function(n,e,t){n=n._reactInternals;var i=Es(),r=gu(n),s=Kl(i,r);s.payload=e,t!=null&&(s.callback=t),e=pu(n,s,r),e!==null&&(fa(e,n,r,i),vw(e,n,r))},enqueueReplaceState:function(n,e,t){n=n._reactInternals;var i=Es(),r=gu(n),s=Kl(i,r);s.tag=1,s.payload=e,t!=null&&(s.callback=t),e=pu(n,s,r),e!==null&&(fa(e,n,r,i),vw(e,n,r))},enqueueForceUpdate:function(n,e){n=n._reactInternals;var t=Es(),i=gu(n),r=Kl(t,i);r.tag=2,e!=null&&(r.callback=e),e=pu(n,r,i),e!==null&&(fa(e,n,i,t),vw(e,n,i))}};function EB(n,e,t,i,r,s,o){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(i,s,o):e.prototype&&e.prototype.isPureReactComponent?!n0(t,i)||!n0(r,s):!0}function Gz(n,e,t){var i=!1,r=bu,s=e.contextType;return typeof s=="object"&&s!==null?s=Vo(s):(r=Vs(e)?Ed:is.current,i=e.contextTypes,s=(i=i!=null)?Yp(n,r):bu),e=new e(t,s),n.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=tA,n.stateNode=e,e._reactInternals=n,i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=r,n.__reactInternalMemoizedMaskedChildContext=s),e}function AB(n,e,t,i){n=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(t,i),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(t,i),e.state!==n&&tA.enqueueReplaceState(e,e.state,null)}function RM(n,e,t,i){var r=n.stateNode;r.props=t,r.state=n.memoizedState,r.refs={},xP(n);var s=e.contextType;typeof s=="object"&&s!==null?r.context=Vo(s):(s=Vs(e)?Ed:is.current,r.context=Yp(n,s)),r.state=n.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(IM(n,e,s,t),r.state=n.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(e=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),e!==r.state&&tA.enqueueReplaceState(r,r.state,null),c1(n,t,r,i),r.state=n.memoizedState),typeof r.componentDidMount=="function"&&(n.flags|=4194308)}function Zp(n,e){try{var t="",i=e;do t+=pY(i),i=i.return;while(i);var r=t}catch(s){r=`
Error generating stack: `+s.message+`
`+s.stack}return{value:n,source:e,stack:r,digest:null}}function nb(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function PM(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var z$=typeof WeakMap=="function"?WeakMap:Map;function jz(n,e,t){t=Kl(-1,t),t.tag=3,t.payload={element:null};var i=e.value;return t.callback=function(){p1||(p1=!0,zM=i),PM(n,e)},t}function Wz(n,e,t){t=Kl(-1,t),t.tag=3;var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var r=e.value;t.payload=function(){return i(r)},t.callback=function(){PM(n,e)}}var s=n.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){PM(n,e),typeof i!="function"&&(mu===null?mu=new Set([this]):mu.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function SB(n,e,t){var i=n.pingCache;if(i===null){i=n.pingCache=new z$;var r=new Set;i.set(e,r)}else r=i.get(e),r===void 0&&(r=new Set,i.set(e,r));r.has(t)||(r.add(t),n=tJ.bind(null,n,e,t),e.then(n,n))}function TB(n){do{var e;if((e=n.tag===13)&&(e=n.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return n;n=n.return}while(n!==null);return null}function bB(n,e,t,i,r){return n.mode&1?(n.flags|=65536,n.lanes=r,n):(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=Kl(-1,1),e.tag=2,pu(t,e,1))),t.lanes|=1),n)}var H$=dc.ReactCurrentOwner,Bs=!1;function ms(n,e,t,i){e.child=n===null?xz(e,null,t,i):Jp(e,n.child,t,i)}function CB(n,e,t,i,r){t=t.render;var s=e.ref;return Tp(e,r),i=TP(n,e,t,i,s,r),t=bP(),n!==null&&!Bs?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,tc(n,e,r)):(gi&&t&&fP(e),e.flags|=1,ms(n,e,i,r),e.child)}function MB(n,e,t,i,r){if(n===null){var s=t.type;return typeof s=="function"&&!BP(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=s,Kz(n,e,s,i,r)):(n=Sw(t.type,null,i,e,e.mode,r),n.ref=e.ref,n.return=e,e.child=n)}if(s=n.child,!(n.lanes&r)){var o=s.memoizedProps;if(t=t.compare,t=t!==null?t:n0,t(o,i)&&n.ref===e.ref)return tc(n,e,r)}return e.flags|=1,n=yu(s,i),n.ref=e.ref,n.return=e,e.child=n}function Kz(n,e,t,i,r){if(n!==null){var s=n.memoizedProps;if(n0(s,i)&&n.ref===e.ref)if(Bs=!1,e.pendingProps=i=s,(n.lanes&r)!==0)n.flags&131072&&(Bs=!0);else return e.lanes=n.lanes,tc(n,e,r)}return NM(n,e,t,i,r)}function Xz(n,e,t){var i=e.pendingProps,r=i.children,s=n!==null?n.memoizedState:null;if(i.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},ri(lp,ro),ro|=t;else{if(!(t&1073741824))return n=s!==null?s.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,ri(lp,ro),ro|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=s!==null?s.baseLanes:t,ri(lp,ro),ro|=i}else s!==null?(i=s.baseLanes|t,e.memoizedState=null):i=t,ri(lp,ro),ro|=i;return ms(n,e,r,t),e.child}function qz(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function NM(n,e,t,i,r){var s=Vs(t)?Ed:is.current;return s=Yp(e,s),Tp(e,r),t=TP(n,e,t,i,s,r),i=bP(),n!==null&&!Bs?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,tc(n,e,r)):(gi&&i&&fP(e),e.flags|=1,ms(n,e,t,r),e.child)}function IB(n,e,t,i,r){if(Vs(t)){var s=!0;r1(e)}else s=!1;if(Tp(e,r),e.stateNode===null)ww(n,e),Gz(e,t,i),RM(e,t,i,r),i=!0;else if(n===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,c=t.contextType;typeof c=="object"&&c!==null?c=Vo(c):(c=Vs(t)?Ed:is.current,c=Yp(e,c));var u=t.getDerivedStateFromProps,h=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==i||l!==c)&&AB(e,o,i,c),Gc=!1;var f=e.memoizedState;o.state=f,c1(e,i,o,r),l=e.memoizedState,a!==i||f!==l||Us.current||Gc?(typeof u=="function"&&(IM(e,t,u,i),l=e.memoizedState),(a=Gc||EB(e,t,a,i,f,l,c))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=l),o.props=i,o.state=l,o.context=c,i=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{o=e.stateNode,Ez(n,e),a=e.memoizedProps,c=e.type===e.elementType?a:na(e.type,a),o.props=c,h=e.pendingProps,f=o.context,l=t.contextType,typeof l=="object"&&l!==null?l=Vo(l):(l=Vs(t)?Ed:is.current,l=Yp(e,l));var m=t.getDerivedStateFromProps;(u=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==h||f!==l)&&AB(e,o,i,l),Gc=!1,f=e.memoizedState,o.state=f,c1(e,i,o,r);var y=e.memoizedState;a!==h||f!==y||Us.current||Gc?(typeof m=="function"&&(IM(e,t,m,i),y=e.memoizedState),(c=Gc||EB(e,t,c,i,f,y,l)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(i,y,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(i,y,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&f===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&f===n.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=y),o.props=i,o.state=y,o.context=l,i=c):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&f===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&f===n.memoizedState||(e.flags|=1024),i=!1)}return DM(n,e,t,i,s,r)}function DM(n,e,t,i,r,s){qz(n,e);var o=(e.flags&128)!==0;if(!i&&!o)return r&&pB(e,t,!1),tc(n,e,s);i=e.stateNode,H$.current=e;var a=o&&typeof t.getDerivedStateFromError!="function"?null:i.render();return e.flags|=1,n!==null&&o?(e.child=Jp(e,n.child,null,s),e.child=Jp(e,null,a,s)):ms(n,e,a,s),e.memoizedState=i.state,r&&pB(e,t,!0),e.child}function Yz(n){var e=n.stateNode;e.pendingContext?fB(n,e.pendingContext,e.pendingContext!==e.context):e.context&&fB(n,e.context,!1),wP(n,e.containerInfo)}function RB(n,e,t,i,r){return $p(),mP(r),e.flags|=256,ms(n,e,t,i),e.child}var LM={dehydrated:null,treeContext:null,retryLane:0};function kM(n){return{baseLanes:n,cachePool:null,transitions:null}}function $z(n,e,t){var i=e.pendingProps,r=xi.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=n!==null&&n.memoizedState===null?!1:(r&2)!==0),a?(s=!0,e.flags&=-129):(n===null||n.memoizedState!==null)&&(r|=1),ri(xi,r&1),n===null)return CM(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(e.mode&1?n.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=i.children,n=i.fallback,s?(i=e.mode,s=e.child,o={mode:"hidden",children:o},!(i&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=rA(o,i,0,null),n=dd(n,i,t,null),s.return=e,n.return=e,s.sibling=n,e.child=s,e.child.memoizedState=kM(t),e.memoizedState=LM,n):IP(e,o));if(r=n.memoizedState,r!==null&&(a=r.dehydrated,a!==null))return G$(n,e,o,i,a,r,t);if(s){s=i.fallback,o=e.mode,r=n.child,a=r.sibling;var l={mode:"hidden",children:i.children};return!(o&1)&&e.child!==r?(i=e.child,i.childLanes=0,i.pendingProps=l,e.deletions=null):(i=yu(r,l),i.subtreeFlags=r.subtreeFlags&14680064),a!==null?s=yu(a,s):(s=dd(s,o,t,null),s.flags|=2),s.return=e,i.return=e,i.sibling=s,e.child=i,i=s,s=e.child,o=n.child.memoizedState,o=o===null?kM(t):{baseLanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=n.childLanes&~t,e.memoizedState=LM,i}return s=n.child,n=s.sibling,i=yu(s,{mode:"visible",children:i.children}),!(e.mode&1)&&(i.lanes=t),i.return=e,i.sibling=null,n!==null&&(t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)),e.child=i,e.memoizedState=null,i}function IP(n,e){return e=rA({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function q_(n,e,t,i){return i!==null&&mP(i),Jp(e,n.child,null,t),n=IP(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function G$(n,e,t,i,r,s,o){if(t)return e.flags&256?(e.flags&=-257,i=nb(Error(Qe(422))),q_(n,e,o,i)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(s=i.fallback,r=e.mode,i=rA({mode:"visible",children:i.children},r,0,null),s=dd(s,r,o,null),s.flags|=2,i.return=e,s.return=e,i.sibling=s,e.child=i,e.mode&1&&Jp(e,n.child,null,o),e.child.memoizedState=kM(o),e.memoizedState=LM,s);if(!(e.mode&1))return q_(n,e,o,null);if(r.data==="$!"){if(i=r.nextSibling&&r.nextSibling.dataset,i)var a=i.dgst;return i=a,s=Error(Qe(419)),i=nb(s,i,void 0),q_(n,e,o,i)}if(a=(o&n.childLanes)!==0,Bs||a){if(i=vr,i!==null){switch(o&-o){case 4:r=2;break;case 16:r=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}r=r&(i.suspendedLanes|o)?0:r,r!==0&&r!==s.retryLane&&(s.retryLane=r,ec(n,r),fa(i,n,r,-1))}return kP(),i=nb(Error(Qe(421))),q_(n,e,o,i)}return r.data==="$?"?(e.flags|=128,e.child=n.child,e=nJ.bind(null,n),r._reactRetry=e,null):(n=s.treeContext,oo=fu(r.nextSibling),lo=e,gi=!0,la=null,n!==null&&(Ro[Po++]=Fl,Ro[Po++]=Ul,Ro[Po++]=Ad,Fl=n.id,Ul=n.overflow,Ad=e),e=IP(e,i.children),e.flags|=4096,e)}function PB(n,e,t){n.lanes|=e;var i=n.alternate;i!==null&&(i.lanes|=e),MM(n.return,e,t)}function ib(n,e,t,i,r){var s=n.memoizedState;s===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:t,tailMode:r}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=t,s.tailMode=r)}function Jz(n,e,t){var i=e.pendingProps,r=i.revealOrder,s=i.tail;if(ms(n,e,i.children,t),i=xi.current,i&2)i=i&1|2,e.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&PB(n,t,e);else if(n.tag===19)PB(n,t,e);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}i&=1}if(ri(xi,i),!(e.mode&1))e.memoizedState=null;else switch(r){case"forwards":for(t=e.child,r=null;t!==null;)n=t.alternate,n!==null&&u1(n)===null&&(r=t),t=t.sibling;t=r,t===null?(r=e.child,e.child=null):(r=t.sibling,t.sibling=null),ib(e,!1,r,t,s);break;case"backwards":for(t=null,r=e.child,e.child=null;r!==null;){if(n=r.alternate,n!==null&&u1(n)===null){e.child=r;break}n=r.sibling,r.sibling=t,t=r,r=n}ib(e,!0,t,null,s);break;case"together":ib(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function ww(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function tc(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),Td|=e.lanes,!(t&e.childLanes))return null;if(n!==null&&e.child!==n.child)throw Error(Qe(153));if(e.child!==null){for(n=e.child,t=yu(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=yu(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function j$(n,e,t){switch(e.tag){case 3:Yz(e),$p();break;case 5:Az(e);break;case 1:Vs(e.type)&&r1(e);break;case 4:wP(e,e.stateNode.containerInfo);break;case 10:var i=e.type._context,r=e.memoizedProps.value;ri(a1,i._currentValue),i._currentValue=r;break;case 13:if(i=e.memoizedState,i!==null)return i.dehydrated!==null?(ri(xi,xi.current&1),e.flags|=128,null):t&e.child.childLanes?$z(n,e,t):(ri(xi,xi.current&1),n=tc(n,e,t),n!==null?n.sibling:null);ri(xi,xi.current&1);break;case 19:if(i=(t&e.childLanes)!==0,n.flags&128){if(i)return Jz(n,e,t);e.flags|=128}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),ri(xi,xi.current),i)break;return null;case 22:case 23:return e.lanes=0,Xz(n,e,t)}return tc(n,e,t)}var Qz,BM,Zz,eH;Qz=function(n,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)n.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};BM=function(){};Zz=function(n,e,t,i){var r=n.memoizedProps;if(r!==i){n=e.stateNode,Kh(Wa.current);var s=null;switch(t){case"input":r=rM(n,r),i=rM(n,i),s=[];break;case"select":r=Ti({},r,{value:void 0}),i=Ti({},i,{value:void 0}),s=[];break;case"textarea":r=aM(n,r),i=aM(n,i),s=[];break;default:typeof r.onClick!="function"&&typeof i.onClick=="function"&&(n.onclick=n1)}cM(t,i);var o;t=null;for(c in r)if(!i.hasOwnProperty(c)&&r.hasOwnProperty(c)&&r[c]!=null)if(c==="style"){var a=r[c];for(o in a)a.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Yy.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in i){var l=i[c];if(a=r!=null?r[c]:void 0,i.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(t||(t={}),t[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(t||(t={}),t[o]=l[o])}else t||(s||(s=[]),s.push(c,t)),t=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Yy.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&ai("scroll",n),s||a===l||(s=[])):(s=s||[]).push(c,l))}t&&(s=s||[]).push("style",t);var c=s;(e.updateQueue=c)&&(e.flags|=4)}};eH=function(n,e,t,i){t!==i&&(e.flags|=4)};function bg(n,e){if(!gi)switch(n.tailMode){case"hidden":e=n.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?n.tail=null:t.sibling=null;break;case"collapsed":t=n.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e||n.tail===null?n.tail=null:n.tail.sibling=null:i.sibling=null}}function Gr(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,i=0;if(e)for(var r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags&14680064,i|=r.flags&14680064,r.return=n,r=r.sibling;else for(r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=n,r=r.sibling;return n.subtreeFlags|=i,n.childLanes=t,e}function W$(n,e,t){var i=e.pendingProps;switch(pP(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Gr(e),null;case 1:return Vs(e.type)&&i1(),Gr(e),null;case 3:return i=e.stateNode,Qp(),di(Us),di(is),AP(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(K_(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,la!==null&&(jM(la),la=null))),BM(n,e),Gr(e),null;case 5:EP(e);var r=Kh(a0.current);if(t=e.type,n!==null&&e.stateNode!=null)Zz(n,e,t,i,r),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!i){if(e.stateNode===null)throw Error(Qe(166));return Gr(e),null}if(n=Kh(Wa.current),K_(e)){i=e.stateNode,t=e.type;var s=e.memoizedProps;switch(i[Ua]=e,i[s0]=s,n=(e.mode&1)!==0,t){case"dialog":ai("cancel",i),ai("close",i);break;case"iframe":case"object":case"embed":ai("load",i);break;case"video":case"audio":for(r=0;r<ny.length;r++)ai(ny[r],i);break;case"source":ai("error",i);break;case"img":case"image":case"link":ai("error",i),ai("load",i);break;case"details":ai("toggle",i);break;case"input":Vk(i,s),ai("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!s.multiple},ai("invalid",i);break;case"textarea":Hk(i,s),ai("invalid",i)}cM(t,s),r=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?i.textContent!==a&&(s.suppressHydrationWarning!==!0&&W_(i.textContent,a,n),r=["children",a]):typeof a=="number"&&i.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&W_(i.textContent,a,n),r=["children",""+a]):Yy.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&ai("scroll",i)}switch(t){case"input":O_(i),zk(i,s,!0);break;case"textarea":O_(i),Gk(i);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(i.onclick=n1)}i=r,e.updateQueue=i,i!==null&&(e.flags|=4)}else{o=r.nodeType===9?r:r.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=MV(t)),n==="http://www.w3.org/1999/xhtml"?t==="script"?(n=o.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=o.createElement(t,{is:i.is}):(n=o.createElement(t),t==="select"&&(o=n,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):n=o.createElementNS(n,t),n[Ua]=e,n[s0]=i,Qz(n,e,!1,!1),e.stateNode=n;e:{switch(o=uM(t,i),t){case"dialog":ai("cancel",n),ai("close",n),r=i;break;case"iframe":case"object":case"embed":ai("load",n),r=i;break;case"video":case"audio":for(r=0;r<ny.length;r++)ai(ny[r],n);r=i;break;case"source":ai("error",n),r=i;break;case"img":case"image":case"link":ai("error",n),ai("load",n),r=i;break;case"details":ai("toggle",n),r=i;break;case"input":Vk(n,i),r=rM(n,i),ai("invalid",n);break;case"option":r=i;break;case"select":n._wrapperState={wasMultiple:!!i.multiple},r=Ti({},i,{value:void 0}),ai("invalid",n);break;case"textarea":Hk(n,i),r=aM(n,i),ai("invalid",n);break;default:r=i}cM(t,r),a=r;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?PV(n,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&IV(n,l)):s==="children"?typeof l=="string"?(t!=="textarea"||l!=="")&&$y(n,l):typeof l=="number"&&$y(n,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Yy.hasOwnProperty(s)?l!=null&&s==="onScroll"&&ai("scroll",n):l!=null&&ZR(n,s,l,o))}switch(t){case"input":O_(n),zk(n,i,!1);break;case"textarea":O_(n),Gk(n);break;case"option":i.value!=null&&n.setAttribute("value",""+Tu(i.value));break;case"select":n.multiple=!!i.multiple,s=i.value,s!=null?wp(n,!!i.multiple,s,!1):i.defaultValue!=null&&wp(n,!!i.multiple,i.defaultValue,!0);break;default:typeof r.onClick=="function"&&(n.onclick=n1)}switch(t){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}}i&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Gr(e),null;case 6:if(n&&e.stateNode!=null)eH(n,e,n.memoizedProps,i);else{if(typeof i!="string"&&e.stateNode===null)throw Error(Qe(166));if(t=Kh(a0.current),Kh(Wa.current),K_(e)){if(i=e.stateNode,t=e.memoizedProps,i[Ua]=e,(s=i.nodeValue!==t)&&(n=lo,n!==null))switch(n.tag){case 3:W_(i.nodeValue,t,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&W_(i.nodeValue,t,(n.mode&1)!==0)}s&&(e.flags|=4)}else i=(t.nodeType===9?t:t.ownerDocument).createTextNode(i),i[Ua]=e,e.stateNode=i}return Gr(e),null;case 13:if(di(xi),i=e.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(gi&&oo!==null&&e.mode&1&&!(e.flags&128))vz(),$p(),e.flags|=98560,s=!1;else if(s=K_(e),i!==null&&i.dehydrated!==null){if(n===null){if(!s)throw Error(Qe(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(Qe(317));s[Ua]=e}else $p(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Gr(e),s=!1}else la!==null&&(jM(la),la=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=t,e):(i=i!==null,i!==(n!==null&&n.memoizedState!==null)&&i&&(e.child.flags|=8192,e.mode&1&&(n===null||xi.current&1?rr===0&&(rr=3):kP())),e.updateQueue!==null&&(e.flags|=4),Gr(e),null);case 4:return Qp(),BM(n,e),n===null&&i0(e.stateNode.containerInfo),Gr(e),null;case 10:return vP(e.type._context),Gr(e),null;case 17:return Vs(e.type)&&i1(),Gr(e),null;case 19:if(di(xi),s=e.memoizedState,s===null)return Gr(e),null;if(i=(e.flags&128)!==0,o=s.rendering,o===null)if(i)bg(s,!1);else{if(rr!==0||n!==null&&n.flags&128)for(n=e.child;n!==null;){if(o=u1(n),o!==null){for(e.flags|=128,bg(s,!1),i=o.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),e.subtreeFlags=0,i=t,t=e.child;t!==null;)s=t,n=i,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=n,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,n=o.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t=t.sibling;return ri(xi,xi.current&1|2),e.child}n=n.sibling}s.tail!==null&&Fi()>em&&(e.flags|=128,i=!0,bg(s,!1),e.lanes=4194304)}else{if(!i)if(n=u1(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),bg(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!gi)return Gr(e),null}else 2*Fi()-s.renderingStartTime>em&&t!==1073741824&&(e.flags|=128,i=!0,bg(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Fi(),e.sibling=null,t=xi.current,ri(xi,i?t&1|2:t&1),e):(Gr(e),null);case 22:case 23:return LP(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?ro&1073741824&&(Gr(e),e.subtreeFlags&6&&(e.flags|=8192)):Gr(e),null;case 24:return null;case 25:return null}throw Error(Qe(156,e.tag))}function K$(n,e){switch(pP(e),e.tag){case 1:return Vs(e.type)&&i1(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Qp(),di(Us),di(is),AP(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return EP(e),null;case 13:if(di(xi),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Qe(340));$p()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return di(xi),null;case 4:return Qp(),null;case 10:return vP(e.type._context),null;case 22:case 23:return LP(),null;case 24:return null;default:return null}}var Y_=!1,$r=!1,X$=typeof WeakSet=="function"?WeakSet:Set,Ct=null;function ap(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){Ri(n,e,i)}else t.current=null}function OM(n,e,t){try{t()}catch(i){Ri(n,e,i)}}var NB=!1;function q$(n,e){if(xM=Zw,n=sz(),dP(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,c=0,u=0,h=n,f=null;t:for(;;){for(var m;h!==t||r!==0&&h.nodeType!==3||(a=o+r),h!==s||i!==0&&h.nodeType!==3||(l=o+i),h.nodeType===3&&(o+=h.nodeValue.length),(m=h.firstChild)!==null;)f=h,h=m;for(;;){if(h===n)break t;if(f===t&&++c===r&&(a=o),f===s&&++u===i&&(l=o),(m=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=m}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(wM={focusedElem:n,selectionRange:t},Zw=!1,Ct=e;Ct!==null;)if(e=Ct,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,Ct=n;else for(;Ct!==null;){e=Ct;try{var y=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var _=y.memoizedProps,v=y.memoizedState,g=e.stateNode,w=g.getSnapshotBeforeUpdate(e.elementType===e.type?_:na(e.type,_),v);g.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var A=e.stateNode.containerInfo;A.nodeType===1?A.textContent="":A.nodeType===9&&A.documentElement&&A.removeChild(A.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Qe(163))}}catch(T){Ri(e,e.return,T)}if(n=e.sibling,n!==null){n.return=e.return,Ct=n;break}Ct=e.return}return y=NB,NB=!1,y}function _y(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&n)===n){var s=r.destroy;r.destroy=void 0,s!==void 0&&OM(e,t,s)}r=r.next}while(r!==i)}}function nA(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function FM(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function tH(n){var e=n.alternate;e!==null&&(n.alternate=null,tH(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Ua],delete e[s0],delete e[SM],delete e[R$],delete e[P$])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function nH(n){return n.tag===5||n.tag===3||n.tag===4}function DB(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||nH(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function UM(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=n1));else if(i!==4&&(n=n.child,n!==null))for(UM(n,e,t),n=n.sibling;n!==null;)UM(n,e,t),n=n.sibling}function VM(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(VM(n,e,t),n=n.sibling;n!==null;)VM(n,e,t),n=n.sibling}var Ar=null,aa=!1;function bc(n,e,t){for(t=t.child;t!==null;)iH(n,e,t),t=t.sibling}function iH(n,e,t){if(ja&&typeof ja.onCommitFiberUnmount=="function")try{ja.onCommitFiberUnmount(qE,t)}catch{}switch(t.tag){case 5:$r||ap(t,e);case 6:var i=Ar,r=aa;Ar=null,bc(n,e,t),Ar=i,aa=r,Ar!==null&&(aa?(n=Ar,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Ar.removeChild(t.stateNode));break;case 18:Ar!==null&&(aa?(n=Ar,t=t.stateNode,n.nodeType===8?$T(n.parentNode,t):n.nodeType===1&&$T(n,t),e0(n)):$T(Ar,t.stateNode));break;case 4:i=Ar,r=aa,Ar=t.stateNode.containerInfo,aa=!0,bc(n,e,t),Ar=i,aa=r;break;case 0:case 11:case 14:case 15:if(!$r&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&OM(t,e,o),r=r.next}while(r!==i)}bc(n,e,t);break;case 1:if(!$r&&(ap(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){Ri(t,e,a)}bc(n,e,t);break;case 21:bc(n,e,t);break;case 22:t.mode&1?($r=(i=$r)||t.memoizedState!==null,bc(n,e,t),$r=i):bc(n,e,t);break;default:bc(n,e,t)}}function LB(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new X$),e.forEach(function(i){var r=iJ.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function qo(n,e){var t=e.deletions;if(t!==null)for(var i=0;i<t.length;i++){var r=t[i];try{var s=n,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:Ar=a.stateNode,aa=!1;break e;case 3:Ar=a.stateNode.containerInfo,aa=!0;break e;case 4:Ar=a.stateNode.containerInfo,aa=!0;break e}a=a.return}if(Ar===null)throw Error(Qe(160));iH(s,o,r),Ar=null,aa=!1;var l=r.alternate;l!==null&&(l.return=null),r.return=null}catch(c){Ri(r,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)rH(e,n),e=e.sibling}function rH(n,e){var t=n.alternate,i=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(qo(e,n),Da(n),i&4){try{_y(3,n,n.return),nA(3,n)}catch(_){Ri(n,n.return,_)}try{_y(5,n,n.return)}catch(_){Ri(n,n.return,_)}}break;case 1:qo(e,n),Da(n),i&512&&t!==null&&ap(t,t.return);break;case 5:if(qo(e,n),Da(n),i&512&&t!==null&&ap(t,t.return),n.flags&32){var r=n.stateNode;try{$y(r,"")}catch(_){Ri(n,n.return,_)}}if(i&4&&(r=n.stateNode,r!=null)){var s=n.memoizedProps,o=t!==null?t.memoizedProps:s,a=n.type,l=n.updateQueue;if(n.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&bV(r,s),uM(a,o);var c=uM(a,s);for(o=0;o<l.length;o+=2){var u=l[o],h=l[o+1];u==="style"?PV(r,h):u==="dangerouslySetInnerHTML"?IV(r,h):u==="children"?$y(r,h):ZR(r,u,h,c)}switch(a){case"input":sM(r,s);break;case"textarea":CV(r,s);break;case"select":var f=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!s.multiple;var m=s.value;m!=null?wp(r,!!s.multiple,m,!1):f!==!!s.multiple&&(s.defaultValue!=null?wp(r,!!s.multiple,s.defaultValue,!0):wp(r,!!s.multiple,s.multiple?[]:"",!1))}r[s0]=s}catch(_){Ri(n,n.return,_)}}break;case 6:if(qo(e,n),Da(n),i&4){if(n.stateNode===null)throw Error(Qe(162));r=n.stateNode,s=n.memoizedProps;try{r.nodeValue=s}catch(_){Ri(n,n.return,_)}}break;case 3:if(qo(e,n),Da(n),i&4&&t!==null&&t.memoizedState.isDehydrated)try{e0(e.containerInfo)}catch(_){Ri(n,n.return,_)}break;case 4:qo(e,n),Da(n);break;case 13:qo(e,n),Da(n),r=n.child,r.flags&8192&&(s=r.memoizedState!==null,r.stateNode.isHidden=s,!s||r.alternate!==null&&r.alternate.memoizedState!==null||(NP=Fi())),i&4&&LB(n);break;case 22:if(u=t!==null&&t.memoizedState!==null,n.mode&1?($r=(c=$r)||u,qo(e,n),$r=c):qo(e,n),Da(n),i&8192){if(c=n.memoizedState!==null,(n.stateNode.isHidden=c)&&!u&&n.mode&1)for(Ct=n,u=n.child;u!==null;){for(h=Ct=u;Ct!==null;){switch(f=Ct,m=f.child,f.tag){case 0:case 11:case 14:case 15:_y(4,f,f.return);break;case 1:ap(f,f.return);var y=f.stateNode;if(typeof y.componentWillUnmount=="function"){i=f,t=f.return;try{e=i,y.props=e.memoizedProps,y.state=e.memoizedState,y.componentWillUnmount()}catch(_){Ri(i,t,_)}}break;case 5:ap(f,f.return);break;case 22:if(f.memoizedState!==null){BB(h);continue}}m!==null?(m.return=f,Ct=m):BB(h)}u=u.sibling}e:for(u=null,h=n;;){if(h.tag===5){if(u===null){u=h;try{r=h.stateNode,c?(s=r.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=h.stateNode,l=h.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=RV("display",o))}catch(_){Ri(n,n.return,_)}}}else if(h.tag===6){if(u===null)try{h.stateNode.nodeValue=c?"":h.memoizedProps}catch(_){Ri(n,n.return,_)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===n)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===n)break e;for(;h.sibling===null;){if(h.return===null||h.return===n)break e;u===h&&(u=null),h=h.return}u===h&&(u=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:qo(e,n),Da(n),i&4&&LB(n);break;case 21:break;default:qo(e,n),Da(n)}}function Da(n){var e=n.flags;if(e&2){try{e:{for(var t=n.return;t!==null;){if(nH(t)){var i=t;break e}t=t.return}throw Error(Qe(160))}switch(i.tag){case 5:var r=i.stateNode;i.flags&32&&($y(r,""),i.flags&=-33);var s=DB(n);VM(n,s,r);break;case 3:case 4:var o=i.stateNode.containerInfo,a=DB(n);UM(n,a,o);break;default:throw Error(Qe(161))}}catch(l){Ri(n,n.return,l)}n.flags&=-3}e&4096&&(n.flags&=-4097)}function Y$(n,e,t){Ct=n,sH(n)}function sH(n,e,t){for(var i=(n.mode&1)!==0;Ct!==null;){var r=Ct,s=r.child;if(r.tag===22&&i){var o=r.memoizedState!==null||Y_;if(!o){var a=r.alternate,l=a!==null&&a.memoizedState!==null||$r;a=Y_;var c=$r;if(Y_=o,($r=l)&&!c)for(Ct=r;Ct!==null;)o=Ct,l=o.child,o.tag===22&&o.memoizedState!==null?OB(r):l!==null?(l.return=o,Ct=l):OB(r);for(;s!==null;)Ct=s,sH(s),s=s.sibling;Ct=r,Y_=a,$r=c}kB(n)}else r.subtreeFlags&8772&&s!==null?(s.return=r,Ct=s):kB(n)}}function kB(n){for(;Ct!==null;){var e=Ct;if(e.flags&8772){var t=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:$r||nA(5,e);break;case 1:var i=e.stateNode;if(e.flags&4&&!$r)if(t===null)i.componentDidMount();else{var r=e.elementType===e.type?t.memoizedProps:na(e.type,t.memoizedProps);i.componentDidUpdate(r,t.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&_B(e,s,i);break;case 3:var o=e.updateQueue;if(o!==null){if(t=null,e.child!==null)switch(e.child.tag){case 5:t=e.child.stateNode;break;case 1:t=e.child.stateNode}_B(e,o,t)}break;case 5:var a=e.stateNode;if(t===null&&e.flags&4){t=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&t.focus();break;case"img":l.src&&(t.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var c=e.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var h=u.dehydrated;h!==null&&e0(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Qe(163))}$r||e.flags&512&&FM(e)}catch(f){Ri(e,e.return,f)}}if(e===n){Ct=null;break}if(t=e.sibling,t!==null){t.return=e.return,Ct=t;break}Ct=e.return}}function BB(n){for(;Ct!==null;){var e=Ct;if(e===n){Ct=null;break}var t=e.sibling;if(t!==null){t.return=e.return,Ct=t;break}Ct=e.return}}function OB(n){for(;Ct!==null;){var e=Ct;try{switch(e.tag){case 0:case 11:case 15:var t=e.return;try{nA(4,e)}catch(l){Ri(e,t,l)}break;case 1:var i=e.stateNode;if(typeof i.componentDidMount=="function"){var r=e.return;try{i.componentDidMount()}catch(l){Ri(e,r,l)}}var s=e.return;try{FM(e)}catch(l){Ri(e,s,l)}break;case 5:var o=e.return;try{FM(e)}catch(l){Ri(e,o,l)}}}catch(l){Ri(e,e.return,l)}if(e===n){Ct=null;break}var a=e.sibling;if(a!==null){a.return=e.return,Ct=a;break}Ct=e.return}}var $$=Math.ceil,f1=dc.ReactCurrentDispatcher,RP=dc.ReactCurrentOwner,Fo=dc.ReactCurrentBatchConfig,On=0,vr=null,Ji=null,Mr=0,ro=0,lp=Wu(0),rr=0,h0=null,Td=0,iA=0,PP=0,xy=null,Ds=null,NP=0,em=1/0,Rl=null,p1=!1,zM=null,mu=null,$_=!1,ru=null,m1=0,wy=0,HM=null,Ew=-1,Aw=0;function Es(){return On&6?Fi():Ew!==-1?Ew:Ew=Fi()}function gu(n){return n.mode&1?On&2&&Mr!==0?Mr&-Mr:D$.transition!==null?(Aw===0&&(Aw=GV()),Aw):(n=Jn,n!==0||(n=window.event,n=n===void 0?16:$V(n.type)),n):1}function fa(n,e,t,i){if(50<wy)throw wy=0,HM=null,Error(Qe(185));Z0(n,t,i),(!(On&2)||n!==vr)&&(n===vr&&(!(On&2)&&(iA|=t),rr===4&&Kc(n,Mr)),zs(n,i),t===1&&On===0&&!(e.mode&1)&&(em=Fi()+500,ZE&&Ku()))}function zs(n,e){var t=n.callbackNode;DY(n,e);var i=Qw(n,n===vr?Mr:0);if(i===0)t!==null&&Kk(t),n.callbackNode=null,n.callbackPriority=0;else if(e=i&-i,n.callbackPriority!==e){if(t!=null&&Kk(t),e===1)n.tag===0?N$(FB.bind(null,n)):mz(FB.bind(null,n)),M$(function(){!(On&6)&&Ku()}),t=null;else{switch(jV(i)){case 1:t=rP;break;case 4:t=zV;break;case 16:t=Jw;break;case 536870912:t=HV;break;default:t=Jw}t=fH(t,oH.bind(null,n))}n.callbackPriority=e,n.callbackNode=t}}function oH(n,e){if(Ew=-1,Aw=0,On&6)throw Error(Qe(327));var t=n.callbackNode;if(bp()&&n.callbackNode!==t)return null;var i=Qw(n,n===vr?Mr:0);if(i===0)return null;if(i&30||i&n.expiredLanes||e)e=g1(n,i);else{e=i;var r=On;On|=2;var s=lH();(vr!==n||Mr!==e)&&(Rl=null,em=Fi()+500,hd(n,e));do try{Z$();break}catch(a){aH(n,a)}while(!0);yP(),f1.current=s,On=r,Ji!==null?e=0:(vr=null,Mr=0,e=rr)}if(e!==0){if(e===2&&(r=mM(n),r!==0&&(i=r,e=GM(n,r))),e===1)throw t=h0,hd(n,0),Kc(n,i),zs(n,Fi()),t;if(e===6)Kc(n,i);else{if(r=n.current.alternate,!(i&30)&&!J$(r)&&(e=g1(n,i),e===2&&(s=mM(n),s!==0&&(i=s,e=GM(n,s))),e===1))throw t=h0,hd(n,0),Kc(n,i),zs(n,Fi()),t;switch(n.finishedWork=r,n.finishedLanes=i,e){case 0:case 1:throw Error(Qe(345));case 2:kh(n,Ds,Rl);break;case 3:if(Kc(n,i),(i&130023424)===i&&(e=NP+500-Fi(),10<e)){if(Qw(n,0)!==0)break;if(r=n.suspendedLanes,(r&i)!==i){Es(),n.pingedLanes|=n.suspendedLanes&r;break}n.timeoutHandle=AM(kh.bind(null,n,Ds,Rl),e);break}kh(n,Ds,Rl);break;case 4:if(Kc(n,i),(i&4194240)===i)break;for(e=n.eventTimes,r=-1;0<i;){var o=31-da(i);s=1<<o,o=e[o],o>r&&(r=o),i&=~s}if(i=r,i=Fi()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*$$(i/1960))-i,10<i){n.timeoutHandle=AM(kh.bind(null,n,Ds,Rl),i);break}kh(n,Ds,Rl);break;case 5:kh(n,Ds,Rl);break;default:throw Error(Qe(329))}}}return zs(n,Fi()),n.callbackNode===t?oH.bind(null,n):null}function GM(n,e){var t=xy;return n.current.memoizedState.isDehydrated&&(hd(n,e).flags|=256),n=g1(n,e),n!==2&&(e=Ds,Ds=t,e!==null&&jM(e)),n}function jM(n){Ds===null?Ds=n:Ds.push.apply(Ds,n)}function J$(n){for(var e=n;;){if(e.flags&16384){var t=e.updateQueue;if(t!==null&&(t=t.stores,t!==null))for(var i=0;i<t.length;i++){var r=t[i],s=r.getSnapshot;r=r.value;try{if(!va(s(),r))return!1}catch{return!1}}}if(t=e.child,e.subtreeFlags&16384&&t!==null)t.return=e,e=t;else{if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Kc(n,e){for(e&=~PP,e&=~iA,n.suspendedLanes|=e,n.pingedLanes&=~e,n=n.expirationTimes;0<e;){var t=31-da(e),i=1<<t;n[t]=-1,e&=~i}}function FB(n){if(On&6)throw Error(Qe(327));bp();var e=Qw(n,0);if(!(e&1))return zs(n,Fi()),null;var t=g1(n,e);if(n.tag!==0&&t===2){var i=mM(n);i!==0&&(e=i,t=GM(n,i))}if(t===1)throw t=h0,hd(n,0),Kc(n,e),zs(n,Fi()),t;if(t===6)throw Error(Qe(345));return n.finishedWork=n.current.alternate,n.finishedLanes=e,kh(n,Ds,Rl),zs(n,Fi()),null}function DP(n,e){var t=On;On|=1;try{return n(e)}finally{On=t,On===0&&(em=Fi()+500,ZE&&Ku())}}function bd(n){ru!==null&&ru.tag===0&&!(On&6)&&bp();var e=On;On|=1;var t=Fo.transition,i=Jn;try{if(Fo.transition=null,Jn=1,n)return n()}finally{Jn=i,Fo.transition=t,On=e,!(On&6)&&Ku()}}function LP(){ro=lp.current,di(lp)}function hd(n,e){n.finishedWork=null,n.finishedLanes=0;var t=n.timeoutHandle;if(t!==-1&&(n.timeoutHandle=-1,C$(t)),Ji!==null)for(t=Ji.return;t!==null;){var i=t;switch(pP(i),i.tag){case 1:i=i.type.childContextTypes,i!=null&&i1();break;case 3:Qp(),di(Us),di(is),AP();break;case 5:EP(i);break;case 4:Qp();break;case 13:di(xi);break;case 19:di(xi);break;case 10:vP(i.type._context);break;case 22:case 23:LP()}t=t.return}if(vr=n,Ji=n=yu(n.current,null),Mr=ro=e,rr=0,h0=null,PP=iA=Td=0,Ds=xy=null,Wh!==null){for(e=0;e<Wh.length;e++)if(t=Wh[e],i=t.interleaved,i!==null){t.interleaved=null;var r=i.next,s=t.pending;if(s!==null){var o=s.next;s.next=r,i.next=o}t.pending=i}Wh=null}return n}function aH(n,e){do{var t=Ji;try{if(yP(),_w.current=d1,h1){for(var i=Si.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}h1=!1}if(Sd=0,pr=nr=Si=null,vy=!1,l0=0,RP.current=null,t===null||t.return===null){rr=1,h0=e,Ji=null;break}e:{var s=n,o=t.return,a=t,l=e;if(e=Mr,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=a,h=u.tag;if(!(u.mode&1)&&(h===0||h===11||h===15)){var f=u.alternate;f?(u.updateQueue=f.updateQueue,u.memoizedState=f.memoizedState,u.lanes=f.lanes):(u.updateQueue=null,u.memoizedState=null)}var m=TB(o);if(m!==null){m.flags&=-257,bB(m,o,a,s,e),m.mode&1&&SB(s,c,e),e=m,l=c;var y=e.updateQueue;if(y===null){var _=new Set;_.add(l),e.updateQueue=_}else y.add(l);break e}else{if(!(e&1)){SB(s,c,e),kP();break e}l=Error(Qe(426))}}else if(gi&&a.mode&1){var v=TB(o);if(v!==null){!(v.flags&65536)&&(v.flags|=256),bB(v,o,a,s,e),mP(Zp(l,a));break e}}s=l=Zp(l,a),rr!==4&&(rr=2),xy===null?xy=[s]:xy.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var g=jz(s,l,e);vB(s,g);break e;case 1:a=l;var w=s.type,A=s.stateNode;if(!(s.flags&128)&&(typeof w.getDerivedStateFromError=="function"||A!==null&&typeof A.componentDidCatch=="function"&&(mu===null||!mu.has(A)))){s.flags|=65536,e&=-e,s.lanes|=e;var T=Wz(s,a,e);vB(s,T);break e}}s=s.return}while(s!==null)}uH(t)}catch(L){e=L,Ji===t&&t!==null&&(Ji=t=t.return);continue}break}while(!0)}function lH(){var n=f1.current;return f1.current=d1,n===null?d1:n}function kP(){(rr===0||rr===3||rr===2)&&(rr=4),vr===null||!(Td&268435455)&&!(iA&268435455)||Kc(vr,Mr)}function g1(n,e){var t=On;On|=2;var i=lH();(vr!==n||Mr!==e)&&(Rl=null,hd(n,e));do try{Q$();break}catch(r){aH(n,r)}while(!0);if(yP(),On=t,f1.current=i,Ji!==null)throw Error(Qe(261));return vr=null,Mr=0,rr}function Q$(){for(;Ji!==null;)cH(Ji)}function Z$(){for(;Ji!==null&&!SY();)cH(Ji)}function cH(n){var e=dH(n.alternate,n,ro);n.memoizedProps=n.pendingProps,e===null?uH(n):Ji=e,RP.current=null}function uH(n){var e=n;do{var t=e.alternate;if(n=e.return,e.flags&32768){if(t=K$(t,e),t!==null){t.flags&=32767,Ji=t;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{rr=6,Ji=null;return}}else if(t=W$(t,e,ro),t!==null){Ji=t;return}if(e=e.sibling,e!==null){Ji=e;return}Ji=e=n}while(e!==null);rr===0&&(rr=5)}function kh(n,e,t){var i=Jn,r=Fo.transition;try{Fo.transition=null,Jn=1,eJ(n,e,t,i)}finally{Fo.transition=r,Jn=i}return null}function eJ(n,e,t,i){do bp();while(ru!==null);if(On&6)throw Error(Qe(327));t=n.finishedWork;var r=n.finishedLanes;if(t===null)return null;if(n.finishedWork=null,n.finishedLanes=0,t===n.current)throw Error(Qe(177));n.callbackNode=null,n.callbackPriority=0;var s=t.lanes|t.childLanes;if(LY(n,s),n===vr&&(Ji=vr=null,Mr=0),!(t.subtreeFlags&2064)&&!(t.flags&2064)||$_||($_=!0,fH(Jw,function(){return bp(),null})),s=(t.flags&15990)!==0,t.subtreeFlags&15990||s){s=Fo.transition,Fo.transition=null;var o=Jn;Jn=1;var a=On;On|=4,RP.current=null,q$(n,t),rH(t,n),x$(wM),Zw=!!xM,wM=xM=null,n.current=t,Y$(t),TY(),On=a,Jn=o,Fo.transition=s}else n.current=t;if($_&&($_=!1,ru=n,m1=r),s=n.pendingLanes,s===0&&(mu=null),MY(t.stateNode),zs(n,Fi()),e!==null)for(i=n.onRecoverableError,t=0;t<e.length;t++)r=e[t],i(r.value,{componentStack:r.stack,digest:r.digest});if(p1)throw p1=!1,n=zM,zM=null,n;return m1&1&&n.tag!==0&&bp(),s=n.pendingLanes,s&1?n===HM?wy++:(wy=0,HM=n):wy=0,Ku(),null}function bp(){if(ru!==null){var n=jV(m1),e=Fo.transition,t=Jn;try{if(Fo.transition=null,Jn=16>n?16:n,ru===null)var i=!1;else{if(n=ru,ru=null,m1=0,On&6)throw Error(Qe(331));var r=On;for(On|=4,Ct=n.current;Ct!==null;){var s=Ct,o=s.child;if(Ct.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(Ct=c;Ct!==null;){var u=Ct;switch(u.tag){case 0:case 11:case 15:_y(8,u,s)}var h=u.child;if(h!==null)h.return=u,Ct=h;else for(;Ct!==null;){u=Ct;var f=u.sibling,m=u.return;if(tH(u),u===c){Ct=null;break}if(f!==null){f.return=m,Ct=f;break}Ct=m}}}var y=s.alternate;if(y!==null){var _=y.child;if(_!==null){y.child=null;do{var v=_.sibling;_.sibling=null,_=v}while(_!==null)}}Ct=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,Ct=o;else e:for(;Ct!==null;){if(s=Ct,s.flags&2048)switch(s.tag){case 0:case 11:case 15:_y(9,s,s.return)}var g=s.sibling;if(g!==null){g.return=s.return,Ct=g;break e}Ct=s.return}}var w=n.current;for(Ct=w;Ct!==null;){o=Ct;var A=o.child;if(o.subtreeFlags&2064&&A!==null)A.return=o,Ct=A;else e:for(o=w;Ct!==null;){if(a=Ct,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:nA(9,a)}}catch(L){Ri(a,a.return,L)}if(a===o){Ct=null;break e}var T=a.sibling;if(T!==null){T.return=a.return,Ct=T;break e}Ct=a.return}}if(On=r,Ku(),ja&&typeof ja.onPostCommitFiberRoot=="function")try{ja.onPostCommitFiberRoot(qE,n)}catch{}i=!0}return i}finally{Jn=t,Fo.transition=e}}return!1}function UB(n,e,t){e=Zp(t,e),e=jz(n,e,1),n=pu(n,e,1),e=Es(),n!==null&&(Z0(n,1,e),zs(n,e))}function Ri(n,e,t){if(n.tag===3)UB(n,n,t);else for(;e!==null;){if(e.tag===3){UB(e,n,t);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(mu===null||!mu.has(i))){n=Zp(t,n),n=Wz(e,n,1),e=pu(e,n,1),n=Es(),e!==null&&(Z0(e,1,n),zs(e,n));break}}e=e.return}}function tJ(n,e,t){var i=n.pingCache;i!==null&&i.delete(e),e=Es(),n.pingedLanes|=n.suspendedLanes&t,vr===n&&(Mr&t)===t&&(rr===4||rr===3&&(Mr&130023424)===Mr&&500>Fi()-NP?hd(n,0):PP|=t),zs(n,e)}function hH(n,e){e===0&&(n.mode&1?(e=V_,V_<<=1,!(V_&130023424)&&(V_=4194304)):e=1);var t=Es();n=ec(n,e),n!==null&&(Z0(n,e,t),zs(n,t))}function nJ(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),hH(n,t)}function iJ(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,r=n.memoizedState;r!==null&&(t=r.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(Qe(314))}i!==null&&i.delete(e),hH(n,t)}var dH;dH=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Us.current)Bs=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Bs=!1,j$(n,e,t);Bs=!!(n.flags&131072)}else Bs=!1,gi&&e.flags&1048576&&gz(e,o1,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;ww(n,e),n=e.pendingProps;var r=Yp(e,is.current);Tp(e,t),r=TP(null,e,i,n,r,t);var s=bP();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Vs(i)?(s=!0,r1(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,xP(e),r.updater=tA,e.stateNode=r,r._reactInternals=e,RM(e,i,n,t),e=DM(null,e,i,!0,s,t)):(e.tag=0,gi&&s&&fP(e),ms(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(ww(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=sJ(i),n=na(i,n),r){case 0:e=NM(null,e,i,n,t);break e;case 1:e=IB(null,e,i,n,t);break e;case 11:e=CB(null,e,i,n,t);break e;case 14:e=MB(null,e,i,na(i.type,n),t);break e}throw Error(Qe(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:na(i,r),NM(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:na(i,r),IB(n,e,i,r,t);case 3:e:{if(Yz(e),n===null)throw Error(Qe(387));i=e.pendingProps,s=e.memoizedState,r=s.element,Ez(n,e),c1(e,i,null,t);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=Zp(Error(Qe(423)),e),e=RB(n,e,i,t,r);break e}else if(i!==r){r=Zp(Error(Qe(424)),e),e=RB(n,e,i,t,r);break e}else for(oo=fu(e.stateNode.containerInfo.firstChild),lo=e,gi=!0,la=null,t=xz(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if($p(),i===r){e=tc(n,e,t);break e}ms(n,e,i,t)}e=e.child}return e;case 5:return Az(e),n===null&&CM(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,o=r.children,EM(i,r)?o=null:s!==null&&EM(i,s)&&(e.flags|=32),qz(n,e),ms(n,e,o,t),e.child;case 6:return n===null&&CM(e),null;case 13:return $z(n,e,t);case 4:return wP(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=Jp(e,null,i,t):ms(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:na(i,r),CB(n,e,i,r,t);case 7:return ms(n,e,e.pendingProps,t),e.child;case 8:return ms(n,e,e.pendingProps.children,t),e.child;case 12:return ms(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,ri(a1,i._currentValue),i._currentValue=o,s!==null)if(va(s.value,o)){if(s.children===r.children&&!Us.current){e=tc(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===i){if(s.tag===1){l=Kl(-1,t&-t),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),MM(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Qe(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),MM(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}ms(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,Tp(e,t),r=Vo(r),i=i(r),e.flags|=1,ms(n,e,i,t),e.child;case 14:return i=e.type,r=na(i,e.pendingProps),r=na(i.type,r),MB(n,e,i,r,t);case 15:return Kz(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:na(i,r),ww(n,e),e.tag=1,Vs(i)?(n=!0,r1(e)):n=!1,Tp(e,t),Gz(e,i,r),RM(e,i,r,t),DM(null,e,i,!0,n,t);case 19:return Jz(n,e,t);case 22:return Xz(n,e,t)}throw Error(Qe(156,e.tag))};function fH(n,e){return VV(n,e)}function rJ(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Lo(n,e,t,i){return new rJ(n,e,t,i)}function BP(n){return n=n.prototype,!(!n||!n.isReactComponent)}function sJ(n){if(typeof n=="function")return BP(n)?1:0;if(n!=null){if(n=n.$$typeof,n===tP)return 11;if(n===nP)return 14}return 2}function yu(n,e){var t=n.alternate;return t===null?(t=Lo(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function Sw(n,e,t,i,r,s){var o=2;if(i=n,typeof n=="function")BP(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case Qf:return dd(t.children,r,s,e);case eP:o=8,r|=8;break;case eM:return n=Lo(12,t,e,r|2),n.elementType=eM,n.lanes=s,n;case tM:return n=Lo(13,t,e,r),n.elementType=tM,n.lanes=s,n;case nM:return n=Lo(19,t,e,r),n.elementType=nM,n.lanes=s,n;case AV:return rA(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case wV:o=10;break e;case EV:o=9;break e;case tP:o=11;break e;case nP:o=14;break e;case Hc:o=16,i=null;break e}throw Error(Qe(130,n==null?n:typeof n,""))}return e=Lo(o,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function dd(n,e,t,i){return n=Lo(7,n,i,e),n.lanes=t,n}function rA(n,e,t,i){return n=Lo(22,n,i,e),n.elementType=AV,n.lanes=t,n.stateNode={isHidden:!1},n}function rb(n,e,t){return n=Lo(6,n,null,e),n.lanes=t,n}function sb(n,e,t){return e=Lo(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function oJ(n,e,t,i,r){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=UT(0),this.expirationTimes=UT(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=UT(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function OP(n,e,t,i,r,s,o,a,l){return n=new oJ(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Lo(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},xP(s),n}function aJ(n,e,t){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Jf,key:i==null?null:""+i,children:n,containerInfo:e,implementation:t}}function pH(n){if(!n)return bu;n=n._reactInternals;e:{if(Kd(n)!==n||n.tag!==1)throw Error(Qe(170));var e=n;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Vs(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(Qe(171))}if(n.tag===1){var t=n.type;if(Vs(t))return pz(n,t,e)}return e}function mH(n,e,t,i,r,s,o,a,l){return n=OP(t,i,!0,n,r,s,o,a,l),n.context=pH(null),t=n.current,i=Es(),r=gu(t),s=Kl(i,r),s.callback=e??null,pu(t,s,r),n.current.lanes=r,Z0(n,r,i),zs(n,i),n}function sA(n,e,t,i){var r=e.current,s=Es(),o=gu(r);return t=pH(t),e.context===null?e.context=t:e.pendingContext=t,e=Kl(s,o),e.payload={element:n},i=i===void 0?null:i,i!==null&&(e.callback=i),n=pu(r,e,o),n!==null&&(fa(n,r,o,s),vw(n,r,o)),o}function y1(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function VB(n,e){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var t=n.retryLane;n.retryLane=t!==0&&t<e?t:e}}function FP(n,e){VB(n,e),(n=n.alternate)&&VB(n,e)}function lJ(){return null}var gH=typeof reportError=="function"?reportError:function(n){console.error(n)};function UP(n){this._internalRoot=n}oA.prototype.render=UP.prototype.render=function(n){var e=this._internalRoot;if(e===null)throw Error(Qe(409));sA(n,e,null,null)};oA.prototype.unmount=UP.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var e=n.containerInfo;bd(function(){sA(null,n,null,null)}),e[Zl]=null}};function oA(n){this._internalRoot=n}oA.prototype.unstable_scheduleHydration=function(n){if(n){var e=XV();n={blockedOn:null,target:n,priority:e};for(var t=0;t<Wc.length&&e!==0&&e<Wc[t].priority;t++);Wc.splice(t,0,n),t===0&&YV(n)}};function VP(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function aA(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function zB(){}function cJ(n,e,t,i,r){if(r){if(typeof i=="function"){var s=i;i=function(){var c=y1(o);s.call(c)}}var o=mH(e,i,n,0,null,!1,!1,"",zB);return n._reactRootContainer=o,n[Zl]=o.current,i0(n.nodeType===8?n.parentNode:n),bd(),o}for(;r=n.lastChild;)n.removeChild(r);if(typeof i=="function"){var a=i;i=function(){var c=y1(l);a.call(c)}}var l=OP(n,0,!1,null,null,!1,!1,"",zB);return n._reactRootContainer=l,n[Zl]=l.current,i0(n.nodeType===8?n.parentNode:n),bd(function(){sA(e,l,t,i)}),l}function lA(n,e,t,i,r){var s=t._reactRootContainer;if(s){var o=s;if(typeof r=="function"){var a=r;r=function(){var l=y1(o);a.call(l)}}sA(e,o,n,r)}else o=cJ(t,e,n,r,i);return y1(o)}WV=function(n){switch(n.tag){case 3:var e=n.stateNode;if(e.current.memoizedState.isDehydrated){var t=ty(e.pendingLanes);t!==0&&(sP(e,t|1),zs(e,Fi()),!(On&6)&&(em=Fi()+500,Ku()))}break;case 13:bd(function(){var i=ec(n,1);if(i!==null){var r=Es();fa(i,n,1,r)}}),FP(n,1)}};oP=function(n){if(n.tag===13){var e=ec(n,134217728);if(e!==null){var t=Es();fa(e,n,134217728,t)}FP(n,134217728)}};KV=function(n){if(n.tag===13){var e=gu(n),t=ec(n,e);if(t!==null){var i=Es();fa(t,n,e,i)}FP(n,e)}};XV=function(){return Jn};qV=function(n,e){var t=Jn;try{return Jn=n,e()}finally{Jn=t}};dM=function(n,e,t){switch(e){case"input":if(sM(n,t),e=t.name,t.type==="radio"&&e!=null){for(t=n;t.parentNode;)t=t.parentNode;for(t=t.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<t.length;e++){var i=t[e];if(i!==n&&i.form===n.form){var r=QE(i);if(!r)throw Error(Qe(90));TV(i),sM(i,r)}}}break;case"textarea":CV(n,t);break;case"select":e=t.value,e!=null&&wp(n,!!t.multiple,e,!1)}};LV=DP;kV=bd;var uJ={usingClientEntryPoint:!1,Events:[tv,np,QE,NV,DV,DP]},Cg={findFiberByHostInstance:jh,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},hJ={bundleType:Cg.bundleType,version:Cg.version,rendererPackageName:Cg.rendererPackageName,rendererConfig:Cg.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:dc.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=FV(n),n===null?null:n.stateNode},findFiberByHostInstance:Cg.findFiberByHostInstance||lJ,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var J_=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!J_.isDisabled&&J_.supportsFiber)try{qE=J_.inject(hJ),ja=J_}catch{}}go.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=uJ;go.createPortal=function(n,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!VP(e))throw Error(Qe(200));return aJ(n,e,null,t)};go.createRoot=function(n,e){if(!VP(n))throw Error(Qe(299));var t=!1,i="",r=gH;return e!=null&&(e.unstable_strictMode===!0&&(t=!0),e.identifierPrefix!==void 0&&(i=e.identifierPrefix),e.onRecoverableError!==void 0&&(r=e.onRecoverableError)),e=OP(n,1,!1,null,null,t,!1,i,r),n[Zl]=e.current,i0(n.nodeType===8?n.parentNode:n),new UP(e)};go.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var e=n._reactInternals;if(e===void 0)throw typeof n.render=="function"?Error(Qe(188)):(n=Object.keys(n).join(","),Error(Qe(268,n)));return n=FV(e),n=n===null?null:n.stateNode,n};go.flushSync=function(n){return bd(n)};go.hydrate=function(n,e,t){if(!aA(e))throw Error(Qe(200));return lA(null,n,e,!0,t)};go.hydrateRoot=function(n,e,t){if(!VP(n))throw Error(Qe(405));var i=t!=null&&t.hydratedSources||null,r=!1,s="",o=gH;if(t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),e=mH(e,null,n,1,t??null,r,!1,s,o),n[Zl]=e.current,i0(n),i)for(n=0;n<i.length;n++)t=i[n],r=t._getVersion,r=r(t._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[t,r]:e.mutableSourceEagerHydrationData.push(t,r);return new oA(e)};go.render=function(n,e,t){if(!aA(e))throw Error(Qe(200));return lA(null,n,e,!1,t)};go.unmountComponentAtNode=function(n){if(!aA(n))throw Error(Qe(40));return n._reactRootContainer?(bd(function(){lA(null,null,n,!1,function(){n._reactRootContainer=null,n[Zl]=null})}),!0):!1};go.unstable_batchedUpdates=DP;go.unstable_renderSubtreeIntoContainer=function(n,e,t,i){if(!aA(t))throw Error(Qe(200));if(n==null||n._reactInternals===void 0)throw Error(Qe(38));return lA(n,e,t,!1,i)};go.version="18.3.1-next-f1338f8080-20240426";function yH(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(yH)}catch(n){console.error(n)}}yH(),yV.exports=go;var iv=yV.exports;const vH=KR(iv);var _H,HB=iv;_H=HB.createRoot,HB.hydrateRoot;const dJ=1,fJ=1e6;let ob=0;function pJ(){return ob=(ob+1)%Number.MAX_SAFE_INTEGER,ob.toString()}const ab=new Map,GB=n=>{if(ab.has(n))return;const e=setTimeout(()=>{ab.delete(n),Ey({type:"REMOVE_TOAST",toastId:n})},fJ);ab.set(n,e)},mJ=(n,e)=>{switch(e.type){case"ADD_TOAST":return{...n,toasts:[e.toast,...n.toasts].slice(0,dJ)};case"UPDATE_TOAST":return{...n,toasts:n.toasts.map(t=>t.id===e.toast.id?{...t,...e.toast}:t)};case"DISMISS_TOAST":{const{toastId:t}=e;return t?GB(t):n.toasts.forEach(i=>{GB(i.id)}),{...n,toasts:n.toasts.map(i=>i.id===t||t===void 0?{...i,open:!1}:i)}}case"REMOVE_TOAST":return e.toastId===void 0?{...n,toasts:[]}:{...n,toasts:n.toasts.filter(t=>t.id!==e.toastId)}}},Tw=[];let bw={toasts:[]};function Ey(n){bw=mJ(bw,n),Tw.forEach(e=>{e(bw)})}function gJ({...n}){const e=pJ(),t=r=>Ey({type:"UPDATE_TOAST",toast:{...r,id:e}}),i=()=>Ey({type:"DISMISS_TOAST",toastId:e});return Ey({type:"ADD_TOAST",toast:{...n,id:e,open:!0,onOpenChange:r=>{r||i()}}}),{id:e,dismiss:i,update:t}}function yJ(){const[n,e]=V.useState(bw);return V.useEffect(()=>(Tw.push(e),()=>{const t=Tw.indexOf(e);t>-1&&Tw.splice(t,1)}),[n]),{...n,toast:gJ,dismiss:t=>Ey({type:"DISMISS_TOAST",toastId:t})}}function ir(n,e,{checkForDefaultPrevented:t=!0}={}){return function(r){if(n==null||n(r),t===!1||!r.defaultPrevented)return e==null?void 0:e(r)}}function jB(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function xH(...n){return e=>{let t=!1;const i=n.map(r=>{const s=jB(r,e);return!t&&typeof s=="function"&&(t=!0),s});if(t)return()=>{for(let r=0;r<i.length;r++){const s=i[r];typeof s=="function"?s():jB(n[r],null)}}}}function _a(...n){return V.useCallback(xH(...n),n)}function cA(n,e=[]){let t=[];function i(s,o){const a=V.createContext(o),l=t.length;t=[...t,o];const c=h=>{var g;const{scope:f,children:m,...y}=h,_=((g=f==null?void 0:f[n])==null?void 0:g[l])||a,v=V.useMemo(()=>y,Object.values(y));return S.jsx(_.Provider,{value:v,children:m})};c.displayName=s+"Provider";function u(h,f){var _;const m=((_=f==null?void 0:f[n])==null?void 0:_[l])||a,y=V.useContext(m);if(y)return y;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${s}\``)}return[c,u]}const r=()=>{const s=t.map(o=>V.createContext(o));return function(a){const l=(a==null?void 0:a[n])||s;return V.useMemo(()=>({[`__scope${n}`]:{...a,[n]:l}}),[a,l])}};return r.scopeName=n,[i,vJ(r,...e)]}function vJ(...n){const e=n[0];if(n.length===1)return e;const t=()=>{const i=n.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const o=i.reduce((a,{useScope:l,scopeName:c})=>{const h=l(s)[`__scope${c}`];return{...a,...h}},{});return V.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}function WM(n){const e=_J(n),t=V.forwardRef((i,r)=>{const{children:s,...o}=i,a=V.Children.toArray(s),l=a.find(wJ);if(l){const c=l.props.children,u=a.map(h=>h===l?V.Children.count(c)>1?V.Children.only(null):V.isValidElement(c)?c.props.children:null:h);return S.jsx(e,{...o,ref:r,children:V.isValidElement(c)?V.cloneElement(c,void 0,u):null})}return S.jsx(e,{...o,ref:r,children:s})});return t.displayName=`${n}.Slot`,t}function _J(n){const e=V.forwardRef((t,i)=>{const{children:r,...s}=t;if(V.isValidElement(r)){const o=AJ(r),a=EJ(s,r.props);return r.type!==V.Fragment&&(a.ref=i?xH(i,o):o),V.cloneElement(r,a)}return V.Children.count(r)>1?V.Children.only(null):null});return e.displayName=`${n}.SlotClone`,e}var wH=Symbol("radix.slottable");function xJ(n){const e=({children:t})=>S.jsx(S.Fragment,{children:t});return e.displayName=`${n}.Slottable`,e.__radixId=wH,e}function wJ(n){return V.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===wH}function EJ(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?t[i]=(...a)=>{const l=s(...a);return r(...a),l}:r&&(t[i]=r):i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}function AJ(n){var i,r;let e=(i=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:i.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=(r=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:r.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}function SJ(n){const e=n+"CollectionProvider",[t,i]=cA(e),[r,s]=t(e,{collectionRef:{current:null},itemMap:new Map}),o=_=>{const{scope:v,children:g}=_,w=at.useRef(null),A=at.useRef(new Map).current;return S.jsx(r,{scope:v,itemMap:A,collectionRef:w,children:g})};o.displayName=e;const a=n+"CollectionSlot",l=WM(a),c=at.forwardRef((_,v)=>{const{scope:g,children:w}=_,A=s(a,g),T=_a(v,A.collectionRef);return S.jsx(l,{ref:T,children:w})});c.displayName=a;const u=n+"CollectionItemSlot",h="data-radix-collection-item",f=WM(u),m=at.forwardRef((_,v)=>{const{scope:g,children:w,...A}=_,T=at.useRef(null),L=_a(v,T),D=s(u,g);return at.useEffect(()=>(D.itemMap.set(T,{ref:T,...A}),()=>void D.itemMap.delete(T))),S.jsx(f,{[h]:"",ref:L,children:w})});m.displayName=u;function y(_){const v=s(n+"CollectionConsumer",_);return at.useCallback(()=>{const w=v.collectionRef.current;if(!w)return[];const A=Array.from(w.querySelectorAll(`[${h}]`));return Array.from(v.itemMap.values()).sort((D,R)=>A.indexOf(D.ref.current)-A.indexOf(R.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:c,ItemSlot:m},y,i]}var TJ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ks=TJ.reduce((n,e)=>{const t=WM(`Primitive.${e}`),i=V.forwardRef((r,s)=>{const{asChild:o,...a}=r,l=o?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),S.jsx(l,{...a,ref:s})});return i.displayName=`Primitive.${e}`,{...n,[e]:i}},{});function EH(n,e){n&&iv.flushSync(()=>n.dispatchEvent(e))}function Cu(n){const e=V.useRef(n);return V.useEffect(()=>{e.current=n}),V.useMemo(()=>(...t)=>{var i;return(i=e.current)==null?void 0:i.call(e,...t)},[])}function bJ(n,e=globalThis==null?void 0:globalThis.document){const t=Cu(n);V.useEffect(()=>{const i=r=>{r.key==="Escape"&&t(r)};return e.addEventListener("keydown",i,{capture:!0}),()=>e.removeEventListener("keydown",i,{capture:!0})},[t,e])}var CJ="DismissableLayer",KM="dismissableLayer.update",MJ="dismissableLayer.pointerDownOutside",IJ="dismissableLayer.focusOutside",WB,AH=V.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zP=V.forwardRef((n,e)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:i,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=n,c=V.useContext(AH),[u,h]=V.useState(null),f=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=V.useState({}),y=_a(e,R=>h(R)),_=Array.from(c.layers),[v]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),g=_.indexOf(v),w=u?_.indexOf(u):-1,A=c.layersWithOutsidePointerEventsDisabled.size>0,T=w>=g,L=PJ(R=>{const I=R.target,M=[...c.branches].some(C=>C.contains(I));!T||M||(r==null||r(R),o==null||o(R),R.defaultPrevented||a==null||a())},f),D=NJ(R=>{const I=R.target;[...c.branches].some(C=>C.contains(I))||(s==null||s(R),o==null||o(R),R.defaultPrevented||a==null||a())},f);return bJ(R=>{w===c.layers.size-1&&(i==null||i(R),!R.defaultPrevented&&a&&(R.preventDefault(),a()))},f),V.useEffect(()=>{if(u)return t&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(WB=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),KB(),()=>{t&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=WB)}},[u,f,t,c]),V.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),KB())},[u,c]),V.useEffect(()=>{const R=()=>m({});return document.addEventListener(KM,R),()=>document.removeEventListener(KM,R)},[]),S.jsx(Ks.div,{...l,ref:y,style:{pointerEvents:A?T?"auto":"none":void 0,...n.style},onFocusCapture:ir(n.onFocusCapture,D.onFocusCapture),onBlurCapture:ir(n.onBlurCapture,D.onBlurCapture),onPointerDownCapture:ir(n.onPointerDownCapture,L.onPointerDownCapture)})});zP.displayName=CJ;var RJ="DismissableLayerBranch",SH=V.forwardRef((n,e)=>{const t=V.useContext(AH),i=V.useRef(null),r=_a(e,i);return V.useEffect(()=>{const s=i.current;if(s)return t.branches.add(s),()=>{t.branches.delete(s)}},[t.branches]),S.jsx(Ks.div,{...n,ref:r})});SH.displayName=RJ;function PJ(n,e=globalThis==null?void 0:globalThis.document){const t=Cu(n),i=V.useRef(!1),r=V.useRef(()=>{});return V.useEffect(()=>{const s=a=>{if(a.target&&!i.current){let l=function(){TH(MJ,t,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",r.current),r.current=l,e.addEventListener("click",r.current,{once:!0})):l()}else e.removeEventListener("click",r.current);i.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",r.current)}},[e,t]),{onPointerDownCapture:()=>i.current=!0}}function NJ(n,e=globalThis==null?void 0:globalThis.document){const t=Cu(n),i=V.useRef(!1);return V.useEffect(()=>{const r=s=>{s.target&&!i.current&&TH(IJ,t,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",r),()=>e.removeEventListener("focusin",r)},[e,t]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function KB(){const n=new CustomEvent(KM);document.dispatchEvent(n)}function TH(n,e,t,{discrete:i}){const r=t.originalEvent.target,s=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:t});e&&r.addEventListener(n,e,{once:!0}),i?EH(r,s):r.dispatchEvent(s)}var DJ=zP,LJ=SH,Mu=globalThis!=null&&globalThis.document?V.useLayoutEffect:()=>{},kJ="Portal",bH=V.forwardRef((n,e)=>{var a;const{container:t,...i}=n,[r,s]=V.useState(!1);Mu(()=>s(!0),[]);const o=t||r&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?vH.createPortal(S.jsx(Ks.div,{...i,ref:e}),o):null});bH.displayName=kJ;function BJ(n,e){return V.useReducer((t,i)=>e[t][i]??t,n)}var HP=n=>{const{present:e,children:t}=n,i=OJ(e),r=typeof t=="function"?t({present:i.isPresent}):V.Children.only(t),s=_a(i.ref,FJ(r));return typeof t=="function"||i.isPresent?V.cloneElement(r,{ref:s}):null};HP.displayName="Presence";function OJ(n){const[e,t]=V.useState(),i=V.useRef(null),r=V.useRef(n),s=V.useRef("none"),o=n?"mounted":"unmounted",[a,l]=BJ(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return V.useEffect(()=>{const c=Q_(i.current);s.current=a==="mounted"?c:"none"},[a]),Mu(()=>{const c=i.current,u=r.current;if(u!==n){const f=s.current,m=Q_(c);n?l("MOUNT"):m==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&f!==m?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),Mu(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,h=m=>{const _=Q_(i.current).includes(m.animationName);if(m.target===e&&_&&(l("ANIMATION_END"),!r.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},f=m=>{m.target===e&&(s.current=Q_(i.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:V.useCallback(c=>{i.current=c?getComputedStyle(c):null,t(c)},[])}}function Q_(n){return(n==null?void 0:n.animationName)||"none"}function FJ(n){var i,r;let e=(i=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:i.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=(r=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:r.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var UJ=mV[" useInsertionEffect ".trim().toString()]||Mu;function VJ({prop:n,defaultProp:e,onChange:t=()=>{},caller:i}){const[r,s,o]=zJ({defaultProp:e,onChange:t}),a=n!==void 0,l=a?n:r;{const u=V.useRef(n!==void 0);V.useEffect(()=>{const h=u.current;h!==a&&console.warn(`${i} is changing from ${h?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,i])}const c=V.useCallback(u=>{var h;if(a){const f=HJ(u)?u(n):u;f!==n&&((h=o.current)==null||h.call(o,f))}else s(u)},[a,n,s,o]);return[l,c]}function zJ({defaultProp:n,onChange:e}){const[t,i]=V.useState(n),r=V.useRef(t),s=V.useRef(e);return UJ(()=>{s.current=e},[e]),V.useEffect(()=>{var o;r.current!==t&&((o=s.current)==null||o.call(s,t),r.current=t)},[t,r]),[t,i,s]}function HJ(n){return typeof n=="function"}var GJ=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),jJ="VisuallyHidden",uA=V.forwardRef((n,e)=>S.jsx(Ks.span,{...n,ref:e,style:{...GJ,...n.style}}));uA.displayName=jJ;var WJ=uA,GP="ToastProvider",[jP,KJ,XJ]=SJ("Toast"),[CH,sCe]=cA("Toast",[XJ]),[qJ,hA]=CH(GP),MH=n=>{const{__scopeToast:e,label:t="Notification",duration:i=5e3,swipeDirection:r="right",swipeThreshold:s=50,children:o}=n,[a,l]=V.useState(null),[c,u]=V.useState(0),h=V.useRef(!1),f=V.useRef(!1);return t.trim()||console.error(`Invalid prop \`label\` supplied to \`${GP}\`. Expected non-empty \`string\`.`),S.jsx(jP.Provider,{scope:e,children:S.jsx(qJ,{scope:e,label:t,duration:i,swipeDirection:r,swipeThreshold:s,toastCount:c,viewport:a,onViewportChange:l,onToastAdd:V.useCallback(()=>u(m=>m+1),[]),onToastRemove:V.useCallback(()=>u(m=>m-1),[]),isFocusedToastEscapeKeyDownRef:h,isClosePausedRef:f,children:o})})};MH.displayName=GP;var IH="ToastViewport",YJ=["F8"],XM="toast.viewportPause",qM="toast.viewportResume",RH=V.forwardRef((n,e)=>{const{__scopeToast:t,hotkey:i=YJ,label:r="Notifications ({hotkey})",...s}=n,o=hA(IH,t),a=KJ(t),l=V.useRef(null),c=V.useRef(null),u=V.useRef(null),h=V.useRef(null),f=_a(e,h,o.onViewportChange),m=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=o.toastCount>0;V.useEffect(()=>{const v=g=>{var A;i.length!==0&&i.every(T=>g[T]||g.code===T)&&((A=h.current)==null||A.focus())};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[i]),V.useEffect(()=>{const v=l.current,g=h.current;if(y&&v&&g){const w=()=>{if(!o.isClosePausedRef.current){const D=new CustomEvent(XM);g.dispatchEvent(D),o.isClosePausedRef.current=!0}},A=()=>{if(o.isClosePausedRef.current){const D=new CustomEvent(qM);g.dispatchEvent(D),o.isClosePausedRef.current=!1}},T=D=>{!v.contains(D.relatedTarget)&&A()},L=()=>{v.contains(document.activeElement)||A()};return v.addEventListener("focusin",w),v.addEventListener("focusout",T),v.addEventListener("pointermove",w),v.addEventListener("pointerleave",L),window.addEventListener("blur",w),window.addEventListener("focus",A),()=>{v.removeEventListener("focusin",w),v.removeEventListener("focusout",T),v.removeEventListener("pointermove",w),v.removeEventListener("pointerleave",L),window.removeEventListener("blur",w),window.removeEventListener("focus",A)}}},[y,o.isClosePausedRef]);const _=V.useCallback(({tabbingDirection:v})=>{const w=a().map(A=>{const T=A.ref.current,L=[T,...lQ(T)];return v==="forwards"?L:L.reverse()});return(v==="forwards"?w.reverse():w).flat()},[a]);return V.useEffect(()=>{const v=h.current;if(v){const g=w=>{var L,D,R;const A=w.altKey||w.ctrlKey||w.metaKey;if(w.key==="Tab"&&!A){const I=document.activeElement,M=w.shiftKey;if(w.target===v&&M){(L=c.current)==null||L.focus();return}const B=_({tabbingDirection:M?"backwards":"forwards"}),O=B.findIndex(X=>X===I);lb(B.slice(O+1))?w.preventDefault():M?(D=c.current)==null||D.focus():(R=u.current)==null||R.focus()}};return v.addEventListener("keydown",g),()=>v.removeEventListener("keydown",g)}},[a,_]),S.jsxs(LJ,{ref:l,role:"region","aria-label":r.replace("{hotkey}",m),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&S.jsx(YM,{ref:c,onFocusFromOutsideViewport:()=>{const v=_({tabbingDirection:"forwards"});lb(v)}}),S.jsx(jP.Slot,{scope:t,children:S.jsx(Ks.ol,{tabIndex:-1,...s,ref:f})}),y&&S.jsx(YM,{ref:u,onFocusFromOutsideViewport:()=>{const v=_({tabbingDirection:"backwards"});lb(v)}})]})});RH.displayName=IH;var PH="ToastFocusProxy",YM=V.forwardRef((n,e)=>{const{__scopeToast:t,onFocusFromOutsideViewport:i,...r}=n,s=hA(PH,t);return S.jsx(uA,{"aria-hidden":!0,tabIndex:0,...r,ref:e,style:{position:"fixed"},onFocus:o=>{var c;const a=o.relatedTarget;!((c=s.viewport)!=null&&c.contains(a))&&i()}})});YM.displayName=PH;var rv="Toast",$J="toast.swipeStart",JJ="toast.swipeMove",QJ="toast.swipeCancel",ZJ="toast.swipeEnd",NH=V.forwardRef((n,e)=>{const{forceMount:t,open:i,defaultOpen:r,onOpenChange:s,...o}=n,[a,l]=VJ({prop:i,defaultProp:r??!0,onChange:s,caller:rv});return S.jsx(HP,{present:t||a,children:S.jsx(nQ,{open:a,...o,ref:e,onClose:()=>l(!1),onPause:Cu(n.onPause),onResume:Cu(n.onResume),onSwipeStart:ir(n.onSwipeStart,c=>{c.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ir(n.onSwipeMove,c=>{const{x:u,y:h}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","move"),c.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${u}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${h}px`)}),onSwipeCancel:ir(n.onSwipeCancel,c=>{c.currentTarget.setAttribute("data-swipe","cancel"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ir(n.onSwipeEnd,c=>{const{x:u,y:h}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","end"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${u}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${h}px`),l(!1)})})})});NH.displayName=rv;var[eQ,tQ]=CH(rv,{onClose(){}}),nQ=V.forwardRef((n,e)=>{const{__scopeToast:t,type:i="foreground",duration:r,open:s,onClose:o,onEscapeKeyDown:a,onPause:l,onResume:c,onSwipeStart:u,onSwipeMove:h,onSwipeCancel:f,onSwipeEnd:m,...y}=n,_=hA(rv,t),[v,g]=V.useState(null),w=_a(e,X=>g(X)),A=V.useRef(null),T=V.useRef(null),L=r||_.duration,D=V.useRef(0),R=V.useRef(L),I=V.useRef(0),{onToastAdd:M,onToastRemove:C}=_,k=Cu(()=>{var le;(v==null?void 0:v.contains(document.activeElement))&&((le=_.viewport)==null||le.focus()),o()}),B=V.useCallback(X=>{!X||X===1/0||(window.clearTimeout(I.current),D.current=new Date().getTime(),I.current=window.setTimeout(k,X))},[k]);V.useEffect(()=>{const X=_.viewport;if(X){const le=()=>{B(R.current),c==null||c()},ie=()=>{const de=new Date().getTime()-D.current;R.current=R.current-de,window.clearTimeout(I.current),l==null||l()};return X.addEventListener(XM,ie),X.addEventListener(qM,le),()=>{X.removeEventListener(XM,ie),X.removeEventListener(qM,le)}}},[_.viewport,L,l,c,B]),V.useEffect(()=>{s&&!_.isClosePausedRef.current&&B(L)},[s,L,_.isClosePausedRef,B]),V.useEffect(()=>(M(),()=>C()),[M,C]);const O=V.useMemo(()=>v?UH(v):null,[v]);return _.viewport?S.jsxs(S.Fragment,{children:[O&&S.jsx(iQ,{__scopeToast:t,role:"status","aria-live":i==="foreground"?"assertive":"polite","aria-atomic":!0,children:O}),S.jsx(eQ,{scope:t,onClose:k,children:iv.createPortal(S.jsx(jP.ItemSlot,{scope:t,children:S.jsx(DJ,{asChild:!0,onEscapeKeyDown:ir(a,()=>{_.isFocusedToastEscapeKeyDownRef.current||k(),_.isFocusedToastEscapeKeyDownRef.current=!1}),children:S.jsx(Ks.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":_.swipeDirection,...y,ref:w,style:{userSelect:"none",touchAction:"none",...n.style},onKeyDown:ir(n.onKeyDown,X=>{X.key==="Escape"&&(a==null||a(X.nativeEvent),X.nativeEvent.defaultPrevented||(_.isFocusedToastEscapeKeyDownRef.current=!0,k()))}),onPointerDown:ir(n.onPointerDown,X=>{X.button===0&&(A.current={x:X.clientX,y:X.clientY})}),onPointerMove:ir(n.onPointerMove,X=>{if(!A.current)return;const le=X.clientX-A.current.x,ie=X.clientY-A.current.y,de=!!T.current,G=["left","right"].includes(_.swipeDirection),$=["left","up"].includes(_.swipeDirection)?Math.min:Math.max,te=G?$(0,le):0,ue=G?0:$(0,ie),ve=X.pointerType==="touch"?10:2,be={x:te,y:ue},he={originalEvent:X,delta:be};de?(T.current=be,Z_(JJ,h,he,{discrete:!1})):XB(be,_.swipeDirection,ve)?(T.current=be,Z_($J,u,he,{discrete:!1}),X.target.setPointerCapture(X.pointerId)):(Math.abs(le)>ve||Math.abs(ie)>ve)&&(A.current=null)}),onPointerUp:ir(n.onPointerUp,X=>{const le=T.current,ie=X.target;if(ie.hasPointerCapture(X.pointerId)&&ie.releasePointerCapture(X.pointerId),T.current=null,A.current=null,le){const de=X.currentTarget,G={originalEvent:X,delta:le};XB(le,_.swipeDirection,_.swipeThreshold)?Z_(ZJ,m,G,{discrete:!0}):Z_(QJ,f,G,{discrete:!0}),de.addEventListener("click",$=>$.preventDefault(),{once:!0})}})})})}),_.viewport)})]}):null}),iQ=n=>{const{__scopeToast:e,children:t,...i}=n,r=hA(rv,e),[s,o]=V.useState(!1),[a,l]=V.useState(!1);return oQ(()=>o(!0)),V.useEffect(()=>{const c=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(c)},[]),a?null:S.jsx(bH,{asChild:!0,children:S.jsx(uA,{...i,children:s&&S.jsxs(S.Fragment,{children:[r.label," ",t]})})})},rQ="ToastTitle",DH=V.forwardRef((n,e)=>{const{__scopeToast:t,...i}=n;return S.jsx(Ks.div,{...i,ref:e})});DH.displayName=rQ;var sQ="ToastDescription",LH=V.forwardRef((n,e)=>{const{__scopeToast:t,...i}=n;return S.jsx(Ks.div,{...i,ref:e})});LH.displayName=sQ;var kH="ToastAction",BH=V.forwardRef((n,e)=>{const{altText:t,...i}=n;return t.trim()?S.jsx(FH,{altText:t,asChild:!0,children:S.jsx(WP,{...i,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${kH}\`. Expected non-empty \`string\`.`),null)});BH.displayName=kH;var OH="ToastClose",WP=V.forwardRef((n,e)=>{const{__scopeToast:t,...i}=n,r=tQ(OH,t);return S.jsx(FH,{asChild:!0,children:S.jsx(Ks.button,{type:"button",...i,ref:e,onClick:ir(n.onClick,r.onClose)})})});WP.displayName=OH;var FH=V.forwardRef((n,e)=>{const{__scopeToast:t,altText:i,...r}=n;return S.jsx(Ks.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":i||void 0,...r,ref:e})});function UH(n){const e=[];return Array.from(n.childNodes).forEach(i=>{if(i.nodeType===i.TEXT_NODE&&i.textContent&&e.push(i.textContent),aQ(i)){const r=i.ariaHidden||i.hidden||i.style.display==="none",s=i.dataset.radixToastAnnounceExclude==="";if(!r)if(s){const o=i.dataset.radixToastAnnounceAlt;o&&e.push(o)}else e.push(...UH(i))}}),e}function Z_(n,e,t,{discrete:i}){const r=t.originalEvent.currentTarget,s=new CustomEvent(n,{bubbles:!0,cancelable:!0,detail:t});e&&r.addEventListener(n,e,{once:!0}),i?EH(r,s):r.dispatchEvent(s)}var XB=(n,e,t=0)=>{const i=Math.abs(n.x),r=Math.abs(n.y),s=i>r;return e==="left"||e==="right"?s&&i>t:!s&&r>t};function oQ(n=()=>{}){const e=Cu(n);Mu(()=>{let t=0,i=0;return t=window.requestAnimationFrame(()=>i=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(t),window.cancelAnimationFrame(i)}},[e])}function aQ(n){return n.nodeType===n.ELEMENT_NODE}function lQ(n){const e=[],t=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const r=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||r?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)e.push(t.currentNode);return e}function lb(n){const e=document.activeElement;return n.some(t=>t===e?!0:(t.focus(),document.activeElement!==e))}var cQ=MH,VH=RH,zH=NH,HH=DH,GH=LH,jH=BH,WH=WP;function KH(n){var e,t,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var r=n.length;for(e=0;e<r;e++)n[e]&&(t=KH(n[e]))&&(i&&(i+=" "),i+=t)}else for(t in n)n[t]&&(i&&(i+=" "),i+=t);return i}function XH(){for(var n,e,t=0,i="",r=arguments.length;t<r;t++)(n=arguments[t])&&(e=KH(n))&&(i&&(i+=" "),i+=e);return i}const qB=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,YB=XH,uQ=(n,e)=>t=>{var i;if((e==null?void 0:e.variants)==null)return YB(n,t==null?void 0:t.class,t==null?void 0:t.className);const{variants:r,defaultVariants:s}=e,o=Object.keys(r).map(c=>{const u=t==null?void 0:t[c],h=s==null?void 0:s[c];if(u===null)return null;const f=qB(u)||qB(h);return r[c][f]}),a=t&&Object.entries(t).reduce((c,u)=>{let[h,f]=u;return f===void 0||(c[h]=f),c},{}),l=e==null||(i=e.compoundVariants)===null||i===void 0?void 0:i.reduce((c,u)=>{let{class:h,className:f,...m}=u;return Object.entries(m).every(y=>{let[_,v]=y;return Array.isArray(v)?v.includes({...s,...a}[_]):{...s,...a}[_]===v})?[...c,h,f]:c},[]);return YB(n,o,l,t==null?void 0:t.class,t==null?void 0:t.className)};/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hQ=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),qH=(...n)=>n.filter((e,t,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===t).join(" ").trim();/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var dQ={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"};/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fQ=V.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:i,className:r="",children:s,iconNode:o,...a},l)=>V.createElement("svg",{ref:l,...dQ,width:e,height:e,stroke:n,strokeWidth:i?Number(t)*24/Number(e):t,className:qH("lucide",r),...a},[...o.map(([c,u])=>V.createElement(c,u)),...Array.isArray(s)?s:[s]]));/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bt=(n,e)=>{const t=V.forwardRef(({className:i,...r},s)=>V.createElement(fQ,{ref:s,iconNode:e,className:qH(`lucide-${hQ(n)}`,i),...r}));return t.displayName=`${n}`,t};/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Im=Bt("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pQ=Bt("Award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mQ=Bt("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $M=Bt("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gQ=Bt("BookmarkCheck",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z",key:"169p4p"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yQ=Bt("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vQ=Bt("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _Q=Bt("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dA=Bt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const YH=Bt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vu=Bt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xQ=Bt("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wQ=Bt("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $H=Bt("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const JH=Bt("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fd=Bt("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const EQ=Bt("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const AQ=Bt("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const KP=Bt("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const QH=Bt("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ay=Bt("Gamepad2",[["line",{x1:"6",x2:"10",y1:"11",y2:"11",key:"1gktln"}],["line",{x1:"8",x2:"8",y1:"9",y2:"13",key:"qnk9ow"}],["line",{x1:"15",x2:"15.01",y1:"12",y2:"12",key:"krot7o"}],["line",{x1:"18",x2:"18.01",y1:"10",y2:"10",key:"1lcuu1"}],["path",{d:"M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z",key:"mfqc10"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $B=Bt("Gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const SQ=Bt("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const TQ=Bt("Glasses",[["circle",{cx:"6",cy:"15",r:"4",key:"vux9w4"}],["circle",{cx:"18",cy:"15",r:"4",key:"18o8ve"}],["path",{d:"M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2",key:"1ag4bs"}],["path",{d:"M2.5 13 5 7c.7-1.3 1.4-2 3-2",key:"1hm1gs"}],["path",{d:"M21.5 13 19 7c-.7-1.3-1.5-2-3-2",key:"1r31ai"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const v1=Bt("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const JM=Bt("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bQ=Bt("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ZH=Bt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _1=Bt("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const CQ=Bt("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const MQ=Bt("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const QM=Bt("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const IQ=Bt("Mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const RQ=Bt("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const PQ=Bt("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const NQ=Bt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const DQ=Bt("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const LQ=Bt("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const eG=Bt("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const d0=Bt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const XP=Bt("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kQ=Bt("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tG=Bt("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const BQ=Bt("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const OQ=Bt("ShieldHalf",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 22V2",key:"zs6s6o"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dl=Bt("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nG=Bt("Shirt",[["path",{d:"M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z",key:"1wgbhj"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const FQ=Bt("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const UQ=Bt("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const iG=Bt("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const su=Bt("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const VQ=Bt("Sword",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cb=Bt("Swords",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const JB=Bt("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const QB=Bt("Ticket",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zQ=Bt("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tm=Bt("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Sy=Bt("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qP=Bt("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fA=Bt("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sv=Bt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ty=Bt("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),YP="-",HQ=n=>{const e=jQ(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:i}=n;return{getClassGroupId:o=>{const a=o.split(YP);return a[0]===""&&a.length!==1&&a.shift(),rG(a,e)||GQ(o)},getConflictingClassGroupIds:(o,a)=>{const l=t[o]||[];return a&&i[o]?[...l,...i[o]]:l}}},rG=(n,e)=>{var o;if(n.length===0)return e.classGroupId;const t=n[0],i=e.nextPart.get(t),r=i?rG(n.slice(1),i):void 0;if(r)return r;if(e.validators.length===0)return;const s=n.join(YP);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},ZB=/^\[(.+)\]$/,GQ=n=>{if(ZB.test(n)){const e=ZB.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},jQ=n=>{const{theme:e,prefix:t}=n,i={nextPart:new Map,validators:[]};return KQ(Object.entries(n.classGroups),t).forEach(([s,o])=>{ZM(o,i,s,e)}),i},ZM=(n,e,t,i)=>{n.forEach(r=>{if(typeof r=="string"){const s=r===""?e:eO(e,r);s.classGroupId=t;return}if(typeof r=="function"){if(WQ(r)){ZM(r(i),e,t,i);return}e.validators.push({validator:r,classGroupId:t});return}Object.entries(r).forEach(([s,o])=>{ZM(o,eO(e,s),t,i)})})},eO=(n,e)=>{let t=n;return e.split(YP).forEach(i=>{t.nextPart.has(i)||t.nextPart.set(i,{nextPart:new Map,validators:[]}),t=t.nextPart.get(i)}),t},WQ=n=>n.isThemeGetter,KQ=(n,e)=>e?n.map(([t,i])=>{const r=i.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[t,r]}):n,XQ=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,i=new Map;const r=(s,o)=>{t.set(s,o),e++,e>n&&(e=0,i=t,t=new Map)};return{get(s){let o=t.get(s);if(o!==void 0)return o;if((o=i.get(s))!==void 0)return r(s,o),o},set(s,o){t.has(s)?t.set(s,o):r(s,o)}}},sG="!",qQ=n=>{const{separator:e,experimentalParseClassName:t}=n,i=e.length===1,r=e[0],s=e.length,o=a=>{const l=[];let c=0,u=0,h;for(let v=0;v<a.length;v++){let g=a[v];if(c===0){if(g===r&&(i||a.slice(v,v+s)===e)){l.push(a.slice(u,v)),u=v+s;continue}if(g==="/"){h=v;continue}}g==="["?c++:g==="]"&&c--}const f=l.length===0?a:a.substring(u),m=f.startsWith(sG),y=m?f.substring(1):f,_=h&&h>u?h-u:void 0;return{modifiers:l,hasImportantModifier:m,baseClassName:y,maybePostfixModifierPosition:_}};return t?a=>t({className:a,parseClassName:o}):o},YQ=n=>{if(n.length<=1)return n;const e=[];let t=[];return n.forEach(i=>{i[0]==="["?(e.push(...t.sort(),i),t=[]):t.push(i)}),e.push(...t.sort()),e},$Q=n=>({cache:XQ(n.cacheSize),parseClassName:qQ(n),...HQ(n)}),JQ=/\s+/,QQ=(n,e)=>{const{parseClassName:t,getClassGroupId:i,getConflictingClassGroupIds:r}=e,s=[],o=n.trim().split(JQ);let a="";for(let l=o.length-1;l>=0;l-=1){const c=o[l],{modifiers:u,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:m}=t(c);let y=!!m,_=i(y?f.substring(0,m):f);if(!_){if(!y){a=c+(a.length>0?" "+a:a);continue}if(_=i(f),!_){a=c+(a.length>0?" "+a:a);continue}y=!1}const v=YQ(u).join(":"),g=h?v+sG:v,w=g+_;if(s.includes(w))continue;s.push(w);const A=r(_,y);for(let T=0;T<A.length;++T){const L=A[T];s.push(g+L)}a=c+(a.length>0?" "+a:a)}return a};function ZQ(){let n=0,e,t,i="";for(;n<arguments.length;)(e=arguments[n++])&&(t=oG(e))&&(i&&(i+=" "),i+=t);return i}const oG=n=>{if(typeof n=="string")return n;let e,t="";for(let i=0;i<n.length;i++)n[i]&&(e=oG(n[i]))&&(t&&(t+=" "),t+=e);return t};function eZ(n,...e){let t,i,r,s=o;function o(l){const c=e.reduce((u,h)=>h(u),n());return t=$Q(c),i=t.cache.get,r=t.cache.set,s=a,a(l)}function a(l){const c=i(l);if(c)return c;const u=QQ(l,t);return r(l,u),u}return function(){return s(ZQ.apply(null,arguments))}}const oi=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},aG=/^\[(?:([a-z-]+):)?(.+)\]$/i,tZ=/^\d+\/\d+$/,nZ=new Set(["px","full","screen"]),iZ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,rZ=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,sZ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,oZ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,aZ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wl=n=>Cp(n)||nZ.has(n)||tZ.test(n),Cc=n=>Rm(n,"length",mZ),Cp=n=>!!n&&!Number.isNaN(Number(n)),ub=n=>Rm(n,"number",Cp),Mg=n=>!!n&&Number.isInteger(Number(n)),lZ=n=>n.endsWith("%")&&Cp(n.slice(0,-1)),fn=n=>aG.test(n),Mc=n=>iZ.test(n),cZ=new Set(["length","size","percentage"]),uZ=n=>Rm(n,cZ,lG),hZ=n=>Rm(n,"position",lG),dZ=new Set(["image","url"]),fZ=n=>Rm(n,dZ,yZ),pZ=n=>Rm(n,"",gZ),Ig=()=>!0,Rm=(n,e,t)=>{const i=aG.exec(n);return i?i[1]?typeof e=="string"?i[1]===e:e.has(i[1]):t(i[2]):!1},mZ=n=>rZ.test(n)&&!sZ.test(n),lG=()=>!1,gZ=n=>oZ.test(n),yZ=n=>aZ.test(n),vZ=()=>{const n=oi("colors"),e=oi("spacing"),t=oi("blur"),i=oi("brightness"),r=oi("borderColor"),s=oi("borderRadius"),o=oi("borderSpacing"),a=oi("borderWidth"),l=oi("contrast"),c=oi("grayscale"),u=oi("hueRotate"),h=oi("invert"),f=oi("gap"),m=oi("gradientColorStops"),y=oi("gradientColorStopPositions"),_=oi("inset"),v=oi("margin"),g=oi("opacity"),w=oi("padding"),A=oi("saturate"),T=oi("scale"),L=oi("sepia"),D=oi("skew"),R=oi("space"),I=oi("translate"),M=()=>["auto","contain","none"],C=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto",fn,e],B=()=>[fn,e],O=()=>["",wl,Cc],X=()=>["auto",Cp,fn],le=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ie=()=>["solid","dashed","dotted","double","none"],de=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>["start","end","center","between","around","evenly","stretch"],$=()=>["","0",fn],te=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ue=()=>[Cp,fn];return{cacheSize:500,separator:":",theme:{colors:[Ig],spacing:[wl,Cc],blur:["none","",Mc,fn],brightness:ue(),borderColor:[n],borderRadius:["none","","full",Mc,fn],borderSpacing:B(),borderWidth:O(),contrast:ue(),grayscale:$(),hueRotate:ue(),invert:$(),gap:B(),gradientColorStops:[n],gradientColorStopPositions:[lZ,Cc],inset:k(),margin:k(),opacity:ue(),padding:B(),saturate:ue(),scale:ue(),sepia:$(),skew:ue(),space:B(),translate:B()},classGroups:{aspect:[{aspect:["auto","square","video",fn]}],container:["container"],columns:[{columns:[Mc]}],"break-after":[{"break-after":te()}],"break-before":[{"break-before":te()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...le(),fn]}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[_]}],"inset-x":[{"inset-x":[_]}],"inset-y":[{"inset-y":[_]}],start:[{start:[_]}],end:[{end:[_]}],top:[{top:[_]}],right:[{right:[_]}],bottom:[{bottom:[_]}],left:[{left:[_]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Mg,fn]}],basis:[{basis:k()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",fn]}],grow:[{grow:$()}],shrink:[{shrink:$()}],order:[{order:["first","last","none",Mg,fn]}],"grid-cols":[{"grid-cols":[Ig]}],"col-start-end":[{col:["auto",{span:["full",Mg,fn]},fn]}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":[Ig]}],"row-start-end":[{row:["auto",{span:[Mg,fn]},fn]}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",fn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",fn]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...G()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...G(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...G(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",fn,e]}],"min-w":[{"min-w":[fn,e,"min","max","fit"]}],"max-w":[{"max-w":[fn,e,"none","full","min","max","fit","prose",{screen:[Mc]},Mc]}],h:[{h:[fn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[fn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[fn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[fn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Mc,Cc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ub]}],"font-family":[{font:[Ig]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",fn]}],"line-clamp":[{"line-clamp":["none",Cp,ub]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",wl,fn]}],"list-image":[{"list-image":["none",fn]}],"list-style-type":[{list:["none","disc","decimal",fn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",wl,Cc]}],"underline-offset":[{"underline-offset":["auto",wl,fn]}],"text-decoration-color":[{decoration:[n]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:B()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",fn]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",fn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...le(),hZ]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",uZ]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},fZ]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[m]}],"gradient-via":[{via:[m]}],"gradient-to":[{to:[m]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...ie(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:ie()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-s":[{"border-s":[r]}],"border-color-e":[{"border-e":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",...ie()]}],"outline-offset":[{"outline-offset":[wl,fn]}],"outline-w":[{outline:[wl,Cc]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:O()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[wl,Cc]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",Mc,pZ]}],"shadow-color":[{shadow:[Ig]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...de(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":de()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[i]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Mc,fn]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[h]}],saturate:[{saturate:[A]}],sepia:[{sepia:[L]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[i]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[A]}],"backdrop-sepia":[{"backdrop-sepia":[L]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",fn]}],duration:[{duration:ue()}],ease:[{ease:["linear","in","out","in-out",fn]}],delay:[{delay:ue()}],animate:[{animate:["none","spin","ping","pulse","bounce",fn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[Mg,fn]}],"translate-x":[{"translate-x":[I]}],"translate-y":[{"translate-y":[I]}],"skew-x":[{"skew-x":[D]}],"skew-y":[{"skew-y":[D]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",fn]}],accent:[{accent:["auto",n]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",fn]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":B()}],"scroll-mx":[{"scroll-mx":B()}],"scroll-my":[{"scroll-my":B()}],"scroll-ms":[{"scroll-ms":B()}],"scroll-me":[{"scroll-me":B()}],"scroll-mt":[{"scroll-mt":B()}],"scroll-mr":[{"scroll-mr":B()}],"scroll-mb":[{"scroll-mb":B()}],"scroll-ml":[{"scroll-ml":B()}],"scroll-p":[{"scroll-p":B()}],"scroll-px":[{"scroll-px":B()}],"scroll-py":[{"scroll-py":B()}],"scroll-ps":[{"scroll-ps":B()}],"scroll-pe":[{"scroll-pe":B()}],"scroll-pt":[{"scroll-pt":B()}],"scroll-pr":[{"scroll-pr":B()}],"scroll-pb":[{"scroll-pb":B()}],"scroll-pl":[{"scroll-pl":B()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",fn]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[wl,Cc,ub]}],stroke:[{stroke:[n,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},_Z=eZ(vZ);function Xd(...n){return _Z(XH(n))}const xZ=cQ,cG=V.forwardRef(({className:n,...e},t)=>S.jsx(VH,{ref:t,className:Xd("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",n),...e}));cG.displayName=VH.displayName;const wZ=uQ("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),uG=V.forwardRef(({className:n,variant:e,...t},i)=>S.jsx(zH,{ref:i,className:Xd(wZ({variant:e}),n),...t}));uG.displayName=zH.displayName;const EZ=V.forwardRef(({className:n,...e},t)=>S.jsx(jH,{ref:t,className:Xd("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",n),...e}));EZ.displayName=jH.displayName;const hG=V.forwardRef(({className:n,...e},t)=>S.jsx(WH,{ref:t,className:Xd("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",n),"toast-close":"",...e,children:S.jsx(sv,{className:"h-4 w-4"})}));hG.displayName=WH.displayName;const dG=V.forwardRef(({className:n,...e},t)=>S.jsx(HH,{ref:t,className:Xd("text-sm font-semibold",n),...e}));dG.displayName=HH.displayName;const fG=V.forwardRef(({className:n,...e},t)=>S.jsx(GH,{ref:t,className:Xd("text-sm opacity-90",n),...e}));fG.displayName=GH.displayName;function AZ(){const{toasts:n}=yJ();return S.jsxs(xZ,{children:[n.map(function({id:e,title:t,description:i,action:r,...s}){return S.jsxs(uG,{...s,children:[S.jsxs("div",{className:"grid gap-1",children:[t&&S.jsx(dG,{children:t}),i&&S.jsx(fG,{children:i})]}),r,S.jsx(hG,{})]},e)}),S.jsx(cG,{})]})}var tO=["light","dark"],SZ="(prefers-color-scheme: dark)",TZ=V.createContext(void 0),bZ={setTheme:n=>{},themes:[]},CZ=()=>{var n;return(n=V.useContext(TZ))!=null?n:bZ};V.memo(({forcedTheme:n,storageKey:e,attribute:t,enableSystem:i,enableColorScheme:r,defaultTheme:s,value:o,attrs:a,nonce:l})=>{let c=s==="system",u=t==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${a.map(y=>`'${y}'`).join(",")})`};`:`var d=document.documentElement,n='${t}',s='setAttribute';`,h=r?tO.includes(s)&&s?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${s}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",f=(y,_=!1,v=!0)=>{let g=o?o[y]:y,w=_?y+"|| ''":`'${g}'`,A="";return r&&v&&!_&&tO.includes(y)&&(A+=`d.style.colorScheme = '${y}';`),t==="class"?_||g?A+=`c.add(${w})`:A+="null":g&&(A+=`d[s](n,${w})`),A},m=n?`!function(){${u}${f(n)}}()`:i?`!function(){try{${u}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${c})){var t='${SZ}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f("dark")}}else{${f("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}${c?"":"else{"+f(s,!1,!1)+"}"}${h}}catch(e){}}()`:`!function(){try{${u}var e=localStorage.getItem('${e}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}else{${f(s,!1,!1)};}${h}}catch(t){}}();`;return V.createElement("script",{nonce:l,dangerouslySetInnerHTML:{__html:m}})});var MZ=n=>{switch(n){case"success":return PZ;case"info":return DZ;case"warning":return NZ;case"error":return LZ;default:return null}},IZ=Array(12).fill(0),RZ=({visible:n,className:e})=>at.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":n},at.createElement("div",{className:"sonner-spinner"},IZ.map((t,i)=>at.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${i}`})))),PZ=at.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},at.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),NZ=at.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},at.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),DZ=at.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},at.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),LZ=at.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},at.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),kZ=at.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},at.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),at.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),BZ=()=>{let[n,e]=at.useState(document.hidden);return at.useEffect(()=>{let t=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",t),()=>window.removeEventListener("visibilitychange",t)},[]),n},eI=1,OZ=class{constructor(){this.subscribe=n=>(this.subscribers.push(n),()=>{let e=this.subscribers.indexOf(n);this.subscribers.splice(e,1)}),this.publish=n=>{this.subscribers.forEach(e=>e(n))},this.addToast=n=>{this.publish(n),this.toasts=[...this.toasts,n]},this.create=n=>{var e;let{message:t,...i}=n,r=typeof(n==null?void 0:n.id)=="number"||((e=n.id)==null?void 0:e.length)>0?n.id:eI++,s=this.toasts.find(a=>a.id===r),o=n.dismissible===void 0?!0:n.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),s?this.toasts=this.toasts.map(a=>a.id===r?(this.publish({...a,...n,id:r,title:t}),{...a,...n,id:r,dismissible:o,title:t}):a):this.addToast({title:t,...i,dismissible:o,id:r}),r},this.dismiss=n=>(this.dismissedToasts.add(n),n||this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:n,dismiss:!0})),n),this.message=(n,e)=>this.create({...e,message:n}),this.error=(n,e)=>this.create({...e,message:n,type:"error"}),this.success=(n,e)=>this.create({...e,type:"success",message:n}),this.info=(n,e)=>this.create({...e,type:"info",message:n}),this.warning=(n,e)=>this.create({...e,type:"warning",message:n}),this.loading=(n,e)=>this.create({...e,type:"loading",message:n}),this.promise=(n,e)=>{if(!e)return;let t;e.loading!==void 0&&(t=this.create({...e,promise:n,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let i=n instanceof Promise?n:n(),r=t!==void 0,s,o=i.then(async l=>{if(s=["resolve",l],at.isValidElement(l))r=!1,this.create({id:t,type:"default",message:l});else if(UZ(l)&&!l.ok){r=!1;let c=typeof e.error=="function"?await e.error(`HTTP error! status: ${l.status}`):e.error,u=typeof e.description=="function"?await e.description(`HTTP error! status: ${l.status}`):e.description;this.create({id:t,type:"error",message:c,description:u})}else if(e.success!==void 0){r=!1;let c=typeof e.success=="function"?await e.success(l):e.success,u=typeof e.description=="function"?await e.description(l):e.description;this.create({id:t,type:"success",message:c,description:u})}}).catch(async l=>{if(s=["reject",l],e.error!==void 0){r=!1;let c=typeof e.error=="function"?await e.error(l):e.error,u=typeof e.description=="function"?await e.description(l):e.description;this.create({id:t,type:"error",message:c,description:u})}}).finally(()=>{var l;r&&(this.dismiss(t),t=void 0),(l=e.finally)==null||l.call(e)}),a=()=>new Promise((l,c)=>o.then(()=>s[0]==="reject"?c(s[1]):l(s[1])).catch(c));return typeof t!="string"&&typeof t!="number"?{unwrap:a}:Object.assign(t,{unwrap:a})},this.custom=(n,e)=>{let t=(e==null?void 0:e.id)||eI++;return this.create({jsx:n(t),id:t,...e}),t},this.getActiveToasts=()=>this.toasts.filter(n=>!this.dismissedToasts.has(n.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Ns=new OZ,FZ=(n,e)=>{let t=(e==null?void 0:e.id)||eI++;return Ns.addToast({title:n,...e,id:t}),t},UZ=n=>n&&typeof n=="object"&&"ok"in n&&typeof n.ok=="boolean"&&"status"in n&&typeof n.status=="number",VZ=FZ,zZ=()=>Ns.toasts,HZ=()=>Ns.getActiveToasts();Object.assign(VZ,{success:Ns.success,info:Ns.info,warning:Ns.warning,error:Ns.error,custom:Ns.custom,message:Ns.message,promise:Ns.promise,dismiss:Ns.dismiss,loading:Ns.loading},{getHistory:zZ,getToasts:HZ});function GZ(n,{insertAt:e}={}){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",e==="top"&&t.firstChild?t.insertBefore(i,t.firstChild):t.appendChild(i),i.styleSheet?i.styleSheet.cssText=n:i.appendChild(document.createTextNode(n))}GZ(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
`);function ex(n){return n.label!==void 0}var jZ=3,WZ="32px",KZ="16px",nO=4e3,XZ=356,qZ=14,YZ=20,$Z=200;function Yo(...n){return n.filter(Boolean).join(" ")}function JZ(n){let[e,t]=n.split("-"),i=[];return e&&i.push(e),t&&i.push(t),i}var QZ=n=>{var e,t,i,r,s,o,a,l,c,u,h;let{invert:f,toast:m,unstyled:y,interacting:_,setHeights:v,visibleToasts:g,heights:w,index:A,toasts:T,expanded:L,removeToast:D,defaultRichColors:R,closeButton:I,style:M,cancelButtonStyle:C,actionButtonStyle:k,className:B="",descriptionClassName:O="",duration:X,position:le,gap:ie,loadingIcon:de,expandByDefault:G,classNames:$,icons:te,closeButtonAriaLabel:ue="Close toast",pauseWhenPageIsHidden:ve}=n,[be,he]=at.useState(null),[Pe,Oe]=at.useState(null),[Ce,mt]=at.useState(!1),[Lt,St]=at.useState(!1),[Nt,ke]=at.useState(!1),[Ue,ee]=at.useState(!1),[xt,je]=at.useState(!1),[ht,$e]=at.useState(0),[Mt,lt]=at.useState(0),Y=at.useRef(m.duration||X||nO),j=at.useRef(null),pe=at.useRef(null),Ie=A===0,ze=A+1<=g,Ee=m.type,tt=m.dismissible!==!1,nt=m.className||"",ct=m.descriptionClassName||"",Yt=at.useMemo(()=>w.findIndex(Ke=>Ke.toastId===m.id)||0,[w,m.id]),Xe=at.useMemo(()=>{var Ke;return(Ke=m.closeButton)!=null?Ke:I},[m.closeButton,I]),dt=at.useMemo(()=>m.duration||X||nO,[m.duration,X]),It=at.useRef(0),gt=at.useRef(0),ut=at.useRef(0),oe=at.useRef(null),[Te,Ye]=le.split("-"),se=at.useMemo(()=>w.reduce((Ke,Et,Gt)=>Gt>=Yt?Ke:Ke+Et.height,0),[w,Yt]),ye=BZ(),we=m.invert||f,De=Ee==="loading";gt.current=at.useMemo(()=>Yt*ie+se,[Yt,se]),at.useEffect(()=>{Y.current=dt},[dt]),at.useEffect(()=>{mt(!0)},[]),at.useEffect(()=>{let Ke=pe.current;if(Ke){let Et=Ke.getBoundingClientRect().height;return lt(Et),v(Gt=>[{toastId:m.id,height:Et,position:m.position},...Gt]),()=>v(Gt=>Gt.filter(Vt=>Vt.toastId!==m.id))}},[v,m.id]),at.useLayoutEffect(()=>{if(!Ce)return;let Ke=pe.current,Et=Ke.style.height;Ke.style.height="auto";let Gt=Ke.getBoundingClientRect().height;Ke.style.height=Et,lt(Gt),v(Vt=>Vt.find(_n=>_n.toastId===m.id)?Vt.map(_n=>_n.toastId===m.id?{..._n,height:Gt}:_n):[{toastId:m.id,height:Gt,position:m.position},...Vt])},[Ce,m.title,m.description,v,m.id]);let ot=at.useCallback(()=>{St(!0),$e(gt.current),v(Ke=>Ke.filter(Et=>Et.toastId!==m.id)),setTimeout(()=>{D(m)},$Z)},[m,D,v,gt]);at.useEffect(()=>{if(m.promise&&Ee==="loading"||m.duration===1/0||m.type==="loading")return;let Ke;return L||_||ve&&ye?(()=>{if(ut.current<It.current){let Et=new Date().getTime()-It.current;Y.current=Y.current-Et}ut.current=new Date().getTime()})():Y.current!==1/0&&(It.current=new Date().getTime(),Ke=setTimeout(()=>{var Et;(Et=m.onAutoClose)==null||Et.call(m,m),ot()},Y.current)),()=>clearTimeout(Ke)},[L,_,m,Ee,ve,ye,ot]),at.useEffect(()=>{m.delete&&ot()},[ot,m.delete]);function it(){var Ke,Et,Gt;return te!=null&&te.loading?at.createElement("div",{className:Yo($==null?void 0:$.loader,(Ke=m==null?void 0:m.classNames)==null?void 0:Ke.loader,"sonner-loader"),"data-visible":Ee==="loading"},te.loading):de?at.createElement("div",{className:Yo($==null?void 0:$.loader,(Et=m==null?void 0:m.classNames)==null?void 0:Et.loader,"sonner-loader"),"data-visible":Ee==="loading"},de):at.createElement(RZ,{className:Yo($==null?void 0:$.loader,(Gt=m==null?void 0:m.classNames)==null?void 0:Gt.loader),visible:Ee==="loading"})}return at.createElement("li",{tabIndex:0,ref:pe,className:Yo(B,nt,$==null?void 0:$.toast,(e=m==null?void 0:m.classNames)==null?void 0:e.toast,$==null?void 0:$.default,$==null?void 0:$[Ee],(t=m==null?void 0:m.classNames)==null?void 0:t[Ee]),"data-sonner-toast":"","data-rich-colors":(i=m.richColors)!=null?i:R,"data-styled":!(m.jsx||m.unstyled||y),"data-mounted":Ce,"data-promise":!!m.promise,"data-swiped":xt,"data-removed":Lt,"data-visible":ze,"data-y-position":Te,"data-x-position":Ye,"data-index":A,"data-front":Ie,"data-swiping":Nt,"data-dismissible":tt,"data-type":Ee,"data-invert":we,"data-swipe-out":Ue,"data-swipe-direction":Pe,"data-expanded":!!(L||G&&Ce),style:{"--index":A,"--toasts-before":A,"--z-index":T.length-A,"--offset":`${Lt?ht:gt.current}px`,"--initial-height":G?"auto":`${Mt}px`,...M,...m.style},onDragEnd:()=>{ke(!1),he(null),oe.current=null},onPointerDown:Ke=>{De||!tt||(j.current=new Date,$e(gt.current),Ke.target.setPointerCapture(Ke.pointerId),Ke.target.tagName!=="BUTTON"&&(ke(!0),oe.current={x:Ke.clientX,y:Ke.clientY}))},onPointerUp:()=>{var Ke,Et,Gt,Vt;if(Ue||!tt)return;oe.current=null;let _n=Number(((Ke=pe.current)==null?void 0:Ke.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),sn=Number(((Et=pe.current)==null?void 0:Et.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),wr=new Date().getTime()-((Gt=j.current)==null?void 0:Gt.getTime()),mi=be==="x"?_n:sn,jn=Math.abs(mi)/wr;if(Math.abs(mi)>=YZ||jn>.11){$e(gt.current),(Vt=m.onDismiss)==null||Vt.call(m,m),Oe(be==="x"?_n>0?"right":"left":sn>0?"down":"up"),ot(),ee(!0),je(!1);return}ke(!1),he(null)},onPointerMove:Ke=>{var Et,Gt,Vt,_n;if(!oe.current||!tt||((Et=window.getSelection())==null?void 0:Et.toString().length)>0)return;let sn=Ke.clientY-oe.current.y,wr=Ke.clientX-oe.current.x,mi=(Gt=n.swipeDirections)!=null?Gt:JZ(le);!be&&(Math.abs(wr)>1||Math.abs(sn)>1)&&he(Math.abs(wr)>Math.abs(sn)?"x":"y");let jn={x:0,y:0};be==="y"?(mi.includes("top")||mi.includes("bottom"))&&(mi.includes("top")&&sn<0||mi.includes("bottom")&&sn>0)&&(jn.y=sn):be==="x"&&(mi.includes("left")||mi.includes("right"))&&(mi.includes("left")&&wr<0||mi.includes("right")&&wr>0)&&(jn.x=wr),(Math.abs(jn.x)>0||Math.abs(jn.y)>0)&&je(!0),(Vt=pe.current)==null||Vt.style.setProperty("--swipe-amount-x",`${jn.x}px`),(_n=pe.current)==null||_n.style.setProperty("--swipe-amount-y",`${jn.y}px`)}},Xe&&!m.jsx?at.createElement("button",{"aria-label":ue,"data-disabled":De,"data-close-button":!0,onClick:De||!tt?()=>{}:()=>{var Ke;ot(),(Ke=m.onDismiss)==null||Ke.call(m,m)},className:Yo($==null?void 0:$.closeButton,(r=m==null?void 0:m.classNames)==null?void 0:r.closeButton)},(s=te==null?void 0:te.close)!=null?s:kZ):null,m.jsx||V.isValidElement(m.title)?m.jsx?m.jsx:typeof m.title=="function"?m.title():m.title:at.createElement(at.Fragment,null,Ee||m.icon||m.promise?at.createElement("div",{"data-icon":"",className:Yo($==null?void 0:$.icon,(o=m==null?void 0:m.classNames)==null?void 0:o.icon)},m.promise||m.type==="loading"&&!m.icon?m.icon||it():null,m.type!=="loading"?m.icon||(te==null?void 0:te[Ee])||MZ(Ee):null):null,at.createElement("div",{"data-content":"",className:Yo($==null?void 0:$.content,(a=m==null?void 0:m.classNames)==null?void 0:a.content)},at.createElement("div",{"data-title":"",className:Yo($==null?void 0:$.title,(l=m==null?void 0:m.classNames)==null?void 0:l.title)},typeof m.title=="function"?m.title():m.title),m.description?at.createElement("div",{"data-description":"",className:Yo(O,ct,$==null?void 0:$.description,(c=m==null?void 0:m.classNames)==null?void 0:c.description)},typeof m.description=="function"?m.description():m.description):null),V.isValidElement(m.cancel)?m.cancel:m.cancel&&ex(m.cancel)?at.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||C,onClick:Ke=>{var Et,Gt;ex(m.cancel)&&tt&&((Gt=(Et=m.cancel).onClick)==null||Gt.call(Et,Ke),ot())},className:Yo($==null?void 0:$.cancelButton,(u=m==null?void 0:m.classNames)==null?void 0:u.cancelButton)},m.cancel.label):null,V.isValidElement(m.action)?m.action:m.action&&ex(m.action)?at.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||k,onClick:Ke=>{var Et,Gt;ex(m.action)&&((Gt=(Et=m.action).onClick)==null||Gt.call(Et,Ke),!Ke.defaultPrevented&&ot())},className:Yo($==null?void 0:$.actionButton,(h=m==null?void 0:m.classNames)==null?void 0:h.actionButton)},m.action.label):null))};function iO(){if(typeof window>"u"||typeof document>"u")return"ltr";let n=document.documentElement.getAttribute("dir");return n==="auto"||!n?window.getComputedStyle(document.documentElement).direction:n}function ZZ(n,e){let t={};return[n,e].forEach((i,r)=>{let s=r===1,o=s?"--mobile-offset":"--offset",a=s?KZ:WZ;function l(c){["top","right","bottom","left"].forEach(u=>{t[`${o}-${u}`]=typeof c=="number"?`${c}px`:c})}typeof i=="number"||typeof i=="string"?l(i):typeof i=="object"?["top","right","bottom","left"].forEach(c=>{i[c]===void 0?t[`${o}-${c}`]=a:t[`${o}-${c}`]=typeof i[c]=="number"?`${i[c]}px`:i[c]}):l(a)}),t}var eee=V.forwardRef(function(n,e){let{invert:t,position:i="bottom-right",hotkey:r=["altKey","KeyT"],expand:s,closeButton:o,className:a,offset:l,mobileOffset:c,theme:u="light",richColors:h,duration:f,style:m,visibleToasts:y=jZ,toastOptions:_,dir:v=iO(),gap:g=qZ,loadingIcon:w,icons:A,containerAriaLabel:T="Notifications",pauseWhenPageIsHidden:L}=n,[D,R]=at.useState([]),I=at.useMemo(()=>Array.from(new Set([i].concat(D.filter(ve=>ve.position).map(ve=>ve.position)))),[D,i]),[M,C]=at.useState([]),[k,B]=at.useState(!1),[O,X]=at.useState(!1),[le,ie]=at.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),de=at.useRef(null),G=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),$=at.useRef(null),te=at.useRef(!1),ue=at.useCallback(ve=>{R(be=>{var he;return(he=be.find(Pe=>Pe.id===ve.id))!=null&&he.delete||Ns.dismiss(ve.id),be.filter(({id:Pe})=>Pe!==ve.id)})},[]);return at.useEffect(()=>Ns.subscribe(ve=>{if(ve.dismiss){R(be=>be.map(he=>he.id===ve.id?{...he,delete:!0}:he));return}setTimeout(()=>{vH.flushSync(()=>{R(be=>{let he=be.findIndex(Pe=>Pe.id===ve.id);return he!==-1?[...be.slice(0,he),{...be[he],...ve},...be.slice(he+1)]:[ve,...be]})})})}),[]),at.useEffect(()=>{if(u!=="system"){ie(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?ie("dark"):ie("light")),typeof window>"u")return;let ve=window.matchMedia("(prefers-color-scheme: dark)");try{ve.addEventListener("change",({matches:be})=>{ie(be?"dark":"light")})}catch{ve.addListener(({matches:he})=>{try{ie(he?"dark":"light")}catch(Pe){console.error(Pe)}})}},[u]),at.useEffect(()=>{D.length<=1&&B(!1)},[D]),at.useEffect(()=>{let ve=be=>{var he,Pe;r.every(Oe=>be[Oe]||be.code===Oe)&&(B(!0),(he=de.current)==null||he.focus()),be.code==="Escape"&&(document.activeElement===de.current||(Pe=de.current)!=null&&Pe.contains(document.activeElement))&&B(!1)};return document.addEventListener("keydown",ve),()=>document.removeEventListener("keydown",ve)},[r]),at.useEffect(()=>{if(de.current)return()=>{$.current&&($.current.focus({preventScroll:!0}),$.current=null,te.current=!1)}},[de.current]),at.createElement("section",{ref:e,"aria-label":`${T} ${G}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},I.map((ve,be)=>{var he;let[Pe,Oe]=ve.split("-");return D.length?at.createElement("ol",{key:ve,dir:v==="auto"?iO():v,tabIndex:-1,ref:de,className:a,"data-sonner-toaster":!0,"data-theme":le,"data-y-position":Pe,"data-lifted":k&&D.length>1&&!s,"data-x-position":Oe,style:{"--front-toast-height":`${((he=M[0])==null?void 0:he.height)||0}px`,"--width":`${XZ}px`,"--gap":`${g}px`,...m,...ZZ(l,c)},onBlur:Ce=>{te.current&&!Ce.currentTarget.contains(Ce.relatedTarget)&&(te.current=!1,$.current&&($.current.focus({preventScroll:!0}),$.current=null))},onFocus:Ce=>{Ce.target instanceof HTMLElement&&Ce.target.dataset.dismissible==="false"||te.current||(te.current=!0,$.current=Ce.relatedTarget)},onMouseEnter:()=>B(!0),onMouseMove:()=>B(!0),onMouseLeave:()=>{O||B(!1)},onDragEnd:()=>B(!1),onPointerDown:Ce=>{Ce.target instanceof HTMLElement&&Ce.target.dataset.dismissible==="false"||X(!0)},onPointerUp:()=>X(!1)},D.filter(Ce=>!Ce.position&&be===0||Ce.position===ve).map((Ce,mt)=>{var Lt,St;return at.createElement(QZ,{key:Ce.id,icons:A,index:mt,toast:Ce,defaultRichColors:h,duration:(Lt=_==null?void 0:_.duration)!=null?Lt:f,className:_==null?void 0:_.className,descriptionClassName:_==null?void 0:_.descriptionClassName,invert:t,visibleToasts:y,closeButton:(St=_==null?void 0:_.closeButton)!=null?St:o,interacting:O,position:ve,style:_==null?void 0:_.style,unstyled:_==null?void 0:_.unstyled,classNames:_==null?void 0:_.classNames,cancelButtonStyle:_==null?void 0:_.cancelButtonStyle,actionButtonStyle:_==null?void 0:_.actionButtonStyle,removeToast:ue,toasts:D.filter(Nt=>Nt.position==Ce.position),heights:M.filter(Nt=>Nt.position==Ce.position),setHeights:C,expandByDefault:s,gap:g,loadingIcon:w,expanded:k,pauseWhenPageIsHidden:L,swipeDirections:n.swipeDirections})})):null}))});const tee=({...n})=>{const{theme:e="system"}=CZ();return S.jsx(eee,{theme:e,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...n})},nee=["top","right","bottom","left"],Iu=Math.min,so=Math.max,x1=Math.round,tx=Math.floor,Ka=n=>({x:n,y:n}),iee={left:"right",right:"left",bottom:"top",top:"bottom"},ree={start:"end",end:"start"};function tI(n,e,t){return so(n,Iu(e,t))}function nc(n,e){return typeof n=="function"?n(e):n}function ic(n){return n.split("-")[0]}function Pm(n){return n.split("-")[1]}function $P(n){return n==="x"?"y":"x"}function JP(n){return n==="y"?"height":"width"}const see=new Set(["top","bottom"]);function Va(n){return see.has(ic(n))?"y":"x"}function QP(n){return $P(Va(n))}function oee(n,e,t){t===void 0&&(t=!1);const i=Pm(n),r=QP(n),s=JP(r);let o=r==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=w1(o)),[o,w1(o)]}function aee(n){const e=w1(n);return[nI(n),e,nI(e)]}function nI(n){return n.replace(/start|end/g,e=>ree[e])}const rO=["left","right"],sO=["right","left"],lee=["top","bottom"],cee=["bottom","top"];function uee(n,e,t){switch(n){case"top":case"bottom":return t?e?sO:rO:e?rO:sO;case"left":case"right":return e?lee:cee;default:return[]}}function hee(n,e,t,i){const r=Pm(n);let s=uee(ic(n),t==="start",i);return r&&(s=s.map(o=>o+"-"+r),e&&(s=s.concat(s.map(nI)))),s}function w1(n){return n.replace(/left|right|bottom|top/g,e=>iee[e])}function dee(n){return{top:0,right:0,bottom:0,left:0,...n}}function pG(n){return typeof n!="number"?dee(n):{top:n,right:n,bottom:n,left:n}}function E1(n){const{x:e,y:t,width:i,height:r}=n;return{width:i,height:r,top:t,left:e,right:e+i,bottom:t+r,x:e,y:t}}function oO(n,e,t){let{reference:i,floating:r}=n;const s=Va(e),o=QP(e),a=JP(o),l=ic(e),c=s==="y",u=i.x+i.width/2-r.width/2,h=i.y+i.height/2-r.height/2,f=i[a]/2-r[a]/2;let m;switch(l){case"top":m={x:u,y:i.y-r.height};break;case"bottom":m={x:u,y:i.y+i.height};break;case"right":m={x:i.x+i.width,y:h};break;case"left":m={x:i.x-r.width,y:h};break;default:m={x:i.x,y:i.y}}switch(Pm(e)){case"start":m[o]-=f*(t&&c?-1:1);break;case"end":m[o]+=f*(t&&c?-1:1);break}return m}const fee=async(n,e,t)=>{const{placement:i="bottom",strategy:r="absolute",middleware:s=[],platform:o}=t,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:n,floating:e,strategy:r}),{x:u,y:h}=oO(c,i,l),f=i,m={},y=0;for(let _=0;_<a.length;_++){const{name:v,fn:g}=a[_],{x:w,y:A,data:T,reset:L}=await g({x:u,y:h,initialPlacement:i,placement:f,strategy:r,middlewareData:m,rects:c,platform:o,elements:{reference:n,floating:e}});u=w??u,h=A??h,m={...m,[v]:{...m[v],...T}},L&&y<=50&&(y++,typeof L=="object"&&(L.placement&&(f=L.placement),L.rects&&(c=L.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:r}):L.rects),{x:u,y:h}=oO(c,f,l)),_=-1)}return{x:u,y:h,placement:f,strategy:r,middlewareData:m}};async function f0(n,e){var t;e===void 0&&(e={});const{x:i,y:r,platform:s,rects:o,elements:a,strategy:l}=n,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:f=!1,padding:m=0}=nc(e,n),y=pG(m),v=a[f?h==="floating"?"reference":"floating":h],g=E1(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(v)))==null||t?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),w=h==="floating"?{x:i,y:r,width:o.floating.width,height:o.floating.height}:o.reference,A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),T=await(s.isElement==null?void 0:s.isElement(A))?await(s.getScale==null?void 0:s.getScale(A))||{x:1,y:1}:{x:1,y:1},L=E1(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:A,strategy:l}):w);return{top:(g.top-L.top+y.top)/T.y,bottom:(L.bottom-g.bottom+y.bottom)/T.y,left:(g.left-L.left+y.left)/T.x,right:(L.right-g.right+y.right)/T.x}}const pee=n=>({name:"arrow",options:n,async fn(e){const{x:t,y:i,placement:r,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=nc(n,e)||{};if(c==null)return{};const h=pG(u),f={x:t,y:i},m=QP(r),y=JP(m),_=await o.getDimensions(c),v=m==="y",g=v?"top":"left",w=v?"bottom":"right",A=v?"clientHeight":"clientWidth",T=s.reference[y]+s.reference[m]-f[m]-s.floating[y],L=f[m]-s.reference[m],D=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let R=D?D[A]:0;(!R||!await(o.isElement==null?void 0:o.isElement(D)))&&(R=a.floating[A]||s.floating[y]);const I=T/2-L/2,M=R/2-_[y]/2-1,C=Iu(h[g],M),k=Iu(h[w],M),B=C,O=R-_[y]-k,X=R/2-_[y]/2+I,le=tI(B,X,O),ie=!l.arrow&&Pm(r)!=null&&X!==le&&s.reference[y]/2-(X<B?C:k)-_[y]/2<0,de=ie?X<B?X-B:X-O:0;return{[m]:f[m]+de,data:{[m]:le,centerOffset:X-le-de,...ie&&{alignmentOffset:de}},reset:ie}}}),mee=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,i;const{placement:r,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:_=!0,...v}=nc(n,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const g=ic(r),w=Va(a),A=ic(a)===a,T=await(l.isRTL==null?void 0:l.isRTL(c.floating)),L=f||(A||!_?[w1(a)]:aee(a)),D=y!=="none";!f&&D&&L.push(...hee(a,_,y,T));const R=[a,...L],I=await f0(e,v),M=[];let C=((i=s.flip)==null?void 0:i.overflows)||[];if(u&&M.push(I[g]),h){const X=oee(r,o,T);M.push(I[X[0]],I[X[1]])}if(C=[...C,{placement:r,overflows:M}],!M.every(X=>X<=0)){var k,B;const X=(((k=s.flip)==null?void 0:k.index)||0)+1,le=R[X];if(le&&(!(h==="alignment"?w!==Va(le):!1)||C.every(G=>G.overflows[0]>0&&Va(G.placement)===w)))return{data:{index:X,overflows:C},reset:{placement:le}};let ie=(B=C.filter(de=>de.overflows[0]<=0).sort((de,G)=>de.overflows[1]-G.overflows[1])[0])==null?void 0:B.placement;if(!ie)switch(m){case"bestFit":{var O;const de=(O=C.filter(G=>{if(D){const $=Va(G.placement);return $===w||$==="y"}return!0}).map(G=>[G.placement,G.overflows.filter($=>$>0).reduce(($,te)=>$+te,0)]).sort((G,$)=>G[1]-$[1])[0])==null?void 0:O[0];de&&(ie=de);break}case"initialPlacement":ie=a;break}if(r!==ie)return{reset:{placement:ie}}}return{}}}};function aO(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function lO(n){return nee.some(e=>n[e]>=0)}const gee=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:i="referenceHidden",...r}=nc(n,e);switch(i){case"referenceHidden":{const s=await f0(e,{...r,elementContext:"reference"}),o=aO(s,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:lO(o)}}}case"escaped":{const s=await f0(e,{...r,altBoundary:!0}),o=aO(s,t.floating);return{data:{escapedOffsets:o,escaped:lO(o)}}}default:return{}}}}},mG=new Set(["left","top"]);async function yee(n,e){const{placement:t,platform:i,elements:r}=n,s=await(i.isRTL==null?void 0:i.isRTL(r.floating)),o=ic(t),a=Pm(t),l=Va(t)==="y",c=mG.has(o)?-1:1,u=s&&l?-1:1,h=nc(e,n);let{mainAxis:f,crossAxis:m,alignmentAxis:y}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof y=="number"&&(m=a==="end"?y*-1:y),l?{x:m*u,y:f*c}:{x:f*c,y:m*u}}const vee=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,i;const{x:r,y:s,placement:o,middlewareData:a}=e,l=await yee(e,n);return o===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+l.x,y:s+l.y,data:{...l,placement:o}}}}},_ee=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:i,placement:r}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:v=>{let{x:g,y:w}=v;return{x:g,y:w}}},...l}=nc(n,e),c={x:t,y:i},u=await f0(e,l),h=Va(ic(r)),f=$P(h);let m=c[f],y=c[h];if(s){const v=f==="y"?"top":"left",g=f==="y"?"bottom":"right",w=m+u[v],A=m-u[g];m=tI(w,m,A)}if(o){const v=h==="y"?"top":"left",g=h==="y"?"bottom":"right",w=y+u[v],A=y-u[g];y=tI(w,y,A)}const _=a.fn({...e,[f]:m,[h]:y});return{..._,data:{x:_.x-t,y:_.y-i,enabled:{[f]:s,[h]:o}}}}}},xee=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:t,y:i,placement:r,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=nc(n,e),u={x:t,y:i},h=Va(r),f=$P(h);let m=u[f],y=u[h];const _=nc(a,e),v=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(l){const A=f==="y"?"height":"width",T=s.reference[f]-s.floating[A]+v.mainAxis,L=s.reference[f]+s.reference[A]-v.mainAxis;m<T?m=T:m>L&&(m=L)}if(c){var g,w;const A=f==="y"?"width":"height",T=mG.has(ic(r)),L=s.reference[h]-s.floating[A]+(T&&((g=o.offset)==null?void 0:g[h])||0)+(T?0:v.crossAxis),D=s.reference[h]+s.reference[A]+(T?0:((w=o.offset)==null?void 0:w[h])||0)-(T?v.crossAxis:0);y<L?y=L:y>D&&(y=D)}return{[f]:m,[h]:y}}}},wee=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var t,i;const{placement:r,rects:s,platform:o,elements:a}=e,{apply:l=()=>{},...c}=nc(n,e),u=await f0(e,c),h=ic(r),f=Pm(r),m=Va(r)==="y",{width:y,height:_}=s.floating;let v,g;h==="top"||h==="bottom"?(v=h,g=f===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(g=h,v=f==="end"?"top":"bottom");const w=_-u.top-u.bottom,A=y-u.left-u.right,T=Iu(_-u[v],w),L=Iu(y-u[g],A),D=!e.middlewareData.shift;let R=T,I=L;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(I=A),(i=e.middlewareData.shift)!=null&&i.enabled.y&&(R=w),D&&!f){const C=so(u.left,0),k=so(u.right,0),B=so(u.top,0),O=so(u.bottom,0);m?I=y-2*(C!==0||k!==0?C+k:so(u.left,u.right)):R=_-2*(B!==0||O!==0?B+O:so(u.top,u.bottom))}await l({...e,availableWidth:I,availableHeight:R});const M=await o.getDimensions(a.floating);return y!==M.width||_!==M.height?{reset:{rects:!0}}:{}}}};function pA(){return typeof window<"u"}function Nm(n){return gG(n)?(n.nodeName||"").toLowerCase():"#document"}function co(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function ul(n){var e;return(e=(gG(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function gG(n){return pA()?n instanceof Node||n instanceof co(n).Node:!1}function xa(n){return pA()?n instanceof Element||n instanceof co(n).Element:!1}function il(n){return pA()?n instanceof HTMLElement||n instanceof co(n).HTMLElement:!1}function cO(n){return!pA()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof co(n).ShadowRoot}const Eee=new Set(["inline","contents"]);function ov(n){const{overflow:e,overflowX:t,overflowY:i,display:r}=wa(n);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!Eee.has(r)}const Aee=new Set(["table","td","th"]);function See(n){return Aee.has(Nm(n))}const Tee=[":popover-open",":modal"];function mA(n){return Tee.some(e=>{try{return n.matches(e)}catch{return!1}})}const bee=["transform","translate","scale","rotate","perspective"],Cee=["transform","translate","scale","rotate","perspective","filter"],Mee=["paint","layout","strict","content"];function ZP(n){const e=e2(),t=xa(n)?wa(n):n;return bee.some(i=>t[i]?t[i]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||Cee.some(i=>(t.willChange||"").includes(i))||Mee.some(i=>(t.contain||"").includes(i))}function Iee(n){let e=Ru(n);for(;il(e)&&!nm(e);){if(ZP(e))return e;if(mA(e))return null;e=Ru(e)}return null}function e2(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Ree=new Set(["html","body","#document"]);function nm(n){return Ree.has(Nm(n))}function wa(n){return co(n).getComputedStyle(n)}function gA(n){return xa(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Ru(n){if(Nm(n)==="html")return n;const e=n.assignedSlot||n.parentNode||cO(n)&&n.host||ul(n);return cO(e)?e.host:e}function yG(n){const e=Ru(n);return nm(e)?n.ownerDocument?n.ownerDocument.body:n.body:il(e)&&ov(e)?e:yG(e)}function p0(n,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=yG(n),s=r===((i=n.ownerDocument)==null?void 0:i.body),o=co(r);if(s){const a=iI(o);return e.concat(o,o.visualViewport||[],ov(r)?r:[],a&&t?p0(a):[])}return e.concat(r,p0(r,[],t))}function iI(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function vG(n){const e=wa(n);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=il(n),s=r?n.offsetWidth:t,o=r?n.offsetHeight:i,a=x1(t)!==s||x1(i)!==o;return a&&(t=s,i=o),{width:t,height:i,$:a}}function t2(n){return xa(n)?n:n.contextElement}function Mp(n){const e=t2(n);if(!il(e))return Ka(1);const t=e.getBoundingClientRect(),{width:i,height:r,$:s}=vG(e);let o=(s?x1(t.width):t.width)/i,a=(s?x1(t.height):t.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Pee=Ka(0);function _G(n){const e=co(n);return!e2()||!e.visualViewport?Pee:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Nee(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==co(n)?!1:e}function Cd(n,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=n.getBoundingClientRect(),s=t2(n);let o=Ka(1);e&&(i?xa(i)&&(o=Mp(i)):o=Mp(n));const a=Nee(s,t,i)?_G(s):Ka(0);let l=(r.left+a.x)/o.x,c=(r.top+a.y)/o.y,u=r.width/o.x,h=r.height/o.y;if(s){const f=co(s),m=i&&xa(i)?co(i):i;let y=f,_=iI(y);for(;_&&i&&m!==y;){const v=Mp(_),g=_.getBoundingClientRect(),w=wa(_),A=g.left+(_.clientLeft+parseFloat(w.paddingLeft))*v.x,T=g.top+(_.clientTop+parseFloat(w.paddingTop))*v.y;l*=v.x,c*=v.y,u*=v.x,h*=v.y,l+=A,c+=T,y=co(_),_=iI(y)}}return E1({width:u,height:h,x:l,y:c})}function n2(n,e){const t=gA(n).scrollLeft;return e?e.left+t:Cd(ul(n)).left+t}function xG(n,e,t){t===void 0&&(t=!1);const i=n.getBoundingClientRect(),r=i.left+e.scrollLeft-(t?0:n2(n,i)),s=i.top+e.scrollTop;return{x:r,y:s}}function Dee(n){let{elements:e,rect:t,offsetParent:i,strategy:r}=n;const s=r==="fixed",o=ul(i),a=e?mA(e.floating):!1;if(i===o||a&&s)return t;let l={scrollLeft:0,scrollTop:0},c=Ka(1);const u=Ka(0),h=il(i);if((h||!h&&!s)&&((Nm(i)!=="body"||ov(o))&&(l=gA(i)),il(i))){const m=Cd(i);c=Mp(i),u.x=m.x+i.clientLeft,u.y=m.y+i.clientTop}const f=o&&!h&&!s?xG(o,l,!0):Ka(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:t.y*c.y-l.scrollTop*c.y+u.y+f.y}}function Lee(n){return Array.from(n.getClientRects())}function kee(n){const e=ul(n),t=gA(n),i=n.ownerDocument.body,r=so(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),s=so(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let o=-t.scrollLeft+n2(n);const a=-t.scrollTop;return wa(i).direction==="rtl"&&(o+=so(e.clientWidth,i.clientWidth)-r),{width:r,height:s,x:o,y:a}}function Bee(n,e){const t=co(n),i=ul(n),r=t.visualViewport;let s=i.clientWidth,o=i.clientHeight,a=0,l=0;if(r){s=r.width,o=r.height;const c=e2();(!c||c&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:s,height:o,x:a,y:l}}const Oee=new Set(["absolute","fixed"]);function Fee(n,e){const t=Cd(n,!0,e==="fixed"),i=t.top+n.clientTop,r=t.left+n.clientLeft,s=il(n)?Mp(n):Ka(1),o=n.clientWidth*s.x,a=n.clientHeight*s.y,l=r*s.x,c=i*s.y;return{width:o,height:a,x:l,y:c}}function uO(n,e,t){let i;if(e==="viewport")i=Bee(n,t);else if(e==="document")i=kee(ul(n));else if(xa(e))i=Fee(e,t);else{const r=_G(n);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return E1(i)}function wG(n,e){const t=Ru(n);return t===e||!xa(t)||nm(t)?!1:wa(t).position==="fixed"||wG(t,e)}function Uee(n,e){const t=e.get(n);if(t)return t;let i=p0(n,[],!1).filter(a=>xa(a)&&Nm(a)!=="body"),r=null;const s=wa(n).position==="fixed";let o=s?Ru(n):n;for(;xa(o)&&!nm(o);){const a=wa(o),l=ZP(o);!l&&a.position==="fixed"&&(r=null),(s?!l&&!r:!l&&a.position==="static"&&!!r&&Oee.has(r.position)||ov(o)&&!l&&wG(n,o))?i=i.filter(u=>u!==o):r=a,o=Ru(o)}return e.set(n,i),i}function Vee(n){let{element:e,boundary:t,rootBoundary:i,strategy:r}=n;const o=[...t==="clippingAncestors"?mA(e)?[]:Uee(e,this._c):[].concat(t),i],a=o[0],l=o.reduce((c,u)=>{const h=uO(e,u,r);return c.top=so(h.top,c.top),c.right=Iu(h.right,c.right),c.bottom=Iu(h.bottom,c.bottom),c.left=so(h.left,c.left),c},uO(e,a,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function zee(n){const{width:e,height:t}=vG(n);return{width:e,height:t}}function Hee(n,e,t){const i=il(e),r=ul(e),s=t==="fixed",o=Cd(n,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=Ka(0);function c(){l.x=n2(r)}if(i||!i&&!s)if((Nm(e)!=="body"||ov(r))&&(a=gA(e)),i){const m=Cd(e,!0,s,e);l.x=m.x+e.clientLeft,l.y=m.y+e.clientTop}else r&&c();s&&!i&&r&&c();const u=r&&!i&&!s?xG(r,a):Ka(0),h=o.left+a.scrollLeft-l.x-u.x,f=o.top+a.scrollTop-l.y-u.y;return{x:h,y:f,width:o.width,height:o.height}}function hb(n){return wa(n).position==="static"}function hO(n,e){if(!il(n)||wa(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return ul(n)===t&&(t=t.ownerDocument.body),t}function EG(n,e){const t=co(n);if(mA(n))return t;if(!il(n)){let r=Ru(n);for(;r&&!nm(r);){if(xa(r)&&!hb(r))return r;r=Ru(r)}return t}let i=hO(n,e);for(;i&&See(i)&&hb(i);)i=hO(i,e);return i&&nm(i)&&hb(i)&&!ZP(i)?t:i||Iee(n)||t}const Gee=async function(n){const e=this.getOffsetParent||EG,t=this.getDimensions,i=await t(n.floating);return{reference:Hee(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function jee(n){return wa(n).direction==="rtl"}const Wee={convertOffsetParentRelativeRectToViewportRelativeRect:Dee,getDocumentElement:ul,getClippingRect:Vee,getOffsetParent:EG,getElementRects:Gee,getClientRects:Lee,getDimensions:zee,getScale:Mp,isElement:xa,isRTL:jee};function AG(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function Kee(n,e){let t=null,i;const r=ul(n);function s(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=n.getBoundingClientRect(),{left:u,top:h,width:f,height:m}=c;if(a||e(),!f||!m)return;const y=tx(h),_=tx(r.clientWidth-(u+f)),v=tx(r.clientHeight-(h+m)),g=tx(u),A={rootMargin:-y+"px "+-_+"px "+-v+"px "+-g+"px",threshold:so(0,Iu(1,l))||1};let T=!0;function L(D){const R=D[0].intersectionRatio;if(R!==l){if(!T)return o();R?o(!1,R):i=setTimeout(()=>{o(!1,1e-7)},1e3)}R===1&&!AG(c,n.getBoundingClientRect())&&o(),T=!1}try{t=new IntersectionObserver(L,{...A,root:r.ownerDocument})}catch{t=new IntersectionObserver(L,A)}t.observe(n)}return o(!0),s}function Xee(n,e,t,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,c=t2(n),u=r||s?[...c?p0(c):[],...p0(e)]:[];u.forEach(g=>{r&&g.addEventListener("scroll",t,{passive:!0}),s&&g.addEventListener("resize",t)});const h=c&&a?Kee(c,t):null;let f=-1,m=null;o&&(m=new ResizeObserver(g=>{let[w]=g;w&&w.target===c&&m&&(m.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var A;(A=m)==null||A.observe(e)})),t()}),c&&!l&&m.observe(c),m.observe(e));let y,_=l?Cd(n):null;l&&v();function v(){const g=Cd(n);_&&!AG(_,g)&&t(),_=g,y=requestAnimationFrame(v)}return t(),()=>{var g;u.forEach(w=>{r&&w.removeEventListener("scroll",t),s&&w.removeEventListener("resize",t)}),h==null||h(),(g=m)==null||g.disconnect(),m=null,l&&cancelAnimationFrame(y)}}const qee=vee,Yee=_ee,$ee=mee,Jee=wee,Qee=gee,dO=pee,Zee=xee,ete=(n,e,t)=>{const i=new Map,r={platform:Wee,...t},s={...r.platform,_c:i};return fee(n,e,{...r,platform:s})};var tte=typeof document<"u",nte=function(){},Cw=tte?V.useLayoutEffect:nte;function A1(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,i,r;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!==e.length)return!1;for(i=t;i--!==0;)if(!A1(n[i],e[i]))return!1;return!0}if(r=Object.keys(n),t=r.length,t!==Object.keys(e).length)return!1;for(i=t;i--!==0;)if(!{}.hasOwnProperty.call(e,r[i]))return!1;for(i=t;i--!==0;){const s=r[i];if(!(s==="_owner"&&n.$$typeof)&&!A1(n[s],e[s]))return!1}return!0}return n!==n&&e!==e}function SG(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function fO(n,e){const t=SG(n);return Math.round(e*t)/t}function db(n){const e=V.useRef(n);return Cw(()=>{e.current=n}),e}function ite(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:i=[],platform:r,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=n,[u,h]=V.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[f,m]=V.useState(i);A1(f,i)||m(i);const[y,_]=V.useState(null),[v,g]=V.useState(null),w=V.useCallback(G=>{G!==D.current&&(D.current=G,_(G))},[]),A=V.useCallback(G=>{G!==R.current&&(R.current=G,g(G))},[]),T=s||y,L=o||v,D=V.useRef(null),R=V.useRef(null),I=V.useRef(u),M=l!=null,C=db(l),k=db(r),B=db(c),O=V.useCallback(()=>{if(!D.current||!R.current)return;const G={placement:e,strategy:t,middleware:f};k.current&&(G.platform=k.current),ete(D.current,R.current,G).then($=>{const te={...$,isPositioned:B.current!==!1};X.current&&!A1(I.current,te)&&(I.current=te,iv.flushSync(()=>{h(te)}))})},[f,e,t,k,B]);Cw(()=>{c===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,h(G=>({...G,isPositioned:!1})))},[c]);const X=V.useRef(!1);Cw(()=>(X.current=!0,()=>{X.current=!1}),[]),Cw(()=>{if(T&&(D.current=T),L&&(R.current=L),T&&L){if(C.current)return C.current(T,L,O);O()}},[T,L,O,C,M]);const le=V.useMemo(()=>({reference:D,floating:R,setReference:w,setFloating:A}),[w,A]),ie=V.useMemo(()=>({reference:T,floating:L}),[T,L]),de=V.useMemo(()=>{const G={position:t,left:0,top:0};if(!ie.floating)return G;const $=fO(ie.floating,u.x),te=fO(ie.floating,u.y);return a?{...G,transform:"translate("+$+"px, "+te+"px)",...SG(ie.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:$,top:te}},[t,a,ie.floating,u.x,u.y]);return V.useMemo(()=>({...u,update:O,refs:le,elements:ie,floatingStyles:de}),[u,O,le,ie,de])}const rte=n=>{function e(t){return{}.hasOwnProperty.call(t,"current")}return{name:"arrow",options:n,fn(t){const{element:i,padding:r}=typeof n=="function"?n(t):n;return i&&e(i)?i.current!=null?dO({element:i.current,padding:r}).fn(t):{}:i?dO({element:i,padding:r}).fn(t):{}}}},ste=(n,e)=>({...qee(n),options:[n,e]}),ote=(n,e)=>({...Yee(n),options:[n,e]}),ate=(n,e)=>({...Zee(n),options:[n,e]}),lte=(n,e)=>({...$ee(n),options:[n,e]}),cte=(n,e)=>({...Jee(n),options:[n,e]}),ute=(n,e)=>({...Qee(n),options:[n,e]}),hte=(n,e)=>({...rte(n),options:[n,e]});var dte="Arrow",TG=V.forwardRef((n,e)=>{const{children:t,width:i=10,height:r=5,...s}=n;return S.jsx(Ks.svg,{...s,ref:e,width:i,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?t:S.jsx("polygon",{points:"0,0 30,0 15,10"})})});TG.displayName=dte;var fte=TG;function pte(n){const[e,t]=V.useState(void 0);return Mu(()=>{if(n){t({width:n.offsetWidth,height:n.offsetHeight});const i=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=n.offsetWidth,a=n.offsetHeight;t({width:o,height:a})});return i.observe(n,{box:"border-box"}),()=>i.unobserve(n)}else t(void 0)},[n]),e}var bG="Popper",[CG,MG]=cA(bG),[oCe,IG]=CG(bG),RG="PopperAnchor",PG=V.forwardRef((n,e)=>{const{__scopePopper:t,virtualRef:i,...r}=n,s=IG(RG,t),o=V.useRef(null),a=_a(e,o);return V.useEffect(()=>{s.onAnchorChange((i==null?void 0:i.current)||o.current)}),i?null:S.jsx(Ks.div,{...r,ref:a})});PG.displayName=RG;var i2="PopperContent",[mte,gte]=CG(i2),NG=V.forwardRef((n,e)=>{var Ce,mt,Lt,St,Nt,ke;const{__scopePopper:t,side:i="bottom",sideOffset:r=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:h="partial",hideWhenDetached:f=!1,updatePositionStrategy:m="optimized",onPlaced:y,..._}=n,v=IG(i2,t),[g,w]=V.useState(null),A=_a(e,Ue=>w(Ue)),[T,L]=V.useState(null),D=pte(T),R=(D==null?void 0:D.width)??0,I=(D==null?void 0:D.height)??0,M=i+(s!=="center"?"-"+s:""),C=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},k=Array.isArray(c)?c:[c],B=k.length>0,O={padding:C,boundary:k.filter(vte),altBoundary:B},{refs:X,floatingStyles:le,placement:ie,isPositioned:de,middlewareData:G}=ite({strategy:"fixed",placement:M,whileElementsMounted:(...Ue)=>Xee(...Ue,{animationFrame:m==="always"}),elements:{reference:v.anchor},middleware:[ste({mainAxis:r+I,alignmentAxis:o}),l&&ote({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?ate():void 0,...O}),l&&lte({...O}),cte({...O,apply:({elements:Ue,rects:ee,availableWidth:xt,availableHeight:je})=>{const{width:ht,height:$e}=ee.reference,Mt=Ue.floating.style;Mt.setProperty("--radix-popper-available-width",`${xt}px`),Mt.setProperty("--radix-popper-available-height",`${je}px`),Mt.setProperty("--radix-popper-anchor-width",`${ht}px`),Mt.setProperty("--radix-popper-anchor-height",`${$e}px`)}}),T&&hte({element:T,padding:a}),_te({arrowWidth:R,arrowHeight:I}),f&&ute({strategy:"referenceHidden",...O})]}),[$,te]=kG(ie),ue=Cu(y);Mu(()=>{de&&(ue==null||ue())},[de,ue]);const ve=(Ce=G.arrow)==null?void 0:Ce.x,be=(mt=G.arrow)==null?void 0:mt.y,he=((Lt=G.arrow)==null?void 0:Lt.centerOffset)!==0,[Pe,Oe]=V.useState();return Mu(()=>{g&&Oe(window.getComputedStyle(g).zIndex)},[g]),S.jsx("div",{ref:X.setFloating,"data-radix-popper-content-wrapper":"",style:{...le,transform:de?le.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Pe,"--radix-popper-transform-origin":[(St=G.transformOrigin)==null?void 0:St.x,(Nt=G.transformOrigin)==null?void 0:Nt.y].join(" "),...((ke=G.hide)==null?void 0:ke.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:S.jsx(mte,{scope:t,placedSide:$,onArrowChange:L,arrowX:ve,arrowY:be,shouldHideArrow:he,children:S.jsx(Ks.div,{"data-side":$,"data-align":te,..._,ref:A,style:{..._.style,animation:de?void 0:"none"}})})})});NG.displayName=i2;var DG="PopperArrow",yte={top:"bottom",right:"left",bottom:"top",left:"right"},LG=V.forwardRef(function(e,t){const{__scopePopper:i,...r}=e,s=gte(DG,i),o=yte[s.placedSide];return S.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:S.jsx(fte,{...r,ref:t,style:{...r.style,display:"block"}})})});LG.displayName=DG;function vte(n){return n!==null}var _te=n=>({name:"transformOrigin",options:n,fn(e){var v,g,w;const{placement:t,rects:i,middlewareData:r}=e,o=((v=r.arrow)==null?void 0:v.centerOffset)!==0,a=o?0:n.arrowWidth,l=o?0:n.arrowHeight,[c,u]=kG(t),h={start:"0%",center:"50%",end:"100%"}[u],f=(((g=r.arrow)==null?void 0:g.x)??0)+a/2,m=(((w=r.arrow)==null?void 0:w.y)??0)+l/2;let y="",_="";return c==="bottom"?(y=o?h:`${f}px`,_=`${-l}px`):c==="top"?(y=o?h:`${f}px`,_=`${i.floating.height+l}px`):c==="right"?(y=`${-l}px`,_=o?h:`${m}px`):c==="left"&&(y=`${i.floating.width+l}px`,_=o?h:`${m}px`),{data:{x:y,y:_}}}});function kG(n){const[e,t="center"]=n.split("-");return[e,t]}var xte=PG,wte=NG,Ete=LG,[yA,aCe]=cA("Tooltip",[MG]),r2=MG(),BG="TooltipProvider",Ate=700,pO="tooltip.open",[Ste,OG]=yA(BG),FG=n=>{const{__scopeTooltip:e,delayDuration:t=Ate,skipDelayDuration:i=300,disableHoverableContent:r=!1,children:s}=n,o=V.useRef(!0),a=V.useRef(!1),l=V.useRef(0);return V.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),S.jsx(Ste,{scope:e,isOpenDelayedRef:o,delayDuration:t,onOpen:V.useCallback(()=>{window.clearTimeout(l.current),o.current=!1},[]),onClose:V.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,i)},[i]),isPointerInTransitRef:a,onPointerInTransitChange:V.useCallback(c=>{a.current=c},[]),disableHoverableContent:r,children:s})};FG.displayName=BG;var UG="Tooltip",[lCe,vA]=yA(UG),rI="TooltipTrigger",Tte=V.forwardRef((n,e)=>{const{__scopeTooltip:t,...i}=n,r=vA(rI,t),s=OG(rI,t),o=r2(t),a=V.useRef(null),l=_a(e,a,r.onTriggerChange),c=V.useRef(!1),u=V.useRef(!1),h=V.useCallback(()=>c.current=!1,[]);return V.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),S.jsx(xte,{asChild:!0,...o,children:S.jsx(Ks.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...i,ref:l,onPointerMove:ir(n.onPointerMove,f=>{f.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(r.onTriggerEnter(),u.current=!0)}),onPointerLeave:ir(n.onPointerLeave,()=>{r.onTriggerLeave(),u.current=!1}),onPointerDown:ir(n.onPointerDown,()=>{r.open&&r.onClose(),c.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:ir(n.onFocus,()=>{c.current||r.onOpen()}),onBlur:ir(n.onBlur,r.onClose),onClick:ir(n.onClick,r.onClose)})})});Tte.displayName=rI;var bte="TooltipPortal",[cCe,Cte]=yA(bte,{forceMount:void 0}),im="TooltipContent",VG=V.forwardRef((n,e)=>{const t=Cte(im,n.__scopeTooltip),{forceMount:i=t.forceMount,side:r="top",...s}=n,o=vA(im,n.__scopeTooltip);return S.jsx(HP,{present:i||o.open,children:o.disableHoverableContent?S.jsx(zG,{side:r,...s,ref:e}):S.jsx(Mte,{side:r,...s,ref:e})})}),Mte=V.forwardRef((n,e)=>{const t=vA(im,n.__scopeTooltip),i=OG(im,n.__scopeTooltip),r=V.useRef(null),s=_a(e,r),[o,a]=V.useState(null),{trigger:l,onClose:c}=t,u=r.current,{onPointerInTransitChange:h}=i,f=V.useCallback(()=>{a(null),h(!1)},[h]),m=V.useCallback((y,_)=>{const v=y.currentTarget,g={x:y.clientX,y:y.clientY},w=Dte(g,v.getBoundingClientRect()),A=Lte(g,w),T=kte(_.getBoundingClientRect()),L=Ote([...A,...T]);a(L),h(!0)},[h]);return V.useEffect(()=>()=>f(),[f]),V.useEffect(()=>{if(l&&u){const y=v=>m(v,u),_=v=>m(v,l);return l.addEventListener("pointerleave",y),u.addEventListener("pointerleave",_),()=>{l.removeEventListener("pointerleave",y),u.removeEventListener("pointerleave",_)}}},[l,u,m,f]),V.useEffect(()=>{if(o){const y=_=>{const v=_.target,g={x:_.clientX,y:_.clientY},w=(l==null?void 0:l.contains(v))||(u==null?void 0:u.contains(v)),A=!Bte(g,o);w?f():A&&(f(),c())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[l,u,o,c,f]),S.jsx(zG,{...n,ref:s})}),[Ite,Rte]=yA(UG,{isInside:!1}),Pte=xJ("TooltipContent"),zG=V.forwardRef((n,e)=>{const{__scopeTooltip:t,children:i,"aria-label":r,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=n,l=vA(im,t),c=r2(t),{onClose:u}=l;return V.useEffect(()=>(document.addEventListener(pO,u),()=>document.removeEventListener(pO,u)),[u]),V.useEffect(()=>{if(l.trigger){const h=f=>{const m=f.target;m!=null&&m.contains(l.trigger)&&u()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[l.trigger,u]),S.jsx(zP,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:u,children:S.jsxs(wte,{"data-state":l.stateAttribute,...c,...a,ref:e,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[S.jsx(Pte,{children:i}),S.jsx(Ite,{scope:t,isInside:!0,children:S.jsx(WJ,{id:l.contentId,role:"tooltip",children:r||i})})]})})});VG.displayName=im;var HG="TooltipArrow",Nte=V.forwardRef((n,e)=>{const{__scopeTooltip:t,...i}=n,r=r2(t);return Rte(HG,t).isInside?null:S.jsx(Ete,{...r,...i,ref:e})});Nte.displayName=HG;function Dte(n,e){const t=Math.abs(e.top-n.y),i=Math.abs(e.bottom-n.y),r=Math.abs(e.right-n.x),s=Math.abs(e.left-n.x);switch(Math.min(t,i,r,s)){case s:return"left";case r:return"right";case t:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function Lte(n,e,t=5){const i=[];switch(e){case"top":i.push({x:n.x-t,y:n.y+t},{x:n.x+t,y:n.y+t});break;case"bottom":i.push({x:n.x-t,y:n.y-t},{x:n.x+t,y:n.y-t});break;case"left":i.push({x:n.x+t,y:n.y-t},{x:n.x+t,y:n.y+t});break;case"right":i.push({x:n.x-t,y:n.y-t},{x:n.x-t,y:n.y+t});break}return i}function kte(n){const{top:e,right:t,bottom:i,left:r}=n;return[{x:r,y:e},{x:t,y:e},{x:t,y:i},{x:r,y:i}]}function Bte(n,e){const{x:t,y:i}=n;let r=!1;for(let s=0,o=e.length-1;s<e.length;o=s++){const a=e[s],l=e[o],c=a.x,u=a.y,h=l.x,f=l.y;u>i!=f>i&&t<(h-c)*(i-u)/(f-u)+c&&(r=!r)}return r}function Ote(n){const e=n.slice();return e.sort((t,i)=>t.x<i.x?-1:t.x>i.x?1:t.y<i.y?-1:t.y>i.y?1:0),Fte(e)}function Fte(n){if(n.length<=1)return n.slice();const e=[];for(let i=0;i<n.length;i++){const r=n[i];for(;e.length>=2;){const s=e[e.length-1],o=e[e.length-2];if((s.x-o.x)*(r.y-o.y)>=(s.y-o.y)*(r.x-o.x))e.pop();else break}e.push(r)}e.pop();const t=[];for(let i=n.length-1;i>=0;i--){const r=n[i];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(r.y-o.y)>=(s.y-o.y)*(r.x-o.x))t.pop();else break}t.push(r)}return t.pop(),e.length===1&&t.length===1&&e[0].x===t[0].x&&e[0].y===t[0].y?e:e.concat(t)}var Ute=FG,GG=VG;const Vte=Ute,zte=V.forwardRef(({className:n,sideOffset:e=4,...t},i)=>S.jsx(GG,{ref:i,sideOffset:e,className:Xd("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...t}));zte.displayName=GG.displayName;var _A=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(n){return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},xA=typeof window>"u"||"Deno"in globalThis;function ia(){}function Hte(n,e){return typeof n=="function"?n(e):n}function Gte(n){return typeof n=="number"&&n>=0&&n!==1/0}function jte(n,e){return Math.max(n+(e||0)-Date.now(),0)}function sI(n,e){return typeof n=="function"?n(e):n}function Wte(n,e){return typeof n=="function"?n(e):n}function mO(n,e){const{type:t="all",exact:i,fetchStatus:r,predicate:s,queryKey:o,stale:a}=n;if(o){if(i){if(e.queryHash!==s2(o,e.options))return!1}else if(!g0(e.queryKey,o))return!1}if(t!=="all"){const l=e.isActive();if(t==="active"&&!l||t==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||r&&r!==e.state.fetchStatus||s&&!s(e))}function gO(n,e){const{exact:t,status:i,predicate:r,mutationKey:s}=n;if(s){if(!e.options.mutationKey)return!1;if(t){if(m0(e.options.mutationKey)!==m0(s))return!1}else if(!g0(e.options.mutationKey,s))return!1}return!(i&&e.state.status!==i||r&&!r(e))}function s2(n,e){return((e==null?void 0:e.queryKeyHashFn)||m0)(n)}function m0(n){return JSON.stringify(n,(e,t)=>oI(t)?Object.keys(t).sort().reduce((i,r)=>(i[r]=t[r],i),{}):t)}function g0(n,e){return n===e?!0:typeof n!=typeof e?!1:n&&e&&typeof n=="object"&&typeof e=="object"?Object.keys(e).every(t=>g0(n[t],e[t])):!1}function jG(n,e){if(n===e)return n;const t=yO(n)&&yO(e);if(t||oI(n)&&oI(e)){const i=t?n:Object.keys(n),r=i.length,s=t?e:Object.keys(e),o=s.length,a=t?[]:{},l=new Set(i);let c=0;for(let u=0;u<o;u++){const h=t?u:s[u];(!t&&l.has(h)||t)&&n[h]===void 0&&e[h]===void 0?(a[h]=void 0,c++):(a[h]=jG(n[h],e[h]),a[h]===n[h]&&n[h]!==void 0&&c++)}return r===o&&c===r?n:a}return e}function yO(n){return Array.isArray(n)&&n.length===Object.keys(n).length}function oI(n){if(!vO(n))return!1;const e=n.constructor;if(e===void 0)return!0;const t=e.prototype;return!(!vO(t)||!t.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(n)!==Object.prototype)}function vO(n){return Object.prototype.toString.call(n)==="[object Object]"}function Kte(n){return new Promise(e=>{setTimeout(e,n)})}function Xte(n,e,t){return typeof t.structuralSharing=="function"?t.structuralSharing(n,e):t.structuralSharing!==!1?jG(n,e):e}function qte(n,e,t=0){const i=[...n,e];return t&&i.length>t?i.slice(1):i}function Yte(n,e,t=0){const i=[e,...n];return t&&i.length>t?i.slice(0,-1):i}var o2=Symbol();function WG(n,e){return!n.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!n.queryFn||n.queryFn===o2?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}var sd,Qc,Vp,J5,$te=(J5=class extends _A{constructor(){super();zn(this,sd);zn(this,Qc);zn(this,Vp);ln(this,Vp,e=>{if(!xA&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}})}onSubscribe(){Ve(this,Qc)||this.setEventListener(Ve(this,Vp))}onUnsubscribe(){var e;this.hasListeners()||((e=Ve(this,Qc))==null||e.call(this),ln(this,Qc,void 0))}setEventListener(e){var t;ln(this,Vp,e),(t=Ve(this,Qc))==null||t.call(this),ln(this,Qc,e(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(e){Ve(this,sd)!==e&&(ln(this,sd,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){var e;return typeof Ve(this,sd)=="boolean"?Ve(this,sd):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},sd=new WeakMap,Qc=new WeakMap,Vp=new WeakMap,J5),KG=new $te,zp,Zc,Hp,Q5,Jte=(Q5=class extends _A{constructor(){super();zn(this,zp,!0);zn(this,Zc);zn(this,Hp);ln(this,Hp,e=>{if(!xA&&window.addEventListener){const t=()=>e(!0),i=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",i)}}})}onSubscribe(){Ve(this,Zc)||this.setEventListener(Ve(this,Hp))}onUnsubscribe(){var e;this.hasListeners()||((e=Ve(this,Zc))==null||e.call(this),ln(this,Zc,void 0))}setEventListener(e){var t;ln(this,Hp,e),(t=Ve(this,Zc))==null||t.call(this),ln(this,Zc,e(this.setOnline.bind(this)))}setOnline(e){Ve(this,zp)!==e&&(ln(this,zp,e),this.listeners.forEach(i=>{i(e)}))}isOnline(){return Ve(this,zp)}},zp=new WeakMap,Zc=new WeakMap,Hp=new WeakMap,Q5),S1=new Jte;function Qte(){let n,e;const t=new Promise((r,s)=>{n=r,e=s});t.status="pending",t.catch(()=>{});function i(r){Object.assign(t,r),delete t.resolve,delete t.reject}return t.resolve=r=>{i({status:"fulfilled",value:r}),n(r)},t.reject=r=>{i({status:"rejected",reason:r}),e(r)},t}function Zte(n){return Math.min(1e3*2**n,3e4)}function XG(n){return(n??"online")==="online"?S1.isOnline():!0}var qG=class extends Error{constructor(n){super("CancelledError"),this.revert=n==null?void 0:n.revert,this.silent=n==null?void 0:n.silent}};function fb(n){return n instanceof qG}function YG(n){let e=!1,t=0,i=!1,r;const s=Qte(),o=_=>{var v;i||(f(new qG(_)),(v=n.abort)==null||v.call(n))},a=()=>{e=!0},l=()=>{e=!1},c=()=>KG.isFocused()&&(n.networkMode==="always"||S1.isOnline())&&n.canRun(),u=()=>XG(n.networkMode)&&n.canRun(),h=_=>{var v;i||(i=!0,(v=n.onSuccess)==null||v.call(n,_),r==null||r(),s.resolve(_))},f=_=>{var v;i||(i=!0,(v=n.onError)==null||v.call(n,_),r==null||r(),s.reject(_))},m=()=>new Promise(_=>{var v;r=g=>{(i||c())&&_(g)},(v=n.onPause)==null||v.call(n)}).then(()=>{var _;r=void 0,i||(_=n.onContinue)==null||_.call(n)}),y=()=>{if(i)return;let _;const v=t===0?n.initialPromise:void 0;try{_=v??n.fn()}catch(g){_=Promise.reject(g)}Promise.resolve(_).then(h).catch(g=>{var D;if(i)return;const w=n.retry??(xA?0:3),A=n.retryDelay??Zte,T=typeof A=="function"?A(t,g):A,L=w===!0||typeof w=="number"&&t<w||typeof w=="function"&&w(t,g);if(e||!L){f(g);return}t++,(D=n.onFail)==null||D.call(n,t,g),Kte(T).then(()=>c()?void 0:m()).then(()=>{e?f(g):y()})})};return{promise:s,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?y():m().then(y),s)}}var ene=n=>setTimeout(n,0);function tne(){let n=[],e=0,t=a=>{a()},i=a=>{a()},r=ene;const s=a=>{e?n.push(a):r(()=>{t(a)})},o=()=>{const a=n;n=[],a.length&&r(()=>{i(()=>{a.forEach(l=>{t(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{t=a},setBatchNotifyFunction:a=>{i=a},setScheduler:a=>{r=a}}}var vs=tne(),od,Z5,$G=(Z5=class{constructor(){zn(this,od)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Gte(this.gcTime)&&ln(this,od,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(xA?1/0:5*60*1e3))}clearGcTimeout(){Ve(this,od)&&(clearTimeout(Ve(this,od)),ln(this,od,void 0))}},od=new WeakMap,Z5),Gp,ad,Io,ld,qr,$0,cd,sa,Ml,eV,nne=(eV=class extends $G{constructor(t){super();zn(this,sa);zn(this,Gp);zn(this,ad);zn(this,Io);zn(this,ld);zn(this,qr);zn(this,$0);zn(this,cd);ln(this,cd,!1),ln(this,$0,t.defaultOptions),this.setOptions(t.options),this.observers=[],ln(this,ld,t.client),ln(this,Io,Ve(this,ld).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ln(this,Gp,rne(this.options)),this.state=t.state??Ve(this,Gp),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=Ve(this,qr))==null?void 0:t.promise}setOptions(t){this.options={...Ve(this,$0),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Ve(this,Io).remove(this)}setData(t,i){const r=Xte(this.state.data,t,this.options);return zr(this,sa,Ml).call(this,{data:r,type:"success",dataUpdatedAt:i==null?void 0:i.updatedAt,manual:i==null?void 0:i.manual}),r}setState(t,i){zr(this,sa,Ml).call(this,{type:"setState",state:t,setStateOptions:i})}cancel(t){var r,s;const i=(r=Ve(this,qr))==null?void 0:r.promise;return(s=Ve(this,qr))==null||s.cancel(t),i?i.then(ia).catch(ia):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Ve(this,Gp))}isActive(){return this.observers.some(t=>Wte(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===o2||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>sI(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!jte(this.state.dataUpdatedAt,t)}onFocus(){var i;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(i=Ve(this,qr))==null||i.continue()}onOnline(){var i;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(i=Ve(this,qr))==null||i.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),Ve(this,Io).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(i=>i!==t),this.observers.length||(Ve(this,qr)&&(Ve(this,cd)?Ve(this,qr).cancel({revert:!0}):Ve(this,qr).cancelRetry()),this.scheduleGc()),Ve(this,Io).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||zr(this,sa,Ml).call(this,{type:"invalidate"})}fetch(t,i){var u,h,f;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(i!=null&&i.cancelRefetch))this.cancel({silent:!0});else if(Ve(this,qr))return Ve(this,qr).continueRetry(),Ve(this,qr).promise}if(t&&this.setOptions(t),!this.options.queryFn){const m=this.observers.find(y=>y.options.queryFn);m&&this.setOptions(m.options)}const r=new AbortController,s=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(ln(this,cd,!0),r.signal)})},o=()=>{const m=WG(this.options,i),_=(()=>{const v={client:Ve(this,ld),queryKey:this.queryKey,meta:this.meta};return s(v),v})();return ln(this,cd,!1),this.options.persister?this.options.persister(m,_,this):m(_)},l=(()=>{const m={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:Ve(this,ld),state:this.state,fetchFn:o};return s(m),m})();(u=this.options.behavior)==null||u.onFetch(l,this),ln(this,ad,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=l.fetchOptions)==null?void 0:h.meta))&&zr(this,sa,Ml).call(this,{type:"fetch",meta:(f=l.fetchOptions)==null?void 0:f.meta});const c=m=>{var y,_,v,g;fb(m)&&m.silent||zr(this,sa,Ml).call(this,{type:"error",error:m}),fb(m)||((_=(y=Ve(this,Io).config).onError)==null||_.call(y,m,this),(g=(v=Ve(this,Io).config).onSettled)==null||g.call(v,this.state.data,m,this)),this.scheduleGc()};return ln(this,qr,YG({initialPromise:i==null?void 0:i.initialPromise,fn:l.fetchFn,abort:r.abort.bind(r),onSuccess:m=>{var y,_,v,g;if(m===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(m)}catch(w){c(w);return}(_=(y=Ve(this,Io).config).onSuccess)==null||_.call(y,m,this),(g=(v=Ve(this,Io).config).onSettled)==null||g.call(v,m,this.state.error,this),this.scheduleGc()},onError:c,onFail:(m,y)=>{zr(this,sa,Ml).call(this,{type:"failed",failureCount:m,error:y})},onPause:()=>{zr(this,sa,Ml).call(this,{type:"pause"})},onContinue:()=>{zr(this,sa,Ml).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0})),Ve(this,qr).start()}},Gp=new WeakMap,ad=new WeakMap,Io=new WeakMap,ld=new WeakMap,qr=new WeakMap,$0=new WeakMap,cd=new WeakMap,sa=new WeakSet,Ml=function(t){const i=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...ine(r.data,this.options),fetchMeta:t.meta??null};case"success":return ln(this,ad,void 0),{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=t.error;return fb(s)&&s.revert&&Ve(this,ad)?{...Ve(this,ad),fetchStatus:"idle"}:{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=i(this.state),vs.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),Ve(this,Io).notify({query:this,type:"updated",action:t})})},eV);function ine(n,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:XG(e.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function rne(n){const e=typeof n.initialData=="function"?n.initialData():n.initialData,t=e!==void 0,i=t?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:t?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}var Ba,tV,sne=(tV=class extends _A{constructor(e={}){super();zn(this,Ba);this.config=e,ln(this,Ba,new Map)}build(e,t,i){const r=t.queryKey,s=t.queryHash??s2(r,t);let o=this.get(s);return o||(o=new nne({client:e,queryKey:r,queryHash:s,options:e.defaultQueryOptions(t),state:i,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){Ve(this,Ba).has(e.queryHash)||(Ve(this,Ba).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=Ve(this,Ba).get(e.queryHash);t&&(e.destroy(),t===e&&Ve(this,Ba).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){vs.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return Ve(this,Ba).get(e)}getAll(){return[...Ve(this,Ba).values()]}find(e){const t={exact:!0,...e};return this.getAll().find(i=>mO(t,i))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(i=>mO(e,i)):t}notify(e){vs.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){vs.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){vs.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ba=new WeakMap,tV),Oa,ps,ud,Fa,Uc,nV,one=(nV=class extends $G{constructor(t){super();zn(this,Fa);zn(this,Oa);zn(this,ps);zn(this,ud);this.mutationId=t.mutationId,ln(this,ps,t.mutationCache),ln(this,Oa,[]),this.state=t.state||ane(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){Ve(this,Oa).includes(t)||(Ve(this,Oa).push(t),this.clearGcTimeout(),Ve(this,ps).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ln(this,Oa,Ve(this,Oa).filter(i=>i!==t)),this.scheduleGc(),Ve(this,ps).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){Ve(this,Oa).length||(this.state.status==="pending"?this.scheduleGc():Ve(this,ps).remove(this))}continue(){var t;return((t=Ve(this,ud))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,l,c,u,h,f,m,y,_,v,g,w,A,T,L,D,R,I,M;const i=()=>{zr(this,Fa,Uc).call(this,{type:"continue"})};ln(this,ud,YG({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(C,k)=>{zr(this,Fa,Uc).call(this,{type:"failed",failureCount:C,error:k})},onPause:()=>{zr(this,Fa,Uc).call(this,{type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Ve(this,ps).canRun(this)}));const r=this.state.status==="pending",s=!Ve(this,ud).canStart();try{if(r)i();else{zr(this,Fa,Uc).call(this,{type:"pending",variables:t,isPaused:s}),await((a=(o=Ve(this,ps).config).onMutate)==null?void 0:a.call(o,t,this));const k=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,t));k!==this.state.context&&zr(this,Fa,Uc).call(this,{type:"pending",context:k,variables:t,isPaused:s})}const C=await Ve(this,ud).start();return await((h=(u=Ve(this,ps).config).onSuccess)==null?void 0:h.call(u,C,t,this.state.context,this)),await((m=(f=this.options).onSuccess)==null?void 0:m.call(f,C,t,this.state.context)),await((_=(y=Ve(this,ps).config).onSettled)==null?void 0:_.call(y,C,null,this.state.variables,this.state.context,this)),await((g=(v=this.options).onSettled)==null?void 0:g.call(v,C,null,t,this.state.context)),zr(this,Fa,Uc).call(this,{type:"success",data:C}),C}catch(C){try{throw await((A=(w=Ve(this,ps).config).onError)==null?void 0:A.call(w,C,t,this.state.context,this)),await((L=(T=this.options).onError)==null?void 0:L.call(T,C,t,this.state.context)),await((R=(D=Ve(this,ps).config).onSettled)==null?void 0:R.call(D,void 0,C,this.state.variables,this.state.context,this)),await((M=(I=this.options).onSettled)==null?void 0:M.call(I,void 0,C,t,this.state.context)),C}finally{zr(this,Fa,Uc).call(this,{type:"error",error:C})}}finally{Ve(this,ps).runNext(this)}}},Oa=new WeakMap,ps=new WeakMap,ud=new WeakMap,Fa=new WeakSet,Uc=function(t){const i=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=i(this.state),vs.batch(()=>{Ve(this,Oa).forEach(r=>{r.onMutationUpdate(t)}),Ve(this,ps).notify({mutation:this,type:"updated",action:t})})},nV);function ane(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var kl,oa,J0,iV,lne=(iV=class extends _A{constructor(e={}){super();zn(this,kl);zn(this,oa);zn(this,J0);this.config=e,ln(this,kl,new Set),ln(this,oa,new Map),ln(this,J0,0)}build(e,t,i){const r=new one({mutationCache:this,mutationId:++L_(this,J0)._,options:e.defaultMutationOptions(t),state:i});return this.add(r),r}add(e){Ve(this,kl).add(e);const t=nx(e);if(typeof t=="string"){const i=Ve(this,oa).get(t);i?i.push(e):Ve(this,oa).set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(Ve(this,kl).delete(e)){const t=nx(e);if(typeof t=="string"){const i=Ve(this,oa).get(t);if(i)if(i.length>1){const r=i.indexOf(e);r!==-1&&i.splice(r,1)}else i[0]===e&&Ve(this,oa).delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=nx(e);if(typeof t=="string"){const i=Ve(this,oa).get(t),r=i==null?void 0:i.find(s=>s.state.status==="pending");return!r||r===e}else return!0}runNext(e){var i;const t=nx(e);if(typeof t=="string"){const r=(i=Ve(this,oa).get(t))==null?void 0:i.find(s=>s!==e&&s.state.isPaused);return(r==null?void 0:r.continue())??Promise.resolve()}else return Promise.resolve()}clear(){vs.batch(()=>{Ve(this,kl).forEach(e=>{this.notify({type:"removed",mutation:e})}),Ve(this,kl).clear(),Ve(this,oa).clear()})}getAll(){return Array.from(Ve(this,kl))}find(e){const t={exact:!0,...e};return this.getAll().find(i=>gO(t,i))}findAll(e={}){return this.getAll().filter(t=>gO(e,t))}notify(e){vs.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return vs.batch(()=>Promise.all(e.map(t=>t.continue().catch(ia))))}},kl=new WeakMap,oa=new WeakMap,J0=new WeakMap,iV);function nx(n){var e;return(e=n.options.scope)==null?void 0:e.id}function _O(n){return{onFetch:(e,t)=>{var u,h,f,m,y;const i=e.options,r=(f=(h=(u=e.fetchOptions)==null?void 0:u.meta)==null?void 0:h.fetchMore)==null?void 0:f.direction,s=((m=e.state.data)==null?void 0:m.pages)||[],o=((y=e.state.data)==null?void 0:y.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let _=!1;const v=A=>{Object.defineProperty(A,"signal",{enumerable:!0,get:()=>(e.signal.aborted?_=!0:e.signal.addEventListener("abort",()=>{_=!0}),e.signal)})},g=WG(e.options,e.fetchOptions),w=async(A,T,L)=>{if(_)return Promise.reject();if(T==null&&A.pages.length)return Promise.resolve(A);const R=(()=>{const k={client:e.client,queryKey:e.queryKey,pageParam:T,direction:L?"backward":"forward",meta:e.options.meta};return v(k),k})(),I=await g(R),{maxPages:M}=e.options,C=L?Yte:qte;return{pages:C(A.pages,I,M),pageParams:C(A.pageParams,T,M)}};if(r&&s.length){const A=r==="backward",T=A?cne:xO,L={pages:s,pageParams:o},D=T(i,L);a=await w(L,D,A)}else{const A=n??s.length;do{const T=l===0?o[0]??i.initialPageParam:xO(i,a);if(l>0&&T==null)break;a=await w(a,T),l++}while(l<A)}return a};e.options.persister?e.fetchFn=()=>{var _,v;return(v=(_=e.options).persister)==null?void 0:v.call(_,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},t)}:e.fetchFn=c}}}function xO(n,{pages:e,pageParams:t}){const i=e.length-1;return e.length>0?n.getNextPageParam(e[i],e,t[i],t):void 0}function cne(n,{pages:e,pageParams:t}){var i;return e.length>0?(i=n.getPreviousPageParam)==null?void 0:i.call(n,e[0],e,t[0],t):void 0}var Ii,eu,tu,jp,Wp,nu,Kp,Xp,rV,une=(rV=class{constructor(n={}){zn(this,Ii);zn(this,eu);zn(this,tu);zn(this,jp);zn(this,Wp);zn(this,nu);zn(this,Kp);zn(this,Xp);ln(this,Ii,n.queryCache||new sne),ln(this,eu,n.mutationCache||new lne),ln(this,tu,n.defaultOptions||{}),ln(this,jp,new Map),ln(this,Wp,new Map),ln(this,nu,0)}mount(){L_(this,nu)._++,Ve(this,nu)===1&&(ln(this,Kp,KG.subscribe(async n=>{n&&(await this.resumePausedMutations(),Ve(this,Ii).onFocus())})),ln(this,Xp,S1.subscribe(async n=>{n&&(await this.resumePausedMutations(),Ve(this,Ii).onOnline())})))}unmount(){var n,e;L_(this,nu)._--,Ve(this,nu)===0&&((n=Ve(this,Kp))==null||n.call(this),ln(this,Kp,void 0),(e=Ve(this,Xp))==null||e.call(this),ln(this,Xp,void 0))}isFetching(n){return Ve(this,Ii).findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return Ve(this,eu).findAll({...n,status:"pending"}).length}getQueryData(n){var t;const e=this.defaultQueryOptions({queryKey:n});return(t=Ve(this,Ii).get(e.queryHash))==null?void 0:t.state.data}ensureQueryData(n){const e=this.defaultQueryOptions(n),t=Ve(this,Ii).build(this,e),i=t.state.data;return i===void 0?this.fetchQuery(n):(n.revalidateIfStale&&t.isStaleByTime(sI(e.staleTime,t))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(n){return Ve(this,Ii).findAll(n).map(({queryKey:e,state:t})=>{const i=t.data;return[e,i]})}setQueryData(n,e,t){const i=this.defaultQueryOptions({queryKey:n}),r=Ve(this,Ii).get(i.queryHash),s=r==null?void 0:r.state.data,o=Hte(e,s);if(o!==void 0)return Ve(this,Ii).build(this,i).setData(o,{...t,manual:!0})}setQueriesData(n,e,t){return vs.batch(()=>Ve(this,Ii).findAll(n).map(({queryKey:i})=>[i,this.setQueryData(i,e,t)]))}getQueryState(n){var t;const e=this.defaultQueryOptions({queryKey:n});return(t=Ve(this,Ii).get(e.queryHash))==null?void 0:t.state}removeQueries(n){const e=Ve(this,Ii);vs.batch(()=>{e.findAll(n).forEach(t=>{e.remove(t)})})}resetQueries(n,e){const t=Ve(this,Ii);return vs.batch(()=>(t.findAll(n).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...n},e)))}cancelQueries(n,e={}){const t={revert:!0,...e},i=vs.batch(()=>Ve(this,Ii).findAll(n).map(r=>r.cancel(t)));return Promise.all(i).then(ia).catch(ia)}invalidateQueries(n,e={}){return vs.batch(()=>(Ve(this,Ii).findAll(n).forEach(t=>{t.invalidate()}),(n==null?void 0:n.refetchType)==="none"?Promise.resolve():this.refetchQueries({...n,type:(n==null?void 0:n.refetchType)??(n==null?void 0:n.type)??"active"},e)))}refetchQueries(n,e={}){const t={...e,cancelRefetch:e.cancelRefetch??!0},i=vs.batch(()=>Ve(this,Ii).findAll(n).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let s=r.fetch(void 0,t);return t.throwOnError||(s=s.catch(ia)),r.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(i).then(ia)}fetchQuery(n){const e=this.defaultQueryOptions(n);e.retry===void 0&&(e.retry=!1);const t=Ve(this,Ii).build(this,e);return t.isStaleByTime(sI(e.staleTime,t))?t.fetch(e):Promise.resolve(t.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(ia).catch(ia)}fetchInfiniteQuery(n){return n.behavior=_O(n.pages),this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(ia).catch(ia)}ensureInfiniteQueryData(n){return n.behavior=_O(n.pages),this.ensureQueryData(n)}resumePausedMutations(){return S1.isOnline()?Ve(this,eu).resumePausedMutations():Promise.resolve()}getQueryCache(){return Ve(this,Ii)}getMutationCache(){return Ve(this,eu)}getDefaultOptions(){return Ve(this,tu)}setDefaultOptions(n){ln(this,tu,n)}setQueryDefaults(n,e){Ve(this,jp).set(m0(n),{queryKey:n,defaultOptions:e})}getQueryDefaults(n){const e=[...Ve(this,jp).values()],t={};return e.forEach(i=>{g0(n,i.queryKey)&&Object.assign(t,i.defaultOptions)}),t}setMutationDefaults(n,e){Ve(this,Wp).set(m0(n),{mutationKey:n,defaultOptions:e})}getMutationDefaults(n){const e=[...Ve(this,Wp).values()],t={};return e.forEach(i=>{g0(n,i.mutationKey)&&Object.assign(t,i.defaultOptions)}),t}defaultQueryOptions(n){if(n._defaulted)return n;const e={...Ve(this,tu).queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return e.queryHash||(e.queryHash=s2(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===o2&&(e.enabled=!1),e}defaultMutationOptions(n){return n!=null&&n._defaulted?n:{...Ve(this,tu).mutations,...(n==null?void 0:n.mutationKey)&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){Ve(this,Ii).clear(),Ve(this,eu).clear()}},Ii=new WeakMap,eu=new WeakMap,tu=new WeakMap,jp=new WeakMap,Wp=new WeakMap,nu=new WeakMap,Kp=new WeakMap,Xp=new WeakMap,rV),hne=V.createContext(void 0),dne=({client:n,children:e})=>(V.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),S.jsx(hne.Provider,{value:n,children:e}));/**
 * @remix-run/router v1.23.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function T1(){return T1=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},T1.apply(this,arguments)}var ou;(function(n){n.Pop="POP",n.Push="PUSH",n.Replace="REPLACE"})(ou||(ou={}));const wO="popstate";function fne(n){n===void 0&&(n={});function e(i,r){let{pathname:s,search:o,hash:a}=i.location;return aI("",{pathname:s,search:o,hash:a},r.state&&r.state.usr||null,r.state&&r.state.key||"default")}function t(i,r){return typeof r=="string"?r:QG(r)}return mne(e,t,null,n)}function js(n,e){if(n===!1||n===null||typeof n>"u")throw new Error(e)}function JG(n,e){if(!n){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function pne(){return Math.random().toString(36).substr(2,8)}function EO(n,e){return{usr:n.state,key:n.key,idx:e}}function aI(n,e,t,i){return t===void 0&&(t=null),T1({pathname:typeof n=="string"?n:n.pathname,search:"",hash:""},typeof e=="string"?wA(e):e,{state:t,key:e&&e.key||i||pne()})}function QG(n){let{pathname:e="/",search:t="",hash:i=""}=n;return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),i&&i!=="#"&&(e+=i.charAt(0)==="#"?i:"#"+i),e}function wA(n){let e={};if(n){let t=n.indexOf("#");t>=0&&(e.hash=n.substr(t),n=n.substr(0,t));let i=n.indexOf("?");i>=0&&(e.search=n.substr(i),n=n.substr(0,i)),n&&(e.pathname=n)}return e}function mne(n,e,t,i){i===void 0&&(i={});let{window:r=document.defaultView,v5Compat:s=!1}=i,o=r.history,a=ou.Pop,l=null,c=u();c==null&&(c=0,o.replaceState(T1({},o.state,{idx:c}),""));function u(){return(o.state||{idx:null}).idx}function h(){a=ou.Pop;let v=u(),g=v==null?null:v-c;c=v,l&&l({action:a,location:_.location,delta:g})}function f(v,g){a=ou.Push;let w=aI(_.location,v,g);c=u()+1;let A=EO(w,c),T=_.createHref(w);try{o.pushState(A,"",T)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;r.location.assign(T)}s&&l&&l({action:a,location:_.location,delta:1})}function m(v,g){a=ou.Replace;let w=aI(_.location,v,g);c=u();let A=EO(w,c),T=_.createHref(w);o.replaceState(A,"",T),s&&l&&l({action:a,location:_.location,delta:0})}function y(v){let g=r.location.origin!=="null"?r.location.origin:r.location.href,w=typeof v=="string"?v:QG(v);return w=w.replace(/ $/,"%20"),js(g,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,g)}let _={get action(){return a},get location(){return n(r,o)},listen(v){if(l)throw new Error("A history only accepts one active listener");return r.addEventListener(wO,h),l=v,()=>{r.removeEventListener(wO,h),l=null}},createHref(v){return e(r,v)},createURL:y,encodeLocation(v){let g=y(v);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:f,replace:m,go(v){return o.go(v)}};return _}var AO;(function(n){n.data="data",n.deferred="deferred",n.redirect="redirect",n.error="error"})(AO||(AO={}));function gne(n,e,t){return t===void 0&&(t="/"),yne(n,e,t,!1)}function yne(n,e,t,i){let r=typeof e=="string"?wA(e):e,s=t9(r.pathname||"/",t);if(s==null)return null;let o=ZG(n);vne(o);let a=null;for(let l=0;a==null&&l<o.length;++l){let c=Ine(s);a=Cne(o[l],c,i)}return a}function ZG(n,e,t,i){e===void 0&&(e=[]),t===void 0&&(t=[]),i===void 0&&(i="");let r=(s,o,a)=>{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};l.relativePath.startsWith("/")&&(js(l.relativePath.startsWith(i),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+i+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(i.length));let c=Ip([i,l.relativePath]),u=t.concat(l);s.children&&s.children.length>0&&(js(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),ZG(s.children,e,u,c)),!(s.path==null&&!s.index)&&e.push({path:c,score:Tne(c,s.index),routesMeta:u})};return n.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))r(s,o);else for(let l of e9(s.path))r(s,o,l)}),e}function e9(n){let e=n.split("/");if(e.length===0)return[];let[t,...i]=e,r=t.endsWith("?"),s=t.replace(/\?$/,"");if(i.length===0)return r?[s,""]:[s];let o=e9(i.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),r&&a.push(...o),a.map(l=>n.startsWith("/")&&l===""?"/":l)}function vne(n){n.sort((e,t)=>e.score!==t.score?t.score-e.score:bne(e.routesMeta.map(i=>i.childrenIndex),t.routesMeta.map(i=>i.childrenIndex)))}const _ne=/^:[\w-]+$/,xne=3,wne=2,Ene=1,Ane=10,Sne=-2,SO=n=>n==="*";function Tne(n,e){let t=n.split("/"),i=t.length;return t.some(SO)&&(i+=Sne),e&&(i+=wne),t.filter(r=>!SO(r)).reduce((r,s)=>r+(_ne.test(s)?xne:s===""?Ene:Ane),i)}function bne(n,e){return n.length===e.length&&n.slice(0,-1).every((i,r)=>i===e[r])?n[n.length-1]-e[e.length-1]:0}function Cne(n,e,t){let{routesMeta:i}=n,r={},s="/",o=[];for(let a=0;a<i.length;++a){let l=i[a],c=a===i.length-1,u=s==="/"?e:e.slice(s.length)||"/",h=TO({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},u),f=l.route;if(!h&&c&&t&&!i[i.length-1].route.index&&(h=TO({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},u)),!h)return null;Object.assign(r,h.params),o.push({params:r,pathname:Ip([s,h.pathname]),pathnameBase:Rne(Ip([s,h.pathnameBase])),route:f}),h.pathnameBase!=="/"&&(s=Ip([s,h.pathnameBase]))}return o}function TO(n,e){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[t,i]=Mne(n.path,n.caseSensitive,n.end),r=e.match(t);if(!r)return null;let s=r[0],o=s.replace(/(.)\/+$/,"$1"),a=r.slice(1);return{params:i.reduce((c,u,h)=>{let{paramName:f,isOptional:m}=u;if(f==="*"){let _=a[h]||"";o=s.slice(0,s.length-_.length).replace(/(.)\/+$/,"$1")}const y=a[h];return m&&!y?c[f]=void 0:c[f]=(y||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:n}}function Mne(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!0),JG(n==="*"||!n.endsWith("*")||n.endsWith("/*"),'Route path "'+n+'" will be treated as if it were '+('"'+n.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+n.replace(/\*$/,"/*")+'".'));let i=[],r="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(i.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return n.endsWith("*")?(i.push({paramName:"*"}),r+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):t?r+="\\/*$":n!==""&&n!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,e?void 0:"i"),i]}function Ine(n){try{return n.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return JG(!1,'The URL path "'+n+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),n}}function t9(n,e){if(e==="/")return n;if(!n.toLowerCase().startsWith(e.toLowerCase()))return null;let t=e.endsWith("/")?e.length-1:e.length,i=n.charAt(t);return i&&i!=="/"?null:n.slice(t)||"/"}const Ip=n=>n.join("/").replace(/\/\/+/g,"/"),Rne=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/");function Pne(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}const n9=["post","put","patch","delete"];new Set(n9);const Nne=["get",...n9];new Set(Nne);/**
 * React Router v6.30.1
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function b1(){return b1=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},b1.apply(this,arguments)}const Dne=V.createContext(null),Lne=V.createContext(null),i9=V.createContext(null),EA=V.createContext(null),AA=V.createContext({outlet:null,matches:[],isDataRoute:!1}),r9=V.createContext(null);function a2(){return V.useContext(EA)!=null}function s9(){return a2()||js(!1),V.useContext(EA).location}function kne(n,e){return Bne(n,e)}function Bne(n,e,t,i){a2()||js(!1);let{navigator:r}=V.useContext(i9),{matches:s}=V.useContext(AA),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let c=s9(),u;if(e){var h;let v=typeof e=="string"?wA(e):e;l==="/"||(h=v.pathname)!=null&&h.startsWith(l)||js(!1),u=v}else u=c;let f=u.pathname||"/",m=f;if(l!=="/"){let v=l.replace(/^\//,"").split("/");m="/"+f.replace(/^\//,"").split("/").slice(v.length).join("/")}let y=gne(n,{pathname:m}),_=zne(y&&y.map(v=>Object.assign({},v,{params:Object.assign({},a,v.params),pathname:Ip([l,r.encodeLocation?r.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?l:Ip([l,r.encodeLocation?r.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),s,t,i);return e&&_?V.createElement(EA.Provider,{value:{location:b1({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:ou.Pop}},_):_}function One(){let n=Wne(),e=Pne(n)?n.status+" "+n.statusText:n instanceof Error?n.message:JSON.stringify(n),t=n instanceof Error?n.stack:null,r={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return V.createElement(V.Fragment,null,V.createElement("h2",null,"Unexpected Application Error!"),V.createElement("h3",{style:{fontStyle:"italic"}},e),t?V.createElement("pre",{style:r},t):null,null)}const Fne=V.createElement(One,null);class Une extends V.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error!==void 0?V.createElement(AA.Provider,{value:this.props.routeContext},V.createElement(r9.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Vne(n){let{routeContext:e,match:t,children:i}=n,r=V.useContext(Dne);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),V.createElement(AA.Provider,{value:e},i)}function zne(n,e,t,i){var r;if(e===void 0&&(e=[]),t===void 0&&(t=null),i===void 0&&(i=null),n==null){var s;if(!t)return null;if(t.errors)n=t.matches;else if((s=i)!=null&&s.v7_partialHydration&&e.length===0&&!t.initialized&&t.matches.length>0)n=t.matches;else return null}let o=n,a=(r=t)==null?void 0:r.errors;if(a!=null){let u=o.findIndex(h=>h.route.id&&(a==null?void 0:a[h.route.id])!==void 0);u>=0||js(!1),o=o.slice(0,Math.min(o.length,u+1))}let l=!1,c=-1;if(t&&i&&i.v7_partialHydration)for(let u=0;u<o.length;u++){let h=o[u];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(c=u),h.route.id){let{loaderData:f,errors:m}=t,y=h.route.loader&&f[h.route.id]===void 0&&(!m||m[h.route.id]===void 0);if(h.route.lazy||y){l=!0,c>=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((u,h,f)=>{let m,y=!1,_=null,v=null;t&&(m=a&&h.route.id?a[h.route.id]:void 0,_=h.route.errorElement||Fne,l&&(c<0&&f===0?(y=!0,v=null):c===f&&(y=!0,v=h.route.hydrateFallbackElement||null)));let g=e.concat(o.slice(0,f+1)),w=()=>{let A;return m?A=_:y?A=v:h.route.Component?A=V.createElement(h.route.Component,null):h.route.element?A=h.route.element:A=u,V.createElement(Vne,{match:h,routeContext:{outlet:u,matches:g,isDataRoute:t!=null},children:A})};return t&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?V.createElement(Une,{location:t.location,revalidation:t.revalidation,component:_,error:m,children:w(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):w()},null)}var lI=function(n){return n.UseBlocker="useBlocker",n.UseLoaderData="useLoaderData",n.UseActionData="useActionData",n.UseRouteError="useRouteError",n.UseNavigation="useNavigation",n.UseRouteLoaderData="useRouteLoaderData",n.UseMatches="useMatches",n.UseRevalidator="useRevalidator",n.UseNavigateStable="useNavigate",n.UseRouteId="useRouteId",n}(lI||{});function Hne(n){let e=V.useContext(Lne);return e||js(!1),e}function Gne(n){let e=V.useContext(AA);return e||js(!1),e}function jne(n){let e=Gne(),t=e.matches[e.matches.length-1];return t.route.id||js(!1),t.route.id}function Wne(){var n;let e=V.useContext(r9),t=Hne(lI.UseRouteError),i=jne(lI.UseRouteError);return e!==void 0?e:(n=t.errors)==null?void 0:n[i]}function Kne(n,e){n==null||n.v7_startTransition,n==null||n.v7_relativeSplatPath}function cI(n){js(!1)}function Xne(n){let{basename:e="/",children:t=null,location:i,navigationType:r=ou.Pop,navigator:s,static:o=!1,future:a}=n;a2()&&js(!1);let l=e.replace(/^\/*/,"/"),c=V.useMemo(()=>({basename:l,navigator:s,static:o,future:b1({v7_relativeSplatPath:!1},a)}),[l,a,s,o]);typeof i=="string"&&(i=wA(i));let{pathname:u="/",search:h="",hash:f="",state:m=null,key:y="default"}=i,_=V.useMemo(()=>{let v=t9(u,l);return v==null?null:{location:{pathname:v,search:h,hash:f,state:m,key:y},navigationType:r}},[l,u,h,f,m,y,r]);return _==null?null:V.createElement(i9.Provider,{value:c},V.createElement(EA.Provider,{children:t,value:_}))}function qne(n){let{children:e,location:t}=n;return kne(uI(e),t)}new Promise(()=>{});function uI(n,e){e===void 0&&(e=[]);let t=[];return V.Children.forEach(n,(i,r)=>{if(!V.isValidElement(i))return;let s=[...e,r];if(i.type===V.Fragment){t.push.apply(t,uI(i.props.children,s));return}i.type!==cI&&js(!1),!i.props.index||!i.props.children||js(!1);let o={id:i.props.id||s.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,loader:i.props.loader,action:i.props.action,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(o.children=uI(i.props.children,s)),t.push(o)}),t}/**
 * React Router DOM v6.30.1
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */const Yne="6";try{window.__reactRouterVersion=Yne}catch{}const $ne="startTransition",bO=mV[$ne];function Jne(n){let{basename:e,children:t,future:i,window:r}=n,s=V.useRef();s.current==null&&(s.current=fne({window:r,v5Compat:!0}));let o=s.current,[a,l]=V.useState({action:o.action,location:o.location}),{v7_startTransition:c}=i||{},u=V.useCallback(h=>{c&&bO?bO(()=>l(h)):l(h)},[l,c]);return V.useLayoutEffect(()=>o.listen(u),[o,u]),V.useEffect(()=>Kne(i),[i]),V.createElement(Xne,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:o,future:i})}var CO;(function(n){n.UseScrollRestoration="useScrollRestoration",n.UseSubmit="useSubmit",n.UseSubmitFetcher="useSubmitFetcher",n.UseFetcher="useFetcher",n.useViewTransitionState="useViewTransitionState"})(CO||(CO={}));var MO;(function(n){n.UseFetcher="useFetcher",n.UseFetchers="useFetchers",n.UseScrollRestoration="useScrollRestoration"})(MO||(MO={}));const l2=V.createContext({});function c2(n){const e=V.useRef(null);return e.current===null&&(e.current=n()),e.current}const Qne=typeof window<"u",o9=Qne?V.useLayoutEffect:V.useEffect,SA=V.createContext(null);function u2(n,e){n.indexOf(e)===-1&&n.push(e)}function C1(n,e){const t=n.indexOf(e);t>-1&&n.splice(t,1)}const rl=(n,e,t)=>t>e?e:t<n?n:t;let TA=()=>{},rm=()=>{};const Pu={},a9=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n);function l9(n){return typeof n=="object"&&n!==null}const c9=n=>/^0[^.\s]+$/u.test(n);function u9(n){let e;return()=>(e===void 0&&(e=n()),e)}const Uo=n=>n,Zne=(n,e)=>t=>e(n(t)),av=(...n)=>n.reduce(Zne),y0=(n,e,t)=>{const i=e-n;return i===0?1:(t-n)/i};class h2{constructor(){this.subscriptions=[]}add(e){return u2(this.subscriptions,e),()=>C1(this.subscriptions,e)}notify(e,t,i){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,i);else for(let s=0;s<r;s++){const o=this.subscriptions[s];o&&o(e,t,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Hs=n=>n*1e3,ko=n=>n/1e3;function h9(n,e){return e?n*(1e3/e):0}const d9=(n,e,t)=>(((1-3*t+3*e)*n+(3*t-6*e))*n+3*e)*n,eie=1e-7,tie=12;function nie(n,e,t,i,r){let s,o,a=0;do o=e+(t-e)/2,s=d9(o,i,r)-n,s>0?t=o:e=o;while(Math.abs(s)>eie&&++a<tie);return o}function lv(n,e,t,i){if(n===e&&t===i)return Uo;const r=s=>nie(s,0,1,n,t);return s=>s===0||s===1?s:d9(r(s),e,i)}const f9=n=>e=>e<=.5?n(2*e)/2:(2-n(2*(1-e)))/2,p9=n=>e=>1-n(1-e),m9=lv(.33,1.53,.69,.99),d2=p9(m9),g9=f9(d2),y9=n=>n>=1?1:(n*=2)<1?.5*d2(n):.5*(2-Math.pow(2,-10*(n-1))),f2=n=>1-Math.sin(Math.acos(n)),v9=p9(f2),_9=f9(f2),iie=lv(.42,0,1,1),rie=lv(0,0,.58,1),x9=lv(.42,0,.58,1),sie=n=>Array.isArray(n)&&typeof n[0]!="number",w9=n=>Array.isArray(n)&&typeof n[0]=="number",IO={linear:Uo,easeIn:iie,easeInOut:x9,easeOut:rie,circIn:f2,circInOut:_9,circOut:v9,backIn:d2,backInOut:g9,backOut:m9,anticipate:y9},oie=n=>typeof n=="string",RO=n=>{if(w9(n)){rm(n.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,t,i,r]=n;return lv(e,t,i,r)}else if(oie(n))return rm(IO[n]!==void 0,`Invalid easing type '${n}'`,"invalid-easing-type"),IO[n];return n},ix=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],PO={value:null,addProjectionMetrics:null};function aie(n,e){let t=new Set,i=new Set,r=!1,s=!1;const o=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1},l=0;function c(h){o.has(h)&&(u.schedule(h),n()),l++,h(a)}const u={schedule:(h,f=!1,m=!1)=>{const _=m&&r?t:i;return f&&o.add(h),_.add(h),h},cancel:h=>{i.delete(h),o.delete(h)},process:h=>{if(a=h,r){s=!0;return}r=!0;const f=t;t=i,i=f,t.forEach(c),e&&PO.value&&PO.value.frameloop[e].push(l),l=0,t.clear(),r=!1,s&&(s=!1,u.process(h))}};return u}const lie=40;function E9(n,e){let t=!1,i=!0;const r={delta:0,timestamp:0,isProcessing:!1},s=()=>t=!0,o=ix.reduce((A,T)=>(A[T]=aie(s,e?T:void 0),A),{}),{setup:a,read:l,resolveKeyframes:c,preUpdate:u,update:h,preRender:f,render:m,postRender:y}=o,_=()=>{const A=Pu.useManualTiming,T=A?r.timestamp:performance.now();t=!1,A||(r.delta=i?1e3/60:Math.max(Math.min(T-r.timestamp,lie),1)),r.timestamp=T,r.isProcessing=!0,a.process(r),l.process(r),c.process(r),u.process(r),h.process(r),f.process(r),m.process(r),y.process(r),r.isProcessing=!1,t&&e&&(i=!1,n(_))},v=()=>{t=!0,i=!0,r.isProcessing||n(_)};return{schedule:ix.reduce((A,T)=>{const L=o[T];return A[T]=(D,R=!1,I=!1)=>(t||v(),L.schedule(D,R,I)),A},{}),cancel:A=>{for(let T=0;T<ix.length;T++)o[ix[T]].cancel(A)},state:r,steps:o}}const{schedule:si,cancel:Nu,state:Sr,steps:pb}=E9(typeof requestAnimationFrame<"u"?requestAnimationFrame:Uo,!0);let Mw;function cie(){Mw=void 0}const xs={now:()=>(Mw===void 0&&xs.set(Sr.isProcessing||Pu.useManualTiming?Sr.timestamp:performance.now()),Mw),set:n=>{Mw=n,queueMicrotask(cie)}},A9=n=>e=>typeof e=="string"&&e.startsWith(n),S9=A9("--"),uie=A9("var(--"),p2=n=>uie(n)?hie.test(n.split("/*")[0].trim()):!1,hie=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function NO(n){return typeof n!="string"?!1:n.split("/*")[0].includes("var(--")}const Dm={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},v0={...Dm,transform:n=>rl(0,1,n)},rx={...Dm,default:1},by=n=>Math.round(n*1e5)/1e5,m2=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function die(n){return n==null}const fie=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,g2=(n,e)=>t=>!!(typeof t=="string"&&fie.test(t)&&t.startsWith(n)||e&&!die(t)&&Object.prototype.hasOwnProperty.call(t,e)),T9=(n,e,t)=>i=>{if(typeof i!="string")return i;const[r,s,o,a]=i.match(m2);return{[n]:parseFloat(r),[e]:parseFloat(s),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},pie=n=>rl(0,255,n),mb={...Dm,transform:n=>Math.round(pie(n))},Xh={test:g2("rgb","red"),parse:T9("red","green","blue"),transform:({red:n,green:e,blue:t,alpha:i=1})=>"rgba("+mb.transform(n)+", "+mb.transform(e)+", "+mb.transform(t)+", "+by(v0.transform(i))+")"};function mie(n){let e="",t="",i="",r="";return n.length>5?(e=n.substring(1,3),t=n.substring(3,5),i=n.substring(5,7),r=n.substring(7,9)):(e=n.substring(1,2),t=n.substring(2,3),i=n.substring(3,4),r=n.substring(4,5),e+=e,t+=t,i+=i,r+=r),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const hI={test:g2("#"),parse:mie,transform:Xh.transform},cv=n=>({test:e=>typeof e=="string"&&e.endsWith(n)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${n}`}),Vc=cv("deg"),Xa=cv("%"),Dt=cv("px"),gie=cv("vh"),yie=cv("vw"),DO={...Xa,parse:n=>Xa.parse(n)/100,transform:n=>Xa.transform(n*100)},cp={test:g2("hsl","hue"),parse:T9("hue","saturation","lightness"),transform:({hue:n,saturation:e,lightness:t,alpha:i=1})=>"hsla("+Math.round(n)+", "+Xa.transform(by(e))+", "+Xa.transform(by(t))+", "+by(v0.transform(i))+")"},$i={test:n=>Xh.test(n)||hI.test(n)||cp.test(n),parse:n=>Xh.test(n)?Xh.parse(n):cp.test(n)?cp.parse(n):hI.parse(n),transform:n=>typeof n=="string"?n:n.hasOwnProperty("red")?Xh.transform(n):cp.transform(n),getAnimatableNone:n=>{const e=$i.parse(n);return e.alpha=0,$i.transform(e)}},vie=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function _ie(n){var e,t;return isNaN(n)&&typeof n=="string"&&(((e=n.match(m2))==null?void 0:e.length)||0)+(((t=n.match(vie))==null?void 0:t.length)||0)>0}const b9="number",C9="color",xie="var",wie="var(",LO="${}",Eie=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function sm(n){const e=n.toString(),t=[],i={color:[],number:[],var:[]},r=[];let s=0;const a=e.replace(Eie,l=>($i.test(l)?(i.color.push(s),r.push(C9),t.push($i.parse(l))):l.startsWith(wie)?(i.var.push(s),r.push(xie),t.push(l)):(i.number.push(s),r.push(b9),t.push(parseFloat(l))),++s,LO)).split(LO);return{values:t,split:a,indexes:i,types:r}}function Aie(n){return sm(n).values}function M9({split:n,types:e}){const t=n.length;return i=>{let r="";for(let s=0;s<t;s++)if(r+=n[s],i[s]!==void 0){const o=e[s];o===b9?r+=by(i[s]):o===C9?r+=$i.transform(i[s]):r+=i[s]}return r}}function Sie(n){return M9(sm(n))}const Tie=n=>typeof n=="number"?0:$i.test(n)?$i.getAnimatableNone(n):n,bie=(n,e)=>typeof n=="number"?e!=null&&e.trim().endsWith("/")?n:0:Tie(n);function Cie(n){const e=sm(n);return M9(e)(e.values.map((i,r)=>bie(i,e.split[r])))}const pa={test:_ie,parse:Aie,createTransformer:Sie,getAnimatableNone:Cie};function gb(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*(2/3-t)*6:n}function Mie({hue:n,saturation:e,lightness:t,alpha:i}){n/=360,e/=100,t/=100;let r=0,s=0,o=0;if(!e)r=s=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;r=gb(l,a,n+1/3),s=gb(l,a,n),o=gb(l,a,n-1/3)}return{red:Math.round(r*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:i}}function M1(n,e){return t=>t>0?e:n}const wi=(n,e,t)=>n+(e-n)*t,yb=(n,e,t)=>{const i=n*n,r=t*(e*e-i)+i;return r<0?0:Math.sqrt(r)},Iie=[hI,Xh,cp],Rie=n=>Iie.find(e=>e.test(n));function kO(n){const e=Rie(n);if(TA(!!e,`'${n}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!e)return!1;let t=e.parse(n);return e===cp&&(t=Mie(t)),t}const BO=(n,e)=>{const t=kO(n),i=kO(e);if(!t||!i)return M1(n,e);const r={...t};return s=>(r.red=yb(t.red,i.red,s),r.green=yb(t.green,i.green,s),r.blue=yb(t.blue,i.blue,s),r.alpha=wi(t.alpha,i.alpha,s),Xh.transform(r))},dI=new Set(["none","hidden"]);function Pie(n,e){return dI.has(n)?t=>t<=0?n:e:t=>t>=1?e:n}function Nie(n,e){return t=>wi(n,e,t)}function y2(n){return typeof n=="number"?Nie:typeof n=="string"?p2(n)?M1:$i.test(n)?BO:kie:Array.isArray(n)?I9:typeof n=="object"?$i.test(n)?BO:Die:M1}function I9(n,e){const t=[...n],i=t.length,r=n.map((s,o)=>y2(s)(s,e[o]));return s=>{for(let o=0;o<i;o++)t[o]=r[o](s);return t}}function Die(n,e){const t={...n,...e},i={};for(const r in t)n[r]!==void 0&&e[r]!==void 0&&(i[r]=y2(n[r])(n[r],e[r]));return r=>{for(const s in i)t[s]=i[s](r);return t}}function Lie(n,e){const t=[],i={color:0,var:0,number:0};for(let r=0;r<e.values.length;r++){const s=e.types[r],o=n.indexes[s][i[s]],a=n.values[o]??0;t[r]=a,i[s]++}return t}const kie=(n,e)=>{const t=pa.createTransformer(e),i=sm(n),r=sm(e);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?dI.has(n)&&!r.values.length||dI.has(e)&&!i.values.length?Pie(n,e):av(I9(Lie(i,r),r.values),t):(TA(!0,`Complex values '${n}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),M1(n,e))};function R9(n,e,t){return typeof n=="number"&&typeof e=="number"&&typeof t=="number"?wi(n,e,t):y2(n)(n,e)}const Bie=n=>{const e=({timestamp:t})=>n(t);return{start:(t=!0)=>si.update(e,t),stop:()=>Nu(e),now:()=>Sr.isProcessing?Sr.timestamp:xs.now()}},P9=(n,e,t=10)=>{let i="";const r=Math.max(Math.round(e/t),2);for(let s=0;s<r;s++)i+=Math.round(n(s/(r-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},I1=2e4;function v2(n){let e=0;const t=50;let i=n.next(e);for(;!i.done&&e<I1;)e+=t,i=n.next(e);return e>=I1?1/0:e}function Oie(n,e=100,t){const i=t({...n,keyframes:[0,e]}),r=Math.min(v2(i),I1);return{type:"keyframes",ease:s=>i.next(r*s).value/e,duration:ko(r)}}const _i={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function fI(n,e){return n*Math.sqrt(1-e*e)}const Fie=12;function Uie(n,e,t){let i=t;for(let r=1;r<Fie;r++)i=i-n(i)/e(i);return i}const vb=.001;function Vie({duration:n=_i.duration,bounce:e=_i.bounce,velocity:t=_i.velocity,mass:i=_i.mass}){let r,s;TA(n<=Hs(_i.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let o=1-e;o=rl(_i.minDamping,_i.maxDamping,o),n=rl(_i.minDuration,_i.maxDuration,ko(n)),o<1?(r=c=>{const u=c*o,h=u*n,f=u-t,m=fI(c,o),y=Math.exp(-h);return vb-f/m*y},s=c=>{const h=c*o*n,f=h*t+t,m=Math.pow(o,2)*Math.pow(c,2)*n,y=Math.exp(-h),_=fI(Math.pow(c,2),o);return(-r(c)+vb>0?-1:1)*((f-m)*y)/_}):(r=c=>{const u=Math.exp(-c*n),h=(c-t)*n+1;return-vb+u*h},s=c=>{const u=Math.exp(-c*n),h=(t-c)*(n*n);return u*h});const a=5/n,l=Uie(r,s,a);if(n=Hs(n),isNaN(l))return{stiffness:_i.stiffness,damping:_i.damping,duration:n};{const c=Math.pow(l,2)*i;return{stiffness:c,damping:o*2*Math.sqrt(i*c),duration:n}}}const zie=["duration","bounce"],Hie=["stiffness","damping","mass"];function OO(n,e){return e.some(t=>n[t]!==void 0)}function Gie(n){let e={velocity:_i.velocity,stiffness:_i.stiffness,damping:_i.damping,mass:_i.mass,isResolvedFromDuration:!1,...n};if(!OO(n,Hie)&&OO(n,zie))if(e.velocity=0,n.visualDuration){const t=n.visualDuration,i=2*Math.PI/(t*1.2),r=i*i,s=2*rl(.05,1,1-(n.bounce||0))*Math.sqrt(r);e={...e,mass:_i.mass,stiffness:r,damping:s}}else{const t=Vie({...n,velocity:0});e={...e,...t,mass:_i.mass},e.isResolvedFromDuration=!0}return e}function R1(n=_i.visualDuration,e=_i.bounce){const t=typeof n!="object"?{visualDuration:n,keyframes:[0,1],bounce:e}:n;let{restSpeed:i,restDelta:r}=t;const s=t.keyframes[0],o=t.keyframes[t.keyframes.length-1],a={done:!1,value:s},{stiffness:l,damping:c,mass:u,duration:h,velocity:f,isResolvedFromDuration:m}=Gie({...t,velocity:-ko(t.velocity||0)}),y=f||0,_=c/(2*Math.sqrt(l*u)),v=o-s,g=ko(Math.sqrt(l/u)),w=Math.abs(v)<5;i||(i=w?_i.restSpeed.granular:_i.restSpeed.default),r||(r=w?_i.restDelta.granular:_i.restDelta.default);let A,T,L,D,R,I;if(_<1)L=fI(g,_),D=(y+_*g*v)/L,A=C=>{const k=Math.exp(-_*g*C);return o-k*(D*Math.sin(L*C)+v*Math.cos(L*C))},R=_*g*D+v*L,I=_*g*v-D*L,T=C=>Math.exp(-_*g*C)*(R*Math.sin(L*C)+I*Math.cos(L*C));else if(_===1){A=k=>o-Math.exp(-g*k)*(v+(y+g*v)*k);const C=y+g*v;T=k=>Math.exp(-g*k)*(g*C*k-y)}else{const C=g*Math.sqrt(_*_-1);A=X=>{const le=Math.exp(-_*g*X),ie=Math.min(C*X,300);return o-le*((y+_*g*v)*Math.sinh(ie)+C*v*Math.cosh(ie))/C};const k=(y+_*g*v)/C,B=_*g*k-v*C,O=_*g*v-k*C;T=X=>{const le=Math.exp(-_*g*X),ie=Math.min(C*X,300);return le*(B*Math.sinh(ie)+O*Math.cosh(ie))}}const M={calculatedDuration:m&&h||null,velocity:C=>Hs(T(C)),next:C=>{if(!m&&_<1){const B=Math.exp(-_*g*C),O=Math.sin(L*C),X=Math.cos(L*C),le=o-B*(D*O+v*X),ie=Hs(B*(R*O+I*X));return a.done=Math.abs(ie)<=i&&Math.abs(o-le)<=r,a.value=a.done?o:le,a}const k=A(C);if(m)a.done=C>=h;else{const B=Hs(T(C));a.done=Math.abs(B)<=i&&Math.abs(o-k)<=r}return a.value=a.done?o:k,a},toString:()=>{const C=Math.min(v2(M),I1),k=P9(B=>M.next(C*B).value,C,30);return C+"ms "+k},toTransition:()=>{}};return M}R1.applyToOptions=n=>{const e=Oie(n,100,R1);return n.ease=e.ease,n.duration=Hs(e.duration),n.type="keyframes",n};const jie=5;function N9(n,e,t){const i=Math.max(e-jie,0);return h9(t-n(i),e-i)}function pI({keyframes:n,velocity:e=0,power:t=.8,timeConstant:i=325,bounceDamping:r=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:u}){const h=n[0],f={done:!1,value:h},m=I=>a!==void 0&&I<a||l!==void 0&&I>l,y=I=>a===void 0?l:l===void 0||Math.abs(a-I)<Math.abs(l-I)?a:l;let _=t*e;const v=h+_,g=o===void 0?v:o(v);g!==v&&(_=g-h);const w=I=>-_*Math.exp(-I/i),A=I=>g+w(I),T=I=>{const M=w(I),C=A(I);f.done=Math.abs(M)<=c,f.value=f.done?g:C};let L,D;const R=I=>{m(f.value)&&(L=I,D=R1({keyframes:[f.value,y(f.value)],velocity:N9(A,I,f.value),damping:r,stiffness:s,restDelta:c,restSpeed:u}))};return R(0),{calculatedDuration:null,next:I=>{let M=!1;return!D&&L===void 0&&(M=!0,T(I),R(I)),L!==void 0&&I>=L?D.next(I-L):(!M&&T(I),f)}}}function Wie(n,e,t){const i=[],r=t||Pu.mix||R9,s=n.length-1;for(let o=0;o<s;o++){let a=r(n[o],n[o+1]);if(e){const l=Array.isArray(e)?e[o]||Uo:e;a=av(l,a)}i.push(a)}return i}function Kie(n,e,{clamp:t=!0,ease:i,mixer:r}={}){const s=n.length;if(rm(s===e.length,"Both input and output ranges must be the same length","range-length"),s===1)return()=>e[0];if(s===2&&e[0]===e[1])return()=>e[1];const o=n[0]===n[1];n[0]>n[s-1]&&(n=[...n].reverse(),e=[...e].reverse());const a=Wie(e,i,r),l=a.length,c=u=>{if(o&&u<n[0])return e[0];let h=0;if(l>1)for(;h<n.length-2&&!(u<n[h+1]);h++);const f=y0(n[h],n[h+1],u);return a[h](f)};return t?u=>c(rl(n[0],n[s-1],u)):c}function Xie(n,e){const t=n[n.length-1];for(let i=1;i<=e;i++){const r=y0(0,e,i);n.push(wi(t,1,r))}}function qie(n){const e=[0];return Xie(e,n.length-1),e}function Yie(n,e){return n.map(t=>t*e)}function $ie(n,e){return n.map(()=>e||x9).splice(0,n.length-1)}function Cy({duration:n=300,keyframes:e,times:t,ease:i="easeInOut"}){const r=sie(i)?i.map(RO):RO(i),s={done:!1,value:e[0]},o=Yie(t&&t.length===e.length?t:qie(e),n),a=Kie(o,e,{ease:Array.isArray(r)?r:$ie(e,r)});return{calculatedDuration:n,next:l=>(s.value=a(l),s.done=l>=n,s)}}const Jie=n=>n!==null;function _2(n,{repeat:e,repeatType:t="loop"},i,r=1){const s=n.filter(Jie),a=r<0||e&&t!=="loop"&&e%2===1?0:s.length-1;return!a||i===void 0?s[a]:i}const Qie={decay:pI,inertia:pI,tween:Cy,keyframes:Cy,spring:R1};function D9(n){typeof n.type=="string"&&(n.type=Qie[n.type])}class x2{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}const Zie=n=>n/100;class w2 extends x2{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var i,r;const{motionValue:t}=this.options;t&&t.updatedAt!==xs.now()&&this.tick(xs.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(r=(i=this.options).onStop)==null||r.call(i))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;D9(e);const{type:t=Cy,repeat:i=0,repeatDelay:r=0,repeatType:s,velocity:o=0}=e;let{keyframes:a}=e;const l=t||Cy;l!==Cy&&typeof a[0]!="number"&&(this.mixKeyframes=av(Zie,R9(a[0],a[1])),a=[0,100]);const c=l({...e,keyframes:a});s==="mirror"&&(this.mirroredGenerator=l({...e,keyframes:[...a].reverse(),velocity:-o})),c.calculatedDuration===null&&(c.calculatedDuration=v2(c));const{calculatedDuration:u}=c;this.calculatedDuration=u,this.resolvedDuration=u+r,this.totalDuration=this.resolvedDuration*(i+1)-r,this.generator=c}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:i,totalDuration:r,mixKeyframes:s,mirroredGenerator:o,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return i.next(0);const{delay:c=0,keyframes:u,repeat:h,repeatType:f,repeatDelay:m,type:y,onUpdate:_,finalKeyframe:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);const g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),w=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let A=this.currentTime,T=i;if(h){const I=Math.min(this.currentTime,r)/a;let M=Math.floor(I),C=I%1;!C&&I>=1&&(C=1),C===1&&M--,M=Math.min(M,h+1),!!(M%2)&&(f==="reverse"?(C=1-C,m&&(C-=m/a)):f==="mirror"&&(T=o)),A=rl(0,1,C)*a}const L=w?{done:!1,value:u[0]}:T.next(A);s&&!w&&(L.value=s(L.value));let{done:D}=L;!w&&l!==null&&(D=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const R=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&D);return R&&y!==pI&&(L.value=_2(u,this.options,v,this.speed)),_&&_(L.value),R&&this.finish(),L}then(e,t){return this.finished.then(e,t)}get duration(){return ko(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+ko(e)}get time(){return ko(this.currentTime)}set time(e){e=Hs(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);const t=this.generator.next(e).value;return N9(i=>this.generator.next(i).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(xs.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=ko(this.currentTime))}play(){var r,s;if(this.isStopped)return;const{driver:e=Bie,startTime:t}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),(s=(r=this.options).onPlay)==null||s.call(r);const i=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=i):this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime||(this.startTime=t??i),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(xs.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,t;this.notifyFinished(),this.teardown(),this.state="finished",(t=(e=this.options).onComplete)==null||t.call(e)}cancel(){var e,t;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(t=(e=this.options).onCancel)==null||t.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var t;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(t=this.driver)==null||t.stop(),e.observe(this)}}function ere(n){for(let e=1;e<n.length;e++)n[e]??(n[e]=n[e-1])}const qh=n=>n*180/Math.PI,mI=n=>{const e=qh(Math.atan2(n[1],n[0]));return gI(e)},tre={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:n=>(Math.abs(n[0])+Math.abs(n[3]))/2,rotate:mI,rotateZ:mI,skewX:n=>qh(Math.atan(n[1])),skewY:n=>qh(Math.atan(n[2])),skew:n=>(Math.abs(n[1])+Math.abs(n[2]))/2},gI=n=>(n=n%360,n<0&&(n+=360),n),FO=mI,UO=n=>Math.sqrt(n[0]*n[0]+n[1]*n[1]),VO=n=>Math.sqrt(n[4]*n[4]+n[5]*n[5]),nre={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:UO,scaleY:VO,scale:n=>(UO(n)+VO(n))/2,rotateX:n=>gI(qh(Math.atan2(n[6],n[5]))),rotateY:n=>gI(qh(Math.atan2(-n[2],n[0]))),rotateZ:FO,rotate:FO,skewX:n=>qh(Math.atan(n[4])),skewY:n=>qh(Math.atan(n[1])),skew:n=>(Math.abs(n[1])+Math.abs(n[4]))/2};function yI(n){return n.includes("scale")?1:0}function vI(n,e){if(!n||n==="none")return yI(e);const t=n.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,r;if(t)i=nre,r=t;else{const a=n.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=tre,r=a}if(!r)return yI(e);const s=i[e],o=r[1].split(",").map(rre);return typeof s=="function"?s(o):o[s]}const ire=(n,e)=>{const{transform:t="none"}=getComputedStyle(n);return vI(t,e)};function rre(n){return parseFloat(n.trim())}const Lm=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],km=new Set(Lm),zO=n=>n===Dm||n===Dt,sre=new Set(["x","y","z"]),ore=Lm.filter(n=>!sre.has(n));function are(n){const e=[];return ore.forEach(t=>{const i=n.getValue(t);i!==void 0&&(e.push([t,i.get()]),i.set(t.startsWith("scale")?1:0))}),e}const au={width:({x:n},{paddingLeft:e="0",paddingRight:t="0",boxSizing:i})=>{const r=n.max-n.min;return i==="border-box"?r:r-parseFloat(e)-parseFloat(t)},height:({y:n},{paddingTop:e="0",paddingBottom:t="0",boxSizing:i})=>{const r=n.max-n.min;return i==="border-box"?r:r-parseFloat(e)-parseFloat(t)},top:(n,{top:e})=>parseFloat(e),left:(n,{left:e})=>parseFloat(e),bottom:({y:n},{top:e})=>parseFloat(e)+(n.max-n.min),right:({x:n},{left:e})=>parseFloat(e)+(n.max-n.min),x:(n,{transform:e})=>vI(e,"x"),y:(n,{transform:e})=>vI(e,"y")};au.translateX=au.x;au.translateY=au.y;const pd=new Set;let _I=!1,xI=!1,wI=!1;function L9(){if(xI){const n=Array.from(pd).filter(i=>i.needsMeasurement),e=new Set(n.map(i=>i.element)),t=new Map;e.forEach(i=>{const r=are(i);r.length&&(t.set(i,r),i.render())}),n.forEach(i=>i.measureInitialState()),e.forEach(i=>{i.render();const r=t.get(i);r&&r.forEach(([s,o])=>{var a;(a=i.getValue(s))==null||a.set(o)})}),n.forEach(i=>i.measureEndState()),n.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}xI=!1,_I=!1,pd.forEach(n=>n.complete(wI)),pd.clear()}function k9(){pd.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(xI=!0)})}function lre(){wI=!0,k9(),L9(),wI=!1}class E2{constructor(e,t,i,r,s,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=i,this.motionValue=r,this.element=s,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(pd.add(this),_I||(_I=!0,si.read(k9),si.resolveKeyframes(L9))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:i,motionValue:r}=this;if(e[0]===null){const s=r==null?void 0:r.get(),o=e[e.length-1];if(s!==void 0)e[0]=s;else if(i&&t){const a=i.readValue(t,o);a!=null&&(e[0]=a)}e[0]===void 0&&(e[0]=o),r&&s===void 0&&r.set(e[0])}ere(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),pd.delete(this)}cancel(){this.state==="scheduled"&&(pd.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const cre=n=>n.startsWith("--");function B9(n,e,t){cre(e)?n.style.setProperty(e,t):n.style[e]=t}const ure={};function O9(n,e){const t=u9(n);return()=>ure[e]??t()}const hre=O9(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),F9=O9(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),iy=([n,e,t,i])=>`cubic-bezier(${n}, ${e}, ${t}, ${i})`,HO={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:iy([0,.65,.55,1]),circOut:iy([.55,0,1,.45]),backIn:iy([.31,.01,.66,-.59]),backOut:iy([.33,1.53,.69,.99])};function U9(n,e){if(n)return typeof n=="function"?F9()?P9(n,e):"ease-out":w9(n)?iy(n):Array.isArray(n)?n.map(t=>U9(t,e)||HO.easeOut):HO[n]}function dre(n,e,t,{delay:i=0,duration:r=300,repeat:s=0,repeatType:o="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[e]:t};l&&(u.offset=l);const h=U9(a,r);Array.isArray(h)&&(u.easing=h);const f={delay:i,duration:r,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"};return c&&(f.pseudoElement=c),n.animate(u,f)}function V9(n){return typeof n=="function"&&"applyToOptions"in n}function fre({type:n,...e}){return V9(n)&&F9()?n.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class z9 extends x2{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:i,keyframes:r,pseudoElement:s,allowFlatten:o=!1,finalKeyframe:a,onComplete:l}=e;this.isPseudoElement=!!s,this.allowFlatten=o,this.options=e,rm(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const c=fre(e);this.animation=dre(t,i,r,c,s),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const u=_2(r,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(u),B9(t,i,u),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,t;(t=(e=this.animation).finish)==null||t.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,i,r;const e=(t=this.options)==null?void 0:t.element;!this.isPseudoElement&&(e!=null&&e.isConnected)&&((r=(i=this.animation).commitStyles)==null||r.call(i))}get duration(){var t,i;const e=((i=(t=this.animation.effect)==null?void 0:t.getComputedTiming)==null?void 0:i.call(t).duration)||0;return ko(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+ko(e)}get time(){return ko(Number(this.animation.currentTime)||0)}set time(e){const t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Hs(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:i,observe:r}){var s;return this.allowFlatten&&((s=this.animation.effect)==null||s.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&hre()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),i&&(this.animation.rangeEnd=i),Uo):r(this)}}const H9={anticipate:y9,backInOut:g9,circInOut:_9};function pre(n){return n in H9}function mre(n){typeof n.ease=="string"&&pre(n.ease)&&(n.ease=H9[n.ease])}const _b=10;class gre extends z9{constructor(e){mre(e),D9(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:i,onComplete:r,element:s,...o}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}const a=new w2({...o,autoplay:!1}),l=Math.max(_b,xs.now()-this.startTime),c=rl(0,_b,l-_b),u=a.sample(l).value,{name:h}=this.options;s&&h&&B9(s,h,u),t.setWithVelocity(a.sample(Math.max(0,l-c)).value,u,c),a.stop()}}const GO=(n,e)=>e==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(pa.test(n)||n==="0")&&!n.startsWith("url("));function yre(n){const e=n[0];if(n.length===1)return!0;for(let t=0;t<n.length;t++)if(n[t]!==e)return!0}function vre(n,e,t,i){const r=n[0];if(r===null)return!1;if(e==="display"||e==="visibility")return!0;const s=n[n.length-1],o=GO(r,e),a=GO(s,e);return TA(o===a,`You are trying to animate ${e} from "${r}" to "${s}". "${o?s:r}" is not an animatable value.`,"value-not-animatable"),!o||!a?!1:yre(n)||(t==="spring"||V9(t))&&i}function EI(n){n.duration=0,n.type="keyframes"}const _re=new Set(["opacity","clipPath","filter","transform"]),xre=u9(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function wre(n){var u;const{motionValue:e,name:t,repeatDelay:i,repeatType:r,damping:s,type:o}=n;if(!(((u=e==null?void 0:e.owner)==null?void 0:u.current)instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:c}=e.owner.getProps();return xre()&&t&&_re.has(t)&&(t!=="transform"||!c)&&!l&&!i&&r!=="mirror"&&s!==0&&o!=="inertia"}const Ere=40;class Are extends x2{constructor({autoplay:e=!0,delay:t=0,type:i="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:o="loop",keyframes:a,name:l,motionValue:c,element:u,...h}){var y;super(),this.stop=()=>{var _,v;this._animation&&(this._animation.stop(),(_=this.stopTimeline)==null||_.call(this)),(v=this.keyframeResolver)==null||v.cancel()},this.createdAt=xs.now();const f={autoplay:e,delay:t,type:i,repeat:r,repeatDelay:s,repeatType:o,name:l,motionValue:c,element:u,...h},m=(u==null?void 0:u.KeyframeResolver)||E2;this.keyframeResolver=new m(a,(_,v,g)=>this.onKeyframesResolved(_,v,f,!g),l,c,u),(y=this.keyframeResolver)==null||y.scheduleResolve()}onKeyframesResolved(e,t,i,r){var g,w;this.keyframeResolver=void 0;const{name:s,type:o,velocity:a,delay:l,isHandoff:c,onUpdate:u}=i;this.resolvedAt=xs.now();let h=!0;vre(e,s,o,a)||(h=!1,(Pu.instantAnimations||!l)&&(u==null||u(_2(e,i,t))),e[0]=e[e.length-1],EI(i),i.repeat=0);const m={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>Ere?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:t,...i,keyframes:e},y=h&&!c&&wre(m),_=(w=(g=m.motionValue)==null?void 0:g.owner)==null?void 0:w.current,v=y?new gre({...m,element:_}):new w2(m);v.finished.then(()=>{this.notifyFinished()}).catch(Uo),this.pendingTimeline&&(this.stopTimeline=v.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=v}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),lre()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}function G9(n,e,t,i=0,r=1){const s=Array.from(n).sort((c,u)=>c.sortNodePosition(u)).indexOf(e),o=n.size,a=(o-1)*i;return typeof t=="function"?t(s,o):r===1?s*i:a-s*i}const Sre=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Tre(n){const e=Sre.exec(n);if(!e)return[,];const[,t,i,r]=e;return[`--${t??i}`,r]}const bre=4;function j9(n,e,t=1){rm(t<=bre,`Max CSS variable fallback depth detected in property "${n}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[i,r]=Tre(n);if(!i)return;const s=window.getComputedStyle(e).getPropertyValue(i);if(s){const o=s.trim();return a9(o)?parseFloat(o):o}return p2(r)?j9(r,e,t+1):r}const Cre={type:"spring",stiffness:500,damping:25,restSpeed:10},Mre=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),Ire={type:"keyframes",duration:.8},Rre={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Pre=(n,{keyframes:e})=>e.length>2?Ire:km.has(n)?n.startsWith("scale")?Mre(e[1]):Cre:Rre,Nre=n=>n!==null;function Dre(n,{repeat:e,repeatType:t="loop"},i){const r=n.filter(Nre),s=e&&t!=="loop"&&e%2===1?0:r.length-1;return!s||i===void 0?r[s]:i}function W9(n,e){if(n!=null&&n.inherit&&e){const{inherit:t,...i}=n;return{...e,...i}}return n}function A2(n,e){const t=(n==null?void 0:n[e])??(n==null?void 0:n.default)??n;return t!==n?W9(t,n):t}function Lre({when:n,delay:e,delayChildren:t,staggerChildren:i,staggerDirection:r,repeat:s,repeatType:o,repeatDelay:a,from:l,elapsed:c,...u}){return!!Object.keys(u).length}const S2=(n,e,t,i={},r,s)=>o=>{const a=A2(i,n)||{},l=a.delay||i.delay||0;let{elapsed:c=0}=i;c=c-Hs(l);const u={keyframes:Array.isArray(t)?t:[null,t],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-c,onUpdate:f=>{e.set(f),a.onUpdate&&a.onUpdate(f)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:n,motionValue:e,element:s?void 0:r};Lre(a)||Object.assign(u,Pre(n,u)),u.duration&&(u.duration=Hs(u.duration)),u.repeatDelay&&(u.repeatDelay=Hs(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let h=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(EI(u),u.delay===0&&(h=!0)),(Pu.instantAnimations||Pu.skipAnimations||r!=null&&r.shouldSkipAnimations)&&(h=!0,EI(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,h&&!s&&e.get()!==void 0){const f=Dre(u.keyframes,a);if(f!==void 0){si.update(()=>{u.onUpdate(f),u.onComplete()});return}}return a.isSync?new w2(u):new Are(u)};function jO(n){const e=[{},{}];return n==null||n.values.forEach((t,i)=>{e[0][i]=t.get(),e[1][i]=t.getVelocity()}),e}function T2(n,e,t,i){if(typeof e=="function"){const[r,s]=jO(i);e=e(t!==void 0?t:n.custom,r,s)}if(typeof e=="string"&&(e=n.variants&&n.variants[e]),typeof e=="function"){const[r,s]=jO(i);e=e(t!==void 0?t:n.custom,r,s)}return e}function md(n,e,t){const i=n.getProps();return T2(i,e,t!==void 0?t:i.custom,n)}const K9=new Set(["width","height","top","left","right","bottom",...Lm]),WO=30,kre=n=>!isNaN(parseFloat(n));class Bre{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{var s;const r=xs.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&((s=this.events.change)==null||s.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=xs.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=kre(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new h2);const i=this.events[e].add(t);return e==="change"?()=>{i(),si.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,i){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-i}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=xs.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>WO)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,WO);return h9(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,t;(e=this.dependents)==null||e.clear(),(t=this.events.destroy)==null||t.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function om(n,e){return new Bre(n,e)}const AI=n=>Array.isArray(n);function Ore(n,e,t){n.hasValue(e)?n.getValue(e).set(t):n.addValue(e,om(t))}function Fre(n){return AI(n)?n[n.length-1]||0:n}function Ure(n,e){const t=md(n,e);let{transitionEnd:i={},transition:r={},...s}=t||{};s={...s,...i};for(const o in s){const a=Fre(s[o]);Ore(n,o,a)}}const Cr=n=>!!(n&&n.getVelocity);function Vre(n){return!!(Cr(n)&&n.add)}function SI(n,e){const t=n.getValue("willChange");if(Vre(t))return t.add(e);if(!t&&Pu.WillChange){const i=new Pu.WillChange("auto");n.addValue("willChange",i),i.add(e)}}function b2(n){return n.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const zre="framerAppearId",X9="data-"+b2(zre);function q9(n){return n.props[X9]}function Hre({protectedKeys:n,needsAnimating:e},t){const i=n.hasOwnProperty(t)&&e[t]!==!0;return e[t]=!1,i}function Y9(n,e,{delay:t=0,transitionOverride:i,type:r}={}){let{transition:s,transitionEnd:o,...a}=e;const l=n.getDefaultTransition();s=s?W9(s,l):l;const c=s==null?void 0:s.reduceMotion;i&&(s=i);const u=[],h=r&&n.animationState&&n.animationState.getState()[r];for(const f in a){const m=n.getValue(f,n.latestValues[f]??null),y=a[f];if(y===void 0||h&&Hre(h,f))continue;const _={delay:t,...A2(s||{},f)},v=m.get();if(v!==void 0&&!m.isAnimating&&!Array.isArray(y)&&y===v&&!_.velocity)continue;let g=!1;if(window.MotionHandoffAnimation){const T=q9(n);if(T){const L=window.MotionHandoffAnimation(T,f,si);L!==null&&(_.startTime=L,g=!0)}}SI(n,f);const w=c??n.shouldReduceMotion;m.start(S2(f,m,y,w&&K9.has(f)?{type:!1}:_,n,g));const A=m.animation;A&&u.push(A)}if(o){const f=()=>si.update(()=>{o&&Ure(n,o)});u.length?Promise.all(u).then(f):f()}return u}function TI(n,e,t={}){var l;const i=md(n,e,t.type==="exit"?(l=n.presenceContext)==null?void 0:l.custom:void 0);let{transition:r=n.getDefaultTransition()||{}}=i||{};t.transitionOverride&&(r=t.transitionOverride);const s=i?()=>Promise.all(Y9(n,i,t)):()=>Promise.resolve(),o=n.variantChildren&&n.variantChildren.size?(c=0)=>{const{delayChildren:u=0,staggerChildren:h,staggerDirection:f}=r;return Gre(n,e,c,u,h,f,t)}:()=>Promise.resolve(),{when:a}=r;if(a){const[c,u]=a==="beforeChildren"?[s,o]:[o,s];return c().then(()=>u())}else return Promise.all([s(),o(t.delay)])}function Gre(n,e,t=0,i=0,r=0,s=1,o){const a=[];for(const l of n.variantChildren)l.notify("AnimationStart",e),a.push(TI(l,e,{...o,delay:t+(typeof i=="function"?0:i)+G9(n.variantChildren,l,i,r,s)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(a)}function jre(n,e,t={}){n.notify("AnimationStart",e);let i;if(Array.isArray(e)){const r=e.map(s=>TI(n,s,t));i=Promise.all(r)}else if(typeof e=="string")i=TI(n,e,t);else{const r=typeof e=="function"?md(n,e,t.custom):e;i=Promise.all(Y9(n,r,t))}return i.then(()=>{n.notify("AnimationComplete",e)})}const Wre={test:n=>n==="auto",parse:n=>n},$9=n=>e=>e.test(n),J9=[Dm,Dt,Xa,Vc,yie,gie,Wre],KO=n=>J9.find($9(n));function Kre(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||c9(n):!0}const Xre=new Set(["brightness","contrast","saturate","opacity"]);function qre(n){const[e,t]=n.slice(0,-1).split("(");if(e==="drop-shadow")return n;const[i]=t.match(m2)||[];if(!i)return n;const r=t.replace(i,"");let s=Xre.has(e)?1:0;return i!==t&&(s*=100),e+"("+s+r+")"}const Yre=/\b([a-z-]*)\(.*?\)/gu,bI={...pa,getAnimatableNone:n=>{const e=n.match(Yre);return e?e.map(qre).join(" "):n}},CI={...pa,getAnimatableNone:n=>{const e=pa.parse(n);return pa.createTransformer(n)(e.map(i=>typeof i=="number"?0:typeof i=="object"?{...i,alpha:1}:i))}},XO={...Dm,transform:Math.round},$re={rotate:Vc,rotateX:Vc,rotateY:Vc,rotateZ:Vc,scale:rx,scaleX:rx,scaleY:rx,scaleZ:rx,skew:Vc,skewX:Vc,skewY:Vc,distance:Dt,translateX:Dt,translateY:Dt,translateZ:Dt,x:Dt,y:Dt,z:Dt,perspective:Dt,transformPerspective:Dt,opacity:v0,originX:DO,originY:DO,originZ:Dt},C2={borderWidth:Dt,borderTopWidth:Dt,borderRightWidth:Dt,borderBottomWidth:Dt,borderLeftWidth:Dt,borderRadius:Dt,borderTopLeftRadius:Dt,borderTopRightRadius:Dt,borderBottomRightRadius:Dt,borderBottomLeftRadius:Dt,width:Dt,maxWidth:Dt,height:Dt,maxHeight:Dt,top:Dt,right:Dt,bottom:Dt,left:Dt,inset:Dt,insetBlock:Dt,insetBlockStart:Dt,insetBlockEnd:Dt,insetInline:Dt,insetInlineStart:Dt,insetInlineEnd:Dt,padding:Dt,paddingTop:Dt,paddingRight:Dt,paddingBottom:Dt,paddingLeft:Dt,paddingBlock:Dt,paddingBlockStart:Dt,paddingBlockEnd:Dt,paddingInline:Dt,paddingInlineStart:Dt,paddingInlineEnd:Dt,margin:Dt,marginTop:Dt,marginRight:Dt,marginBottom:Dt,marginLeft:Dt,marginBlock:Dt,marginBlockStart:Dt,marginBlockEnd:Dt,marginInline:Dt,marginInlineStart:Dt,marginInlineEnd:Dt,fontSize:Dt,backgroundPositionX:Dt,backgroundPositionY:Dt,...$re,zIndex:XO,fillOpacity:v0,strokeOpacity:v0,numOctaves:XO},Jre={...C2,color:$i,backgroundColor:$i,outlineColor:$i,fill:$i,stroke:$i,borderColor:$i,borderTopColor:$i,borderRightColor:$i,borderBottomColor:$i,borderLeftColor:$i,filter:bI,WebkitFilter:bI,mask:CI,WebkitMask:CI},Q9=n=>Jre[n],Qre=new Set([bI,CI]);function Z9(n,e){let t=Q9(n);return Qre.has(t)||(t=pa),t.getAnimatableNone?t.getAnimatableNone(e):void 0}const Zre=new Set(["auto","none","0"]);function ese(n,e,t){let i=0,r;for(;i<n.length&&!r;){const s=n[i];typeof s=="string"&&!Zre.has(s)&&sm(s).values.length&&(r=n[i]),i++}if(r&&t)for(const s of e)n[s]=Z9(t,r)}class tse extends E2{constructor(e,t,i,r,s){super(e,t,i,r,s,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:i}=this;if(!t||!t.current)return;super.readKeyframes();for(let u=0;u<e.length;u++){let h=e[u];if(typeof h=="string"&&(h=h.trim(),p2(h))){const f=j9(h,t.current);f!==void 0&&(e[u]=f),u===e.length-1&&(this.finalKeyframe=h)}}if(this.resolveNoneKeyframes(),!K9.has(i)||e.length!==2)return;const[r,s]=e,o=KO(r),a=KO(s),l=NO(r),c=NO(s);if(l!==c&&au[i]){this.needsMeasurement=!0;return}if(o!==a)if(zO(o)&&zO(a))for(let u=0;u<e.length;u++){const h=e[u];typeof h=="string"&&(e[u]=parseFloat(h))}else au[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,i=[];for(let r=0;r<e.length;r++)(e[r]===null||Kre(e[r]))&&i.push(r);i.length&&ese(e,i,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:i}=this;if(!e||!e.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=au[i](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const r=t[t.length-1];r!==void 0&&e.getValue(i,r).jump(r,!1)}measureEndState(){var a;const{element:e,name:t,unresolvedKeyframes:i}=this;if(!e||!e.current)return;const r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);const s=i.length-1,o=i[s];i[s]=au[t](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(a=this.removedTransforms)!=null&&a.length&&this.removedTransforms.forEach(([l,c])=>{e.getValue(l).set(c)}),this.resolveNoneKeyframes()}}const nse=new Set(["opacity","clipPath","filter","transform"]);function e6(n,e,t){if(n==null)return[];if(n instanceof EventTarget)return[n];if(typeof n=="string"){const r=document.querySelectorAll(n);return r?Array.from(r):[]}return Array.from(n).filter(i=>i!=null)}const t6=(n,e)=>e&&typeof n=="number"?e.transform(n):n;function Iw(n){return l9(n)&&"offsetHeight"in n&&!("ownerSVGElement"in n)}const{schedule:M2,cancel:dCe}=E9(queueMicrotask,!1),ta={x:!1,y:!1};function n6(){return ta.x||ta.y}function ise(n){return n==="x"||n==="y"?ta[n]?null:(ta[n]=!0,()=>{ta[n]=!1}):ta.x||ta.y?null:(ta.x=ta.y=!0,()=>{ta.x=ta.y=!1})}function i6(n,e){const t=e6(n),i=new AbortController,r={passive:!0,...e,signal:i.signal};return[t,r,()=>i.abort()]}function rse(n){return!(n.pointerType==="touch"||n6())}function sse(n,e,t={}){const[i,r,s]=i6(n,t);return i.forEach(o=>{let a=!1,l=!1,c;const u=()=>{o.removeEventListener("pointerleave",y)},h=v=>{c&&(c(v),c=void 0),u()},f=v=>{a=!1,window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f),l&&(l=!1,h(v))},m=()=>{a=!0,window.addEventListener("pointerup",f,r),window.addEventListener("pointercancel",f,r)},y=v=>{if(v.pointerType!=="touch"){if(a){l=!0;return}h(v)}},_=v=>{if(!rse(v))return;l=!1;const g=e(o,v);typeof g=="function"&&(c=g,o.addEventListener("pointerleave",y,r))};o.addEventListener("pointerenter",_,r),o.addEventListener("pointerdown",m,r)}),s}const r6=(n,e)=>e?n===e?!0:r6(n,e.parentElement):!1,I2=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1,ose=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function ase(n){return ose.has(n.tagName)||n.isContentEditable===!0}const lse=new Set(["INPUT","SELECT","TEXTAREA"]);function cse(n){return lse.has(n.tagName)||n.isContentEditable===!0}const Rw=new WeakSet;function qO(n){return e=>{e.key==="Enter"&&n(e)}}function xb(n,e){n.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const use=(n,e)=>{const t=n.currentTarget;if(!t)return;const i=qO(()=>{if(Rw.has(t))return;xb(t,"down");const r=qO(()=>{xb(t,"up")}),s=()=>xb(t,"cancel");t.addEventListener("keyup",r,e),t.addEventListener("blur",s,e)});t.addEventListener("keydown",i,e),t.addEventListener("blur",()=>t.removeEventListener("keydown",i),e)};function YO(n){return I2(n)&&!n6()}const $O=new WeakSet;function hse(n,e,t={}){const[i,r,s]=i6(n,t),o=a=>{const l=a.currentTarget;if(!YO(a)||$O.has(a))return;Rw.add(l),t.stopPropagation&&$O.add(a);const c=e(l,a),u=(m,y)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",f),Rw.has(l)&&Rw.delete(l),YO(m)&&typeof c=="function"&&c(m,{success:y})},h=m=>{u(m,l===window||l===document||t.useGlobalTarget||r6(l,m.target))},f=m=>{u(m,!1)};window.addEventListener("pointerup",h,r),window.addEventListener("pointercancel",f,r)};return i.forEach(a=>{(t.useGlobalTarget?window:a).addEventListener("pointerdown",o,r),Iw(a)&&(a.addEventListener("focus",c=>use(c,r)),!ase(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),s}function R2(n){return l9(n)&&"ownerSVGElement"in n}const Pw=new WeakMap;let zc;const s6=(n,e,t)=>(i,r)=>r&&r[0]?r[0][n+"Size"]:R2(i)&&"getBBox"in i?i.getBBox()[e]:i[t],dse=s6("inline","width","offsetWidth"),fse=s6("block","height","offsetHeight");function pse({target:n,borderBoxSize:e}){var t;(t=Pw.get(n))==null||t.forEach(i=>{i(n,{get width(){return dse(n,e)},get height(){return fse(n,e)}})})}function mse(n){n.forEach(pse)}function gse(){typeof ResizeObserver>"u"||(zc=new ResizeObserver(mse))}function yse(n,e){zc||gse();const t=e6(n);return t.forEach(i=>{let r=Pw.get(i);r||(r=new Set,Pw.set(i,r)),r.add(e),zc==null||zc.observe(i)}),()=>{t.forEach(i=>{const r=Pw.get(i);r==null||r.delete(e),r!=null&&r.size||zc==null||zc.unobserve(i)})}}const Nw=new Set;let up;function vse(){up=()=>{const n={get width(){return window.innerWidth},get height(){return window.innerHeight}};Nw.forEach(e=>e(n))},window.addEventListener("resize",up)}function _se(n){return Nw.add(n),up||vse(),()=>{Nw.delete(n),!Nw.size&&typeof up=="function"&&(window.removeEventListener("resize",up),up=void 0)}}function JO(n,e){return typeof n=="function"?_se(n):yse(n,e)}function xse(n){return R2(n)&&n.tagName==="svg"}const wse=[...J9,$i,pa],Ese=n=>wse.find($9(n)),QO=()=>({translate:0,scale:1,origin:0,originPoint:0}),hp=()=>({x:QO(),y:QO()}),ZO=()=>({min:0,max:0}),tr=()=>({x:ZO(),y:ZO()}),Ase=new WeakMap;function bA(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}function _0(n){return typeof n=="string"||Array.isArray(n)}const P2=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],N2=["initial",...P2];function CA(n){return bA(n.animate)||N2.some(e=>_0(n[e]))}function o6(n){return!!(CA(n)||n.variants)}function Sse(n,e,t){for(const i in e){const r=e[i],s=t[i];if(Cr(r))n.addValue(i,r);else if(Cr(s))n.addValue(i,om(r,{owner:n}));else if(s!==r)if(n.hasValue(i)){const o=n.getValue(i);o.liveStyle===!0?o.jump(r):o.hasAnimated||o.set(r)}else{const o=n.getStaticValue(i);n.addValue(i,om(o!==void 0?o:r,{owner:n}))}}for(const i in t)e[i]===void 0&&n.removeValue(i);return e}const MI={current:null},a6={current:!1},Tse=typeof window<"u";function bse(){if(a6.current=!0,!!Tse)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),e=()=>MI.current=n.matches;n.addEventListener("change",e),e()}else MI.current=!1}const eF=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let P1={};function l6(n){P1=n}function Cse(){return P1}class Mse{scrapeMotionValuesFromProps(e,t,i){return{}}constructor({parent:e,props:t,presenceContext:i,reducedMotionConfig:r,skipAnimations:s,blockInitialAnimation:o,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=E2,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const m=xs.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,si.render(this.render,!1,!0))};const{latestValues:c,renderState:u}=a;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=u,this.parent=e,this.props=t,this.presenceContext=i,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=s,this.options=l,this.blockInitialAnimation=!!o,this.isControllingVariants=CA(t),this.isVariantNode=o6(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:h,...f}=this.scrapeMotionValuesFromProps(t,{},this);for(const m in f){const y=f[m];c[m]!==void 0&&Cr(y)&&y.set(c[m])}}mount(e){var t,i;if(this.hasBeenMounted)for(const r in this.initialValues)(t=this.values.get(r))==null||t.jump(this.initialValues[r]),this.latestValues[r]=this.initialValues[r];this.current=e,Ase.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,s)=>this.bindToMotionValue(s,r)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(a6.current||bse(),this.shouldReduceMotion=MI.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(i=this.parent)==null||i.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var e;this.projection&&this.projection.unmount(),Nu(this.notifyUpdate),Nu(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const i=this.features[t];i&&(i.unmount(),i.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&nse.has(e)&&this.current instanceof HTMLElement){const{factory:o,keyframes:a,times:l,ease:c,duration:u}=t.accelerate,h=new z9({element:this.current,name:e,keyframes:a,times:l,ease:c,duration:Hs(u)}),f=o(h);this.valueSubscriptions.set(e,()=>{f(),h.cancel()});return}const i=km.has(e);i&&this.onBindTransform&&this.onBindTransform();const r=t.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&si.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let s;typeof window<"u"&&window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),s&&s(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in P1){const t=P1[e];if(!t)continue;const{isEnabled:i,Feature:r}=t;if(!this.features[e]&&r&&i(this.props)&&(this.features[e]=new r(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):tr()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let i=0;i<eF.length;i++){const r=eF[i];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const s="on"+r,o=e[s];o&&(this.propEventSubscriptions[r]=this.on(r,o))}this.prevMotionValues=Sse(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const i=this.values.get(e);t!==i&&(i&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let i=this.values.get(e);return i===void 0&&t!==void 0&&(i=om(t===null?void 0:t,{owner:this}),this.addValue(e,i)),i}readValue(e,t){let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(a9(i)||c9(i))?i=parseFloat(i):!Ese(i)&&pa.test(t)&&(i=Z9(e,t)),this.setBaseTarget(e,Cr(i)?i.get():i)),Cr(i)?i.get():i}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var s;const{initial:t}=this.props;let i;if(typeof t=="string"||typeof t=="object"){const o=T2(this.props,t,(s=this.presenceContext)==null?void 0:s.custom);o&&(i=o[e])}if(t&&i!==void 0)return i;const r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!Cr(r)?r:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new h2),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){M2.render(this.render)}}class c6 extends Mse{constructor(){super(...arguments),this.KeyframeResolver=tse}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){const i=e.style;return i?i[t]:void 0}removeValueFromRenderState(e,{vars:t,style:i}){delete t[e],delete i[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Cr(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}class Xu{constructor(e){this.isMounted=!1,this.node=e}update(){}}function u6({top:n,left:e,right:t,bottom:i}){return{x:{min:e,max:t},y:{min:n,max:i}}}function Ise({x:n,y:e}){return{top:e.min,right:n.max,bottom:e.max,left:n.min}}function Rse(n,e){if(!e)return n;const t=e({x:n.left,y:n.top}),i=e({x:n.right,y:n.bottom});return{top:t.y,left:t.x,bottom:i.y,right:i.x}}function wb(n){return n===void 0||n===1}function II({scale:n,scaleX:e,scaleY:t}){return!wb(n)||!wb(e)||!wb(t)}function Bh(n){return II(n)||h6(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function h6(n){return tF(n.x)||tF(n.y)}function tF(n){return n&&n!=="0%"}function N1(n,e,t){const i=n-t,r=e*i;return t+r}function nF(n,e,t,i,r){return r!==void 0&&(n=N1(n,r,i)),N1(n,t,i)+e}function RI(n,e=0,t=1,i,r){n.min=nF(n.min,e,t,i,r),n.max=nF(n.max,e,t,i,r)}function d6(n,{x:e,y:t}){RI(n.x,e.translate,e.scale,e.originPoint),RI(n.y,t.translate,t.scale,t.originPoint)}const iF=.999999999999,rF=1.0000000000001;function Pse(n,e,t,i=!1){var a;const r=t.length;if(!r)return;e.x=e.y=1;let s,o;for(let l=0;l<r;l++){s=t[l],o=s.projectionDelta;const{visualElement:c}=s.options;c&&c.props.style&&c.props.style.display==="contents"||(i&&s.options.layoutScroll&&s.scroll&&s!==s.root&&fp(n,{x:-s.scroll.offset.x,y:-s.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,d6(n,o)),i&&Bh(s.latestValues)&&fp(n,s.latestValues,(a=s.layout)==null?void 0:a.layoutBox))}e.x<rF&&e.x>iF&&(e.x=1),e.y<rF&&e.y>iF&&(e.y=1)}function dp(n,e){n.min=n.min+e,n.max=n.max+e}function sF(n,e,t,i,r=.5){const s=wi(n.min,n.max,r);RI(n,e,t,s,i)}function oF(n,e){return typeof n=="string"?parseFloat(n)/100*(e.max-e.min):n}function fp(n,e,t){const i=t??n;sF(n.x,oF(e.x,i.x),e.scaleX,e.scale,e.originX),sF(n.y,oF(e.y,i.y),e.scaleY,e.scale,e.originY)}function f6(n,e){return u6(Rse(n.getBoundingClientRect(),e))}function Nse(n,e,t){const i=f6(n,t),{scroll:r}=e;return r&&(dp(i.x,r.offset.x),dp(i.y,r.offset.y)),i}const Dse={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Lse=Lm.length;function kse(n,e,t){let i="",r=!0;for(let s=0;s<Lse;s++){const o=Lm[s],a=n[o];if(a===void 0)continue;let l=!0;if(typeof a=="number")l=a===(o.startsWith("scale")?1:0);else{const c=parseFloat(a);l=o.startsWith("scale")?c===1:c===0}if(!l||t){const c=t6(a,C2[o]);if(!l){r=!1;const u=Dse[o]||o;i+=`${u}(${c}) `}t&&(e[o]=c)}}return i=i.trim(),t?i=t(e,r?"":i):r&&(i="none"),i}function D2(n,e,t){const{style:i,vars:r,transformOrigin:s}=n;let o=!1,a=!1;for(const l in e){const c=e[l];if(km.has(l)){o=!0;continue}else if(S9(l)){r[l]=c;continue}else{const u=t6(c,C2[l]);l.startsWith("origin")?(a=!0,s[l]=u):i[l]=u}}if(e.transform||(o||t?i.transform=kse(e,n.transform,t):i.transform&&(i.transform="none")),a){const{originX:l="50%",originY:c="50%",originZ:u=0}=s;i.transformOrigin=`${l} ${c} ${u}`}}function p6(n,{style:e,vars:t},i,r){const s=n.style;let o;for(o in e)s[o]=e[o];r==null||r.applyProjectionStyles(s,i);for(o in t)s.setProperty(o,t[o])}function aF(n,e){return e.max===e.min?0:n/(e.max-e.min)*100}const Rg={correct:(n,e)=>{if(!e.target)return n;if(typeof n=="string")if(Dt.test(n))n=parseFloat(n);else return n;const t=aF(n,e.target.x),i=aF(n,e.target.y);return`${t}% ${i}%`}},Bse={correct:(n,{treeScale:e,projectionDelta:t})=>{const i=n,r=pa.parse(n);if(r.length>5)return i;const s=pa.createTransformer(n),o=typeof r[0]!="number"?1:0,a=t.x.scale*e.x,l=t.y.scale*e.y;r[0+o]/=a,r[1+o]/=l;const c=wi(a,l,.5);return typeof r[2+o]=="number"&&(r[2+o]/=c),typeof r[3+o]=="number"&&(r[3+o]/=c),s(r)}},PI={borderRadius:{...Rg,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Rg,borderTopRightRadius:Rg,borderBottomLeftRadius:Rg,borderBottomRightRadius:Rg,boxShadow:Bse};function m6(n,{layout:e,layoutId:t}){return km.has(n)||n.startsWith("origin")||(e||t!==void 0)&&(!!PI[n]||n==="opacity")}function L2(n,e,t){var o;const i=n.style,r=e==null?void 0:e.style,s={};if(!i)return s;for(const a in i)(Cr(i[a])||r&&Cr(r[a])||m6(a,n)||((o=t==null?void 0:t.getValue(a))==null?void 0:o.liveStyle)!==void 0)&&(s[a]=i[a]);return s}function Ose(n){return window.getComputedStyle(n)}class Fse extends c6{constructor(){super(...arguments),this.type="html",this.renderInstance=p6}readValueFromInstance(e,t){var i;if(km.has(t))return(i=this.projection)!=null&&i.isProjecting?yI(t):ire(e,t);{const r=Ose(e),s=(S9(t)?r.getPropertyValue(t):r[t])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:t}){return f6(e,t)}build(e,t,i){D2(e,t,i.transformTemplate)}scrapeMotionValuesFromProps(e,t,i){return L2(e,t,i)}}const Use={offset:"stroke-dashoffset",array:"stroke-dasharray"},Vse={offset:"strokeDashoffset",array:"strokeDasharray"};function zse(n,e,t=1,i=0,r=!0){n.pathLength=1;const s=r?Use:Vse;n[s.offset]=`${-i}`,n[s.array]=`${e} ${t}`}const Hse=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function g6(n,{attrX:e,attrY:t,attrScale:i,pathLength:r,pathSpacing:s=1,pathOffset:o=0,...a},l,c,u){if(D2(n,a,c),l){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:h,style:f}=n;h.transform&&(f.transform=h.transform,delete h.transform),(f.transform||h.transformOrigin)&&(f.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),f.transform&&(f.transformBox=(u==null?void 0:u.transformBox)??"fill-box",delete h.transformBox);for(const m of Hse)h[m]!==void 0&&(f[m]=h[m],delete h[m]);e!==void 0&&(h.x=e),t!==void 0&&(h.y=t),i!==void 0&&(h.scale=i),r!==void 0&&zse(h,r,s,o,!1)}const y6=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),v6=n=>typeof n=="string"&&n.toLowerCase()==="svg";function Gse(n,e,t,i){p6(n,e,void 0,i);for(const r in e.attrs)n.setAttribute(y6.has(r)?r:b2(r),e.attrs[r])}function _6(n,e,t){const i=L2(n,e,t);for(const r in n)if(Cr(n[r])||Cr(e[r])){const s=Lm.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;i[s]=n[r]}return i}class jse extends c6{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=tr}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(km.has(t)){const i=Q9(t);return i&&i.default||0}return t=y6.has(t)?t:b2(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,i){return _6(e,t,i)}build(e,t,i){g6(e,t,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(e,t,i,r){Gse(e,t,i,r)}mount(e){this.isSVGTag=v6(e.tagName),super.mount(e)}}const Wse=N2.length;function x6(n){if(!n)return;if(!n.isControllingVariants){const t=n.parent?x6(n.parent)||{}:{};return n.props.initial!==void 0&&(t.initial=n.props.initial),t}const e={};for(let t=0;t<Wse;t++){const i=N2[t],r=n.props[i];(_0(r)||r===!1)&&(e[i]=r)}return e}function w6(n,e){if(!Array.isArray(e))return!1;const t=e.length;if(t!==n.length)return!1;for(let i=0;i<t;i++)if(e[i]!==n[i])return!1;return!0}const Kse=[...P2].reverse(),Xse=P2.length;function qse(n){return e=>Promise.all(e.map(({animation:t,options:i})=>jre(n,t,i)))}function Yse(n){let e=qse(n),t=lF(),i=!0,r=!1;const s=c=>(u,h)=>{var m;const f=md(n,h,c==="exit"?(m=n.presenceContext)==null?void 0:m.custom:void 0);if(f){const{transition:y,transitionEnd:_,...v}=f;u={...u,...v,..._}}return u};function o(c){e=c(n)}function a(c){const{props:u}=n,h=x6(n.parent)||{},f=[],m=new Set;let y={},_=1/0;for(let g=0;g<Xse;g++){const w=Kse[g],A=t[w],T=u[w]!==void 0?u[w]:h[w],L=_0(T),D=w===c?A.isActive:null;D===!1&&(_=g);let R=T===h[w]&&T!==u[w]&&L;if(R&&(i||r)&&n.manuallyAnimateOnMount&&(R=!1),A.protectedKeys={...y},!A.isActive&&D===null||!T&&!A.prevProp||bA(T)||typeof T=="boolean")continue;if(w==="exit"&&A.isActive&&D!==!0){A.prevResolvedValues&&(y={...y,...A.prevResolvedValues});continue}const I=$se(A.prevProp,T);let M=I||w===c&&A.isActive&&!R&&L||g>_&&L,C=!1;const k=Array.isArray(T)?T:[T];let B=k.reduce(s(w),{});D===!1&&(B={});const{prevResolvedValues:O={}}=A,X={...O,...B},le=G=>{M=!0,m.has(G)&&(C=!0,m.delete(G)),A.needsAnimating[G]=!0;const $=n.getValue(G);$&&($.liveStyle=!1)};for(const G in X){const $=B[G],te=O[G];if(y.hasOwnProperty(G))continue;let ue=!1;AI($)&&AI(te)?ue=!w6($,te):ue=$!==te,ue?$!=null?le(G):m.add(G):$!==void 0&&m.has(G)?le(G):A.protectedKeys[G]=!0}A.prevProp=T,A.prevResolvedValues=B,A.isActive&&(y={...y,...B}),(i||r)&&n.blockInitialAnimation&&(M=!1);const ie=R&&I;M&&(!ie||C)&&f.push(...k.map(G=>{const $={type:w};if(typeof G=="string"&&(i||r)&&!ie&&n.manuallyAnimateOnMount&&n.parent){const{parent:te}=n,ue=md(te,G);if(te.enteringChildren&&ue){const{delayChildren:ve}=ue.transition||{};$.delay=G9(te.enteringChildren,n,ve)}}return{animation:G,options:$}}))}if(m.size){const g={};if(typeof u.initial!="boolean"){const w=md(n,Array.isArray(u.initial)?u.initial[0]:u.initial);w&&w.transition&&(g.transition=w.transition)}m.forEach(w=>{const A=n.getBaseTarget(w),T=n.getValue(w);T&&(T.liveStyle=!0),g[w]=A??null}),f.push({animation:g})}let v=!!f.length;return i&&(u.initial===!1||u.initial===u.animate)&&!n.manuallyAnimateOnMount&&(v=!1),i=!1,r=!1,v?e(f):Promise.resolve()}function l(c,u){var f;if(t[c].isActive===u)return Promise.resolve();(f=n.variantChildren)==null||f.forEach(m=>{var y;return(y=m.animationState)==null?void 0:y.setActive(c,u)}),t[c].isActive=u;const h=a(c);for(const m in t)t[m].protectedKeys={};return h}return{animateChanges:a,setActive:l,setAnimateFunction:o,getState:()=>t,reset:()=>{t=lF(),r=!0}}}function $se(n,e){return typeof e=="string"?e!==n:Array.isArray(e)?!w6(e,n):!1}function vh(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function lF(){return{animate:vh(!0),whileInView:vh(),whileHover:vh(),whileTap:vh(),whileDrag:vh(),whileFocus:vh(),exit:vh()}}function NI(n,e){n.min=e.min,n.max=e.max}function $o(n,e){NI(n.x,e.x),NI(n.y,e.y)}function cF(n,e){n.translate=e.translate,n.scale=e.scale,n.originPoint=e.originPoint,n.origin=e.origin}const E6=1e-4,Jse=1-E6,Qse=1+E6,A6=.01,Zse=0-A6,eoe=0+A6;function ws(n){return n.max-n.min}function toe(n,e,t){return Math.abs(n-e)<=t}function uF(n,e,t,i=.5){n.origin=i,n.originPoint=wi(e.min,e.max,n.origin),n.scale=ws(t)/ws(e),n.translate=wi(t.min,t.max,n.origin)-n.originPoint,(n.scale>=Jse&&n.scale<=Qse||isNaN(n.scale))&&(n.scale=1),(n.translate>=Zse&&n.translate<=eoe||isNaN(n.translate))&&(n.translate=0)}function My(n,e,t,i){uF(n.x,e.x,t.x,i?i.originX:void 0),uF(n.y,e.y,t.y,i?i.originY:void 0)}function hF(n,e,t){n.min=t.min+e.min,n.max=n.min+ws(e)}function noe(n,e,t){hF(n.x,e.x,t.x),hF(n.y,e.y,t.y)}function dF(n,e,t){n.min=e.min-t.min,n.max=n.min+ws(e)}function D1(n,e,t){dF(n.x,e.x,t.x),dF(n.y,e.y,t.y)}function fF(n,e,t,i,r){return n-=e,n=N1(n,1/t,i),r!==void 0&&(n=N1(n,1/r,i)),n}function ioe(n,e=0,t=1,i=.5,r,s=n,o=n){if(Xa.test(e)&&(e=parseFloat(e),e=wi(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=wi(s.min,s.max,i);n===s&&(a-=e),n.min=fF(n.min,e,t,a,r),n.max=fF(n.max,e,t,a,r)}function pF(n,e,[t,i,r],s,o){ioe(n,e[t],e[i],e[r],e.scale,s,o)}const roe=["x","scaleX","originX"],soe=["y","scaleY","originY"];function mF(n,e,t,i){pF(n.x,e,roe,t?t.x:void 0,i?i.x:void 0),pF(n.y,e,soe,t?t.y:void 0,i?i.y:void 0)}function gF(n){return n.translate===0&&n.scale===1}function S6(n){return gF(n.x)&&gF(n.y)}function yF(n,e){return n.min===e.min&&n.max===e.max}function ooe(n,e){return yF(n.x,e.x)&&yF(n.y,e.y)}function vF(n,e){return Math.round(n.min)===Math.round(e.min)&&Math.round(n.max)===Math.round(e.max)}function T6(n,e){return vF(n.x,e.x)&&vF(n.y,e.y)}function _F(n){return ws(n.x)/ws(n.y)}function xF(n,e){return n.translate===e.translate&&n.scale===e.scale&&n.originPoint===e.originPoint}function ka(n){return[n("x"),n("y")]}function aoe(n,e,t){let i="";const r=n.x.translate/e.x,s=n.y.translate/e.y,o=(t==null?void 0:t.z)||0;if((r||s||o)&&(i=`translate3d(${r}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(i+=`scale(${1/e.x}, ${1/e.y}) `),t){const{transformPerspective:c,rotate:u,rotateX:h,rotateY:f,skewX:m,skewY:y}=t;c&&(i=`perspective(${c}px) ${i}`),u&&(i+=`rotate(${u}deg) `),h&&(i+=`rotateX(${h}deg) `),f&&(i+=`rotateY(${f}deg) `),m&&(i+=`skewX(${m}deg) `),y&&(i+=`skewY(${y}deg) `)}const a=n.x.scale*e.x,l=n.y.scale*e.y;return(a!==1||l!==1)&&(i+=`scale(${a}, ${l})`),i||"none"}const b6=["TopLeft","TopRight","BottomLeft","BottomRight"],loe=b6.length,wF=n=>typeof n=="string"?parseFloat(n):n,EF=n=>typeof n=="number"||Dt.test(n);function coe(n,e,t,i,r,s){r?(n.opacity=wi(0,t.opacity??1,uoe(i)),n.opacityExit=wi(e.opacity??1,0,hoe(i))):s&&(n.opacity=wi(e.opacity??1,t.opacity??1,i));for(let o=0;o<loe;o++){const a=`border${b6[o]}Radius`;let l=AF(e,a),c=AF(t,a);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||EF(l)===EF(c)?(n[a]=Math.max(wi(wF(l),wF(c),i),0),(Xa.test(c)||Xa.test(l))&&(n[a]+="%")):n[a]=c}(e.rotate||t.rotate)&&(n.rotate=wi(e.rotate||0,t.rotate||0,i))}function AF(n,e){return n[e]!==void 0?n[e]:n.borderRadius}const uoe=C6(0,.5,v9),hoe=C6(.5,.95,Uo);function C6(n,e,t){return i=>i<n?0:i>e?1:t(y0(n,e,i))}function doe(n,e,t){const i=Cr(n)?n:om(n);return i.start(S2("",i,e,t)),i.animation}function x0(n,e,t,i={passive:!0}){return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t)}const foe=(n,e)=>n.depth-e.depth;class poe{constructor(){this.children=[],this.isDirty=!1}add(e){u2(this.children,e),this.isDirty=!0}remove(e){C1(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(foe),this.isDirty=!1,this.children.forEach(e)}}function moe(n,e){const t=xs.now(),i=({timestamp:r})=>{const s=r-t;s>=e&&(Nu(i),n(s-e))};return si.setup(i,!0),()=>Nu(i)}function Dw(n){return Cr(n)?n.get():n}class goe{constructor(){this.members=[]}add(e){u2(this.members,e);for(let t=this.members.length-1;t>=0;t--){const i=this.members[t];if(i===e||i===this.lead||i===this.prevLead)continue;const r=i.instance;(!r||r.isConnected===!1)&&!i.snapshot&&(C1(this.members,i),i.unmount())}e.scheduleRender()}remove(e){if(C1(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(e){var t;for(let i=this.members.indexOf(e)-1;i>=0;i--){const r=this.members[i];if(r.isPresent!==!1&&((t=r.instance)==null?void 0:t.isConnected)!==!1)return this.promote(r),!0}return!1}promote(e,t){var r;const i=this.lead;if(e!==i&&(this.prevLead=i,this.lead=e,e.show(),i)){i.updateSnapshot(),e.scheduleRender();const{layoutDependency:s}=i.options,{layoutDependency:o}=e.options;(s===void 0||s!==o)&&(e.resumeFrom=i,t&&(i.preserveOpacity=!0),i.snapshot&&(e.snapshot=i.snapshot,e.snapshot.latestValues=i.animationValues||i.latestValues),(r=e.root)!=null&&r.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(e=>{var t,i,r,s,o;(i=(t=e.options).onExitComplete)==null||i.call(t),(o=(r=e.resumingFrom)==null?void 0:(s=r.options).onExitComplete)==null||o.call(s)})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){var e;(e=this.lead)!=null&&e.snapshot&&(this.lead.snapshot=void 0)}}const Lw={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Eb=["","X","Y","Z"],yoe=1e3;let voe=0;function Ab(n,e,t,i){const{latestValues:r}=e;r[n]&&(t[n]=r[n],e.setStaticValue(n,0),i&&(i[n]=0))}function M6(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:e}=n.options;if(!e)return;const t=q9(e);if(window.MotionHasOptimisedAnimation(t,"transform")){const{layout:r,layoutId:s}=n.options;window.MotionCancelOptimisedAnimation(t,"transform",si,!(r||s))}const{parent:i}=n;i&&!i.hasCheckedOptimisedAppear&&M6(i)}function I6({attachResizeListener:n,defaultParent:e,measureScroll:t,checkIsScrollRoot:i,resetTransform:r}){return class{constructor(o={},a=e==null?void 0:e()){this.id=voe++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(woe),this.nodes.forEach(Toe),this.nodes.forEach(boe),this.nodes.forEach(Eoe)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new poe)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new h2),this.eventHandlers.get(o).add(a)}notifyListeners(o,...a){const l=this.eventHandlers.get(o);l&&l.notify(...a)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=R2(o)&&!xse(o),this.instance=o;const{layoutId:a,layout:l,visualElement:c}=this.options;if(c&&!c.current&&c.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||a)&&(this.isLayoutDirty=!0),n){let u,h=0;const f=()=>this.root.updateBlockedByResize=!1;si.read(()=>{h=window.innerWidth}),n(o,()=>{const m=window.innerWidth;m!==h&&(h=m,this.root.updateBlockedByResize=!0,u&&u(),u=moe(f,250),Lw.hasAnimatedSinceResize&&(Lw.hasAnimatedSinceResize=!1,this.nodes.forEach(bF)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&c&&(a||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:h,hasRelativeLayoutChanged:f,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||c.getDefaultTransition()||Poe,{onLayoutAnimationStart:_,onLayoutAnimationComplete:v}=c.getProps(),g=!this.targetLayout||!T6(this.targetLayout,m),w=!h&&f;if(this.options.layoutRoot||this.resumeFrom||w||h&&(g||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const A={...A2(y,"layout"),onPlay:_,onComplete:v};(c.shouldReduceMotion||this.options.layoutRoot)&&(A.delay=0,A.type=!1),this.startAnimation(A),this.setAnimationOrigin(u,w)}else h||bF(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Nu(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Coe),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&M6(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const h=this.path[u];h.shouldResetTransform=!0,(typeof h.latestValues.x=="string"||typeof h.latestValues.y=="string")&&(h.isLayoutDirty=!0),h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(SF);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(TF);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Soe),this.nodes.forEach(_oe),this.nodes.forEach(xoe)):this.nodes.forEach(TF),this.clearAllSnapshots();const a=xs.now();Sr.delta=rl(0,1e3/60,a-Sr.timestamp),Sr.timestamp=a,Sr.isProcessing=!0,pb.update.process(Sr),pb.preRender.process(Sr),pb.render.process(Sr),Sr.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,M2.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Aoe),this.sharedNodes.forEach(Moe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,si.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){si.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!ws(this.snapshot.measuredBox.x)&&!ws(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=tr(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a&&this.instance){const l=i(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:l,offset:t(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!r)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!S6(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;o&&this.instance&&(a||Bh(this.latestValues)||u)&&(r(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return o&&(l=this.removeTransform(l)),Noe(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var c;const{visualElement:o}=this.options;if(!o)return tr();const a=o.measureViewportBox();if(!(((c=this.scroll)==null?void 0:c.wasRoot)||this.path.some(Doe))){const{scroll:u}=this.root;u&&(dp(a.x,u.offset.x),dp(a.y,u.offset.y))}return a}removeElementScroll(o){var l;const a=tr();if($o(a,o),(l=this.scroll)!=null&&l.wasRoot)return a;for(let c=0;c<this.path.length;c++){const u=this.path[c],{scroll:h,options:f}=u;u!==this.root&&h&&f.layoutScroll&&(h.wasRoot&&$o(a,o),dp(a.x,h.offset.x),dp(a.y,h.offset.y))}return a}applyTransform(o,a=!1){var c,u;const l=tr();$o(l,o);for(let h=0;h<this.path.length;h++){const f=this.path[h];!a&&f.options.layoutScroll&&f.scroll&&f!==f.root&&fp(l,{x:-f.scroll.offset.x,y:-f.scroll.offset.y}),Bh(f.latestValues)&&fp(l,f.latestValues,(c=f.layout)==null?void 0:c.layoutBox)}return Bh(this.latestValues)&&fp(l,this.latestValues,(u=this.layout)==null?void 0:u.layoutBox),l}removeTransform(o){var l;const a=tr();$o(a,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!Bh(u.latestValues))continue;let h;u.instance&&(II(u.latestValues)&&u.updateSnapshot(),h=tr(),$o(h,u.measurePageBox())),mF(a,u.latestValues,(l=u.snapshot)==null?void 0:l.layoutBox,h)}return Bh(this.latestValues)&&mF(a,this.latestValues),a}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Sr.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var m;const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==a;if(!(o||l&&this.isSharedProjectionDirty||this.isProjectionDirty||(m=this.parent)!=null&&m.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:h}=this.options;if(!this.layout||!(u||h))return;this.resolvedRelativeTargetAt=Sr.timestamp;const f=this.getClosestProjectingParent();f&&this.linkedParentVersion!==f.layoutVersion&&!f.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(f&&f.layout?this.createRelativeTarget(f,this.layout.layoutBox,f.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=tr(),this.targetWithTransforms=tr()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),noe(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):$o(this.target,this.layout.layoutBox),d6(this.target,this.targetDelta)):$o(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&this.animationProgress!==1?this.createRelativeTarget(f,this.target,f.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||II(this.parent.latestValues)||h6(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,a,l){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=tr(),this.relativeTargetOrigin=tr(),D1(this.relativeTargetOrigin,a,l),$o(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var y;const o=this.getLead(),a=!!this.resumingFrom||this!==o;let l=!0;if((this.isProjectionDirty||(y=this.parent)!=null&&y.isProjectionDirty)&&(l=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===Sr.timestamp&&(l=!1),l)return;const{layout:c,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||u))return;$o(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,f=this.treeScale.y;Pse(this.layoutCorrected,this.treeScale,this.path,a),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=tr());const{target:m}=o;if(!m){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(cF(this.prevProjectionDelta.x,this.projectionDelta.x),cF(this.prevProjectionDelta.y,this.projectionDelta.y)),My(this.projectionDelta,this.layoutCorrected,m,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==f||!xF(this.projectionDelta.x,this.prevProjectionDelta.x)||!xF(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",m))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var a;if((a=this.options.visualElement)==null||a.scheduleRender(),o){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=hp(),this.projectionDelta=hp(),this.projectionDeltaWithTransform=hp()}setAnimationOrigin(o,a=!1){const l=this.snapshot,c=l?l.latestValues:{},u={...this.latestValues},h=hp();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const f=tr(),m=l?l.source:void 0,y=this.layout?this.layout.source:void 0,_=m!==y,v=this.getStack(),g=!v||v.members.length<=1,w=!!(_&&!g&&this.options.crossfade===!0&&!this.path.some(Roe));this.animationProgress=0;let A;this.mixTargetDelta=T=>{const L=T/1e3;CF(h.x,o.x,L),CF(h.y,o.y,L),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(D1(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Ioe(this.relativeTarget,this.relativeTargetOrigin,f,L),A&&ooe(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=tr()),$o(A,this.relativeTarget)),_&&(this.animationValues=u,coe(u,c,this.latestValues,L,w,g)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=L},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var a,l,c;this.notifyListeners("animationStart"),(a=this.currentAnimation)==null||a.stop(),(c=(l=this.resumingFrom)==null?void 0:l.currentAnimation)==null||c.stop(),this.pendingAnimation&&(Nu(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=si.update(()=>{Lw.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=om(0)),this.motionValue.jump(0,!1),this.currentAnimation=doe(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:u=>{this.mixTargetDelta(u),o.onUpdate&&o.onUpdate(u)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(yoe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:u}=o;if(!(!a||!l||!c)){if(this!==o&&this.layout&&c&&R6(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||tr();const h=ws(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+h;const f=ws(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+f}$o(a,l),fp(a,u),My(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new goe),this.sharedNodes.get(o).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())==null?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())==null?void 0:a.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const c={};l.z&&Ab("z",o,c,this.animationValues);for(let u=0;u<Eb.length;u++)Ab(`rotate${Eb[u]}`,o,c,this.animationValues),Ab(`skew${Eb[u]}`,o,c,this.animationValues);o.render();for(const u in c)o.setStaticValue(u,c[u]),this.animationValues&&(this.animationValues[u]=c[u]);o.scheduleRender()}applyProjectionStyles(o,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=Dw(a==null?void 0:a.pointerEvents)||"",o.transform=l?l(this.latestValues,""):"none";return}const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=Dw(a==null?void 0:a.pointerEvents)||""),this.hasProjected&&!Bh(this.latestValues)&&(o.transform=l?l({},""):"none",this.hasProjected=!1);return}o.visibility="";const u=c.animationValues||c.latestValues;this.applyTransformsToTarget();let h=aoe(this.projectionDeltaWithTransform,this.treeScale,u);l&&(h=l(u,h)),o.transform=h;const{x:f,y:m}=this.projectionDelta;o.transformOrigin=`${f.origin*100}% ${m.origin*100}% 0`,c.animationValues?o.opacity=c===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:o.opacity=c===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const y in PI){if(u[y]===void 0)continue;const{correct:_,applyTo:v,isCSSVariable:g}=PI[y],w=h==="none"?u[y]:_(u[y],c);if(v){const A=v.length;for(let T=0;T<A;T++)o[v[T]]=w}else g?this.options.visualElement.renderState.vars[y]=w:o[y]=w}this.options.layoutId&&(o.pointerEvents=c===this?Dw(a==null?void 0:a.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var a;return(a=o.currentAnimation)==null?void 0:a.stop()}),this.root.nodes.forEach(SF),this.root.sharedNodes.clear()}}}function _oe(n){n.updateLayout()}function xoe(n){var t;const e=((t=n.resumeFrom)==null?void 0:t.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&e&&n.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:r}=n.layout,{animationType:s}=n.options,o=e.source!==n.layout.source;if(s==="size")ka(h=>{const f=o?e.measuredBox[h]:e.layoutBox[h],m=ws(f);f.min=i[h].min,f.max=f.min+m});else if(s==="x"||s==="y"){const h=s==="x"?"y":"x";NI(o?e.measuredBox[h]:e.layoutBox[h],i[h])}else R6(s,e.layoutBox,i)&&ka(h=>{const f=o?e.measuredBox[h]:e.layoutBox[h],m=ws(i[h]);f.max=f.min+m,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[h].max=n.relativeTarget[h].min+m)});const a=hp();My(a,i,e.layoutBox);const l=hp();o?My(l,n.applyTransform(r,!0),e.measuredBox):My(l,i,e.layoutBox);const c=!S6(a);let u=!1;if(!n.resumeFrom){const h=n.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:f,layout:m}=h;if(f&&m){const y=tr();D1(y,e.layoutBox,f.layoutBox);const _=tr();D1(_,i,m.layoutBox),T6(y,_)||(u=!0),h.options.layoutRoot&&(n.relativeTarget=_,n.relativeTargetOrigin=y,n.relativeParent=h)}}}n.notifyListeners("didUpdate",{layout:i,snapshot:e,delta:l,layoutDelta:a,hasLayoutChanged:c,hasRelativeLayoutChanged:u})}else if(n.isLead()){const{onExitComplete:i}=n.options;i&&i()}n.options.transition=void 0}function woe(n){n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function Eoe(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function Aoe(n){n.clearSnapshot()}function SF(n){n.clearMeasurements()}function TF(n){n.isLayoutDirty=!1}function Soe(n){const{visualElement:e}=n.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),n.resetTransform()}function bF(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function Toe(n){n.resolveTargetDelta()}function boe(n){n.calcProjection()}function Coe(n){n.resetSkewAndRotation()}function Moe(n){n.removeLeadSnapshot()}function CF(n,e,t){n.translate=wi(e.translate,0,t),n.scale=wi(e.scale,1,t),n.origin=e.origin,n.originPoint=e.originPoint}function MF(n,e,t,i){n.min=wi(e.min,t.min,i),n.max=wi(e.max,t.max,i)}function Ioe(n,e,t,i){MF(n.x,e.x,t.x,i),MF(n.y,e.y,t.y,i)}function Roe(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const Poe={duration:.45,ease:[.4,0,.1,1]},IF=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),RF=IF("applewebkit/")&&!IF("chrome/")?Math.round:Uo;function PF(n){n.min=RF(n.min),n.max=RF(n.max)}function Noe(n){PF(n.x),PF(n.y)}function R6(n,e,t){return n==="position"||n==="preserve-aspect"&&!toe(_F(e),_F(t),.2)}function Doe(n){var e;return n!==n.root&&((e=n.scroll)==null?void 0:e.wasRoot)}const Loe=I6({attachResizeListener:(n,e)=>x0(n,"resize",e),measureScroll:()=>{var n,e;return{x:document.documentElement.scrollLeft||((n=document.body)==null?void 0:n.scrollLeft)||0,y:document.documentElement.scrollTop||((e=document.body)==null?void 0:e.scrollTop)||0}},checkIsScrollRoot:()=>!0}),Sb={current:void 0},P6=I6({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!Sb.current){const n=new Loe({});n.mount(window),n.setOptions({layoutScroll:!0}),Sb.current=n}return Sb.current},resetTransform:(n,e)=>{n.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),k2=V.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"});function NF(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function koe(...n){return e=>{let t=!1;const i=n.map(r=>{const s=NF(r,e);return!t&&typeof s=="function"&&(t=!0),s});if(t)return()=>{for(let r=0;r<i.length;r++){const s=i[r];typeof s=="function"?s():NF(n[r],null)}}}}function Boe(...n){return V.useCallback(koe(...n),n)}class Ooe extends V.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(Iw(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const i=t.offsetParent,r=Iw(i)&&i.offsetWidth||0,s=Iw(i)&&i.offsetHeight||0,o=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(o.height),a.width=parseFloat(o.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=r-a.width-a.left,a.bottom=s-a.height-a.top}return null}componentDidUpdate(){}render(){return this.props.children}}function Foe({children:n,isPresent:e,anchorX:t,anchorY:i,root:r,pop:s}){var f;const o=V.useId(),a=V.useRef(null),l=V.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:c}=V.useContext(k2),u=((f=n.props)==null?void 0:f.ref)??(n==null?void 0:n.ref),h=Boe(a,u);return V.useInsertionEffect(()=>{const{width:m,height:y,top:_,left:v,right:g,bottom:w}=l.current;if(e||s===!1||!a.current||!m||!y)return;const A=t==="left"?`left: ${v}`:`right: ${g}`,T=i==="bottom"?`bottom: ${w}`:`top: ${_}`;a.current.dataset.motionPopId=o;const L=document.createElement("style");c&&(L.nonce=c);const D=r??document.head;return D.appendChild(L),L.sheet&&L.sheet.insertRule(`
          [data-motion-pop-id="${o}"] {
            position: absolute !important;
            width: ${m}px !important;
            height: ${y}px !important;
            ${A}px !important;
            ${T}px !important;
          }
        `),()=>{var R;(R=a.current)==null||R.removeAttribute("data-motion-pop-id"),D.contains(L)&&D.removeChild(L)}},[e]),S.jsx(Ooe,{isPresent:e,childRef:a,sizeRef:l,pop:s,children:s===!1?n:V.cloneElement(n,{ref:h})})}const Uoe=({children:n,initial:e,isPresent:t,onExitComplete:i,custom:r,presenceAffectsLayout:s,mode:o,anchorX:a,anchorY:l,root:c})=>{const u=c2(Voe),h=V.useId();let f=!0,m=V.useMemo(()=>(f=!1,{id:h,initial:e,isPresent:t,custom:r,onExitComplete:y=>{u.set(y,!0);for(const _ of u.values())if(!_)return;i&&i()},register:y=>(u.set(y,!1),()=>u.delete(y))}),[t,u,i]);return s&&f&&(m={...m}),V.useMemo(()=>{u.forEach((y,_)=>u.set(_,!1))},[t]),V.useEffect(()=>{!t&&!u.size&&i&&i()},[t]),n=S.jsx(Foe,{pop:o==="popLayout",isPresent:t,anchorX:a,anchorY:l,root:c,children:n}),S.jsx(SA.Provider,{value:m,children:n})};function Voe(){return new Map}function N6(n=!0){const e=V.useContext(SA);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:i,register:r}=e,s=V.useId();V.useEffect(()=>{if(n)return r(s)},[n]);const o=V.useCallback(()=>n&&i&&i(s),[s,i,n]);return!t&&i?[!1,o]:[!0]}const sx=n=>n.key||"";function DF(n){const e=[];return V.Children.forEach(n,t=>{V.isValidElement(t)&&e.push(t)}),e}const Gs=({children:n,custom:e,initial:t=!0,onExitComplete:i,presenceAffectsLayout:r=!0,mode:s="sync",propagate:o=!1,anchorX:a="left",anchorY:l="top",root:c})=>{const[u,h]=N6(o),f=V.useMemo(()=>DF(n),[n]),m=o&&!u?[]:f.map(sx),y=V.useRef(!0),_=V.useRef(f),v=c2(()=>new Map),g=V.useRef(new Set),[w,A]=V.useState(f),[T,L]=V.useState(f);o9(()=>{y.current=!1,_.current=f;for(let I=0;I<T.length;I++){const M=sx(T[I]);m.includes(M)?(v.delete(M),g.current.delete(M)):v.get(M)!==!0&&v.set(M,!1)}},[T,m.length,m.join("-")]);const D=[];if(f!==w){let I=[...f];for(let M=0;M<T.length;M++){const C=T[M],k=sx(C);m.includes(k)||(I.splice(M,0,C),D.push(C))}return s==="wait"&&D.length&&(I=D),L(DF(I)),A(f),null}const{forceRender:R}=V.useContext(l2);return S.jsx(S.Fragment,{children:T.map(I=>{const M=sx(I),C=o&&!u?!1:f===T||m.includes(M),k=()=>{if(g.current.has(M))return;if(v.has(M))g.current.add(M),v.set(M,!0);else return;let B=!0;v.forEach(O=>{O||(B=!1)}),B&&(R==null||R(),L(_.current),o&&(h==null||h()),i&&i())};return S.jsx(Uoe,{isPresent:C,initial:!y.current||t?void 0:!1,custom:e,presenceAffectsLayout:r,mode:s,root:c,onExitComplete:C?void 0:k,anchorX:a,anchorY:l,children:I},M)})})},D6=V.createContext({strict:!1}),LF={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let kF=!1;function zoe(){if(kF)return;const n={};for(const e in LF)n[e]={isEnabled:t=>LF[e].some(i=>!!t[i])};l6(n),kF=!0}function L6(){return zoe(),Cse()}function Hoe(n){const e=L6();for(const t in n)e[t]={...e[t],...n[t]};l6(e)}const Goe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function L1(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||Goe.has(n)}let k6=n=>!L1(n);function joe(n){typeof n=="function"&&(k6=e=>e.startsWith("on")?!L1(e):n(e))}try{joe(require("@emotion/is-prop-valid").default)}catch{}function Woe(n,e,t){const i={};for(const r in n)r==="values"&&typeof n.values=="object"||Cr(n[r])||(k6(r)||t===!0&&L1(r)||!e&&!L1(r)||n.draggable&&r.startsWith("onDrag"))&&(i[r]=n[r]);return i}const MA=V.createContext({});function Koe(n,e){if(CA(n)){const{initial:t,animate:i}=n;return{initial:t===!1||_0(t)?t:void 0,animate:_0(i)?i:void 0}}return n.inherit!==!1?e:{}}function Xoe(n){const{initial:e,animate:t}=Koe(n,V.useContext(MA));return V.useMemo(()=>({initial:e,animate:t}),[BF(e),BF(t)])}function BF(n){return Array.isArray(n)?n.join(" "):n}const B2=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function B6(n,e,t){for(const i in e)!Cr(e[i])&&!m6(i,t)&&(n[i]=e[i])}function qoe({transformTemplate:n},e){return V.useMemo(()=>{const t=B2();return D2(t,e,n),Object.assign({},t.vars,t.style)},[e])}function Yoe(n,e){const t=n.style||{},i={};return B6(i,t,n),Object.assign(i,qoe(n,e)),i}function $oe(n,e){const t={},i=Yoe(n,e);return n.drag&&n.dragListener!==!1&&(t.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(t.tabIndex=0),t.style=i,t}const O6=()=>({...B2(),attrs:{}});function Joe(n,e,t,i){const r=V.useMemo(()=>{const s=O6();return g6(s,e,v6(i),n.transformTemplate,n.style),{...s.attrs,style:{...s.style}}},[e]);if(n.style){const s={};B6(s,n.style,n),r.style={...s,...r.style}}return r}const Qoe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function O2(n){return typeof n!="string"||n.includes("-")?!1:!!(Qoe.indexOf(n)>-1||/[A-Z]/u.test(n))}function Zoe(n,e,t,{latestValues:i},r,s=!1,o){const l=(o??O2(n)?Joe:$oe)(e,i,r,n),c=Woe(e,typeof n=="string",s),u=n!==V.Fragment?{...c,...l,ref:t}:{},{children:h}=e,f=V.useMemo(()=>Cr(h)?h.get():h,[h]);return V.createElement(n,{...u,children:f})}function eae({scrapeMotionValuesFromProps:n,createRenderState:e},t,i,r){return{latestValues:tae(t,i,r,n),renderState:e()}}function tae(n,e,t,i){const r={},s=i(n,{});for(const f in s)r[f]=Dw(s[f]);let{initial:o,animate:a}=n;const l=CA(n),c=o6(n);e&&c&&!l&&n.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let u=t?t.initial===!1:!1;u=u||o===!1;const h=u?a:o;if(h&&typeof h!="boolean"&&!bA(h)){const f=Array.isArray(h)?h:[h];for(let m=0;m<f.length;m++){const y=T2(n,f[m]);if(y){const{transitionEnd:_,transition:v,...g}=y;for(const w in g){let A=g[w];if(Array.isArray(A)){const T=u?A.length-1:0;A=A[T]}A!==null&&(r[w]=A)}for(const w in _)r[w]=_[w]}}}return r}const F6=n=>(e,t)=>{const i=V.useContext(MA),r=V.useContext(SA),s=()=>eae(n,e,i,r);return t?s():c2(s)},nae=F6({scrapeMotionValuesFromProps:L2,createRenderState:B2}),iae=F6({scrapeMotionValuesFromProps:_6,createRenderState:O6}),rae=Symbol.for("motionComponentSymbol");function sae(n,e,t){const i=V.useRef(t);V.useInsertionEffect(()=>{i.current=t});const r=V.useRef(null);return V.useCallback(s=>{var a;s&&((a=n.onMount)==null||a.call(n,s));const o=i.current;if(typeof o=="function")if(s){const l=o(s);typeof l=="function"&&(r.current=l)}else r.current?(r.current(),r.current=null):o(s);else o&&(o.current=s);e&&(s?e.mount(s):e.unmount())},[e])}const U6=V.createContext({});function Wf(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function oae(n,e,t,i,r,s){var A,T;const{visualElement:o}=V.useContext(MA),a=V.useContext(D6),l=V.useContext(SA),c=V.useContext(k2),u=c.reducedMotion,h=c.skipAnimations,f=V.useRef(null),m=V.useRef(!1);i=i||a.renderer,!f.current&&i&&(f.current=i(n,{visualState:e,parent:o,props:t,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u,skipAnimations:h,isSVG:s}),m.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));const y=f.current,_=V.useContext(U6);y&&!y.projection&&r&&(y.type==="html"||y.type==="svg")&&aae(f.current,t,r,_);const v=V.useRef(!1);V.useInsertionEffect(()=>{y&&v.current&&y.update(t,l)});const g=t[X9],w=V.useRef(!!g&&typeof window<"u"&&!((A=window.MotionHandoffIsComplete)!=null&&A.call(window,g))&&((T=window.MotionHasOptimisedAnimation)==null?void 0:T.call(window,g)));return o9(()=>{m.current=!0,y&&(v.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),y.scheduleRenderMicrotask(),w.current&&y.animationState&&y.animationState.animateChanges())}),V.useEffect(()=>{y&&(!w.current&&y.animationState&&y.animationState.animateChanges(),w.current&&(queueMicrotask(()=>{var L;(L=window.MotionHandoffMarkAsComplete)==null||L.call(window,g)}),w.current=!1),y.enteringChildren=void 0)}),y}function aae(n,e,t,i){const{layoutId:r,layout:s,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:c,layoutCrossfade:u}=e;n.projection=new t(n.latestValues,e["data-framer-portal-id"]?void 0:V6(n.parent)),n.projection.setOptions({layoutId:r,layout:s,alwaysMeasureLayout:!!o||a&&Wf(a),visualElement:n,animationType:typeof s=="string"?s:"both",initialPromotionConfig:i,crossfade:u,layoutScroll:l,layoutRoot:c})}function V6(n){if(n)return n.options.allowProjection!==!1?n.projection:V6(n.parent)}function Tb(n,{forwardMotionProps:e=!1,type:t}={},i,r){i&&Hoe(i);const s=t?t==="svg":O2(n),o=s?iae:nae;function a(c,u){let h;const f={...V.useContext(k2),...c,layoutId:lae(c)},{isStatic:m}=f,y=Xoe(c),_=o(c,m);if(!m&&typeof window<"u"){cae();const v=uae(f);h=v.MeasureLayout,y.visualElement=oae(n,_,f,r,v.ProjectionNode,s)}return S.jsxs(MA.Provider,{value:y,children:[h&&y.visualElement?S.jsx(h,{visualElement:y.visualElement,...f}):null,Zoe(n,c,sae(_,y.visualElement,u),_,m,e,s)]})}a.displayName=`motion.${typeof n=="string"?n:`create(${n.displayName??n.name??""})`}`;const l=V.forwardRef(a);return l[rae]=n,l}function lae({layoutId:n}){const e=V.useContext(l2).id;return e&&n!==void 0?e+"-"+n:n}function cae(n,e){V.useContext(D6).strict}function uae(n){const e=L6(),{drag:t,layout:i}=e;if(!t&&!i)return{};const r={...t,...i};return{MeasureLayout:t!=null&&t.isEnabled(n)||i!=null&&i.isEnabled(n)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function hae(n,e){if(typeof Proxy>"u")return Tb;const t=new Map,i=(s,o)=>Tb(s,o,n,e),r=(s,o)=>i(s,o);return new Proxy(r,{get:(s,o)=>o==="create"?i:(t.has(o)||t.set(o,Tb(o,void 0,n,e)),t.get(o))})}const dae=(n,e)=>e.isSVG??O2(n)?new jse(e):new Fse(e,{allowProjection:n!==V.Fragment});class fae extends Xu{constructor(e){super(e),e.animationState||(e.animationState=Yse(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();bA(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let pae=0;class mae extends Xu{constructor(){super(...arguments),this.id=pae++,this.isExitComplete=!1}update(){var s;if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;if(e&&i===!1){if(this.isExitComplete){const{initial:o,custom:a}=this.node.getProps();if(typeof o=="string"){const l=md(this.node,o,a);if(l){const{transition:c,transitionEnd:u,...h}=l;for(const f in h)(s=this.node.getValue(f))==null||s.jump(h[f])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const r=this.node.animationState.setActive("exit",!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const gae={animation:{Feature:fae},exit:{Feature:mae}};function uv(n){return{point:{x:n.pageX,y:n.pageY}}}const yae=n=>e=>I2(e)&&n(e,uv(e));function Iy(n,e,t,i){return x0(n,e,yae(t),i)}const z6=({current:n})=>n?n.ownerDocument.defaultView:null,OF=(n,e)=>Math.abs(n-e);function vae(n,e){const t=OF(n.x,e.x),i=OF(n.y,e.y);return Math.sqrt(t**2+i**2)}const FF=new Set(["auto","scroll"]);class H6{constructor(e,t,{transformPagePoint:i,contextWindow:r=window,dragSnapToOrigin:s=!1,distanceThreshold:o=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=m=>{this.handleScroll(m.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=ox(this.lastRawMoveEventInfo,this.transformPagePoint));const m=bb(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,_=vae(m.offset,{x:0,y:0})>=this.distanceThreshold;if(!y&&!_)return;const{point:v}=m,{timestamp:g}=Sr;this.history.push({...v,timestamp:g});const{onStart:w,onMove:A}=this.handlers;y||(w&&w(this.lastMoveEvent,m),this.startEvent=this.lastMoveEvent),A&&A(this.lastMoveEvent,m)},this.handlePointerMove=(m,y)=>{this.lastMoveEvent=m,this.lastRawMoveEventInfo=y,this.lastMoveEventInfo=ox(y,this.transformPagePoint),si.update(this.updatePoint,!0)},this.handlePointerUp=(m,y)=>{this.end();const{onEnd:_,onSessionEnd:v,resumeAnimation:g}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&g&&g(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=bb(m.type==="pointercancel"?this.lastMoveEventInfo:ox(y,this.transformPagePoint),this.history);this.startEvent&&_&&_(m,w),v&&v(m,w)},!I2(e))return;this.dragSnapToOrigin=s,this.handlers=t,this.transformPagePoint=i,this.distanceThreshold=o,this.contextWindow=r||window;const l=uv(e),c=ox(l,this.transformPagePoint),{point:u}=c,{timestamp:h}=Sr;this.history=[{...u,timestamp:h}];const{onSessionStart:f}=t;f&&f(e,bb(c,this.history)),this.removeListeners=av(Iy(this.contextWindow,"pointermove",this.handlePointerMove),Iy(this.contextWindow,"pointerup",this.handlePointerUp),Iy(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(e){let t=e.parentElement;for(;t;){const i=getComputedStyle(t);(FF.has(i.overflowX)||FF.has(i.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const i=e===window,r=i?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},s={x:r.x-t.x,y:r.y-t.y};s.x===0&&s.y===0||(i?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s.x,this.lastMoveEventInfo.point.y+=s.y):this.history.length>0&&(this.history[0].x-=s.x,this.history[0].y-=s.y),this.scrollPositions.set(e,r),si.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Nu(this.updatePoint)}}function ox(n,e){return e?{point:e(n.point)}:n}function UF(n,e){return{x:n.x-e.x,y:n.y-e.y}}function bb({point:n},e){return{point:n,delta:UF(n,G6(e)),offset:UF(n,_ae(e)),velocity:xae(e,.1)}}function _ae(n){return n[0]}function G6(n){return n[n.length-1]}function xae(n,e){if(n.length<2)return{x:0,y:0};let t=n.length-1,i=null;const r=G6(n);for(;t>=0&&(i=n[t],!(r.timestamp-i.timestamp>Hs(e)));)t--;if(!i)return{x:0,y:0};i===n[0]&&n.length>2&&r.timestamp-i.timestamp>Hs(e)*2&&(i=n[1]);const s=ko(r.timestamp-i.timestamp);if(s===0)return{x:0,y:0};const o={x:(r.x-i.x)/s,y:(r.y-i.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function wae(n,{min:e,max:t},i){return e!==void 0&&n<e?n=i?wi(e,n,i.min):Math.max(n,e):t!==void 0&&n>t&&(n=i?wi(t,n,i.max):Math.min(n,t)),n}function VF(n,e,t){return{min:e!==void 0?n.min+e:void 0,max:t!==void 0?n.max+t-(n.max-n.min):void 0}}function Eae(n,{top:e,left:t,bottom:i,right:r}){return{x:VF(n.x,t,r),y:VF(n.y,e,i)}}function zF(n,e){let t=e.min-n.min,i=e.max-n.max;return e.max-e.min<n.max-n.min&&([t,i]=[i,t]),{min:t,max:i}}function Aae(n,e){return{x:zF(n.x,e.x),y:zF(n.y,e.y)}}function Sae(n,e){let t=.5;const i=ws(n),r=ws(e);return r>i?t=y0(e.min,e.max-i,n.min):i>r&&(t=y0(n.min,n.max-r,e.min)),rl(0,1,t)}function Tae(n,e){const t={};return e.min!==void 0&&(t.min=e.min-n.min),e.max!==void 0&&(t.max=e.max-n.min),t}const DI=.35;function bae(n=DI){return n===!1?n=0:n===!0&&(n=DI),{x:HF(n,"left","right"),y:HF(n,"top","bottom")}}function HF(n,e,t){return{min:GF(n,e),max:GF(n,t)}}function GF(n,e){return typeof n=="number"?n:n[e]||0}const Cae=new WeakMap;class Mae{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=tr(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:i}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=h=>{t&&this.snapToCursor(uv(h).point),this.stopAnimation()},o=(h,f)=>{const{drag:m,dragPropagation:y,onDragStart:_}=this.getProps();if(m&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=ise(m),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ka(g=>{let w=this.getAxisMotionValue(g).get()||0;if(Xa.test(w)){const{projection:A}=this.visualElement;if(A&&A.layout){const T=A.layout.layoutBox[g];T&&(w=ws(T)*(parseFloat(w)/100))}}this.originPoint[g]=w}),_&&si.update(()=>_(h,f),!1,!0),SI(this.visualElement,"transform");const{animationState:v}=this.visualElement;v&&v.setActive("whileDrag",!0)},a=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f;const{dragPropagation:m,dragDirectionLock:y,onDirectionLock:_,onDrag:v}=this.getProps();if(!m&&!this.openDragLock)return;const{offset:g}=f;if(y&&this.currentDirection===null){this.currentDirection=Rae(g),this.currentDirection!==null&&_&&_(this.currentDirection);return}this.updateAxis("x",f.point,g),this.updateAxis("y",f.point,g),this.visualElement.render(),v&&si.update(()=>v(h,f),!1,!0)},l=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f,this.stop(h,f),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{const{dragSnapToOrigin:h}=this.getProps();(h||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:u}=this.getProps();this.panSession=new H6(e,{onSessionStart:s,onStart:o,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:i,contextWindow:z6(this.visualElement),element:this.visualElement.current})}stop(e,t){const i=e||this.latestPointerEvent,r=t||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!r||!i)return;const{velocity:o}=r;this.startAnimation(o);const{onDragEnd:a}=this.getProps();a&&si.postRender(()=>a(i,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,i){const{drag:r}=this.getProps();if(!i||!ax(e,r,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(o=wae(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var s;const{dragConstraints:e,dragElastic:t}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)==null?void 0:s.layout,r=this.constraints;e&&Wf(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&i?this.constraints=Eae(i.layoutBox,e):this.constraints=!1,this.elastic=bae(t),r!==this.constraints&&!Wf(e)&&i&&this.constraints&&!this.hasMutatedConstraints&&ka(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=Tae(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Wf(e))return!1;const i=e.current;rm(i!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const s=Nse(i,r.root,this.visualElement.getTransformPagePoint());let o=Aae(r.layout.layoutBox,s);if(t){const a=t(Ise(o));this.hasMutatedConstraints=!!a,a&&(o=u6(a))}return o}startAnimation(e){const{drag:t,dragMomentum:i,dragElastic:r,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=ka(u=>{if(!ax(u,t,this.currentDirection))return;let h=l&&l[u]||{};(o===!0||o===u)&&(h={min:0,max:0});const f=r?200:1e6,m=r?40:1e7,y={type:"inertia",velocity:i?e[u]:0,bounceStiffness:f,bounceDamping:m,timeConstant:750,restDelta:1,restSpeed:10,...s,...h};return this.startAxisValueAnimation(u,y)});return Promise.all(c).then(a)}startAxisValueAnimation(e,t){const i=this.getAxisMotionValue(e);return SI(this.visualElement,e),i.start(S2(e,i,0,t,this.visualElement,!1))}stopAnimation(){ka(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,i=this.visualElement.getProps(),r=i[t];return r||this.visualElement.getValue(e,(i.initial?i.initial[e]:void 0)||0)}snapToCursor(e){ka(t=>{const{drag:i}=this.getProps();if(!ax(t,i,this.currentDirection))return;const{projection:r}=this.visualElement,s=this.getAxisMotionValue(t);if(r&&r.layout){const{min:o,max:a}=r.layout.layoutBox[t],l=s.get()||0;s.set(e[t]-wi(o,a,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:i}=this.visualElement;if(!Wf(t)||!i||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};ka(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();r[o]=Sae({min:l,max:l},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.constraints=!1,this.resolveConstraints(),ka(o=>{if(!ax(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:c}=this.constraints[o];a.set(wi(l,c,r[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Cae.set(this.visualElement,this);const e=this.visualElement.current,t=Iy(e,"pointerdown",c=>{const{drag:u,dragListener:h=!0}=this.getProps(),f=c.target,m=f!==e&&cse(f);u&&h&&!m&&this.start(c)});let i;const r=()=>{const{dragConstraints:c}=this.getProps();Wf(c)&&c.current&&(this.constraints=this.resolveRefConstraints(),i||(i=Iae(e,c.current,()=>this.scalePositionWithinConstraints())))},{projection:s}=this.visualElement,o=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),si.read(r);const a=x0(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(ka(h=>{const f=this.getAxisMotionValue(h);f&&(this.originPoint[h]+=c[h].translate,f.set(f.get()+c[h].translate))}),this.visualElement.render())});return()=>{a(),t(),o(),l&&l(),i&&i()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:i=!1,dragPropagation:r=!1,dragConstraints:s=!1,dragElastic:o=DI,dragMomentum:a=!0}=e;return{...e,drag:t,dragDirectionLock:i,dragPropagation:r,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function jF(n){let e=!0;return()=>{if(e){e=!1;return}n()}}function Iae(n,e,t){const i=JO(n,jF(t)),r=JO(e,jF(t));return()=>{i(),r()}}function ax(n,e,t){return(e===!0||e===n)&&(t===null||t===n)}function Rae(n,e=10){let t=null;return Math.abs(n.y)>e?t="y":Math.abs(n.x)>e&&(t="x"),t}class Pae extends Xu{constructor(e){super(e),this.removeGroupControls=Uo,this.removeListeners=Uo,this.controls=new Mae(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Uo}update(){const{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Cb=n=>(e,t)=>{n&&si.update(()=>n(e,t),!1,!0)};class Nae extends Xu{constructor(){super(...arguments),this.removePointerDownListener=Uo}onPointerDown(e){this.session=new H6(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:z6(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:i,onPanEnd:r}=this.node.getProps();return{onSessionStart:Cb(e),onStart:Cb(t),onMove:Cb(i),onEnd:(s,o)=>{delete this.session,r&&si.postRender(()=>r(s,o))}}}mount(){this.removePointerDownListener=Iy(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Mb=!1;class Dae extends V.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:i,layoutId:r}=this.props,{projection:s}=e;s&&(t.group&&t.group.add(s),i&&i.register&&r&&i.register(s),Mb&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Lw.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:i,drag:r,isPresent:s}=this.props,{projection:o}=i;return o&&(o.isPresent=s,e.layoutDependency!==t&&o.setOptions({...o.options,layoutDependency:t}),Mb=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==s?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||si.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),M2.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:i}=this.props,{projection:r}=e;Mb=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),i&&i.deregister&&i.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function j6(n){const[e,t]=N6(),i=V.useContext(l2);return S.jsx(Dae,{...n,layoutGroup:i,switchLayoutGroup:V.useContext(U6),isPresent:e,safeToRemove:t})}const Lae={pan:{Feature:Nae},drag:{Feature:Pae,ProjectionNode:P6,MeasureLayout:j6}};function WF(n,e,t){const{props:i}=n;n.animationState&&i.whileHover&&n.animationState.setActive("whileHover",t==="Start");const r="onHover"+t,s=i[r];s&&si.postRender(()=>s(e,uv(e)))}class kae extends Xu{mount(){const{current:e}=this.node;e&&(this.unmount=sse(e,(t,i)=>(WF(this.node,i,"Start"),r=>WF(this.node,r,"End"))))}unmount(){}}class Bae extends Xu{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=av(x0(this.node.current,"focus",()=>this.onFocus()),x0(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function KF(n,e,t){const{props:i}=n;if(n.current instanceof HTMLButtonElement&&n.current.disabled)return;n.animationState&&i.whileTap&&n.animationState.setActive("whileTap",t==="Start");const r="onTap"+(t==="End"?"":t),s=i[r];s&&si.postRender(()=>s(e,uv(e)))}class Oae extends Xu{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:i}=this.node.props;this.unmount=hse(e,(r,s)=>(KF(this.node,s,"Start"),(o,{success:a})=>KF(this.node,o,a?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:(i==null?void 0:i.tap)===!1})}unmount(){}}const LI=new WeakMap,Ib=new WeakMap,Fae=n=>{const e=LI.get(n.target);e&&e(n)},Uae=n=>{n.forEach(Fae)};function Vae({root:n,...e}){const t=n||document;Ib.has(t)||Ib.set(t,{});const i=Ib.get(t),r=JSON.stringify(e);return i[r]||(i[r]=new IntersectionObserver(Uae,{root:n,...e})),i[r]}function zae(n,e,t){const i=Vae(e);return LI.set(n,t),i.observe(n),()=>{LI.delete(n),i.unobserve(n)}}const Hae={some:0,all:1};class Gae extends Xu{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:t,margin:i,amount:r="some",once:s}=e,o={root:t?t.current:void 0,rootMargin:i,threshold:typeof r=="number"?r:Hae[r]},a=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,s&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:u,onViewportLeave:h}=this.node.getProps(),f=c?u:h;f&&f(l)};return zae(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(jae(e,t))&&this.startObserver()}unmount(){}}function jae({viewport:n={}},{viewport:e={}}={}){return t=>n[t]!==e[t]}const Wae={inView:{Feature:Gae},tap:{Feature:Oae},focus:{Feature:Bae},hover:{Feature:kae}},Kae={layout:{ProjectionNode:P6,MeasureLayout:j6}},Xae={...gae,...Wae,...Lae,...Kae},Le=hae(Xae,dae),qae="https://cdn.discordapp.com/attachments/1475095229186179095/1475153775680557340/Untitled17_20250215003249.png?ex=699c7383&is=699b2203&hm=339648575ff0039eb743f8bee6cd3b53b3a428419ddfb64e0b56f61d6e801320&",Yae=({size:n=24,active:e=!1})=>S.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:e?"url(#red-grad)":"url(#grey-grad)",stroke:"none",children:S.jsx("path",{d:"M3 12.5L12 4l9 8.5V20a1 1 0 01-1 1h-5v-5a1 1 0 00-1-1h-2a1 1 0 00-1 1v5H6a1 1 0 01-1-1v-7.5z"})}),$ae=({size:n=24,active:e=!1})=>S.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:e?"url(#red-grad)":"url(#grey-grad)",strokeWidth:2.5,strokeLinecap:"round",children:[S.jsx("circle",{cx:"10.5",cy:"10.5",r:"6.5",fill:e?"url(#red-grad)":"none",fillOpacity:e?.15:0}),S.jsx("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),S.jsx("line",{x1:"15.5",y1:"15.5",x2:"21",y2:"21"})]}),Jae=({size:n=24,active:e=!1})=>S.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:e?"url(#red-grad)":"url(#grey-grad)",stroke:"none",children:S.jsx("path",{d:"M21 12a9 9 0 01-9 9 8.96 8.96 0 01-4.9-1.45L3 21l1.45-4.1A8.96 8.96 0 013 12a9 9 0 0118 0z"})}),Qae=({size:n=24,active:e=!1})=>S.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:e?"url(#red-grad)":"url(#grey-grad)",stroke:"none",children:[S.jsx("path",{d:"M12 15a3 3 0 100-6 3 3 0 000 6z"}),S.jsx("path",{d:"M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 01-2.83 2.83l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-4 0v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83-2.83l.06-.06A1.65 1.65 0 004.68 15a1.65 1.65 0 00-1.51-1H3a2 2 0 010-4h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 012.83-2.83l.06.06A1.65 1.65 0 009 4.68a1.65 1.65 0 001-1.51V3a2 2 0 014 0v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 2.83l-.06.06A1.65 1.65 0 0019.32 9a1.65 1.65 0 001.51 1H21a2 2 0 010 4h-.09a1.65 1.65 0 00-1.51 1z"})]}),Zae=[{id:"home",icon:Yae},{id:"search",icon:$ae},{id:"chat",icon:Jae},{id:"settings",icon:Qae}],ele=({activeTab:n,onTabChange:e})=>{const[t,i]=at.useState(!1);return S.jsxs(S.Fragment,{children:[S.jsx("svg",{width:"0",height:"0",className:"absolute pointer-events-none",children:S.jsxs("defs",{children:[S.jsxs("linearGradient",{id:"grey-grad",x1:"0%",y1:"100%",x2:"100%",y2:"0%",children:[S.jsx("stop",{offset:"0%",stopColor:"#94a3b8"}),S.jsx("stop",{offset:"100%",stopColor:"#cbd5e1"})]}),S.jsxs("linearGradient",{id:"red-grad",x1:"0%",y1:"100%",x2:"100%",y2:"0%",children:[S.jsx("stop",{offset:"0%",stopColor:"#ef4444"}),S.jsx("stop",{offset:"100%",stopColor:"#fca5a5"})]})]})}),S.jsxs("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50 flex items-center gap-3 w-full justify-center px-4",children:[S.jsx(Le.div,{layout:!0,className:"relative flex items-center rounded-[28px] glass-surface shadow-elevated overflow-hidden",style:{boxShadow:"0 8px 32px -8px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.8)"},children:S.jsx("div",{className:"flex items-center gap-1.5 px-5 py-3",children:Zae.map(r=>{const s=n===r.id,o=r.icon;return S.jsxs("button",{onClick:()=>e(r.id),className:"relative flex-shrink-0 w-[52px] h-[52px] flex items-center justify-center rounded-2xl transition-all duration-500",children:[s&&S.jsx(Le.div,{layoutId:"nav-pill",className:"absolute inset-0 bg-card/90 shadow-sm rounded-2xl z-0",transition:{type:"spring",bounce:.35,duration:.6}}),S.jsx("div",{className:"relative z-10",children:S.jsx(o,{size:24,active:s})})]},r.id)})})}),S.jsxs(Le.button,{onClick:()=>e("avatar"),whileHover:{scale:1.05,y:-3},whileTap:{scale:.95,y:0},className:"relative flex-shrink-0 focus:outline-none",children:[n==="avatar"&&S.jsx(Le.div,{layoutId:"avatar-glow",className:"absolute inset-0 bg-primary/30 blur-2xl rounded-full"}),S.jsx("div",{className:"relative flex items-center justify-center w-[66px] h-[66px] rounded-full glass-avatar shadow-elevated overflow-hidden",style:{boxShadow:"0 8px 24px -6px rgba(0,0,0,0.15)"},children:S.jsx("div",{className:`w-full h-full p-[2px] transition-all duration-500 rounded-full ${n==="avatar"?"bg-gradient-to-tr from-primary to-primary/60":"bg-transparent"}`,children:S.jsx("div",{className:"w-full h-full rounded-full overflow-hidden",children:t?S.jsx("div",{className:"w-full h-full bg-secondary flex items-center justify-center",children:S.jsx(qP,{size:24,stroke:"url(#grey-grad)"})}):S.jsx("img",{src:qae,alt:"Avatar",onError:()=>i(!0),className:"w-full h-full object-cover select-none pointer-events-none"})})})})]})]})]})},tle="https://file.garden/aS2_Au6dLxrEuvxH/IMG_6788.png",nle=[{id:1,title:"Dynamite",image:"https://file.garden/aS2_Au6dLxrEuvxH/Cubic/983a8c9d-a658-47e0-8d9d-ef2be734cb05.jpeg",players:"12.5k",likes:"98%",desc:"The ultimate explosive sports arena.",icon:Ty,badge:"NEW"},{id:3,title:"Sky Wars",image:"https://file.garden/aS2_Au6dLxrEuvxH/Cubic/983a8c9d-a658-47e0-8d9d-ef2be734cb05.jpeg",players:"5.2k",likes:"91%",desc:"Battle in the skies for ultimate glory.",icon:VQ,badge:"SEASON 2"},{id:4,title:"Alien Arena",image:"https://file.garden/aS2_Au6dLxrEuvxH/Cubic/a48c612e-71b8-4605-ad98-abf09a4d8e12.jpeg",players:"3.8k",likes:"89%",desc:"Fight alien invaders in this sci-fi shooter!",icon:DQ},{id:5,title:"Sky Realms",image:"https://file.garden/aS2_Au6dLxrEuvxH/Cubic/DCE5F85A-6F03-4FC8-B705-C42B37479506.jpeg",players:"6.7k",likes:"93%",desc:"Explore floating kingdoms above the clouds.",icon:IQ,badge:"UPDATE"},{id:6,title:"Crystal Conquest",image:"https://file.garden/aS2_Au6dLxrEuvxH/Cubic/983a8c9d-a658-47e0-8d9d-ef2be734cb05.jpeg",players:"4.1k",likes:"90%",desc:"Mine crystals and dominate the leaderboard.",icon:fd},{id:7,title:"Fortress",image:"https://file.garden/aS2_Au6dLxrEuvxH/Cubic/a48c612e-71b8-4605-ad98-abf09a4d8e12.jpeg",players:"7.3k",likes:"95%",desc:"Build and defend your ultimate fortress.",icon:Dl}],ile=["Recommended","Popular","New","Updated"],rle=({title:n,onDone:e})=>{const[t,i]=V.useState(0);return V.useEffect(()=>{const r=setInterval(()=>{i(s=>{const o=s+Math.floor(Math.random()*8)+2;return o>=100?(clearInterval(r),setTimeout(e,300),100):o})},120);return()=>clearInterval(r)},[e]),S.jsxs(Le.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[80] bg-background flex flex-col items-center justify-center",children:[S.jsx(Le.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},className:"w-10 h-10 border-3 border-border border-t-primary rounded-full mb-4"}),S.jsx("p",{className:"text-sm font-bold text-foreground mb-1",children:n}),S.jsx("p",{className:"text-[10px] text-muted-foreground mb-6",children:"Please wait..."}),S.jsxs("div",{className:"fixed bottom-0 left-0 right-0 bg-card border-t border-border px-5 py-4",children:[S.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[S.jsx("p",{className:"text-[11px] font-bold text-foreground",children:"Loading Game Assets:"}),S.jsxs("p",{className:"text-[11px] font-bold text-primary",children:[t,"%"]})]}),S.jsx("div",{className:"w-full h-2.5 bg-secondary rounded-full overflow-hidden",children:S.jsx(Le.div,{className:"h-full rounded-full bg-primary",animate:{width:`${t}%`},transition:{ease:"linear",duration:.1}})})]})]})},sle=({game:n,onClose:e})=>{const[t,i]=V.useState("public"),[r,s]=V.useState(!1),[o,a]=V.useState(!1);return V.useEffect(()=>{const l=c=>{var u;((u=c.data)==null?void 0:u.type)==="game-exit"&&a(!1)};return window.addEventListener("message",l),()=>window.removeEventListener("message",l)},[]),o?S.jsx(Le.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[100] bg-black",children:S.jsx("iframe",{src:"/game/index.html",className:"w-full h-full border-0",allow:"autoplay; fullscreen",title:"Game"})}):S.jsxs(S.Fragment,{children:[S.jsxs(Le.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:{type:"spring",bounce:.08,duration:.45},className:"fixed inset-0 z-[60] bg-card flex flex-col",children:[S.jsxs("div",{className:"relative h-[38%] overflow-hidden flex-shrink-0",children:[S.jsx("img",{src:n.image,alt:n.title,className:"w-full h-full object-cover"}),S.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-card via-card/30 to-transparent"}),S.jsx(Le.button,{whileTap:{scale:.85},onClick:e,className:"absolute top-10 left-4 w-8 h-8 bg-card/80 backdrop-blur-sm rounded-lg flex items-center justify-center shadow-md",children:S.jsx(Im,{size:15,className:"text-foreground"})})]}),S.jsxs("div",{className:"flex-1 px-5 pt-4 pb-3 flex flex-col overflow-y-auto",children:[S.jsx("h2",{className:"text-xl font-black text-foreground mb-1",children:n.title}),S.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed mb-4",children:n.desc}),S.jsx("div",{className:"flex gap-2.5 mb-4",children:[{icon:fA,value:n.players,label:"Players",color:"text-muted-foreground"},{icon:su,value:n.likes,label:"Likes",color:"text-primary"}].map(l=>S.jsxs("div",{className:"flex items-center gap-1.5 bg-secondary rounded-xl px-3 py-2",children:[S.jsx(l.icon,{size:13,className:l.color}),S.jsxs("div",{children:[S.jsx("p",{className:"text-xs font-bold text-foreground",children:l.value}),S.jsx("p",{className:"text-[8px] text-muted-foreground uppercase",children:l.label})]})]},l.label))}),S.jsxs("div",{className:"mb-4",children:[S.jsx("p",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-wider mb-2",children:"Server Type"}),S.jsx("div",{className:"flex gap-2",children:["public","private"].map(l=>S.jsxs("button",{onClick:()=>i(l),className:`flex-1 flex items-center justify-center gap-1.5 py-2.5 rounded-xl text-xs font-bold transition-all border ${t===l?"bg-primary/10 border-primary/30 text-primary":"bg-secondary border-border/50 text-muted-foreground"}`,children:[l==="public"?S.jsx(v1,{size:13}):S.jsx(_1,{size:13}),l==="public"?"Public":"Private"]},l))}),t==="private"&&S.jsxs(Le.p,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},className:"text-[10px] text-muted-foreground mt-1.5 flex items-center gap-1",children:[S.jsx(kQ,{size:10})," Only invited players can join"]})]})]}),S.jsx("div",{className:"px-5 pb-10 pt-2 flex-shrink-0",children:S.jsxs(Le.button,{whileTap:{scale:.95},onClick:()=>s(!0),className:"w-full py-3.5 rounded-xl text-primary-foreground font-black uppercase flex items-center justify-center gap-2 text-sm bg-primary shadow-[0_6px_20px_-4px_hsl(var(--glow-red))]",children:[S.jsx(PQ,{size:18,className:"fill-current"})," PLAY NOW"]})})]}),S.jsx(Gs,{children:r&&S.jsx(rle,{title:n.title,onDone:()=>{s(!1),a(!0)}})})]})},ole=({onGameModalChange:n})=>{const[e,t]=V.useState("Recommended"),[i,r]=V.useState(null);return V.useEffect(()=>{n==null||n(!!i)},[i,n]),S.jsxs("div",{className:"flex flex-col min-h-full pb-32 relative",children:[S.jsxs("header",{className:"sticky top-0 z-40 bg-card/80 backdrop-blur-md px-4 py-3 flex items-center justify-between border-b border-border/50",style:{boxShadow:"0 4px 20px -4px rgba(0,0,0,0.06)"},children:[S.jsx("div",{className:"flex gap-2",children:S.jsxs("div",{className:"flex items-center bg-secondary rounded-full px-2.5 py-1.5 gap-1.5",style:{boxShadow:"0 2px 8px -2px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.6)"},children:[S.jsx("img",{src:tle,className:"w-4 h-4 object-contain",alt:"Coins"}),S.jsx("span",{className:"text-[11px] font-black text-foreground",children:"1,250"}),S.jsx("div",{className:"w-5 h-5 rounded-full bg-primary flex items-center justify-center shadow-[0_2px_6px_-1px_hsl(var(--glow-red))]",children:S.jsx(NQ,{size:11,className:"text-primary-foreground",strokeWidth:3})})]})}),S.jsx("div",{className:"flex items-center gap-3",children:S.jsx(Ay,{size:18,className:"text-primary"})})]}),S.jsx("div",{className:"px-4 mt-4",children:S.jsxs("div",{className:"relative w-full aspect-[2.5/1] rounded-2xl overflow-hidden border border-border/40",style:{boxShadow:"0 12px 32px -8px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.8)"},children:[S.jsx("img",{src:"https://file.garden/aS2_Au6dLxrEuvxH/Cubic/DCE5F85A-6F03-4FC8-B705-C42B37479506.jpeg",alt:"Banner",className:"w-full h-full object-cover"}),S.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-primary/60 via-primary/20 to-transparent"}),S.jsx("div",{className:"absolute inset-0 flex items-center px-5",children:S.jsxs("div",{children:[S.jsx("p",{className:"text-[9px] font-bold text-primary-foreground/80 uppercase tracking-widest",children:"Season 2"}),S.jsx("h2",{className:"text-base font-black text-primary-foreground leading-tight",children:"New Update Live"}),S.jsx("p",{className:"text-[10px] text-primary-foreground/70 mt-0.5",children:"Check out what's new"})]})}),S.jsx("div",{className:"absolute top-2 right-2 bg-destructive rounded-full px-2 py-0.5",children:S.jsx("span",{className:"text-[8px] text-primary-foreground font-black uppercase",children:"Live"})})]})}),S.jsx("div",{className:"mt-5 flex overflow-x-auto px-4 gap-5 no-scrollbar",children:ile.map(s=>S.jsx("button",{onClick:()=>t(s),className:`whitespace-nowrap text-[12px] font-bold transition-colors pb-1.5 ${e===s?"text-foreground border-b-2 border-primary":"text-muted-foreground"}`,children:s},s))}),S.jsxs("div",{className:"mt-5 px-4",children:[S.jsxs("div",{className:"flex items-center justify-between mb-2.5",children:[S.jsx("h2",{className:"text-sm font-extrabold text-foreground",children:"Recently played"}),S.jsx(vu,{size:16,className:"text-muted-foreground/40"})]}),S.jsx("div",{className:"flex gap-3",children:S.jsx("div",{className:"w-20 h-20 bg-secondary rounded-2xl flex items-center justify-center border border-border/30",style:{boxShadow:"0 4px 12px -4px rgba(0,0,0,0.06)"},children:S.jsx(Ay,{size:24,className:"text-muted-foreground/30"})})})]}),S.jsxs("div",{className:"mt-6 px-4",children:[S.jsxs("div",{className:"flex items-center justify-between mb-3",children:[S.jsxs("h2",{className:"text-sm font-extrabold text-foreground flex items-center gap-1.5",children:[S.jsx(Ay,{size:14,className:"text-primary"})," Minigames"]}),S.jsx(vu,{size:16,className:"text-muted-foreground/40"})]}),S.jsx("div",{className:"grid grid-cols-3 gap-3",children:nle.map((s,o)=>S.jsxs(Le.button,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:o*.05},whileTap:{scale:.93},onClick:()=>r(s),className:"flex flex-col gap-1 text-left",children:[S.jsxs("div",{className:"relative aspect-square rounded-xl overflow-hidden border border-border/30",style:{boxShadow:"0 6px 20px -6px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.6)"},children:[S.jsx("img",{src:s.image,className:"w-full h-full object-cover",alt:s.title}),S.jsx("div",{className:"absolute top-1 left-1 bg-primary/80 backdrop-blur-sm rounded-md p-1",children:S.jsx(s.icon,{size:10,className:"text-primary-foreground"})}),s.badge&&S.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-foreground/40 backdrop-blur-sm px-1.5 py-0.5",children:S.jsx("span",{className:"text-[7px] text-primary-foreground font-black uppercase tracking-tight truncate block",children:s.badge})})]}),S.jsx("h3",{className:"text-[11px] font-bold text-foreground truncate mt-0.5",children:s.title}),S.jsxs("div",{className:"flex items-center justify-between text-[9px] text-muted-foreground font-medium",children:[S.jsxs("div",{className:"flex items-center gap-0.5",children:[S.jsx(JM,{size:8,className:"text-primary fill-primary"}),S.jsx("span",{children:s.likes})]}),S.jsxs("div",{className:"flex items-center gap-0.5",children:[S.jsx(fA,{size:8,className:"text-muted-foreground"}),S.jsx("span",{children:s.players})]})]})]},s.id))})]}),S.jsx(Gs,{children:i&&S.jsx(sle,{game:i,onClose:()=>r(null)})}),S.jsx("style",{children:`
        .no-scrollbar::-webkit-scrollbar { display: none; }
        .no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
      `})]})};var XF={};/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const W6={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"};/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const yt=function(n,e){if(!n)throw Bm(e)},Bm=function(n){return new Error("Firebase Database ("+W6.SDK_VERSION+") INTERNAL ASSERT FAILED: "+n)};/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const K6=function(n){const e=[];let t=0;for(let i=0;i<n.length;i++){let r=n.charCodeAt(i);r<128?e[t++]=r:r<2048?(e[t++]=r>>6|192,e[t++]=r&63|128):(r&64512)===55296&&i+1<n.length&&(n.charCodeAt(i+1)&64512)===56320?(r=65536+((r&1023)<<10)+(n.charCodeAt(++i)&1023),e[t++]=r>>18|240,e[t++]=r>>12&63|128,e[t++]=r>>6&63|128,e[t++]=r&63|128):(e[t++]=r>>12|224,e[t++]=r>>6&63|128,e[t++]=r&63|128)}return e},ale=function(n){const e=[];let t=0,i=0;for(;t<n.length;){const r=n[t++];if(r<128)e[i++]=String.fromCharCode(r);else if(r>191&&r<224){const s=n[t++];e[i++]=String.fromCharCode((r&31)<<6|s&63)}else if(r>239&&r<365){const s=n[t++],o=n[t++],a=n[t++],l=((r&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[i++]=String.fromCharCode(55296+(l>>10)),e[i++]=String.fromCharCode(56320+(l&1023))}else{const s=n[t++],o=n[t++];e[i++]=String.fromCharCode((r&15)<<12|(s&63)<<6|o&63)}}return e.join("")},F2={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();const t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let r=0;r<n.length;r+=3){const s=n[r],o=r+1<n.length,a=o?n[r+1]:0,l=r+2<n.length,c=l?n[r+2]:0,u=s>>2,h=(s&3)<<4|a>>4;let f=(a&15)<<2|c>>6,m=c&63;l||(m=64,o||(f=64)),i.push(t[u],t[h],t[f],t[m])}return i.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(K6(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):ale(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let r=0;r<n.length;){const s=t[n.charAt(r++)],a=r<n.length?t[n.charAt(r)]:0;++r;const c=r<n.length?t[n.charAt(r)]:64;++r;const h=r<n.length?t[n.charAt(r)]:64;if(++r,s==null||a==null||c==null||h==null)throw new lle;const f=s<<2|a>>4;if(i.push(f),c!==64){const m=a<<4&240|c>>2;if(i.push(m),h!==64){const y=c<<6&192|h;i.push(y)}}}return i},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}};class lle extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const X6=function(n){const e=K6(n);return F2.encodeByteArray(e,!0)},k1=function(n){return X6(n).replace(/\./g,"")},B1=function(n){try{return F2.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function cle(n){return q6(void 0,n)}function q6(n,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:const t=e;return new Date(t.getTime());case Object:n===void 0&&(n={});break;case Array:n=[];break;default:return e}for(const t in e)!e.hasOwnProperty(t)||!ule(t)||(n[t]=q6(n[t],e[t]));return n}function ule(n){return n!=="__proto__"}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function hle(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const dle=()=>hle().__FIREBASE_DEFAULTS__,fle=()=>{if(typeof process>"u"||typeof XF>"u")return;const n=XF.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},ple=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&B1(n[1]);return e&&JSON.parse(e)},IA=()=>{try{return dle()||fle()||ple()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},Y6=n=>{var e,t;return(t=(e=IA())===null||e===void 0?void 0:e.emulatorHosts)===null||t===void 0?void 0:t[n]},$6=n=>{const e=Y6(n);if(!e)return;const t=e.lastIndexOf(":");if(t<=0||t+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const i=parseInt(e.substring(t+1),10);return e[0]==="["?[e.substring(1,t-1),i]:[e.substring(0,t),i]},J6=()=>{var n;return(n=IA())===null||n===void 0?void 0:n.config},Q6=n=>{var e;return(e=IA())===null||e===void 0?void 0:e[`_${n}`]};/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class U2{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,i)=>{t?this.reject(t):this.resolve(i),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,i))}}}/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Z6(n,e){if(n.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const t={alg:"none",type:"JWT"},i=e||"demo-project",r=n.iat||0,s=n.sub||n.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${i}`,aud:i,iat:r,exp:r+3600,auth_time:r,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}}},n);return[k1(JSON.stringify(t)),k1(JSON.stringify(o)),""].join(".")}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function rs(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function V2(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(rs())}function mle(){var n;const e=(n=IA())===null||n===void 0?void 0:n.forceEnvironment;if(e==="node")return!0;if(e==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function gle(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function yle(){const n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function ej(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function vle(){const n=rs();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function tj(){return W6.NODE_ADMIN===!0}function _le(){return!mle()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function xle(){try{return typeof indexedDB=="object"}catch{return!1}}function wle(){return new Promise((n,e)=>{try{let t=!0;const i="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(i);r.onsuccess=()=>{r.result.close(),t||self.indexedDB.deleteDatabase(i),n(!0)},r.onupgradeneeded=()=>{t=!1},r.onerror=()=>{var s;e(((s=r.error)===null||s===void 0?void 0:s.message)||"")}}catch(t){e(t)}})}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Ele="FirebaseError";class fc extends Error{constructor(e,t,i){super(t),this.code=e,this.customData=i,this.name=Ele,Object.setPrototypeOf(this,fc.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,hv.prototype.create)}}class hv{constructor(e,t,i){this.service=e,this.serviceName=t,this.errors=i}create(e,...t){const i=t[0]||{},r=`${this.service}/${e}`,s=this.errors[e],o=s?Ale(s,i):"Error",a=`${this.serviceName}: ${o} (${r}).`;return new fc(r,a,i)}}function Ale(n,e){return n.replace(Sle,(t,i)=>{const r=e[i];return r!=null?String(r):`<${i}?>`})}const Sle=/\{\$([^}]+)}/g;/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function w0(n){return JSON.parse(n)}function Tr(n){return JSON.stringify(n)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const nj=function(n){let e={},t={},i={},r="";try{const s=n.split(".");e=w0(B1(s[0])||""),t=w0(B1(s[1])||""),r=s[2],i=t.d||{},delete t.d}catch{}return{header:e,claims:t,data:i,signature:r}},Tle=function(n){const e=nj(n),t=e.claims;return!!t&&typeof t=="object"&&t.hasOwnProperty("iat")},ble=function(n){const e=nj(n).claims;return typeof e=="object"&&e.admin===!0};/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function pc(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function am(n,e){if(Object.prototype.hasOwnProperty.call(n,e))return n[e]}function kI(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function O1(n,e,t){const i={};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(i[r]=e.call(t,n[r],r,n));return i}function F1(n,e){if(n===e)return!0;const t=Object.keys(n),i=Object.keys(e);for(const r of t){if(!i.includes(r))return!1;const s=n[r],o=e[r];if(qF(s)&&qF(o)){if(!F1(s,o))return!1}else if(s!==o)return!1}for(const r of i)if(!t.includes(r))return!1;return!0}function qF(n){return n!==null&&typeof n=="object"}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Om(n){const e=[];for(const[t,i]of Object.entries(n))Array.isArray(i)?i.forEach(r=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(r))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(i));return e.length?"&"+e.join("&"):""}function ry(n){const e={};return n.replace(/^\?/,"").split("&").forEach(i=>{if(i){const[r,s]=i.split("=");e[decodeURIComponent(r)]=decodeURIComponent(s)}}),e}function sy(n){const e=n.indexOf("?");if(!e)return"";const t=n.indexOf("#",e);return n.substring(e,t>0?t:void 0)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Cle{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=512/8,this.pad_[0]=128;for(let e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(e,t){t||(t=0);const i=this.W_;if(typeof e=="string")for(let h=0;h<16;h++)i[h]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(let h=0;h<16;h++)i[h]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],t+=4;for(let h=16;h<80;h++){const f=i[h-3]^i[h-8]^i[h-14]^i[h-16];i[h]=(f<<1|f>>>31)&4294967295}let r=this.chain_[0],s=this.chain_[1],o=this.chain_[2],a=this.chain_[3],l=this.chain_[4],c,u;for(let h=0;h<80;h++){h<40?h<20?(c=a^s&(o^a),u=1518500249):(c=s^o^a,u=1859775393):h<60?(c=s&o|a&(s|o),u=2400959708):(c=s^o^a,u=3395469782);const f=(r<<5|r>>>27)+c+l+u+i[h]&4294967295;l=a,a=o,o=(s<<30|s>>>2)&4294967295,s=r,r=f}this.chain_[0]=this.chain_[0]+r&4294967295,this.chain_[1]=this.chain_[1]+s&4294967295,this.chain_[2]=this.chain_[2]+o&4294967295,this.chain_[3]=this.chain_[3]+a&4294967295,this.chain_[4]=this.chain_[4]+l&4294967295}update(e,t){if(e==null)return;t===void 0&&(t=e.length);const i=t-this.blockSize;let r=0;const s=this.buf_;let o=this.inbuf_;for(;r<t;){if(o===0)for(;r<=i;)this.compress_(e,r),r+=this.blockSize;if(typeof e=="string"){for(;r<t;)if(s[o]=e.charCodeAt(r),++o,++r,o===this.blockSize){this.compress_(s),o=0;break}}else for(;r<t;)if(s[o]=e[r],++o,++r,o===this.blockSize){this.compress_(s),o=0;break}}this.inbuf_=o,this.total_+=t}digest(){const e=[];let t=this.total_*8;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let r=this.blockSize-1;r>=56;r--)this.buf_[r]=t&255,t/=256;this.compress_(this.buf_);let i=0;for(let r=0;r<5;r++)for(let s=24;s>=0;s-=8)e[i]=this.chain_[r]>>s&255,++i;return e}}function Mle(n,e){const t=new Ile(n,e);return t.subscribe.bind(t)}class Ile{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(i=>{this.error(i)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,i){let r;if(e===void 0&&t===void 0&&i===void 0)throw new Error("Missing Observer.");Rle(e,["next","error","complete"])?r=e:r={next:e,error:t,complete:i},r.next===void 0&&(r.next=Rb),r.error===void 0&&(r.error=Rb),r.complete===void 0&&(r.complete=Rb);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch{}}),this.observers.push(r),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(i){typeof console<"u"&&console.error&&console.error(i)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function Rle(n,e){if(typeof n!="object"||n===null)return!1;for(const t of e)if(t in n&&typeof n[t]=="function")return!0;return!1}function Rb(){}function Ple(n,e){return`${n} failed: ${e} argument `}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Nle=function(n){const e=[];let t=0;for(let i=0;i<n.length;i++){let r=n.charCodeAt(i);if(r>=55296&&r<=56319){const s=r-55296;i++,yt(i<n.length,"Surrogate pair missing trail surrogate.");const o=n.charCodeAt(i)-56320;r=65536+(s<<10)+o}r<128?e[t++]=r:r<2048?(e[t++]=r>>6|192,e[t++]=r&63|128):r<65536?(e[t++]=r>>12|224,e[t++]=r>>6&63|128,e[t++]=r&63|128):(e[t++]=r>>18|240,e[t++]=r>>12&63|128,e[t++]=r>>6&63|128,e[t++]=r&63|128)}return e},RA=function(n){let e=0;for(let t=0;t<n.length;t++){const i=n.charCodeAt(t);i<128?e++:i<2048?e+=2:i>=55296&&i<=56319?(e+=4,t++):e+=3}return e};/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function zi(n){return n&&n._delegate?n._delegate:n}class Du{constructor(e,t,i){this.name=e,this.instanceFactory=t,this.type=i,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Oh="[DEFAULT]";/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let Dle=class{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const i=new U2;if(this.instancesDeferred.set(t,i),this.isInitialized(t)||this.shouldAutoInitialize())try{const r=this.getOrInitializeService({instanceIdentifier:t});r&&i.resolve(r)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const i=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),r=(t=e==null?void 0:e.optional)!==null&&t!==void 0?t:!1;if(this.isInitialized(i)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:i})}catch(s){if(r)return null;throw s}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(kle(e))try{this.getOrInitializeService({instanceIdentifier:Oh})}catch{}for(const[t,i]of this.instancesDeferred.entries()){const r=this.normalizeInstanceIdentifier(t);try{const s=this.getOrInitializeService({instanceIdentifier:r});i.resolve(s)}catch{}}}}clearInstance(e=Oh){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=Oh){return this.instances.has(e)}getOptions(e=Oh){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,i=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(i))throw Error(`${this.name}(${i}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const r=this.getOrInitializeService({instanceIdentifier:i,options:t});for(const[s,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(s);i===a&&o.resolve(r)}return r}onInit(e,t){var i;const r=this.normalizeInstanceIdentifier(t),s=(i=this.onInitCallbacks.get(r))!==null&&i!==void 0?i:new Set;s.add(e),this.onInitCallbacks.set(r,s);const o=this.instances.get(r);return o&&e(o,r),()=>{s.delete(e)}}invokeOnInitCallbacks(e,t){const i=this.onInitCallbacks.get(t);if(i)for(const r of i)try{r(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let i=this.instances.get(e);if(!i&&this.component&&(i=this.component.instanceFactory(this.container,{instanceIdentifier:Lle(e),options:t}),this.instances.set(e,i),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(i,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,i)}catch{}return i||null}normalizeInstanceIdentifier(e=Oh){return this.component?this.component.multipleInstances?e:Oh:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Lle(n){return n===Oh?void 0:n}function kle(n){return n.instantiationMode==="EAGER"}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Ble{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new Dle(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var Sn;(function(n){n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT"})(Sn||(Sn={}));const Ole={debug:Sn.DEBUG,verbose:Sn.VERBOSE,info:Sn.INFO,warn:Sn.WARN,error:Sn.ERROR,silent:Sn.SILENT},Fle=Sn.INFO,Ule={[Sn.DEBUG]:"log",[Sn.VERBOSE]:"log",[Sn.INFO]:"info",[Sn.WARN]:"warn",[Sn.ERROR]:"error"},Vle=(n,e,...t)=>{if(e<n.logLevel)return;const i=new Date().toISOString(),r=Ule[e];if(r)console[r](`[${i}]  ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class PA{constructor(e){this.name=e,this._logLevel=Fle,this._logHandler=Vle,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in Sn))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?Ole[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,Sn.DEBUG,...e),this._logHandler(this,Sn.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,Sn.VERBOSE,...e),this._logHandler(this,Sn.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,Sn.INFO,...e),this._logHandler(this,Sn.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,Sn.WARN,...e),this._logHandler(this,Sn.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,Sn.ERROR,...e),this._logHandler(this,Sn.ERROR,...e)}}const zle=(n,e)=>e.some(t=>n instanceof t);let YF,$F;function Hle(){return YF||(YF=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Gle(){return $F||($F=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const ij=new WeakMap,BI=new WeakMap,rj=new WeakMap,Pb=new WeakMap,z2=new WeakMap;function jle(n){const e=new Promise((t,i)=>{const r=()=>{n.removeEventListener("success",s),n.removeEventListener("error",o)},s=()=>{t(_u(n.result)),r()},o=()=>{i(n.error),r()};n.addEventListener("success",s),n.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&ij.set(t,n)}).catch(()=>{}),z2.set(e,n),e}function Wle(n){if(BI.has(n))return;const e=new Promise((t,i)=>{const r=()=>{n.removeEventListener("complete",s),n.removeEventListener("error",o),n.removeEventListener("abort",o)},s=()=>{t(),r()},o=()=>{i(n.error||new DOMException("AbortError","AbortError")),r()};n.addEventListener("complete",s),n.addEventListener("error",o),n.addEventListener("abort",o)});BI.set(n,e)}let OI={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return BI.get(n);if(e==="objectStoreNames")return n.objectStoreNames||rj.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return _u(n[e])},set(n,e,t){return n[e]=t,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};function Kle(n){OI=n(OI)}function Xle(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const i=n.call(Nb(this),e,...t);return rj.set(i,e.sort?e.sort():[e]),_u(i)}:Gle().includes(n)?function(...e){return n.apply(Nb(this),e),_u(ij.get(this))}:function(...e){return _u(n.apply(Nb(this),e))}}function qle(n){return typeof n=="function"?Xle(n):(n instanceof IDBTransaction&&Wle(n),zle(n,Hle())?new Proxy(n,OI):n)}function _u(n){if(n instanceof IDBRequest)return jle(n);if(Pb.has(n))return Pb.get(n);const e=qle(n);return e!==n&&(Pb.set(n,e),z2.set(e,n)),e}const Nb=n=>z2.get(n);function Yle(n,e,{blocked:t,upgrade:i,blocking:r,terminated:s}={}){const o=indexedDB.open(n,e),a=_u(o);return i&&o.addEventListener("upgradeneeded",l=>{i(_u(o.result),l.oldVersion,l.newVersion,_u(o.transaction),l)}),t&&o.addEventListener("blocked",l=>t(l.oldVersion,l.newVersion,l)),a.then(l=>{s&&l.addEventListener("close",()=>s()),r&&l.addEventListener("versionchange",c=>r(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const $le=["get","getKey","getAll","getAllKeys","count"],Jle=["put","add","delete","clear"],Db=new Map;function JF(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(Db.get(e))return Db.get(e);const t=e.replace(/FromIndex$/,""),i=e!==t,r=Jle.includes(t);if(!(t in(i?IDBIndex:IDBObjectStore).prototype)||!(r||$le.includes(t)))return;const s=async function(o,...a){const l=this.transaction(o,r?"readwrite":"readonly");let c=l.store;return i&&(c=c.index(a.shift())),(await Promise.all([c[t](...a),r&&l.done]))[0]};return Db.set(e,s),s}Kle(n=>({...n,get:(e,t,i)=>JF(e,t)||n.get(e,t,i),has:(e,t)=>!!JF(e,t)||n.has(e,t)}));/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Qle{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(Zle(t)){const i=t.getImmediate();return`${i.library}/${i.version}`}else return null}).filter(t=>t).join(" ")}}function Zle(n){const e=n.getComponent();return(e==null?void 0:e.type)==="VERSION"}const FI="@firebase/app",QF="0.10.13";/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const rc=new PA("@firebase/app"),ece="@firebase/app-compat",tce="@firebase/analytics-compat",nce="@firebase/analytics",ice="@firebase/app-check-compat",rce="@firebase/app-check",sce="@firebase/auth",oce="@firebase/auth-compat",ace="@firebase/database",lce="@firebase/data-connect",cce="@firebase/database-compat",uce="@firebase/functions",hce="@firebase/functions-compat",dce="@firebase/installations",fce="@firebase/installations-compat",pce="@firebase/messaging",mce="@firebase/messaging-compat",gce="@firebase/performance",yce="@firebase/performance-compat",vce="@firebase/remote-config",_ce="@firebase/remote-config-compat",xce="@firebase/storage",wce="@firebase/storage-compat",Ece="@firebase/firestore",Ace="@firebase/vertexai-preview",Sce="@firebase/firestore-compat",Tce="firebase",bce="10.14.1";/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const UI="[DEFAULT]",Cce={[FI]:"fire-core",[ece]:"fire-core-compat",[nce]:"fire-analytics",[tce]:"fire-analytics-compat",[rce]:"fire-app-check",[ice]:"fire-app-check-compat",[sce]:"fire-auth",[oce]:"fire-auth-compat",[ace]:"fire-rtdb",[lce]:"fire-data-connect",[cce]:"fire-rtdb-compat",[uce]:"fire-fn",[hce]:"fire-fn-compat",[dce]:"fire-iid",[fce]:"fire-iid-compat",[pce]:"fire-fcm",[mce]:"fire-fcm-compat",[gce]:"fire-perf",[yce]:"fire-perf-compat",[vce]:"fire-rc",[_ce]:"fire-rc-compat",[xce]:"fire-gcs",[wce]:"fire-gcs-compat",[Ece]:"fire-fst",[Sce]:"fire-fst-compat",[Ace]:"fire-vertex","fire-js":"fire-js",[Tce]:"fire-js-all"};/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const U1=new Map,Mce=new Map,VI=new Map;function ZF(n,e){try{n.container.addComponent(e)}catch(t){rc.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function Md(n){const e=n.name;if(VI.has(e))return rc.debug(`There were multiple attempts to register component ${e}.`),!1;VI.set(e,n);for(const t of U1.values())ZF(t,n);for(const t of Mce.values())ZF(t,n);return!0}function NA(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function za(n){return n.settings!==void 0}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Ice={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},xu=new hv("app","Firebase",Ice);/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Rce{constructor(e,t,i){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=i,this.container.addComponent(new Du("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw xu.create("app-deleted",{appName:this._name})}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const qd=bce;function sj(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const i=Object.assign({name:UI,automaticDataCollectionEnabled:!1},e),r=i.name;if(typeof r!="string"||!r)throw xu.create("bad-app-name",{appName:String(r)});if(t||(t=J6()),!t)throw xu.create("no-options");const s=U1.get(r);if(s){if(F1(t,s.options)&&F1(i,s.config))return s;throw xu.create("duplicate-app",{appName:r})}const o=new Ble(r);for(const l of VI.values())o.addComponent(l);const a=new Rce(t,i,o);return U1.set(r,a),a}function H2(n=UI){const e=U1.get(n);if(!e&&n===UI&&J6())return sj();if(!e)throw xu.create("no-app",{appName:n});return e}function qa(n,e,t){var i;let r=(i=Cce[n])!==null&&i!==void 0?i:n;t&&(r+=`-${t}`);const s=r.match(/\s|\//),o=e.match(/\s|\//);if(s||o){const a=[`Unable to register library "${r}" with version "${e}":`];s&&a.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),rc.warn(a.join(" "));return}Md(new Du(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Pce="firebase-heartbeat-database",Nce=1,E0="firebase-heartbeat-store";let Lb=null;function oj(){return Lb||(Lb=Yle(Pce,Nce,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(E0)}catch(t){console.warn(t)}}}}).catch(n=>{throw xu.create("idb-open",{originalErrorMessage:n.message})})),Lb}async function Dce(n){try{const t=(await oj()).transaction(E0),i=await t.objectStore(E0).get(aj(n));return await t.done,i}catch(e){if(e instanceof fc)rc.warn(e.message);else{const t=xu.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});rc.warn(t.message)}}}async function e3(n,e){try{const i=(await oj()).transaction(E0,"readwrite");await i.objectStore(E0).put(e,aj(n)),await i.done}catch(t){if(t instanceof fc)rc.warn(t.message);else{const i=xu.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});rc.warn(i.message)}}}function aj(n){return`${n.name}!${n.options.appId}`}/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Lce=1024,kce=30*24*60*60*1e3;class Bce{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new Fce(t),this._heartbeatsCachePromise=this._storage.read().then(i=>(this._heartbeatsCache=i,i))}async triggerHeartbeat(){var e,t;try{const r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=t3();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:r}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{const a=new Date(o.date).valueOf();return Date.now()-a<=kce}),this._storage.overwrite(this._heartbeatsCache))}catch(i){rc.warn(i)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const t=t3(),{heartbeatsToSend:i,unsentEntries:r}=Oce(this._heartbeatsCache.heartbeats),s=k1(JSON.stringify({version:2,heartbeats:i}));return this._heartbeatsCache.lastSentHeartbeatDate=t,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(t){return rc.warn(t),""}}}function t3(){return new Date().toISOString().substring(0,10)}function Oce(n,e=Lce){const t=[];let i=n.slice();for(const r of n){const s=t.find(o=>o.agent===r.agent);if(s){if(s.dates.push(r.date),n3(t)>e){s.dates.pop();break}}else if(t.push({agent:r.agent,dates:[r.date]}),n3(t)>e){t.pop();break}i=i.slice(1)}return{heartbeatsToSend:t,unsentEntries:i}}class Fce{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return xle()?wle().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await Dce(this.app);return t!=null&&t.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const r=await this.read();return e3(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var t;if(await this._canUseIndexedDBPromise){const r=await this.read();return e3(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function n3(n){return k1(JSON.stringify({version:2,heartbeats:n})).length}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Uce(n){Md(new Du("platform-logger",e=>new Qle(e),"PRIVATE")),Md(new Du("heartbeat",e=>new Bce(e),"PRIVATE")),qa(FI,QF,n),qa(FI,QF,"esm2017"),qa("fire-js","")}Uce("");var i3=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
Copyright The Closure Library Authors.
SPDX-License-Identifier: Apache-2.0
*/var gd,lj;(function(){var n;/** @license

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/function e(R,I){function M(){}M.prototype=I.prototype,R.D=I.prototype,R.prototype=new M,R.prototype.constructor=R,R.C=function(C,k,B){for(var O=Array(arguments.length-2),X=2;X<arguments.length;X++)O[X-2]=arguments[X];return I.prototype[k].apply(C,O)}}function t(){this.blockSize=-1}function i(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}e(i,t),i.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function r(R,I,M){M||(M=0);var C=Array(16);if(typeof I=="string")for(var k=0;16>k;++k)C[k]=I.charCodeAt(M++)|I.charCodeAt(M++)<<8|I.charCodeAt(M++)<<16|I.charCodeAt(M++)<<24;else for(k=0;16>k;++k)C[k]=I[M++]|I[M++]<<8|I[M++]<<16|I[M++]<<24;I=R.g[0],M=R.g[1],k=R.g[2];var B=R.g[3],O=I+(B^M&(k^B))+C[0]+3614090360&4294967295;I=M+(O<<7&4294967295|O>>>25),O=B+(k^I&(M^k))+C[1]+3905402710&4294967295,B=I+(O<<12&4294967295|O>>>20),O=k+(M^B&(I^M))+C[2]+606105819&4294967295,k=B+(O<<17&4294967295|O>>>15),O=M+(I^k&(B^I))+C[3]+3250441966&4294967295,M=k+(O<<22&4294967295|O>>>10),O=I+(B^M&(k^B))+C[4]+4118548399&4294967295,I=M+(O<<7&4294967295|O>>>25),O=B+(k^I&(M^k))+C[5]+1200080426&4294967295,B=I+(O<<12&4294967295|O>>>20),O=k+(M^B&(I^M))+C[6]+2821735955&4294967295,k=B+(O<<17&4294967295|O>>>15),O=M+(I^k&(B^I))+C[7]+4249261313&4294967295,M=k+(O<<22&4294967295|O>>>10),O=I+(B^M&(k^B))+C[8]+1770035416&4294967295,I=M+(O<<7&4294967295|O>>>25),O=B+(k^I&(M^k))+C[9]+2336552879&4294967295,B=I+(O<<12&4294967295|O>>>20),O=k+(M^B&(I^M))+C[10]+4294925233&4294967295,k=B+(O<<17&4294967295|O>>>15),O=M+(I^k&(B^I))+C[11]+2304563134&4294967295,M=k+(O<<22&4294967295|O>>>10),O=I+(B^M&(k^B))+C[12]+1804603682&4294967295,I=M+(O<<7&4294967295|O>>>25),O=B+(k^I&(M^k))+C[13]+4254626195&4294967295,B=I+(O<<12&4294967295|O>>>20),O=k+(M^B&(I^M))+C[14]+2792965006&4294967295,k=B+(O<<17&4294967295|O>>>15),O=M+(I^k&(B^I))+C[15]+1236535329&4294967295,M=k+(O<<22&4294967295|O>>>10),O=I+(k^B&(M^k))+C[1]+4129170786&4294967295,I=M+(O<<5&4294967295|O>>>27),O=B+(M^k&(I^M))+C[6]+3225465664&4294967295,B=I+(O<<9&4294967295|O>>>23),O=k+(I^M&(B^I))+C[11]+643717713&4294967295,k=B+(O<<14&4294967295|O>>>18),O=M+(B^I&(k^B))+C[0]+3921069994&4294967295,M=k+(O<<20&4294967295|O>>>12),O=I+(k^B&(M^k))+C[5]+3593408605&4294967295,I=M+(O<<5&4294967295|O>>>27),O=B+(M^k&(I^M))+C[10]+38016083&4294967295,B=I+(O<<9&4294967295|O>>>23),O=k+(I^M&(B^I))+C[15]+3634488961&4294967295,k=B+(O<<14&4294967295|O>>>18),O=M+(B^I&(k^B))+C[4]+3889429448&4294967295,M=k+(O<<20&4294967295|O>>>12),O=I+(k^B&(M^k))+C[9]+568446438&4294967295,I=M+(O<<5&4294967295|O>>>27),O=B+(M^k&(I^M))+C[14]+3275163606&4294967295,B=I+(O<<9&4294967295|O>>>23),O=k+(I^M&(B^I))+C[3]+4107603335&4294967295,k=B+(O<<14&4294967295|O>>>18),O=M+(B^I&(k^B))+C[8]+1163531501&4294967295,M=k+(O<<20&4294967295|O>>>12),O=I+(k^B&(M^k))+C[13]+2850285829&4294967295,I=M+(O<<5&4294967295|O>>>27),O=B+(M^k&(I^M))+C[2]+4243563512&4294967295,B=I+(O<<9&4294967295|O>>>23),O=k+(I^M&(B^I))+C[7]+1735328473&4294967295,k=B+(O<<14&4294967295|O>>>18),O=M+(B^I&(k^B))+C[12]+2368359562&4294967295,M=k+(O<<20&4294967295|O>>>12),O=I+(M^k^B)+C[5]+4294588738&4294967295,I=M+(O<<4&4294967295|O>>>28),O=B+(I^M^k)+C[8]+2272392833&4294967295,B=I+(O<<11&4294967295|O>>>21),O=k+(B^I^M)+C[11]+1839030562&4294967295,k=B+(O<<16&4294967295|O>>>16),O=M+(k^B^I)+C[14]+4259657740&4294967295,M=k+(O<<23&4294967295|O>>>9),O=I+(M^k^B)+C[1]+2763975236&4294967295,I=M+(O<<4&4294967295|O>>>28),O=B+(I^M^k)+C[4]+1272893353&4294967295,B=I+(O<<11&4294967295|O>>>21),O=k+(B^I^M)+C[7]+4139469664&4294967295,k=B+(O<<16&4294967295|O>>>16),O=M+(k^B^I)+C[10]+3200236656&4294967295,M=k+(O<<23&4294967295|O>>>9),O=I+(M^k^B)+C[13]+681279174&4294967295,I=M+(O<<4&4294967295|O>>>28),O=B+(I^M^k)+C[0]+3936430074&4294967295,B=I+(O<<11&4294967295|O>>>21),O=k+(B^I^M)+C[3]+3572445317&4294967295,k=B+(O<<16&4294967295|O>>>16),O=M+(k^B^I)+C[6]+76029189&4294967295,M=k+(O<<23&4294967295|O>>>9),O=I+(M^k^B)+C[9]+3654602809&4294967295,I=M+(O<<4&4294967295|O>>>28),O=B+(I^M^k)+C[12]+3873151461&4294967295,B=I+(O<<11&4294967295|O>>>21),O=k+(B^I^M)+C[15]+530742520&4294967295,k=B+(O<<16&4294967295|O>>>16),O=M+(k^B^I)+C[2]+3299628645&4294967295,M=k+(O<<23&4294967295|O>>>9),O=I+(k^(M|~B))+C[0]+4096336452&4294967295,I=M+(O<<6&4294967295|O>>>26),O=B+(M^(I|~k))+C[7]+1126891415&4294967295,B=I+(O<<10&4294967295|O>>>22),O=k+(I^(B|~M))+C[14]+2878612391&4294967295,k=B+(O<<15&4294967295|O>>>17),O=M+(B^(k|~I))+C[5]+4237533241&4294967295,M=k+(O<<21&4294967295|O>>>11),O=I+(k^(M|~B))+C[12]+1700485571&4294967295,I=M+(O<<6&4294967295|O>>>26),O=B+(M^(I|~k))+C[3]+2399980690&4294967295,B=I+(O<<10&4294967295|O>>>22),O=k+(I^(B|~M))+C[10]+4293915773&4294967295,k=B+(O<<15&4294967295|O>>>17),O=M+(B^(k|~I))+C[1]+2240044497&4294967295,M=k+(O<<21&4294967295|O>>>11),O=I+(k^(M|~B))+C[8]+1873313359&4294967295,I=M+(O<<6&4294967295|O>>>26),O=B+(M^(I|~k))+C[15]+4264355552&4294967295,B=I+(O<<10&4294967295|O>>>22),O=k+(I^(B|~M))+C[6]+2734768916&4294967295,k=B+(O<<15&4294967295|O>>>17),O=M+(B^(k|~I))+C[13]+1309151649&4294967295,M=k+(O<<21&4294967295|O>>>11),O=I+(k^(M|~B))+C[4]+4149444226&4294967295,I=M+(O<<6&4294967295|O>>>26),O=B+(M^(I|~k))+C[11]+3174756917&4294967295,B=I+(O<<10&4294967295|O>>>22),O=k+(I^(B|~M))+C[2]+718787259&4294967295,k=B+(O<<15&4294967295|O>>>17),O=M+(B^(k|~I))+C[9]+3951481745&4294967295,R.g[0]=R.g[0]+I&4294967295,R.g[1]=R.g[1]+(k+(O<<21&4294967295|O>>>11))&4294967295,R.g[2]=R.g[2]+k&4294967295,R.g[3]=R.g[3]+B&4294967295}i.prototype.u=function(R,I){I===void 0&&(I=R.length);for(var M=I-this.blockSize,C=this.B,k=this.h,B=0;B<I;){if(k==0)for(;B<=M;)r(this,R,B),B+=this.blockSize;if(typeof R=="string"){for(;B<I;)if(C[k++]=R.charCodeAt(B++),k==this.blockSize){r(this,C),k=0;break}}else for(;B<I;)if(C[k++]=R[B++],k==this.blockSize){r(this,C),k=0;break}}this.h=k,this.o+=I},i.prototype.v=function(){var R=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);R[0]=128;for(var I=1;I<R.length-8;++I)R[I]=0;var M=8*this.o;for(I=R.length-8;I<R.length;++I)R[I]=M&255,M/=256;for(this.u(R),R=Array(16),I=M=0;4>I;++I)for(var C=0;32>C;C+=8)R[M++]=this.g[I]>>>C&255;return R};function s(R,I){var M=a;return Object.prototype.hasOwnProperty.call(M,R)?M[R]:M[R]=I(R)}function o(R,I){this.h=I;for(var M=[],C=!0,k=R.length-1;0<=k;k--){var B=R[k]|0;C&&B==I||(M[k]=B,C=!1)}this.g=M}var a={};function l(R){return-128<=R&&128>R?s(R,function(I){return new o([I|0],0>I?-1:0)}):new o([R|0],0>R?-1:0)}function c(R){if(isNaN(R)||!isFinite(R))return h;if(0>R)return v(c(-R));for(var I=[],M=1,C=0;R>=M;C++)I[C]=R/M|0,M*=4294967296;return new o(I,0)}function u(R,I){if(R.length==0)throw Error("number format error: empty string");if(I=I||10,2>I||36<I)throw Error("radix out of range: "+I);if(R.charAt(0)=="-")return v(u(R.substring(1),I));if(0<=R.indexOf("-"))throw Error('number format error: interior "-" character');for(var M=c(Math.pow(I,8)),C=h,k=0;k<R.length;k+=8){var B=Math.min(8,R.length-k),O=parseInt(R.substring(k,k+B),I);8>B?(B=c(Math.pow(I,B)),C=C.j(B).add(c(O))):(C=C.j(M),C=C.add(c(O)))}return C}var h=l(0),f=l(1),m=l(16777216);n=o.prototype,n.m=function(){if(_(this))return-v(this).m();for(var R=0,I=1,M=0;M<this.g.length;M++){var C=this.i(M);R+=(0<=C?C:4294967296+C)*I,I*=4294967296}return R},n.toString=function(R){if(R=R||10,2>R||36<R)throw Error("radix out of range: "+R);if(y(this))return"0";if(_(this))return"-"+v(this).toString(R);for(var I=c(Math.pow(R,6)),M=this,C="";;){var k=T(M,I).g;M=g(M,k.j(I));var B=((0<M.g.length?M.g[0]:M.h)>>>0).toString(R);if(M=k,y(M))return B+C;for(;6>B.length;)B="0"+B;C=B+C}},n.i=function(R){return 0>R?0:R<this.g.length?this.g[R]:this.h};function y(R){if(R.h!=0)return!1;for(var I=0;I<R.g.length;I++)if(R.g[I]!=0)return!1;return!0}function _(R){return R.h==-1}n.l=function(R){return R=g(this,R),_(R)?-1:y(R)?0:1};function v(R){for(var I=R.g.length,M=[],C=0;C<I;C++)M[C]=~R.g[C];return new o(M,~R.h).add(f)}n.abs=function(){return _(this)?v(this):this},n.add=function(R){for(var I=Math.max(this.g.length,R.g.length),M=[],C=0,k=0;k<=I;k++){var B=C+(this.i(k)&65535)+(R.i(k)&65535),O=(B>>>16)+(this.i(k)>>>16)+(R.i(k)>>>16);C=O>>>16,B&=65535,O&=65535,M[k]=O<<16|B}return new o(M,M[M.length-1]&-2147483648?-1:0)};function g(R,I){return R.add(v(I))}n.j=function(R){if(y(this)||y(R))return h;if(_(this))return _(R)?v(this).j(v(R)):v(v(this).j(R));if(_(R))return v(this.j(v(R)));if(0>this.l(m)&&0>R.l(m))return c(this.m()*R.m());for(var I=this.g.length+R.g.length,M=[],C=0;C<2*I;C++)M[C]=0;for(C=0;C<this.g.length;C++)for(var k=0;k<R.g.length;k++){var B=this.i(C)>>>16,O=this.i(C)&65535,X=R.i(k)>>>16,le=R.i(k)&65535;M[2*C+2*k]+=O*le,w(M,2*C+2*k),M[2*C+2*k+1]+=B*le,w(M,2*C+2*k+1),M[2*C+2*k+1]+=O*X,w(M,2*C+2*k+1),M[2*C+2*k+2]+=B*X,w(M,2*C+2*k+2)}for(C=0;C<I;C++)M[C]=M[2*C+1]<<16|M[2*C];for(C=I;C<2*I;C++)M[C]=0;return new o(M,0)};function w(R,I){for(;(R[I]&65535)!=R[I];)R[I+1]+=R[I]>>>16,R[I]&=65535,I++}function A(R,I){this.g=R,this.h=I}function T(R,I){if(y(I))throw Error("division by zero");if(y(R))return new A(h,h);if(_(R))return I=T(v(R),I),new A(v(I.g),v(I.h));if(_(I))return I=T(R,v(I)),new A(v(I.g),I.h);if(30<R.g.length){if(_(R)||_(I))throw Error("slowDivide_ only works with positive integers.");for(var M=f,C=I;0>=C.l(R);)M=L(M),C=L(C);var k=D(M,1),B=D(C,1);for(C=D(C,2),M=D(M,2);!y(C);){var O=B.add(C);0>=O.l(R)&&(k=k.add(M),B=O),C=D(C,1),M=D(M,1)}return I=g(R,k.j(I)),new A(k,I)}for(k=h;0<=R.l(I);){for(M=Math.max(1,Math.floor(R.m()/I.m())),C=Math.ceil(Math.log(M)/Math.LN2),C=48>=C?1:Math.pow(2,C-48),B=c(M),O=B.j(I);_(O)||0<O.l(R);)M-=C,B=c(M),O=B.j(I);y(B)&&(B=f),k=k.add(B),R=g(R,O)}return new A(k,R)}n.A=function(R){return T(this,R).h},n.and=function(R){for(var I=Math.max(this.g.length,R.g.length),M=[],C=0;C<I;C++)M[C]=this.i(C)&R.i(C);return new o(M,this.h&R.h)},n.or=function(R){for(var I=Math.max(this.g.length,R.g.length),M=[],C=0;C<I;C++)M[C]=this.i(C)|R.i(C);return new o(M,this.h|R.h)},n.xor=function(R){for(var I=Math.max(this.g.length,R.g.length),M=[],C=0;C<I;C++)M[C]=this.i(C)^R.i(C);return new o(M,this.h^R.h)};function L(R){for(var I=R.g.length+1,M=[],C=0;C<I;C++)M[C]=R.i(C)<<1|R.i(C-1)>>>31;return new o(M,R.h)}function D(R,I){var M=I>>5;I%=32;for(var C=R.g.length-M,k=[],B=0;B<C;B++)k[B]=0<I?R.i(B+M)>>>I|R.i(B+M+1)<<32-I:R.i(B+M);return new o(k,R.h)}i.prototype.digest=i.prototype.v,i.prototype.reset=i.prototype.s,i.prototype.update=i.prototype.u,lj=i,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.A,o.prototype.compare=o.prototype.l,o.prototype.toNumber=o.prototype.m,o.prototype.toString=o.prototype.toString,o.prototype.getBits=o.prototype.i,o.fromNumber=c,o.fromString=u,gd=o}).apply(typeof i3<"u"?i3:typeof self<"u"?self:typeof window<"u"?window:{});var lx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
Copyright The Closure Library Authors.
SPDX-License-Identifier: Apache-2.0
*/var cj,oy,uj,kw,zI,hj,dj,fj;(function(){var n,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(x,N,F){return x==Array.prototype||x==Object.prototype||(x[N]=F.value),x};function t(x){x=[typeof globalThis=="object"&&globalThis,x,typeof window=="object"&&window,typeof self=="object"&&self,typeof lx=="object"&&lx];for(var N=0;N<x.length;++N){var F=x[N];if(F&&F.Math==Math)return F}throw Error("Cannot find global object")}var i=t(this);function r(x,N){if(N)e:{var F=i;x=x.split(".");for(var W=0;W<x.length-1;W++){var me=x[W];if(!(me in F))break e;F=F[me]}x=x[x.length-1],W=F[x],N=N(W),N!=W&&N!=null&&e(F,x,{configurable:!0,writable:!0,value:N})}}function s(x,N){x instanceof String&&(x+="");var F=0,W=!1,me={next:function(){if(!W&&F<x.length){var Se=F++;return{value:N(Se,x[Se]),done:!1}}return W=!0,{done:!0,value:void 0}}};return me[Symbol.iterator]=function(){return me},me}r("Array.prototype.values",function(x){return x||function(){return s(this,function(N,F){return F})}});/** @license

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/var o=o||{},a=this||self;function l(x){var N=typeof x;return N=N!="object"?N:x?Array.isArray(x)?"array":N:"null",N=="array"||N=="object"&&typeof x.length=="number"}function c(x){var N=typeof x;return N=="object"&&x!=null||N=="function"}function u(x,N,F){return x.call.apply(x.bind,arguments)}function h(x,N,F){if(!x)throw Error();if(2<arguments.length){var W=Array.prototype.slice.call(arguments,2);return function(){var me=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(me,W),x.apply(N,me)}}return function(){return x.apply(N,arguments)}}function f(x,N,F){return f=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?u:h,f.apply(null,arguments)}function m(x,N){var F=Array.prototype.slice.call(arguments,1);return function(){var W=F.slice();return W.push.apply(W,arguments),x.apply(this,W)}}function y(x,N){function F(){}F.prototype=N.prototype,x.aa=N.prototype,x.prototype=new F,x.prototype.constructor=x,x.Qb=function(W,me,Se){for(var et=Array(arguments.length-2),Cn=2;Cn<arguments.length;Cn++)et[Cn-2]=arguments[Cn];return N.prototype[me].apply(W,et)}}function _(x){const N=x.length;if(0<N){const F=Array(N);for(let W=0;W<N;W++)F[W]=x[W];return F}return[]}function v(x,N){for(let F=1;F<arguments.length;F++){const W=arguments[F];if(l(W)){const me=x.length||0,Se=W.length||0;x.length=me+Se;for(let et=0;et<Se;et++)x[me+et]=W[et]}else x.push(W)}}class g{constructor(N,F){this.i=N,this.j=F,this.h=0,this.g=null}get(){let N;return 0<this.h?(this.h--,N=this.g,this.g=N.next,N.next=null):N=this.i(),N}}function w(x){return/^[\s\xa0]*$/.test(x)}function A(){var x=a.navigator;return x&&(x=x.userAgent)?x:""}function T(x){return T[" "](x),x}T[" "]=function(){};var L=A().indexOf("Gecko")!=-1&&!(A().toLowerCase().indexOf("webkit")!=-1&&A().indexOf("Edge")==-1)&&!(A().indexOf("Trident")!=-1||A().indexOf("MSIE")!=-1)&&A().indexOf("Edge")==-1;function D(x,N,F){for(const W in x)N.call(F,x[W],W,x)}function R(x,N){for(const F in x)N.call(void 0,x[F],F,x)}function I(x){const N={};for(const F in x)N[F]=x[F];return N}const M="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function C(x,N){let F,W;for(let me=1;me<arguments.length;me++){W=arguments[me];for(F in W)x[F]=W[F];for(let Se=0;Se<M.length;Se++)F=M[Se],Object.prototype.hasOwnProperty.call(W,F)&&(x[F]=W[F])}}function k(x){var N=1;x=x.split(":");const F=[];for(;0<N&&x.length;)F.push(x.shift()),N--;return x.length&&F.push(x.join(":")),F}function B(x){a.setTimeout(()=>{throw x},0)}function O(){var x=$;let N=null;return x.g&&(N=x.g,x.g=x.g.next,x.g||(x.h=null),N.next=null),N}class X{constructor(){this.h=this.g=null}add(N,F){const W=le.get();W.set(N,F),this.h?this.h.next=W:this.g=W,this.h=W}}var le=new g(()=>new ie,x=>x.reset());class ie{constructor(){this.next=this.g=this.h=null}set(N,F){this.h=N,this.g=F,this.next=null}reset(){this.next=this.g=this.h=null}}let de,G=!1,$=new X,te=()=>{const x=a.Promise.resolve(void 0);de=()=>{x.then(ue)}};var ue=()=>{for(var x;x=O();){try{x.h.call(x.g)}catch(F){B(F)}var N=le;N.j(x),100>N.h&&(N.h++,x.next=N.g,N.g=x)}G=!1};function ve(){this.s=this.s,this.C=this.C}ve.prototype.s=!1,ve.prototype.ma=function(){this.s||(this.s=!0,this.N())},ve.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function be(x,N){this.type=x,this.g=this.target=N,this.defaultPrevented=!1}be.prototype.h=function(){this.defaultPrevented=!0};var he=function(){if(!a.addEventListener||!Object.defineProperty)return!1;var x=!1,N=Object.defineProperty({},"passive",{get:function(){x=!0}});try{const F=()=>{};a.addEventListener("test",F,N),a.removeEventListener("test",F,N)}catch{}return x}();function Pe(x,N){if(be.call(this,x?x.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,x){var F=this.type=x.type,W=x.changedTouches&&x.changedTouches.length?x.changedTouches[0]:null;if(this.target=x.target||x.srcElement,this.g=N,N=x.relatedTarget){if(L){e:{try{T(N.nodeName);var me=!0;break e}catch{}me=!1}me||(N=null)}}else F=="mouseover"?N=x.fromElement:F=="mouseout"&&(N=x.toElement);this.relatedTarget=N,W?(this.clientX=W.clientX!==void 0?W.clientX:W.pageX,this.clientY=W.clientY!==void 0?W.clientY:W.pageY,this.screenX=W.screenX||0,this.screenY=W.screenY||0):(this.clientX=x.clientX!==void 0?x.clientX:x.pageX,this.clientY=x.clientY!==void 0?x.clientY:x.pageY,this.screenX=x.screenX||0,this.screenY=x.screenY||0),this.button=x.button,this.key=x.key||"",this.ctrlKey=x.ctrlKey,this.altKey=x.altKey,this.shiftKey=x.shiftKey,this.metaKey=x.metaKey,this.pointerId=x.pointerId||0,this.pointerType=typeof x.pointerType=="string"?x.pointerType:Oe[x.pointerType]||"",this.state=x.state,this.i=x,x.defaultPrevented&&Pe.aa.h.call(this)}}y(Pe,be);var Oe={2:"touch",3:"pen",4:"mouse"};Pe.prototype.h=function(){Pe.aa.h.call(this);var x=this.i;x.preventDefault?x.preventDefault():x.returnValue=!1};var Ce="closure_listenable_"+(1e6*Math.random()|0),mt=0;function Lt(x,N,F,W,me){this.listener=x,this.proxy=null,this.src=N,this.type=F,this.capture=!!W,this.ha=me,this.key=++mt,this.da=this.fa=!1}function St(x){x.da=!0,x.listener=null,x.proxy=null,x.src=null,x.ha=null}function Nt(x){this.src=x,this.g={},this.h=0}Nt.prototype.add=function(x,N,F,W,me){var Se=x.toString();x=this.g[Se],x||(x=this.g[Se]=[],this.h++);var et=Ue(x,N,W,me);return-1<et?(N=x[et],F||(N.fa=!1)):(N=new Lt(N,this.src,Se,!!W,me),N.fa=F,x.push(N)),N};function ke(x,N){var F=N.type;if(F in x.g){var W=x.g[F],me=Array.prototype.indexOf.call(W,N,void 0),Se;(Se=0<=me)&&Array.prototype.splice.call(W,me,1),Se&&(St(N),x.g[F].length==0&&(delete x.g[F],x.h--))}}function Ue(x,N,F,W){for(var me=0;me<x.length;++me){var Se=x[me];if(!Se.da&&Se.listener==N&&Se.capture==!!F&&Se.ha==W)return me}return-1}var ee="closure_lm_"+(1e6*Math.random()|0),xt={};function je(x,N,F,W,me){if(Array.isArray(N)){for(var Se=0;Se<N.length;Se++)je(x,N[Se],F,W,me);return null}return F=ze(F),x&&x[Ce]?x.K(N,F,c(W)?!!W.capture:!!W,me):ht(x,N,F,!1,W,me)}function ht(x,N,F,W,me,Se){if(!N)throw Error("Invalid event type");var et=c(me)?!!me.capture:!!me,Cn=pe(x);if(Cn||(x[ee]=Cn=new Nt(x)),F=Cn.add(N,F,W,et,Se),F.proxy)return F;if(W=$e(),F.proxy=W,W.src=x,W.listener=F,x.addEventListener)he||(me=et),me===void 0&&(me=!1),x.addEventListener(N.toString(),W,me);else if(x.attachEvent)x.attachEvent(Y(N.toString()),W);else if(x.addListener&&x.removeListener)x.addListener(W);else throw Error("addEventListener and attachEvent are unavailable.");return F}function $e(){function x(F){return N.call(x.src,x.listener,F)}const N=j;return x}function Mt(x,N,F,W,me){if(Array.isArray(N))for(var Se=0;Se<N.length;Se++)Mt(x,N[Se],F,W,me);else W=c(W)?!!W.capture:!!W,F=ze(F),x&&x[Ce]?(x=x.i,N=String(N).toString(),N in x.g&&(Se=x.g[N],F=Ue(Se,F,W,me),-1<F&&(St(Se[F]),Array.prototype.splice.call(Se,F,1),Se.length==0&&(delete x.g[N],x.h--)))):x&&(x=pe(x))&&(N=x.g[N.toString()],x=-1,N&&(x=Ue(N,F,W,me)),(F=-1<x?N[x]:null)&&lt(F))}function lt(x){if(typeof x!="number"&&x&&!x.da){var N=x.src;if(N&&N[Ce])ke(N.i,x);else{var F=x.type,W=x.proxy;N.removeEventListener?N.removeEventListener(F,W,x.capture):N.detachEvent?N.detachEvent(Y(F),W):N.addListener&&N.removeListener&&N.removeListener(W),(F=pe(N))?(ke(F,x),F.h==0&&(F.src=null,N[ee]=null)):St(x)}}}function Y(x){return x in xt?xt[x]:xt[x]="on"+x}function j(x,N){if(x.da)x=!0;else{N=new Pe(N,this);var F=x.listener,W=x.ha||x.src;x.fa&&lt(x),x=F.call(W,N)}return x}function pe(x){return x=x[ee],x instanceof Nt?x:null}var Ie="__closure_events_fn_"+(1e9*Math.random()>>>0);function ze(x){return typeof x=="function"?x:(x[Ie]||(x[Ie]=function(N){return x.handleEvent(N)}),x[Ie])}function Ee(){ve.call(this),this.i=new Nt(this),this.M=this,this.F=null}y(Ee,ve),Ee.prototype[Ce]=!0,Ee.prototype.removeEventListener=function(x,N,F,W){Mt(this,x,N,F,W)};function tt(x,N){var F,W=x.F;if(W)for(F=[];W;W=W.F)F.push(W);if(x=x.M,W=N.type||N,typeof N=="string")N=new be(N,x);else if(N instanceof be)N.target=N.target||x;else{var me=N;N=new be(W,x),C(N,me)}if(me=!0,F)for(var Se=F.length-1;0<=Se;Se--){var et=N.g=F[Se];me=nt(et,W,!0,N)&&me}if(et=N.g=x,me=nt(et,W,!0,N)&&me,me=nt(et,W,!1,N)&&me,F)for(Se=0;Se<F.length;Se++)et=N.g=F[Se],me=nt(et,W,!1,N)&&me}Ee.prototype.N=function(){if(Ee.aa.N.call(this),this.i){var x=this.i,N;for(N in x.g){for(var F=x.g[N],W=0;W<F.length;W++)St(F[W]);delete x.g[N],x.h--}}this.F=null},Ee.prototype.K=function(x,N,F,W){return this.i.add(String(x),N,!1,F,W)},Ee.prototype.L=function(x,N,F,W){return this.i.add(String(x),N,!0,F,W)};function nt(x,N,F,W){if(N=x.i.g[String(N)],!N)return!0;N=N.concat();for(var me=!0,Se=0;Se<N.length;++Se){var et=N[Se];if(et&&!et.da&&et.capture==F){var Cn=et.listener,Gi=et.ha||et.src;et.fa&&ke(x.i,et),me=Cn.call(Gi,W)!==!1&&me}}return me&&!W.defaultPrevented}function ct(x,N,F){if(typeof x=="function")F&&(x=f(x,F));else if(x&&typeof x.handleEvent=="function")x=f(x.handleEvent,x);else throw Error("Invalid listener argument");return 2147483647<Number(N)?-1:a.setTimeout(x,N||0)}function Yt(x){x.g=ct(()=>{x.g=null,x.i&&(x.i=!1,Yt(x))},x.l);const N=x.h;x.h=null,x.m.apply(null,N)}class Xe extends ve{constructor(N,F){super(),this.m=N,this.l=F,this.h=null,this.i=!1,this.g=null}j(N){this.h=arguments,this.g?this.i=!0:Yt(this)}N(){super.N(),this.g&&(a.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function dt(x){ve.call(this),this.h=x,this.g={}}y(dt,ve);var It=[];function gt(x){D(x.g,function(N,F){this.g.hasOwnProperty(F)&&lt(N)},x),x.g={}}dt.prototype.N=function(){dt.aa.N.call(this),gt(this)},dt.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var ut=a.JSON.stringify,oe=a.JSON.parse,Te=class{stringify(x){return a.JSON.stringify(x,void 0)}parse(x){return a.JSON.parse(x,void 0)}};function Ye(){}Ye.prototype.h=null;function se(x){return x.h||(x.h=x.i())}function ye(){}var we={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function De(){be.call(this,"d")}y(De,be);function ot(){be.call(this,"c")}y(ot,be);var it={},Ke=null;function Et(){return Ke=Ke||new Ee}it.La="serverreachability";function Gt(x){be.call(this,it.La,x)}y(Gt,be);function Vt(x){const N=Et();tt(N,new Gt(N))}it.STAT_EVENT="statevent";function _n(x,N){be.call(this,it.STAT_EVENT,x),this.stat=N}y(_n,be);function sn(x){const N=Et();tt(N,new _n(N,x))}it.Ma="timingevent";function wr(x,N){be.call(this,it.Ma,x),this.size=N}y(wr,be);function mi(x,N){if(typeof x!="function")throw Error("Fn must not be null and must be a function");return a.setTimeout(function(){x()},N)}function jn(){this.g=!0}jn.prototype.xa=function(){this.g=!1};function jo(x,N,F,W,me,Se){x.info(function(){if(x.g)if(Se)for(var et="",Cn=Se.split("&"),Gi=0;Gi<Cn.length;Gi++){var En=Cn[Gi].split("=");if(1<En.length){var ji=En[0];En=En[1];var Kn=ji.split("_");et=2<=Kn.length&&Kn[1]=="type"?et+(ji+"="+En+"&"):et+(ji+"=redacted&")}}else et=null;else et=Se;return"XMLHTTP REQ ("+W+") [attempt "+me+"]: "+N+`
`+F+`
`+et})}function vo(x,N,F,W,me,Se,et){x.info(function(){return"XMLHTTP RESP ("+W+") [ attempt "+me+"]: "+N+`
`+F+`
`+Se+" "+et})}function Di(x,N,F,W){x.info(function(){return"XMLHTTP TEXT ("+N+"): "+dl(x,F)+(W?" "+W:"")})}function tn(x,N){x.info(function(){return"TIMEOUT: "+N})}jn.prototype.info=function(){};function dl(x,N){if(!x.g)return N;if(!N)return null;try{var F=JSON.parse(N);if(F){for(x=0;x<F.length;x++)if(Array.isArray(F[x])){var W=F[x];if(!(2>W.length)){var me=W[1];if(Array.isArray(me)&&!(1>me.length)){var Se=me[0];if(Se!="noop"&&Se!="stop"&&Se!="close")for(var et=1;et<me.length;et++)me[et]=""}}}}return ut(F)}catch{return N}}var Xs={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},H={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"},K;function ae(){}y(ae,Ye),ae.prototype.g=function(){return new XMLHttpRequest},ae.prototype.i=function(){return{}},K=new ae;function xe(x,N,F,W){this.j=x,this.i=N,this.l=F,this.R=W||1,this.U=new dt(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new Me}function Me(){this.i=null,this.g="",this.h=!1}var z={},J={};function ne(x,N,F){x.L=1,x.v=fl(Jt(N)),x.m=F,x.P=!0,re(x,null)}function re(x,N){x.F=Date.now(),_e(x),x.A=Jt(x.v);var F=x.A,W=x.R;Array.isArray(W)||(W=[String(W)]),af(F.i,"t",W),x.C=0,F=x.j.J,x.h=new Me,x.g=ch(x.j,F?N:null,!x.m),0<x.O&&(x.M=new Xe(f(x.Y,x,x.g),x.O)),N=x.U,F=x.g,W=x.ca;var me="readystatechange";Array.isArray(me)||(me&&(It[0]=me.toString()),me=It);for(var Se=0;Se<me.length;Se++){var et=je(F,me[Se],W||N.handleEvent,!1,N.h||N);if(!et)break;N.g[et.key]=et}N=x.H?I(x.H):{},x.m?(x.u||(x.u="POST"),N["Content-Type"]="application/x-www-form-urlencoded",x.g.ea(x.A,x.u,x.m,N)):(x.u="GET",x.g.ea(x.A,x.u,null,N)),Vt(),jo(x.i,x.u,x.A,x.l,x.R,x.m)}xe.prototype.ca=function(x){x=x.target;const N=this.M;N&&Li(x)==3?N.j():this.Y(x)},xe.prototype.Y=function(x){try{if(x==this.g)e:{const Kn=Li(this.g);var N=this.g.Ba();const Wi=this.g.Z();if(!(3>Kn)&&(Kn!=3||this.g&&(this.h.h||this.g.oa()||sh(this.g)))){this.J||Kn!=4||N==7||(N==8||0>=Wi?Vt(3):Vt(2)),Be(this);var F=this.g.Z();this.X=F;t:if(Q(this)){var W=sh(this.g);x="";var me=W.length,Se=Li(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){Je(this),Ge(this);var et="";break t}this.h.i=new a.TextDecoder}for(N=0;N<me;N++)this.h.h=!0,x+=this.h.i.decode(W[N],{stream:!(Se&&N==me-1)});W.length=0,this.h.g+=x,this.C=0,et=this.h.g}else et=this.g.oa();if(this.o=F==200,vo(this.i,this.u,this.A,this.l,this.R,Kn,F),this.o){if(this.T&&!this.K){t:{if(this.g){var Cn,Gi=this.g;if((Cn=Gi.g?Gi.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!w(Cn)){var En=Cn;break t}}En=null}if(F=En)Di(this.i,this.l,F,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,We(this,F);else{this.o=!1,this.s=3,sn(12),Je(this),Ge(this);break e}}if(this.P){F=!0;let An;for(;!this.J&&this.C<et.length;)if(An=ge(this,et),An==J){Kn==4&&(this.s=4,sn(14),F=!1),Di(this.i,this.l,null,"[Incomplete Response]");break}else if(An==z){this.s=4,sn(15),Di(this.i,this.l,et,"[Invalid Chunk]"),F=!1;break}else Di(this.i,this.l,An,null),We(this,An);if(Q(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),Kn!=4||et.length!=0||this.h.h||(this.s=1,sn(16),F=!1),this.o=this.o&&F,!F)Di(this.i,this.l,et,"[Invalid Chunked Response]"),Je(this),Ge(this);else if(0<et.length&&!this.W){this.W=!0;var ji=this.j;ji.g==this&&ji.ba&&!ji.M&&(ji.j.info("Great, no buffering proxy detected. Bytes received: "+et.length),Qs(ji),ji.M=!0,sn(11))}}else Di(this.i,this.l,et,null),We(this,et);Kn==4&&Je(this),this.o&&!this.J&&(Kn==4?tg(this.j,this):(this.o=!1,_e(this)))}else cf(this.g),F==400&&0<et.indexOf("Unknown SID")?(this.s=3,sn(12)):(this.s=0,sn(13)),Je(this),Ge(this)}}}catch{}finally{}};function Q(x){return x.g?x.u=="GET"&&x.L!=2&&x.j.Ca:!1}function ge(x,N){var F=x.C,W=N.indexOf(`
`,F);return W==-1?J:(F=Number(N.substring(F,W)),isNaN(F)?z:(W+=1,W+F>N.length?J:(N=N.slice(W,W+F),x.C=W+F,N)))}xe.prototype.cancel=function(){this.J=!0,Je(this)};function _e(x){x.S=Date.now()+x.I,Ze(x,x.I)}function Ze(x,N){if(x.B!=null)throw Error("WatchDog timer not null");x.B=mi(f(x.ba,x),N)}function Be(x){x.B&&(a.clearTimeout(x.B),x.B=null)}xe.prototype.ba=function(){this.B=null;const x=Date.now();0<=x-this.S?(tn(this.i,this.A),this.L!=2&&(Vt(),sn(17)),Je(this),this.s=2,Ge(this)):Ze(this,this.S-x)};function Ge(x){x.j.G==0||x.J||tg(x.j,x)}function Je(x){Be(x);var N=x.M;N&&typeof N.ma=="function"&&N.ma(),x.M=null,gt(x.U),x.g&&(N=x.g,x.g=null,N.abort(),N.ma())}function We(x,N){try{var F=x.j;if(F.G!=0&&(F.g==x||At(F.h,x))){if(!x.K&&At(F.h,x)&&F.G==3){try{var W=F.Da.g.parse(N)}catch{W=null}if(Array.isArray(W)&&W.length==3){var me=W;if(me[0]==0){e:if(!F.u){if(F.g)if(F.g.F+3e3<x.F)yl(F),ah(F);else break e;ff(F),sn(18)}}else F.za=me[1],0<F.za-F.T&&37500>me[2]&&F.F&&F.v==0&&!F.C&&(F.C=mi(f(F.Za,F),6e3));if(1>=Ft(F.h)&&F.ca){try{F.ca()}catch{}F.ca=void 0}}else Ma(F,11)}else if((x.K||F.g==x)&&yl(F),!w(N))for(me=F.Da.g.parse(N),N=0;N<me.length;N++){let En=me[N];if(F.T=En[0],En=En[1],F.G==2)if(En[0]=="c"){F.K=En[1],F.ia=En[2];const ji=En[3];ji!=null&&(F.la=ji,F.j.info("VER="+F.la));const Kn=En[4];Kn!=null&&(F.Aa=Kn,F.j.info("SVER="+F.Aa));const Wi=En[5];Wi!=null&&typeof Wi=="number"&&0<Wi&&(W=1.5*Wi,F.L=W,F.j.info("backChannelRequestTimeoutMs_="+W)),W=F;const An=x.g;if(An){const Ia=An.g?An.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Ia){var Se=W.h;Se.g||Ia.indexOf("spdy")==-1&&Ia.indexOf("quic")==-1&&Ia.indexOf("h2")==-1||(Se.j=Se.l,Se.g=new Set,Se.h&&(rt(Se,Se.h),Se.h=null))}if(W.D){const cs=An.g?An.g.getResponseHeader("X-HTTP-Session-Id"):null;cs&&(W.ya=cs,yn(W.I,W.D,cs))}}F.G=3,F.l&&F.l.ua(),F.ba&&(F.R=Date.now()-x.F,F.j.info("Handshake RTT: "+F.R+"ms")),W=F;var et=x;if(W.qa=pf(W,W.J?W.ia:null,W.W),et.K){Wt(W.h,et);var Cn=et,Gi=W.L;Gi&&(Cn.I=Gi),Cn.B&&(Be(Cn),_e(Cn)),W.g=et}else df(W);0<F.i.length&&vc(F)}else En[0]!="stop"&&En[0]!="close"||Ma(F,7);else F.G==3&&(En[0]=="stop"||En[0]=="close"?En[0]=="stop"?Ma(F,7):oh(F):En[0]!="noop"&&F.l&&F.l.ta(En),F.v=0)}}Vt(4)}catch{}}var Tt=class{constructor(x,N){this.g=x,this.map=N}};function Rt(x){this.l=x||10,a.PerformanceNavigationTiming?(x=a.performance.getEntriesByType("navigation"),x=0<x.length&&(x[0].nextHopProtocol=="hq"||x[0].nextHopProtocol=="h2")):x=!!(a.chrome&&a.chrome.loadTimes&&a.chrome.loadTimes()&&a.chrome.loadTimes().wasFetchedViaSpdy),this.j=x?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function vt(x){return x.h?!0:x.g?x.g.size>=x.j:!1}function Ft(x){return x.h?1:x.g?x.g.size:0}function At(x,N){return x.h?x.h==N:x.g?x.g.has(N):!1}function rt(x,N){x.g?x.g.add(N):x.h=N}function Wt(x,N){x.h&&x.h==N?x.h=null:x.g&&x.g.has(N)&&x.g.delete(N)}Rt.prototype.cancel=function(){if(this.i=Ut(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const x of this.g.values())x.cancel();this.g.clear()}};function Ut(x){if(x.h!=null)return x.i.concat(x.h.D);if(x.g!=null&&x.g.size!==0){let N=x.i;for(const F of x.g.values())N=N.concat(F.D);return N}return _(x.i)}function Wn(x){if(x.V&&typeof x.V=="function")return x.V();if(typeof Map<"u"&&x instanceof Map||typeof Set<"u"&&x instanceof Set)return Array.from(x.values());if(typeof x=="string")return x.split("");if(l(x)){for(var N=[],F=x.length,W=0;W<F;W++)N.push(x[W]);return N}N=[],F=0;for(W in x)N[F++]=x[W];return N}function Yn(x){if(x.na&&typeof x.na=="function")return x.na();if(!x.V||typeof x.V!="function"){if(typeof Map<"u"&&x instanceof Map)return Array.from(x.keys());if(!(typeof Set<"u"&&x instanceof Set)){if(l(x)||typeof x=="string"){var N=[];x=x.length;for(var F=0;F<x;F++)N.push(F);return N}N=[],F=0;for(const W in x)N[F++]=W;return N}}}function Pn(x,N){if(x.forEach&&typeof x.forEach=="function")x.forEach(N,void 0);else if(l(x)||typeof x=="string")Array.prototype.forEach.call(x,N,void 0);else for(var F=Yn(x),W=Wn(x),me=W.length,Se=0;Se<me;Se++)N.call(void 0,W[Se],F&&F[Se],x)}var gn=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Zt(x,N){if(x){x=x.split("&");for(var F=0;F<x.length;F++){var W=x[F].indexOf("="),me=null;if(0<=W){var Se=x[F].substring(0,W);me=x[F].substring(W+1)}else Se=x[F];N(Se,me?decodeURIComponent(me.replace(/\+/g," ")):"")}}}function $t(x){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,x instanceof $t){this.h=x.h,hn(this,x.j),this.o=x.o,this.g=x.g,yi(this,x.s),this.l=x.l;var N=x.i,F=new nh;F.i=N.i,N.g&&(F.g=new Map(N.g),F.h=N.h),ei(this,F),this.m=x.m}else x&&(N=String(x).match(gn))?(this.h=!1,hn(this,N[1]||"",!0),this.o=Ca(N[2]||""),this.g=Ca(N[3]||"",!0),yi(this,N[4]),this.l=Ca(N[5]||"",!0),ei(this,N[6]||"",!0),this.m=Ca(N[7]||"")):(this.h=!1,this.i=new nh(null,this.h))}$t.prototype.toString=function(){var x=[],N=this.j;N&&x.push(Wo(N,$v,!0),":");var F=this.g;return(F||N=="file")&&(x.push("//"),(N=this.o)&&x.push(Wo(N,$v,!0),"@"),x.push(encodeURIComponent(String(F)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),F=this.s,F!=null&&x.push(":",String(F))),(F=this.l)&&(this.g&&F.charAt(0)!="/"&&x.push("/"),x.push(Wo(F,F.charAt(0)=="/"?$m:zS,!0))),(F=this.i.toString())&&x.push("?",F),(F=this.m)&&x.push("#",Wo(F,th)),x.join("")};function Jt(x){return new $t(x)}function hn(x,N,F){x.j=F?Ca(N,!0):N,x.j&&(x.j=x.j.replace(/:$/,""))}function yi(x,N){if(N){if(N=Number(N),isNaN(N)||0>N)throw Error("Bad port number "+N);x.s=N}else x.s=null}function ei(x,N,F){N instanceof nh?(x.i=N,HS(x.i,x.h)):(F||(N=Wo(N,Jm)),x.i=new nh(N,x.h))}function yn(x,N,F){x.i.set(N,F)}function fl(x){return yn(x,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),x}function Ca(x,N){return x?N?decodeURI(x.replace(/%25/g,"%2525")):decodeURIComponent(x):""}function Wo(x,N,F){return typeof x=="string"?(x=encodeURI(x).replace(N,of),F&&(x=x.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),x):null}function of(x){return x=x.charCodeAt(0),"%"+(x>>4&15).toString(16)+(x&15).toString(16)}var $v=/[#\/\?@]/g,zS=/[#\?:]/g,$m=/[#\?]/g,Jm=/[#\?@]/g,th=/#/g;function nh(x,N){this.h=this.g=null,this.i=x||null,this.j=!!N}function _o(x){x.g||(x.g=new Map,x.h=0,x.i&&Zt(x.i,function(N,F){x.add(decodeURIComponent(N.replace(/\+/g," ")),F)}))}n=nh.prototype,n.add=function(x,N){_o(this),this.i=null,x=pl(this,x);var F=this.g.get(x);return F||this.g.set(x,F=[]),F.push(N),this.h+=1,this};function bn(x,N){_o(x),N=pl(x,N),x.g.has(N)&&(x.i=null,x.h-=x.g.get(N).length,x.g.delete(N))}function Qm(x,N){return _o(x),N=pl(x,N),x.g.has(N)}n.forEach=function(x,N){_o(this),this.g.forEach(function(F,W){F.forEach(function(me){x.call(N,me,W,this)},this)},this)},n.na=function(){_o(this);const x=Array.from(this.g.values()),N=Array.from(this.g.keys()),F=[];for(let W=0;W<N.length;W++){const me=x[W];for(let Se=0;Se<me.length;Se++)F.push(N[W])}return F},n.V=function(x){_o(this);let N=[];if(typeof x=="string")Qm(this,x)&&(N=N.concat(this.g.get(pl(this,x))));else{x=Array.from(this.g.values());for(let F=0;F<x.length;F++)N=N.concat(x[F])}return N},n.set=function(x,N){return _o(this),this.i=null,x=pl(this,x),Qm(this,x)&&(this.h-=this.g.get(x).length),this.g.set(x,[N]),this.h+=1,this},n.get=function(x,N){return x?(x=this.V(x),0<x.length?String(x[0]):N):N};function af(x,N,F){bn(x,N),0<F.length&&(x.i=null,x.g.set(pl(x,N),_(F)),x.h+=F.length)}n.toString=function(){if(this.i)return this.i;if(!this.g)return"";const x=[],N=Array.from(this.g.keys());for(var F=0;F<N.length;F++){var W=N[F];const Se=encodeURIComponent(String(W)),et=this.V(W);for(W=0;W<et.length;W++){var me=Se;et[W]!==""&&(me+="="+encodeURIComponent(String(et[W]))),x.push(me)}}return this.i=x.join("&")};function pl(x,N){return N=String(N),x.j&&(N=N.toLowerCase()),N}function HS(x,N){N&&!x.j&&(_o(x),x.i=null,x.g.forEach(function(F,W){var me=W.toLowerCase();W!=me&&(bn(this,W),af(this,me,F))},x)),x.j=N}function GS(x,N){const F=new jn;if(a.Image){const W=new Image;W.onload=m(xo,F,"TestLoadImage: loaded",!0,N,W),W.onerror=m(xo,F,"TestLoadImage: error",!1,N,W),W.onabort=m(xo,F,"TestLoadImage: abort",!1,N,W),W.ontimeout=m(xo,F,"TestLoadImage: timeout",!1,N,W),a.setTimeout(function(){W.ontimeout&&W.ontimeout()},1e4),W.src=x}else N(!1)}function Hi(x,N){const F=new jn,W=new AbortController,me=setTimeout(()=>{W.abort(),xo(F,"TestPingServer: timeout",!1,N)},1e4);fetch(x,{signal:W.signal}).then(Se=>{clearTimeout(me),Se.ok?xo(F,"TestPingServer: ok",!0,N):xo(F,"TestPingServer: server error",!1,N)}).catch(()=>{clearTimeout(me),xo(F,"TestPingServer: error",!1,N)})}function xo(x,N,F,W,me){try{me&&(me.onload=null,me.onerror=null,me.onabort=null,me.ontimeout=null),W(F)}catch{}}function jS(){this.g=new Te}function Zm(x,N,F){const W=F||"";try{Pn(x,function(me,Se){let et=me;c(me)&&(et=ut(me)),N.push(W+Se+"="+encodeURIComponent(et))})}catch(me){throw N.push(W+"type="+encodeURIComponent("_badmap")),me}}function lf(x){this.l=x.Ub||null,this.j=x.eb||!1}y(lf,Ye),lf.prototype.g=function(){return new ml(this.l,this.j)},lf.prototype.i=function(x){return function(){return x}}({});function ml(x,N){Ee.call(this),this.D=x,this.o=N,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}y(ml,Ee),n=ml.prototype,n.open=function(x,N){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=x,this.A=N,this.readyState=1,rh(this)},n.send=function(x){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const N={headers:this.u,method:this.B,credentials:this.m,cache:void 0};x&&(N.body=x),(this.D||a).fetch(new Request(this.A,N)).then(this.Sa.bind(this),this.ga.bind(this))},n.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,ih(this)),this.readyState=0},n.Sa=function(x){if(this.g&&(this.l=x,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=x.headers,this.readyState=2,rh(this)),this.g&&(this.readyState=3,rh(this),this.g)))if(this.responseType==="arraybuffer")x.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof a.ReadableStream<"u"&&"body"in x){if(this.j=x.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;qs(this)}else x.text().then(this.Ra.bind(this),this.ga.bind(this))};function qs(x){x.j.read().then(x.Pa.bind(x)).catch(x.ga.bind(x))}n.Pa=function(x){if(this.g){if(this.o&&x.value)this.response.push(x.value);else if(!this.o){var N=x.value?x.value:new Uint8Array(0);(N=this.v.decode(N,{stream:!x.done}))&&(this.response=this.responseText+=N)}x.done?ih(this):rh(this),this.readyState==3&&qs(this)}},n.Ra=function(x){this.g&&(this.response=this.responseText=x,ih(this))},n.Qa=function(x){this.g&&(this.response=x,ih(this))},n.ga=function(){this.g&&ih(this)};function ih(x){x.readyState=4,x.l=null,x.j=null,x.v=null,rh(x)}n.setRequestHeader=function(x,N){this.u.append(x,N)},n.getResponseHeader=function(x){return this.h&&this.h.get(x.toLowerCase())||""},n.getAllResponseHeaders=function(){if(!this.h)return"";const x=[],N=this.h.entries();for(var F=N.next();!F.done;)F=F.value,x.push(F[0]+": "+F[1]),F=N.next();return x.join(`\r
`)};function rh(x){x.onreadystatechange&&x.onreadystatechange.call(x)}Object.defineProperty(ml.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(x){this.m=x?"include":"same-origin"}});function Ys(x){let N="";return D(x,function(F,W){N+=W,N+=":",N+=F,N+=`\r
`}),N}function $s(x,N,F){e:{for(W in F){var W=!1;break e}W=!0}W||(F=Ys(F),typeof x=="string"?F!=null&&encodeURIComponent(String(F)):yn(x,N,F))}function ti(x){Ee.call(this),this.headers=new Map,this.o=x||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}y(ti,Ee);var eg=/^https?$/i,Jv=["POST","PUT"];n=ti.prototype,n.Ha=function(x){this.J=x},n.ea=function(x,N,F,W){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+x);N=N?N.toUpperCase():"GET",this.D=x,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():K.g(),this.v=this.o?se(this.o):se(K),this.g.onreadystatechange=f(this.Ea,this);try{this.B=!0,this.g.open(N,String(x),!0),this.B=!1}catch(Se){Qv(this,Se);return}if(x=F||"",F=new Map(this.headers),W)if(Object.getPrototypeOf(W)===Object.prototype)for(var me in W)F.set(me,W[me]);else if(typeof W.keys=="function"&&typeof W.get=="function")for(const Se of W.keys())F.set(Se,W.get(Se));else throw Error("Unknown input type for opt_headers: "+String(W));W=Array.from(F.keys()).find(Se=>Se.toLowerCase()=="content-type"),me=a.FormData&&x instanceof a.FormData,!(0<=Array.prototype.indexOf.call(Jv,N,void 0))||W||me||F.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[Se,et]of F)this.g.setRequestHeader(Se,et);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{e_(this),this.u=!0,this.g.send(x),this.u=!1}catch(Se){Qv(this,Se)}};function Qv(x,N){x.h=!1,x.g&&(x.j=!0,x.g.abort(),x.j=!1),x.l=N,x.m=5,Js(x),gl(x)}function Js(x){x.A||(x.A=!0,tt(x,"complete"),tt(x,"error"))}n.abort=function(x){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=x||7,tt(this,"complete"),tt(this,"abort"),gl(this))},n.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),gl(this,!0)),ti.aa.N.call(this)},n.Ea=function(){this.s||(this.B||this.u||this.j?Zv(this):this.bb())},n.bb=function(){Zv(this)};function Zv(x){if(x.h&&typeof o<"u"&&(!x.v[1]||Li(x)!=4||x.Z()!=2)){if(x.u&&Li(x)==4)ct(x.Ea,0,x);else if(tt(x,"readystatechange"),Li(x)==4){x.h=!1;try{const et=x.Z();e:switch(et){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var N=!0;break e;default:N=!1}var F;if(!(F=N)){var W;if(W=et===0){var me=String(x.D).match(gn)[1]||null;!me&&a.self&&a.self.location&&(me=a.self.location.protocol.slice(0,-1)),W=!eg.test(me?me.toLowerCase():"")}F=W}if(F)tt(x,"complete"),tt(x,"success");else{x.m=6;try{var Se=2<Li(x)?x.g.statusText:""}catch{Se=""}x.l=Se+" ["+x.Z()+"]",Js(x)}}finally{gl(x)}}}}function gl(x,N){if(x.g){e_(x);const F=x.g,W=x.v[0]?()=>{}:null;x.g=null,x.v=null,N||tt(x,"ready");try{F.onreadystatechange=W}catch{}}}function e_(x){x.I&&(a.clearTimeout(x.I),x.I=null)}n.isActive=function(){return!!this.g};function Li(x){return x.g?x.g.readyState:0}n.Z=function(){try{return 2<Li(this)?this.g.status:-1}catch{return-1}},n.oa=function(){try{return this.g?this.g.responseText:""}catch{return""}},n.Oa=function(x){if(this.g){var N=this.g.responseText;return x&&N.indexOf(x)==0&&(N=N.substring(x.length)),oe(N)}};function sh(x){try{if(!x.g)return null;if("response"in x.g)return x.g.response;switch(x.H){case"":case"text":return x.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in x.g)return x.g.mozResponseArrayBuffer}return null}catch{return null}}function cf(x){const N={};x=(x.g&&2<=Li(x)&&x.g.getAllResponseHeaders()||"").split(`\r
`);for(let W=0;W<x.length;W++){if(w(x[W]))continue;var F=k(x[W]);const me=F[0];if(F=F[1],typeof F!="string")continue;F=F.trim();const Se=N[me]||[];N[me]=Se,Se.push(F)}R(N,function(W){return W.join(", ")})}n.Ba=function(){return this.m},n.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function wo(x,N,F){return F&&F.internalChannelParams&&F.internalChannelParams[x]||N}function uf(x){this.Aa=0,this.i=[],this.j=new jn,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=wo("failFast",!1,x),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=wo("baseRetryDelayMs",5e3,x),this.cb=wo("retryDelaySeedMs",1e4,x),this.Wa=wo("forwardChannelMaxRetries",2,x),this.wa=wo("forwardChannelRequestTimeoutMs",2e4,x),this.pa=x&&x.xmlHttpFactory||void 0,this.Xa=x&&x.Tb||void 0,this.Ca=x&&x.useFetchStreams||!1,this.L=void 0,this.J=x&&x.supportsCrossDomainXhr||!1,this.K="",this.h=new Rt(x&&x.concurrentRequestLimit),this.Da=new jS,this.P=x&&x.fastHandshake||!1,this.O=x&&x.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=x&&x.Rb||!1,x&&x.xa&&this.j.xa(),x&&x.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&x&&x.detectBufferingProxy||!1,this.ja=void 0,x&&x.longPollingTimeout&&0<x.longPollingTimeout&&(this.ja=x.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}n=uf.prototype,n.la=8,n.G=1,n.connect=function(x,N,F,W){sn(0),this.W=x,this.H=N||{},F&&W!==void 0&&(this.H.OSID=F,this.H.OAID=W),this.F=this.X,this.I=pf(this,null,this.W),vc(this)};function oh(x){if(hf(x),x.G==3){var N=x.U++,F=Jt(x.I);if(yn(F,"SID",x.K),yn(F,"RID",N),yn(F,"TYPE","terminate"),kr(x,F),N=new xe(x,x.j,N),N.L=2,N.v=fl(Jt(F)),F=!1,a.navigator&&a.navigator.sendBeacon)try{F=a.navigator.sendBeacon(N.v.toString(),"")}catch{}!F&&a.Image&&(new Image().src=N.v,F=!0),F||(N.g=ch(N.j,null),N.g.ea(N.v)),N.F=Date.now(),_e(N)}ng(x)}function ah(x){x.g&&(Qs(x),x.g.cancel(),x.g=null)}function hf(x){ah(x),x.u&&(a.clearTimeout(x.u),x.u=null),yl(x),x.h.cancel(),x.s&&(typeof x.s=="number"&&a.clearTimeout(x.s),x.s=null)}function vc(x){if(!vt(x.h)&&!x.s){x.s=!0;var N=x.Ga;de||te(),G||(de(),G=!0),$.add(N,x),x.B=0}}function _c(x,N){return Ft(x.h)>=x.h.j-(x.s?1:0)?!1:x.s?(x.i=N.D.concat(x.i),!0):x.G==1||x.G==2||x.B>=(x.Va?0:x.Wa)?!1:(x.s=mi(f(x.Ga,x,N),lh(x,x.B)),x.B++,!0)}n.Ga=function(x){if(this.s)if(this.s=null,this.G==1){if(!x){this.U=Math.floor(1e5*Math.random()),x=this.U++;const me=new xe(this,this.j,x);let Se=this.o;if(this.S&&(Se?(Se=I(Se),C(Se,this.S)):Se=this.S),this.m!==null||this.O||(me.H=Se,Se=null),this.P)e:{for(var N=0,F=0;F<this.i.length;F++){t:{var W=this.i[F];if("__data__"in W.map&&(W=W.map.__data__,typeof W=="string")){W=W.length;break t}W=void 0}if(W===void 0)break;if(N+=W,4096<N){N=F;break e}if(N===4096||F===this.i.length-1){N=F+1;break e}}N=1e3}else N=1e3;N=Ko(this,me,N),F=Jt(this.I),yn(F,"RID",x),yn(F,"CVER",22),this.D&&yn(F,"X-HTTP-Session-Id",this.D),kr(this,F),Se&&(this.O?N="headers="+encodeURIComponent(String(Ys(Se)))+"&"+N:this.m&&$s(F,this.m,Se)),rt(this.h,me),this.Ua&&yn(F,"TYPE","init"),this.P?(yn(F,"$req",N),yn(F,"SID","null"),me.T=!0,ne(me,F,null)):ne(me,F,N),this.G=2}}else this.G==3&&(x?ls(this,x):this.i.length==0||vt(this.h)||ls(this))};function ls(x,N){var F;N?F=N.l:F=x.U++;const W=Jt(x.I);yn(W,"SID",x.K),yn(W,"RID",F),yn(W,"AID",x.T),kr(x,W),x.m&&x.o&&$s(W,x.m,x.o),F=new xe(x,x.j,F,x.B+1),x.m===null&&(F.H=x.o),N&&(x.i=N.D.concat(x.i)),N=Ko(x,F,1e3),F.I=Math.round(.5*x.wa)+Math.round(.5*x.wa*Math.random()),rt(x.h,F),ne(F,W,N)}function kr(x,N){x.H&&D(x.H,function(F,W){yn(N,W,F)}),x.l&&Pn({},function(F,W){yn(N,W,F)})}function Ko(x,N,F){F=Math.min(x.i.length,F);var W=x.l?f(x.l.Na,x.l,x):null;e:{var me=x.i;let Se=-1;for(;;){const et=["count="+F];Se==-1?0<F?(Se=me[0].g,et.push("ofs="+Se)):Se=0:et.push("ofs="+Se);let Cn=!0;for(let Gi=0;Gi<F;Gi++){let En=me[Gi].g;const ji=me[Gi].map;if(En-=Se,0>En)Se=Math.max(0,me[Gi].g-100),Cn=!1;else try{Zm(ji,et,"req"+En+"_")}catch{W&&W(ji)}}if(Cn){W=et.join("&");break e}}}return x=x.i.splice(0,F),N.D=x,W}function df(x){if(!x.g&&!x.u){x.Y=1;var N=x.Fa;de||te(),G||(de(),G=!0),$.add(N,x),x.v=0}}function ff(x){return x.g||x.u||3<=x.v?!1:(x.Y++,x.u=mi(f(x.Fa,x),lh(x,x.v)),x.v++,!0)}n.Fa=function(){if(this.u=null,Xo(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var x=2*this.R;this.j.info("BP detection timer enabled: "+x),this.A=mi(f(this.ab,this),x)}},n.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,sn(10),ah(this),Xo(this))};function Qs(x){x.A!=null&&(a.clearTimeout(x.A),x.A=null)}function Xo(x){x.g=new xe(x,x.j,"rpc",x.Y),x.m===null&&(x.g.H=x.o),x.g.O=0;var N=Jt(x.qa);yn(N,"RID","rpc"),yn(N,"SID",x.K),yn(N,"AID",x.T),yn(N,"CI",x.F?"0":"1"),!x.F&&x.ja&&yn(N,"TO",x.ja),yn(N,"TYPE","xmlhttp"),kr(x,N),x.m&&x.o&&$s(N,x.m,x.o),x.L&&(x.g.I=x.L);var F=x.g;x=x.ia,F.L=1,F.v=fl(Jt(N)),F.m=null,F.P=!0,re(F,x)}n.Za=function(){this.C!=null&&(this.C=null,ah(this),ff(this),sn(19))};function yl(x){x.C!=null&&(a.clearTimeout(x.C),x.C=null)}function tg(x,N){var F=null;if(x.g==N){yl(x),Qs(x),x.g=null;var W=2}else if(At(x.h,N))F=N.D,Wt(x.h,N),W=1;else return;if(x.G!=0){if(N.o)if(W==1){F=N.m?N.m.length:0,N=Date.now()-N.F;var me=x.B;W=Et(),tt(W,new wr(W,F)),vc(x)}else df(x);else if(me=N.s,me==3||me==0&&0<N.X||!(W==1&&_c(x,N)||W==2&&ff(x)))switch(F&&0<F.length&&(N=x.h,N.i=N.i.concat(F)),me){case 1:Ma(x,5);break;case 4:Ma(x,10);break;case 3:Ma(x,6);break;default:Ma(x,2)}}}function lh(x,N){let F=x.Ta+Math.floor(Math.random()*x.cb);return x.isActive()||(F*=2),F*N}function Ma(x,N){if(x.j.info("Error code "+N),N==2){var F=f(x.fb,x),W=x.Xa;const me=!W;W=new $t(W||"//www.google.com/images/cleardot.gif"),a.location&&a.location.protocol=="http"||hn(W,"https"),fl(W),me?GS(W.toString(),F):Hi(W.toString(),F)}else sn(2);x.G=0,x.l&&x.l.sa(N),ng(x),hf(x)}n.fb=function(x){x?(this.j.info("Successfully pinged google.com"),sn(2)):(this.j.info("Failed to ping google.com"),sn(1))};function ng(x){if(x.G=0,x.ka=[],x.l){const N=Ut(x.h);(N.length!=0||x.i.length!=0)&&(v(x.ka,N),v(x.ka,x.i),x.h.i.length=0,_(x.i),x.i.length=0),x.l.ra()}}function pf(x,N,F){var W=F instanceof $t?Jt(F):new $t(F);if(W.g!="")N&&(W.g=N+"."+W.g),yi(W,W.s);else{var me=a.location;W=me.protocol,N=N?N+"."+me.hostname:me.hostname,me=+me.port;var Se=new $t(null);W&&hn(Se,W),N&&(Se.g=N),me&&yi(Se,me),F&&(Se.l=F),W=Se}return F=x.D,N=x.ya,F&&N&&yn(W,F,N),yn(W,"VER",x.la),kr(x,W),W}function ch(x,N,F){if(N&&!x.J)throw Error("Can't create secondary domain capable XhrIo object.");return N=x.Ca&&!x.pa?new ti(new lf({eb:F})):new ti(x.pa),N.Ha(x.J),N}n.isActive=function(){return!!this.l&&this.l.isActive(this)};function ig(){}n=ig.prototype,n.ua=function(){},n.ta=function(){},n.sa=function(){},n.ra=function(){},n.isActive=function(){return!0},n.Na=function(){};function uh(){}uh.prototype.g=function(x,N){return new Br(x,N)};function Br(x,N){Ee.call(this),this.g=new uf(N),this.l=x,this.h=N&&N.messageUrlParams||null,x=N&&N.messageHeaders||null,N&&N.clientProtocolHeaderRequired&&(x?x["X-Client-Protocol"]="webchannel":x={"X-Client-Protocol":"webchannel"}),this.g.o=x,x=N&&N.initMessageHeaders||null,N&&N.messageContentType&&(x?x["X-WebChannel-Content-Type"]=N.messageContentType:x={"X-WebChannel-Content-Type":N.messageContentType}),N&&N.va&&(x?x["X-WebChannel-Client-Profile"]=N.va:x={"X-WebChannel-Client-Profile":N.va}),this.g.S=x,(x=N&&N.Sb)&&!w(x)&&(this.g.m=x),this.v=N&&N.supportsCrossDomainXhr||!1,this.u=N&&N.sendRawJson||!1,(N=N&&N.httpSessionIdParam)&&!w(N)&&(this.g.D=N,x=this.h,x!==null&&N in x&&(x=this.h,N in x&&delete x[N])),this.j=new Zs(this)}y(Br,Ee),Br.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},Br.prototype.close=function(){oh(this.g)},Br.prototype.o=function(x){var N=this.g;if(typeof x=="string"){var F={};F.__data__=x,x=F}else this.u&&(F={},F.__data__=ut(x),x=F);N.i.push(new Tt(N.Ya++,x)),N.G==3&&vc(N)},Br.prototype.N=function(){this.g.l=null,delete this.j,oh(this.g),delete this.g,Br.aa.N.call(this)};function mf(x){De.call(this),x.__headers__&&(this.headers=x.__headers__,this.statusCode=x.__status__,delete x.__headers__,delete x.__status__);var N=x.__sm__;if(N){e:{for(const F in N){x=F;break e}x=void 0}(this.i=x)&&(x=this.i,N=N!==null&&x in N?N[x]:void 0),this.data=N}else this.data=x}y(mf,De);function vl(){ot.call(this),this.status=1}y(vl,ot);function Zs(x){this.g=x}y(Zs,ig),Zs.prototype.ua=function(){tt(this.g,"a")},Zs.prototype.ta=function(x){tt(this.g,new mf(x))},Zs.prototype.sa=function(x){tt(this.g,new vl)},Zs.prototype.ra=function(){tt(this.g,"b")},uh.prototype.createWebChannel=uh.prototype.g,Br.prototype.send=Br.prototype.o,Br.prototype.open=Br.prototype.m,Br.prototype.close=Br.prototype.close,fj=function(){return new uh},dj=function(){return Et()},hj=it,zI={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},Xs.NO_ERROR=0,Xs.TIMEOUT=8,Xs.HTTP_ERROR=6,kw=Xs,H.COMPLETE="complete",uj=H,ye.EventType=we,we.OPEN="a",we.CLOSE="b",we.ERROR="c",we.MESSAGE="d",Ee.prototype.listen=Ee.prototype.K,oy=ye,ti.prototype.listenOnce=ti.prototype.L,ti.prototype.getLastError=ti.prototype.Ka,ti.prototype.getLastErrorCode=ti.prototype.Ba,ti.prototype.getStatus=ti.prototype.Z,ti.prototype.getResponseJson=ti.prototype.Oa,ti.prototype.getResponseText=ti.prototype.oa,ti.prototype.send=ti.prototype.ea,ti.prototype.setWithCredentials=ti.prototype.Ha,cj=ti}).apply(typeof lx<"u"?lx:typeof self<"u"?self:typeof window<"u"?window:{});const r3="@firebase/firestore";/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Yr{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}Yr.UNAUTHENTICATED=new Yr(null),Yr.GOOGLE_CREDENTIALS=new Yr("google-credentials-uid"),Yr.FIRST_PARTY=new Yr("first-party-uid"),Yr.MOCK_USER=new Yr("mock-user");/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let Fm="10.14.0";/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Id=new PA("@firebase/firestore");function Pg(){return Id.logLevel}function kt(n,...e){if(Id.logLevel<=Sn.DEBUG){const t=e.map(G2);Id.debug(`Firestore (${Fm}): ${n}`,...t)}}function sc(n,...e){if(Id.logLevel<=Sn.ERROR){const t=e.map(G2);Id.error(`Firestore (${Fm}): ${n}`,...t)}}function lm(n,...e){if(Id.logLevel<=Sn.WARN){const t=e.map(G2);Id.warn(`Firestore (${Fm}): ${n}`,...t)}}function G2(n){if(typeof n=="string")return n;try{/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/return function(t){return JSON.stringify(t)}(n)}catch{return n}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function en(n="Unexpected state"){const e=`FIRESTORE (${Fm}) INTERNAL ASSERTION FAILED: `+n;throw sc(e),new Error(e)}function Qn(n,e){n||en()}function rn(n,e){return n}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const He={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class bt extends fc{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Xl{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class pj{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class Vce{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(Yr.UNAUTHENTICATED))}shutdown(){}}class zce{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable(()=>t(this.token.user))}shutdown(){this.changeListener=null}}class Hce{constructor(e){this.t=e,this.currentUser=Yr.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){Qn(this.o===void 0);let i=this.i;const r=l=>this.i!==i?(i=this.i,t(l)):Promise.resolve();let s=new Xl;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new Xl,e.enqueueRetryable(()=>r(this.currentUser))};const o=()=>{const l=s;e.enqueueRetryable(async()=>{await l.promise,await r(this.currentUser)})},a=l=>{kt("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=l,this.o&&(this.auth.addAuthTokenListener(this.o),o())};this.t.onInit(l=>a(l)),setTimeout(()=>{if(!this.auth){const l=this.t.getImmediate({optional:!0});l?a(l):(kt("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new Xl)}},0),o()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(i=>this.i!==e?(kt("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):i?(Qn(typeof i.accessToken=="string"),new pj(i.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return Qn(e===null||typeof e=="string"),new Yr(e)}}class Gce{constructor(e,t,i){this.l=e,this.h=t,this.P=i,this.type="FirstParty",this.user=Yr.FIRST_PARTY,this.I=new Map}T(){return this.P?this.P():null}get headers(){this.I.set("X-Goog-AuthUser",this.l);const e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}class jce{constructor(e,t,i){this.l=e,this.h=t,this.P=i}getToken(){return Promise.resolve(new Gce(this.l,this.h,this.P))}start(e,t){e.enqueueRetryable(()=>t(Yr.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class Wce{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Kce{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,t){Qn(this.o===void 0);const i=s=>{s.error!=null&&kt("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${s.error.message}`);const o=s.token!==this.R;return this.R=s.token,kt("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?t(s.token):Promise.resolve()};this.o=s=>{e.enqueueRetryable(()=>i(s))};const r=s=>{kt("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=s,this.o&&this.appCheck.addTokenListener(this.o)};this.A.onInit(s=>r(s)),setTimeout(()=>{if(!this.appCheck){const s=this.A.getImmediate({optional:!0});s?r(s):kt("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(t=>t?(Qn(typeof t.token=="string"),this.R=t.token,new Wce(t.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Xce(n){const e=typeof self<"u"&&(self.crypto||self.msCrypto),t=new Uint8Array(n);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(t);else for(let i=0;i<n;i++)t[i]=Math.floor(256*Math.random());return t}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class mj{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=Math.floor(256/e.length)*e.length;let i="";for(;i.length<20;){const r=Xce(40);for(let s=0;s<r.length;++s)i.length<20&&r[s]<t&&(i+=e.charAt(r[s]%e.length))}return i}}function Hn(n,e){return n<e?-1:n>e?1:0}function cm(n,e,t){return n.length===e.length&&n.every((i,r)=>t(i,e[r]))}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class sr{constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new bt(He.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new bt(He.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-62135596800)throw new bt(He.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new bt(He.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return sr.fromMillis(Date.now())}static fromDate(e){return sr.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),i=Math.floor(1e6*(e-1e3*t));return new sr(t,i)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?Hn(this.nanoseconds,e.nanoseconds):Hn(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class nn{constructor(e){this.timestamp=e}static fromTimestamp(e){return new nn(e)}static min(){return new nn(new sr(0,0))}static max(){return new nn(new sr(253402300799,999999999))}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class A0{constructor(e,t,i){t===void 0?t=0:t>e.length&&en(),i===void 0?i=e.length-t:i>e.length-t&&en(),this.segments=e,this.offset=t,this.len=i}get length(){return this.len}isEqual(e){return A0.comparator(this,e)===0}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof A0?e.forEach(i=>{t.push(i)}):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,i=this.limit();t<i;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){const i=Math.min(e.length,t.length);for(let r=0;r<i;r++){const s=e.get(r),o=t.get(r);if(s<o)return-1;if(s>o)return 1}return e.length<t.length?-1:e.length>t.length?1:0}}class ui extends A0{construct(e,t,i){return new ui(e,t,i)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const t=[];for(const i of e){if(i.indexOf("//")>=0)throw new bt(He.INVALID_ARGUMENT,`Invalid segment (${i}). Paths must not contain // in them.`);t.push(...i.split("/").filter(r=>r.length>0))}return new ui(t)}static emptyPath(){return new ui([])}}const qce=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class br extends A0{construct(e,t,i){return new br(e,t,i)}static isValidIdentifier(e){return qce.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),br.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)==="__name__"}static keyField(){return new br(["__name__"])}static fromServerFormat(e){const t=[];let i="",r=0;const s=()=>{if(i.length===0)throw new bt(He.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(i),i=""};let o=!1;for(;r<e.length;){const a=e[r];if(a==="\\"){if(r+1===e.length)throw new bt(He.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const l=e[r+1];if(l!=="\\"&&l!=="."&&l!=="`")throw new bt(He.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);i+=l,r+=2}else a==="`"?(o=!o,r++):a!=="."||o?(i+=a,r++):(s(),r++)}if(s(),o)throw new bt(He.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new br(t)}static emptyPath(){return new br([])}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class jt{constructor(e){this.path=e}static fromPath(e){return new jt(ui.fromString(e))}static fromName(e){return new jt(ui.fromString(e).popFirst(5))}static empty(){return new jt(ui.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&ui.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return ui.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new jt(new ui(e.slice()))}}function Yce(n,e){const t=n.toTimestamp().seconds,i=n.toTimestamp().nanoseconds+1,r=nn.fromTimestamp(i===1e9?new sr(t+1,0):new sr(t,i));return new Lu(r,jt.empty(),e)}function $ce(n){return new Lu(n.readTime,n.key,-1)}class Lu{constructor(e,t,i){this.readTime=e,this.documentKey=t,this.largestBatchId=i}static min(){return new Lu(nn.min(),jt.empty(),-1)}static max(){return new Lu(nn.max(),jt.empty(),-1)}}function Jce(n,e){let t=n.readTime.compareTo(e.readTime);return t!==0?t:(t=jt.comparator(n.documentKey,e.documentKey),t!==0?t:Hn(n.largestBatchId,e.largestBatchId))}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Qce="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class Zce{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function dv(n){if(n.code!==He.FAILED_PRECONDITION||n.message!==Qce)throw n;kt("LocalStore","Unexpectedly lost primary lease")}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class qe{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)},t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)})}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&en(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new qe((i,r)=>{this.nextCallback=s=>{this.wrapSuccess(e,s).next(i,r)},this.catchCallback=s=>{this.wrapFailure(t,s).next(i,r)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{const t=e();return t instanceof qe?t:qe.resolve(t)}catch(t){return qe.reject(t)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):qe.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):qe.reject(t)}static resolve(e){return new qe((t,i)=>{t(e)})}static reject(e){return new qe((t,i)=>{i(e)})}static waitFor(e){return new qe((t,i)=>{let r=0,s=0,o=!1;e.forEach(a=>{++r,a.next(()=>{++s,o&&s===r&&t()},l=>i(l))}),o=!0,s===r&&t()})}static or(e){let t=qe.resolve(!1);for(const i of e)t=t.next(r=>r?qe.resolve(r):i());return t}static forEach(e,t){const i=[];return e.forEach((r,s)=>{i.push(t.call(this,r,s))}),this.waitFor(i)}static mapArray(e,t){return new qe((i,r)=>{const s=e.length,o=new Array(s);let a=0;for(let l=0;l<s;l++){const c=l;t(e[c]).next(u=>{o[c]=u,++a,a===s&&i(o)},u=>r(u))}})}static doWhile(e,t){return new qe((i,r)=>{const s=()=>{e()===!0?t().next(()=>{s()},r):i()};s()})}}function eue(n){const e=n.match(/Android ([\d.]+)/i),t=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(t)}function fv(n){return n.name==="IndexedDbTransactionError"}/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class j2{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=i=>this.ie(i),this.se=i=>t.writeSequenceNumber(i))}ie(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.se&&this.se(e),e}}j2.oe=-1;function DA(n){return n==null}function V1(n){return n===0&&1/n==-1/0}function tue(n){return typeof n=="number"&&Number.isInteger(n)&&!V1(n)&&n<=Number.MAX_SAFE_INTEGER&&n>=Number.MIN_SAFE_INTEGER}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function s3(n){let e=0;for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e++;return e}function Yd(n,e){for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(t,n[t])}function gj(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let Zi=class HI{constructor(e,t){this.comparator=e,this.root=t||wu.EMPTY}insert(e,t){return new HI(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,wu.BLACK,null,null))}remove(e){return new HI(this.comparator,this.root.remove(e,this.comparator).copy(null,null,wu.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){const i=this.comparator(e,t.key);if(i===0)return t.value;i<0?t=t.left:i>0&&(t=t.right)}return null}indexOf(e){let t=0,i=this.root;for(;!i.isEmpty();){const r=this.comparator(e,i.key);if(r===0)return t+i.left.size;r<0?i=i.left:(t+=i.left.size+1,i=i.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((t,i)=>(e(t,i),!1))}toString(){const e=[];return this.inorderTraversal((t,i)=>(e.push(`${t}:${i}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new cx(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new cx(this.root,e,this.comparator,!1)}getReverseIterator(){return new cx(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new cx(this.root,e,this.comparator,!0)}},cx=class{constructor(e,t,i,r){this.isReverse=r,this.nodeStack=[];let s=1;for(;!e.isEmpty();)if(s=t?i(e.key,t):1,t&&r&&(s*=-1),s<0)e=this.isReverse?e.left:e.right;else{if(s===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}},wu=class Il{constructor(e,t,i,r,s){this.key=e,this.value=t,this.color=i??Il.RED,this.left=r??Il.EMPTY,this.right=s??Il.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,i,r,s){return new Il(e??this.key,t??this.value,i??this.color,r??this.left,s??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,i){let r=this;const s=i(e,r.key);return r=s<0?r.copy(null,null,null,r.left.insert(e,t,i),null):s===0?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,i)),r.fixUp()}removeMin(){if(this.left.isEmpty())return Il.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,t){let i,r=this;if(t(e,r.key)<0)r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(e,t),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),t(e,r.key)===0){if(r.right.isEmpty())return Il.EMPTY;i=r.right.min(),r=r.copy(i.key,i.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(e,t))}return r.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,Il.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,Il.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed()||this.right.isRed())throw en();const e=this.left.check();if(e!==this.right.check())throw en();return e+(this.isRed()?0:1)}};wu.EMPTY=null,wu.RED=!0,wu.BLACK=!1;wu.EMPTY=new class{constructor(){this.size=0}get key(){throw en()}get value(){throw en()}get color(){throw en()}get left(){throw en()}get right(){throw en()}copy(e,t,i,r,s){return this}insert(e,t,i){return new wu(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Ir{constructor(e){this.comparator=e,this.data=new Zi(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((t,i)=>(e(t),!1))}forEachInRange(e,t){const i=this.data.getIteratorFrom(e[0]);for(;i.hasNext();){const r=i.getNext();if(this.comparator(r.key,e[1])>=0)return;t(r.key)}}forEachWhile(e,t){let i;for(i=t!==void 0?this.data.getIteratorFrom(t):this.data.getIterator();i.hasNext();)if(!e(i.getNext().key))return}firstAfterOrEqual(e){const t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new o3(this.data.getIterator())}getIteratorFrom(e){return new o3(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach(i=>{t=t.add(i)}),t}isEqual(e){if(!(e instanceof Ir)||this.size!==e.size)return!1;const t=this.data.getIterator(),i=e.data.getIterator();for(;t.hasNext();){const r=t.getNext().key,s=i.getNext().key;if(this.comparator(r,s)!==0)return!1}return!0}toArray(){const e=[];return this.forEach(t=>{e.push(t)}),e}toString(){const e=[];return this.forEach(t=>e.push(t)),"SortedSet("+e.toString()+")"}copy(e){const t=new Ir(this.comparator);return t.data=e,t}}class o3{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ao{constructor(e){this.fields=e,e.sort(br.comparator)}static empty(){return new ao([])}unionWith(e){let t=new Ir(br.comparator);for(const i of this.fields)t=t.add(i);for(const i of e)t=t.add(i);return new ao(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return cm(this.fields,e.fields,(t,i)=>t.isEqual(i))}}/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class yj extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Dr{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(r){try{return atob(r)}catch(s){throw typeof DOMException<"u"&&s instanceof DOMException?new yj("Invalid base64 string: "+s):s}}(e);return new Dr(t)}static fromUint8Array(e){const t=function(r){let s="";for(let o=0;o<r.length;++o)s+=String.fromCharCode(r[o]);return s}(e);return new Dr(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(t){return btoa(t)}(this.binaryString)}toUint8Array(){return function(t){const i=new Uint8Array(t.length);for(let r=0;r<t.length;r++)i[r]=t.charCodeAt(r);return i}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return Hn(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}Dr.EMPTY_BYTE_STRING=new Dr("");const nue=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function ku(n){if(Qn(!!n),typeof n=="string"){let e=0;const t=nue.exec(n);if(Qn(!!t),t[1]){let r=t[1];r=(r+"000000000").substr(0,9),e=Number(r)}const i=new Date(n);return{seconds:Math.floor(i.getTime()/1e3),nanos:e}}return{seconds:Oi(n.seconds),nanos:Oi(n.nanos)}}function Oi(n){return typeof n=="number"?n:typeof n=="string"?Number(n):0}function Rd(n){return typeof n=="string"?Dr.fromBase64String(n):Dr.fromUint8Array(n)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function W2(n){var e,t;return((t=(((e=n==null?void 0:n.mapValue)===null||e===void 0?void 0:e.fields)||{}).__type__)===null||t===void 0?void 0:t.stringValue)==="server_timestamp"}function K2(n){const e=n.mapValue.fields.__previous_value__;return W2(e)?K2(e):e}function S0(n){const e=ku(n.mapValue.fields.__local_write_time__.timestampValue);return new sr(e.seconds,e.nanos)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class iue{constructor(e,t,i,r,s,o,a,l,c){this.databaseId=e,this.appId=t,this.persistenceKey=i,this.host=r,this.ssl=s,this.forceLongPolling=o,this.autoDetectLongPolling=a,this.longPollingOptions=l,this.useFetchStreams=c}}class T0{constructor(e,t){this.projectId=e,this.database=t||"(default)"}static empty(){return new T0("","")}get isDefaultDatabase(){return this.database==="(default)"}isEqual(e){return e instanceof T0&&e.projectId===this.projectId&&e.database===this.database}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const ux={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function Pd(n){return"nullValue"in n?0:"booleanValue"in n?1:"integerValue"in n||"doubleValue"in n?2:"timestampValue"in n?3:"stringValue"in n?5:"bytesValue"in n?6:"referenceValue"in n?7:"geoPointValue"in n?8:"arrayValue"in n?9:"mapValue"in n?W2(n)?4:sue(n)?9007199254740991:rue(n)?10:11:en()}function sl(n,e){if(n===e)return!0;const t=Pd(n);if(t!==Pd(e))return!1;switch(t){case 0:case 9007199254740991:return!0;case 1:return n.booleanValue===e.booleanValue;case 4:return S0(n).isEqual(S0(e));case 3:return function(r,s){if(typeof r.timestampValue=="string"&&typeof s.timestampValue=="string"&&r.timestampValue.length===s.timestampValue.length)return r.timestampValue===s.timestampValue;const o=ku(r.timestampValue),a=ku(s.timestampValue);return o.seconds===a.seconds&&o.nanos===a.nanos}(n,e);case 5:return n.stringValue===e.stringValue;case 6:return function(r,s){return Rd(r.bytesValue).isEqual(Rd(s.bytesValue))}(n,e);case 7:return n.referenceValue===e.referenceValue;case 8:return function(r,s){return Oi(r.geoPointValue.latitude)===Oi(s.geoPointValue.latitude)&&Oi(r.geoPointValue.longitude)===Oi(s.geoPointValue.longitude)}(n,e);case 2:return function(r,s){if("integerValue"in r&&"integerValue"in s)return Oi(r.integerValue)===Oi(s.integerValue);if("doubleValue"in r&&"doubleValue"in s){const o=Oi(r.doubleValue),a=Oi(s.doubleValue);return o===a?V1(o)===V1(a):isNaN(o)&&isNaN(a)}return!1}(n,e);case 9:return cm(n.arrayValue.values||[],e.arrayValue.values||[],sl);case 10:case 11:return function(r,s){const o=r.mapValue.fields||{},a=s.mapValue.fields||{};if(s3(o)!==s3(a))return!1;for(const l in o)if(o.hasOwnProperty(l)&&(a[l]===void 0||!sl(o[l],a[l])))return!1;return!0}(n,e);default:return en()}}function b0(n,e){return(n.values||[]).find(t=>sl(t,e))!==void 0}function um(n,e){if(n===e)return 0;const t=Pd(n),i=Pd(e);if(t!==i)return Hn(t,i);switch(t){case 0:case 9007199254740991:return 0;case 1:return Hn(n.booleanValue,e.booleanValue);case 2:return function(s,o){const a=Oi(s.integerValue||s.doubleValue),l=Oi(o.integerValue||o.doubleValue);return a<l?-1:a>l?1:a===l?0:isNaN(a)?isNaN(l)?0:-1:1}(n,e);case 3:return a3(n.timestampValue,e.timestampValue);case 4:return a3(S0(n),S0(e));case 5:return Hn(n.stringValue,e.stringValue);case 6:return function(s,o){const a=Rd(s),l=Rd(o);return a.compareTo(l)}(n.bytesValue,e.bytesValue);case 7:return function(s,o){const a=s.split("/"),l=o.split("/");for(let c=0;c<a.length&&c<l.length;c++){const u=Hn(a[c],l[c]);if(u!==0)return u}return Hn(a.length,l.length)}(n.referenceValue,e.referenceValue);case 8:return function(s,o){const a=Hn(Oi(s.latitude),Oi(o.latitude));return a!==0?a:Hn(Oi(s.longitude),Oi(o.longitude))}(n.geoPointValue,e.geoPointValue);case 9:return l3(n.arrayValue,e.arrayValue);case 10:return function(s,o){var a,l,c,u;const h=s.fields||{},f=o.fields||{},m=(a=h.value)===null||a===void 0?void 0:a.arrayValue,y=(l=f.value)===null||l===void 0?void 0:l.arrayValue,_=Hn(((c=m==null?void 0:m.values)===null||c===void 0?void 0:c.length)||0,((u=y==null?void 0:y.values)===null||u===void 0?void 0:u.length)||0);return _!==0?_:l3(m,y)}(n.mapValue,e.mapValue);case 11:return function(s,o){if(s===ux.mapValue&&o===ux.mapValue)return 0;if(s===ux.mapValue)return 1;if(o===ux.mapValue)return-1;const a=s.fields||{},l=Object.keys(a),c=o.fields||{},u=Object.keys(c);l.sort(),u.sort();for(let h=0;h<l.length&&h<u.length;++h){const f=Hn(l[h],u[h]);if(f!==0)return f;const m=um(a[l[h]],c[u[h]]);if(m!==0)return m}return Hn(l.length,u.length)}(n.mapValue,e.mapValue);default:throw en()}}function a3(n,e){if(typeof n=="string"&&typeof e=="string"&&n.length===e.length)return Hn(n,e);const t=ku(n),i=ku(e),r=Hn(t.seconds,i.seconds);return r!==0?r:Hn(t.nanos,i.nanos)}function l3(n,e){const t=n.values||[],i=e.values||[];for(let r=0;r<t.length&&r<i.length;++r){const s=um(t[r],i[r]);if(s)return s}return Hn(t.length,i.length)}function hm(n){return GI(n)}function GI(n){return"nullValue"in n?"null":"booleanValue"in n?""+n.booleanValue:"integerValue"in n?""+n.integerValue:"doubleValue"in n?""+n.doubleValue:"timestampValue"in n?function(t){const i=ku(t);return`time(${i.seconds},${i.nanos})`}(n.timestampValue):"stringValue"in n?n.stringValue:"bytesValue"in n?function(t){return Rd(t).toBase64()}(n.bytesValue):"referenceValue"in n?function(t){return jt.fromName(t).toString()}(n.referenceValue):"geoPointValue"in n?function(t){return`geo(${t.latitude},${t.longitude})`}(n.geoPointValue):"arrayValue"in n?function(t){let i="[",r=!0;for(const s of t.values||[])r?r=!1:i+=",",i+=GI(s);return i+"]"}(n.arrayValue):"mapValue"in n?function(t){const i=Object.keys(t.fields||{}).sort();let r="{",s=!0;for(const o of i)s?s=!1:r+=",",r+=`${o}:${GI(t.fields[o])}`;return r+"}"}(n.mapValue):en()}function c3(n,e){return{referenceValue:`projects/${n.projectId}/databases/${n.database}/documents/${e.path.canonicalString()}`}}function jI(n){return!!n&&"integerValue"in n}function X2(n){return!!n&&"arrayValue"in n}function u3(n){return!!n&&"nullValue"in n}function h3(n){return!!n&&"doubleValue"in n&&isNaN(Number(n.doubleValue))}function Bw(n){return!!n&&"mapValue"in n}function rue(n){var e,t;return((t=(((e=n==null?void 0:n.mapValue)===null||e===void 0?void 0:e.fields)||{}).__type__)===null||t===void 0?void 0:t.stringValue)==="__vector__"}function Ry(n){if(n.geoPointValue)return{geoPointValue:Object.assign({},n.geoPointValue)};if(n.timestampValue&&typeof n.timestampValue=="object")return{timestampValue:Object.assign({},n.timestampValue)};if(n.mapValue){const e={mapValue:{fields:{}}};return Yd(n.mapValue.fields,(t,i)=>e.mapValue.fields[t]=Ry(i)),e}if(n.arrayValue){const e={arrayValue:{values:[]}};for(let t=0;t<(n.arrayValue.values||[]).length;++t)e.arrayValue.values[t]=Ry(n.arrayValue.values[t]);return e}return Object.assign({},n)}function sue(n){return(((n.mapValue||{}).fields||{}).__type__||{}).stringValue==="__max__"}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Ls{constructor(e){this.value=e}static empty(){return new Ls({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let i=0;i<e.length-1;++i)if(t=(t.mapValue.fields||{})[e.get(i)],!Bw(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=Ry(t)}setAll(e){let t=br.emptyPath(),i={},r=[];e.forEach((o,a)=>{if(!t.isImmediateParentOf(a)){const l=this.getFieldsMap(t);this.applyChanges(l,i,r),i={},r=[],t=a.popLast()}o?i[a.lastSegment()]=Ry(o):r.push(a.lastSegment())});const s=this.getFieldsMap(t);this.applyChanges(s,i,r)}delete(e){const t=this.field(e.popLast());Bw(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return sl(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let i=0;i<e.length;++i){let r=t.mapValue.fields[e.get(i)];Bw(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},t.mapValue.fields[e.get(i)]=r),t=r}return t.mapValue.fields}applyChanges(e,t,i){Yd(t,(r,s)=>e[r]=s);for(const r of i)delete e[r]}clone(){return new Ls(Ry(this.value))}}function vj(n){const e=[];return Yd(n.fields,(t,i)=>{const r=new br([t]);if(Bw(i)){const s=vj(i.mapValue).fields;if(s.length===0)e.push(r);else for(const o of s)e.push(r.child(o))}else e.push(r)}),new ao(e)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Jr{constructor(e,t,i,r,s,o,a){this.key=e,this.documentType=t,this.version=i,this.readTime=r,this.createTime=s,this.data=o,this.documentState=a}static newInvalidDocument(e){return new Jr(e,0,nn.min(),nn.min(),nn.min(),Ls.empty(),0)}static newFoundDocument(e,t,i,r){return new Jr(e,1,t,nn.min(),i,r,0)}static newNoDocument(e,t){return new Jr(e,2,t,nn.min(),nn.min(),Ls.empty(),0)}static newUnknownDocument(e,t){return new Jr(e,3,t,nn.min(),nn.min(),Ls.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(nn.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=Ls.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Ls.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=nn.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof Jr&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new Jr(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class z1{constructor(e,t){this.position=e,this.inclusive=t}}function d3(n,e,t){let i=0;for(let r=0;r<n.position.length;r++){const s=e[r],o=n.position[r];if(s.field.isKeyField()?i=jt.comparator(jt.fromName(o.referenceValue),t.key):i=um(o,t.data.field(s.field)),s.dir==="desc"&&(i*=-1),i!==0)break}return i}function f3(n,e){if(n===null)return e===null;if(e===null||n.inclusive!==e.inclusive||n.position.length!==e.position.length)return!1;for(let t=0;t<n.position.length;t++)if(!sl(n.position[t],e.position[t]))return!1;return!0}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class C0{constructor(e,t="asc"){this.field=e,this.dir=t}}function oue(n,e){return n.dir===e.dir&&n.field.isEqual(e.field)}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class _j{}class Qi extends _j{constructor(e,t,i){super(),this.field=e,this.op=t,this.value=i}static create(e,t,i){return e.isKeyField()?t==="in"||t==="not-in"?this.createKeyFieldInFilter(e,t,i):new lue(e,t,i):t==="array-contains"?new hue(e,i):t==="in"?new due(e,i):t==="not-in"?new fue(e,i):t==="array-contains-any"?new pue(e,i):new Qi(e,t,i)}static createKeyFieldInFilter(e,t,i){return t==="in"?new cue(e,i):new uue(e,i)}matches(e){const t=e.data.field(this.field);return this.op==="!="?t!==null&&this.matchesComparison(um(t,this.value)):t!==null&&Pd(this.value)===Pd(t)&&this.matchesComparison(um(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return e===0;case"!=":return e!==0;case">":return e>0;case">=":return e>=0;default:return en()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Ea extends _j{constructor(e,t){super(),this.filters=e,this.op=t,this.ae=null}static create(e,t){return new Ea(e,t)}matches(e){return xj(this)?this.filters.find(t=>!t.matches(e))===void 0:this.filters.find(t=>t.matches(e))!==void 0}getFlattenedFilters(){return this.ae!==null||(this.ae=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.ae}getFilters(){return Object.assign([],this.filters)}}function xj(n){return n.op==="and"}function wj(n){return aue(n)&&xj(n)}function aue(n){for(const e of n.filters)if(e instanceof Ea)return!1;return!0}function WI(n){if(n instanceof Qi)return n.field.canonicalString()+n.op.toString()+hm(n.value);if(wj(n))return n.filters.map(e=>WI(e)).join(",");{const e=n.filters.map(t=>WI(t)).join(",");return`${n.op}(${e})`}}function Ej(n,e){return n instanceof Qi?function(i,r){return r instanceof Qi&&i.op===r.op&&i.field.isEqual(r.field)&&sl(i.value,r.value)}(n,e):n instanceof Ea?function(i,r){return r instanceof Ea&&i.op===r.op&&i.filters.length===r.filters.length?i.filters.reduce((s,o,a)=>s&&Ej(o,r.filters[a]),!0):!1}(n,e):void en()}function Aj(n){return n instanceof Qi?function(t){return`${t.field.canonicalString()} ${t.op} ${hm(t.value)}`}(n):n instanceof Ea?function(t){return t.op.toString()+" {"+t.getFilters().map(Aj).join(" ,")+"}"}(n):"Filter"}class lue extends Qi{constructor(e,t,i){super(e,t,i),this.key=jt.fromName(i.referenceValue)}matches(e){const t=jt.comparator(e.key,this.key);return this.matchesComparison(t)}}class cue extends Qi{constructor(e,t){super(e,"in",t),this.keys=Sj("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class uue extends Qi{constructor(e,t){super(e,"not-in",t),this.keys=Sj("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function Sj(n,e){var t;return(((t=e.arrayValue)===null||t===void 0?void 0:t.values)||[]).map(i=>jt.fromName(i.referenceValue))}class hue extends Qi{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return X2(t)&&b0(t.arrayValue,this.value)}}class due extends Qi{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return t!==null&&b0(this.value.arrayValue,t)}}class fue extends Qi{constructor(e,t){super(e,"not-in",t)}matches(e){if(b0(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return t!==null&&!b0(this.value.arrayValue,t)}}class pue extends Qi{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!X2(t)||!t.arrayValue.values)&&t.arrayValue.values.some(i=>b0(this.value.arrayValue,i))}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class mue{constructor(e,t=null,i=[],r=[],s=null,o=null,a=null){this.path=e,this.collectionGroup=t,this.orderBy=i,this.filters=r,this.limit=s,this.startAt=o,this.endAt=a,this.ue=null}}function p3(n,e=null,t=[],i=[],r=null,s=null,o=null){return new mue(n,e,t,i,r,s,o)}function q2(n){const e=rn(n);if(e.ue===null){let t=e.path.canonicalString();e.collectionGroup!==null&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(i=>WI(i)).join(","),t+="|ob:",t+=e.orderBy.map(i=>function(s){return s.field.canonicalString()+s.dir}(i)).join(","),DA(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(i=>hm(i)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(i=>hm(i)).join(",")),e.ue=t}return e.ue}function Y2(n,e){if(n.limit!==e.limit||n.orderBy.length!==e.orderBy.length)return!1;for(let t=0;t<n.orderBy.length;t++)if(!oue(n.orderBy[t],e.orderBy[t]))return!1;if(n.filters.length!==e.filters.length)return!1;for(let t=0;t<n.filters.length;t++)if(!Ej(n.filters[t],e.filters[t]))return!1;return n.collectionGroup===e.collectionGroup&&!!n.path.isEqual(e.path)&&!!f3(n.startAt,e.startAt)&&f3(n.endAt,e.endAt)}function KI(n){return jt.isDocumentKey(n.path)&&n.collectionGroup===null&&n.filters.length===0}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Um{constructor(e,t=null,i=[],r=[],s=null,o="F",a=null,l=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=i,this.filters=r,this.limit=s,this.limitType=o,this.startAt=a,this.endAt=l,this.ce=null,this.le=null,this.he=null,this.startAt,this.endAt}}function gue(n,e,t,i,r,s,o,a){return new Um(n,e,t,i,r,s,o,a)}function LA(n){return new Um(n)}function m3(n){return n.filters.length===0&&n.limit===null&&n.startAt==null&&n.endAt==null&&(n.explicitOrderBy.length===0||n.explicitOrderBy.length===1&&n.explicitOrderBy[0].field.isKeyField())}function Tj(n){return n.collectionGroup!==null}function Py(n){const e=rn(n);if(e.ce===null){e.ce=[];const t=new Set;for(const s of e.explicitOrderBy)e.ce.push(s),t.add(s.field.canonicalString());const i=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let a=new Ir(br.comparator);return o.filters.forEach(l=>{l.getFlattenedFilters().forEach(c=>{c.isInequality()&&(a=a.add(c.field))})}),a})(e).forEach(s=>{t.has(s.canonicalString())||s.isKeyField()||e.ce.push(new C0(s,i))}),t.has(br.keyField().canonicalString())||e.ce.push(new C0(br.keyField(),i))}return e.ce}function Ya(n){const e=rn(n);return e.le||(e.le=yue(e,Py(n))),e.le}function yue(n,e){if(n.limitType==="F")return p3(n.path,n.collectionGroup,e,n.filters,n.limit,n.startAt,n.endAt);{e=e.map(r=>{const s=r.dir==="desc"?"asc":"desc";return new C0(r.field,s)});const t=n.endAt?new z1(n.endAt.position,n.endAt.inclusive):null,i=n.startAt?new z1(n.startAt.position,n.startAt.inclusive):null;return p3(n.path,n.collectionGroup,e,n.filters,n.limit,t,i)}}function XI(n,e){const t=n.filters.concat([e]);return new Um(n.path,n.collectionGroup,n.explicitOrderBy.slice(),t,n.limit,n.limitType,n.startAt,n.endAt)}function H1(n,e,t){return new Um(n.path,n.collectionGroup,n.explicitOrderBy.slice(),n.filters.slice(),e,t,n.startAt,n.endAt)}function kA(n,e){return Y2(Ya(n),Ya(e))&&n.limitType===e.limitType}function bj(n){return`${q2(Ya(n))}|lt:${n.limitType}`}function Kf(n){return`Query(target=${function(t){let i=t.path.canonicalString();return t.collectionGroup!==null&&(i+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(i+=`, filters: [${t.filters.map(r=>Aj(r)).join(", ")}]`),DA(t.limit)||(i+=", limit: "+t.limit),t.orderBy.length>0&&(i+=`, orderBy: [${t.orderBy.map(r=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(r)).join(", ")}]`),t.startAt&&(i+=", startAt: ",i+=t.startAt.inclusive?"b:":"a:",i+=t.startAt.position.map(r=>hm(r)).join(",")),t.endAt&&(i+=", endAt: ",i+=t.endAt.inclusive?"a:":"b:",i+=t.endAt.position.map(r=>hm(r)).join(",")),`Target(${i})`}(Ya(n))}; limitType=${n.limitType})`}function BA(n,e){return e.isFoundDocument()&&function(i,r){const s=r.key.path;return i.collectionGroup!==null?r.key.hasCollectionId(i.collectionGroup)&&i.path.isPrefixOf(s):jt.isDocumentKey(i.path)?i.path.isEqual(s):i.path.isImmediateParentOf(s)}(n,e)&&function(i,r){for(const s of Py(i))if(!s.field.isKeyField()&&r.data.field(s.field)===null)return!1;return!0}(n,e)&&function(i,r){for(const s of i.filters)if(!s.matches(r))return!1;return!0}(n,e)&&function(i,r){return!(i.startAt&&!function(o,a,l){const c=d3(o,a,l);return o.inclusive?c<=0:c<0}(i.startAt,Py(i),r)||i.endAt&&!function(o,a,l){const c=d3(o,a,l);return o.inclusive?c>=0:c>0}(i.endAt,Py(i),r))}(n,e)}function vue(n){return n.collectionGroup||(n.path.length%2==1?n.path.lastSegment():n.path.get(n.path.length-2))}function Cj(n){return(e,t)=>{let i=!1;for(const r of Py(n)){const s=_ue(r,e,t);if(s!==0)return s;i=i||r.field.isKeyField()}return 0}}function _ue(n,e,t){const i=n.field.isKeyField()?jt.comparator(e.key,t.key):function(s,o,a){const l=o.data.field(s),c=a.data.field(s);return l!==null&&c!==null?um(l,c):en()}(n.field,e,t);switch(n.dir){case"asc":return i;case"desc":return-1*i;default:return en()}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Vm{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){const t=this.mapKeyFn(e),i=this.inner[t];if(i!==void 0){for(const[r,s]of i)if(this.equalsFn(r,e))return s}}has(e){return this.get(e)!==void 0}set(e,t){const i=this.mapKeyFn(e),r=this.inner[i];if(r===void 0)return this.inner[i]=[[e,t]],void this.innerSize++;for(let s=0;s<r.length;s++)if(this.equalsFn(r[s][0],e))return void(r[s]=[e,t]);r.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),i=this.inner[t];if(i===void 0)return!1;for(let r=0;r<i.length;r++)if(this.equalsFn(i[r][0],e))return i.length===1?delete this.inner[t]:i.splice(r,1),this.innerSize--,!0;return!1}forEach(e){Yd(this.inner,(t,i)=>{for(const[r,s]of i)e(r,s)})}isEmpty(){return gj(this.inner)}size(){return this.innerSize}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const xue=new Zi(jt.comparator);function oc(){return xue}const Mj=new Zi(jt.comparator);function ay(...n){let e=Mj;for(const t of n)e=e.insert(t.key,t);return e}function Ij(n){let e=Mj;return n.forEach((t,i)=>e=e.insert(t,i.overlayedDocument)),e}function Yh(){return Ny()}function Rj(){return Ny()}function Ny(){return new Vm(n=>n.toString(),(n,e)=>n.isEqual(e))}const wue=new Zi(jt.comparator),Eue=new Ir(jt.comparator);function Tn(...n){let e=Eue;for(const t of n)e=e.add(t);return e}const Aue=new Ir(Hn);function Sue(){return Aue}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function $2(n,e){if(n.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:V1(e)?"-0":e}}function Pj(n){return{integerValue:""+n}}function Nj(n,e){return tue(e)?Pj(e):$2(n,e)}/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class OA{constructor(){this._=void 0}}function Tue(n,e,t){return n instanceof M0?function(r,s){const o={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:r.seconds,nanos:r.nanoseconds}}}};return s&&W2(s)&&(s=K2(s)),s&&(o.fields.__previous_value__=s),{mapValue:o}}(t,e):n instanceof I0?Lj(n,e):n instanceof R0?kj(n,e):function(r,s){const o=Dj(r,s),a=g3(o)+g3(r.Pe);return jI(o)&&jI(r.Pe)?Pj(a):$2(r.serializer,a)}(n,e)}function bue(n,e,t){return n instanceof I0?Lj(n,e):n instanceof R0?kj(n,e):t}function Dj(n,e){return n instanceof P0?function(i){return jI(i)||function(s){return!!s&&"doubleValue"in s}(i)}(e)?e:{integerValue:0}:null}class M0 extends OA{}class I0 extends OA{constructor(e){super(),this.elements=e}}function Lj(n,e){const t=Bj(e);for(const i of n.elements)t.some(r=>sl(r,i))||t.push(i);return{arrayValue:{values:t}}}class R0 extends OA{constructor(e){super(),this.elements=e}}function kj(n,e){let t=Bj(e);for(const i of n.elements)t=t.filter(r=>!sl(r,i));return{arrayValue:{values:t}}}class P0 extends OA{constructor(e,t){super(),this.serializer=e,this.Pe=t}}function g3(n){return Oi(n.integerValue||n.doubleValue)}function Bj(n){return X2(n)&&n.arrayValue.values?n.arrayValue.values.slice():[]}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Oj{constructor(e,t){this.field=e,this.transform=t}}function Cue(n,e){return n.field.isEqual(e.field)&&function(i,r){return i instanceof I0&&r instanceof I0||i instanceof R0&&r instanceof R0?cm(i.elements,r.elements,sl):i instanceof P0&&r instanceof P0?sl(i.Pe,r.Pe):i instanceof M0&&r instanceof M0}(n.transform,e.transform)}class Mue{constructor(e,t){this.version=e,this.transformResults=t}}class ma{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new ma}static exists(e){return new ma(void 0,e)}static updateTime(e){return new ma(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Ow(n,e){return n.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(n.updateTime):n.exists===void 0||n.exists===e.isFoundDocument()}class FA{}function Fj(n,e){if(!n.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return n.isNoDocument()?new Vj(n.key,ma.none()):new pv(n.key,n.data,ma.none());{const t=n.data,i=Ls.empty();let r=new Ir(br.comparator);for(let s of e.fields)if(!r.has(s)){let o=t.field(s);o===null&&s.length>1&&(s=s.popLast(),o=t.field(s)),o===null?i.delete(s):i.set(s,o),r=r.add(s)}return new qu(n.key,i,new ao(r.toArray()),ma.none())}}function Iue(n,e,t){n instanceof pv?function(r,s,o){const a=r.value.clone(),l=v3(r.fieldTransforms,s,o.transformResults);a.setAll(l),s.convertToFoundDocument(o.version,a).setHasCommittedMutations()}(n,e,t):n instanceof qu?function(r,s,o){if(!Ow(r.precondition,s))return void s.convertToUnknownDocument(o.version);const a=v3(r.fieldTransforms,s,o.transformResults),l=s.data;l.setAll(Uj(r)),l.setAll(a),s.convertToFoundDocument(o.version,l).setHasCommittedMutations()}(n,e,t):function(r,s,o){s.convertToNoDocument(o.version).setHasCommittedMutations()}(0,e,t)}function Dy(n,e,t,i){return n instanceof pv?function(s,o,a,l){if(!Ow(s.precondition,o))return a;const c=s.value.clone(),u=_3(s.fieldTransforms,l,o);return c.setAll(u),o.convertToFoundDocument(o.version,c).setHasLocalMutations(),null}(n,e,t,i):n instanceof qu?function(s,o,a,l){if(!Ow(s.precondition,o))return a;const c=_3(s.fieldTransforms,l,o),u=o.data;return u.setAll(Uj(s)),u.setAll(c),o.convertToFoundDocument(o.version,u).setHasLocalMutations(),a===null?null:a.unionWith(s.fieldMask.fields).unionWith(s.fieldTransforms.map(h=>h.field))}(n,e,t,i):function(s,o,a){return Ow(s.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):a}(n,e,t)}function Rue(n,e){let t=null;for(const i of n.fieldTransforms){const r=e.data.field(i.field),s=Dj(i.transform,r||null);s!=null&&(t===null&&(t=Ls.empty()),t.set(i.field,s))}return t||null}function y3(n,e){return n.type===e.type&&!!n.key.isEqual(e.key)&&!!n.precondition.isEqual(e.precondition)&&!!function(i,r){return i===void 0&&r===void 0||!(!i||!r)&&cm(i,r,(s,o)=>Cue(s,o))}(n.fieldTransforms,e.fieldTransforms)&&(n.type===0?n.value.isEqual(e.value):n.type!==1||n.data.isEqual(e.data)&&n.fieldMask.isEqual(e.fieldMask))}class pv extends FA{constructor(e,t,i,r=[]){super(),this.key=e,this.value=t,this.precondition=i,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class qu extends FA{constructor(e,t,i,r,s=[]){super(),this.key=e,this.data=t,this.fieldMask=i,this.precondition=r,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function Uj(n){const e=new Map;return n.fieldMask.fields.forEach(t=>{if(!t.isEmpty()){const i=n.data.field(t);e.set(t,i)}}),e}function v3(n,e,t){const i=new Map;Qn(n.length===t.length);for(let r=0;r<t.length;r++){const s=n[r],o=s.transform,a=e.data.field(s.field);i.set(s.field,bue(o,a,t[r]))}return i}function _3(n,e,t){const i=new Map;for(const r of n){const s=r.transform,o=t.data.field(r.field);i.set(r.field,Tue(s,o,e))}return i}class Vj extends FA{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class Pue extends FA{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Nue{constructor(e,t,i,r){this.batchId=e,this.localWriteTime=t,this.baseMutations=i,this.mutations=r}applyToRemoteDocument(e,t){const i=t.mutationResults;for(let r=0;r<this.mutations.length;r++){const s=this.mutations[r];s.key.isEqual(e.key)&&Iue(s,e,i[r])}}applyToLocalView(e,t){for(const i of this.baseMutations)i.key.isEqual(e.key)&&(t=Dy(i,e,t,this.localWriteTime));for(const i of this.mutations)i.key.isEqual(e.key)&&(t=Dy(i,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const i=Rj();return this.mutations.forEach(r=>{const s=e.get(r.key),o=s.overlayedDocument;let a=this.applyToLocalView(o,s.mutatedFields);a=t.has(r.key)?null:a;const l=Fj(o,a);l!==null&&i.set(r.key,l),o.isValidDocument()||o.convertToNoDocument(nn.min())}),i}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),Tn())}isEqual(e){return this.batchId===e.batchId&&cm(this.mutations,e.mutations,(t,i)=>y3(t,i))&&cm(this.baseMutations,e.baseMutations,(t,i)=>y3(t,i))}}class J2{constructor(e,t,i,r){this.batch=e,this.commitVersion=t,this.mutationResults=i,this.docVersions=r}static from(e,t,i){Qn(e.mutations.length===i.length);let r=function(){return wue}();const s=e.mutations;for(let o=0;o<s.length;o++)r=r.insert(s[o].key,i[o].version);return new J2(e,t,i,r)}}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Due{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{
      largestBatchId: ${this.largestBatchId},
      mutation: ${this.mutation.toString()}
    }`}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Lue{constructor(e,t){this.count=e,this.unchangedNames=t}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var Yi,Nn;function kue(n){switch(n){default:return en();case He.CANCELLED:case He.UNKNOWN:case He.DEADLINE_EXCEEDED:case He.RESOURCE_EXHAUSTED:case He.INTERNAL:case He.UNAVAILABLE:case He.UNAUTHENTICATED:return!1;case He.INVALID_ARGUMENT:case He.NOT_FOUND:case He.ALREADY_EXISTS:case He.PERMISSION_DENIED:case He.FAILED_PRECONDITION:case He.ABORTED:case He.OUT_OF_RANGE:case He.UNIMPLEMENTED:case He.DATA_LOSS:return!0}}function zj(n){if(n===void 0)return sc("GRPC error has no .code"),He.UNKNOWN;switch(n){case Yi.OK:return He.OK;case Yi.CANCELLED:return He.CANCELLED;case Yi.UNKNOWN:return He.UNKNOWN;case Yi.DEADLINE_EXCEEDED:return He.DEADLINE_EXCEEDED;case Yi.RESOURCE_EXHAUSTED:return He.RESOURCE_EXHAUSTED;case Yi.INTERNAL:return He.INTERNAL;case Yi.UNAVAILABLE:return He.UNAVAILABLE;case Yi.UNAUTHENTICATED:return He.UNAUTHENTICATED;case Yi.INVALID_ARGUMENT:return He.INVALID_ARGUMENT;case Yi.NOT_FOUND:return He.NOT_FOUND;case Yi.ALREADY_EXISTS:return He.ALREADY_EXISTS;case Yi.PERMISSION_DENIED:return He.PERMISSION_DENIED;case Yi.FAILED_PRECONDITION:return He.FAILED_PRECONDITION;case Yi.ABORTED:return He.ABORTED;case Yi.OUT_OF_RANGE:return He.OUT_OF_RANGE;case Yi.UNIMPLEMENTED:return He.UNIMPLEMENTED;case Yi.DATA_LOSS:return He.DATA_LOSS;default:return en()}}(Nn=Yi||(Yi={}))[Nn.OK=0]="OK",Nn[Nn.CANCELLED=1]="CANCELLED",Nn[Nn.UNKNOWN=2]="UNKNOWN",Nn[Nn.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",Nn[Nn.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",Nn[Nn.NOT_FOUND=5]="NOT_FOUND",Nn[Nn.ALREADY_EXISTS=6]="ALREADY_EXISTS",Nn[Nn.PERMISSION_DENIED=7]="PERMISSION_DENIED",Nn[Nn.UNAUTHENTICATED=16]="UNAUTHENTICATED",Nn[Nn.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",Nn[Nn.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",Nn[Nn.ABORTED=10]="ABORTED",Nn[Nn.OUT_OF_RANGE=11]="OUT_OF_RANGE",Nn[Nn.UNIMPLEMENTED=12]="UNIMPLEMENTED",Nn[Nn.INTERNAL=13]="INTERNAL",Nn[Nn.UNAVAILABLE=14]="UNAVAILABLE",Nn[Nn.DATA_LOSS=15]="DATA_LOSS";/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Bue(){return new TextEncoder}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Oue=new gd([4294967295,4294967295],0);function x3(n){const e=Bue().encode(n),t=new lj;return t.update(e),new Uint8Array(t.digest())}function w3(n){const e=new DataView(n.buffer),t=e.getUint32(0,!0),i=e.getUint32(4,!0),r=e.getUint32(8,!0),s=e.getUint32(12,!0);return[new gd([t,i],0),new gd([r,s],0)]}class Q2{constructor(e,t,i){if(this.bitmap=e,this.padding=t,this.hashCount=i,t<0||t>=8)throw new ly(`Invalid padding: ${t}`);if(i<0)throw new ly(`Invalid hash count: ${i}`);if(e.length>0&&this.hashCount===0)throw new ly(`Invalid hash count: ${i}`);if(e.length===0&&t!==0)throw new ly(`Invalid padding when bitmap length is 0: ${t}`);this.Ie=8*e.length-t,this.Te=gd.fromNumber(this.Ie)}Ee(e,t,i){let r=e.add(t.multiply(gd.fromNumber(i)));return r.compare(Oue)===1&&(r=new gd([r.getBits(0),r.getBits(1)],0)),r.modulo(this.Te).toNumber()}de(e){return(this.bitmap[Math.floor(e/8)]&1<<e%8)!=0}mightContain(e){if(this.Ie===0)return!1;const t=x3(e),[i,r]=w3(t);for(let s=0;s<this.hashCount;s++){const o=this.Ee(i,r,s);if(!this.de(o))return!1}return!0}static create(e,t,i){const r=e%8==0?0:8-e%8,s=new Uint8Array(Math.ceil(e/8)),o=new Q2(s,r,t);return i.forEach(a=>o.insert(a)),o}insert(e){if(this.Ie===0)return;const t=x3(e),[i,r]=w3(t);for(let s=0;s<this.hashCount;s++){const o=this.Ee(i,r,s);this.Ae(o)}}Ae(e){const t=Math.floor(e/8),i=e%8;this.bitmap[t]|=1<<i}}class ly extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class UA{constructor(e,t,i,r,s){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=i,this.documentUpdates=r,this.resolvedLimboDocuments=s}static createSynthesizedRemoteEventForCurrentChange(e,t,i){const r=new Map;return r.set(e,mv.createSynthesizedTargetChangeForCurrentChange(e,t,i)),new UA(nn.min(),r,new Zi(Hn),oc(),Tn())}}class mv{constructor(e,t,i,r,s){this.resumeToken=e,this.current=t,this.addedDocuments=i,this.modifiedDocuments=r,this.removedDocuments=s}static createSynthesizedTargetChangeForCurrentChange(e,t,i){return new mv(i,t,Tn(),Tn(),Tn())}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Fw{constructor(e,t,i,r){this.Re=e,this.removedTargetIds=t,this.key=i,this.Ve=r}}class Hj{constructor(e,t){this.targetId=e,this.me=t}}class Gj{constructor(e,t,i=Dr.EMPTY_BYTE_STRING,r=null){this.state=e,this.targetIds=t,this.resumeToken=i,this.cause=r}}class E3{constructor(){this.fe=0,this.ge=S3(),this.pe=Dr.EMPTY_BYTE_STRING,this.ye=!1,this.we=!0}get current(){return this.ye}get resumeToken(){return this.pe}get Se(){return this.fe!==0}get be(){return this.we}De(e){e.approximateByteSize()>0&&(this.we=!0,this.pe=e)}ve(){let e=Tn(),t=Tn(),i=Tn();return this.ge.forEach((r,s)=>{switch(s){case 0:e=e.add(r);break;case 2:t=t.add(r);break;case 1:i=i.add(r);break;default:en()}}),new mv(this.pe,this.ye,e,t,i)}Ce(){this.we=!1,this.ge=S3()}Fe(e,t){this.we=!0,this.ge=this.ge.insert(e,t)}Me(e){this.we=!0,this.ge=this.ge.remove(e)}xe(){this.fe+=1}Oe(){this.fe-=1,Qn(this.fe>=0)}Ne(){this.we=!0,this.ye=!0}}class Fue{constructor(e){this.Le=e,this.Be=new Map,this.ke=oc(),this.qe=A3(),this.Qe=new Zi(Hn)}Ke(e){for(const t of e.Re)e.Ve&&e.Ve.isFoundDocument()?this.$e(t,e.Ve):this.Ue(t,e.key,e.Ve);for(const t of e.removedTargetIds)this.Ue(t,e.key,e.Ve)}We(e){this.forEachTarget(e,t=>{const i=this.Ge(t);switch(e.state){case 0:this.ze(t)&&i.De(e.resumeToken);break;case 1:i.Oe(),i.Se||i.Ce(),i.De(e.resumeToken);break;case 2:i.Oe(),i.Se||this.removeTarget(t);break;case 3:this.ze(t)&&(i.Ne(),i.De(e.resumeToken));break;case 4:this.ze(t)&&(this.je(t),i.De(e.resumeToken));break;default:en()}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.Be.forEach((i,r)=>{this.ze(r)&&t(r)})}He(e){const t=e.targetId,i=e.me.count,r=this.Je(t);if(r){const s=r.target;if(KI(s))if(i===0){const o=new jt(s.path);this.Ue(t,o,Jr.newNoDocument(o,nn.min()))}else Qn(i===1);else{const o=this.Ye(t);if(o!==i){const a=this.Ze(e),l=a?this.Xe(a,e,o):1;if(l!==0){this.je(t);const c=l===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Qe=this.Qe.insert(t,c)}}}}}Ze(e){const t=e.me.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:i="",padding:r=0},hashCount:s=0}=t;let o,a;try{o=Rd(i).toUint8Array()}catch(l){if(l instanceof yj)return lm("Decoding the base64 bloom filter in existence filter failed ("+l.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw l}try{a=new Q2(o,r,s)}catch(l){return lm(l instanceof ly?"BloomFilter error: ":"Applying bloom filter failed: ",l),null}return a.Ie===0?null:a}Xe(e,t,i){return t.me.count===i-this.nt(e,t.targetId)?0:2}nt(e,t){const i=this.Le.getRemoteKeysForTarget(t);let r=0;return i.forEach(s=>{const o=this.Le.tt(),a=`projects/${o.projectId}/databases/${o.database}/documents/${s.path.canonicalString()}`;e.mightContain(a)||(this.Ue(t,s,null),r++)}),r}rt(e){const t=new Map;this.Be.forEach((s,o)=>{const a=this.Je(o);if(a){if(s.current&&KI(a.target)){const l=new jt(a.target.path);this.ke.get(l)!==null||this.it(o,l)||this.Ue(o,l,Jr.newNoDocument(l,e))}s.be&&(t.set(o,s.ve()),s.Ce())}});let i=Tn();this.qe.forEach((s,o)=>{let a=!0;o.forEachWhile(l=>{const c=this.Je(l);return!c||c.purpose==="TargetPurposeLimboResolution"||(a=!1,!1)}),a&&(i=i.add(s))}),this.ke.forEach((s,o)=>o.setReadTime(e));const r=new UA(e,t,this.Qe,this.ke,i);return this.ke=oc(),this.qe=A3(),this.Qe=new Zi(Hn),r}$e(e,t){if(!this.ze(e))return;const i=this.it(e,t.key)?2:0;this.Ge(e).Fe(t.key,i),this.ke=this.ke.insert(t.key,t),this.qe=this.qe.insert(t.key,this.st(t.key).add(e))}Ue(e,t,i){if(!this.ze(e))return;const r=this.Ge(e);this.it(e,t)?r.Fe(t,1):r.Me(t),this.qe=this.qe.insert(t,this.st(t).delete(e)),i&&(this.ke=this.ke.insert(t,i))}removeTarget(e){this.Be.delete(e)}Ye(e){const t=this.Ge(e).ve();return this.Le.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}xe(e){this.Ge(e).xe()}Ge(e){let t=this.Be.get(e);return t||(t=new E3,this.Be.set(e,t)),t}st(e){let t=this.qe.get(e);return t||(t=new Ir(Hn),this.qe=this.qe.insert(e,t)),t}ze(e){const t=this.Je(e)!==null;return t||kt("WatchChangeAggregator","Detected inactive target",e),t}Je(e){const t=this.Be.get(e);return t&&t.Se?null:this.Le.ot(e)}je(e){this.Be.set(e,new E3),this.Le.getRemoteKeysForTarget(e).forEach(t=>{this.Ue(e,t,null)})}it(e,t){return this.Le.getRemoteKeysForTarget(e).has(t)}}function A3(){return new Zi(jt.comparator)}function S3(){return new Zi(jt.comparator)}const Uue={asc:"ASCENDING",desc:"DESCENDING"},Vue={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},zue={and:"AND",or:"OR"};class Hue{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function qI(n,e){return n.useProto3Json||DA(e)?e:{value:e}}function G1(n,e){return n.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function jj(n,e){return n.useProto3Json?e.toBase64():e.toUint8Array()}function Gue(n,e){return G1(n,e.toTimestamp())}function $a(n){return Qn(!!n),nn.fromTimestamp(function(t){const i=ku(t);return new sr(i.seconds,i.nanos)}(n))}function Z2(n,e){return YI(n,e).canonicalString()}function YI(n,e){const t=function(r){return new ui(["projects",r.projectId,"databases",r.database])}(n).child("documents");return e===void 0?t:t.child(e)}function Wj(n){const e=ui.fromString(n);return Qn($j(e)),e}function $I(n,e){return Z2(n.databaseId,e.path)}function kb(n,e){const t=Wj(e);if(t.get(1)!==n.databaseId.projectId)throw new bt(He.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+t.get(1)+" vs "+n.databaseId.projectId);if(t.get(3)!==n.databaseId.database)throw new bt(He.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+t.get(3)+" vs "+n.databaseId.database);return new jt(Xj(t))}function Kj(n,e){return Z2(n.databaseId,e)}function jue(n){const e=Wj(n);return e.length===4?ui.emptyPath():Xj(e)}function JI(n){return new ui(["projects",n.databaseId.projectId,"databases",n.databaseId.database]).canonicalString()}function Xj(n){return Qn(n.length>4&&n.get(4)==="documents"),n.popFirst(5)}function T3(n,e,t){return{name:$I(n,e),fields:t.value.mapValue.fields}}function Wue(n,e){let t;if("targetChange"in e){e.targetChange;const i=function(c){return c==="NO_CHANGE"?0:c==="ADD"?1:c==="REMOVE"?2:c==="CURRENT"?3:c==="RESET"?4:en()}(e.targetChange.targetChangeType||"NO_CHANGE"),r=e.targetChange.targetIds||[],s=function(c,u){return c.useProto3Json?(Qn(u===void 0||typeof u=="string"),Dr.fromBase64String(u||"")):(Qn(u===void 0||u instanceof Buffer||u instanceof Uint8Array),Dr.fromUint8Array(u||new Uint8Array))}(n,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(c){const u=c.code===void 0?He.UNKNOWN:zj(c.code);return new bt(u,c.message||"")}(o);t=new Gj(i,r,s,a||null)}else if("documentChange"in e){e.documentChange;const i=e.documentChange;i.document,i.document.name,i.document.updateTime;const r=kb(n,i.document.name),s=$a(i.document.updateTime),o=i.document.createTime?$a(i.document.createTime):nn.min(),a=new Ls({mapValue:{fields:i.document.fields}}),l=Jr.newFoundDocument(r,s,o,a),c=i.targetIds||[],u=i.removedTargetIds||[];t=new Fw(c,u,l.key,l)}else if("documentDelete"in e){e.documentDelete;const i=e.documentDelete;i.document;const r=kb(n,i.document),s=i.readTime?$a(i.readTime):nn.min(),o=Jr.newNoDocument(r,s),a=i.removedTargetIds||[];t=new Fw([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const i=e.documentRemove;i.document;const r=kb(n,i.document),s=i.removedTargetIds||[];t=new Fw([],s,r,null)}else{if(!("filter"in e))return en();{e.filter;const i=e.filter;i.targetId;const{count:r=0,unchangedNames:s}=i,o=new Lue(r,s),a=i.targetId;t=new Hj(a,o)}}return t}function Kue(n,e){let t;if(e instanceof pv)t={update:T3(n,e.key,e.value)};else if(e instanceof Vj)t={delete:$I(n,e.key)};else if(e instanceof qu)t={update:T3(n,e.key,e.data),updateMask:the(e.fieldMask)};else{if(!(e instanceof Pue))return en();t={verify:$I(n,e.key)}}return e.fieldTransforms.length>0&&(t.updateTransforms=e.fieldTransforms.map(i=>function(s,o){const a=o.transform;if(a instanceof M0)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof I0)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof R0)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof P0)return{fieldPath:o.field.canonicalString(),increment:a.Pe};throw en()}(0,i))),e.precondition.isNone||(t.currentDocument=function(r,s){return s.updateTime!==void 0?{updateTime:Gue(r,s.updateTime)}:s.exists!==void 0?{exists:s.exists}:en()}(n,e.precondition)),t}function Xue(n,e){return n&&n.length>0?(Qn(e!==void 0),n.map(t=>function(r,s){let o=r.updateTime?$a(r.updateTime):$a(s);return o.isEqual(nn.min())&&(o=$a(s)),new Mue(o,r.transformResults||[])}(t,e))):[]}function que(n,e){return{documents:[Kj(n,e.path)]}}function Yue(n,e){const t={structuredQuery:{}},i=e.path;let r;e.collectionGroup!==null?(r=i,t.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(r=i.popLast(),t.structuredQuery.from=[{collectionId:i.lastSegment()}]),t.parent=Kj(n,r);const s=function(c){if(c.length!==0)return Yj(Ea.create(c,"and"))}(e.filters);s&&(t.structuredQuery.where=s);const o=function(c){if(c.length!==0)return c.map(u=>function(f){return{field:Xf(f.field),direction:Que(f.dir)}}(u))}(e.orderBy);o&&(t.structuredQuery.orderBy=o);const a=qI(n,e.limit);return a!==null&&(t.structuredQuery.limit=a),e.startAt&&(t.structuredQuery.startAt=function(c){return{before:c.inclusive,values:c.position}}(e.startAt)),e.endAt&&(t.structuredQuery.endAt=function(c){return{before:!c.inclusive,values:c.position}}(e.endAt)),{_t:t,parent:r}}function $ue(n){let e=jue(n.parent);const t=n.structuredQuery,i=t.from?t.from.length:0;let r=null;if(i>0){Qn(i===1);const u=t.from[0];u.allDescendants?r=u.collectionId:e=e.child(u.collectionId)}let s=[];t.where&&(s=function(h){const f=qj(h);return f instanceof Ea&&wj(f)?f.getFilters():[f]}(t.where));let o=[];t.orderBy&&(o=function(h){return h.map(f=>function(y){return new C0(qf(y.field),function(v){switch(v){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(y.direction))}(f))}(t.orderBy));let a=null;t.limit&&(a=function(h){let f;return f=typeof h=="object"?h.value:h,DA(f)?null:f}(t.limit));let l=null;t.startAt&&(l=function(h){const f=!!h.before,m=h.values||[];return new z1(m,f)}(t.startAt));let c=null;return t.endAt&&(c=function(h){const f=!h.before,m=h.values||[];return new z1(m,f)}(t.endAt)),gue(e,r,o,s,a,"F",l,c)}function Jue(n,e){const t=function(r){switch(r){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return en()}}(e.purpose);return t==null?null:{"goog-listen-tags":t}}function qj(n){return n.unaryFilter!==void 0?function(t){switch(t.unaryFilter.op){case"IS_NAN":const i=qf(t.unaryFilter.field);return Qi.create(i,"==",{doubleValue:NaN});case"IS_NULL":const r=qf(t.unaryFilter.field);return Qi.create(r,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=qf(t.unaryFilter.field);return Qi.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=qf(t.unaryFilter.field);return Qi.create(o,"!=",{nullValue:"NULL_VALUE"});default:return en()}}(n):n.fieldFilter!==void 0?function(t){return Qi.create(qf(t.fieldFilter.field),function(r){switch(r){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return en()}}(t.fieldFilter.op),t.fieldFilter.value)}(n):n.compositeFilter!==void 0?function(t){return Ea.create(t.compositeFilter.filters.map(i=>qj(i)),function(r){switch(r){case"AND":return"and";case"OR":return"or";default:return en()}}(t.compositeFilter.op))}(n):en()}function Que(n){return Uue[n]}function Zue(n){return Vue[n]}function ehe(n){return zue[n]}function Xf(n){return{fieldPath:n.canonicalString()}}function qf(n){return br.fromServerFormat(n.fieldPath)}function Yj(n){return n instanceof Qi?function(t){if(t.op==="=="){if(h3(t.value))return{unaryFilter:{field:Xf(t.field),op:"IS_NAN"}};if(u3(t.value))return{unaryFilter:{field:Xf(t.field),op:"IS_NULL"}}}else if(t.op==="!="){if(h3(t.value))return{unaryFilter:{field:Xf(t.field),op:"IS_NOT_NAN"}};if(u3(t.value))return{unaryFilter:{field:Xf(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Xf(t.field),op:Zue(t.op),value:t.value}}}(n):n instanceof Ea?function(t){const i=t.getFilters().map(r=>Yj(r));return i.length===1?i[0]:{compositeFilter:{op:ehe(t.op),filters:i}}}(n):en()}function the(n){const e=[];return n.fields.forEach(t=>e.push(t.canonicalString())),{fieldPaths:e}}function $j(n){return n.length>=4&&n.get(0)==="projects"&&n.get(2)==="databases"}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class lu{constructor(e,t,i,r,s=nn.min(),o=nn.min(),a=Dr.EMPTY_BYTE_STRING,l=null){this.target=e,this.targetId=t,this.purpose=i,this.sequenceNumber=r,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=a,this.expectedCount=l}withSequenceNumber(e){return new lu(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new lu(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new lu(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new lu(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class nhe{constructor(e){this.ct=e}}function ihe(n){const e=$ue({parent:n.parent,structuredQuery:n.structuredQuery});return n.limitType==="LAST"?H1(e,e.limit,"L"):e}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class rhe{constructor(){this.un=new she}addToCollectionParentIndex(e,t){return this.un.add(t),qe.resolve()}getCollectionParents(e,t){return qe.resolve(this.un.getEntries(t))}addFieldIndex(e,t){return qe.resolve()}deleteFieldIndex(e,t){return qe.resolve()}deleteAllFieldIndexes(e){return qe.resolve()}createTargetIndexes(e,t){return qe.resolve()}getDocumentsMatchingTarget(e,t){return qe.resolve(null)}getIndexType(e,t){return qe.resolve(0)}getFieldIndexes(e,t){return qe.resolve([])}getNextCollectionGroupToUpdate(e){return qe.resolve(null)}getMinOffset(e,t){return qe.resolve(Lu.min())}getMinOffsetFromCollectionGroup(e,t){return qe.resolve(Lu.min())}updateCollectionGroup(e,t,i){return qe.resolve()}updateIndexEntries(e,t){return qe.resolve()}}class she{constructor(){this.index={}}add(e){const t=e.lastSegment(),i=e.popLast(),r=this.index[t]||new Ir(ui.comparator),s=!r.has(i);return this.index[t]=r.add(i),s}has(e){const t=e.lastSegment(),i=e.popLast(),r=this.index[t];return r&&r.has(i)}getEntries(e){return(this.index[e]||new Ir(ui.comparator)).toArray()}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class dm{constructor(e){this.Ln=e}next(){return this.Ln+=2,this.Ln}static Bn(){return new dm(0)}static kn(){return new dm(-1)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ohe{constructor(){this.changes=new Vm(e=>e.toString(),(e,t)=>e.isEqual(t)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,Jr.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const i=this.changes.get(t);return i!==void 0?qe.resolve(i):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *//**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ahe{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class lhe{constructor(e,t,i,r){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=i,this.indexManager=r}getDocument(e,t){let i=null;return this.documentOverlayCache.getOverlay(e,t).next(r=>(i=r,this.remoteDocumentCache.getEntry(e,t))).next(r=>(i!==null&&Dy(i.mutation,r,ao.empty(),sr.now()),r))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(i=>this.getLocalViewOfDocuments(e,i,Tn()).next(()=>i))}getLocalViewOfDocuments(e,t,i=Tn()){const r=Yh();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,i).next(s=>{let o=ay();return s.forEach((a,l)=>{o=o.insert(a,l.overlayedDocument)}),o}))}getOverlayedDocuments(e,t){const i=Yh();return this.populateOverlays(e,i,t).next(()=>this.computeViews(e,t,i,Tn()))}populateOverlays(e,t,i){const r=[];return i.forEach(s=>{t.has(s)||r.push(s)}),this.documentOverlayCache.getOverlays(e,r).next(s=>{s.forEach((o,a)=>{t.set(o,a)})})}computeViews(e,t,i,r){let s=oc();const o=Ny(),a=function(){return Ny()}();return t.forEach((l,c)=>{const u=i.get(c.key);r.has(c.key)&&(u===void 0||u.mutation instanceof qu)?s=s.insert(c.key,c):u!==void 0?(o.set(c.key,u.mutation.getFieldMask()),Dy(u.mutation,c,u.mutation.getFieldMask(),sr.now())):o.set(c.key,ao.empty())}),this.recalculateAndSaveOverlays(e,s).next(l=>(l.forEach((c,u)=>o.set(c,u)),t.forEach((c,u)=>{var h;return a.set(c,new ahe(u,(h=o.get(c))!==null&&h!==void 0?h:null))}),a))}recalculateAndSaveOverlays(e,t){const i=Ny();let r=new Zi((o,a)=>o-a),s=Tn();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(o=>{for(const a of o)a.keys().forEach(l=>{const c=t.get(l);if(c===null)return;let u=i.get(l)||ao.empty();u=a.applyToLocalView(c,u),i.set(l,u);const h=(r.get(a.batchId)||Tn()).add(l);r=r.insert(a.batchId,h)})}).next(()=>{const o=[],a=r.getReverseIterator();for(;a.hasNext();){const l=a.getNext(),c=l.key,u=l.value,h=Rj();u.forEach(f=>{if(!s.has(f)){const m=Fj(t.get(f),i.get(f));m!==null&&h.set(f,m),s=s.add(f)}}),o.push(this.documentOverlayCache.saveOverlays(e,c,h))}return qe.waitFor(o)}).next(()=>i)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(i=>this.recalculateAndSaveOverlays(e,i))}getDocumentsMatchingQuery(e,t,i,r){return function(o){return jt.isDocumentKey(o.path)&&o.collectionGroup===null&&o.filters.length===0}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Tj(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,i,r):this.getDocumentsMatchingCollectionQuery(e,t,i,r)}getNextDocuments(e,t,i,r){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,i,r).next(s=>{const o=r-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,i.largestBatchId,r-s.size):qe.resolve(Yh());let a=-1,l=s;return o.next(c=>qe.forEach(c,(u,h)=>(a<h.largestBatchId&&(a=h.largestBatchId),s.get(u)?qe.resolve():this.remoteDocumentCache.getEntry(e,u).next(f=>{l=l.insert(u,f)}))).next(()=>this.populateOverlays(e,c,s)).next(()=>this.computeViews(e,l,c,Tn())).next(u=>({batchId:a,changes:Ij(u)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new jt(t)).next(i=>{let r=ay();return i.isFoundDocument()&&(r=r.insert(i.key,i)),r})}getDocumentsMatchingCollectionGroupQuery(e,t,i,r){const s=t.collectionGroup;let o=ay();return this.indexManager.getCollectionParents(e,s).next(a=>qe.forEach(a,l=>{const c=function(h,f){return new Um(f,null,h.explicitOrderBy.slice(),h.filters.slice(),h.limit,h.limitType,h.startAt,h.endAt)}(t,l.child(s));return this.getDocumentsMatchingCollectionQuery(e,c,i,r).next(u=>{u.forEach((h,f)=>{o=o.insert(h,f)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(e,t,i,r){let s;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,i.largestBatchId).next(o=>(s=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,i,s,r))).next(o=>{s.forEach((l,c)=>{const u=c.getKey();o.get(u)===null&&(o=o.insert(u,Jr.newInvalidDocument(u)))});let a=ay();return o.forEach((l,c)=>{const u=s.get(l);u!==void 0&&Dy(u.mutation,c,ao.empty(),sr.now()),BA(t,c)&&(a=a.insert(l,c))}),a})}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class che{constructor(e){this.serializer=e,this.hr=new Map,this.Pr=new Map}getBundleMetadata(e,t){return qe.resolve(this.hr.get(t))}saveBundleMetadata(e,t){return this.hr.set(t.id,function(r){return{id:r.id,version:r.version,createTime:$a(r.createTime)}}(t)),qe.resolve()}getNamedQuery(e,t){return qe.resolve(this.Pr.get(t))}saveNamedQuery(e,t){return this.Pr.set(t.name,function(r){return{name:r.name,query:ihe(r.bundledQuery),readTime:$a(r.readTime)}}(t)),qe.resolve()}}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class uhe{constructor(){this.overlays=new Zi(jt.comparator),this.Ir=new Map}getOverlay(e,t){return qe.resolve(this.overlays.get(t))}getOverlays(e,t){const i=Yh();return qe.forEach(t,r=>this.getOverlay(e,r).next(s=>{s!==null&&i.set(r,s)})).next(()=>i)}saveOverlays(e,t,i){return i.forEach((r,s)=>{this.ht(e,t,s)}),qe.resolve()}removeOverlaysForBatchId(e,t,i){const r=this.Ir.get(i);return r!==void 0&&(r.forEach(s=>this.overlays=this.overlays.remove(s)),this.Ir.delete(i)),qe.resolve()}getOverlaysForCollection(e,t,i){const r=Yh(),s=t.length+1,o=new jt(t.child("")),a=this.overlays.getIteratorFrom(o);for(;a.hasNext();){const l=a.getNext().value,c=l.getKey();if(!t.isPrefixOf(c.path))break;c.path.length===s&&l.largestBatchId>i&&r.set(l.getKey(),l)}return qe.resolve(r)}getOverlaysForCollectionGroup(e,t,i,r){let s=new Zi((c,u)=>c-u);const o=this.overlays.getIterator();for(;o.hasNext();){const c=o.getNext().value;if(c.getKey().getCollectionGroup()===t&&c.largestBatchId>i){let u=s.get(c.largestBatchId);u===null&&(u=Yh(),s=s.insert(c.largestBatchId,u)),u.set(c.getKey(),c)}}const a=Yh(),l=s.getIterator();for(;l.hasNext()&&(l.getNext().value.forEach((c,u)=>a.set(c,u)),!(a.size()>=r)););return qe.resolve(a)}ht(e,t,i){const r=this.overlays.get(i.key);if(r!==null){const o=this.Ir.get(r.largestBatchId).delete(i.key);this.Ir.set(r.largestBatchId,o)}this.overlays=this.overlays.insert(i.key,new Due(t,i));let s=this.Ir.get(t);s===void 0&&(s=Tn(),this.Ir.set(t,s)),this.Ir.set(t,s.add(i.key))}}/**
 * @license
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class hhe{constructor(){this.sessionToken=Dr.EMPTY_BYTE_STRING}getSessionToken(e){return qe.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,qe.resolve()}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class eN{constructor(){this.Tr=new Ir(fr.Er),this.dr=new Ir(fr.Ar)}isEmpty(){return this.Tr.isEmpty()}addReference(e,t){const i=new fr(e,t);this.Tr=this.Tr.add(i),this.dr=this.dr.add(i)}Rr(e,t){e.forEach(i=>this.addReference(i,t))}removeReference(e,t){this.Vr(new fr(e,t))}mr(e,t){e.forEach(i=>this.removeReference(i,t))}gr(e){const t=new jt(new ui([])),i=new fr(t,e),r=new fr(t,e+1),s=[];return this.dr.forEachInRange([i,r],o=>{this.Vr(o),s.push(o.key)}),s}pr(){this.Tr.forEach(e=>this.Vr(e))}Vr(e){this.Tr=this.Tr.delete(e),this.dr=this.dr.delete(e)}yr(e){const t=new jt(new ui([])),i=new fr(t,e),r=new fr(t,e+1);let s=Tn();return this.dr.forEachInRange([i,r],o=>{s=s.add(o.key)}),s}containsKey(e){const t=new fr(e,0),i=this.Tr.firstAfterOrEqual(t);return i!==null&&e.isEqual(i.key)}}class fr{constructor(e,t){this.key=e,this.wr=t}static Er(e,t){return jt.comparator(e.key,t.key)||Hn(e.wr,t.wr)}static Ar(e,t){return Hn(e.wr,t.wr)||jt.comparator(e.key,t.key)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class dhe{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.Sr=1,this.br=new Ir(fr.Er)}checkEmpty(e){return qe.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,i,r){const s=this.Sr;this.Sr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new Nue(s,t,i,r);this.mutationQueue.push(o);for(const a of r)this.br=this.br.add(new fr(a.key,s)),this.indexManager.addToCollectionParentIndex(e,a.key.path.popLast());return qe.resolve(o)}lookupMutationBatch(e,t){return qe.resolve(this.Dr(t))}getNextMutationBatchAfterBatchId(e,t){const i=t+1,r=this.vr(i),s=r<0?0:r;return qe.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return qe.resolve(this.mutationQueue.length===0?-1:this.Sr-1)}getAllMutationBatches(e){return qe.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const i=new fr(t,0),r=new fr(t,Number.POSITIVE_INFINITY),s=[];return this.br.forEachInRange([i,r],o=>{const a=this.Dr(o.wr);s.push(a)}),qe.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(e,t){let i=new Ir(Hn);return t.forEach(r=>{const s=new fr(r,0),o=new fr(r,Number.POSITIVE_INFINITY);this.br.forEachInRange([s,o],a=>{i=i.add(a.wr)})}),qe.resolve(this.Cr(i))}getAllMutationBatchesAffectingQuery(e,t){const i=t.path,r=i.length+1;let s=i;jt.isDocumentKey(s)||(s=s.child(""));const o=new fr(new jt(s),0);let a=new Ir(Hn);return this.br.forEachWhile(l=>{const c=l.key.path;return!!i.isPrefixOf(c)&&(c.length===r&&(a=a.add(l.wr)),!0)},o),qe.resolve(this.Cr(a))}Cr(e){const t=[];return e.forEach(i=>{const r=this.Dr(i);r!==null&&t.push(r)}),t}removeMutationBatch(e,t){Qn(this.Fr(t.batchId,"removed")===0),this.mutationQueue.shift();let i=this.br;return qe.forEach(t.mutations,r=>{const s=new fr(r.key,t.batchId);return i=i.delete(s),this.referenceDelegate.markPotentiallyOrphaned(e,r.key)}).next(()=>{this.br=i})}On(e){}containsKey(e,t){const i=new fr(t,0),r=this.br.firstAfterOrEqual(i);return qe.resolve(t.isEqual(r&&r.key))}performConsistencyCheck(e){return this.mutationQueue.length,qe.resolve()}Fr(e,t){return this.vr(e)}vr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Dr(e){const t=this.vr(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class fhe{constructor(e){this.Mr=e,this.docs=function(){return new Zi(jt.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const i=t.key,r=this.docs.get(i),s=r?r.size:0,o=this.Mr(t);return this.docs=this.docs.insert(i,{document:t.mutableCopy(),size:o}),this.size+=o-s,this.indexManager.addToCollectionParentIndex(e,i.path.popLast())}removeEntry(e){const t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){const i=this.docs.get(t);return qe.resolve(i?i.document.mutableCopy():Jr.newInvalidDocument(t))}getEntries(e,t){let i=oc();return t.forEach(r=>{const s=this.docs.get(r);i=i.insert(r,s?s.document.mutableCopy():Jr.newInvalidDocument(r))}),qe.resolve(i)}getDocumentsMatchingQuery(e,t,i,r){let s=oc();const o=t.path,a=new jt(o.child("")),l=this.docs.getIteratorFrom(a);for(;l.hasNext();){const{key:c,value:{document:u}}=l.getNext();if(!o.isPrefixOf(c.path))break;c.path.length>o.length+1||Jce($ce(u),i)<=0||(r.has(u.key)||BA(t,u))&&(s=s.insert(u.key,u.mutableCopy()))}return qe.resolve(s)}getAllFromCollectionGroup(e,t,i,r){en()}Or(e,t){return qe.forEach(this.docs,i=>t(i))}newChangeBuffer(e){return new phe(this)}getSize(e){return qe.resolve(this.size)}}class phe extends ohe{constructor(e){super(),this.cr=e}applyChanges(e){const t=[];return this.changes.forEach((i,r)=>{r.isValidDocument()?t.push(this.cr.addEntry(e,r)):this.cr.removeEntry(i)}),qe.waitFor(t)}getFromCache(e,t){return this.cr.getEntry(e,t)}getAllFromCache(e,t){return this.cr.getEntries(e,t)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class mhe{constructor(e){this.persistence=e,this.Nr=new Vm(t=>q2(t),Y2),this.lastRemoteSnapshotVersion=nn.min(),this.highestTargetId=0,this.Lr=0,this.Br=new eN,this.targetCount=0,this.kr=dm.Bn()}forEachTarget(e,t){return this.Nr.forEach((i,r)=>t(r)),qe.resolve()}getLastRemoteSnapshotVersion(e){return qe.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return qe.resolve(this.Lr)}allocateTargetId(e){return this.highestTargetId=this.kr.next(),qe.resolve(this.highestTargetId)}setTargetsMetadata(e,t,i){return i&&(this.lastRemoteSnapshotVersion=i),t>this.Lr&&(this.Lr=t),qe.resolve()}Kn(e){this.Nr.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.kr=new dm(t),this.highestTargetId=t),e.sequenceNumber>this.Lr&&(this.Lr=e.sequenceNumber)}addTargetData(e,t){return this.Kn(t),this.targetCount+=1,qe.resolve()}updateTargetData(e,t){return this.Kn(t),qe.resolve()}removeTargetData(e,t){return this.Nr.delete(t.target),this.Br.gr(t.targetId),this.targetCount-=1,qe.resolve()}removeTargets(e,t,i){let r=0;const s=[];return this.Nr.forEach((o,a)=>{a.sequenceNumber<=t&&i.get(a.targetId)===null&&(this.Nr.delete(o),s.push(this.removeMatchingKeysForTargetId(e,a.targetId)),r++)}),qe.waitFor(s).next(()=>r)}getTargetCount(e){return qe.resolve(this.targetCount)}getTargetData(e,t){const i=this.Nr.get(t)||null;return qe.resolve(i)}addMatchingKeys(e,t,i){return this.Br.Rr(t,i),qe.resolve()}removeMatchingKeys(e,t,i){this.Br.mr(t,i);const r=this.persistence.referenceDelegate,s=[];return r&&t.forEach(o=>{s.push(r.markPotentiallyOrphaned(e,o))}),qe.waitFor(s)}removeMatchingKeysForTargetId(e,t){return this.Br.gr(t),qe.resolve()}getMatchingKeysForTargetId(e,t){const i=this.Br.yr(t);return qe.resolve(i)}containsKey(e,t){return qe.resolve(this.Br.containsKey(t))}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ghe{constructor(e,t){this.qr={},this.overlays={},this.Qr=new j2(0),this.Kr=!1,this.Kr=!0,this.$r=new hhe,this.referenceDelegate=e(this),this.Ur=new mhe(this),this.indexManager=new rhe,this.remoteDocumentCache=function(r){return new fhe(r)}(i=>this.referenceDelegate.Wr(i)),this.serializer=new nhe(t),this.Gr=new che(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.Kr=!1,Promise.resolve()}get started(){return this.Kr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new uhe,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let i=this.qr[e.toKey()];return i||(i=new dhe(t,this.referenceDelegate),this.qr[e.toKey()]=i),i}getGlobalsCache(){return this.$r}getTargetCache(){return this.Ur}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Gr}runTransaction(e,t,i){kt("MemoryPersistence","Starting transaction:",e);const r=new yhe(this.Qr.next());return this.referenceDelegate.zr(),i(r).next(s=>this.referenceDelegate.jr(r).next(()=>s)).toPromise().then(s=>(r.raiseOnCommittedEvent(),s))}Hr(e,t){return qe.or(Object.values(this.qr).map(i=>()=>i.containsKey(e,t)))}}class yhe extends Zce{constructor(e){super(),this.currentSequenceNumber=e}}class tN{constructor(e){this.persistence=e,this.Jr=new eN,this.Yr=null}static Zr(e){return new tN(e)}get Xr(){if(this.Yr)return this.Yr;throw en()}addReference(e,t,i){return this.Jr.addReference(i,t),this.Xr.delete(i.toString()),qe.resolve()}removeReference(e,t,i){return this.Jr.removeReference(i,t),this.Xr.add(i.toString()),qe.resolve()}markPotentiallyOrphaned(e,t){return this.Xr.add(t.toString()),qe.resolve()}removeTarget(e,t){this.Jr.gr(t.targetId).forEach(r=>this.Xr.add(r.toString()));const i=this.persistence.getTargetCache();return i.getMatchingKeysForTargetId(e,t.targetId).next(r=>{r.forEach(s=>this.Xr.add(s.toString()))}).next(()=>i.removeTargetData(e,t))}zr(){this.Yr=new Set}jr(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return qe.forEach(this.Xr,i=>{const r=jt.fromPath(i);return this.ei(e,r).next(s=>{s||t.removeEntry(r,nn.min())})}).next(()=>(this.Yr=null,t.apply(e)))}updateLimboDocument(e,t){return this.ei(e,t).next(i=>{i?this.Xr.delete(t.toString()):this.Xr.add(t.toString())})}Wr(e){return 0}ei(e,t){return qe.or([()=>qe.resolve(this.Jr.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Hr(e,t)])}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class nN{constructor(e,t,i,r){this.targetId=e,this.fromCache=t,this.$i=i,this.Ui=r}static Wi(e,t){let i=Tn(),r=Tn();for(const s of t.docChanges)switch(s.type){case 0:i=i.add(s.doc.key);break;case 1:r=r.add(s.doc.key)}return new nN(e,t.fromCache,i,r)}}/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class vhe{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class _he{constructor(){this.Gi=!1,this.zi=!1,this.ji=100,this.Hi=function(){return _le()?8:eue(rs())>0?6:4}()}initialize(e,t){this.Ji=e,this.indexManager=t,this.Gi=!0}getDocumentsMatchingQuery(e,t,i,r){const s={result:null};return this.Yi(e,t).next(o=>{s.result=o}).next(()=>{if(!s.result)return this.Zi(e,t,r,i).next(o=>{s.result=o})}).next(()=>{if(s.result)return;const o=new vhe;return this.Xi(e,t,o).next(a=>{if(s.result=a,this.zi)return this.es(e,t,o,a.size)})}).next(()=>s.result)}es(e,t,i,r){return i.documentReadCount<this.ji?(Pg()<=Sn.DEBUG&&kt("QueryEngine","SDK will not create cache indexes for query:",Kf(t),"since it only creates cache indexes for collection contains","more than or equal to",this.ji,"documents"),qe.resolve()):(Pg()<=Sn.DEBUG&&kt("QueryEngine","Query:",Kf(t),"scans",i.documentReadCount,"local documents and returns",r,"documents as results."),i.documentReadCount>this.Hi*r?(Pg()<=Sn.DEBUG&&kt("QueryEngine","The SDK decides to create cache indexes for query:",Kf(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Ya(t))):qe.resolve())}Yi(e,t){if(m3(t))return qe.resolve(null);let i=Ya(t);return this.indexManager.getIndexType(e,i).next(r=>r===0?null:(t.limit!==null&&r===1&&(t=H1(t,null,"F"),i=Ya(t)),this.indexManager.getDocumentsMatchingTarget(e,i).next(s=>{const o=Tn(...s);return this.Ji.getDocuments(e,o).next(a=>this.indexManager.getMinOffset(e,i).next(l=>{const c=this.ts(t,a);return this.ns(t,c,o,l.readTime)?this.Yi(e,H1(t,null,"F")):this.rs(e,c,t,l)}))})))}Zi(e,t,i,r){return m3(t)||r.isEqual(nn.min())?qe.resolve(null):this.Ji.getDocuments(e,i).next(s=>{const o=this.ts(t,s);return this.ns(t,o,i,r)?qe.resolve(null):(Pg()<=Sn.DEBUG&&kt("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),Kf(t)),this.rs(e,o,t,Yce(r,-1)).next(a=>a))})}ts(e,t){let i=new Ir(Cj(e));return t.forEach((r,s)=>{BA(e,s)&&(i=i.add(s))}),i}ns(e,t,i,r){if(e.limit===null)return!1;if(i.size!==t.size)return!0;const s=e.limitType==="F"?t.last():t.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(r)>0)}Xi(e,t,i){return Pg()<=Sn.DEBUG&&kt("QueryEngine","Using full collection scan to execute query:",Kf(t)),this.Ji.getDocumentsMatchingQuery(e,t,Lu.min(),i)}rs(e,t,i,r){return this.Ji.getDocumentsMatchingQuery(e,i,r).next(s=>(t.forEach(o=>{s=s.insert(o.key,o)}),s))}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class xhe{constructor(e,t,i,r){this.persistence=e,this.ss=t,this.serializer=r,this.os=new Zi(Hn),this._s=new Vm(s=>q2(s),Y2),this.us=new Map,this.cs=e.getRemoteDocumentCache(),this.Ur=e.getTargetCache(),this.Gr=e.getBundleCache(),this.ls(i)}ls(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new lhe(this.cs,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.cs.setIndexManager(this.indexManager),this.ss.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.os))}}function whe(n,e,t,i){return new xhe(n,e,t,i)}async function Jj(n,e){const t=rn(n);return await t.persistence.runTransaction("Handle user change","readonly",i=>{let r;return t.mutationQueue.getAllMutationBatches(i).next(s=>(r=s,t.ls(e),t.mutationQueue.getAllMutationBatches(i))).next(s=>{const o=[],a=[];let l=Tn();for(const c of r){o.push(c.batchId);for(const u of c.mutations)l=l.add(u.key)}for(const c of s){a.push(c.batchId);for(const u of c.mutations)l=l.add(u.key)}return t.localDocuments.getDocuments(i,l).next(c=>({hs:c,removedBatchIds:o,addedBatchIds:a}))})})}function Ehe(n,e){const t=rn(n);return t.persistence.runTransaction("Acknowledge batch","readwrite-primary",i=>{const r=e.batch.keys(),s=t.cs.newChangeBuffer({trackRemovals:!0});return function(a,l,c,u){const h=c.batch,f=h.keys();let m=qe.resolve();return f.forEach(y=>{m=m.next(()=>u.getEntry(l,y)).next(_=>{const v=c.docVersions.get(y);Qn(v!==null),_.version.compareTo(v)<0&&(h.applyToRemoteDocument(_,c),_.isValidDocument()&&(_.setReadTime(c.commitVersion),u.addEntry(_)))})}),m.next(()=>a.mutationQueue.removeMutationBatch(l,h))}(t,i,e,s).next(()=>s.apply(i)).next(()=>t.mutationQueue.performConsistencyCheck(i)).next(()=>t.documentOverlayCache.removeOverlaysForBatchId(i,r,e.batch.batchId)).next(()=>t.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(i,function(a){let l=Tn();for(let c=0;c<a.mutationResults.length;++c)a.mutationResults[c].transformResults.length>0&&(l=l.add(a.batch.mutations[c].key));return l}(e))).next(()=>t.localDocuments.getDocuments(i,r))})}function Qj(n){const e=rn(n);return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.Ur.getLastRemoteSnapshotVersion(t))}function Ahe(n,e){const t=rn(n),i=e.snapshotVersion;let r=t.os;return t.persistence.runTransaction("Apply remote event","readwrite-primary",s=>{const o=t.cs.newChangeBuffer({trackRemovals:!0});r=t.os;const a=[];e.targetChanges.forEach((u,h)=>{const f=r.get(h);if(!f)return;a.push(t.Ur.removeMatchingKeys(s,u.removedDocuments,h).next(()=>t.Ur.addMatchingKeys(s,u.addedDocuments,h)));let m=f.withSequenceNumber(s.currentSequenceNumber);e.targetMismatches.get(h)!==null?m=m.withResumeToken(Dr.EMPTY_BYTE_STRING,nn.min()).withLastLimboFreeSnapshotVersion(nn.min()):u.resumeToken.approximateByteSize()>0&&(m=m.withResumeToken(u.resumeToken,i)),r=r.insert(h,m),function(_,v,g){return _.resumeToken.approximateByteSize()===0||v.snapshotVersion.toMicroseconds()-_.snapshotVersion.toMicroseconds()>=3e8?!0:g.addedDocuments.size+g.modifiedDocuments.size+g.removedDocuments.size>0}(f,m,u)&&a.push(t.Ur.updateTargetData(s,m))});let l=oc(),c=Tn();if(e.documentUpdates.forEach(u=>{e.resolvedLimboDocuments.has(u)&&a.push(t.persistence.referenceDelegate.updateLimboDocument(s,u))}),a.push(She(s,o,e.documentUpdates).next(u=>{l=u.Ps,c=u.Is})),!i.isEqual(nn.min())){const u=t.Ur.getLastRemoteSnapshotVersion(s).next(h=>t.Ur.setTargetsMetadata(s,s.currentSequenceNumber,i));a.push(u)}return qe.waitFor(a).next(()=>o.apply(s)).next(()=>t.localDocuments.getLocalViewOfDocuments(s,l,c)).next(()=>l)}).then(s=>(t.os=r,s))}function She(n,e,t){let i=Tn(),r=Tn();return t.forEach(s=>i=i.add(s)),e.getEntries(n,i).next(s=>{let o=oc();return t.forEach((a,l)=>{const c=s.get(a);l.isFoundDocument()!==c.isFoundDocument()&&(r=r.add(a)),l.isNoDocument()&&l.version.isEqual(nn.min())?(e.removeEntry(a,l.readTime),o=o.insert(a,l)):!c.isValidDocument()||l.version.compareTo(c.version)>0||l.version.compareTo(c.version)===0&&c.hasPendingWrites?(e.addEntry(l),o=o.insert(a,l)):kt("LocalStore","Ignoring outdated watch update for ",a,". Current version:",c.version," Watch version:",l.version)}),{Ps:o,Is:r}})}function The(n,e){const t=rn(n);return t.persistence.runTransaction("Get next mutation batch","readonly",i=>(e===void 0&&(e=-1),t.mutationQueue.getNextMutationBatchAfterBatchId(i,e)))}function bhe(n,e){const t=rn(n);return t.persistence.runTransaction("Allocate target","readwrite",i=>{let r;return t.Ur.getTargetData(i,e).next(s=>s?(r=s,qe.resolve(r)):t.Ur.allocateTargetId(i).next(o=>(r=new lu(e,o,"TargetPurposeListen",i.currentSequenceNumber),t.Ur.addTargetData(i,r).next(()=>r))))}).then(i=>{const r=t.os.get(i.targetId);return(r===null||i.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(t.os=t.os.insert(i.targetId,i),t._s.set(e,i.targetId)),i})}async function QI(n,e,t){const i=rn(n),r=i.os.get(e),s=t?"readwrite":"readwrite-primary";try{t||await i.persistence.runTransaction("Release target",s,o=>i.persistence.referenceDelegate.removeTarget(o,r))}catch(o){if(!fv(o))throw o;kt("LocalStore",`Failed to update sequence numbers for target ${e}: ${o}`)}i.os=i.os.remove(e),i._s.delete(r.target)}function b3(n,e,t){const i=rn(n);let r=nn.min(),s=Tn();return i.persistence.runTransaction("Execute query","readwrite",o=>function(l,c,u){const h=rn(l),f=h._s.get(u);return f!==void 0?qe.resolve(h.os.get(f)):h.Ur.getTargetData(c,u)}(i,o,Ya(e)).next(a=>{if(a)return r=a.lastLimboFreeSnapshotVersion,i.Ur.getMatchingKeysForTargetId(o,a.targetId).next(l=>{s=l})}).next(()=>i.ss.getDocumentsMatchingQuery(o,e,t?r:nn.min(),t?s:Tn())).next(a=>(Che(i,vue(e),a),{documents:a,Ts:s})))}function Che(n,e,t){let i=n.us.get(e)||nn.min();t.forEach((r,s)=>{s.readTime.compareTo(i)>0&&(i=s.readTime)}),n.us.set(e,i)}class C3{constructor(){this.activeTargetIds=Sue()}fs(e){this.activeTargetIds=this.activeTargetIds.add(e)}gs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Vs(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class Mhe{constructor(){this.so=new C3,this.oo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,i){}addLocalQueryTarget(e,t=!0){return t&&this.so.fs(e),this.oo[e]||"not-current"}updateQueryState(e,t,i){this.oo[e]=t}removeLocalQueryTarget(e){this.so.gs(e)}isLocalQueryTarget(e){return this.so.activeTargetIds.has(e)}clearQueryState(e){delete this.oo[e]}getAllActiveQueryTargets(){return this.so.activeTargetIds}isActiveQueryTarget(e){return this.so.activeTargetIds.has(e)}start(){return this.so=new C3,Promise.resolve()}handleUserChange(e,t,i){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Ihe{_o(e){}shutdown(){}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class M3{constructor(){this.ao=()=>this.uo(),this.co=()=>this.lo(),this.ho=[],this.Po()}_o(e){this.ho.push(e)}shutdown(){window.removeEventListener("online",this.ao),window.removeEventListener("offline",this.co)}Po(){window.addEventListener("online",this.ao),window.addEventListener("offline",this.co)}uo(){kt("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const e of this.ho)e(0)}lo(){kt("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const e of this.ho)e(1)}static D(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let hx=null;function Bb(){return hx===null?hx=function(){return 268435456+Math.round(2147483648*Math.random())}():hx++,"0x"+hx.toString(16)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Rhe={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Phe{constructor(e){this.Io=e.Io,this.To=e.To}Eo(e){this.Ao=e}Ro(e){this.Vo=e}mo(e){this.fo=e}onMessage(e){this.po=e}close(){this.To()}send(e){this.Io(e)}yo(){this.Ao()}wo(){this.Vo()}So(e){this.fo(e)}bo(e){this.po(e)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const jr="WebChannelConnection";class Nhe extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const i=t.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.Do=i+"://"+t.host,this.vo=`projects/${r}/databases/${s}`,this.Co=this.databaseId.database==="(default)"?`project_id=${r}`:`project_id=${r}&database_id=${s}`}get Fo(){return!1}Mo(t,i,r,s,o){const a=Bb(),l=this.xo(t,i.toUriEncodedString());kt("RestConnection",`Sending RPC '${t}' ${a}:`,l,r);const c={"google-cloud-resource-prefix":this.vo,"x-goog-request-params":this.Co};return this.Oo(c,s,o),this.No(t,l,c,r).then(u=>(kt("RestConnection",`Received RPC '${t}' ${a}: `,u),u),u=>{throw lm("RestConnection",`RPC '${t}' ${a} failed with error: `,u,"url: ",l,"request:",r),u})}Lo(t,i,r,s,o,a){return this.Mo(t,i,r,s,o)}Oo(t,i,r){t["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+Fm}(),t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),i&&i.headers.forEach((s,o)=>t[o]=s),r&&r.headers.forEach((s,o)=>t[o]=s)}xo(t,i){const r=Rhe[t];return`${this.Do}/v1/${i}:${r}`}terminate(){}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}No(e,t,i,r){const s=Bb();return new Promise((o,a)=>{const l=new cj;l.setWithCredentials(!0),l.listenOnce(uj.COMPLETE,()=>{try{switch(l.getLastErrorCode()){case kw.NO_ERROR:const u=l.getResponseJson();kt(jr,`XHR for RPC '${e}' ${s} received:`,JSON.stringify(u)),o(u);break;case kw.TIMEOUT:kt(jr,`RPC '${e}' ${s} timed out`),a(new bt(He.DEADLINE_EXCEEDED,"Request time out"));break;case kw.HTTP_ERROR:const h=l.getStatus();if(kt(jr,`RPC '${e}' ${s} failed with status:`,h,"response text:",l.getResponseText()),h>0){let f=l.getResponseJson();Array.isArray(f)&&(f=f[0]);const m=f==null?void 0:f.error;if(m&&m.status&&m.message){const y=function(v){const g=v.toLowerCase().replace(/_/g,"-");return Object.values(He).indexOf(g)>=0?g:He.UNKNOWN}(m.status);a(new bt(y,m.message))}else a(new bt(He.UNKNOWN,"Server responded with status "+l.getStatus()))}else a(new bt(He.UNAVAILABLE,"Connection failed."));break;default:en()}}finally{kt(jr,`RPC '${e}' ${s} completed.`)}});const c=JSON.stringify(r);kt(jr,`RPC '${e}' ${s} sending request:`,r),l.send(t,"POST",c,i,15)})}Bo(e,t,i){const r=Bb(),s=[this.Do,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=fj(),a=dj(),l={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;c!==void 0&&(l.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(l.useFetchStreams=!0),this.Oo(l.initMessageHeaders,t,i),l.encodeInitMessageHeaders=!0;const u=s.join("");kt(jr,`Creating RPC '${e}' stream ${r}: ${u}`,l);const h=o.createWebChannel(u,l);let f=!1,m=!1;const y=new Phe({Io:v=>{m?kt(jr,`Not sending because RPC '${e}' stream ${r} is closed:`,v):(f||(kt(jr,`Opening RPC '${e}' stream ${r} transport.`),h.open(),f=!0),kt(jr,`RPC '${e}' stream ${r} sending:`,v),h.send(v))},To:()=>h.close()}),_=(v,g,w)=>{v.listen(g,A=>{try{w(A)}catch(T){setTimeout(()=>{throw T},0)}})};return _(h,oy.EventType.OPEN,()=>{m||(kt(jr,`RPC '${e}' stream ${r} transport opened.`),y.yo())}),_(h,oy.EventType.CLOSE,()=>{m||(m=!0,kt(jr,`RPC '${e}' stream ${r} transport closed`),y.So())}),_(h,oy.EventType.ERROR,v=>{m||(m=!0,lm(jr,`RPC '${e}' stream ${r} transport errored:`,v),y.So(new bt(He.UNAVAILABLE,"The operation could not be completed")))}),_(h,oy.EventType.MESSAGE,v=>{var g;if(!m){const w=v.data[0];Qn(!!w);const A=w,T=A.error||((g=A[0])===null||g===void 0?void 0:g.error);if(T){kt(jr,`RPC '${e}' stream ${r} received error:`,T);const L=T.status;let D=function(M){const C=Yi[M];if(C!==void 0)return zj(C)}(L),R=T.message;D===void 0&&(D=He.INTERNAL,R="Unknown error status: "+L+" with message "+T.message),m=!0,y.So(new bt(D,R)),h.close()}else kt(jr,`RPC '${e}' stream ${r} received:`,w),y.bo(w)}}),_(a,hj.STAT_EVENT,v=>{v.stat===zI.PROXY?kt(jr,`RPC '${e}' stream ${r} detected buffering proxy`):v.stat===zI.NOPROXY&&kt(jr,`RPC '${e}' stream ${r} detected no buffering proxy`)}),setTimeout(()=>{y.wo()},0),y}}function Ob(){return typeof document<"u"?document:null}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function VA(n){return new Hue(n,!0)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Zj{constructor(e,t,i=1e3,r=1.5,s=6e4){this.ui=e,this.timerId=t,this.ko=i,this.qo=r,this.Qo=s,this.Ko=0,this.$o=null,this.Uo=Date.now(),this.reset()}reset(){this.Ko=0}Wo(){this.Ko=this.Qo}Go(e){this.cancel();const t=Math.floor(this.Ko+this.zo()),i=Math.max(0,Date.now()-this.Uo),r=Math.max(0,t-i);r>0&&kt("ExponentialBackoff",`Backing off for ${r} ms (base delay: ${this.Ko} ms, delay with jitter: ${t} ms, last attempt: ${i} ms ago)`),this.$o=this.ui.enqueueAfterDelay(this.timerId,r,()=>(this.Uo=Date.now(),e())),this.Ko*=this.qo,this.Ko<this.ko&&(this.Ko=this.ko),this.Ko>this.Qo&&(this.Ko=this.Qo)}jo(){this.$o!==null&&(this.$o.skipDelay(),this.$o=null)}cancel(){this.$o!==null&&(this.$o.cancel(),this.$o=null)}zo(){return(Math.random()-.5)*this.Ko}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class e8{constructor(e,t,i,r,s,o,a,l){this.ui=e,this.Ho=i,this.Jo=r,this.connection=s,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=a,this.listener=l,this.state=0,this.Yo=0,this.Zo=null,this.Xo=null,this.stream=null,this.e_=0,this.t_=new Zj(e,t)}n_(){return this.state===1||this.state===5||this.r_()}r_(){return this.state===2||this.state===3}start(){this.e_=0,this.state!==4?this.auth():this.i_()}async stop(){this.n_()&&await this.close(0)}s_(){this.state=0,this.t_.reset()}o_(){this.r_()&&this.Zo===null&&(this.Zo=this.ui.enqueueAfterDelay(this.Ho,6e4,()=>this.__()))}a_(e){this.u_(),this.stream.send(e)}async __(){if(this.r_())return this.close(0)}u_(){this.Zo&&(this.Zo.cancel(),this.Zo=null)}c_(){this.Xo&&(this.Xo.cancel(),this.Xo=null)}async close(e,t){this.u_(),this.c_(),this.t_.cancel(),this.Yo++,e!==4?this.t_.reset():t&&t.code===He.RESOURCE_EXHAUSTED?(sc(t.toString()),sc("Using maximum backoff delay to prevent overloading the backend."),this.t_.Wo()):t&&t.code===He.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.l_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.mo(t)}l_(){}auth(){this.state=1;const e=this.h_(this.Yo),t=this.Yo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([i,r])=>{this.Yo===t&&this.P_(i,r)},i=>{e(()=>{const r=new bt(He.UNKNOWN,"Fetching auth token failed: "+i.message);return this.I_(r)})})}P_(e,t){const i=this.h_(this.Yo);this.stream=this.T_(e,t),this.stream.Eo(()=>{i(()=>this.listener.Eo())}),this.stream.Ro(()=>{i(()=>(this.state=2,this.Xo=this.ui.enqueueAfterDelay(this.Jo,1e4,()=>(this.r_()&&(this.state=3),Promise.resolve())),this.listener.Ro()))}),this.stream.mo(r=>{i(()=>this.I_(r))}),this.stream.onMessage(r=>{i(()=>++this.e_==1?this.E_(r):this.onNext(r))})}i_(){this.state=5,this.t_.Go(async()=>{this.state=0,this.start()})}I_(e){return kt("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}h_(e){return t=>{this.ui.enqueueAndForget(()=>this.Yo===e?t():(kt("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class Dhe extends e8{constructor(e,t,i,r,s,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,i,r,o),this.serializer=s}T_(e,t){return this.connection.Bo("Listen",e,t)}E_(e){return this.onNext(e)}onNext(e){this.t_.reset();const t=Wue(this.serializer,e),i=function(s){if(!("targetChange"in s))return nn.min();const o=s.targetChange;return o.targetIds&&o.targetIds.length?nn.min():o.readTime?$a(o.readTime):nn.min()}(e);return this.listener.d_(t,i)}A_(e){const t={};t.database=JI(this.serializer),t.addTarget=function(s,o){let a;const l=o.target;if(a=KI(l)?{documents:que(s,l)}:{query:Yue(s,l)._t},a.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){a.resumeToken=jj(s,o.resumeToken);const c=qI(s,o.expectedCount);c!==null&&(a.expectedCount=c)}else if(o.snapshotVersion.compareTo(nn.min())>0){a.readTime=G1(s,o.snapshotVersion.toTimestamp());const c=qI(s,o.expectedCount);c!==null&&(a.expectedCount=c)}return a}(this.serializer,e);const i=Jue(this.serializer,e);i&&(t.labels=i),this.a_(t)}R_(e){const t={};t.database=JI(this.serializer),t.removeTarget=e,this.a_(t)}}class Lhe extends e8{constructor(e,t,i,r,s,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,i,r,o),this.serializer=s}get V_(){return this.e_>0}start(){this.lastStreamToken=void 0,super.start()}l_(){this.V_&&this.m_([])}T_(e,t){return this.connection.Bo("Write",e,t)}E_(e){return Qn(!!e.streamToken),this.lastStreamToken=e.streamToken,Qn(!e.writeResults||e.writeResults.length===0),this.listener.f_()}onNext(e){Qn(!!e.streamToken),this.lastStreamToken=e.streamToken,this.t_.reset();const t=Xue(e.writeResults,e.commitTime),i=$a(e.commitTime);return this.listener.g_(i,t)}p_(){const e={};e.database=JI(this.serializer),this.a_(e)}m_(e){const t={streamToken:this.lastStreamToken,writes:e.map(i=>Kue(this.serializer,i))};this.a_(t)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class khe extends class{}{constructor(e,t,i,r){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=i,this.serializer=r,this.y_=!1}w_(){if(this.y_)throw new bt(He.FAILED_PRECONDITION,"The client has already been terminated.")}Mo(e,t,i,r){return this.w_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,o])=>this.connection.Mo(e,YI(t,i),r,s,o)).catch(s=>{throw s.name==="FirebaseError"?(s.code===He.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),s):new bt(He.UNKNOWN,s.toString())})}Lo(e,t,i,r,s){return this.w_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,a])=>this.connection.Lo(e,YI(t,i),r,o,a,s)).catch(o=>{throw o.name==="FirebaseError"?(o.code===He.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new bt(He.UNKNOWN,o.toString())})}terminate(){this.y_=!0,this.connection.terminate()}}class Bhe{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.S_=0,this.b_=null,this.D_=!0}v_(){this.S_===0&&(this.C_("Unknown"),this.b_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.b_=null,this.F_("Backend didn't respond within 10 seconds."),this.C_("Offline"),Promise.resolve())))}M_(e){this.state==="Online"?this.C_("Unknown"):(this.S_++,this.S_>=1&&(this.x_(),this.F_(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.C_("Offline")))}set(e){this.x_(),this.S_=0,e==="Online"&&(this.D_=!1),this.C_(e)}C_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}F_(e){const t=`Could not reach Cloud Firestore backend. ${e}
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.D_?(sc(t),this.D_=!1):kt("OnlineStateTracker",t)}x_(){this.b_!==null&&(this.b_.cancel(),this.b_=null)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Ohe{constructor(e,t,i,r,s){this.localStore=e,this.datastore=t,this.asyncQueue=i,this.remoteSyncer={},this.O_=[],this.N_=new Map,this.L_=new Set,this.B_=[],this.k_=s,this.k_._o(o=>{i.enqueueAndForget(async()=>{$d(this)&&(kt("RemoteStore","Restarting streams for network reachability change."),await async function(l){const c=rn(l);c.L_.add(4),await gv(c),c.q_.set("Unknown"),c.L_.delete(4),await zA(c)}(this))})}),this.q_=new Bhe(i,r)}}async function zA(n){if($d(n))for(const e of n.B_)await e(!0)}async function gv(n){for(const e of n.B_)await e(!1)}function t8(n,e){const t=rn(n);t.N_.has(e.targetId)||(t.N_.set(e.targetId,e),oN(t)?sN(t):zm(t).r_()&&rN(t,e))}function iN(n,e){const t=rn(n),i=zm(t);t.N_.delete(e),i.r_()&&n8(t,e),t.N_.size===0&&(i.r_()?i.o_():$d(t)&&t.q_.set("Unknown"))}function rN(n,e){if(n.Q_.xe(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(nn.min())>0){const t=n.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(t)}zm(n).A_(e)}function n8(n,e){n.Q_.xe(e),zm(n).R_(e)}function sN(n){n.Q_=new Fue({getRemoteKeysForTarget:e=>n.remoteSyncer.getRemoteKeysForTarget(e),ot:e=>n.N_.get(e)||null,tt:()=>n.datastore.serializer.databaseId}),zm(n).start(),n.q_.v_()}function oN(n){return $d(n)&&!zm(n).n_()&&n.N_.size>0}function $d(n){return rn(n).L_.size===0}function i8(n){n.Q_=void 0}async function Fhe(n){n.q_.set("Online")}async function Uhe(n){n.N_.forEach((e,t)=>{rN(n,e)})}async function Vhe(n,e){i8(n),oN(n)?(n.q_.M_(e),sN(n)):n.q_.set("Unknown")}async function zhe(n,e,t){if(n.q_.set("Online"),e instanceof Gj&&e.state===2&&e.cause)try{await async function(r,s){const o=s.cause;for(const a of s.targetIds)r.N_.has(a)&&(await r.remoteSyncer.rejectListen(a,o),r.N_.delete(a),r.Q_.removeTarget(a))}(n,e)}catch(i){kt("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),i),await j1(n,i)}else if(e instanceof Fw?n.Q_.Ke(e):e instanceof Hj?n.Q_.He(e):n.Q_.We(e),!t.isEqual(nn.min()))try{const i=await Qj(n.localStore);t.compareTo(i)>=0&&await function(s,o){const a=s.Q_.rt(o);return a.targetChanges.forEach((l,c)=>{if(l.resumeToken.approximateByteSize()>0){const u=s.N_.get(c);u&&s.N_.set(c,u.withResumeToken(l.resumeToken,o))}}),a.targetMismatches.forEach((l,c)=>{const u=s.N_.get(l);if(!u)return;s.N_.set(l,u.withResumeToken(Dr.EMPTY_BYTE_STRING,u.snapshotVersion)),n8(s,l);const h=new lu(u.target,l,c,u.sequenceNumber);rN(s,h)}),s.remoteSyncer.applyRemoteEvent(a)}(n,t)}catch(i){kt("RemoteStore","Failed to raise snapshot:",i),await j1(n,i)}}async function j1(n,e,t){if(!fv(e))throw e;n.L_.add(1),await gv(n),n.q_.set("Offline"),t||(t=()=>Qj(n.localStore)),n.asyncQueue.enqueueRetryable(async()=>{kt("RemoteStore","Retrying IndexedDB access"),await t(),n.L_.delete(1),await zA(n)})}function r8(n,e){return e().catch(t=>j1(n,t,e))}async function HA(n){const e=rn(n),t=Bu(e);let i=e.O_.length>0?e.O_[e.O_.length-1].batchId:-1;for(;Hhe(e);)try{const r=await The(e.localStore,i);if(r===null){e.O_.length===0&&t.o_();break}i=r.batchId,Ghe(e,r)}catch(r){await j1(e,r)}s8(e)&&o8(e)}function Hhe(n){return $d(n)&&n.O_.length<10}function Ghe(n,e){n.O_.push(e);const t=Bu(n);t.r_()&&t.V_&&t.m_(e.mutations)}function s8(n){return $d(n)&&!Bu(n).n_()&&n.O_.length>0}function o8(n){Bu(n).start()}async function jhe(n){Bu(n).p_()}async function Whe(n){const e=Bu(n);for(const t of n.O_)e.m_(t.mutations)}async function Khe(n,e,t){const i=n.O_.shift(),r=J2.from(i,e,t);await r8(n,()=>n.remoteSyncer.applySuccessfulWrite(r)),await HA(n)}async function Xhe(n,e){e&&Bu(n).V_&&await async function(i,r){if(function(o){return kue(o)&&o!==He.ABORTED}(r.code)){const s=i.O_.shift();Bu(i).s_(),await r8(i,()=>i.remoteSyncer.rejectFailedWrite(s.batchId,r)),await HA(i)}}(n,e),s8(n)&&o8(n)}async function I3(n,e){const t=rn(n);t.asyncQueue.verifyOperationInProgress(),kt("RemoteStore","RemoteStore received new credentials");const i=$d(t);t.L_.add(3),await gv(t),i&&t.q_.set("Unknown"),await t.remoteSyncer.handleCredentialChange(e),t.L_.delete(3),await zA(t)}async function qhe(n,e){const t=rn(n);e?(t.L_.delete(2),await zA(t)):e||(t.L_.add(2),await gv(t),t.q_.set("Unknown"))}function zm(n){return n.K_||(n.K_=function(t,i,r){const s=rn(t);return s.w_(),new Dhe(i,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,r)}(n.datastore,n.asyncQueue,{Eo:Fhe.bind(null,n),Ro:Uhe.bind(null,n),mo:Vhe.bind(null,n),d_:zhe.bind(null,n)}),n.B_.push(async e=>{e?(n.K_.s_(),oN(n)?sN(n):n.q_.set("Unknown")):(await n.K_.stop(),i8(n))})),n.K_}function Bu(n){return n.U_||(n.U_=function(t,i,r){const s=rn(t);return s.w_(),new Lhe(i,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,r)}(n.datastore,n.asyncQueue,{Eo:()=>Promise.resolve(),Ro:jhe.bind(null,n),mo:Xhe.bind(null,n),f_:Whe.bind(null,n),g_:Khe.bind(null,n)}),n.B_.push(async e=>{e?(n.U_.s_(),await HA(n)):(await n.U_.stop(),n.O_.length>0&&(kt("RemoteStore",`Stopping write stream with ${n.O_.length} pending writes`),n.O_=[]))})),n.U_}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class aN{constructor(e,t,i,r,s){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=i,this.op=r,this.removalCallback=s,this.deferred=new Xl,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(o=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,i,r,s){const o=Date.now()+i,a=new aN(e,t,o,r,s);return a.start(i),a}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new bt(He.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function lN(n,e){if(sc("AsyncQueue",`${e}: ${n}`),fv(n))return new bt(He.UNAVAILABLE,`${e}: ${n}`);throw n}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Rp{constructor(e){this.comparator=e?(t,i)=>e(t,i)||jt.comparator(t.key,i.key):(t,i)=>jt.comparator(t.key,i.key),this.keyedMap=ay(),this.sortedSet=new Zi(this.comparator)}static emptySet(e){return new Rp(e.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((t,i)=>(e(t),!1))}add(e){const t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){const t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof Rp)||this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),i=e.sortedSet.getIterator();for(;t.hasNext();){const r=t.getNext().key,s=i.getNext().key;if(!r.isEqual(s))return!1}return!0}toString(){const e=[];return this.forEach(t=>{e.push(t.toString())}),e.length===0?"DocumentSet ()":`DocumentSet (
  `+e.join(`  
`)+`
)`}copy(e,t){const i=new Rp;return i.comparator=this.comparator,i.keyedMap=e,i.sortedSet=t,i}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class R3{constructor(){this.W_=new Zi(jt.comparator)}track(e){const t=e.doc.key,i=this.W_.get(t);i?e.type!==0&&i.type===3?this.W_=this.W_.insert(t,e):e.type===3&&i.type!==1?this.W_=this.W_.insert(t,{type:i.type,doc:e.doc}):e.type===2&&i.type===2?this.W_=this.W_.insert(t,{type:2,doc:e.doc}):e.type===2&&i.type===0?this.W_=this.W_.insert(t,{type:0,doc:e.doc}):e.type===1&&i.type===0?this.W_=this.W_.remove(t):e.type===1&&i.type===2?this.W_=this.W_.insert(t,{type:1,doc:i.doc}):e.type===0&&i.type===1?this.W_=this.W_.insert(t,{type:2,doc:e.doc}):en():this.W_=this.W_.insert(t,e)}G_(){const e=[];return this.W_.inorderTraversal((t,i)=>{e.push(i)}),e}}class fm{constructor(e,t,i,r,s,o,a,l,c){this.query=e,this.docs=t,this.oldDocs=i,this.docChanges=r,this.mutatedKeys=s,this.fromCache=o,this.syncStateChanged=a,this.excludesMetadataChanges=l,this.hasCachedResults=c}static fromInitialDocuments(e,t,i,r,s){const o=[];return t.forEach(a=>{o.push({type:0,doc:a})}),new fm(e,t,Rp.emptySet(t),o,i,r,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&kA(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const t=this.docChanges,i=e.docChanges;if(t.length!==i.length)return!1;for(let r=0;r<t.length;r++)if(t[r].type!==i[r].type||!t[r].doc.isEqual(i[r].doc))return!1;return!0}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Yhe{constructor(){this.z_=void 0,this.j_=[]}H_(){return this.j_.some(e=>e.J_())}}class $he{constructor(){this.queries=P3(),this.onlineState="Unknown",this.Y_=new Set}terminate(){(function(t,i){const r=rn(t),s=r.queries;r.queries=P3(),s.forEach((o,a)=>{for(const l of a.j_)l.onError(i)})})(this,new bt(He.ABORTED,"Firestore shutting down"))}}function P3(){return new Vm(n=>bj(n),kA)}async function cN(n,e){const t=rn(n);let i=3;const r=e.query;let s=t.queries.get(r);s?!s.H_()&&e.J_()&&(i=2):(s=new Yhe,i=e.J_()?0:1);try{switch(i){case 0:s.z_=await t.onListen(r,!0);break;case 1:s.z_=await t.onListen(r,!1);break;case 2:await t.onFirstRemoteStoreListen(r)}}catch(o){const a=lN(o,`Initialization of query '${Kf(e.query)}' failed`);return void e.onError(a)}t.queries.set(r,s),s.j_.push(e),e.Z_(t.onlineState),s.z_&&e.X_(s.z_)&&hN(t)}async function uN(n,e){const t=rn(n),i=e.query;let r=3;const s=t.queries.get(i);if(s){const o=s.j_.indexOf(e);o>=0&&(s.j_.splice(o,1),s.j_.length===0?r=e.J_()?0:1:!s.H_()&&e.J_()&&(r=2))}switch(r){case 0:return t.queries.delete(i),t.onUnlisten(i,!0);case 1:return t.queries.delete(i),t.onUnlisten(i,!1);case 2:return t.onLastRemoteStoreUnlisten(i);default:return}}function Jhe(n,e){const t=rn(n);let i=!1;for(const r of e){const s=r.query,o=t.queries.get(s);if(o){for(const a of o.j_)a.X_(r)&&(i=!0);o.z_=r}}i&&hN(t)}function Qhe(n,e,t){const i=rn(n),r=i.queries.get(e);if(r)for(const s of r.j_)s.onError(t);i.queries.delete(e)}function hN(n){n.Y_.forEach(e=>{e.next()})}var ZI,N3;(N3=ZI||(ZI={})).ea="default",N3.Cache="cache";class dN{constructor(e,t,i){this.query=e,this.ta=t,this.na=!1,this.ra=null,this.onlineState="Unknown",this.options=i||{}}X_(e){if(!this.options.includeMetadataChanges){const i=[];for(const r of e.docChanges)r.type!==3&&i.push(r);e=new fm(e.query,e.docs,e.oldDocs,i,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.na?this.ia(e)&&(this.ta.next(e),t=!0):this.sa(e,this.onlineState)&&(this.oa(e),t=!0),this.ra=e,t}onError(e){this.ta.error(e)}Z_(e){this.onlineState=e;let t=!1;return this.ra&&!this.na&&this.sa(this.ra,e)&&(this.oa(this.ra),t=!0),t}sa(e,t){if(!e.fromCache||!this.J_())return!0;const i=t!=="Offline";return(!this.options._a||!i)&&(!e.docs.isEmpty()||e.hasCachedResults||t==="Offline")}ia(e){if(e.docChanges.length>0)return!0;const t=this.ra&&this.ra.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&this.options.includeMetadataChanges===!0}oa(e){e=fm.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.na=!0,this.ta.next(e)}J_(){return this.options.source!==ZI.Cache}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class a8{constructor(e){this.key=e}}class l8{constructor(e){this.key=e}}class Zhe{constructor(e,t){this.query=e,this.Ta=t,this.Ea=null,this.hasCachedResults=!1,this.current=!1,this.da=Tn(),this.mutatedKeys=Tn(),this.Aa=Cj(e),this.Ra=new Rp(this.Aa)}get Va(){return this.Ta}ma(e,t){const i=t?t.fa:new R3,r=t?t.Ra:this.Ra;let s=t?t.mutatedKeys:this.mutatedKeys,o=r,a=!1;const l=this.query.limitType==="F"&&r.size===this.query.limit?r.last():null,c=this.query.limitType==="L"&&r.size===this.query.limit?r.first():null;if(e.inorderTraversal((u,h)=>{const f=r.get(u),m=BA(this.query,h)?h:null,y=!!f&&this.mutatedKeys.has(f.key),_=!!m&&(m.hasLocalMutations||this.mutatedKeys.has(m.key)&&m.hasCommittedMutations);let v=!1;f&&m?f.data.isEqual(m.data)?y!==_&&(i.track({type:3,doc:m}),v=!0):this.ga(f,m)||(i.track({type:2,doc:m}),v=!0,(l&&this.Aa(m,l)>0||c&&this.Aa(m,c)<0)&&(a=!0)):!f&&m?(i.track({type:0,doc:m}),v=!0):f&&!m&&(i.track({type:1,doc:f}),v=!0,(l||c)&&(a=!0)),v&&(m?(o=o.add(m),s=_?s.add(u):s.delete(u)):(o=o.delete(u),s=s.delete(u)))}),this.query.limit!==null)for(;o.size>this.query.limit;){const u=this.query.limitType==="F"?o.last():o.first();o=o.delete(u.key),s=s.delete(u.key),i.track({type:1,doc:u})}return{Ra:o,fa:i,ns:a,mutatedKeys:s}}ga(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,i,r){const s=this.Ra;this.Ra=e.Ra,this.mutatedKeys=e.mutatedKeys;const o=e.fa.G_();o.sort((u,h)=>function(m,y){const _=v=>{switch(v){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return en()}};return _(m)-_(y)}(u.type,h.type)||this.Aa(u.doc,h.doc)),this.pa(i),r=r!=null&&r;const a=t&&!r?this.ya():[],l=this.da.size===0&&this.current&&!r?1:0,c=l!==this.Ea;return this.Ea=l,o.length!==0||c?{snapshot:new fm(this.query,e.Ra,s,o,e.mutatedKeys,l===0,c,!1,!!i&&i.resumeToken.approximateByteSize()>0),wa:a}:{wa:a}}Z_(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({Ra:this.Ra,fa:new R3,mutatedKeys:this.mutatedKeys,ns:!1},!1)):{wa:[]}}Sa(e){return!this.Ta.has(e)&&!!this.Ra.has(e)&&!this.Ra.get(e).hasLocalMutations}pa(e){e&&(e.addedDocuments.forEach(t=>this.Ta=this.Ta.add(t)),e.modifiedDocuments.forEach(t=>{}),e.removedDocuments.forEach(t=>this.Ta=this.Ta.delete(t)),this.current=e.current)}ya(){if(!this.current)return[];const e=this.da;this.da=Tn(),this.Ra.forEach(i=>{this.Sa(i.key)&&(this.da=this.da.add(i.key))});const t=[];return e.forEach(i=>{this.da.has(i)||t.push(new l8(i))}),this.da.forEach(i=>{e.has(i)||t.push(new a8(i))}),t}ba(e){this.Ta=e.Ts,this.da=Tn();const t=this.ma(e.documents);return this.applyChanges(t,!0)}Da(){return fm.fromInitialDocuments(this.query,this.Ra,this.mutatedKeys,this.Ea===0,this.hasCachedResults)}}class ede{constructor(e,t,i){this.query=e,this.targetId=t,this.view=i}}class tde{constructor(e){this.key=e,this.va=!1}}class nde{constructor(e,t,i,r,s,o){this.localStore=e,this.remoteStore=t,this.eventManager=i,this.sharedClientState=r,this.currentUser=s,this.maxConcurrentLimboResolutions=o,this.Ca={},this.Fa=new Vm(a=>bj(a),kA),this.Ma=new Map,this.xa=new Set,this.Oa=new Zi(jt.comparator),this.Na=new Map,this.La=new eN,this.Ba={},this.ka=new Map,this.qa=dm.kn(),this.onlineState="Unknown",this.Qa=void 0}get isPrimaryClient(){return this.Qa===!0}}async function ide(n,e,t=!0){const i=p8(n);let r;const s=i.Fa.get(e);return s?(i.sharedClientState.addLocalQueryTarget(s.targetId),r=s.view.Da()):r=await c8(i,e,t,!0),r}async function rde(n,e){const t=p8(n);await c8(t,e,!0,!1)}async function c8(n,e,t,i){const r=await bhe(n.localStore,Ya(e)),s=r.targetId,o=n.sharedClientState.addLocalQueryTarget(s,t);let a;return i&&(a=await sde(n,e,s,o==="current",r.resumeToken)),n.isPrimaryClient&&t&&t8(n.remoteStore,r),a}async function sde(n,e,t,i,r){n.Ka=(h,f,m)=>async function(_,v,g,w){let A=v.view.ma(g);A.ns&&(A=await b3(_.localStore,v.query,!1).then(({documents:R})=>v.view.ma(R,A)));const T=w&&w.targetChanges.get(v.targetId),L=w&&w.targetMismatches.get(v.targetId)!=null,D=v.view.applyChanges(A,_.isPrimaryClient,T,L);return L3(_,v.targetId,D.wa),D.snapshot}(n,h,f,m);const s=await b3(n.localStore,e,!0),o=new Zhe(e,s.Ts),a=o.ma(s.documents),l=mv.createSynthesizedTargetChangeForCurrentChange(t,i&&n.onlineState!=="Offline",r),c=o.applyChanges(a,n.isPrimaryClient,l);L3(n,t,c.wa);const u=new ede(e,t,o);return n.Fa.set(e,u),n.Ma.has(t)?n.Ma.get(t).push(e):n.Ma.set(t,[e]),c.snapshot}async function ode(n,e,t){const i=rn(n),r=i.Fa.get(e),s=i.Ma.get(r.targetId);if(s.length>1)return i.Ma.set(r.targetId,s.filter(o=>!kA(o,e))),void i.Fa.delete(e);i.isPrimaryClient?(i.sharedClientState.removeLocalQueryTarget(r.targetId),i.sharedClientState.isActiveQueryTarget(r.targetId)||await QI(i.localStore,r.targetId,!1).then(()=>{i.sharedClientState.clearQueryState(r.targetId),t&&iN(i.remoteStore,r.targetId),eR(i,r.targetId)}).catch(dv)):(eR(i,r.targetId),await QI(i.localStore,r.targetId,!0))}async function ade(n,e){const t=rn(n),i=t.Fa.get(e),r=t.Ma.get(i.targetId);t.isPrimaryClient&&r.length===1&&(t.sharedClientState.removeLocalQueryTarget(i.targetId),iN(t.remoteStore,i.targetId))}async function lde(n,e,t){const i=mde(n);try{const r=await function(o,a){const l=rn(o),c=sr.now(),u=a.reduce((m,y)=>m.add(y.key),Tn());let h,f;return l.persistence.runTransaction("Locally write mutations","readwrite",m=>{let y=oc(),_=Tn();return l.cs.getEntries(m,u).next(v=>{y=v,y.forEach((g,w)=>{w.isValidDocument()||(_=_.add(g))})}).next(()=>l.localDocuments.getOverlayedDocuments(m,y)).next(v=>{h=v;const g=[];for(const w of a){const A=Rue(w,h.get(w.key).overlayedDocument);A!=null&&g.push(new qu(w.key,A,vj(A.value.mapValue),ma.exists(!0)))}return l.mutationQueue.addMutationBatch(m,c,g,a)}).next(v=>{f=v;const g=v.applyToLocalDocumentSet(h,_);return l.documentOverlayCache.saveOverlays(m,v.batchId,g)})}).then(()=>({batchId:f.batchId,changes:Ij(h)}))}(i.localStore,e);i.sharedClientState.addPendingMutation(r.batchId),function(o,a,l){let c=o.Ba[o.currentUser.toKey()];c||(c=new Zi(Hn)),c=c.insert(a,l),o.Ba[o.currentUser.toKey()]=c}(i,r.batchId,t),await yv(i,r.changes),await HA(i.remoteStore)}catch(r){const s=lN(r,"Failed to persist write");t.reject(s)}}async function u8(n,e){const t=rn(n);try{const i=await Ahe(t.localStore,e);e.targetChanges.forEach((r,s)=>{const o=t.Na.get(s);o&&(Qn(r.addedDocuments.size+r.modifiedDocuments.size+r.removedDocuments.size<=1),r.addedDocuments.size>0?o.va=!0:r.modifiedDocuments.size>0?Qn(o.va):r.removedDocuments.size>0&&(Qn(o.va),o.va=!1))}),await yv(t,i,e)}catch(i){await dv(i)}}function D3(n,e,t){const i=rn(n);if(i.isPrimaryClient&&t===0||!i.isPrimaryClient&&t===1){const r=[];i.Fa.forEach((s,o)=>{const a=o.view.Z_(e);a.snapshot&&r.push(a.snapshot)}),function(o,a){const l=rn(o);l.onlineState=a;let c=!1;l.queries.forEach((u,h)=>{for(const f of h.j_)f.Z_(a)&&(c=!0)}),c&&hN(l)}(i.eventManager,e),r.length&&i.Ca.d_(r),i.onlineState=e,i.isPrimaryClient&&i.sharedClientState.setOnlineState(e)}}async function cde(n,e,t){const i=rn(n);i.sharedClientState.updateQueryState(e,"rejected",t);const r=i.Na.get(e),s=r&&r.key;if(s){let o=new Zi(jt.comparator);o=o.insert(s,Jr.newNoDocument(s,nn.min()));const a=Tn().add(s),l=new UA(nn.min(),new Map,new Zi(Hn),o,a);await u8(i,l),i.Oa=i.Oa.remove(s),i.Na.delete(e),fN(i)}else await QI(i.localStore,e,!1).then(()=>eR(i,e,t)).catch(dv)}async function ude(n,e){const t=rn(n),i=e.batch.batchId;try{const r=await Ehe(t.localStore,e);d8(t,i,null),h8(t,i),t.sharedClientState.updateMutationState(i,"acknowledged"),await yv(t,r)}catch(r){await dv(r)}}async function hde(n,e,t){const i=rn(n);try{const r=await function(o,a){const l=rn(o);return l.persistence.runTransaction("Reject batch","readwrite-primary",c=>{let u;return l.mutationQueue.lookupMutationBatch(c,a).next(h=>(Qn(h!==null),u=h.keys(),l.mutationQueue.removeMutationBatch(c,h))).next(()=>l.mutationQueue.performConsistencyCheck(c)).next(()=>l.documentOverlayCache.removeOverlaysForBatchId(c,u,a)).next(()=>l.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(c,u)).next(()=>l.localDocuments.getDocuments(c,u))})}(i.localStore,e);d8(i,e,t),h8(i,e),i.sharedClientState.updateMutationState(e,"rejected",t),await yv(i,r)}catch(r){await dv(r)}}function h8(n,e){(n.ka.get(e)||[]).forEach(t=>{t.resolve()}),n.ka.delete(e)}function d8(n,e,t){const i=rn(n);let r=i.Ba[i.currentUser.toKey()];if(r){const s=r.get(e);s&&(t?s.reject(t):s.resolve(),r=r.remove(e)),i.Ba[i.currentUser.toKey()]=r}}function eR(n,e,t=null){n.sharedClientState.removeLocalQueryTarget(e);for(const i of n.Ma.get(e))n.Fa.delete(i),t&&n.Ca.$a(i,t);n.Ma.delete(e),n.isPrimaryClient&&n.La.gr(e).forEach(i=>{n.La.containsKey(i)||f8(n,i)})}function f8(n,e){n.xa.delete(e.path.canonicalString());const t=n.Oa.get(e);t!==null&&(iN(n.remoteStore,t),n.Oa=n.Oa.remove(e),n.Na.delete(t),fN(n))}function L3(n,e,t){for(const i of t)i instanceof a8?(n.La.addReference(i.key,e),dde(n,i)):i instanceof l8?(kt("SyncEngine","Document no longer in limbo: "+i.key),n.La.removeReference(i.key,e),n.La.containsKey(i.key)||f8(n,i.key)):en()}function dde(n,e){const t=e.key,i=t.path.canonicalString();n.Oa.get(t)||n.xa.has(i)||(kt("SyncEngine","New document in limbo: "+t),n.xa.add(i),fN(n))}function fN(n){for(;n.xa.size>0&&n.Oa.size<n.maxConcurrentLimboResolutions;){const e=n.xa.values().next().value;n.xa.delete(e);const t=new jt(ui.fromString(e)),i=n.qa.next();n.Na.set(i,new tde(t)),n.Oa=n.Oa.insert(t,i),t8(n.remoteStore,new lu(Ya(LA(t.path)),i,"TargetPurposeLimboResolution",j2.oe))}}async function yv(n,e,t){const i=rn(n),r=[],s=[],o=[];i.Fa.isEmpty()||(i.Fa.forEach((a,l)=>{o.push(i.Ka(l,e,t).then(c=>{var u;if((c||t)&&i.isPrimaryClient){const h=c?!c.fromCache:(u=t==null?void 0:t.targetChanges.get(l.targetId))===null||u===void 0?void 0:u.current;i.sharedClientState.updateQueryState(l.targetId,h?"current":"not-current")}if(c){r.push(c);const h=nN.Wi(l.targetId,c);s.push(h)}}))}),await Promise.all(o),i.Ca.d_(r),await async function(l,c){const u=rn(l);try{await u.persistence.runTransaction("notifyLocalViewChanges","readwrite",h=>qe.forEach(c,f=>qe.forEach(f.$i,m=>u.persistence.referenceDelegate.addReference(h,f.targetId,m)).next(()=>qe.forEach(f.Ui,m=>u.persistence.referenceDelegate.removeReference(h,f.targetId,m)))))}catch(h){if(!fv(h))throw h;kt("LocalStore","Failed to update sequence numbers: "+h)}for(const h of c){const f=h.targetId;if(!h.fromCache){const m=u.os.get(f),y=m.snapshotVersion,_=m.withLastLimboFreeSnapshotVersion(y);u.os=u.os.insert(f,_)}}}(i.localStore,s))}async function fde(n,e){const t=rn(n);if(!t.currentUser.isEqual(e)){kt("SyncEngine","User change. New user:",e.toKey());const i=await Jj(t.localStore,e);t.currentUser=e,function(s,o){s.ka.forEach(a=>{a.forEach(l=>{l.reject(new bt(He.CANCELLED,o))})}),s.ka.clear()}(t,"'waitForPendingWrites' promise is rejected due to a user change."),t.sharedClientState.handleUserChange(e,i.removedBatchIds,i.addedBatchIds),await yv(t,i.hs)}}function pde(n,e){const t=rn(n),i=t.Na.get(e);if(i&&i.va)return Tn().add(i.key);{let r=Tn();const s=t.Ma.get(e);if(!s)return r;for(const o of s){const a=t.Fa.get(o);r=r.unionWith(a.view.Va)}return r}}function p8(n){const e=rn(n);return e.remoteStore.remoteSyncer.applyRemoteEvent=u8.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=pde.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=cde.bind(null,e),e.Ca.d_=Jhe.bind(null,e.eventManager),e.Ca.$a=Qhe.bind(null,e.eventManager),e}function mde(n){const e=rn(n);return e.remoteStore.remoteSyncer.applySuccessfulWrite=ude.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=hde.bind(null,e),e}class W1{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=VA(e.databaseInfo.databaseId),this.sharedClientState=this.Wa(e),this.persistence=this.Ga(e),await this.persistence.start(),this.localStore=this.za(e),this.gcScheduler=this.ja(e,this.localStore),this.indexBackfillerScheduler=this.Ha(e,this.localStore)}ja(e,t){return null}Ha(e,t){return null}za(e){return whe(this.persistence,new _he,e.initialUser,this.serializer)}Ga(e){return new ghe(tN.Zr,this.serializer)}Wa(e){return new Mhe}async terminate(){var e,t;(e=this.gcScheduler)===null||e===void 0||e.stop(),(t=this.indexBackfillerScheduler)===null||t===void 0||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}W1.provider={build:()=>new W1};class tR{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=i=>D3(this.syncEngine,i,1),this.remoteStore.remoteSyncer.handleCredentialChange=fde.bind(null,this.syncEngine),await qhe(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new $he}()}createDatastore(e){const t=VA(e.databaseInfo.databaseId),i=function(s){return new Nhe(s)}(e.databaseInfo);return function(s,o,a,l){return new khe(s,o,a,l)}(e.authCredentials,e.appCheckCredentials,i,t)}createRemoteStore(e){return function(i,r,s,o,a){return new Ohe(i,r,s,o,a)}(this.localStore,this.datastore,e.asyncQueue,t=>D3(this.syncEngine,t,0),function(){return M3.D()?new M3:new Ihe}())}createSyncEngine(e,t){return function(r,s,o,a,l,c,u){const h=new nde(r,s,o,a,l,c);return u&&(h.Qa=!0),h}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await async function(r){const s=rn(r);kt("RemoteStore","RemoteStore shutting down."),s.L_.add(5),await gv(s),s.k_.shutdown(),s.q_.set("Unknown")}(this.remoteStore),(e=this.datastore)===null||e===void 0||e.terminate(),(t=this.eventManager)===null||t===void 0||t.terminate()}}tR.provider={build:()=>new tR};/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *//**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class pN{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Ya(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Ya(this.observer.error,e):sc("Uncaught Error in snapshot listener:",e.toString()))}Za(){this.muted=!0}Ya(e,t){setTimeout(()=>{this.muted||e(t)},0)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class gde{constructor(e,t,i,r,s){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=i,this.databaseInfo=r,this.user=Yr.UNAUTHENTICATED,this.clientId=mj.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=s,this.authCredentials.start(i,async o=>{kt("FirestoreClient","Received user=",o.uid),await this.authCredentialListener(o),this.user=o}),this.appCheckCredentials.start(i,o=>(kt("FirestoreClient","Received new app check token=",o),this.appCheckCredentialListener(o,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Xl;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){const i=lN(t,"Failed to shutdown persistence");e.reject(i)}}),e.promise}}async function Fb(n,e){n.asyncQueue.verifyOperationInProgress(),kt("FirestoreClient","Initializing OfflineComponentProvider");const t=n.configuration;await e.initialize(t);let i=t.initialUser;n.setCredentialChangeListener(async r=>{i.isEqual(r)||(await Jj(e.localStore,r),i=r)}),e.persistence.setDatabaseDeletedListener(()=>n.terminate()),n._offlineComponents=e}async function k3(n,e){n.asyncQueue.verifyOperationInProgress();const t=await yde(n);kt("FirestoreClient","Initializing OnlineComponentProvider"),await e.initialize(t,n.configuration),n.setCredentialChangeListener(i=>I3(e.remoteStore,i)),n.setAppCheckTokenChangeListener((i,r)=>I3(e.remoteStore,r)),n._onlineComponents=e}async function yde(n){if(!n._offlineComponents)if(n._uninitializedComponentsProvider){kt("FirestoreClient","Using user provided OfflineComponentProvider");try{await Fb(n,n._uninitializedComponentsProvider._offline)}catch(e){const t=e;if(!function(r){return r.name==="FirebaseError"?r.code===He.FAILED_PRECONDITION||r.code===He.UNIMPLEMENTED:!(typeof DOMException<"u"&&r instanceof DOMException)||r.code===22||r.code===20||r.code===11}(t))throw t;lm("Error using user provided cache. Falling back to memory cache: "+t),await Fb(n,new W1)}}else kt("FirestoreClient","Using default OfflineComponentProvider"),await Fb(n,new W1);return n._offlineComponents}async function m8(n){return n._onlineComponents||(n._uninitializedComponentsProvider?(kt("FirestoreClient","Using user provided OnlineComponentProvider"),await k3(n,n._uninitializedComponentsProvider._online)):(kt("FirestoreClient","Using default OnlineComponentProvider"),await k3(n,new tR))),n._onlineComponents}function vde(n){return m8(n).then(e=>e.syncEngine)}async function K1(n){const e=await m8(n),t=e.eventManager;return t.onListen=ide.bind(null,e.syncEngine),t.onUnlisten=ode.bind(null,e.syncEngine),t.onFirstRemoteStoreListen=rde.bind(null,e.syncEngine),t.onLastRemoteStoreUnlisten=ade.bind(null,e.syncEngine),t}function _de(n,e,t={}){const i=new Xl;return n.asyncQueue.enqueueAndForget(async()=>function(s,o,a,l,c){const u=new pN({next:f=>{u.Za(),o.enqueueAndForget(()=>uN(s,h));const m=f.docs.has(a);!m&&f.fromCache?c.reject(new bt(He.UNAVAILABLE,"Failed to get document because the client is offline.")):m&&f.fromCache&&l&&l.source==="server"?c.reject(new bt(He.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):c.resolve(f)},error:f=>c.reject(f)}),h=new dN(LA(a.path),u,{includeMetadataChanges:!0,_a:!0});return cN(s,h)}(await K1(n),n.asyncQueue,e,t,i)),i.promise}function xde(n,e,t={}){const i=new Xl;return n.asyncQueue.enqueueAndForget(async()=>function(s,o,a,l,c){const u=new pN({next:f=>{u.Za(),o.enqueueAndForget(()=>uN(s,h)),f.fromCache&&l.source==="server"?c.reject(new bt(He.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):c.resolve(f)},error:f=>c.reject(f)}),h=new dN(a,u,{includeMetadataChanges:!0,_a:!0});return cN(s,h)}(await K1(n),n.asyncQueue,e,t,i)),i.promise}/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function g8(n){const e={};return n.timeoutSeconds!==void 0&&(e.timeoutSeconds=n.timeoutSeconds),e}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const B3=new Map;/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function y8(n,e,t){if(!t)throw new bt(He.INVALID_ARGUMENT,`Function ${n}() cannot be called with an empty ${e}.`)}function wde(n,e,t,i){if(e===!0&&i===!0)throw new bt(He.INVALID_ARGUMENT,`${n} and ${t} cannot be used together.`)}function O3(n){if(!jt.isDocumentKey(n))throw new bt(He.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${n} has ${n.length}.`)}function F3(n){if(jt.isDocumentKey(n))throw new bt(He.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${n} has ${n.length}.`)}function GA(n){if(n===void 0)return"undefined";if(n===null)return"null";if(typeof n=="string")return n.length>20&&(n=`${n.substring(0,20)}...`),JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean")return""+n;if(typeof n=="object"){if(n instanceof Array)return"an array";{const e=function(i){return i.constructor?i.constructor.name:null}(n);return e?`a custom ${e} object`:"an object"}}return typeof n=="function"?"a function":en()}function uo(n,e){if("_delegate"in n&&(n=n._delegate),!(n instanceof e)){if(e.name===n.constructor.name)throw new bt(He.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const t=GA(n);throw new bt(He.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${t}`)}}return n}function Ede(n,e){if(e<=0)throw new bt(He.INVALID_ARGUMENT,`Function ${n}() requires a positive number, but it was: ${e}.`)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class U3{constructor(e){var t,i;if(e.host===void 0){if(e.ssl!==void 0)throw new bt(He.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=e.host,this.ssl=(t=e.ssl)===null||t===void 0||t;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=41943040;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<1048576)throw new bt(He.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}wde("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=g8((i=e.experimentalLongPollingOptions)!==null&&i!==void 0?i:{}),function(s){if(s.timeoutSeconds!==void 0){if(isNaN(s.timeoutSeconds))throw new bt(He.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (must not be NaN)`);if(s.timeoutSeconds<5)throw new bt(He.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (minimum allowed value is 5)`);if(s.timeoutSeconds>30)throw new bt(He.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(i,r){return i.timeoutSeconds===r.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class jA{constructor(e,t,i,r){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=i,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new U3({}),this._settingsFrozen=!1,this._terminateTask="notTerminated"}get app(){if(!this._app)throw new bt(He.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new bt(He.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new U3(e),e.credentials!==void 0&&(this._authCredentials=function(i){if(!i)return new Vce;switch(i.type){case"firstParty":return new jce(i.sessionIndex||"0",i.iamToken||null,i.authTokenFactory||null);case"provider":return i.client;default:throw new bt(He.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const i=B3.get(t);i&&(kt("ComponentProvider","Removing Datastore"),B3.delete(t),i.terminate())}(this),Promise.resolve()}}function Ade(n,e,t,i={}){var r;const s=(n=uo(n,jA))._getSettings(),o=`${e}:${t}`;if(s.host!=="firestore.googleapis.com"&&s.host!==o&&lm("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),n._setSettings(Object.assign(Object.assign({},s),{host:o,ssl:!1})),i.mockUserToken){let a,l;if(typeof i.mockUserToken=="string")a=i.mockUserToken,l=Yr.MOCK_USER;else{a=Z6(i.mockUserToken,(r=n._app)===null||r===void 0?void 0:r.options.projectId);const c=i.mockUserToken.sub||i.mockUserToken.user_id;if(!c)throw new bt(He.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");l=new Yr(c)}n._authCredentials=new zce(new pj(a,l))}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class mc{constructor(e,t,i){this.converter=t,this._query=i,this.type="query",this.firestore=e}withConverter(e){return new mc(this.firestore,e,this._query)}}class ts{constructor(e,t,i){this.converter=t,this._key=i,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Eu(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new ts(this.firestore,e,this._key)}}class Eu extends mc{constructor(e,t,i){super(e,t,LA(i)),this._path=i,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new ts(this.firestore,null,new jt(e))}withConverter(e){return new Eu(this.firestore,e,this._path)}}function gc(n,e,...t){if(n=zi(n),y8("collection","path",e),n instanceof jA){const i=ui.fromString(e,...t);return F3(i),new Eu(n,null,i)}{if(!(n instanceof ts||n instanceof Eu))throw new bt(He.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const i=n._path.child(ui.fromString(e,...t));return F3(i),new Eu(n.firestore,null,i)}}function Yu(n,e,...t){if(n=zi(n),arguments.length===1&&(e=mj.newId()),y8("doc","path",e),n instanceof jA){const i=ui.fromString(e,...t);return O3(i),new ts(n,null,new jt(i))}{if(!(n instanceof ts||n instanceof Eu))throw new bt(He.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const i=n._path.child(ui.fromString(e,...t));return O3(i),new ts(n.firestore,n instanceof Eu?n.converter:null,new jt(i))}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class V3{constructor(e=Promise.resolve()){this.Pu=[],this.Iu=!1,this.Tu=[],this.Eu=null,this.du=!1,this.Au=!1,this.Ru=[],this.t_=new Zj(this,"async_queue_retry"),this.Vu=()=>{const i=Ob();i&&kt("AsyncQueue","Visibility state changed to "+i.visibilityState),this.t_.jo()},this.mu=e;const t=Ob();t&&typeof t.addEventListener=="function"&&t.addEventListener("visibilitychange",this.Vu)}get isShuttingDown(){return this.Iu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.fu(),this.gu(e)}enterRestrictedMode(e){if(!this.Iu){this.Iu=!0,this.Au=e||!1;const t=Ob();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this.Vu)}}enqueue(e){if(this.fu(),this.Iu)return new Promise(()=>{});const t=new Xl;return this.gu(()=>this.Iu&&this.Au?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Pu.push(e),this.pu()))}async pu(){if(this.Pu.length!==0){try{await this.Pu[0](),this.Pu.shift(),this.t_.reset()}catch(e){if(!fv(e))throw e;kt("AsyncQueue","Operation failed with retryable error: "+e)}this.Pu.length>0&&this.t_.Go(()=>this.pu())}}gu(e){const t=this.mu.then(()=>(this.du=!0,e().catch(i=>{this.Eu=i,this.du=!1;const r=function(o){let a=o.message||"";return o.stack&&(a=o.stack.includes(o.message)?o.stack:o.message+`
`+o.stack),a}(i);throw sc("INTERNAL UNHANDLED ERROR: ",r),i}).then(i=>(this.du=!1,i))));return this.mu=t,t}enqueueAfterDelay(e,t,i){this.fu(),this.Ru.indexOf(e)>-1&&(t=0);const r=aN.createAndSchedule(this,e,t,i,s=>this.yu(s));return this.Tu.push(r),r}fu(){this.Eu&&en()}verifyOperationInProgress(){}async wu(){let e;do e=this.mu,await e;while(e!==this.mu)}Su(e){for(const t of this.Tu)if(t.timerId===e)return!0;return!1}bu(e){return this.wu().then(()=>{this.Tu.sort((t,i)=>t.targetTimeMs-i.targetTimeMs);for(const t of this.Tu)if(t.skipDelay(),e!=="all"&&t.timerId===e)break;return this.wu()})}Du(e){this.Ru.push(e)}yu(e){const t=this.Tu.indexOf(e);this.Tu.splice(t,1)}}function z3(n){return function(t,i){if(typeof t!="object"||t===null)return!1;const r=t;for(const s of i)if(s in r&&typeof r[s]=="function")return!0;return!1}(n,["next","error","complete"])}class Ou extends jA{constructor(e,t,i,r){super(e,t,i,r),this.type="firestore",this._queue=new V3,this._persistenceKey=(r==null?void 0:r.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new V3(e),this._firestoreClient=void 0,await e}}}function Sde(n,e){const t=typeof n=="object"?n:H2(),i=typeof n=="string"?n:"(default)",r=NA(t,"firestore").getImmediate({identifier:i});if(!r._initialized){const s=$6("firestore");s&&Ade(r,...s)}return r}function WA(n){if(n._terminated)throw new bt(He.FAILED_PRECONDITION,"The client has already been terminated.");return n._firestoreClient||Tde(n),n._firestoreClient}function Tde(n){var e,t,i;const r=n._freezeSettings(),s=function(a,l,c,u){return new iue(a,l,c,u.host,u.ssl,u.experimentalForceLongPolling,u.experimentalAutoDetectLongPolling,g8(u.experimentalLongPollingOptions),u.useFetchStreams)}(n._databaseId,((e=n._app)===null||e===void 0?void 0:e.options.appId)||"",n._persistenceKey,r);n._componentsProvider||!((t=r.localCache)===null||t===void 0)&&t._offlineComponentProvider&&(!((i=r.localCache)===null||i===void 0)&&i._onlineComponentProvider)&&(n._componentsProvider={_offline:r.localCache._offlineComponentProvider,_online:r.localCache._onlineComponentProvider}),n._firestoreClient=new gde(n._authCredentials,n._appCheckCredentials,n._queue,s,n._componentsProvider&&function(a){const l=a==null?void 0:a._online.build();return{_offline:a==null?void 0:a._offline.build(l),_online:l}}(n._componentsProvider))}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class pm{constructor(e){this._byteString=e}static fromBase64String(e){try{return new pm(Dr.fromBase64String(e))}catch(t){throw new bt(He.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(e){return new pm(Dr.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class KA{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new bt(He.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new br(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class vv{constructor(e){this._methodName=e}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class mN{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new bt(He.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new bt(He.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return Hn(this._lat,e._lat)||Hn(this._long,e._long)}}/**
 * @license
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class gN{constructor(e){this._values=(e||[]).map(t=>t)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(i,r){if(i.length!==r.length)return!1;for(let s=0;s<i.length;++s)if(i[s]!==r[s])return!1;return!0}(this._values,e._values)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const bde=/^__.*__$/;class Cde{constructor(e,t,i){this.data=e,this.fieldMask=t,this.fieldTransforms=i}toMutation(e,t){return this.fieldMask!==null?new qu(e,this.data,this.fieldMask,t,this.fieldTransforms):new pv(e,this.data,t,this.fieldTransforms)}}class v8{constructor(e,t,i){this.data=e,this.fieldMask=t,this.fieldTransforms=i}toMutation(e,t){return new qu(e,this.data,this.fieldMask,t,this.fieldTransforms)}}function _8(n){switch(n){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw en()}}class yN{constructor(e,t,i,r,s,o){this.settings=e,this.databaseId=t,this.serializer=i,this.ignoreUndefinedProperties=r,s===void 0&&this.vu(),this.fieldTransforms=s||[],this.fieldMask=o||[]}get path(){return this.settings.path}get Cu(){return this.settings.Cu}Fu(e){return new yN(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Mu(e){var t;const i=(t=this.path)===null||t===void 0?void 0:t.child(e),r=this.Fu({path:i,xu:!1});return r.Ou(e),r}Nu(e){var t;const i=(t=this.path)===null||t===void 0?void 0:t.child(e),r=this.Fu({path:i,xu:!1});return r.vu(),r}Lu(e){return this.Fu({path:void 0,xu:!0})}Bu(e){return X1(e,this.settings.methodName,this.settings.ku||!1,this.path,this.settings.qu)}contains(e){return this.fieldMask.find(t=>e.isPrefixOf(t))!==void 0||this.fieldTransforms.find(t=>e.isPrefixOf(t.field))!==void 0}vu(){if(this.path)for(let e=0;e<this.path.length;e++)this.Ou(this.path.get(e))}Ou(e){if(e.length===0)throw this.Bu("Document fields must not be empty");if(_8(this.Cu)&&bde.test(e))throw this.Bu('Document fields cannot begin and end with "__"')}}class Mde{constructor(e,t,i){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=i||VA(e)}Qu(e,t,i,r=!1){return new yN({Cu:e,methodName:t,qu:i,path:br.emptyPath(),xu:!1,ku:r},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function XA(n){const e=n._freezeSettings(),t=VA(n._databaseId);return new Mde(n._databaseId,!!e.ignoreUndefinedProperties,t)}function x8(n,e,t,i,r,s={}){const o=n.Qu(s.merge||s.mergeFields?2:0,e,t,r);xN("Data must be an object, but it was:",o,i);const a=w8(i,o);let l,c;if(s.merge)l=new ao(o.fieldMask),c=o.fieldTransforms;else if(s.mergeFields){const u=[];for(const h of s.mergeFields){const f=nR(e,h,t);if(!o.contains(f))throw new bt(He.INVALID_ARGUMENT,`Field '${f}' is specified in your field mask but missing from your input data.`);A8(u,f)||u.push(f)}l=new ao(u),c=o.fieldTransforms.filter(h=>l.covers(h.field))}else l=null,c=o.fieldTransforms;return new Cde(new Ls(a),l,c)}class qA extends vv{_toFieldTransform(e){if(e.Cu!==2)throw e.Cu===1?e.Bu(`${this._methodName}() can only appear at the top level of your update data`):e.Bu(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof qA}}class vN extends vv{_toFieldTransform(e){return new Oj(e.path,new M0)}isEqual(e){return e instanceof vN}}class _N extends vv{constructor(e,t){super(e),this.$u=t}_toFieldTransform(e){const t=new P0(e.serializer,Nj(e.serializer,this.$u));return new Oj(e.path,t)}isEqual(e){return e instanceof _N&&this.$u===e.$u}}function Ide(n,e,t,i){const r=n.Qu(1,e,t);xN("Data must be an object, but it was:",r,i);const s=[],o=Ls.empty();Yd(i,(l,c)=>{const u=wN(e,l,t);c=zi(c);const h=r.Nu(u);if(c instanceof qA)s.push(u);else{const f=_v(c,h);f!=null&&(s.push(u),o.set(u,f))}});const a=new ao(s);return new v8(o,a,r.fieldTransforms)}function Rde(n,e,t,i,r,s){const o=n.Qu(1,e,t),a=[nR(e,i,t)],l=[r];if(s.length%2!=0)throw new bt(He.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let f=0;f<s.length;f+=2)a.push(nR(e,s[f])),l.push(s[f+1]);const c=[],u=Ls.empty();for(let f=a.length-1;f>=0;--f)if(!A8(c,a[f])){const m=a[f];let y=l[f];y=zi(y);const _=o.Nu(m);if(y instanceof qA)c.push(m);else{const v=_v(y,_);v!=null&&(c.push(m),u.set(m,v))}}const h=new ao(c);return new v8(u,h,o.fieldTransforms)}function Pde(n,e,t,i=!1){return _v(t,n.Qu(i?4:3,e))}function _v(n,e){if(E8(n=zi(n)))return xN("Unsupported field value:",e,n),w8(n,e);if(n instanceof vv)return function(i,r){if(!_8(r.Cu))throw r.Bu(`${i._methodName}() can only be used with update() and set()`);if(!r.path)throw r.Bu(`${i._methodName}() is not currently supported inside arrays`);const s=i._toFieldTransform(r);s&&r.fieldTransforms.push(s)}(n,e),null;if(n===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),n instanceof Array){if(e.settings.xu&&e.Cu!==4)throw e.Bu("Nested arrays are not supported");return function(i,r){const s=[];let o=0;for(const a of i){let l=_v(a,r.Lu(o));l==null&&(l={nullValue:"NULL_VALUE"}),s.push(l),o++}return{arrayValue:{values:s}}}(n,e)}return function(i,r){if((i=zi(i))===null)return{nullValue:"NULL_VALUE"};if(typeof i=="number")return Nj(r.serializer,i);if(typeof i=="boolean")return{booleanValue:i};if(typeof i=="string")return{stringValue:i};if(i instanceof Date){const s=sr.fromDate(i);return{timestampValue:G1(r.serializer,s)}}if(i instanceof sr){const s=new sr(i.seconds,1e3*Math.floor(i.nanoseconds/1e3));return{timestampValue:G1(r.serializer,s)}}if(i instanceof mN)return{geoPointValue:{latitude:i.latitude,longitude:i.longitude}};if(i instanceof pm)return{bytesValue:jj(r.serializer,i._byteString)};if(i instanceof ts){const s=r.databaseId,o=i.firestore._databaseId;if(!o.isEqual(s))throw r.Bu(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${s.projectId}/${s.database}`);return{referenceValue:Z2(i.firestore._databaseId||r.databaseId,i._key.path)}}if(i instanceof gN)return function(o,a){return{mapValue:{fields:{__type__:{stringValue:"__vector__"},value:{arrayValue:{values:o.toArray().map(l=>{if(typeof l!="number")throw a.Bu("VectorValues must only contain numeric values.");return $2(a.serializer,l)})}}}}}}(i,r);throw r.Bu(`Unsupported field value: ${GA(i)}`)}(n,e)}function w8(n,e){const t={};return gj(n)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Yd(n,(i,r)=>{const s=_v(r,e.Mu(i));s!=null&&(t[i]=s)}),{mapValue:{fields:t}}}function E8(n){return!(typeof n!="object"||n===null||n instanceof Array||n instanceof Date||n instanceof sr||n instanceof mN||n instanceof pm||n instanceof ts||n instanceof vv||n instanceof gN)}function xN(n,e,t){if(!E8(t)||!function(r){return typeof r=="object"&&r!==null&&(Object.getPrototypeOf(r)===Object.prototype||Object.getPrototypeOf(r)===null)}(t)){const i=GA(t);throw i==="an object"?e.Bu(n+" a custom object"):e.Bu(n+" "+i)}}function nR(n,e,t){if((e=zi(e))instanceof KA)return e._internalPath;if(typeof e=="string")return wN(n,e);throw X1("Field path arguments must be of type string or ",n,!1,void 0,t)}const Nde=new RegExp("[~\\*/\\[\\]]");function wN(n,e,t){if(e.search(Nde)>=0)throw X1(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,n,!1,void 0,t);try{return new KA(...e.split("."))._internalPath}catch{throw X1(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,n,!1,void 0,t)}}function X1(n,e,t,i,r){const s=i&&!i.isEmpty(),o=r!==void 0;let a=`Function ${e}() called with invalid data`;t&&(a+=" (via `toFirestore()`)"),a+=". ";let l="";return(s||o)&&(l+=" (found",s&&(l+=` in field ${i}`),o&&(l+=` in document ${r}`),l+=")"),new bt(He.INVALID_ARGUMENT,a+n+l)}function A8(n,e){return n.some(t=>t.isEqual(e))}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class S8{constructor(e,t,i,r,s){this._firestore=e,this._userDataWriter=t,this._key=i,this._document=r,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new ts(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new Dde(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){const t=this._document.data.field(YA("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t)}}}class Dde extends S8{data(){return super.data()}}function YA(n,e){return typeof e=="string"?wN(n,e):e instanceof KA?e._internalPath:e._delegate._internalPath}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function T8(n){if(n.limitType==="L"&&n.explicitOrderBy.length===0)throw new bt(He.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class EN{}class AN extends EN{}function xv(n,e,...t){let i=[];e instanceof EN&&i.push(e),i=i.concat(t),function(s){const o=s.filter(l=>l instanceof SN).length,a=s.filter(l=>l instanceof $A).length;if(o>1||o>0&&a>0)throw new bt(He.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(i);for(const r of i)n=r._apply(n);return n}class $A extends AN{constructor(e,t,i){super(),this._field=e,this._op=t,this._value=i,this.type="where"}static _create(e,t,i){return new $A(e,t,i)}_apply(e){const t=this._parse(e);return C8(e._query,t),new mc(e.firestore,e.converter,XI(e._query,t))}_parse(e){const t=XA(e.firestore);return function(s,o,a,l,c,u,h){let f;if(c.isKeyField()){if(u==="array-contains"||u==="array-contains-any")throw new bt(He.INVALID_ARGUMENT,`Invalid Query. You can't perform '${u}' queries on documentId().`);if(u==="in"||u==="not-in"){G3(h,u);const m=[];for(const y of h)m.push(H3(l,s,y));f={arrayValue:{values:m}}}else f=H3(l,s,h)}else u!=="in"&&u!=="not-in"&&u!=="array-contains-any"||G3(h,u),f=Pde(a,o,h,u==="in"||u==="not-in");return Qi.create(c,u,f)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}}function iR(n,e,t){const i=e,r=YA("where",n);return $A._create(r,i,t)}class SN extends EN{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new SN(e,t)}_parse(e){const t=this._queryConstraints.map(i=>i._parse(e)).filter(i=>i.getFilters().length>0);return t.length===1?t[0]:Ea.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return t.getFilters().length===0?e:(function(r,s){let o=r;const a=s.getFlattenedFilters();for(const l of a)C8(o,l),o=XI(o,l)}(e._query,t),new mc(e.firestore,e.converter,XI(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}class TN extends AN{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new TN(e,t)}_apply(e){const t=function(r,s,o){if(r.startAt!==null)throw new bt(He.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(r.endAt!==null)throw new bt(He.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new C0(s,o)}(e._query,this._field,this._direction);return new mc(e.firestore,e.converter,function(r,s){const o=r.explicitOrderBy.concat([s]);return new Um(r.path,r.collectionGroup,o,r.filters.slice(),r.limit,r.limitType,r.startAt,r.endAt)}(e._query,t))}}function JA(n,e="asc"){const t=e,i=YA("orderBy",n);return TN._create(i,t)}class bN extends AN{constructor(e,t,i){super(),this.type=e,this._limit=t,this._limitType=i}static _create(e,t,i){return new bN(e,t,i)}_apply(e){return new mc(e.firestore,e.converter,H1(e._query,this._limit,this._limitType))}}function b8(n){return Ede("limit",n),bN._create("limit",n,"F")}function H3(n,e,t){if(typeof(t=zi(t))=="string"){if(t==="")throw new bt(He.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Tj(e)&&t.indexOf("/")!==-1)throw new bt(He.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${t}' contains a '/' character.`);const i=e.path.child(ui.fromString(t));if(!jt.isDocumentKey(i))throw new bt(He.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${i}' is not because it has an odd number of segments (${i.length}).`);return c3(n,new jt(i))}if(t instanceof ts)return c3(n,t._key);throw new bt(He.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${GA(t)}.`)}function G3(n,e){if(!Array.isArray(n)||n.length===0)throw new bt(He.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function C8(n,e){const t=function(r,s){for(const o of r)for(const a of o.getFlattenedFilters())if(s.indexOf(a.op)>=0)return a.op;return null}(n.filters,function(r){switch(r){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(t!==null)throw t===e.op?new bt(He.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new bt(He.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${t.toString()}' filters.`)}class Lde{convertValue(e,t="none"){switch(Pd(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Oi(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(Rd(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw en()}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const i={};return Yd(e,(r,s)=>{i[r]=this.convertValue(s,t)}),i}convertVectorValue(e){var t,i,r;const s=(r=(i=(t=e.fields)===null||t===void 0?void 0:t.value.arrayValue)===null||i===void 0?void 0:i.values)===null||r===void 0?void 0:r.map(o=>Oi(o.doubleValue));return new gN(s)}convertGeoPoint(e){return new mN(Oi(e.latitude),Oi(e.longitude))}convertArray(e,t){return(e.values||[]).map(i=>this.convertValue(i,t))}convertServerTimestamp(e,t){switch(t){case"previous":const i=K2(e);return i==null?null:this.convertValue(i,t);case"estimate":return this.convertTimestamp(S0(e));default:return null}}convertTimestamp(e){const t=ku(e);return new sr(t.seconds,t.nanos)}convertDocumentKey(e,t){const i=ui.fromString(e);Qn($j(i));const r=new T0(i.get(1),i.get(3)),s=new jt(i.popFirst(5));return r.isEqual(t)||sc(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),s}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function M8(n,e,t){let i;return i=n?t&&(t.merge||t.mergeFields)?n.toFirestore(e,t):n.toFirestore(e):e,i}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class cy{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class I8 extends S8{constructor(e,t,i,r,s,o){super(e,t,i,r,o),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new Uw(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){const i=this._document.data.field(YA("DocumentSnapshot.get",e));if(i!==null)return this._userDataWriter.convertValue(i,t.serverTimestamps)}}}class Uw extends I8{data(e={}){return super.data(e)}}class R8{constructor(e,t,i,r){this._firestore=e,this._userDataWriter=t,this._snapshot=r,this.metadata=new cy(r.hasPendingWrites,r.fromCache),this.query=i}get docs(){const e=[];return this.forEach(t=>e.push(t)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,t){this._snapshot.docs.forEach(i=>{e.call(t,new Uw(this._firestore,this._userDataWriter,i.key,i,new cy(this._snapshot.mutatedKeys.has(i.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new bt(He.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(r,s){if(r._snapshot.oldDocs.isEmpty()){let o=0;return r._snapshot.docChanges.map(a=>{const l=new Uw(r._firestore,r._userDataWriter,a.doc.key,a.doc,new cy(r._snapshot.mutatedKeys.has(a.doc.key),r._snapshot.fromCache),r.query.converter);return a.doc,{type:"added",doc:l,oldIndex:-1,newIndex:o++}})}{let o=r._snapshot.oldDocs;return r._snapshot.docChanges.filter(a=>s||a.type!==3).map(a=>{const l=new Uw(r._firestore,r._userDataWriter,a.doc.key,a.doc,new cy(r._snapshot.mutatedKeys.has(a.doc.key),r._snapshot.fromCache),r.query.converter);let c=-1,u=-1;return a.type!==0&&(c=o.indexOf(a.doc.key),o=o.delete(a.doc.key)),a.type!==1&&(o=o.add(a.doc),u=o.indexOf(a.doc.key)),{type:kde(a.type),doc:l,oldIndex:c,newIndex:u}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}}function kde(n){switch(n){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return en()}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Bde(n){n=uo(n,ts);const e=uo(n.firestore,Ou);return _de(WA(e),n._key).then(t=>P8(e,n,t))}class CN extends Lde{constructor(e){super(),this.firestore=e}convertBytes(e){return new pm(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new ts(this.firestore,null,t)}}function Ode(n){n=uo(n,mc);const e=uo(n.firestore,Ou),t=WA(e),i=new CN(e);return T8(n._query),xde(t,n._query).then(r=>new R8(e,i,n,r))}function MN(n,e,t){n=uo(n,ts);const i=uo(n.firestore,Ou),r=M8(n.converter,e,t);return RN(i,[x8(XA(i),"setDoc",n._key,r,n.converter!==null,t).toMutation(n._key,ma.none())])}function IN(n,e,t,...i){n=uo(n,ts);const r=uo(n.firestore,Ou),s=XA(r);let o;return o=typeof(e=zi(e))=="string"||e instanceof KA?Rde(s,"updateDoc",n._key,e,t,i):Ide(s,"updateDoc",n._key,e),RN(r,[o.toMutation(n._key,ma.exists(!0))])}function QA(n,e){const t=uo(n.firestore,Ou),i=Yu(n),r=M8(n.converter,e);return RN(t,[x8(XA(n.firestore),"addDoc",i._key,r,n.converter!==null,{}).toMutation(i._key,ma.exists(!1))]).then(()=>i)}function ZA(n,...e){var t,i,r;n=zi(n);let s={includeMetadataChanges:!1,source:"default"},o=0;typeof e[o]!="object"||z3(e[o])||(s=e[o],o++);const a={includeMetadataChanges:s.includeMetadataChanges,source:s.source};if(z3(e[o])){const h=e[o];e[o]=(t=h.next)===null||t===void 0?void 0:t.bind(h),e[o+1]=(i=h.error)===null||i===void 0?void 0:i.bind(h),e[o+2]=(r=h.complete)===null||r===void 0?void 0:r.bind(h)}let l,c,u;if(n instanceof ts)c=uo(n.firestore,Ou),u=LA(n._key.path),l={next:h=>{e[o]&&e[o](P8(c,n,h))},error:e[o+1],complete:e[o+2]};else{const h=uo(n,mc);c=uo(h.firestore,Ou),u=h._query;const f=new CN(c);l={next:m=>{e[o]&&e[o](new R8(c,f,h,m))},error:e[o+1],complete:e[o+2]},T8(n._query)}return function(f,m,y,_){const v=new pN(_),g=new dN(m,v,y);return f.asyncQueue.enqueueAndForget(async()=>cN(await K1(f),g)),()=>{v.Za(),f.asyncQueue.enqueueAndForget(async()=>uN(await K1(f),g))}}(WA(c),u,a,l)}function RN(n,e){return function(i,r){const s=new Xl;return i.asyncQueue.enqueueAndForget(async()=>lde(await vde(i),r,s)),s.promise}(WA(n),e)}function P8(n,e,t){const i=t.docs.get(e._key),r=new CN(n);return new I8(n,r,e._key,i,new cy(t.hasPendingWrites,t.fromCache),e.converter)}function Fu(){return new vN("serverTimestamp")}function N8(n){return new _N("increment",n)}(function(e,t=!0){(function(r){Fm=r})(qd),Md(new Du("firestore",(i,{instanceIdentifier:r,options:s})=>{const o=i.getProvider("app").getImmediate(),a=new Ou(new Hce(i.getProvider("auth-internal")),new Kce(i.getProvider("app-check-internal")),function(c,u){if(!Object.prototype.hasOwnProperty.apply(c.options,["projectId"]))throw new bt(He.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new T0(c.options.projectId,u)}(o,r),o);return s=Object.assign({useFetchStreams:t},s),a._setSettings(s),a},"PUBLIC").setMultipleInstances(!0)),qa(r3,"4.7.3",e),qa(r3,"4.7.3","esm2017")})();var Fde="firebase",Ude="10.14.1";/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */qa(Fde,Ude,"app");function PN(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(n);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(n,i[r])&&(t[i[r]]=n[i[r]]);return t}function D8(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const Vde=D8,L8=new hv("auth","Firebase",D8());/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const q1=new PA("@firebase/auth");function zde(n,...e){q1.logLevel<=Sn.WARN&&q1.warn(`Auth (${qd}): ${n}`,...e)}function Vw(n,...e){q1.logLevel<=Sn.ERROR&&q1.error(`Auth (${qd}): ${n}`,...e)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Aa(n,...e){throw NN(n,...e)}function Ja(n,...e){return NN(n,...e)}function k8(n,e,t){const i=Object.assign(Object.assign({},Vde()),{[e]:t});return new hv("auth","Firebase",i).create(e,{appName:n.name})}function ql(n){return k8(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function NN(n,...e){if(typeof n!="string"){const t=e[0],i=[...e.slice(1)];return i[0]&&(i[0].appName=n.name),n._errorFactory.create(t,...i)}return L8.create(n,...e)}function Qt(n,e,...t){if(!n)throw NN(e,...t)}function Vl(n){const e="INTERNAL ASSERTION FAILED: "+n;throw Vw(e),new Error(e)}function ac(n,e){n||Vl(e)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function rR(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.href)||""}function Hde(){return j3()==="http:"||j3()==="https:"}function j3(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.protocol)||null}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Gde(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Hde()||yle()||"connection"in navigator)?navigator.onLine:!0}function jde(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class wv{constructor(e,t){this.shortDelay=e,this.longDelay=t,ac(t>e,"Short delay should be less than long delay!"),this.isMobile=V2()||ej()}get(){return Gde()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function DN(n,e){ac(n.emulator,"Emulator should always be set here");const{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class B8{static initialize(e,t,i){this.fetchImpl=e,t&&(this.headersImpl=t),i&&(this.responseImpl=i)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;Vl("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;Vl("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;Vl("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Wde={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Kde=new wv(3e4,6e4);function $u(n,e){return n.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:n.tenantId}):e}async function Ju(n,e,t,i,r={}){return O8(n,r,async()=>{let s={},o={};i&&(e==="GET"?o=i:s={body:JSON.stringify(i)});const a=Om(Object.assign({key:n.config.apiKey},o)).slice(1),l=await n._getAdditionalHeaders();l["Content-Type"]="application/json",n.languageCode&&(l["X-Firebase-Locale"]=n.languageCode);const c=Object.assign({method:e,headers:l},s);return gle()||(c.referrerPolicy="no-referrer"),B8.fetch()(F8(n,n.config.apiHost,t,a),c)})}async function O8(n,e,t){n._canInitEmulator=!1;const i=Object.assign(Object.assign({},Wde),e);try{const r=new qde(n),s=await Promise.race([t(),r.promise]);r.clearNetworkTimeout();const o=await s.json();if("needConfirmation"in o)throw dx(n,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{const a=s.ok?o.errorMessage:o.error.message,[l,c]=a.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw dx(n,"credential-already-in-use",o);if(l==="EMAIL_EXISTS")throw dx(n,"email-already-in-use",o);if(l==="USER_DISABLED")throw dx(n,"user-disabled",o);const u=i[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(c)throw k8(n,u,c);Aa(n,u)}}catch(r){if(r instanceof fc)throw r;Aa(n,"network-request-failed",{message:String(r)})}}async function Ev(n,e,t,i,r={}){const s=await Ju(n,e,t,i,r);return"mfaPendingCredential"in s&&Aa(n,"multi-factor-auth-required",{_serverResponse:s}),s}function F8(n,e,t,i){const r=`${e}${t}?${i}`;return n.config.emulator?DN(n.config,r):`${n.config.apiScheme}://${r}`}function Xde(n){switch(n){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class qde{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,i)=>{this.timer=setTimeout(()=>i(Ja(this.auth,"network-request-failed")),Kde.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function dx(n,e,t){const i={appName:n.name};t.email&&(i.email=t.email),t.phoneNumber&&(i.phoneNumber=t.phoneNumber);const r=Ja(n,e,i);return r.customData._tokenResponse=t,r}function W3(n){return n!==void 0&&n.enterprise!==void 0}class Yde{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(const t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return Xde(t.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}}async function $de(n,e){return Ju(n,"GET","/v2/recaptchaConfig",$u(n,e))}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function Jde(n,e){return Ju(n,"POST","/v1/accounts:delete",e)}async function U8(n,e){return Ju(n,"POST","/v1/accounts:lookup",e)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Ly(n){if(n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function Qde(n,e=!1){const t=zi(n),i=await t.getIdToken(e),r=LN(i);Qt(r&&r.exp&&r.auth_time&&r.iat,t.auth,"internal-error");const s=typeof r.firebase=="object"?r.firebase:void 0,o=s==null?void 0:s.sign_in_provider;return{claims:r,token:i,authTime:Ly(Ub(r.auth_time)),issuedAtTime:Ly(Ub(r.iat)),expirationTime:Ly(Ub(r.exp)),signInProvider:o||null,signInSecondFactor:(s==null?void 0:s.sign_in_second_factor)||null}}function Ub(n){return Number(n)*1e3}function LN(n){const[e,t,i]=n.split(".");if(e===void 0||t===void 0||i===void 0)return Vw("JWT malformed, contained fewer than 3 sections"),null;try{const r=B1(t);return r?JSON.parse(r):(Vw("Failed to decode base64 JWT payload"),null)}catch(r){return Vw("Caught error parsing JWT payload as JSON",r==null?void 0:r.toString()),null}}function K3(n){const e=LN(n);return Qt(e,"internal-error"),Qt(typeof e.exp<"u","internal-error"),Qt(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function N0(n,e,t=!1){if(t)return e;try{return await e}catch(i){throw i instanceof fc&&Zde(i)&&n.auth.currentUser===n&&await n.auth.signOut(),i}}function Zde({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class efe{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var t;if(e){const i=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),i}else{this.errorBackoff=3e4;const r=((t=this.user.stsTokenManager.expirationTime)!==null&&t!==void 0?t:0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(e==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class sR{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=Ly(this.lastLoginAt),this.creationTime=Ly(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function Y1(n){var e;const t=n.auth,i=await n.getIdToken(),r=await N0(n,U8(t,{idToken:i}));Qt(r==null?void 0:r.users.length,t,"internal-error");const s=r.users[0];n._notifyReloadListener(s);const o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?V8(s.providerUserInfo):[],a=nfe(n.providerData,o),l=n.isAnonymous,c=!(n.email&&s.passwordHash)&&!(a!=null&&a.length),u=l?c:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new sR(s.createdAt,s.lastLoginAt),isAnonymous:u};Object.assign(n,h)}async function tfe(n){const e=zi(n);await Y1(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function nfe(n,e){return[...n.filter(i=>!e.some(r=>r.providerId===i.providerId)),...e]}function V8(n){return n.map(e=>{var{providerId:t}=e,i=PN(e,["providerId"]);return{providerId:t,uid:i.rawId||"",displayName:i.displayName||null,email:i.email||null,phoneNumber:i.phoneNumber||null,photoURL:i.photoUrl||null}})}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function ife(n,e){const t=await O8(n,{},async()=>{const i=Om({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:r,apiKey:s}=n.config,o=F8(n,r,"/v1/token",`key=${s}`),a=await n._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",B8.fetch()(o,{method:"POST",headers:a,body:i})});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function rfe(n,e){return Ju(n,"POST","/v2/accounts:revokeToken",$u(n,e))}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Pp{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Qt(e.idToken,"internal-error"),Qt(typeof e.idToken<"u","internal-error"),Qt(typeof e.refreshToken<"u","internal-error");const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):K3(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){Qt(e.length!==0,"internal-error");const t=K3(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(Qt(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:i,refreshToken:r,expiresIn:s}=await ife(e,t);this.updateTokensAndExpiration(i,r,Number(s))}updateTokensAndExpiration(e,t,i){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+i*1e3}static fromJSON(e,t){const{refreshToken:i,accessToken:r,expirationTime:s}=t,o=new Pp;return i&&(Qt(typeof i=="string","internal-error",{appName:e}),o.refreshToken=i),r&&(Qt(typeof r=="string","internal-error",{appName:e}),o.accessToken=r),s&&(Qt(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new Pp,this.toJSON())}_performRefresh(){return Vl("not implemented")}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Ic(n,e){Qt(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class zl{constructor(e){var{uid:t,auth:i,stsTokenManager:r}=e,s=PN(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new efe(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=i,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new sR(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const t=await N0(this,this.stsTokenManager.getToken(this.auth,e));return Qt(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return Qde(this,e)}reload(){return tfe(this)}_assign(e){this!==e&&(Qt(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(t=>Object.assign({},t)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new zl(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){Qt(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let i=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),i=!0),t&&await Y1(this),await this.auth._persistUserIfCurrent(this),i&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(za(this.auth.app))return Promise.reject(ql(this.auth));const e=await this.getIdToken();return await N0(this,Jde(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){var i,r,s,o,a,l,c,u;const h=(i=t.displayName)!==null&&i!==void 0?i:void 0,f=(r=t.email)!==null&&r!==void 0?r:void 0,m=(s=t.phoneNumber)!==null&&s!==void 0?s:void 0,y=(o=t.photoURL)!==null&&o!==void 0?o:void 0,_=(a=t.tenantId)!==null&&a!==void 0?a:void 0,v=(l=t._redirectEventId)!==null&&l!==void 0?l:void 0,g=(c=t.createdAt)!==null&&c!==void 0?c:void 0,w=(u=t.lastLoginAt)!==null&&u!==void 0?u:void 0,{uid:A,emailVerified:T,isAnonymous:L,providerData:D,stsTokenManager:R}=t;Qt(A&&R,e,"internal-error");const I=Pp.fromJSON(this.name,R);Qt(typeof A=="string",e,"internal-error"),Ic(h,e.name),Ic(f,e.name),Qt(typeof T=="boolean",e,"internal-error"),Qt(typeof L=="boolean",e,"internal-error"),Ic(m,e.name),Ic(y,e.name),Ic(_,e.name),Ic(v,e.name),Ic(g,e.name),Ic(w,e.name);const M=new zl({uid:A,auth:e,email:f,emailVerified:T,displayName:h,isAnonymous:L,photoURL:y,phoneNumber:m,tenantId:_,stsTokenManager:I,createdAt:g,lastLoginAt:w});return D&&Array.isArray(D)&&(M.providerData=D.map(C=>Object.assign({},C))),v&&(M._redirectEventId=v),M}static async _fromIdTokenResponse(e,t,i=!1){const r=new Pp;r.updateFromServerResponse(t);const s=new zl({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:i});return await Y1(s),s}static async _fromGetAccountInfoResponse(e,t,i){const r=t.users[0];Qt(r.localId!==void 0,"internal-error");const s=r.providerUserInfo!==void 0?V8(r.providerUserInfo):[],o=!(r.email&&r.passwordHash)&&!(s!=null&&s.length),a=new Pp;a.updateFromIdToken(i);const l=new zl({uid:r.localId,auth:e,stsTokenManager:a,isAnonymous:o}),c={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:s,metadata:new sR(r.createdAt,r.lastLoginAt),isAnonymous:!(r.email&&r.passwordHash)&&!(s!=null&&s.length)};return Object.assign(l,c),l}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const X3=new Map;function Hl(n){ac(n instanceof Function,"Expected a class definition");let e=X3.get(n);return e?(ac(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,X3.set(n,e),e)}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class z8{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}z8.type="NONE";const q3=z8;/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function zw(n,e,t){return`firebase:${n}:${e}:${t}`}class Np{constructor(e,t,i){this.persistence=e,this.auth=t,this.userKey=i;const{config:r,name:s}=this.auth;this.fullUserKey=zw(this.userKey,r.apiKey,s),this.fullPersistenceKey=zw("persistence",r.apiKey,s),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);return e?zl._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,i="authUser"){if(!t.length)return new Np(Hl(q3),e,i);const r=(await Promise.all(t.map(async c=>{if(await c._isAvailable())return c}))).filter(c=>c);let s=r[0]||Hl(q3);const o=zw(i,e.config.apiKey,e.name);let a=null;for(const c of t)try{const u=await c._get(o);if(u){const h=zl._fromJSON(e,u);c!==s&&(a=h),s=c;break}}catch{}const l=r.filter(c=>c._shouldAllowMigration);return!s._shouldAllowMigration||!l.length?new Np(s,e,i):(s=l[0],a&&await s._set(o,a.toJSON()),await Promise.all(t.map(async c=>{if(c!==s)try{await c._remove(o)}catch{}})),new Np(s,e,i))}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Y3(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(W8(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(H8(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(X8(e))return"Blackberry";if(q8(e))return"Webos";if(G8(e))return"Safari";if((e.includes("chrome/")||j8(e))&&!e.includes("edge/"))return"Chrome";if(K8(e))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,i=n.match(t);if((i==null?void 0:i.length)===2)return i[1]}return"Other"}function H8(n=rs()){return/firefox\//i.test(n)}function G8(n=rs()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function j8(n=rs()){return/crios\//i.test(n)}function W8(n=rs()){return/iemobile/i.test(n)}function K8(n=rs()){return/android/i.test(n)}function X8(n=rs()){return/blackberry/i.test(n)}function q8(n=rs()){return/webos/i.test(n)}function kN(n=rs()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function sfe(n=rs()){var e;return kN(n)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function ofe(){return vle()&&document.documentMode===10}function Y8(n=rs()){return kN(n)||K8(n)||q8(n)||X8(n)||/windows phone/i.test(n)||W8(n)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function $8(n,e=[]){let t;switch(n){case"Browser":t=Y3(rs());break;case"Worker":t=`${Y3(rs())}-${n}`;break;default:t=n}const i=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${qd}/${i}`}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class afe{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const i=s=>new Promise((o,a)=>{try{const l=e(s);o(l)}catch(l){a(l)}});i.onAbort=t,this.queue.push(i);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const i of this.queue)await i(e),i.onAbort&&t.push(i.onAbort)}catch(i){t.reverse();for(const r of t)try{r()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:i==null?void 0:i.message})}}}/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function lfe(n,e={}){return Ju(n,"GET","/v2/passwordPolicy",$u(n,e))}/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const cfe=6;class ufe{constructor(e){var t,i,r,s;const o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(t=o.minPasswordLength)!==null&&t!==void 0?t:cfe,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(r=(i=e.allowedNonAlphanumericCharacters)===null||i===void 0?void 0:i.join(""))!==null&&r!==void 0?r:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,i,r,s,o,a;const l={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,l),this.validatePasswordCharacterOptions(e,l),l.isValid&&(l.isValid=(t=l.meetsMinPasswordLength)!==null&&t!==void 0?t:!0),l.isValid&&(l.isValid=(i=l.meetsMaxPasswordLength)!==null&&i!==void 0?i:!0),l.isValid&&(l.isValid=(r=l.containsLowercaseLetter)!==null&&r!==void 0?r:!0),l.isValid&&(l.isValid=(s=l.containsUppercaseLetter)!==null&&s!==void 0?s:!0),l.isValid&&(l.isValid=(o=l.containsNumericCharacter)!==null&&o!==void 0?o:!0),l.isValid&&(l.isValid=(a=l.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),l}validatePasswordLengthOptions(e,t){const i=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;i&&(t.meetsMinPasswordLength=e.length>=i),r&&(t.meetsMaxPasswordLength=e.length<=r)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let i;for(let r=0;r<e.length;r++)i=e.charAt(r),this.updatePasswordCharacterOptionsStatuses(t,i>="a"&&i<="z",i>="A"&&i<="Z",i>="0"&&i<="9",this.allowedNonAlphanumericCharacters.includes(i))}updatePasswordCharacterOptionsStatuses(e,t,i,r,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=i)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class hfe{constructor(e,t,i,r){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=i,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new $3(this),this.idTokenSubscription=new $3(this),this.beforeStateQueue=new afe(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=L8,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=r.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=Hl(t)),this._initializationPromise=this.queue(async()=>{var i,r;if(!this._deleted&&(this.persistenceManager=await Np.create(this,e),!this._deleted)){if(!((i=this._popupRedirectResolver)===null||i===void 0)&&i._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=((r=this.currentUser)===null||r===void 0?void 0:r.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const t=await U8(this,{idToken:e}),i=await zl._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(i)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var t;if(za(this.app)){const o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}const i=await this.assertedPersistence.getCurrentUser();let r=i,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId,a=r==null?void 0:r._redirectEventId,l=await this.tryRedirectSignIn(e);(!o||o===a)&&(l!=null&&l.user)&&(r=l.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(o){r=i,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Qt(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await Y1(e)}catch(t){if((t==null?void 0:t.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=jde()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(za(this.app))return Promise.reject(ql(this));const t=e?zi(e):null;return t&&Qt(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&Qt(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return za(this.app)?Promise.reject(ql(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return za(this.app)?Promise.reject(ql(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Hl(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await lfe(this),t=new ufe(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new hv("auth","Firebase",e())}onAuthStateChanged(e,t,i){return this.registerStateListener(this.authStateSubscription,e,t,i)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,i){return this.registerStateListener(this.idTokenSubscription,e,t,i)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{const i=this.onAuthStateChanged(()=>{i(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t=await this.currentUser.getIdToken(),i={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:t};this.tenantId!=null&&(i.tenantId=this.tenantId),await rfe(this,i)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,t){const i=await this.getOrInitRedirectPersistenceManager(t);return e===null?i.removeCurrentUser():i.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&Hl(e)||this._popupRedirectResolver;Qt(t,this,"argument-error"),this.redirectPersistenceManager=await Np.create(this,[Hl(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,i;return this._isInitialized&&await this.queue(async()=>{}),((t=this._currentUser)===null||t===void 0?void 0:t._redirectEventId)===e?this._currentUser:((i=this.redirectUser)===null||i===void 0?void 0:i._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const i=(t=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&t!==void 0?t:null;this.lastNotifiedUid!==i&&(this.lastNotifiedUid=i,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,i,r){if(this._deleted)return()=>{};const s=typeof t=="function"?t:t.next.bind(t);let o=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(Qt(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof t=="function"){const l=e.addObserver(t,i,r);return()=>{o=!0,l()}}else{const l=e.addObserver(t);return()=>{o=!0,l()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return Qt(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=$8(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const i=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());i&&(t["X-Firebase-Client"]=i);const r=await this._getAppCheckToken();return r&&(t["X-Firebase-AppCheck"]=r),t}async _getAppCheckToken(){var e;const t=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return t!=null&&t.error&&zde(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function Jd(n){return zi(n)}class $3{constructor(e){this.auth=e,this.observer=null,this.addObserver=Mle(t=>this.observer=t)}get next(){return Qt(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let eS={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function dfe(n){eS=n}function J8(n){return eS.loadJS(n)}function ffe(){return eS.recaptchaEnterpriseScript}function pfe(){return eS.gapiScript}function mfe(n){return`__${n}${Math.floor(Math.random()*1e6)}`}const gfe="recaptcha-enterprise",yfe="NO_RECAPTCHA";class vfe{constructor(e){this.type=gfe,this.auth=Jd(e)}async verify(e="verify",t=!1){async function i(s){if(!t){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{$de(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(l=>{if(l.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{const c=new Yde(l);return s.tenantId==null?s._agentRecaptchaConfig=c:s._tenantRecaptchaConfigs[s.tenantId]=c,o(c.siteKey)}}).catch(l=>{a(l)})})}function r(s,o,a){const l=window.grecaptcha;W3(l)?l.enterprise.ready(()=>{l.enterprise.execute(s,{action:e}).then(c=>{o(c)}).catch(()=>{o(yfe)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{i(this.auth).then(a=>{if(!t&&W3(window.grecaptcha))r(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let l=ffe();l.length!==0&&(l+=a),J8(l).then(()=>{r(a,s,o)}).catch(c=>{o(c)})}}).catch(a=>{o(a)})})}}async function J3(n,e,t,i=!1){const r=new vfe(n);let s;try{s=await r.verify(t)}catch{s=await r.verify(t,!0)}const o=Object.assign({},e);return i?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function oR(n,e,t,i){var r;if(!((r=n._getRecaptchaConfig())===null||r===void 0)&&r.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const s=await J3(n,e,t,t==="getOobCode");return i(n,s)}else return i(n,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${t} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const o=await J3(n,e,t,t==="getOobCode");return i(n,o)}else return Promise.reject(s)})}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function _fe(n,e){const t=NA(n,"auth");if(t.isInitialized()){const r=t.getImmediate(),s=t.getOptions();if(F1(s,e??{}))return r;Aa(r,"already-initialized")}return t.initialize({options:e})}function xfe(n,e){const t=(e==null?void 0:e.persistence)||[],i=(Array.isArray(t)?t:[t]).map(Hl);e!=null&&e.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(i,e==null?void 0:e.popupRedirectResolver)}function wfe(n,e,t){const i=Jd(n);Qt(i._canInitEmulator,i,"emulator-config-failed"),Qt(/^https?:\/\//.test(e),i,"invalid-emulator-scheme");const r=!1,s=Q8(e),{host:o,port:a}=Efe(e),l=a===null?"":`:${a}`;i.config.emulator={url:`${s}//${o}${l}/`},i.settings.appVerificationDisabledForTesting=!0,i.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:r})}),Afe()}function Q8(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function Efe(n){const e=Q8(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};const i=t[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(i);if(r){const s=r[1];return{host:s,port:Q3(i.substr(s.length+1))}}else{const[s,o]=i.split(":");return{host:s,port:Q3(o)}}}function Q3(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function Afe(){function n(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only.  Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",n):n())}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class BN{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return Vl("not implemented")}_getIdTokenResponse(e){return Vl("not implemented")}_linkToIdToken(e,t){return Vl("not implemented")}_getReauthenticationResolver(e){return Vl("not implemented")}}async function Sfe(n,e){return Ju(n,"POST","/v1/accounts:signUp",e)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function Tfe(n,e){return Ev(n,"POST","/v1/accounts:signInWithPassword",$u(n,e))}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function bfe(n,e){return Ev(n,"POST","/v1/accounts:signInWithEmailLink",$u(n,e))}async function Cfe(n,e){return Ev(n,"POST","/v1/accounts:signInWithEmailLink",$u(n,e))}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class D0 extends BN{constructor(e,t,i,r=null){super("password",i),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new D0(e,t,"password")}static _fromEmailAndCode(e,t,i=null){return new D0(e,t,"emailLink",i)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;if(t!=null&&t.email&&(t!=null&&t.password)){if(t.signInMethod==="password")return this._fromEmailAndPassword(t.email,t.password);if(t.signInMethod==="emailLink")return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":const t={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return oR(e,t,"signInWithPassword",Tfe);case"emailLink":return bfe(e,{email:this._email,oobCode:this._password});default:Aa(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":const i={idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return oR(e,i,"signUpPassword",Sfe);case"emailLink":return Cfe(e,{idToken:t,email:this._email,oobCode:this._password});default:Aa(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function Dp(n,e){return Ev(n,"POST","/v1/accounts:signInWithIdp",$u(n,e))}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Mfe="http://localhost";class Nd extends BN{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new Nd(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):Aa("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e,{providerId:i,signInMethod:r}=t,s=PN(t,["providerId","signInMethod"]);if(!i||!r)return null;const o=new Nd(i,r);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){const t=this.buildRequest();return Dp(e,t)}_linkToIdToken(e,t){const i=this.buildRequest();return i.idToken=t,Dp(e,i)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Dp(e,t)}buildRequest(){const e={requestUri:Mfe,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=Om(t)}return e}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Ife(n){switch(n){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Rfe(n){const e=ry(sy(n)).link,t=e?ry(sy(e)).deep_link_id:null,i=ry(sy(n)).deep_link_id;return(i?ry(sy(i)).link:null)||i||t||e||n}class ON{constructor(e){var t,i,r,s,o,a;const l=ry(sy(e)),c=(t=l.apiKey)!==null&&t!==void 0?t:null,u=(i=l.oobCode)!==null&&i!==void 0?i:null,h=Ife((r=l.mode)!==null&&r!==void 0?r:null);Qt(c&&u&&h,"argument-error"),this.apiKey=c,this.operation=h,this.code=u,this.continueUrl=(s=l.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=l.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=l.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){const t=Rfe(e);try{return new ON(t)}catch{return null}}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Hm{constructor(){this.providerId=Hm.PROVIDER_ID}static credential(e,t){return D0._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const i=ON.parseLink(t);return Qt(i,"argument-error"),D0._fromEmailAndCode(e,i.code,i.tenantId)}}Hm.PROVIDER_ID="password";Hm.EMAIL_PASSWORD_SIGN_IN_METHOD="password";Hm.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Z8{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Av extends Z8{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Xc extends Av{constructor(){super("facebook.com")}static credential(e){return Nd._fromParams({providerId:Xc.PROVIDER_ID,signInMethod:Xc.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Xc.credentialFromTaggedObject(e)}static credentialFromError(e){return Xc.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Xc.credential(e.oauthAccessToken)}catch{return null}}}Xc.FACEBOOK_SIGN_IN_METHOD="facebook.com";Xc.PROVIDER_ID="facebook.com";/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class qc extends Av{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return Nd._fromParams({providerId:qc.PROVIDER_ID,signInMethod:qc.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return qc.credentialFromTaggedObject(e)}static credentialFromError(e){return qc.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:i}=e;if(!t&&!i)return null;try{return qc.credential(t,i)}catch{return null}}}qc.GOOGLE_SIGN_IN_METHOD="google.com";qc.PROVIDER_ID="google.com";/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Yc extends Av{constructor(){super("github.com")}static credential(e){return Nd._fromParams({providerId:Yc.PROVIDER_ID,signInMethod:Yc.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Yc.credentialFromTaggedObject(e)}static credentialFromError(e){return Yc.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Yc.credential(e.oauthAccessToken)}catch{return null}}}Yc.GITHUB_SIGN_IN_METHOD="github.com";Yc.PROVIDER_ID="github.com";/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class $c extends Av{constructor(){super("twitter.com")}static credential(e,t){return Nd._fromParams({providerId:$c.PROVIDER_ID,signInMethod:$c.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return $c.credentialFromTaggedObject(e)}static credentialFromError(e){return $c.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:i}=e;if(!t||!i)return null;try{return $c.credential(t,i)}catch{return null}}}$c.TWITTER_SIGN_IN_METHOD="twitter.com";$c.PROVIDER_ID="twitter.com";/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function Pfe(n,e){return Ev(n,"POST","/v1/accounts:signUp",$u(n,e))}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Dd{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,i,r=!1){const s=await zl._fromIdTokenResponse(e,i,r),o=Z3(i);return new Dd({user:s,providerId:o,_tokenResponse:i,operationType:t})}static async _forOperation(e,t,i){await e._updateTokensIfNecessary(i,!0);const r=Z3(i);return new Dd({user:e,providerId:r,_tokenResponse:i,operationType:t})}}function Z3(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class $1 extends fc{constructor(e,t,i,r){var s;super(t.code,t.message),this.operationType=i,this.user=r,Object.setPrototypeOf(this,$1.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:t.customData._serverResponse,operationType:i}}static _fromErrorAndOperation(e,t,i,r){return new $1(e,t,i,r)}}function eW(n,e,t,i){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?$1._fromErrorAndOperation(n,s,e,i):s})}async function Nfe(n,e,t=!1){const i=await N0(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return Dd._forOperation(n,"link",i)}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function Dfe(n,e,t=!1){const{auth:i}=n;if(za(i.app))return Promise.reject(ql(i));const r="reauthenticate";try{const s=await N0(n,eW(i,r,e,n),t);Qt(s.idToken,i,"internal-error");const o=LN(s.idToken);Qt(o,i,"internal-error");const{sub:a}=o;return Qt(n.uid===a,i,"user-mismatch"),Dd._forOperation(n,r,s)}catch(s){throw(s==null?void 0:s.code)==="auth/user-not-found"&&Aa(i,"user-mismatch"),s}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function tW(n,e,t=!1){if(za(n.app))return Promise.reject(ql(n));const i="signIn",r=await eW(n,i,e),s=await Dd._fromIdTokenResponse(n,i,r);return t||await n._updateCurrentUser(s.user),s}async function Lfe(n,e){return tW(Jd(n),e)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function nW(n){const e=Jd(n);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function kfe(n,e,t){if(za(n.app))return Promise.reject(ql(n));const i=Jd(n),o=await oR(i,{returnSecureToken:!0,email:e,password:t,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Pfe).catch(l=>{throw l.code==="auth/password-does-not-meet-requirements"&&nW(n),l}),a=await Dd._fromIdTokenResponse(i,"signIn",o);return await i._updateCurrentUser(a.user),a}function Bfe(n,e,t){return za(n.app)?Promise.reject(ql(n)):Lfe(zi(n),Hm.credential(e,t)).catch(async i=>{throw i.code==="auth/password-does-not-meet-requirements"&&nW(n),i})}function Ofe(n,e,t,i){return zi(n).onIdTokenChanged(e,t,i)}function Ffe(n,e,t){return zi(n).beforeAuthStateChanged(e,t)}function Ufe(n,e,t,i){return zi(n).onAuthStateChanged(e,t,i)}function Vfe(n){return zi(n).signOut()}const J1="__sak";/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class iW{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(J1,"1"),this.storage.removeItem(J1),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const zfe=1e3,Hfe=10;class rW extends iW{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Y8(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const i=this.storage.getItem(t),r=this.localCache[t];i!==r&&e(t,r,i)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((o,a,l)=>{this.notifyListeners(o,l)});return}const i=e.key;t?this.detachListener():this.stopPolling();const r=()=>{const o=this.storage.getItem(i);!t&&this.localCache[i]===o||this.notifyListeners(i,o)},s=this.storage.getItem(i);ofe()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(r,Hfe):r()}notifyListeners(e,t){this.localCache[e]=t;const i=this.listeners[e];if(i)for(const r of Array.from(i))r(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,i)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:i}),!0)})},zfe)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}rW.type="LOCAL";const Gfe=rW;/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class sW extends iW{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}sW.type="SESSION";const oW=sW;/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function jfe(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class tS{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(r=>r.isListeningto(e));if(t)return t;const i=new tS(e);return this.receivers.push(i),i}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:i,eventType:r,data:s}=t.data,o=this.handlersMap[r];if(!(o!=null&&o.size))return;t.ports[0].postMessage({status:"ack",eventId:i,eventType:r});const a=Array.from(o).map(async c=>c(t.origin,s)),l=await jfe(a);t.ports[0].postMessage({status:"done",eventId:i,eventType:r,response:l})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),(!t||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}tS.receivers=[];/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function FN(n="",e=10){let t="";for(let i=0;i<e;i++)t+=Math.floor(Math.random()*10);return n+t}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Wfe{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,i=50){const r=typeof MessageChannel<"u"?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let s,o;return new Promise((a,l)=>{const c=FN("",20);r.port1.start();const u=setTimeout(()=>{l(new Error("unsupported_event"))},i);o={messageChannel:r,onMessage(h){const f=h;if(f.data.eventId===c)switch(f.data.status){case"ack":clearTimeout(u),s=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(f.data.response);break;default:clearTimeout(u),clearTimeout(s),l(new Error("invalid_response"));break}}},this.handlers.add(o),r.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[r.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Qa(){return window}function Kfe(n){Qa().location.href=n}/**
 * @license
 * Copyright 2020 Google LLC.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function aW(){return typeof Qa().WorkerGlobalScope<"u"&&typeof Qa().importScripts=="function"}async function Xfe(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function qfe(){var n;return((n=navigator==null?void 0:navigator.serviceWorker)===null||n===void 0?void 0:n.controller)||null}function Yfe(){return aW()?self:null}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const lW="firebaseLocalStorageDb",$fe=1,Q1="firebaseLocalStorage",cW="fbase_key";class Sv{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function nS(n,e){return n.transaction([Q1],e?"readwrite":"readonly").objectStore(Q1)}function Jfe(){const n=indexedDB.deleteDatabase(lW);return new Sv(n).toPromise()}function aR(){const n=indexedDB.open(lW,$fe);return new Promise((e,t)=>{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const i=n.result;try{i.createObjectStore(Q1,{keyPath:cW})}catch(r){t(r)}}),n.addEventListener("success",async()=>{const i=n.result;i.objectStoreNames.contains(Q1)?e(i):(i.close(),await Jfe(),e(await aR()))})})}async function eU(n,e,t){const i=nS(n,!0).put({[cW]:e,value:t});return new Sv(i).toPromise()}async function Qfe(n,e){const t=nS(n,!1).get(e),i=await new Sv(t).toPromise();return i===void 0?null:i.value}function tU(n,e){const t=nS(n,!0).delete(e);return new Sv(t).toPromise()}const Zfe=800,epe=3;class uW{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await aR(),this.db)}async _withRetries(e){let t=0;for(;;)try{const i=await this._openDb();return await e(i)}catch(i){if(t++>epe)throw i;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return aW()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=tS._getInstance(Yfe()),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var e,t;if(this.activeServiceWorker=await Xfe(),!this.activeServiceWorker)return;this.sender=new Wfe(this.activeServiceWorker);const i=await this.sender._send("ping",{},800);i&&!((e=i[0])===null||e===void 0)&&e.fulfilled&&!((t=i[0])===null||t===void 0)&&t.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||qfe()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await aR();return await eU(e,J1,"1"),await tU(e,J1),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(i=>eU(i,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(i=>Qfe(i,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>tU(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(r=>{const s=nS(r,!1).getAll();return new Sv(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],i=new Set;if(e.length!==0)for(const{fbase_key:r,value:s}of e)i.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(s)&&(this.notifyListeners(r,s),t.push(r));for(const r of Object.keys(this.localCache))this.localCache[r]&&!i.has(r)&&(this.notifyListeners(r,null),t.push(r));return t}notifyListeners(e,t){this.localCache[e]=t;const i=this.listeners[e];if(i)for(const r of Array.from(i))r(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zfe)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}}uW.type="LOCAL";const tpe=uW;new wv(3e4,6e4);/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function npe(n,e){return e?Hl(e):(Qt(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class UN extends BN{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Dp(e,this._buildIdpRequest())}_linkToIdToken(e,t){return Dp(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return Dp(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function ipe(n){return tW(n.auth,new UN(n),n.bypassAuthState)}function rpe(n){const{auth:e,user:t}=n;return Qt(t,e,"internal-error"),Dfe(t,new UN(n),n.bypassAuthState)}async function spe(n){const{auth:e,user:t}=n;return Qt(t,e,"internal-error"),Nfe(t,new UN(n),n.bypassAuthState)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class hW{constructor(e,t,i,r,s=!1){this.auth=e,this.resolver=i,this.user=r,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(i){this.reject(i)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:i,postBody:r,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}const l={auth:this.auth,requestUri:t,sessionId:i,tenantId:s||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(l))}catch(c){this.reject(c)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ipe;case"linkViaPopup":case"linkViaRedirect":return spe;case"reauthViaPopup":case"reauthViaRedirect":return rpe;default:Aa(this.auth,"internal-error")}}resolve(e){ac(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){ac(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const ope=new wv(2e3,1e4);class pp extends hW{constructor(e,t,i,r,s){super(e,t,r,s),this.provider=i,this.authWindow=null,this.pollId=null,pp.currentPopupAction&&pp.currentPopupAction.cancel(),pp.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Qt(e,this.auth,"internal-error"),e}async onExecution(){ac(this.filter.length===1,"Popup operations only handle one event");const e=FN();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(Ja(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(Ja(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,pp.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,i;if(!((i=(t=this.authWindow)===null||t===void 0?void 0:t.window)===null||i===void 0)&&i.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Ja(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,ope.get())};e()}}pp.currentPopupAction=null;/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const ape="pendingRedirect",Hw=new Map;class lpe extends hW{constructor(e,t,i=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,i),this.eventId=null}async execute(){let e=Hw.get(this.auth._key());if(!e){try{const i=await cpe(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(i)}catch(t){e=()=>Promise.reject(t)}Hw.set(this.auth._key(),e)}return this.bypassAuthState||Hw.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function cpe(n,e){const t=dpe(e),i=hpe(n);if(!await i._isAvailable())return!1;const r=await i._get(t)==="true";return await i._remove(t),r}function upe(n,e){Hw.set(n._key(),e)}function hpe(n){return Hl(n._redirectPersistence)}function dpe(n){return zw(ape,n.config.apiKey,n.name)}async function fpe(n,e,t=!1){if(za(n.app))return Promise.reject(ql(n));const i=Jd(n),r=npe(i,e),o=await new lpe(i,r,t).execute();return o&&!t&&(delete o.user._redirectEventId,await i._persistUserIfCurrent(o.user),await i._setRedirectUser(null,e)),o}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const ppe=10*60*1e3;class mpe{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(i=>{this.isEventForConsumer(e,i)&&(t=!0,this.sendToConsumer(e,i),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!gpe(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var i;if(e.error&&!dW(e)){const r=((i=e.error.code)===null||i===void 0?void 0:i.split("auth/")[1])||"internal-error";t.onError(Ja(this.auth,r))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const i=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&i}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=ppe&&this.cachedEventUids.clear(),this.cachedEventUids.has(nU(e))}saveEventToCache(e){this.cachedEventUids.add(nU(e)),this.lastProcessedEventTime=Date.now()}}function nU(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function dW({type:n,error:e}){return n==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function gpe(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return dW(n);default:return!1}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function ype(n,e={}){return Ju(n,"GET","/v1/projects",e)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const vpe=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,_pe=/^https?/;async function xpe(n){if(n.config.emulator)return;const{authorizedDomains:e}=await ype(n);for(const t of e)try{if(wpe(t))return}catch{}Aa(n,"unauthorized-domain")}function wpe(n){const e=rR(),{protocol:t,hostname:i}=new URL(e);if(n.startsWith("chrome-extension://")){const o=new URL(n);return o.hostname===""&&i===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&o.hostname===i}if(!_pe.test(t))return!1;if(vpe.test(n))return i===n;const r=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(i)}/**
 * @license
 * Copyright 2020 Google LLC.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Epe=new wv(3e4,6e4);function iU(){const n=Qa().___jsl;if(n!=null&&n.H){for(const e of Object.keys(n.H))if(n.H[e].r=n.H[e].r||[],n.H[e].L=n.H[e].L||[],n.H[e].r=[...n.H[e].L],n.CP)for(let t=0;t<n.CP.length;t++)n.CP[t]=null}}function Ape(n){return new Promise((e,t)=>{var i,r,s;function o(){iU(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{iU(),t(Ja(n,"network-request-failed"))},timeout:Epe.get()})}if(!((r=(i=Qa().gapi)===null||i===void 0?void 0:i.iframes)===null||r===void 0)&&r.Iframe)e(gapi.iframes.getContext());else if(!((s=Qa().gapi)===null||s===void 0)&&s.load)o();else{const a=mfe("iframefcb");return Qa()[a]=()=>{gapi.load?o():t(Ja(n,"network-request-failed"))},J8(`${pfe()}?onload=${a}`).catch(l=>t(l))}}).catch(e=>{throw Gw=null,e})}let Gw=null;function Spe(n){return Gw=Gw||Ape(n),Gw}/**
 * @license
 * Copyright 2020 Google LLC.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Tpe=new wv(5e3,15e3),bpe="__/auth/iframe",Cpe="emulator/auth/iframe",Mpe={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Ipe=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Rpe(n){const e=n.config;Qt(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?DN(e,Cpe):`https://${n.config.authDomain}/${bpe}`,i={apiKey:e.apiKey,appName:n.name,v:qd},r=Ipe.get(n.config.apiHost);r&&(i.eid=r);const s=n._getFrameworks();return s.length&&(i.fw=s.join(",")),`${t}?${Om(i).slice(1)}`}async function Ppe(n){const e=await Spe(n),t=Qa().gapi;return Qt(t,n,"internal-error"),e.open({where:document.body,url:Rpe(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Mpe,dontclear:!0},i=>new Promise(async(r,s)=>{await i.restyle({setHideOnLeave:!1});const o=Ja(n,"network-request-failed"),a=Qa().setTimeout(()=>{s(o)},Tpe.get());function l(){Qa().clearTimeout(a),r(i)}i.ping(l).then(l,()=>{s(o)})}))}/**
 * @license
 * Copyright 2020 Google LLC.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Npe={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},Dpe=500,Lpe=600,kpe="_blank",Bpe="http://localhost";class rU{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function Ope(n,e,t,i=Dpe,r=Lpe){const s=Math.max((window.screen.availHeight-r)/2,0).toString(),o=Math.max((window.screen.availWidth-i)/2,0).toString();let a="";const l=Object.assign(Object.assign({},Npe),{width:i.toString(),height:r.toString(),top:s,left:o}),c=rs().toLowerCase();t&&(a=j8(c)?kpe:t),H8(c)&&(e=e||Bpe,l.scrollbars="yes");const u=Object.entries(l).reduce((f,[m,y])=>`${f}${m}=${y},`,"");if(sfe(c)&&a!=="_self")return Fpe(e||"",a),new rU(null);const h=window.open(e||"",a,u);Qt(h,n,"popup-blocked");try{h.focus()}catch{}return new rU(h)}function Fpe(n,e){const t=document.createElement("a");t.href=n,t.target=e;const i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(i)}/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Upe="__/auth/handler",Vpe="emulator/auth/handler",zpe=encodeURIComponent("fac");async function sU(n,e,t,i,r,s){Qt(n.config.authDomain,n,"auth-domain-config-required"),Qt(n.config.apiKey,n,"invalid-api-key");const o={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:i,v:qd,eventId:r};if(e instanceof Z8){e.setDefaultLanguage(n.languageCode),o.providerId=e.providerId||"",kI(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[u,h]of Object.entries({}))o[u]=h}if(e instanceof Av){const u=e.getScopes().filter(h=>h!=="");u.length>0&&(o.scopes=u.join(","))}n.tenantId&&(o.tid=n.tenantId);const a=o;for(const u of Object.keys(a))a[u]===void 0&&delete a[u];const l=await n._getAppCheckToken(),c=l?`#${zpe}=${encodeURIComponent(l)}`:"";return`${Hpe(n)}?${Om(a).slice(1)}${c}`}function Hpe({config:n}){return n.emulator?DN(n,Vpe):`https://${n.authDomain}/${Upe}`}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Vb="webStorageSupport";class Gpe{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=oW,this._completeRedirectFn=fpe,this._overrideRedirectResult=upe}async _openPopup(e,t,i,r){var s;ac((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");const o=await sU(e,t,i,rR(),r);return Ope(e,o,FN())}async _openRedirect(e,t,i,r){await this._originValidation(e);const s=await sU(e,t,i,rR(),r);return Kfe(s),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:r,promise:s}=this.eventManagers[t];return r?Promise.resolve(r):(ac(s,"If manager is not set, promise should be"),s)}const i=this.initAndGetManager(e);return this.eventManagers[t]={promise:i},i.catch(()=>{delete this.eventManagers[t]}),i}async initAndGetManager(e){const t=await Ppe(e),i=new mpe(e);return t.register("authEvent",r=>(Qt(r==null?void 0:r.authEvent,e,"invalid-auth-event"),{status:i.onEvent(r.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:i},this.iframes[e._key()]=t,i}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Vb,{type:Vb},r=>{var s;const o=(s=r==null?void 0:r[0])===null||s===void 0?void 0:s[Vb];o!==void 0&&t(!!o),Aa(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=xpe(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Y8()||G8()||kN()}}const jpe=Gpe;var oU="@firebase/auth",aU="1.7.9";/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Wpe{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged(i=>{e((i==null?void 0:i.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){Qt(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Kpe(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Xpe(n){Md(new Du("auth",(e,{options:t})=>{const i=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=i.options;Qt(o&&!o.includes(":"),"invalid-api-key",{appName:i.name});const l={apiKey:o,authDomain:a,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:$8(n)},c=new hfe(i,r,s,l);return xfe(c,t),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,i)=>{e.getProvider("auth-internal").initialize()})),Md(new Du("auth-internal",e=>{const t=Jd(e.getProvider("auth").getImmediate());return(i=>new Wpe(i))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),qa(oU,aU,Kpe(n)),qa(oU,aU,"esm2017")}/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const qpe=5*60,Ype=Q6("authIdTokenMaxAge")||qpe;let lU=null;const $pe=n=>async e=>{const t=e&&await e.getIdTokenResult(),i=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(i&&i>Ype)return;const r=t==null?void 0:t.token;lU!==r&&(lU=r,await fetch(n,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))};function Jpe(n=H2()){const e=NA(n,"auth");if(e.isInitialized())return e.getImmediate();const t=_fe(n,{popupRedirectResolver:jpe,persistence:[tpe,Gfe,oW]}),i=Q6("authTokenSyncURL");if(i&&typeof isSecureContext=="boolean"&&isSecureContext){const s=new URL(i,location.origin);if(location.origin===s.origin){const o=$pe(s.toString());Ffe(t,o,()=>o(t.currentUser)),Ofe(t,a=>o(a))}}const r=Y6("auth");return r&&wfe(t,`http://${r}`),t}function Qpe(){var n,e;return(e=(n=document.getElementsByTagName("head"))===null||n===void 0?void 0:n[0])!==null&&e!==void 0?e:document}dfe({loadJS(n){return new Promise((e,t)=>{const i=document.createElement("script");i.setAttribute("src",n),i.onload=e,i.onerror=r=>{const s=Ja("internal-error");s.customData=r,t(s)},i.type="text/javascript",i.charset="UTF-8",Qpe().appendChild(i)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Xpe("Browser");var cU={};const uU="@firebase/database",hU="1.0.8";/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let fW="";function Zpe(n){fW=n}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class eme{constructor(e){this.domStorage_=e,this.prefix_="firebase:"}set(e,t){t==null?this.domStorage_.removeItem(this.prefixedName_(e)):this.domStorage_.setItem(this.prefixedName_(e),Tr(t))}get(e){const t=this.domStorage_.getItem(this.prefixedName_(e));return t==null?null:w0(t)}remove(e){this.domStorage_.removeItem(this.prefixedName_(e))}prefixedName_(e){return this.prefix_+e}toString(){return this.domStorage_.toString()}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class tme{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(e,t){t==null?delete this.cache_[e]:this.cache_[e]=t}get(e){return pc(this.cache_,e)?this.cache_[e]:null}remove(e){delete this.cache_[e]}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const pW=function(n){try{if(typeof window<"u"&&typeof window[n]<"u"){const e=window[n];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new eme(e)}}catch{}return new tme},$h=pW("localStorage"),nme=pW("sessionStorage");/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Lp=new PA("@firebase/database"),ime=function(){let n=1;return function(){return n++}}(),mW=function(n){const e=Nle(n),t=new Cle;t.update(e);const i=t.digest();return F2.encodeByteArray(i)},Tv=function(...n){let e="";for(let t=0;t<n.length;t++){const i=n[t];Array.isArray(i)||i&&typeof i=="object"&&typeof i.length=="number"?e+=Tv.apply(null,i):typeof i=="object"?e+=Tr(i):e+=i,e+=" "}return e};let ky=null,dU=!0;const rme=function(n,e){yt(!e,"Can't turn on custom loggers persistently."),Lp.logLevel=Sn.VERBOSE,ky=Lp.log.bind(Lp)},Qr=function(...n){if(dU===!0&&(dU=!1,ky===null&&nme.get("logging_enabled")===!0&&rme()),ky){const e=Tv.apply(null,n);ky(e)}},bv=function(n){return function(...e){Qr(n,...e)}},lR=function(...n){const e="FIREBASE INTERNAL ERROR: "+Tv(...n);Lp.error(e)},lc=function(...n){const e=`FIREBASE FATAL ERROR: ${Tv(...n)}`;throw Lp.error(e),new Error(e)},ho=function(...n){const e="FIREBASE WARNING: "+Tv(...n);Lp.warn(e)},sme=function(){typeof window<"u"&&window.location&&window.location.protocol&&window.location.protocol.indexOf("https:")!==-1&&ho("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().")},gW=function(n){return typeof n=="number"&&(n!==n||n===Number.POSITIVE_INFINITY||n===Number.NEGATIVE_INFINITY)},ome=function(n){if(document.readyState==="complete")n();else{let e=!1;const t=function(){if(!document.body){setTimeout(t,Math.floor(10));return}e||(e=!0,n())};document.addEventListener?(document.addEventListener("DOMContentLoaded",t,!1),window.addEventListener("load",t,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",()=>{document.readyState==="complete"&&t()}),window.attachEvent("onload",t))}},mm="[MIN_NAME]",Ld="[MAX_NAME]",Gm=function(n,e){if(n===e)return 0;if(n===mm||e===Ld)return-1;if(e===mm||n===Ld)return 1;{const t=fU(n),i=fU(e);return t!==null?i!==null?t-i===0?n.length-e.length:t-i:-1:i!==null?1:n<e?-1:1}},ame=function(n,e){return n===e?0:n<e?-1:1},Ng=function(n,e){if(e&&n in e)return e[n];throw new Error("Missing required key ("+n+") in object: "+Tr(e))},VN=function(n){if(typeof n!="object"||n===null)return Tr(n);const e=[];for(const i in n)e.push(i);e.sort();let t="{";for(let i=0;i<e.length;i++)i!==0&&(t+=","),t+=Tr(e[i]),t+=":",t+=VN(n[e[i]]);return t+="}",t},yW=function(n,e){const t=n.length;if(t<=e)return[n];const i=[];for(let r=0;r<t;r+=e)r+e>t?i.push(n.substring(r,t)):i.push(n.substring(r,r+e));return i};function Ho(n,e){for(const t in n)n.hasOwnProperty(t)&&e(t,n[t])}const vW=function(n){yt(!gW(n),"Invalid JSON number");const e=11,t=52,i=(1<<e-1)-1;let r,s,o,a,l;n===0?(s=0,o=0,r=1/n===-1/0?1:0):(r=n<0,n=Math.abs(n),n>=Math.pow(2,1-i)?(a=Math.min(Math.floor(Math.log(n)/Math.LN2),i),s=a+i,o=Math.round(n*Math.pow(2,t-a)-Math.pow(2,t))):(s=0,o=Math.round(n/Math.pow(2,1-i-t))));const c=[];for(l=t;l;l-=1)c.push(o%2?1:0),o=Math.floor(o/2);for(l=e;l;l-=1)c.push(s%2?1:0),s=Math.floor(s/2);c.push(r?1:0),c.reverse();const u=c.join("");let h="";for(l=0;l<64;l+=8){let f=parseInt(u.substr(l,8),2).toString(16);f.length===1&&(f="0"+f),h=h+f}return h.toLowerCase()},lme=function(){return!!(typeof window=="object"&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))},cme=function(){return typeof Windows=="object"&&typeof Windows.UI=="object"},ume=new RegExp("^-?(0*)\\d{1,10}$"),hme=-2147483648,dme=2147483647,fU=function(n){if(ume.test(n)){const e=Number(n);if(e>=hme&&e<=dme)return e}return null},Cv=function(n){try{n()}catch(e){setTimeout(()=>{const t=e.stack||"";throw ho("Exception was thrown by user callback.",t),e},Math.floor(0))}},fme=function(){return(typeof window=="object"&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},By=function(n,e){const t=setTimeout(n,e);return typeof t=="number"&&typeof Deno<"u"&&Deno.unrefTimer?Deno.unrefTimer(t):typeof t=="object"&&t.unref&&t.unref(),t};/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class pme{constructor(e,t){this.appName_=e,this.appCheckProvider=t,this.appCheck=t==null?void 0:t.getImmediate({optional:!0}),this.appCheck||t==null||t.get().then(i=>this.appCheck=i)}getToken(e){return this.appCheck?this.appCheck.getToken(e):new Promise((t,i)=>{setTimeout(()=>{this.appCheck?this.getToken(e).then(t,i):t(null)},0)})}addTokenChangeListener(e){var t;(t=this.appCheckProvider)===null||t===void 0||t.get().then(i=>i.addTokenListener(e))}notifyForInvalidToken(){ho(`Provided AppCheck credentials for the app named "${this.appName_}" are invalid. This usually indicates your app was not initialized correctly.`)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class mme{constructor(e,t,i){this.appName_=e,this.firebaseOptions_=t,this.authProvider_=i,this.auth_=null,this.auth_=i.getImmediate({optional:!0}),this.auth_||i.onInit(r=>this.auth_=r)}getToken(e){return this.auth_?this.auth_.getToken(e).catch(t=>t&&t.code==="auth/token-not-initialized"?(Qr("Got auth/token-not-initialized error.  Treating as null token."),null):Promise.reject(t)):new Promise((t,i)=>{setTimeout(()=>{this.auth_?this.getToken(e).then(t,i):t(null)},0)})}addTokenChangeListener(e){this.auth_?this.auth_.addAuthTokenListener(e):this.authProvider_.get().then(t=>t.addAuthTokenListener(e))}removeTokenChangeListener(e){this.authProvider_.get().then(t=>t.removeAuthTokenListener(e))}notifyForInvalidToken(){let e='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?e+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?e+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':e+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',ho(e)}}class jw{constructor(e){this.accessToken=e}getToken(e){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(e){e(this.accessToken)}removeTokenChangeListener(e){}notifyForInvalidToken(){}}jw.OWNER="owner";/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const zN="5",_W="v",xW="s",wW="r",EW="f",AW=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,SW="ls",TW="p",cR="ac",bW="websocket",CW="long_polling";/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class MW{constructor(e,t,i,r,s=!1,o="",a=!1,l=!1){this.secure=t,this.namespace=i,this.webSocketOnly=r,this.nodeAdmin=s,this.persistenceKey=o,this.includeNamespaceInQueryParams=a,this.isUsingEmulator=l,this._host=e.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=$h.get("host:"+e)||this._host}isCacheableHost(){return this.internalHost.substr(0,2)==="s-"}isCustomHost(){return this._domain!=="firebaseio.com"&&this._domain!=="firebaseio-demo.com"}get host(){return this._host}set host(e){e!==this.internalHost&&(this.internalHost=e,this.isCacheableHost()&&$h.set("host:"+this._host,this.internalHost))}toString(){let e=this.toURLString();return this.persistenceKey&&(e+="<"+this.persistenceKey+">"),e}toURLString(){const e=this.secure?"https://":"http://",t=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${e}${this.host}/${t}`}}function gme(n){return n.host!==n.internalHost||n.isCustomHost()||n.includeNamespaceInQueryParams}function IW(n,e,t){yt(typeof e=="string","typeof type must == string"),yt(typeof t=="object","typeof params must == object");let i;if(e===bW)i=(n.secure?"wss://":"ws://")+n.internalHost+"/.ws?";else if(e===CW)i=(n.secure?"https://":"http://")+n.internalHost+"/.lp?";else throw new Error("Unknown connection type: "+e);gme(n)&&(t.ns=n.namespace);const r=[];return Ho(t,(s,o)=>{r.push(s+"="+o)}),i+r.join("&")}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class yme{constructor(){this.counters_={}}incrementCounter(e,t=1){pc(this.counters_,e)||(this.counters_[e]=0),this.counters_[e]+=t}get(){return cle(this.counters_)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const zb={},Hb={};function HN(n){const e=n.toString();return zb[e]||(zb[e]=new yme),zb[e]}function vme(n,e){const t=n.toString();return Hb[t]||(Hb[t]=e()),Hb[t]}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class _me{constructor(e){this.onMessage_=e,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(e,t){this.closeAfterResponse=e,this.onClose=t,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)}handleResponse(e,t){for(this.pendingResponses[e]=t;this.pendingResponses[this.currentResponseNum];){const i=this.pendingResponses[this.currentResponseNum];delete this.pendingResponses[this.currentResponseNum];for(let r=0;r<i.length;++r)i[r]&&Cv(()=>{this.onMessage_(i[r])});if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const pU="start",xme="close",wme="pLPCommand",Eme="pRTLPCB",RW="id",PW="pw",NW="ser",Ame="cb",Sme="seg",Tme="ts",bme="d",Cme="dframe",DW=1870,LW=30,Mme=DW-LW,Ime=25e3,Rme=3e4;class mp{constructor(e,t,i,r,s,o,a){this.connId=e,this.repoInfo=t,this.applicationId=i,this.appCheckToken=r,this.authToken=s,this.transportSessionId=o,this.lastSessionId=a,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=bv(e),this.stats_=HN(t),this.urlFn=l=>(this.appCheckToken&&(l[cR]=this.appCheckToken),IW(t,CW,l))}open(e,t){this.curSegmentNum=0,this.onDisconnect_=t,this.myPacketOrderer=new _me(e),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(Rme)),ome(()=>{if(this.isClosed_)return;this.scriptTagHolder=new GN((...s)=>{const[o,a,l,c,u]=s;if(this.incrementIncomingBytes_(s),!!this.scriptTagHolder)if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,o===pU)this.id=a,this.password=l;else if(o===xme)a?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(a,()=>{this.onClosed_()})):this.onClosed_();else throw new Error("Unrecognized command received: "+o)},(...s)=>{const[o,a]=s;this.incrementIncomingBytes_(s),this.myPacketOrderer.handleResponse(o,a)},()=>{this.onClosed_()},this.urlFn);const i={};i[pU]="t",i[NW]=Math.floor(Math.random()*1e8),this.scriptTagHolder.uniqueCallbackIdentifier&&(i[Ame]=this.scriptTagHolder.uniqueCallbackIdentifier),i[_W]=zN,this.transportSessionId&&(i[xW]=this.transportSessionId),this.lastSessionId&&(i[SW]=this.lastSessionId),this.applicationId&&(i[TW]=this.applicationId),this.appCheckToken&&(i[cR]=this.appCheckToken),typeof location<"u"&&location.hostname&&AW.test(location.hostname)&&(i[wW]=EW);const r=this.urlFn(i);this.log_("Connecting via long-poll to "+r),this.scriptTagHolder.addTag(r,()=>{})})}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){mp.forceAllow_=!0}static forceDisallow(){mp.forceDisallow_=!0}static isAvailable(){return mp.forceAllow_?!0:!mp.forceDisallow_&&typeof document<"u"&&document.createElement!=null&&!lme()&&!cme()}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(e){const t=Tr(e);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);const i=X6(t),r=yW(i,Mme);for(let s=0;s<r.length;s++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,r.length,r[s]),this.curSegmentNum++}addDisconnectPingFrame(e,t){this.myDisconnFrame=document.createElement("iframe");const i={};i[Cme]="t",i[RW]=e,i[PW]=t,this.myDisconnFrame.src=this.urlFn(i),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}incrementIncomingBytes_(e){const t=Tr(e).length;this.bytesReceived+=t,this.stats_.incrementCounter("bytes_received",t)}}class GN{constructor(e,t,i,r){this.onDisconnect=i,this.urlFn=r,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(Math.random()*1e8),this.sendNewPolls=!0;{this.uniqueCallbackIdentifier=ime(),window[wme+this.uniqueCallbackIdentifier]=e,window[Eme+this.uniqueCallbackIdentifier]=t,this.myIFrame=GN.createIFrame_();let s="";this.myIFrame.src&&this.myIFrame.src.substr(0,11)==="javascript:"&&(s='<script>document.domain="'+document.domain+'";<\/script>');const o="<html><body>"+s+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(o),this.myIFrame.doc.close()}catch(a){Qr("frame writing exception"),a.stack&&Qr(a.stack),Qr(a)}}}static createIFrame_(){const e=document.createElement("iframe");if(e.style.display="none",document.body){document.body.appendChild(e);try{e.contentWindow.document||Qr("No IE domain setting required")}catch{const i=document.domain;e.src="javascript:void((function(){document.open();document.domain='"+i+"';document.close();})())"}}else throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";return e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document),e}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.textContent="",setTimeout(()=>{this.myIFrame!==null&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)},Math.floor(0)));const e=this.onDisconnect;e&&(this.onDisconnect=null,e())}startLongPoll(e,t){for(this.myID=e,this.myPW=t,this.alive=!0;this.newRequest_(););}newRequest_(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;const e={};e[RW]=this.myID,e[PW]=this.myPW,e[NW]=this.currentSerial;let t=this.urlFn(e),i="",r=0;for(;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+LW+i.length<=DW;){const o=this.pendingSegs.shift();i=i+"&"+Sme+r+"="+o.seg+"&"+Tme+r+"="+o.ts+"&"+bme+r+"="+o.d,r++}return t=t+i,this.addLongPollTag_(t,this.currentSerial),!0}else return!1}enqueueSegment(e,t,i){this.pendingSegs.push({seg:e,ts:t,d:i}),this.alive&&this.newRequest_()}addLongPollTag_(e,t){this.outstandingRequests.add(t);const i=()=>{this.outstandingRequests.delete(t),this.newRequest_()},r=setTimeout(i,Math.floor(Ime)),s=()=>{clearTimeout(r),i()};this.addTag(e,s)}addTag(e,t){setTimeout(()=>{try{if(!this.sendNewPolls)return;const i=this.myIFrame.doc.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.onload=i.onreadystatechange=function(){const r=i.readyState;(!r||r==="loaded"||r==="complete")&&(i.onload=i.onreadystatechange=null,i.parentNode&&i.parentNode.removeChild(i),t())},i.onerror=()=>{Qr("Long-poll script failed to load: "+e),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(i)}catch{}},Math.floor(1))}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Pme=16384,Nme=45e3;let Z1=null;typeof MozWebSocket<"u"?Z1=MozWebSocket:typeof WebSocket<"u"&&(Z1=WebSocket);class ua{constructor(e,t,i,r,s,o,a){this.connId=e,this.applicationId=i,this.appCheckToken=r,this.authToken=s,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=bv(this.connId),this.stats_=HN(t),this.connURL=ua.connectionURL_(t,o,a,r,i),this.nodeAdmin=t.nodeAdmin}static connectionURL_(e,t,i,r,s){const o={};return o[_W]=zN,typeof location<"u"&&location.hostname&&AW.test(location.hostname)&&(o[wW]=EW),t&&(o[xW]=t),i&&(o[SW]=i),r&&(o[cR]=r),s&&(o[TW]=s),IW(e,bW,o)}open(e,t){this.onDisconnect=t,this.onMessage=e,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,$h.set("previous_websocket_failure",!0);try{let i;tj(),this.mySock=new Z1(this.connURL,[],i)}catch(i){this.log_("Error instantiating WebSocket.");const r=i.message||i.data;r&&this.log_(r),this.onClosed_();return}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0},this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=i=>{this.handleIncomingFrame(i)},this.mySock.onerror=i=>{this.log_("WebSocket error.  Closing connection.");const r=i.message||i.data;r&&this.log_(r),this.onClosed_()}}start(){}static forceDisallow(){ua.forceDisallow_=!0}static isAvailable(){let e=!1;if(typeof navigator<"u"&&navigator.userAgent){const t=/Android ([0-9]{0,}\.[0-9]{0,})/,i=navigator.userAgent.match(t);i&&i.length>1&&parseFloat(i[1])<4.4&&(e=!0)}return!e&&Z1!==null&&!ua.forceDisallow_}static previouslyFailed(){return $h.isInMemoryStorage||$h.get("previous_websocket_failure")===!0}markConnectionHealthy(){$h.remove("previous_websocket_failure")}appendFrame_(e){if(this.frames.push(e),this.frames.length===this.totalFrames){const t=this.frames.join("");this.frames=null;const i=w0(t);this.onMessage(i)}}handleNewFrameCount_(e){this.totalFrames=e,this.frames=[]}extractFrameCount_(e){if(yt(this.frames===null,"We already have a frame buffer"),e.length<=6){const t=Number(e);if(!isNaN(t))return this.handleNewFrameCount_(t),null}return this.handleNewFrameCount_(1),e}handleIncomingFrame(e){if(this.mySock===null)return;const t=e.data;if(this.bytesReceived+=t.length,this.stats_.incrementCounter("bytes_received",t.length),this.resetKeepAlive(),this.frames!==null)this.appendFrame_(t);else{const i=this.extractFrameCount_(t);i!==null&&this.appendFrame_(i)}}send(e){this.resetKeepAlive();const t=Tr(e);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);const i=yW(t,Pme);i.length>1&&this.sendString_(String(i.length));for(let r=0;r<i.length;r++)this.sendString_(i[r])}shutdown_(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)}onClosed_(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))}close(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())}resetKeepAlive(){clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(()=>{this.mySock&&this.sendString_("0"),this.resetKeepAlive()},Math.floor(Nme))}sendString_(e){try{this.mySock.send(e)}catch(t){this.log_("Exception thrown from WebSocket.send():",t.message||t.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}ua.responsesRequiredToBeHealthy=2;ua.healthyTimeout=3e4;/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class L0{constructor(e){this.initTransports_(e)}static get ALL_TRANSPORTS(){return[mp,ua]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}initTransports_(e){const t=ua&&ua.isAvailable();let i=t&&!ua.previouslyFailed();if(e.webSocketOnly&&(t||ho("wss:// URL used, but browser isn't known to support websockets.  Trying anyway."),i=!0),i)this.transports_=[ua];else{const r=this.transports_=[];for(const s of L0.ALL_TRANSPORTS)s&&s.isAvailable()&&r.push(s);L0.globalTransportInitialized_=!0}}initialTransport(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")}upgradeTransport(){return this.transports_.length>1?this.transports_[1]:null}}L0.globalTransportInitialized_=!1;/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Dme=6e4,Lme=5e3,kme=10*1024,Bme=100*1024,Gb="t",mU="d",Ome="s",gU="r",Fme="e",yU="o",vU="a",_U="n",xU="p",Ume="h";class Vme{constructor(e,t,i,r,s,o,a,l,c,u){this.id=e,this.repoInfo_=t,this.applicationId_=i,this.appCheckToken_=r,this.authToken_=s,this.onMessage_=o,this.onReady_=a,this.onDisconnect_=l,this.onKill_=c,this.lastSessionId=u,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=bv("c:"+this.id+":"),this.transportManager_=new L0(t),this.log_("Connection created"),this.start_()}start_(){const e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;const t=this.connReceiver_(this.conn_),i=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(()=>{this.conn_&&this.conn_.open(t,i)},Math.floor(0));const r=e.healthyTimeout||0;r>0&&(this.healthyTimeout_=By(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>Bme?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes.  Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>kme?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes.  Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))},Math.floor(r)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(e){return t=>{e===this.conn_?this.onConnectionLost_(t):e===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(e){return t=>{this.state_!==2&&(e===this.rx_?this.onPrimaryMessageReceived_(t):e===this.secondaryConn_?this.onSecondaryMessageReceived_(t):this.log_("message on old connection"))}}sendRequest(e){const t={t:"d",d:e};this.sendData_(t)}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(e){if(Gb in e){const t=e[Gb];t===vU?this.upgradeIfSecondaryHealthy_():t===gU?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):t===yU&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(e){const t=Ng("t",e),i=Ng("d",e);if(t==="c")this.onSecondaryControl_(i);else if(t==="d")this.pendingDataMessages.push(i);else throw new Error("Unknown protocol layer: "+t)}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:xU,d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:vU,d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:_U,d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(e){const t=Ng("t",e),i=Ng("d",e);t==="c"?this.onControl_(i):t==="d"&&this.onDataMessage_(i)}onDataMessage_(e){this.onPrimaryResponse_(),this.onMessage_(e)}onPrimaryResponse_(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(e){const t=Ng(Gb,e);if(mU in e){const i=e[mU];if(t===Ume){const r=Object.assign({},i);this.repoInfo_.isUsingEmulator&&(r.h=this.repoInfo_.host),this.onHandshake_(r)}else if(t===_U){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let r=0;r<this.pendingDataMessages.length;++r)this.onDataMessage_(this.pendingDataMessages[r]);this.pendingDataMessages=[],this.tryCleanupConnection()}else t===Ome?this.onConnectionShutdown_(i):t===gU?this.onReset_(i):t===Fme?lR("Server Error: "+i):t===yU?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):lR("Unknown control packet command: "+t)}}onHandshake_(e){const t=e.ts,i=e.v,r=e.h;this.sessionId=e.s,this.repoInfo_.host=r,this.state_===0&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,t),zN!==i&&ho("Protocol version mismatch detected"),this.tryStartUpgrade_())}tryStartUpgrade_(){const e=this.transportManager_.upgradeTransport();e&&this.startUpgrade_(e)}startUpgrade_(e){this.secondaryConn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,this.sessionId),this.secondaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;const t=this.connReceiver_(this.secondaryConn_),i=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(t,i),By(()=>{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())},Math.floor(Dme))}onReset_(e){this.log_("Reset packet received.  New host: "+e),this.repoInfo_.host=e,this.state_===1?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(e,t){this.log_("Realtime connection established."),this.conn_=e,this.state_=1,this.onReady_&&(this.onReady_(t,this.sessionId),this.onReady_=null),this.primaryResponsesRequired_===0?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):By(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(Lme))}sendPingOnPrimaryIfNecessary_(){!this.isHealthy_&&this.state_===1&&(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:xU,d:{}}}))}onSecondaryConnectionLost_(){const e=this.secondaryConn_;this.secondaryConn_=null,(this.tx_===e||this.rx_===e)&&this.close()}onConnectionLost_(e){this.conn_=null,!e&&this.state_===0?(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&($h.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)):this.state_===1&&this.log_("Realtime connection lost."),this.close()}onConnectionShutdown_(e){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(e),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(e){if(this.state_!==1)throw"Connection is not connected";this.tx_.send(e)}close(){this.state_!==2&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class kW{put(e,t,i,r){}merge(e,t,i,r){}refreshAuthToken(e){}refreshAppCheckToken(e){}onDisconnectPut(e,t,i){}onDisconnectMerge(e,t,i){}onDisconnectCancel(e,t){}reportStats(e){}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class BW{constructor(e){this.allowedEvents_=e,this.listeners_={},yt(Array.isArray(e)&&e.length>0,"Requires a non-empty array")}trigger(e,...t){if(Array.isArray(this.listeners_[e])){const i=[...this.listeners_[e]];for(let r=0;r<i.length;r++)i[r].callback.apply(i[r].context,t)}}on(e,t,i){this.validateEventType_(e),this.listeners_[e]=this.listeners_[e]||[],this.listeners_[e].push({callback:t,context:i});const r=this.getInitialEvent(e);r&&t.apply(i,r)}off(e,t,i){this.validateEventType_(e);const r=this.listeners_[e]||[];for(let s=0;s<r.length;s++)if(r[s].callback===t&&(!i||i===r[s].context)){r.splice(s,1);return}}validateEventType_(e){yt(this.allowedEvents_.find(t=>t===e),"Unknown event: "+e)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class eE extends BW{constructor(){super(["online"]),this.online_=!0,typeof window<"u"&&typeof window.addEventListener<"u"&&!V2()&&(window.addEventListener("online",()=>{this.online_||(this.online_=!0,this.trigger("online",!0))},!1),window.addEventListener("offline",()=>{this.online_&&(this.online_=!1,this.trigger("online",!1))},!1))}static getInstance(){return new eE}getInitialEvent(e){return yt(e==="online","Unknown event type: "+e),[this.online_]}currentlyOnline(){return this.online_}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const wU=32,EU=768;let pi=class{constructor(e,t){if(t===void 0){this.pieces_=e.split("/");let i=0;for(let r=0;r<this.pieces_.length;r++)this.pieces_[r].length>0&&(this.pieces_[i]=this.pieces_[r],i++);this.pieces_.length=i,this.pieceNum_=0}else this.pieces_=e,this.pieceNum_=t}toString(){let e="";for(let t=this.pieceNum_;t<this.pieces_.length;t++)this.pieces_[t]!==""&&(e+="/"+this.pieces_[t]);return e||"/"}};function Zn(){return new pi("")}function Ln(n){return n.pieceNum_>=n.pieces_.length?null:n.pieces_[n.pieceNum_]}function Uu(n){return n.pieces_.length-n.pieceNum_}function ci(n){let e=n.pieceNum_;return e<n.pieces_.length&&e++,new pi(n.pieces_,e)}function OW(n){return n.pieceNum_<n.pieces_.length?n.pieces_[n.pieces_.length-1]:null}function zme(n){let e="";for(let t=n.pieceNum_;t<n.pieces_.length;t++)n.pieces_[t]!==""&&(e+="/"+encodeURIComponent(String(n.pieces_[t])));return e||"/"}function FW(n,e=0){return n.pieces_.slice(n.pieceNum_+e)}function UW(n){if(n.pieceNum_>=n.pieces_.length)return null;const e=[];for(let t=n.pieceNum_;t<n.pieces_.length-1;t++)e.push(n.pieces_[t]);return new pi(e,0)}function gr(n,e){const t=[];for(let i=n.pieceNum_;i<n.pieces_.length;i++)t.push(n.pieces_[i]);if(e instanceof pi)for(let i=e.pieceNum_;i<e.pieces_.length;i++)t.push(e.pieces_[i]);else{const i=e.split("/");for(let r=0;r<i.length;r++)i[r].length>0&&t.push(i[r])}return new pi(t,0)}function In(n){return n.pieceNum_>=n.pieces_.length}function Bo(n,e){const t=Ln(n),i=Ln(e);if(t===null)return e;if(t===i)return Bo(ci(n),ci(e));throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+n+")")}function VW(n,e){if(Uu(n)!==Uu(e))return!1;for(let t=n.pieceNum_,i=e.pieceNum_;t<=n.pieces_.length;t++,i++)if(n.pieces_[t]!==e.pieces_[i])return!1;return!0}function ha(n,e){let t=n.pieceNum_,i=e.pieceNum_;if(Uu(n)>Uu(e))return!1;for(;t<n.pieces_.length;){if(n.pieces_[t]!==e.pieces_[i])return!1;++t,++i}return!0}class Hme{constructor(e,t){this.errorPrefix_=t,this.parts_=FW(e,0),this.byteLength_=Math.max(1,this.parts_.length);for(let i=0;i<this.parts_.length;i++)this.byteLength_+=RA(this.parts_[i]);zW(this)}}function Gme(n,e){n.parts_.length>0&&(n.byteLength_+=1),n.parts_.push(e),n.byteLength_+=RA(e),zW(n)}function jme(n){const e=n.parts_.pop();n.byteLength_-=RA(e),n.parts_.length>0&&(n.byteLength_-=1)}function zW(n){if(n.byteLength_>EU)throw new Error(n.errorPrefix_+"has a key path longer than "+EU+" bytes ("+n.byteLength_+").");if(n.parts_.length>wU)throw new Error(n.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+wU+") or object contains a cycle "+Fh(n))}function Fh(n){return n.parts_.length===0?"":"in property '"+n.parts_.join(".")+"'"}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class jN extends BW{constructor(){super(["visible"]);let e,t;typeof document<"u"&&typeof document.addEventListener<"u"&&(typeof document.hidden<"u"?(t="visibilitychange",e="hidden"):typeof document.mozHidden<"u"?(t="mozvisibilitychange",e="mozHidden"):typeof document.msHidden<"u"?(t="msvisibilitychange",e="msHidden"):typeof document.webkitHidden<"u"&&(t="webkitvisibilitychange",e="webkitHidden")),this.visible_=!0,t&&document.addEventListener(t,()=>{const i=!document[e];i!==this.visible_&&(this.visible_=i,this.trigger("visible",i))},!1)}static getInstance(){return new jN}getInitialEvent(e){return yt(e==="visible","Unknown event type: "+e),[this.visible_]}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Dg=1e3,Wme=60*5*1e3,AU=30*1e3,Kme=1.3,Xme=3e4,qme="server_kill",SU=3;class Yl extends kW{constructor(e,t,i,r,s,o,a,l){if(super(),this.repoInfo_=e,this.applicationId_=t,this.onDataUpdate_=i,this.onConnectStatus_=r,this.onServerInfoUpdate_=s,this.authTokenProvider_=o,this.appCheckTokenProvider_=a,this.authOverride_=l,this.id=Yl.nextPersistentConnectionId_++,this.log_=bv("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=Dg,this.maxReconnectDelay_=Wme,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,l&&!tj())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");jN.getInstance().on("visible",this.onVisible_,this),e.host.indexOf("fblocal")===-1&&eE.getInstance().on("online",this.onOnline_,this)}sendRequest(e,t,i){const r=++this.requestNumber_,s={r,a:e,b:t};this.log_(Tr(s)),yt(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(s),i&&(this.requestCBHash_[r]=i)}get(e){this.initConnection_();const t=new U2,r={action:"g",request:{p:e._path.toString(),q:e._queryObject},onComplete:o=>{const a=o.d;o.s==="ok"?t.resolve(a):t.reject(a)}};this.outstandingGets_.push(r),this.outstandingGetCount_++;const s=this.outstandingGets_.length-1;return this.connected_&&this.sendGet_(s),t.promise}listen(e,t,i,r){this.initConnection_();const s=e._queryIdentifier,o=e._path.toString();this.log_("Listen called for "+o+" "+s),this.listens.has(o)||this.listens.set(o,new Map),yt(e._queryParams.isDefault()||!e._queryParams.loadsAllData(),"listen() called for non-default but complete query"),yt(!this.listens.get(o).has(s),"listen() called twice for same path/queryId.");const a={onComplete:r,hashFn:t,query:e,tag:i};this.listens.get(o).set(s,a),this.connected_&&this.sendListen_(a)}sendGet_(e){const t=this.outstandingGets_[e];this.sendRequest("g",t.request,i=>{delete this.outstandingGets_[e],this.outstandingGetCount_--,this.outstandingGetCount_===0&&(this.outstandingGets_=[]),t.onComplete&&t.onComplete(i)})}sendListen_(e){const t=e.query,i=t._path.toString(),r=t._queryIdentifier;this.log_("Listen on "+i+" for "+r);const s={p:i},o="q";e.tag&&(s.q=t._queryObject,s.t=e.tag),s.h=e.hashFn(),this.sendRequest(o,s,a=>{const l=a.d,c=a.s;Yl.warnOnListenWarnings_(l,t),(this.listens.get(i)&&this.listens.get(i).get(r))===e&&(this.log_("listen response",a),c!=="ok"&&this.removeListen_(i,r),e.onComplete&&e.onComplete(c,l))})}static warnOnListenWarnings_(e,t){if(e&&typeof e=="object"&&pc(e,"w")){const i=am(e,"w");if(Array.isArray(i)&&~i.indexOf("no_index")){const r='".indexOn": "'+t._queryParams.getIndex().toString()+'"',s=t._path.toString();ho(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${r} at ${s} to your security rules for better performance.`)}}}refreshAuthToken(e){this.authToken_=e,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},()=>{}),this.reduceReconnectDelayIfAdminCredential_(e)}reduceReconnectDelayIfAdminCredential_(e){(e&&e.length===40||ble(e))&&(this.log_("Admin auth credential detected.  Reducing max reconnect time."),this.maxReconnectDelay_=AU)}refreshAppCheckToken(e){this.appCheckToken_=e,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},()=>{})}tryAuth(){if(this.connected_&&this.authToken_){const e=this.authToken_,t=Tle(e)?"auth":"gauth",i={cred:e};this.authOverride_===null?i.noauth=!0:typeof this.authOverride_=="object"&&(i.authvar=this.authOverride_),this.sendRequest(t,i,r=>{const s=r.s,o=r.d||"error";this.authToken_===e&&(s==="ok"?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(s,o))})}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},e=>{const t=e.s,i=e.d||"error";t==="ok"?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(t,i)})}unlisten(e,t){const i=e._path.toString(),r=e._queryIdentifier;this.log_("Unlisten called for "+i+" "+r),yt(e._queryParams.isDefault()||!e._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(i,r)&&this.connected_&&this.sendUnlisten_(i,r,e._queryObject,t)}sendUnlisten_(e,t,i,r){this.log_("Unlisten on "+e+" for "+t);const s={p:e},o="n";r&&(s.q=i,s.t=r),this.sendRequest(o,s)}onDisconnectPut(e,t,i){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",e,t,i):this.onDisconnectRequestQueue_.push({pathString:e,action:"o",data:t,onComplete:i})}onDisconnectMerge(e,t,i){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",e,t,i):this.onDisconnectRequestQueue_.push({pathString:e,action:"om",data:t,onComplete:i})}onDisconnectCancel(e,t){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",e,null,t):this.onDisconnectRequestQueue_.push({pathString:e,action:"oc",data:null,onComplete:t})}sendOnDisconnect_(e,t,i,r){const s={p:t,d:i};this.log_("onDisconnect "+e,s),this.sendRequest(e,s,o=>{r&&setTimeout(()=>{r(o.s,o.d)},Math.floor(0))})}put(e,t,i,r){this.putInternal("p",e,t,i,r)}merge(e,t,i,r){this.putInternal("m",e,t,i,r)}putInternal(e,t,i,r,s){this.initConnection_();const o={p:t,d:i};s!==void 0&&(o.h=s),this.outstandingPuts_.push({action:e,request:o,onComplete:r}),this.outstandingPutCount_++;const a=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(a):this.log_("Buffering put: "+t)}sendPut_(e){const t=this.outstandingPuts_[e].action,i=this.outstandingPuts_[e].request,r=this.outstandingPuts_[e].onComplete;this.outstandingPuts_[e].queued=this.connected_,this.sendRequest(t,i,s=>{this.log_(t+" response",s),delete this.outstandingPuts_[e],this.outstandingPutCount_--,this.outstandingPutCount_===0&&(this.outstandingPuts_=[]),r&&r(s.s,s.d)})}reportStats(e){if(this.connected_){const t={c:e};this.log_("reportStats",t),this.sendRequest("s",t,i=>{if(i.s!=="ok"){const s=i.d;this.log_("reportStats","Error sending stats: "+s)}})}}onDataMessage_(e){if("r"in e){this.log_("from server: "+Tr(e));const t=e.r,i=this.requestCBHash_[t];i&&(delete this.requestCBHash_[t],i(e.b))}else{if("error"in e)throw"A server-side error has occurred: "+e.error;"a"in e&&this.onDataPush_(e.a,e.b)}}onDataPush_(e,t){this.log_("handleServerMessage",e,t),e==="d"?this.onDataUpdate_(t.p,t.d,!1,t.t):e==="m"?this.onDataUpdate_(t.p,t.d,!0,t.t):e==="c"?this.onListenRevoked_(t.p,t.q):e==="ac"?this.onAuthRevoked_(t.s,t.d):e==="apc"?this.onAppCheckRevoked_(t.s,t.d):e==="sd"?this.onSecurityDebugPacket_(t):lR("Unrecognized action received from server: "+Tr(e)+`
Are you using the latest client?`)}onReady_(e,t){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=new Date().getTime(),this.handleTimestamp_(e),this.lastSessionId=t,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(e){yt(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(()=>{this.establishConnectionTimer_=null,this.establishConnection_()},Math.floor(e))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(e){e&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible.  Reducing delay."),this.reconnectDelay_=Dg,this.realtime_||this.scheduleConnect_(0)),this.visible_=e}onOnline_(e){e?(this.log_("Browser went online."),this.reconnectDelay_=Dg,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline.  Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&(new Date().getTime()-this.lastConnectionEstablishedTime_>Xme&&(this.reconnectDelay_=Dg),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible.  Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=new Date().getTime());const e=new Date().getTime()-this.lastConnectionAttemptTime_;let t=Math.max(0,this.reconnectDelay_-e);t=Math.random()*t,this.log_("Trying to reconnect in "+t+"ms"),this.scheduleConnect_(t),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,this.reconnectDelay_*Kme)}this.onConnectStatus_(!1)}async establishConnection_(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=new Date().getTime(),this.lastConnectionEstablishedTime_=null;const e=this.onDataMessage_.bind(this),t=this.onReady_.bind(this),i=this.onRealtimeDisconnect_.bind(this),r=this.id+":"+Yl.nextConnectionId_++,s=this.lastSessionId;let o=!1,a=null;const l=function(){a?a.close():(o=!0,i())},c=function(h){yt(a,"sendRequest call when we're not connected not allowed."),a.sendRequest(h)};this.realtime_={close:l,sendRequest:c};const u=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{const[h,f]=await Promise.all([this.authTokenProvider_.getToken(u),this.appCheckTokenProvider_.getToken(u)]);o?Qr("getToken() completed but was canceled"):(Qr("getToken() completed. Creating connection."),this.authToken_=h&&h.accessToken,this.appCheckToken_=f&&f.token,a=new Vme(r,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,e,t,i,m=>{ho(m+" ("+this.repoInfo_.toString()+")"),this.interrupt(qme)},s))}catch(h){this.log_("Failed to get token: "+h),o||(this.repoInfo_.nodeAdmin&&ho(h),l())}}}interrupt(e){Qr("Interrupting connection for reason: "+e),this.interruptReasons_[e]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(e){Qr("Resuming connection for reason: "+e),delete this.interruptReasons_[e],kI(this.interruptReasons_)&&(this.reconnectDelay_=Dg,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(e){const t=e-new Date().getTime();this.onServerInfoUpdate_({serverTimeOffset:t})}cancelSentTransactions_(){for(let e=0;e<this.outstandingPuts_.length;e++){const t=this.outstandingPuts_[e];t&&"h"in t.request&&t.queued&&(t.onComplete&&t.onComplete("disconnect"),delete this.outstandingPuts_[e],this.outstandingPutCount_--)}this.outstandingPutCount_===0&&(this.outstandingPuts_=[])}onListenRevoked_(e,t){let i;t?i=t.map(s=>VN(s)).join("$"):i="default";const r=this.removeListen_(e,i);r&&r.onComplete&&r.onComplete("permission_denied")}removeListen_(e,t){const i=new pi(e).toString();let r;if(this.listens.has(i)){const s=this.listens.get(i);r=s.get(t),s.delete(t),s.size===0&&this.listens.delete(i)}else r=void 0;return r}onAuthRevoked_(e,t){Qr("Auth token revoked: "+e+"/"+t),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),(e==="invalid_token"||e==="permission_denied")&&(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=SU&&(this.reconnectDelay_=AU,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(e,t){Qr("App check token revoked: "+e+"/"+t),this.appCheckToken_=null,this.forceTokenRefresh_=!0,(e==="invalid_token"||e==="permission_denied")&&(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=SU&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(e){this.securityDebugCallback_?this.securityDebugCallback_(e):"msg"in e&&console.log("FIREBASE: "+e.msg.replace(`
`,`
FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of this.listens.values())for(const t of e.values())this.sendListen_(t);for(let e=0;e<this.outstandingPuts_.length;e++)this.outstandingPuts_[e]&&this.sendPut_(e);for(;this.onDisconnectRequestQueue_.length;){const e=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(e.action,e.pathString,e.data,e.onComplete)}for(let e=0;e<this.outstandingGets_.length;e++)this.outstandingGets_[e]&&this.sendGet_(e)}sendConnectStats_(){const e={};let t="js";e["sdk."+t+"."+fW.replace(/\./g,"-")]=1,V2()?e["framework.cordova"]=1:ej()&&(e["framework.reactnative"]=1),this.reportStats(e)}shouldReconnect_(){const e=eE.getInstance().currentlyOnline();return kI(this.interruptReasons_)&&e}}Yl.nextPersistentConnectionId_=0;Yl.nextConnectionId_=0;/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class kn{constructor(e,t){this.name=e,this.node=t}static Wrap(e,t){return new kn(e,t)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let iS=class{getCompare(){return this.compare.bind(this)}indexedValueChanged(e,t){const i=new kn(mm,e),r=new kn(mm,t);return this.compare(i,r)!==0}minPost(){return kn.MIN}};/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let fx;class HW extends iS{static get __EMPTY_NODE(){return fx}static set __EMPTY_NODE(e){fx=e}compare(e,t){return Gm(e.name,t.name)}isDefinedOn(e){throw Bm("KeyIndex.isDefinedOn not expected to be called.")}indexedValueChanged(e,t){return!1}minPost(){return kn.MIN}maxPost(){return new kn(Ld,fx)}makePost(e,t){return yt(typeof e=="string","KeyIndex indexValue must always be a string."),new kn(e,fx)}toString(){return".key"}}const kp=new HW;/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class px{constructor(e,t,i,r,s=null){this.isReverse_=r,this.resultGenerator_=s,this.nodeStack_=[];let o=1;for(;!e.isEmpty();)if(e=e,o=t?i(e.key,t):1,r&&(o*=-1),o<0)this.isReverse_?e=e.left:e=e.right;else if(o===0){this.nodeStack_.push(e);break}else this.nodeStack_.push(e),this.isReverse_?e=e.right:e=e.left}getNext(){if(this.nodeStack_.length===0)return null;let e=this.nodeStack_.pop(),t;if(this.resultGenerator_?t=this.resultGenerator_(e.key,e.value):t={key:e.key,value:e.value},this.isReverse_)for(e=e.left;!e.isEmpty();)this.nodeStack_.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack_.push(e),e=e.left;return t}hasNext(){return this.nodeStack_.length>0}peek(){if(this.nodeStack_.length===0)return null;const e=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value}}}class mr{constructor(e,t,i,r,s){this.key=e,this.value=t,this.color=i??mr.RED,this.left=r??Os.EMPTY_NODE,this.right=s??Os.EMPTY_NODE}copy(e,t,i,r,s){return new mr(e??this.key,t??this.value,i??this.color,r??this.left,s??this.right)}count(){return this.left.count()+1+this.right.count()}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||!!e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min_(){return this.left.isEmpty()?this:this.left.min_()}minKey(){return this.min_().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,i){let r=this;const s=i(e,r.key);return s<0?r=r.copy(null,null,null,r.left.insert(e,t,i),null):s===0?r=r.copy(null,t,null,null,null):r=r.copy(null,null,null,null,r.right.insert(e,t,i)),r.fixUp_()}removeMin_(){if(this.left.isEmpty())return Os.EMPTY_NODE;let e=this;return!e.left.isRed_()&&!e.left.left.isRed_()&&(e=e.moveRedLeft_()),e=e.copy(null,null,null,e.left.removeMin_(),null),e.fixUp_()}remove(e,t){let i,r;if(i=this,t(e,i.key)<0)!i.left.isEmpty()&&!i.left.isRed_()&&!i.left.left.isRed_()&&(i=i.moveRedLeft_()),i=i.copy(null,null,null,i.left.remove(e,t),null);else{if(i.left.isRed_()&&(i=i.rotateRight_()),!i.right.isEmpty()&&!i.right.isRed_()&&!i.right.left.isRed_()&&(i=i.moveRedRight_()),t(e,i.key)===0){if(i.right.isEmpty())return Os.EMPTY_NODE;r=i.right.min_(),i=i.copy(r.key,r.value,null,null,i.right.removeMin_())}i=i.copy(null,null,null,null,i.right.remove(e,t))}return i.fixUp_()}isRed_(){return this.color}fixUp_(){let e=this;return e.right.isRed_()&&!e.left.isRed_()&&(e=e.rotateLeft_()),e.left.isRed_()&&e.left.left.isRed_()&&(e=e.rotateRight_()),e.left.isRed_()&&e.right.isRed_()&&(e=e.colorFlip_()),e}moveRedLeft_(){let e=this.colorFlip_();return e.right.left.isRed_()&&(e=e.copy(null,null,null,null,e.right.rotateRight_()),e=e.rotateLeft_(),e=e.colorFlip_()),e}moveRedRight_(){let e=this.colorFlip_();return e.left.left.isRed_()&&(e=e.rotateRight_(),e=e.colorFlip_()),e}rotateLeft_(){const e=this.copy(null,null,mr.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight_(){const e=this.copy(null,null,mr.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip_(){const e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth_(){const e=this.check_();return Math.pow(2,e)<=this.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");const e=this.left.check_();if(e!==this.right.check_())throw new Error("Black depths differ");return e+(this.isRed_()?0:1)}}mr.RED=!0;mr.BLACK=!1;class Yme{copy(e,t,i,r,s){return this}insert(e,t,i){return new mr(e,t,null)}remove(e,t){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}}class Os{constructor(e,t=Os.EMPTY_NODE){this.comparator_=e,this.root_=t}insert(e,t){return new Os(this.comparator_,this.root_.insert(e,t,this.comparator_).copy(null,null,mr.BLACK,null,null))}remove(e){return new Os(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,mr.BLACK,null,null))}get(e){let t,i=this.root_;for(;!i.isEmpty();){if(t=this.comparator_(e,i.key),t===0)return i.value;t<0?i=i.left:t>0&&(i=i.right)}return null}getPredecessorKey(e){let t,i=this.root_,r=null;for(;!i.isEmpty();)if(t=this.comparator_(e,i.key),t===0){if(i.left.isEmpty())return r?r.key:null;for(i=i.left;!i.right.isEmpty();)i=i.right;return i.key}else t<0?i=i.left:t>0&&(r=i,i=i.right);throw new Error("Attempted to find predecessor key for a nonexistent key.  What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(e){return this.root_.inorderTraversal(e)}reverseTraversal(e){return this.root_.reverseTraversal(e)}getIterator(e){return new px(this.root_,null,this.comparator_,!1,e)}getIteratorFrom(e,t){return new px(this.root_,e,this.comparator_,!1,t)}getReverseIteratorFrom(e,t){return new px(this.root_,e,this.comparator_,!0,t)}getReverseIterator(e){return new px(this.root_,null,this.comparator_,!0,e)}}Os.EMPTY_NODE=new Yme;/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function $me(n,e){return Gm(n.name,e.name)}function WN(n,e){return Gm(n,e)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let uR;function Jme(n){uR=n}const GW=function(n){return typeof n=="number"?"number:"+vW(n):"string:"+n},jW=function(n){if(n.isLeafNode()){const e=n.val();yt(typeof e=="string"||typeof e=="number"||typeof e=="object"&&pc(e,".sv"),"Priority must be a string or number.")}else yt(n===uR||n.isEmpty(),"priority of unexpected type.");yt(n===uR||n.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let TU;class dr{constructor(e,t=dr.__childrenNodeConstructor.EMPTY_NODE){this.value_=e,this.priorityNode_=t,this.lazyHash_=null,yt(this.value_!==void 0&&this.value_!==null,"LeafNode shouldn't be created with null/undefined value."),jW(this.priorityNode_)}static set __childrenNodeConstructor(e){TU=e}static get __childrenNodeConstructor(){return TU}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(e){return new dr(this.value_,e)}getImmediateChild(e){return e===".priority"?this.priorityNode_:dr.__childrenNodeConstructor.EMPTY_NODE}getChild(e){return In(e)?this:Ln(e)===".priority"?this.priorityNode_:dr.__childrenNodeConstructor.EMPTY_NODE}hasChild(){return!1}getPredecessorChildName(e,t){return null}updateImmediateChild(e,t){return e===".priority"?this.updatePriority(t):t.isEmpty()&&e!==".priority"?this:dr.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(e,t).updatePriority(this.priorityNode_)}updateChild(e,t){const i=Ln(e);return i===null?t:t.isEmpty()&&i!==".priority"?this:(yt(i!==".priority"||Uu(e)===1,".priority must be the last token in a path"),this.updateImmediateChild(i,dr.__childrenNodeConstructor.EMPTY_NODE.updateChild(ci(e),t)))}isEmpty(){return!1}numChildren(){return 0}forEachChild(e,t){return!1}val(e){return e&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()}hash(){if(this.lazyHash_===null){let e="";this.priorityNode_.isEmpty()||(e+="priority:"+GW(this.priorityNode_.val())+":");const t=typeof this.value_;e+=t+":",t==="number"?e+=vW(this.value_):e+=this.value_,this.lazyHash_=mW(e)}return this.lazyHash_}getValue(){return this.value_}compareTo(e){return e===dr.__childrenNodeConstructor.EMPTY_NODE?1:e instanceof dr.__childrenNodeConstructor?-1:(yt(e.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(e))}compareToLeafNode_(e){const t=typeof e.value_,i=typeof this.value_,r=dr.VALUE_TYPE_ORDER.indexOf(t),s=dr.VALUE_TYPE_ORDER.indexOf(i);return yt(r>=0,"Unknown leaf type: "+t),yt(s>=0,"Unknown leaf type: "+i),r===s?i==="object"?0:this.value_<e.value_?-1:this.value_===e.value_?0:1:s-r}withIndex(){return this}isIndexed(){return!0}equals(e){if(e===this)return!0;if(e.isLeafNode()){const t=e;return this.value_===t.value_&&this.priorityNode_.equals(t.priorityNode_)}else return!1}}dr.VALUE_TYPE_ORDER=["object","boolean","number","string"];/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let WW,KW;function Qme(n){WW=n}function Zme(n){KW=n}class ege extends iS{compare(e,t){const i=e.node.getPriority(),r=t.node.getPriority(),s=i.compareTo(r);return s===0?Gm(e.name,t.name):s}isDefinedOn(e){return!e.getPriority().isEmpty()}indexedValueChanged(e,t){return!e.getPriority().equals(t.getPriority())}minPost(){return kn.MIN}maxPost(){return new kn(Ld,new dr("[PRIORITY-POST]",KW))}makePost(e,t){const i=WW(e);return new kn(t,new dr("[PRIORITY-POST]",i))}toString(){return".priority"}}const es=new ege;/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const tge=Math.log(2);class nge{constructor(e){const t=s=>parseInt(Math.log(s)/tge,10),i=s=>parseInt(Array(s+1).join("1"),2);this.count=t(e+1),this.current_=this.count-1;const r=i(this.count);this.bits_=e+1&r}nextBitIsOne(){const e=!(this.bits_&1<<this.current_);return this.current_--,e}}const tE=function(n,e,t,i){n.sort(e);const r=function(l,c){const u=c-l;let h,f;if(u===0)return null;if(u===1)return h=n[l],f=t?t(h):h,new mr(f,h.node,mr.BLACK,null,null);{const m=parseInt(u/2,10)+l,y=r(l,m),_=r(m+1,c);return h=n[m],f=t?t(h):h,new mr(f,h.node,mr.BLACK,y,_)}},s=function(l){let c=null,u=null,h=n.length;const f=function(y,_){const v=h-y,g=h;h-=y;const w=r(v+1,g),A=n[v],T=t?t(A):A;m(new mr(T,A.node,_,null,w))},m=function(y){c?(c.left=y,c=y):(u=y,c=y)};for(let y=0;y<l.count;++y){const _=l.nextBitIsOne(),v=Math.pow(2,l.count-(y+1));_?f(v,mr.BLACK):(f(v,mr.BLACK),f(v,mr.RED))}return u},o=new nge(n.length),a=s(o);return new Os(i||e,a)};/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let jb;const Tf={};class Gl{constructor(e,t){this.indexes_=e,this.indexSet_=t}static get Default(){return yt(Tf&&es,"ChildrenNode.ts has not been loaded"),jb=jb||new Gl({".priority":Tf},{".priority":es}),jb}get(e){const t=am(this.indexes_,e);if(!t)throw new Error("No index defined for "+e);return t instanceof Os?t:null}hasIndex(e){return pc(this.indexSet_,e.toString())}addIndex(e,t){yt(e!==kp,"KeyIndex always exists and isn't meant to be added to the IndexMap.");const i=[];let r=!1;const s=t.getIterator(kn.Wrap);let o=s.getNext();for(;o;)r=r||e.isDefinedOn(o.node),i.push(o),o=s.getNext();let a;r?a=tE(i,e.getCompare()):a=Tf;const l=e.toString(),c=Object.assign({},this.indexSet_);c[l]=e;const u=Object.assign({},this.indexes_);return u[l]=a,new Gl(u,c)}addToIndexes(e,t){const i=O1(this.indexes_,(r,s)=>{const o=am(this.indexSet_,s);if(yt(o,"Missing index implementation for "+s),r===Tf)if(o.isDefinedOn(e.node)){const a=[],l=t.getIterator(kn.Wrap);let c=l.getNext();for(;c;)c.name!==e.name&&a.push(c),c=l.getNext();return a.push(e),tE(a,o.getCompare())}else return Tf;else{const a=t.get(e.name);let l=r;return a&&(l=l.remove(new kn(e.name,a))),l.insert(e,e.node)}});return new Gl(i,this.indexSet_)}removeFromIndexes(e,t){const i=O1(this.indexes_,r=>{if(r===Tf)return r;{const s=t.get(e.name);return s?r.remove(new kn(e.name,s)):r}});return new Gl(i,this.indexSet_)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let Lg;class Xn{constructor(e,t,i){this.children_=e,this.priorityNode_=t,this.indexMap_=i,this.lazyHash_=null,this.priorityNode_&&jW(this.priorityNode_),this.children_.isEmpty()&&yt(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}static get EMPTY_NODE(){return Lg||(Lg=new Xn(new Os(WN),null,Gl.Default))}isLeafNode(){return!1}getPriority(){return this.priorityNode_||Lg}updatePriority(e){return this.children_.isEmpty()?this:new Xn(this.children_,e,this.indexMap_)}getImmediateChild(e){if(e===".priority")return this.getPriority();{const t=this.children_.get(e);return t===null?Lg:t}}getChild(e){const t=Ln(e);return t===null?this:this.getImmediateChild(t).getChild(ci(e))}hasChild(e){return this.children_.get(e)!==null}updateImmediateChild(e,t){if(yt(t,"We should always be passing snapshot nodes"),e===".priority")return this.updatePriority(t);{const i=new kn(e,t);let r,s;t.isEmpty()?(r=this.children_.remove(e),s=this.indexMap_.removeFromIndexes(i,this.children_)):(r=this.children_.insert(e,t),s=this.indexMap_.addToIndexes(i,this.children_));const o=r.isEmpty()?Lg:this.priorityNode_;return new Xn(r,o,s)}}updateChild(e,t){const i=Ln(e);if(i===null)return t;{yt(Ln(e)!==".priority"||Uu(e)===1,".priority must be the last token in a path");const r=this.getImmediateChild(i).updateChild(ci(e),t);return this.updateImmediateChild(i,r)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(e){if(this.isEmpty())return null;const t={};let i=0,r=0,s=!0;if(this.forEachChild(es,(o,a)=>{t[o]=a.val(e),i++,s&&Xn.INTEGER_REGEXP_.test(o)?r=Math.max(r,Number(o)):s=!1}),!e&&s&&r<2*i){const o=[];for(const a in t)o[a]=t[a];return o}else return e&&!this.getPriority().isEmpty()&&(t[".priority"]=this.getPriority().val()),t}hash(){if(this.lazyHash_===null){let e="";this.getPriority().isEmpty()||(e+="priority:"+GW(this.getPriority().val())+":"),this.forEachChild(es,(t,i)=>{const r=i.hash();r!==""&&(e+=":"+t+":"+r)}),this.lazyHash_=e===""?"":mW(e)}return this.lazyHash_}getPredecessorChildName(e,t,i){const r=this.resolveIndex_(i);if(r){const s=r.getPredecessorKey(new kn(e,t));return s?s.name:null}else return this.children_.getPredecessorKey(e)}getFirstChildName(e){const t=this.resolveIndex_(e);if(t){const i=t.minKey();return i&&i.name}else return this.children_.minKey()}getFirstChild(e){const t=this.getFirstChildName(e);return t?new kn(t,this.children_.get(t)):null}getLastChildName(e){const t=this.resolveIndex_(e);if(t){const i=t.maxKey();return i&&i.name}else return this.children_.maxKey()}getLastChild(e){const t=this.getLastChildName(e);return t?new kn(t,this.children_.get(t)):null}forEachChild(e,t){const i=this.resolveIndex_(e);return i?i.inorderTraversal(r=>t(r.name,r.node)):this.children_.inorderTraversal(t)}getIterator(e){return this.getIteratorFrom(e.minPost(),e)}getIteratorFrom(e,t){const i=this.resolveIndex_(t);if(i)return i.getIteratorFrom(e,r=>r);{const r=this.children_.getIteratorFrom(e.name,kn.Wrap);let s=r.peek();for(;s!=null&&t.compare(s,e)<0;)r.getNext(),s=r.peek();return r}}getReverseIterator(e){return this.getReverseIteratorFrom(e.maxPost(),e)}getReverseIteratorFrom(e,t){const i=this.resolveIndex_(t);if(i)return i.getReverseIteratorFrom(e,r=>r);{const r=this.children_.getReverseIteratorFrom(e.name,kn.Wrap);let s=r.peek();for(;s!=null&&t.compare(s,e)>0;)r.getNext(),s=r.peek();return r}}compareTo(e){return this.isEmpty()?e.isEmpty()?0:-1:e.isLeafNode()||e.isEmpty()?1:e===Mv?-1:0}withIndex(e){if(e===kp||this.indexMap_.hasIndex(e))return this;{const t=this.indexMap_.addIndex(e,this.children_);return new Xn(this.children_,this.priorityNode_,t)}}isIndexed(e){return e===kp||this.indexMap_.hasIndex(e)}equals(e){if(e===this)return!0;if(e.isLeafNode())return!1;{const t=e;if(this.getPriority().equals(t.getPriority()))if(this.children_.count()===t.children_.count()){const i=this.getIterator(es),r=t.getIterator(es);let s=i.getNext(),o=r.getNext();for(;s&&o;){if(s.name!==o.name||!s.node.equals(o.node))return!1;s=i.getNext(),o=r.getNext()}return s===null&&o===null}else return!1;else return!1}}resolveIndex_(e){return e===kp?null:this.indexMap_.get(e.toString())}}Xn.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/;class ige extends Xn{constructor(){super(new Os(WN),Xn.EMPTY_NODE,Gl.Default)}compareTo(e){return e===this?0:1}equals(e){return e===this}getPriority(){return this}getImmediateChild(e){return Xn.EMPTY_NODE}isEmpty(){return!1}}const Mv=new ige;Object.defineProperties(kn,{MIN:{value:new kn(mm,Xn.EMPTY_NODE)},MAX:{value:new kn(Ld,Mv)}});HW.__EMPTY_NODE=Xn.EMPTY_NODE;dr.__childrenNodeConstructor=Xn;Jme(Mv);Zme(Mv);/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const rge=!0;function Zr(n,e=null){if(n===null)return Xn.EMPTY_NODE;if(typeof n=="object"&&".priority"in n&&(e=n[".priority"]),yt(e===null||typeof e=="string"||typeof e=="number"||typeof e=="object"&&".sv"in e,"Invalid priority type found: "+typeof e),typeof n=="object"&&".value"in n&&n[".value"]!==null&&(n=n[".value"]),typeof n!="object"||".sv"in n){const t=n;return new dr(t,Zr(e))}if(!(n instanceof Array)&&rge){const t=[];let i=!1;if(Ho(n,(o,a)=>{if(o.substring(0,1)!=="."){const l=Zr(a);l.isEmpty()||(i=i||!l.getPriority().isEmpty(),t.push(new kn(o,l)))}}),t.length===0)return Xn.EMPTY_NODE;const s=tE(t,$me,o=>o.name,WN);if(i){const o=tE(t,es.getCompare());return new Xn(s,Zr(e),new Gl({".priority":o},{".priority":es}))}else return new Xn(s,Zr(e),Gl.Default)}else{let t=Xn.EMPTY_NODE;return Ho(n,(i,r)=>{if(pc(n,i)&&i.substring(0,1)!=="."){const s=Zr(r);(s.isLeafNode()||!s.isEmpty())&&(t=t.updateImmediateChild(i,s))}}),t.updatePriority(Zr(e))}}Qme(Zr);/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class sge extends iS{constructor(e){super(),this.indexPath_=e,yt(!In(e)&&Ln(e)!==".priority","Can't create PathIndex with empty path or .priority key")}extractChild(e){return e.getChild(this.indexPath_)}isDefinedOn(e){return!e.getChild(this.indexPath_).isEmpty()}compare(e,t){const i=this.extractChild(e.node),r=this.extractChild(t.node),s=i.compareTo(r);return s===0?Gm(e.name,t.name):s}makePost(e,t){const i=Zr(e),r=Xn.EMPTY_NODE.updateChild(this.indexPath_,i);return new kn(t,r)}maxPost(){const e=Xn.EMPTY_NODE.updateChild(this.indexPath_,Mv);return new kn(Ld,e)}toString(){return FW(this.indexPath_,0).join("/")}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class oge extends iS{compare(e,t){const i=e.node.compareTo(t.node);return i===0?Gm(e.name,t.name):i}isDefinedOn(e){return!0}indexedValueChanged(e,t){return!e.equals(t)}minPost(){return kn.MIN}maxPost(){return kn.MAX}makePost(e,t){const i=Zr(e);return new kn(t,i)}toString(){return".value"}}const age=new oge;/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function lge(n){return{type:"value",snapshotNode:n}}function cge(n,e){return{type:"child_added",snapshotNode:e,childName:n}}function uge(n,e){return{type:"child_removed",snapshotNode:e,childName:n}}function bU(n,e,t){return{type:"child_changed",snapshotNode:e,childName:n,oldSnap:t}}function hge(n,e){return{type:"child_moved",snapshotNode:e,childName:n}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class KN{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=es}hasStart(){return this.startSet_}isViewFromLeft(){return this.viewFrom_===""?this.startSet_:this.viewFrom_==="l"}getIndexStartValue(){return yt(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return yt(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:mm}hasEnd(){return this.endSet_}getIndexEndValue(){return yt(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return yt(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:Ld}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&this.viewFrom_!==""}getLimit(){return yt(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===es}copy(){const e=new KN;return e.limitSet_=this.limitSet_,e.limit_=this.limit_,e.startSet_=this.startSet_,e.startAfterSet_=this.startAfterSet_,e.indexStartValue_=this.indexStartValue_,e.startNameSet_=this.startNameSet_,e.indexStartName_=this.indexStartName_,e.endSet_=this.endSet_,e.endBeforeSet_=this.endBeforeSet_,e.indexEndValue_=this.indexEndValue_,e.endNameSet_=this.endNameSet_,e.indexEndName_=this.indexEndName_,e.index_=this.index_,e.viewFrom_=this.viewFrom_,e}}function CU(n){const e={};if(n.isDefault())return e;let t;if(n.index_===es?t="$priority":n.index_===age?t="$value":n.index_===kp?t="$key":(yt(n.index_ instanceof sge,"Unrecognized index type!"),t=n.index_.toString()),e.orderBy=Tr(t),n.startSet_){const i=n.startAfterSet_?"startAfter":"startAt";e[i]=Tr(n.indexStartValue_),n.startNameSet_&&(e[i]+=","+Tr(n.indexStartName_))}if(n.endSet_){const i=n.endBeforeSet_?"endBefore":"endAt";e[i]=Tr(n.indexEndValue_),n.endNameSet_&&(e[i]+=","+Tr(n.indexEndName_))}return n.limitSet_&&(n.isViewFromLeft()?e.limitToFirst=n.limit_:e.limitToLast=n.limit_),e}function MU(n){const e={};if(n.startSet_&&(e.sp=n.indexStartValue_,n.startNameSet_&&(e.sn=n.indexStartName_),e.sin=!n.startAfterSet_),n.endSet_&&(e.ep=n.indexEndValue_,n.endNameSet_&&(e.en=n.indexEndName_),e.ein=!n.endBeforeSet_),n.limitSet_){e.l=n.limit_;let t=n.viewFrom_;t===""&&(n.isViewFromLeft()?t="l":t="r"),e.vf=t}return n.index_!==es&&(e.i=n.index_.toString()),e}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class nE extends kW{constructor(e,t,i,r){super(),this.repoInfo_=e,this.onDataUpdate_=t,this.authTokenProvider_=i,this.appCheckTokenProvider_=r,this.log_=bv("p:rest:"),this.listens_={}}reportStats(e){throw new Error("Method not implemented.")}static getListenId_(e,t){return t!==void 0?"tag$"+t:(yt(e._queryParams.isDefault(),"should have a tag if it's not a default query."),e._path.toString())}listen(e,t,i,r){const s=e._path.toString();this.log_("Listen called for "+s+" "+e._queryIdentifier);const o=nE.getListenId_(e,i),a={};this.listens_[o]=a;const l=CU(e._queryParams);this.restRequest_(s+".json",l,(c,u)=>{let h=u;if(c===404&&(h=null,c=null),c===null&&this.onDataUpdate_(s,h,!1,i),am(this.listens_,o)===a){let f;c?c===401?f="permission_denied":f="rest_error:"+c:f="ok",r(f,null)}})}unlisten(e,t){const i=nE.getListenId_(e,t);delete this.listens_[i]}get(e){const t=CU(e._queryParams),i=e._path.toString(),r=new U2;return this.restRequest_(i+".json",t,(s,o)=>{let a=o;s===404&&(a=null,s=null),s===null?(this.onDataUpdate_(i,a,!1,null),r.resolve(a)):r.reject(new Error(a))}),r.promise}refreshAuthToken(e){}restRequest_(e,t={},i){return t.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then(([r,s])=>{r&&r.accessToken&&(t.auth=r.accessToken),s&&s.token&&(t.ac=s.token);const o=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+e+"?ns="+this.repoInfo_.namespace+Om(t);this.log_("Sending REST request for "+o);const a=new XMLHttpRequest;a.onreadystatechange=()=>{if(i&&a.readyState===4){this.log_("REST Response for "+o+" received. status:",a.status,"response:",a.responseText);let l=null;if(a.status>=200&&a.status<300){try{l=w0(a.responseText)}catch{ho("Failed to parse JSON response for "+o+": "+a.responseText)}i(null,l)}else a.status!==401&&a.status!==404&&ho("Got unsuccessful REST response for "+o+" Status: "+a.status),i(a.status);i=null}},a.open("GET",o,!0),a.send()})}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class dge{constructor(){this.rootNode_=Xn.EMPTY_NODE}getNode(e){return this.rootNode_.getChild(e)}updateSnapshot(e,t){this.rootNode_=this.rootNode_.updateChild(e,t)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function iE(){return{value:null,children:new Map}}function XW(n,e,t){if(In(e))n.value=t,n.children.clear();else if(n.value!==null)n.value=n.value.updateChild(e,t);else{const i=Ln(e);n.children.has(i)||n.children.set(i,iE());const r=n.children.get(i);e=ci(e),XW(r,e,t)}}function hR(n,e,t){n.value!==null?t(e,n.value):fge(n,(i,r)=>{const s=new pi(e.toString()+"/"+i);hR(r,s,t)})}function fge(n,e){n.children.forEach((t,i)=>{e(i,t)})}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class pge{constructor(e){this.collection_=e,this.last_=null}get(){const e=this.collection_.get(),t=Object.assign({},e);return this.last_&&Ho(this.last_,(i,r)=>{t[i]=t[i]-r}),this.last_=e,t}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const IU=10*1e3,mge=30*1e3,gge=5*60*1e3;class yge{constructor(e,t){this.server_=t,this.statsToReport_={},this.statsListener_=new pge(e);const i=IU+(mge-IU)*Math.random();By(this.reportStats_.bind(this),Math.floor(i))}reportStats_(){const e=this.statsListener_.get(),t={};let i=!1;Ho(e,(r,s)=>{s>0&&pc(this.statsToReport_,r)&&(t[r]=s,i=!0)}),i&&this.server_.reportStats(t),By(this.reportStats_.bind(this),Math.floor(Math.random()*2*gge))}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var Ha;(function(n){n[n.OVERWRITE=0]="OVERWRITE",n[n.MERGE=1]="MERGE",n[n.ACK_USER_WRITE=2]="ACK_USER_WRITE",n[n.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"})(Ha||(Ha={}));function qW(){return{fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}function YW(){return{fromUser:!1,fromServer:!0,queryId:null,tagged:!1}}function $W(n){return{fromUser:!1,fromServer:!0,queryId:n,tagged:!0}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class rE{constructor(e,t,i){this.path=e,this.affectedTree=t,this.revert=i,this.type=Ha.ACK_USER_WRITE,this.source=qW()}operationForChild(e){if(In(this.path)){if(this.affectedTree.value!=null)return yt(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{const t=this.affectedTree.subtree(new pi(e));return new rE(Zn(),t,this.revert)}}else return yt(Ln(this.path)===e,"operationForChild called for unrelated child."),new rE(ci(this.path),this.affectedTree,this.revert)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class kd{constructor(e,t,i){this.source=e,this.path=t,this.snap=i,this.type=Ha.OVERWRITE}operationForChild(e){return In(this.path)?new kd(this.source,Zn(),this.snap.getImmediateChild(e)):new kd(this.source,ci(this.path),this.snap)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class k0{constructor(e,t,i){this.source=e,this.path=t,this.children=i,this.type=Ha.MERGE}operationForChild(e){if(In(this.path)){const t=this.children.subtree(new pi(e));return t.isEmpty()?null:t.value?new kd(this.source,Zn(),t.value):new k0(this.source,Zn(),t)}else return yt(Ln(this.path)===e,"Can't get a merge for a child not on the path of the operation"),new k0(this.source,ci(this.path),this.children)}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class XN{constructor(e,t,i){this.node_=e,this.fullyInitialized_=t,this.filtered_=i}isFullyInitialized(){return this.fullyInitialized_}isFiltered(){return this.filtered_}isCompleteForPath(e){if(In(e))return this.isFullyInitialized()&&!this.filtered_;const t=Ln(e);return this.isCompleteForChild(t)}isCompleteForChild(e){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(e)}getNode(){return this.node_}}function vge(n,e,t,i){const r=[],s=[];return e.forEach(o=>{o.type==="child_changed"&&n.index_.indexedValueChanged(o.oldSnap,o.snapshotNode)&&s.push(hge(o.childName,o.snapshotNode))}),kg(n,r,"child_removed",e,i,t),kg(n,r,"child_added",e,i,t),kg(n,r,"child_moved",s,i,t),kg(n,r,"child_changed",e,i,t),kg(n,r,"value",e,i,t),r}function kg(n,e,t,i,r,s){const o=i.filter(a=>a.type===t);o.sort((a,l)=>xge(n,a,l)),o.forEach(a=>{const l=_ge(n,a,s);r.forEach(c=>{c.respondsTo(a.type)&&e.push(c.createEvent(l,n.query_))})})}function _ge(n,e,t){return e.type==="value"||e.type==="child_removed"||(e.prevName=t.getPredecessorChildName(e.childName,e.snapshotNode,n.index_)),e}function xge(n,e,t){if(e.childName==null||t.childName==null)throw Bm("Should only compare child_ events.");const i=new kn(e.childName,e.snapshotNode),r=new kn(t.childName,t.snapshotNode);return n.index_.compare(i,r)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function JW(n,e){return{eventCache:n,serverCache:e}}function Oy(n,e,t,i){return JW(new XN(e,t,i),n.serverCache)}function QW(n,e,t,i){return JW(n.eventCache,new XN(e,t,i))}function dR(n){return n.eventCache.isFullyInitialized()?n.eventCache.getNode():null}function Bd(n){return n.serverCache.isFullyInitialized()?n.serverCache.getNode():null}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let Wb;const wge=()=>(Wb||(Wb=new Os(ame)),Wb);class li{constructor(e,t=wge()){this.value=e,this.children=t}static fromObject(e){let t=new li(null);return Ho(e,(i,r)=>{t=t.set(new pi(i),r)}),t}isEmpty(){return this.value===null&&this.children.isEmpty()}findRootMostMatchingPathAndValue(e,t){if(this.value!=null&&t(this.value))return{path:Zn(),value:this.value};if(In(e))return null;{const i=Ln(e),r=this.children.get(i);if(r!==null){const s=r.findRootMostMatchingPathAndValue(ci(e),t);return s!=null?{path:gr(new pi(i),s.path),value:s.value}:null}else return null}}findRootMostValueAndPath(e){return this.findRootMostMatchingPathAndValue(e,()=>!0)}subtree(e){if(In(e))return this;{const t=Ln(e),i=this.children.get(t);return i!==null?i.subtree(ci(e)):new li(null)}}set(e,t){if(In(e))return new li(t,this.children);{const i=Ln(e),s=(this.children.get(i)||new li(null)).set(ci(e),t),o=this.children.insert(i,s);return new li(this.value,o)}}remove(e){if(In(e))return this.children.isEmpty()?new li(null):new li(null,this.children);{const t=Ln(e),i=this.children.get(t);if(i){const r=i.remove(ci(e));let s;return r.isEmpty()?s=this.children.remove(t):s=this.children.insert(t,r),this.value===null&&s.isEmpty()?new li(null):new li(this.value,s)}else return this}}get(e){if(In(e))return this.value;{const t=Ln(e),i=this.children.get(t);return i?i.get(ci(e)):null}}setTree(e,t){if(In(e))return t;{const i=Ln(e),s=(this.children.get(i)||new li(null)).setTree(ci(e),t);let o;return s.isEmpty()?o=this.children.remove(i):o=this.children.insert(i,s),new li(this.value,o)}}fold(e){return this.fold_(Zn(),e)}fold_(e,t){const i={};return this.children.inorderTraversal((r,s)=>{i[r]=s.fold_(gr(e,r),t)}),t(e,this.value,i)}findOnPath(e,t){return this.findOnPath_(e,Zn(),t)}findOnPath_(e,t,i){const r=this.value?i(t,this.value):!1;if(r)return r;if(In(e))return null;{const s=Ln(e),o=this.children.get(s);return o?o.findOnPath_(ci(e),gr(t,s),i):null}}foreachOnPath(e,t){return this.foreachOnPath_(e,Zn(),t)}foreachOnPath_(e,t,i){if(In(e))return this;{this.value&&i(t,this.value);const r=Ln(e),s=this.children.get(r);return s?s.foreachOnPath_(ci(e),gr(t,r),i):new li(null)}}foreach(e){this.foreach_(Zn(),e)}foreach_(e,t){this.children.inorderTraversal((i,r)=>{r.foreach_(gr(e,i),t)}),this.value&&t(e,this.value)}foreachChild(e){this.children.inorderTraversal((t,i)=>{i.value&&e(t,i.value)})}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ga{constructor(e){this.writeTree_=e}static empty(){return new ga(new li(null))}}function Fy(n,e,t){if(In(e))return new ga(new li(t));{const i=n.writeTree_.findRootMostValueAndPath(e);if(i!=null){const r=i.path;let s=i.value;const o=Bo(r,e);return s=s.updateChild(o,t),new ga(n.writeTree_.set(r,s))}else{const r=new li(t),s=n.writeTree_.setTree(e,r);return new ga(s)}}}function RU(n,e,t){let i=n;return Ho(t,(r,s)=>{i=Fy(i,gr(e,r),s)}),i}function PU(n,e){if(In(e))return ga.empty();{const t=n.writeTree_.setTree(e,new li(null));return new ga(t)}}function fR(n,e){return Qd(n,e)!=null}function Qd(n,e){const t=n.writeTree_.findRootMostValueAndPath(e);return t!=null?n.writeTree_.get(t.path).getChild(Bo(t.path,e)):null}function NU(n){const e=[],t=n.writeTree_.value;return t!=null?t.isLeafNode()||t.forEachChild(es,(i,r)=>{e.push(new kn(i,r))}):n.writeTree_.children.inorderTraversal((i,r)=>{r.value!=null&&e.push(new kn(i,r.value))}),e}function Au(n,e){if(In(e))return n;{const t=Qd(n,e);return t!=null?new ga(new li(t)):new ga(n.writeTree_.subtree(e))}}function pR(n){return n.writeTree_.isEmpty()}function gm(n,e){return ZW(Zn(),n.writeTree_,e)}function ZW(n,e,t){if(e.value!=null)return t.updateChild(n,e.value);{let i=null;return e.children.inorderTraversal((r,s)=>{r===".priority"?(yt(s.value!==null,"Priority writes must always be leaf nodes"),i=s.value):t=ZW(gr(n,r),s,t)}),!t.getChild(n).isEmpty()&&i!==null&&(t=t.updateChild(gr(n,".priority"),i)),t}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function e7(n,e){return s7(e,n)}function Ege(n,e,t,i,r){yt(i>n.lastWriteId,"Stacking an older write on top of newer ones"),r===void 0&&(r=!0),n.allWrites.push({path:e,snap:t,writeId:i,visible:r}),r&&(n.visibleWrites=Fy(n.visibleWrites,e,t)),n.lastWriteId=i}function Age(n,e){for(let t=0;t<n.allWrites.length;t++){const i=n.allWrites[t];if(i.writeId===e)return i}return null}function Sge(n,e){const t=n.allWrites.findIndex(a=>a.writeId===e);yt(t>=0,"removeWrite called with nonexistent writeId.");const i=n.allWrites[t];n.allWrites.splice(t,1);let r=i.visible,s=!1,o=n.allWrites.length-1;for(;r&&o>=0;){const a=n.allWrites[o];a.visible&&(o>=t&&Tge(a,i.path)?r=!1:ha(i.path,a.path)&&(s=!0)),o--}if(r){if(s)return bge(n),!0;if(i.snap)n.visibleWrites=PU(n.visibleWrites,i.path);else{const a=i.children;Ho(a,l=>{n.visibleWrites=PU(n.visibleWrites,gr(i.path,l))})}return!0}else return!1}function Tge(n,e){if(n.snap)return ha(n.path,e);for(const t in n.children)if(n.children.hasOwnProperty(t)&&ha(gr(n.path,t),e))return!0;return!1}function bge(n){n.visibleWrites=t7(n.allWrites,Cge,Zn()),n.allWrites.length>0?n.lastWriteId=n.allWrites[n.allWrites.length-1].writeId:n.lastWriteId=-1}function Cge(n){return n.visible}function t7(n,e,t){let i=ga.empty();for(let r=0;r<n.length;++r){const s=n[r];if(e(s)){const o=s.path;let a;if(s.snap)ha(t,o)?(a=Bo(t,o),i=Fy(i,a,s.snap)):ha(o,t)&&(a=Bo(o,t),i=Fy(i,Zn(),s.snap.getChild(a)));else if(s.children){if(ha(t,o))a=Bo(t,o),i=RU(i,a,s.children);else if(ha(o,t))if(a=Bo(o,t),In(a))i=RU(i,Zn(),s.children);else{const l=am(s.children,Ln(a));if(l){const c=l.getChild(ci(a));i=Fy(i,Zn(),c)}}}else throw Bm("WriteRecord should have .snap or .children")}}return i}function n7(n,e,t,i,r){if(!i&&!r){const s=Qd(n.visibleWrites,e);if(s!=null)return s;{const o=Au(n.visibleWrites,e);if(pR(o))return t;if(t==null&&!fR(o,Zn()))return null;{const a=t||Xn.EMPTY_NODE;return gm(o,a)}}}else{const s=Au(n.visibleWrites,e);if(!r&&pR(s))return t;if(!r&&t==null&&!fR(s,Zn()))return null;{const o=function(c){return(c.visible||r)&&(!i||!~i.indexOf(c.writeId))&&(ha(c.path,e)||ha(e,c.path))},a=t7(n.allWrites,o,e),l=t||Xn.EMPTY_NODE;return gm(a,l)}}}function Mge(n,e,t){let i=Xn.EMPTY_NODE;const r=Qd(n.visibleWrites,e);if(r)return r.isLeafNode()||r.forEachChild(es,(s,o)=>{i=i.updateImmediateChild(s,o)}),i;if(t){const s=Au(n.visibleWrites,e);return t.forEachChild(es,(o,a)=>{const l=gm(Au(s,new pi(o)),a);i=i.updateImmediateChild(o,l)}),NU(s).forEach(o=>{i=i.updateImmediateChild(o.name,o.node)}),i}else{const s=Au(n.visibleWrites,e);return NU(s).forEach(o=>{i=i.updateImmediateChild(o.name,o.node)}),i}}function Ige(n,e,t,i,r){yt(i||r,"Either existingEventSnap or existingServerSnap must exist");const s=gr(e,t);if(fR(n.visibleWrites,s))return null;{const o=Au(n.visibleWrites,s);return pR(o)?r.getChild(t):gm(o,r.getChild(t))}}function Rge(n,e,t,i){const r=gr(e,t),s=Qd(n.visibleWrites,r);if(s!=null)return s;if(i.isCompleteForChild(t)){const o=Au(n.visibleWrites,r);return gm(o,i.getNode().getImmediateChild(t))}else return null}function Pge(n,e){return Qd(n.visibleWrites,e)}function Nge(n,e,t,i,r,s,o){let a;const l=Au(n.visibleWrites,e),c=Qd(l,Zn());if(c!=null)a=c;else if(t!=null)a=gm(l,t);else return[];if(a=a.withIndex(o),!a.isEmpty()&&!a.isLeafNode()){const u=[],h=o.getCompare(),f=s?a.getReverseIteratorFrom(i,o):a.getIteratorFrom(i,o);let m=f.getNext();for(;m&&u.length<r;)h(m,i)!==0&&u.push(m),m=f.getNext();return u}else return[]}function Dge(){return{visibleWrites:ga.empty(),allWrites:[],lastWriteId:-1}}function mR(n,e,t,i){return n7(n.writeTree,n.treePath,e,t,i)}function i7(n,e){return Mge(n.writeTree,n.treePath,e)}function DU(n,e,t,i){return Ige(n.writeTree,n.treePath,e,t,i)}function sE(n,e){return Pge(n.writeTree,gr(n.treePath,e))}function Lge(n,e,t,i,r,s){return Nge(n.writeTree,n.treePath,e,t,i,r,s)}function qN(n,e,t){return Rge(n.writeTree,n.treePath,e,t)}function r7(n,e){return s7(gr(n.treePath,e),n.writeTree)}function s7(n,e){return{treePath:n,writeTree:e}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class kge{constructor(){this.changeMap=new Map}trackChildChange(e){const t=e.type,i=e.childName;yt(t==="child_added"||t==="child_changed"||t==="child_removed","Only child changes supported for tracking"),yt(i!==".priority","Only non-priority child changes can be tracked.");const r=this.changeMap.get(i);if(r){const s=r.type;if(t==="child_added"&&s==="child_removed")this.changeMap.set(i,bU(i,e.snapshotNode,r.snapshotNode));else if(t==="child_removed"&&s==="child_added")this.changeMap.delete(i);else if(t==="child_removed"&&s==="child_changed")this.changeMap.set(i,uge(i,r.oldSnap));else if(t==="child_changed"&&s==="child_added")this.changeMap.set(i,cge(i,e.snapshotNode));else if(t==="child_changed"&&s==="child_changed")this.changeMap.set(i,bU(i,e.snapshotNode,r.oldSnap));else throw Bm("Illegal combination of changes: "+e+" occurred after "+r)}else this.changeMap.set(i,e)}getChanges(){return Array.from(this.changeMap.values())}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Bge{getCompleteChild(e){return null}getChildAfterChild(e,t,i){return null}}const o7=new Bge;class YN{constructor(e,t,i=null){this.writes_=e,this.viewCache_=t,this.optCompleteServerCache_=i}getCompleteChild(e){const t=this.viewCache_.eventCache;if(t.isCompleteForChild(e))return t.getNode().getImmediateChild(e);{const i=this.optCompleteServerCache_!=null?new XN(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return qN(this.writes_,e,i)}}getChildAfterChild(e,t,i){const r=this.optCompleteServerCache_!=null?this.optCompleteServerCache_:Bd(this.viewCache_),s=Lge(this.writes_,r,t,1,i,e);return s.length===0?null:s[0]}}function Oge(n,e){yt(e.eventCache.getNode().isIndexed(n.filter.getIndex()),"Event snap not indexed"),yt(e.serverCache.getNode().isIndexed(n.filter.getIndex()),"Server snap not indexed")}function Fge(n,e,t,i,r){const s=new kge;let o,a;if(t.type===Ha.OVERWRITE){const c=t;c.source.fromUser?o=gR(n,e,c.path,c.snap,i,r,s):(yt(c.source.fromServer,"Unknown source."),a=c.source.tagged||e.serverCache.isFiltered()&&!In(c.path),o=oE(n,e,c.path,c.snap,i,r,a,s))}else if(t.type===Ha.MERGE){const c=t;c.source.fromUser?o=Vge(n,e,c.path,c.children,i,r,s):(yt(c.source.fromServer,"Unknown source."),a=c.source.tagged||e.serverCache.isFiltered(),o=yR(n,e,c.path,c.children,i,r,a,s))}else if(t.type===Ha.ACK_USER_WRITE){const c=t;c.revert?o=Gge(n,e,c.path,i,r,s):o=zge(n,e,c.path,c.affectedTree,i,r,s)}else if(t.type===Ha.LISTEN_COMPLETE)o=Hge(n,e,t.path,i,s);else throw Bm("Unknown operation type: "+t.type);const l=s.getChanges();return Uge(e,o,l),{viewCache:o,changes:l}}function Uge(n,e,t){const i=e.eventCache;if(i.isFullyInitialized()){const r=i.getNode().isLeafNode()||i.getNode().isEmpty(),s=dR(n);(t.length>0||!n.eventCache.isFullyInitialized()||r&&!i.getNode().equals(s)||!i.getNode().getPriority().equals(s.getPriority()))&&t.push(lge(dR(e)))}}function a7(n,e,t,i,r,s){const o=e.eventCache;if(sE(i,t)!=null)return e;{let a,l;if(In(t))if(yt(e.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),e.serverCache.isFiltered()){const c=Bd(e),u=c instanceof Xn?c:Xn.EMPTY_NODE,h=i7(i,u);a=n.filter.updateFullNode(e.eventCache.getNode(),h,s)}else{const c=mR(i,Bd(e));a=n.filter.updateFullNode(e.eventCache.getNode(),c,s)}else{const c=Ln(t);if(c===".priority"){yt(Uu(t)===1,"Can't have a priority with additional path components");const u=o.getNode();l=e.serverCache.getNode();const h=DU(i,t,u,l);h!=null?a=n.filter.updatePriority(u,h):a=o.getNode()}else{const u=ci(t);let h;if(o.isCompleteForChild(c)){l=e.serverCache.getNode();const f=DU(i,t,o.getNode(),l);f!=null?h=o.getNode().getImmediateChild(c).updateChild(u,f):h=o.getNode().getImmediateChild(c)}else h=qN(i,c,e.serverCache);h!=null?a=n.filter.updateChild(o.getNode(),c,h,u,r,s):a=o.getNode()}}return Oy(e,a,o.isFullyInitialized()||In(t),n.filter.filtersNodes())}}function oE(n,e,t,i,r,s,o,a){const l=e.serverCache;let c;const u=o?n.filter:n.filter.getIndexedFilter();if(In(t))c=u.updateFullNode(l.getNode(),i,null);else if(u.filtersNodes()&&!l.isFiltered()){const m=l.getNode().updateChild(t,i);c=u.updateFullNode(l.getNode(),m,null)}else{const m=Ln(t);if(!l.isCompleteForPath(t)&&Uu(t)>1)return e;const y=ci(t),v=l.getNode().getImmediateChild(m).updateChild(y,i);m===".priority"?c=u.updatePriority(l.getNode(),v):c=u.updateChild(l.getNode(),m,v,y,o7,null)}const h=QW(e,c,l.isFullyInitialized()||In(t),u.filtersNodes()),f=new YN(r,h,s);return a7(n,h,t,r,f,a)}function gR(n,e,t,i,r,s,o){const a=e.eventCache;let l,c;const u=new YN(r,e,s);if(In(t))c=n.filter.updateFullNode(e.eventCache.getNode(),i,o),l=Oy(e,c,!0,n.filter.filtersNodes());else{const h=Ln(t);if(h===".priority")c=n.filter.updatePriority(e.eventCache.getNode(),i),l=Oy(e,c,a.isFullyInitialized(),a.isFiltered());else{const f=ci(t),m=a.getNode().getImmediateChild(h);let y;if(In(f))y=i;else{const _=u.getCompleteChild(h);_!=null?OW(f)===".priority"&&_.getChild(UW(f)).isEmpty()?y=_:y=_.updateChild(f,i):y=Xn.EMPTY_NODE}if(m.equals(y))l=e;else{const _=n.filter.updateChild(a.getNode(),h,y,f,u,o);l=Oy(e,_,a.isFullyInitialized(),n.filter.filtersNodes())}}}return l}function LU(n,e){return n.eventCache.isCompleteForChild(e)}function Vge(n,e,t,i,r,s,o){let a=e;return i.foreach((l,c)=>{const u=gr(t,l);LU(e,Ln(u))&&(a=gR(n,a,u,c,r,s,o))}),i.foreach((l,c)=>{const u=gr(t,l);LU(e,Ln(u))||(a=gR(n,a,u,c,r,s,o))}),a}function kU(n,e,t){return t.foreach((i,r)=>{e=e.updateChild(i,r)}),e}function yR(n,e,t,i,r,s,o,a){if(e.serverCache.getNode().isEmpty()&&!e.serverCache.isFullyInitialized())return e;let l=e,c;In(t)?c=i:c=new li(null).setTree(t,i);const u=e.serverCache.getNode();return c.children.inorderTraversal((h,f)=>{if(u.hasChild(h)){const m=e.serverCache.getNode().getImmediateChild(h),y=kU(n,m,f);l=oE(n,l,new pi(h),y,r,s,o,a)}}),c.children.inorderTraversal((h,f)=>{const m=!e.serverCache.isCompleteForChild(h)&&f.value===null;if(!u.hasChild(h)&&!m){const y=e.serverCache.getNode().getImmediateChild(h),_=kU(n,y,f);l=oE(n,l,new pi(h),_,r,s,o,a)}}),l}function zge(n,e,t,i,r,s,o){if(sE(r,t)!=null)return e;const a=e.serverCache.isFiltered(),l=e.serverCache;if(i.value!=null){if(In(t)&&l.isFullyInitialized()||l.isCompleteForPath(t))return oE(n,e,t,l.getNode().getChild(t),r,s,a,o);if(In(t)){let c=new li(null);return l.getNode().forEachChild(kp,(u,h)=>{c=c.set(new pi(u),h)}),yR(n,e,t,c,r,s,a,o)}else return e}else{let c=new li(null);return i.foreach((u,h)=>{const f=gr(t,u);l.isCompleteForPath(f)&&(c=c.set(u,l.getNode().getChild(f)))}),yR(n,e,t,c,r,s,a,o)}}function Hge(n,e,t,i,r){const s=e.serverCache,o=QW(e,s.getNode(),s.isFullyInitialized()||In(t),s.isFiltered());return a7(n,o,t,i,o7,r)}function Gge(n,e,t,i,r,s){let o;if(sE(i,t)!=null)return e;{const a=new YN(i,e,r),l=e.eventCache.getNode();let c;if(In(t)||Ln(t)===".priority"){let u;if(e.serverCache.isFullyInitialized())u=mR(i,Bd(e));else{const h=e.serverCache.getNode();yt(h instanceof Xn,"serverChildren would be complete if leaf node"),u=i7(i,h)}u=u,c=n.filter.updateFullNode(l,u,s)}else{const u=Ln(t);let h=qN(i,u,e.serverCache);h==null&&e.serverCache.isCompleteForChild(u)&&(h=l.getImmediateChild(u)),h!=null?c=n.filter.updateChild(l,u,h,ci(t),a,s):e.eventCache.getNode().hasChild(u)?c=n.filter.updateChild(l,u,Xn.EMPTY_NODE,ci(t),a,s):c=l,c.isEmpty()&&e.serverCache.isFullyInitialized()&&(o=mR(i,Bd(e)),o.isLeafNode()&&(c=n.filter.updateFullNode(c,o,s)))}return o=e.serverCache.isFullyInitialized()||sE(i,Zn())!=null,Oy(e,c,o,n.filter.filtersNodes())}}function jge(n,e){const t=Bd(n.viewCache_);return t&&(n.query._queryParams.loadsAllData()||!In(e)&&!t.getImmediateChild(Ln(e)).isEmpty())?t.getChild(e):null}function BU(n,e,t,i){e.type===Ha.MERGE&&e.source.queryId!==null&&(yt(Bd(n.viewCache_),"We should always have a full cache before handling merges"),yt(dR(n.viewCache_),"Missing event cache, even though we have a server cache"));const r=n.viewCache_,s=Fge(n.processor_,r,e,t,i);return Oge(n.processor_,s.viewCache),yt(s.viewCache.serverCache.isFullyInitialized()||!r.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),n.viewCache_=s.viewCache,Wge(n,s.changes,s.viewCache.eventCache.getNode())}function Wge(n,e,t,i){const r=n.eventRegistrations_;return vge(n.eventGenerator_,e,t,r)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let OU;function Kge(n){yt(!OU,"__referenceConstructor has already been defined"),OU=n}function $N(n,e,t,i){const r=e.source.queryId;if(r!==null){const s=n.views.get(r);return yt(s!=null,"SyncTree gave us an op for an invalid query."),BU(s,e,t,i)}else{let s=[];for(const o of n.views.values())s=s.concat(BU(o,e,t,i));return s}}function JN(n,e){let t=null;for(const i of n.views.values())t=t||jge(i,e);return t}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let FU;function Xge(n){yt(!FU,"__referenceConstructor has already been defined"),FU=n}class UU{constructor(e){this.listenProvider_=e,this.syncPointTree_=new li(null),this.pendingWriteTree_=Dge(),this.tagToQueryMap=new Map,this.queryToTagMap=new Map}}function qge(n,e,t,i,r){return Ege(n.pendingWriteTree_,e,t,i,r),r?sS(n,new kd(qW(),e,t)):[]}function gp(n,e,t=!1){const i=Age(n.pendingWriteTree_,e);if(Sge(n.pendingWriteTree_,e)){let s=new li(null);return i.snap!=null?s=s.set(Zn(),!0):Ho(i.children,o=>{s=s.set(new pi(o),!0)}),sS(n,new rE(i.path,s,t))}else return[]}function rS(n,e,t){return sS(n,new kd(YW(),e,t))}function Yge(n,e,t){const i=li.fromObject(t);return sS(n,new k0(YW(),e,i))}function $ge(n,e,t,i){const r=h7(n,i);if(r!=null){const s=d7(r),o=s.path,a=s.queryId,l=Bo(o,e),c=new kd($W(a),l,t);return f7(n,o,c)}else return[]}function Jge(n,e,t,i){const r=h7(n,i);if(r){const s=d7(r),o=s.path,a=s.queryId,l=Bo(o,e),c=li.fromObject(t),u=new k0($W(a),l,c);return f7(n,o,u)}else return[]}function l7(n,e,t){const r=n.pendingWriteTree_,s=n.syncPointTree_.findOnPath(e,(o,a)=>{const l=Bo(o,e),c=JN(a,l);if(c)return c});return n7(r,e,s,t,!0)}function sS(n,e){return c7(e,n.syncPointTree_,null,e7(n.pendingWriteTree_,Zn()))}function c7(n,e,t,i){if(In(n.path))return u7(n,e,t,i);{const r=e.get(Zn());t==null&&r!=null&&(t=JN(r,Zn()));let s=[];const o=Ln(n.path),a=n.operationForChild(o),l=e.children.get(o);if(l&&a){const c=t?t.getImmediateChild(o):null,u=r7(i,o);s=s.concat(c7(a,l,c,u))}return r&&(s=s.concat($N(r,n,i,t))),s}}function u7(n,e,t,i){const r=e.get(Zn());t==null&&r!=null&&(t=JN(r,Zn()));let s=[];return e.children.inorderTraversal((o,a)=>{const l=t?t.getImmediateChild(o):null,c=r7(i,o),u=n.operationForChild(o);u&&(s=s.concat(u7(u,a,l,c)))}),r&&(s=s.concat($N(r,n,i,t))),s}function h7(n,e){return n.tagToQueryMap.get(e)}function d7(n){const e=n.indexOf("$");return yt(e!==-1&&e<n.length-1,"Bad queryKey."),{queryId:n.substr(e+1),path:new pi(n.substr(0,e))}}function f7(n,e,t){const i=n.syncPointTree_.get(e);yt(i,"Missing sync point for query tag that we're tracking");const r=e7(n.pendingWriteTree_,e);return $N(i,t,r,null)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class QN{constructor(e){this.node_=e}getImmediateChild(e){const t=this.node_.getImmediateChild(e);return new QN(t)}node(){return this.node_}}class ZN{constructor(e,t){this.syncTree_=e,this.path_=t}getImmediateChild(e){const t=gr(this.path_,e);return new ZN(this.syncTree_,t)}node(){return l7(this.syncTree_,this.path_)}}const Qge=function(n){return n=n||{},n.timestamp=n.timestamp||new Date().getTime(),n},VU=function(n,e,t){if(!n||typeof n!="object")return n;if(yt(".sv"in n,"Unexpected leaf node or priority contents"),typeof n[".sv"]=="string")return Zge(n[".sv"],e,t);if(typeof n[".sv"]=="object")return eye(n[".sv"],e);yt(!1,"Unexpected server value: "+JSON.stringify(n,null,2))},Zge=function(n,e,t){switch(n){case"timestamp":return t.timestamp;default:yt(!1,"Unexpected server value: "+n)}},eye=function(n,e,t){n.hasOwnProperty("increment")||yt(!1,"Unexpected server value: "+JSON.stringify(n,null,2));const i=n.increment;typeof i!="number"&&yt(!1,"Unexpected increment value: "+i);const r=e.node();if(yt(r!==null&&typeof r<"u","Expected ChildrenNode.EMPTY_NODE for nulls"),!r.isLeafNode())return i;const o=r.getValue();return typeof o!="number"?i:o+i},tye=function(n,e,t,i){return eD(e,new ZN(t,n),i)},nye=function(n,e,t){return eD(n,new QN(e),t)};function eD(n,e,t){const i=n.getPriority().val(),r=VU(i,e.getImmediateChild(".priority"),t);let s;if(n.isLeafNode()){const o=n,a=VU(o.getValue(),e,t);return a!==o.getValue()||r!==o.getPriority().val()?new dr(a,Zr(r)):n}else{const o=n;return s=o,r!==o.getPriority().val()&&(s=s.updatePriority(new dr(r))),o.forEachChild(es,(a,l)=>{const c=eD(l,e.getImmediateChild(a),t);c!==l&&(s=s.updateImmediateChild(a,c))}),s}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class tD{constructor(e="",t=null,i={children:{},childCount:0}){this.name=e,this.parent=t,this.node=i}}function nD(n,e){let t=e instanceof pi?e:new pi(e),i=n,r=Ln(t);for(;r!==null;){const s=am(i.node.children,r)||{children:{},childCount:0};i=new tD(r,i,s),t=ci(t),r=Ln(t)}return i}function jm(n){return n.node.value}function p7(n,e){n.node.value=e,vR(n)}function m7(n){return n.node.childCount>0}function iye(n){return jm(n)===void 0&&!m7(n)}function oS(n,e){Ho(n.node.children,(t,i)=>{e(new tD(t,n,i))})}function g7(n,e,t,i){t&&!i&&e(n),oS(n,r=>{g7(r,e,!0,i)}),t&&i&&e(n)}function rye(n,e,t){let i=n.parent;for(;i!==null;){if(e(i))return!0;i=i.parent}return!1}function Iv(n){return new pi(n.parent===null?n.name:Iv(n.parent)+"/"+n.name)}function vR(n){n.parent!==null&&sye(n.parent,n.name,n)}function sye(n,e,t){const i=iye(t),r=pc(n.node.children,e);i&&r?(delete n.node.children[e],n.node.childCount--,vR(n)):!i&&!r&&(n.node.children[e]=t.node,n.node.childCount++,vR(n))}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const oye=/[\[\].#$\/\u0000-\u001F\u007F]/,aye=/[\[\].#$\u0000-\u001F\u007F]/,Kb=10*1024*1024,y7=function(n){return typeof n=="string"&&n.length!==0&&!oye.test(n)},lye=function(n){return typeof n=="string"&&n.length!==0&&!aye.test(n)},cye=function(n){return n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),lye(n)},v7=function(n,e,t){const i=t instanceof pi?new Hme(t,n):t;if(e===void 0)throw new Error(n+"contains undefined "+Fh(i));if(typeof e=="function")throw new Error(n+"contains a function "+Fh(i)+" with contents = "+e.toString());if(gW(e))throw new Error(n+"contains "+e.toString()+" "+Fh(i));if(typeof e=="string"&&e.length>Kb/3&&RA(e)>Kb)throw new Error(n+"contains a string greater than "+Kb+" utf8 bytes "+Fh(i)+" ('"+e.substring(0,50)+"...')");if(e&&typeof e=="object"){let r=!1,s=!1;if(Ho(e,(o,a)=>{if(o===".value")r=!0;else if(o!==".priority"&&o!==".sv"&&(s=!0,!y7(o)))throw new Error(n+" contains an invalid key ("+o+") "+Fh(i)+`.  Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"`);Gme(i,o),v7(n,a,i),jme(i)}),r&&s)throw new Error(n+' contains ".value" child '+Fh(i)+" in addition to actual children.")}},uye=function(n,e){const t=e.path.toString();if(typeof e.repoInfo.host!="string"||e.repoInfo.host.length===0||!y7(e.repoInfo.namespace)&&e.repoInfo.host.split(":")[0]!=="localhost"||t.length!==0&&!cye(t))throw new Error(Ple(n,"url")+`must be a valid firebase URL and the path can't contain ".", "#", "$", "[", or "]".`)};/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class hye{constructor(){this.eventLists_=[],this.recursionDepth_=0}}function dye(n,e){let t=null;for(let i=0;i<e.length;i++){const r=e[i],s=r.getPath();t!==null&&!VW(s,t.path)&&(n.eventLists_.push(t),t=null),t===null&&(t={events:[],path:s}),t.events.push(r)}t&&n.eventLists_.push(t)}function Zd(n,e,t){dye(n,t),fye(n,i=>ha(i,e)||ha(e,i))}function fye(n,e){n.recursionDepth_++;let t=!0;for(let i=0;i<n.eventLists_.length;i++){const r=n.eventLists_[i];if(r){const s=r.path;e(s)?(pye(n.eventLists_[i]),n.eventLists_[i]=null):t=!1}}t&&(n.eventLists_=[]),n.recursionDepth_--}function pye(n){for(let e=0;e<n.events.length;e++){const t=n.events[e];if(t!==null){n.events[e]=null;const i=t.getEventRunner();ky&&Qr("event: "+t.toString()),Cv(i)}}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const mye="repo_interrupt",gye=25;class yye{constructor(e,t,i,r){this.repoInfo_=e,this.forceRestClient_=t,this.authTokenProvider_=i,this.appCheckProvider_=r,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new hye,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=iE(),this.transactionQueueTree_=new tD,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}toString(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host}}function vye(n,e,t){if(n.stats_=HN(n.repoInfo_),n.forceRestClient_||fme())n.server_=new nE(n.repoInfo_,(i,r,s,o)=>{zU(n,i,r,s,o)},n.authTokenProvider_,n.appCheckProvider_),setTimeout(()=>HU(n,!0),0);else{if(typeof t<"u"&&t!==null){if(typeof t!="object")throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{Tr(t)}catch(i){throw new Error("Invalid authOverride provided: "+i)}}n.persistentConnection_=new Yl(n.repoInfo_,e,(i,r,s,o)=>{zU(n,i,r,s,o)},i=>{HU(n,i)},i=>{xye(n,i)},n.authTokenProvider_,n.appCheckProvider_,t),n.server_=n.persistentConnection_}n.authTokenProvider_.addTokenChangeListener(i=>{n.server_.refreshAuthToken(i)}),n.appCheckProvider_.addTokenChangeListener(i=>{n.server_.refreshAppCheckToken(i.token)}),n.statsReporter_=vme(n.repoInfo_,()=>new yge(n.stats_,n.server_)),n.infoData_=new dge,n.infoSyncTree_=new UU({startListening:(i,r,s,o)=>{let a=[];const l=n.infoData_.getNode(i._path);return l.isEmpty()||(a=rS(n.infoSyncTree_,i._path,l),setTimeout(()=>{o("ok")},0)),a},stopListening:()=>{}}),iD(n,"connected",!1),n.serverSyncTree_=new UU({startListening:(i,r,s,o)=>(n.server_.listen(i,s,r,(a,l)=>{const c=o(a,l);Zd(n.eventQueue_,i._path,c)}),[]),stopListening:(i,r)=>{n.server_.unlisten(i,r)}})}function _ye(n){const t=n.infoData_.getNode(new pi(".info/serverTimeOffset")).val()||0;return new Date().getTime()+t}function _7(n){return Qge({timestamp:_ye(n)})}function zU(n,e,t,i,r){n.dataUpdateCount++;const s=new pi(e);t=n.interceptServerDataCallback_?n.interceptServerDataCallback_(e,t):t;let o=[];if(r)if(i){const l=O1(t,c=>Zr(c));o=Jge(n.serverSyncTree_,s,l,r)}else{const l=Zr(t);o=$ge(n.serverSyncTree_,s,l,r)}else if(i){const l=O1(t,c=>Zr(c));o=Yge(n.serverSyncTree_,s,l)}else{const l=Zr(t);o=rS(n.serverSyncTree_,s,l)}let a=s;o.length>0&&(a=sD(n,s)),Zd(n.eventQueue_,a,o)}function HU(n,e){iD(n,"connected",e),e===!1&&Eye(n)}function xye(n,e){Ho(e,(t,i)=>{iD(n,t,i)})}function iD(n,e,t){const i=new pi("/.info/"+e),r=Zr(t);n.infoData_.updateSnapshot(i,r);const s=rS(n.infoSyncTree_,i,r);Zd(n.eventQueue_,i,s)}function wye(n){return n.nextWriteId_++}function Eye(n){x7(n,"onDisconnectEvents");const e=_7(n),t=iE();hR(n.onDisconnect_,Zn(),(r,s)=>{const o=tye(r,s,n.serverSyncTree_,e);XW(t,r,o)});let i=[];hR(t,Zn(),(r,s)=>{i=i.concat(rS(n.serverSyncTree_,r,s));const o=bye(n,r);sD(n,o)}),n.onDisconnect_=iE(),Zd(n.eventQueue_,Zn(),i)}function Aye(n){n.persistentConnection_&&n.persistentConnection_.interrupt(mye)}function x7(n,...e){let t="";n.persistentConnection_&&(t=n.persistentConnection_.id+":"),Qr(t,...e)}function w7(n,e,t){return l7(n.serverSyncTree_,e,t)||Xn.EMPTY_NODE}function rD(n,e=n.transactionQueueTree_){if(e||aS(n,e),jm(e)){const t=A7(n,e);yt(t.length>0,"Sending zero length transaction queue"),t.every(r=>r.status===0)&&Sye(n,Iv(e),t)}else m7(e)&&oS(e,t=>{rD(n,t)})}function Sye(n,e,t){const i=t.map(c=>c.currentWriteId),r=w7(n,e,i);let s=r;const o=r.hash();for(let c=0;c<t.length;c++){const u=t[c];yt(u.status===0,"tryToSendTransactionQueue_: items in queue should all be run."),u.status=1,u.retryCount++;const h=Bo(e,u.path);s=s.updateChild(h,u.currentOutputSnapshotRaw)}const a=s.val(!0),l=e;n.server_.put(l.toString(),a,c=>{x7(n,"transaction put response",{path:l.toString(),status:c});let u=[];if(c==="ok"){const h=[];for(let f=0;f<t.length;f++)t[f].status=2,u=u.concat(gp(n.serverSyncTree_,t[f].currentWriteId)),t[f].onComplete&&h.push(()=>t[f].onComplete(null,!0,t[f].currentOutputSnapshotResolved)),t[f].unwatcher();aS(n,nD(n.transactionQueueTree_,e)),rD(n,n.transactionQueueTree_),Zd(n.eventQueue_,e,u);for(let f=0;f<h.length;f++)Cv(h[f])}else{if(c==="datastale")for(let h=0;h<t.length;h++)t[h].status===3?t[h].status=4:t[h].status=0;else{ho("transaction at "+l.toString()+" failed: "+c);for(let h=0;h<t.length;h++)t[h].status=4,t[h].abortReason=c}sD(n,e)}},o)}function sD(n,e){const t=E7(n,e),i=Iv(t),r=A7(n,t);return Tye(n,r,i),i}function Tye(n,e,t){if(e.length===0)return;const i=[];let r=[];const o=e.filter(a=>a.status===0).map(a=>a.currentWriteId);for(let a=0;a<e.length;a++){const l=e[a],c=Bo(t,l.path);let u=!1,h;if(yt(c!==null,"rerunTransactionsUnderNode_: relativePath should not be null."),l.status===4)u=!0,h=l.abortReason,r=r.concat(gp(n.serverSyncTree_,l.currentWriteId,!0));else if(l.status===0)if(l.retryCount>=gye)u=!0,h="maxretry",r=r.concat(gp(n.serverSyncTree_,l.currentWriteId,!0));else{const f=w7(n,l.path,o);l.currentInputSnapshot=f;const m=e[a].update(f.val());if(m!==void 0){v7("transaction failed: Data returned ",m,l.path);let y=Zr(m);typeof m=="object"&&m!=null&&pc(m,".priority")||(y=y.updatePriority(f.getPriority()));const v=l.currentWriteId,g=_7(n),w=nye(y,f,g);l.currentOutputSnapshotRaw=y,l.currentOutputSnapshotResolved=w,l.currentWriteId=wye(n),o.splice(o.indexOf(v),1),r=r.concat(qge(n.serverSyncTree_,l.path,w,l.currentWriteId,l.applyLocally)),r=r.concat(gp(n.serverSyncTree_,v,!0))}else u=!0,h="nodata",r=r.concat(gp(n.serverSyncTree_,l.currentWriteId,!0))}Zd(n.eventQueue_,t,r),r=[],u&&(e[a].status=2,function(f){setTimeout(f,Math.floor(0))}(e[a].unwatcher),e[a].onComplete&&(h==="nodata"?i.push(()=>e[a].onComplete(null,!1,e[a].currentInputSnapshot)):i.push(()=>e[a].onComplete(new Error(h),!1,null))))}aS(n,n.transactionQueueTree_);for(let a=0;a<i.length;a++)Cv(i[a]);rD(n,n.transactionQueueTree_)}function E7(n,e){let t,i=n.transactionQueueTree_;for(t=Ln(e);t!==null&&jm(i)===void 0;)i=nD(i,t),e=ci(e),t=Ln(e);return i}function A7(n,e){const t=[];return S7(n,e,t),t.sort((i,r)=>i.order-r.order),t}function S7(n,e,t){const i=jm(e);if(i)for(let r=0;r<i.length;r++)t.push(i[r]);oS(e,r=>{S7(n,r,t)})}function aS(n,e){const t=jm(e);if(t){let i=0;for(let r=0;r<t.length;r++)t[r].status!==2&&(t[i]=t[r],i++);t.length=i,p7(e,t.length>0?t:void 0)}oS(e,i=>{aS(n,i)})}function bye(n,e){const t=Iv(E7(n,e)),i=nD(n.transactionQueueTree_,e);return rye(i,r=>{Xb(n,r)}),Xb(n,i),g7(i,r=>{Xb(n,r)}),t}function Xb(n,e){const t=jm(e);if(t){const i=[];let r=[],s=-1;for(let o=0;o<t.length;o++)t[o].status===3||(t[o].status===1?(yt(s===o-1,"All SENT items should be at beginning of queue."),s=o,t[o].status=3,t[o].abortReason="set"):(yt(t[o].status===0,"Unexpected transaction status in abort"),t[o].unwatcher(),r=r.concat(gp(n.serverSyncTree_,t[o].currentWriteId,!0)),t[o].onComplete&&i.push(t[o].onComplete.bind(null,new Error("set"),!1,null))));s===-1?p7(e,void 0):t.length=s+1,Zd(n.eventQueue_,Iv(e),r);for(let o=0;o<i.length;o++)Cv(i[o])}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Cye(n){let e="";const t=n.split("/");for(let i=0;i<t.length;i++)if(t[i].length>0){let r=t[i];try{r=decodeURIComponent(r.replace(/\+/g," "))}catch{}e+="/"+r}return e}function Mye(n){const e={};n.charAt(0)==="?"&&(n=n.substring(1));for(const t of n.split("&")){if(t.length===0)continue;const i=t.split("=");i.length===2?e[decodeURIComponent(i[0])]=decodeURIComponent(i[1]):ho(`Invalid query segment '${t}' in query '${n}'`)}return e}const GU=function(n,e){const t=Iye(n),i=t.namespace;t.domain==="firebase.com"&&lc(t.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),(!i||i==="undefined")&&t.domain!=="localhost"&&lc("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),t.secure||sme();const r=t.scheme==="ws"||t.scheme==="wss";return{repoInfo:new MW(t.host,t.secure,i,r,e,"",i!==t.subdomain),path:new pi(t.pathString)}},Iye=function(n){let e="",t="",i="",r="",s="",o=!0,a="https",l=443;if(typeof n=="string"){let c=n.indexOf("//");c>=0&&(a=n.substring(0,c-1),n=n.substring(c+2));let u=n.indexOf("/");u===-1&&(u=n.length);let h=n.indexOf("?");h===-1&&(h=n.length),e=n.substring(0,Math.min(u,h)),u<h&&(r=Cye(n.substring(u,h)));const f=Mye(n.substring(Math.min(n.length,h)));c=e.indexOf(":"),c>=0?(o=a==="https"||a==="wss",l=parseInt(e.substring(c+1),10)):c=e.length;const m=e.slice(0,c);if(m.toLowerCase()==="localhost")t="localhost";else if(m.split(".").length<=2)t=m;else{const y=e.indexOf(".");i=e.substring(0,y).toLowerCase(),t=e.substring(y+1),s=i}"ns"in f&&(s=f.ns)}return{host:e,port:l,domain:t,subdomain:i,secure:o,scheme:a,pathString:r,namespace:s}};/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class oD{constructor(e,t,i,r){this._repo=e,this._path=t,this._queryParams=i,this._orderByCalled=r}get key(){return In(this._path)?null:OW(this._path)}get ref(){return new Wm(this._repo,this._path)}get _queryIdentifier(){const e=MU(this._queryParams),t=VN(e);return t==="{}"?"default":t}get _queryObject(){return MU(this._queryParams)}isEqual(e){if(e=zi(e),!(e instanceof oD))return!1;const t=this._repo===e._repo,i=VW(this._path,e._path),r=this._queryIdentifier===e._queryIdentifier;return t&&i&&r}toJSON(){return this.toString()}toString(){return this._repo.toString()+zme(this._path)}}class Wm extends oD{constructor(e,t){super(e,t,new KN,!1)}get parent(){const e=UW(this._path);return e===null?null:new Wm(this._repo,e)}get root(){let e=this;for(;e.parent!==null;)e=e.parent;return e}}Kge(Wm);Xge(Wm);/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Rye="FIREBASE_DATABASE_EMULATOR_HOST",_R={};let Pye=!1;function Nye(n,e,t,i){n.repoInfo_=new MW(`${e}:${t}`,!1,n.repoInfo_.namespace,n.repoInfo_.webSocketOnly,n.repoInfo_.nodeAdmin,n.repoInfo_.persistenceKey,n.repoInfo_.includeNamespaceInQueryParams,!0),i&&(n.authTokenProvider_=i)}function Dye(n,e,t,i,r){let s=i||n.options.databaseURL;s===void 0&&(n.options.projectId||lc("Can't determine Firebase Database URL. Be sure to include  a Project ID when calling firebase.initializeApp()."),Qr("Using default host for project ",n.options.projectId),s=`${n.options.projectId}-default-rtdb.firebaseio.com`);let o=GU(s,r),a=o.repoInfo,l;typeof process<"u"&&cU&&(l=cU[Rye]),l?(s=`http://${l}?ns=${a.namespace}`,o=GU(s,r),a=o.repoInfo):o.repoInfo.secure;const c=new mme(n.name,n.options,e);uye("Invalid Firebase Database URL",o),In(o.path)||lc("Database URL must point to the root of a Firebase Database (not including a child path).");const u=kye(a,n,c,new pme(n.name,t));return new Bye(u,n)}function Lye(n,e){const t=_R[e];(!t||t[n.key]!==n)&&lc(`Database ${e}(${n.repoInfo_}) has already been deleted.`),Aye(n),delete t[n.key]}function kye(n,e,t,i){let r=_R[e.name];r||(r={},_R[e.name]=r);let s=r[n.toURLString()];return s&&lc("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),s=new yye(n,Pye,t,i),r[n.toURLString()]=s,s}class Bye{constructor(e,t){this._repoInternal=e,this.app=t,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(vye(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new Wm(this._repo,Zn())),this._rootInternal}_delete(){return this._rootInternal!==null&&(Lye(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(e){this._rootInternal===null&&lc("Cannot call "+e+" on a deleted database.")}}function Oye(n=H2(),e){const t=NA(n,"database").getImmediate({identifier:e});if(!t._instanceStarted){const i=$6("database");i&&Fye(t,...i)}return t}function Fye(n,e,t,i={}){n=zi(n),n._checkNotDeleted("useEmulator"),n._instanceStarted&&lc("Cannot call useEmulator() after instance has already been initialized.");const r=n._repoInternal;let s;if(r.repoInfo_.nodeAdmin)i.mockUserToken&&lc('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),s=new jw(jw.OWNER);else if(i.mockUserToken){const o=typeof i.mockUserToken=="string"?i.mockUserToken:Z6(i.mockUserToken,n.app.options.projectId);s=new jw(o)}Nye(r,e,t,s)}/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Uye(n){Zpe(qd),Md(new Du("database",(e,{instanceIdentifier:t})=>{const i=e.getProvider("app").getImmediate(),r=e.getProvider("auth-internal"),s=e.getProvider("app-check-internal");return Dye(i,r,s,t)},"PUBLIC").setMultipleInstances(!0)),qa(uU,hU,n),qa(uU,hU,"esm2017")}Yl.prototype.simpleListen=function(n,e){this.sendRequest("q",{p:n},e)};Yl.prototype.echo=function(n,e){this.sendRequest("echo",{d:n},e)};Uye();const Vye={apiKey:"AIzaSyBCeh5e5fj4K4Y4VpXCKFKTyMINEAFz1Z0",authDomain:"project-crafty-4c1d0.firebaseapp.com",databaseURL:"https://project-crafty-4c1d0-default-rtdb.firebaseio.com",projectId:"project-crafty-4c1d0",storageBucket:"project-crafty-4c1d0.firebasestorage.app",messagingSenderId:"106511799746",appId:"1:106511799746:web:34388a60f7e27c1832325b",measurementId:"G-W9LK0WGX56"},aD=sj(Vye),B0=Jpe(aD),os=Sde(aD);Oye(aD);function cc(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")}function T7(n){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)}function zye(n){return/^[a-zA-Z0-9_]{3,20}$/.test(n)}function Hye(){const n="ABCDEFGHJKLMNPQRSTUVWXYZ23456789";let e="";for(let t=0;t<6;t++)e+=n.charAt(Math.floor(Math.random()*n.length));return e}function Gye(n){const e=xv(gc(os,"globalChat"),JA("createdAt","asc"));return ZA(e,t=>{const i=t.docs.map(r=>({id:r.id,...r.data()}));n(i)})}async function jye(n,e,t){const i=cc(t.trim());!i||i.length>500||await QA(gc(os,"globalChat"),{text:i,senderId:n,senderName:cc(e),createdAt:Fu()})}async function b7(n){if(!n.trim())return[];const e=cc(n.trim()),t=xv(gc(os,"users"),iR("username",">=",e),iR("username","<=",e+""),b8(20));return(await Ode(t)).docs.map(r=>({uid:r.id,...r.data()}))}function Wye(n,e){const t=xv(gc(os,"friendRequests"),iR("toUid","==",n),JA("createdAt","desc"));return ZA(t,i=>{e(i.docs.map(r=>({id:r.id,...r.data()})))})}async function Kye(n,e,t){await QA(gc(os,"friendRequests"),{fromUid:n,fromName:cc(e),toUid:t,status:"pending",createdAt:Fu()})}async function jU(n,e){await IN(Yu(os,"friendRequests",n),{status:e})}function Xye(n){const e=xv(gc(os,"communityPosts"),JA("createdAt","desc"),b8(50));return ZA(e,t=>{const i=t.docs.map(r=>({id:r.id,...r.data()}));n(i)})}async function qye(n,e,t,i){const r=cc(t.trim());!r||r.length>1e3||await QA(gc(os,"communityPosts"),{authorUid:n,authorName:cc(e),authorAvatar:"",content:r,image:null,likes:0,views:0,createdAt:Fu()})}async function Yye(n){await IN(Yu(os,"communityPosts",n),{likes:N8(1)})}async function $ye(n){await IN(Yu(os,"communityPosts",n),{likes:N8(-1)})}function Jye(n,e){const t=xv(gc(os,"communityPosts",n,"comments"),JA("createdAt","asc"));return ZA(t,i=>{e(i.docs.map(r=>({id:r.id,...r.data()})))})}async function Qye(n,e,t,i){const r=cc(i.trim());!r||r.length>500||await QA(gc(os,"communityPosts",n,"comments"),{authorUid:e,authorName:cc(t),text:r,likes:0,createdAt:Fu()})}const xR="https://file.garden/aS2_Au6dLxrEuvxH/122_Sem_Titulo_20260111083529.png",Zye=({uid:n,username:e,onBack:t})=>{const[i,r]=V.useState([]),[s,o]=V.useState(""),a=V.useRef(null);V.useEffect(()=>Gye(u=>{r(u),setTimeout(()=>{var h;return(h=a.current)==null?void 0:h.scrollTo({top:a.current.scrollHeight,behavior:"smooth"})},100)}),[]);const l=async()=>{if(!s.trim())return;const c=s;o(""),await jye(n,e,c)};return S.jsxs(Le.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",bounce:.15,duration:.4},className:"fixed inset-0 bg-secondary flex flex-col z-[60]",children:[S.jsx("header",{className:"flex items-center justify-between px-3 pt-9 pb-2 bg-card/80 backdrop-blur-md border-b border-card shadow-depth",children:S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:t,className:"p-1 active:scale-90 transition-transform",children:S.jsx(YH,{size:22,className:"text-muted-foreground"})}),S.jsx("div",{className:"w-8 h-8 rounded-md bg-primary/10 flex items-center justify-center",children:S.jsx(v1,{size:18,className:"text-primary"})}),S.jsxs("div",{className:"flex flex-col",children:[S.jsx("span",{className:"text-[13px] text-foreground leading-tight font-medium",children:"Global Chat"}),S.jsx("span",{className:"text-[9px] text-green-500",children:"Live"})]})]})}),S.jsxs("div",{ref:a,className:"flex-1 overflow-y-auto p-3 space-y-2 bg-secondary shadow-inner",children:[i.length===0&&S.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-muted-foreground/40",children:[S.jsx(v1,{size:32,className:"mb-2"}),S.jsx("p",{className:"text-xs",children:"No messages yet. Say hello!"})]}),i.map(c=>S.jsxs(Le.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},className:`flex ${c.senderId===n?"justify-end":"justify-start"} items-end gap-1.5`,children:[c.senderId!==n&&S.jsx("div",{className:"w-6 h-6 rounded-md overflow-hidden flex-shrink-0 border border-card shadow-sm",children:S.jsx("img",{src:xR,alt:"pfp",className:"w-full h-full object-cover"})}),S.jsxs("div",{className:`max-w-[75%] px-2.5 py-1.5 rounded-lg shadow-depth ${c.senderId===n?"bg-primary text-primary-foreground":"bg-card text-foreground border border-card"}`,children:[c.senderId!==n&&S.jsx("p",{className:"text-[9px] font-bold text-primary/70 mb-0.5",children:c.senderName}),S.jsx("p",{className:"text-[13px]",children:c.text})]})]},c.id))]}),S.jsxs("div",{className:"bg-card border-t border-border p-2 flex items-center gap-1.5 pb-7 shadow-[0_-4px_10px_rgba(0,0,0,0.04)]",children:[S.jsx("div",{className:"flex-1 bg-secondary border border-border rounded-md px-2.5 py-1.5 shadow-inner",children:S.jsx("input",{type:"text",value:s,onChange:c=>o(c.target.value),onKeyDown:c=>c.key==="Enter"&&l(),className:"w-full bg-transparent outline-none text-[13px] text-foreground",placeholder:"Type a message..."})}),S.jsx(Le.button,{whileTap:{scale:.85},onClick:l,className:"p-2 rounded-xl key-button-red",children:S.jsx(XP,{size:16,className:"text-primary-foreground"})})]})]})},e0e=({uid:n,username:e,onOpenProfile:t,onChatOpen:i})=>{const[r,s]=V.useState("Chat"),[o,a]=V.useState(!1),[l,c]=V.useState(""),[u,h]=V.useState([]),[f,m]=V.useState(!1),[y,_]=V.useState([]);V.useEffect(()=>{i==null||i(o)},[o,i]),V.useEffect(()=>n?Wye(n,_):void 0,[n]),V.useEffect(()=>{if(!l.trim()){h([]);return}const A=setTimeout(async()=>{m(!0);const T=await b7(l);h(T.filter(L=>L.uid!==n)),m(!1)},400);return()=>clearTimeout(A)},[l,n]);const v=async A=>{await jU(A,"accepted")},g=async A=>{await jU(A,"rejected")},w=y.filter(A=>A.status==="pending").length;return S.jsxs("div",{className:"flex flex-col min-h-full pb-28 text-foreground",children:[S.jsx(Gs,{children:o&&S.jsx(Zye,{uid:n,username:e,onBack:()=>a(!1)})}),S.jsxs("header",{className:"px-4 pt-9 pb-2",children:[S.jsxs("div",{className:"flex items-center justify-between mb-3",children:[S.jsxs("div",{className:"flex flex-col",children:[S.jsx("h1",{className:"text-lg text-foreground tracking-tight font-semibold",children:"Social"}),S.jsx("span",{className:"text-[9px] text-muted-foreground uppercase tracking-widest font-medium",children:"Global Network"})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(Le.button,{whileTap:{scale:.85},className:"p-1.5 bg-card rounded-full shadow-depth border border-card",children:S.jsx($M,{size:18,className:"text-muted-foreground"})}),S.jsx(Le.button,{whileTap:{scale:.85},className:"p-1.5 bg-card rounded-full shadow-depth border border-card",children:S.jsx(tm,{size:18,className:"text-muted-foreground"})})]})]}),S.jsxs("div",{className:"flex items-center bg-card border border-card rounded-lg px-2.5 py-1.5 shadow-depth mb-3 relative overflow-hidden",children:[S.jsx(d0,{size:14,className:"text-muted-foreground mr-2"}),S.jsx("input",{type:"text",value:l,onChange:A=>c(A.target.value),placeholder:"Search users by username...",className:"bg-transparent border-none outline-none w-full text-[12px] text-foreground placeholder:text-muted-foreground"}),S.jsx(Sy,{size:14,className:"text-primary ml-2"})]}),S.jsx("div",{className:"flex gap-3",children:["Chat","Users","Request"].map(A=>S.jsxs("button",{onClick:()=>s(A),className:`pb-1.5 text-[13px] transition-all relative px-1 ${r===A?"text-primary font-semibold":"text-muted-foreground"}`,children:[A,A==="Request"&&w>0&&S.jsx(Le.span,{initial:{scale:0},animate:{scale:1},className:"absolute -top-1 -right-2 w-3.5 h-3.5 bg-primary text-primary-foreground text-[8px] font-bold rounded-full flex items-center justify-center",children:w}),r===A&&S.jsx(Le.div,{layoutId:"chat-tab-indicator",className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary rounded-full shadow-[0_0_6px_hsl(var(--glow-red))]"})]},A))})]}),S.jsxs("main",{className:"flex-1 overflow-y-auto bg-card rounded-t-2xl shadow-elevated border-t border-border",children:[r==="Chat"&&S.jsx("div",{className:"flex flex-col",children:S.jsxs(Le.button,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},onClick:()=>a(!0),className:"flex items-center px-3 py-3 hover:bg-secondary active:bg-muted transition-all border-b border-border/30 text-left group",children:[S.jsx("div",{className:"mr-2.5 flex-shrink-0",children:S.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center shadow-depth",children:S.jsx(v1,{size:20,className:"text-primary"})})}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsx("span",{className:"text-[13px] text-foreground font-bold",children:"Global Chat"}),S.jsxs("span",{className:"text-[9px] text-green-500 font-medium flex items-center gap-0.5",children:[S.jsx("div",{className:"w-1.5 h-1.5 bg-green-500 rounded-full animate-pulse"})," Live"]})]}),S.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Chat with everyone in real-time"})]})]})}),r==="Users"&&S.jsxs("div",{className:"flex flex-col",children:[f&&S.jsx("div",{className:"flex items-center justify-center py-8",children:S.jsx("div",{className:"w-5 h-5 border-2 border-border border-t-primary rounded-full animate-spin"})}),!f&&u.length===0&&l&&S.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[S.jsx(d0,{size:28,className:"mb-2 opacity-30"}),S.jsxs("p",{className:"text-xs font-medium",children:['No users found for "',l,'"']})]}),!f&&u.length===0&&!l&&S.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground/50",children:[S.jsx(fA,{size:28,className:"mb-2"}),S.jsx("p",{className:"text-xs font-medium",children:"Search for users by username"})]}),u.map((A,T)=>S.jsxs(Le.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{delay:T*.03},className:"flex items-center px-3 py-2.5 border-b border-border/30 group",children:[S.jsxs("div",{className:"mr-2.5 flex-shrink-0 relative",children:[S.jsx("div",{className:"w-10 h-10 rounded-lg overflow-hidden bg-secondary border border-border shadow-depth",children:S.jsx("img",{src:xR,alt:"pfp",className:"w-full h-full object-cover"})}),A.isOnline&&S.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 bg-green-500 border-2 border-card rounded-full"})]}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsx("span",{className:"text-[13px] text-foreground block font-medium",children:A.username}),S.jsxs("span",{className:`text-[11px] ${A.isOnline?"text-green-500":"text-muted-foreground"}`,children:[A.isOnline?"Online":"Offline"," • Lv.",A.level||1]})]}),S.jsx(Le.button,{whileTap:{scale:.85},onClick:()=>Kye(n,e,A.uid),className:"p-2 rounded-xl bg-primary/10 text-primary",children:S.jsx(Sy,{size:14})})]},A.uid))]}),r==="Request"&&S.jsxs("div",{className:"flex flex-col",children:[y.length===0&&S.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground/50",children:[S.jsx(Sy,{size:28,className:"mb-2"}),S.jsx("p",{className:"text-xs font-medium",children:"No friend requests"})]}),y.map((A,T)=>S.jsxs(Le.div,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{delay:T*.05},className:`flex items-center px-3 py-2.5 border-b border-border/30 transition-all ${A.status==="accepted"?"bg-green-50":A.status==="rejected"?"bg-secondary opacity-50":"bg-gradient-to-r from-transparent to-primary/5"}`,children:[S.jsx("div",{className:"mr-2.5 flex-shrink-0",children:S.jsx("div",{className:"w-10 h-10 rounded-lg overflow-hidden bg-card border border-border shadow-depth",children:S.jsx("img",{src:xR,alt:"pfp",className:"w-full h-full object-cover"})})}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsx("span",{className:"text-[13px] text-foreground block truncate font-medium",children:A.fromName}),S.jsx("span",{className:"text-[10px] text-muted-foreground block truncate",children:A.status==="accepted"?"Friend added!":A.status==="rejected"?"Declined":"Wants to be your friend"})]}),S.jsx(Gs,{mode:"wait",children:A.status==="pending"&&S.jsxs(Le.div,{exit:{scale:0,opacity:0},className:"flex gap-1.5 ml-2",children:[S.jsx(Le.button,{whileTap:{scale:.8},onClick:()=>v(A.id),className:"w-7 h-7 rounded-full bg-card text-green-600 flex items-center justify-center border border-green-100 shadow-depth",children:S.jsx(dA,{size:14})}),S.jsx(Le.button,{whileTap:{scale:.8},onClick:()=>g(A.id),className:"w-7 h-7 rounded-full bg-card text-primary flex items-center justify-center border border-primary/20 shadow-depth",children:S.jsx(sv,{size:14})})]})})]},A.id))]})]})]})},t0e="https://file.garden/aS2_Au6dLxrEuvxH/90_Sem_Titulo_20251211172932.png",n0e="https://file.garden/aS2_Au6dLxrEuvxH/IMG_7064.png",i0e="https://file.garden/aS2_Au6dLxrEuvxH/IMG_6859.png",C7=({onBack:n})=>{const[e,t]=V.useState("dossier"),[i,r]=V.useState(!1),[s,o]=V.useState(!1),[a,l]=V.useState(0);return S.jsxs(Le.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",bounce:.12,duration:.4},className:"fixed inset-0 bg-background flex flex-col z-[55]",children:[S.jsxs("div",{className:"flex justify-between items-center px-5 pt-11 pb-3 z-50 bg-card/80 backdrop-blur-md border-b border-border/20",children:[S.jsx(Le.button,{whileTap:{scale:.85},onClick:n,className:"p-2.5 bg-secondary rounded-2xl border border-border/50 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.06)]",children:S.jsx(YH,{size:18,className:"text-muted-foreground"})}),S.jsx("h2",{className:"text-[10px] font-extrabold tracking-[0.2em] uppercase text-foreground",children:"Profile"}),S.jsx(Le.button,{whileTap:{scale:.85},onClick:()=>r(!0),className:"p-2.5 bg-secondary rounded-2xl border border-border/50 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.06)]",children:S.jsx(tG,{size:16,className:"text-muted-foreground"})})]}),S.jsx("div",{className:"relative px-5 py-4",children:S.jsxs(Le.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"bg-card rounded-[28px] p-5 shadow-[0_16px_40px_-12px_rgba(0,0,0,0.08)] border border-border/30",children:[S.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[S.jsxs("div",{className:"relative w-[72px] h-[72px] flex items-center justify-center flex-shrink-0",children:[S.jsx(Le.img,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},transition:{delay:.15,type:"spring",bounce:.4},src:t0e,alt:"avatar",className:"w-14 h-14 object-cover rounded-2xl z-[5] shadow-md"}),S.jsx("img",{src:n0e,alt:"frame",className:"absolute w-[72px] h-[72px] z-10 pointer-events-none"})]}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsx("h1",{className:"text-lg font-black text-foreground tracking-tight flex items-center gap-2",children:"Newbie"}),S.jsx("p",{className:"text-[10px] font-mono text-muted-foreground/60 mt-0.5",children:"ID: 866,676,596"}),S.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5",children:[S.jsx("img",{src:i0e,className:"w-4 h-4",alt:"badge"}),S.jsx("span",{className:"text-[9px] font-bold text-primary uppercase tracking-wider",children:"Master"})]})]})]}),S.jsxs("div",{className:"flex gap-2",children:[S.jsxs(Le.button,{whileTap:{scale:.93},onClick:()=>o(!s),className:`flex-1 py-2.5 rounded-2xl font-bold text-xs flex items-center justify-center gap-1.5 transition-all shadow-sm ${s?"bg-secondary text-muted-foreground border border-border/50":"bg-foreground text-card shadow-[0_4px_12px_-2px_rgba(0,0,0,0.15)]"}`,children:[s?S.jsx(JM,{size:14,className:"fill-primary text-primary"}):S.jsx(Sy,{size:14}),s?"Following":"Follow"]}),S.jsxs(Le.button,{whileTap:{scale:.93},className:"flex-1 py-2.5 rounded-2xl bg-secondary border border-border/50 font-bold text-xs text-foreground flex items-center justify-center gap-1.5 shadow-sm",children:[S.jsx(QM,{size:14})," Message"]})]})]})}),S.jsx("div",{className:"px-5 mb-4",children:S.jsx(Le.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{delay:.2},className:"bg-card rounded-[24px] border border-border/30 shadow-[0_8px_30px_-8px_rgba(0,0,0,0.08)] overflow-hidden",children:S.jsxs("div",{className:"relative h-48 bg-gradient-to-b from-secondary/50 to-secondary/20 flex items-center justify-center",children:[S.jsx(Le.div,{animate:{rotateY:a},transition:{type:"spring",stiffness:100,damping:20},className:"relative",children:S.jsx("div",{className:"w-20 h-32 bg-gradient-to-b from-muted-foreground/20 to-muted-foreground/10 rounded-lg border border-border/30 flex items-center justify-center shadow-[0_8px_20px_-4px_rgba(0,0,0,0.1)]",children:S.jsx(Ay,{size:32,className:"text-muted-foreground/30"})})}),S.jsx(Le.button,{whileTap:{scale:.85},onClick:()=>l(c=>c+90),className:"absolute bottom-3 right-3 p-2 bg-card/80 backdrop-blur-sm rounded-xl border border-border/50 shadow-[0_4px_12px_-2px_rgba(0,0,0,0.08)]",children:S.jsx(eG,{size:14,className:"text-muted-foreground"})}),S.jsx("div",{className:"absolute bottom-3 left-3",children:S.jsx("p",{className:"text-[9px] font-bold text-muted-foreground/60 uppercase tracking-widest",children:"3D Skin Preview"})})]})})}),S.jsx(Le.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.15},className:"px-5 mb-4",children:S.jsx("div",{className:"grid grid-cols-4 gap-2",children:[{icon:JM,label:"Followers",value:"12.8k",color:"text-primary"},{icon:tm,label:"Wins",value:"284",color:"text-amber-500"},{icon:cb,label:"Kills",value:"12.4k",color:"text-blue-500"},{icon:su,label:"Level",value:"114",color:"text-purple-500"}].map((c,u)=>S.jsxs(Le.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.25+u*.05},className:"bg-card rounded-2xl p-3 text-center border border-border/30 shadow-[0_4px_12px_-4px_rgba(0,0,0,0.06)]",children:[S.jsx(c.icon,{size:16,className:`${c.color} mx-auto mb-1.5`}),S.jsx("p",{className:"text-sm font-black text-foreground",children:c.value}),S.jsx("p",{className:"text-[8px] text-muted-foreground uppercase tracking-wider font-bold",children:c.label})]},c.label))})}),S.jsx("div",{className:"px-5 flex gap-1 bg-secondary/50 mx-5 rounded-2xl p-1 mb-4",children:["dossier","logs"].map(c=>S.jsx("button",{onClick:()=>t(c),className:`flex-1 py-2.5 rounded-xl text-[11px] font-bold uppercase tracking-wider transition-all ${e===c?"bg-card text-foreground shadow-sm":"text-muted-foreground"}`,children:c==="dossier"?"About":"Activity"},c))}),S.jsx("div",{className:"flex-1 overflow-y-auto px-5 pb-10",children:S.jsxs(Gs,{mode:"wait",children:[e==="dossier"&&S.jsxs(Le.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},exit:{opacity:0,x:10},className:"space-y-4",children:[S.jsxs("div",{className:"bg-card rounded-2xl p-4 border border-border/30 shadow-[0_4px_12px_-4px_rgba(0,0,0,0.05)]",children:[S.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[S.jsx("div",{className:"w-2 h-2 bg-emerald-400 rounded-full animate-pulse"}),S.jsx("p",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-widest",children:"Currently Online"})]}),S.jsxs("p",{className:"text-sm text-foreground font-medium flex items-center gap-1.5",children:[S.jsx(Dl,{size:14,className:"text-blue-500"})," Playing Bedwars..."]})]}),S.jsxs("div",{className:"bg-card rounded-2xl p-4 border border-border/30 shadow-[0_4px_12px_-4px_rgba(0,0,0,0.05)]",children:[S.jsx("p",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-widest mb-2",children:"Bio"}),S.jsx("p",{className:"text-sm text-foreground/80 leading-relaxed",children:"Just a casual gamer who loves Bedwars and Sky Wars. Always looking for new teammates!"})]}),S.jsxs("div",{children:[S.jsx("h3",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground px-1 mb-3",children:"Favorite Games"}),S.jsx("div",{className:"flex gap-3 overflow-x-auto no-scrollbar",children:[{name:"Bedwars",icon:Dl,plays:"2.1k",color:"text-blue-500"},{name:"Sky Wars",icon:cb,plays:"890",color:"text-amber-500"},{name:"Dynamite",icon:Ty,plays:"456",color:"text-orange-500"}].map((c,u)=>S.jsxs(Le.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{delay:.3+u*.08},className:"flex-shrink-0 w-24 bg-card rounded-2xl p-3 text-center border border-border/30 shadow-[0_4px_12px_-4px_rgba(0,0,0,0.05)]",children:[S.jsx("div",{className:"w-10 h-10 rounded-xl bg-secondary flex items-center justify-center mx-auto mb-2",children:S.jsx(c.icon,{size:20,className:c.color})}),S.jsx("p",{className:"text-[11px] font-bold text-foreground",children:c.name}),S.jsxs("p",{className:"text-[9px] text-muted-foreground",children:[c.plays," plays"]})]},c.name))})]})]},"dossier"),e==="logs"&&S.jsx(Le.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},className:"space-y-3",children:[{text:"Won Bedwars Match",time:"2 min ago",badge:"+50 XP",color:"text-emerald-500",icon:tm},{text:"New Achievement: Unstoppable",time:"1 hour ago",badge:"Unlocked",color:"text-amber-500",icon:su},{text:"Joined Sky Wars Lobby",time:"3 hours ago",badge:"",color:"text-blue-500",icon:cb},{text:"Profile Updated",time:"Yesterday",badge:"Done",color:"text-muted-foreground",icon:$H}].map((c,u)=>S.jsxs(Le.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.07},className:`p-4 bg-card rounded-2xl flex items-center gap-3 border border-border/30 shadow-[0_4px_12px_-4px_rgba(0,0,0,0.05)] ${u>=3?"opacity-50":""}`,children:[S.jsx("div",{className:"w-9 h-9 rounded-xl bg-secondary flex items-center justify-center flex-shrink-0",children:S.jsx(c.icon,{size:16,className:c.color})}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsx("p",{className:"text-xs font-bold text-foreground",children:c.text}),S.jsx("p",{className:"text-[10px] text-muted-foreground",children:c.time})]}),c.badge&&S.jsx("span",{className:`${c.color} font-bold text-xs`,children:c.badge})]},u))},"logs")]})}),S.jsx(Gs,{children:i&&S.jsxs(S.Fragment,{children:[S.jsx(Le.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-foreground/20 backdrop-blur-sm z-[90]",onClick:()=>r(!1)}),S.jsxs(Le.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:{type:"spring",bounce:.15,duration:.4},className:"fixed bottom-0 left-0 right-0 bg-card rounded-t-[32px] z-[100] p-6 shadow-[0_-10px_40px_rgba(0,0,0,0.1)]",children:[S.jsx("div",{className:"w-12 h-1.5 bg-secondary rounded-full mx-auto mb-6"}),S.jsxs("div",{className:"space-y-2.5",children:[S.jsxs(Le.button,{whileTap:{scale:.97},className:"w-full flex items-center justify-between p-4 bg-primary/5 text-primary rounded-2xl font-bold border border-primary/10",children:[S.jsx("span",{className:"text-sm",children:"Report Player"}),S.jsx(QH,{size:18})]}),S.jsxs(Le.button,{whileTap:{scale:.97},className:"w-full flex items-center justify-between p-4 bg-secondary text-foreground rounded-2xl font-bold border border-border/50",children:[S.jsx("span",{className:"text-sm",children:"Block User"}),S.jsx(mQ,{size:18})]})]}),S.jsx("button",{onClick:()=>r(!1),className:"w-full py-5 text-muted-foreground font-bold uppercase text-[10px] mt-2 tracking-wider",children:"Dismiss"})]})]})})]})};/**
 * @license
 * Copyright 2010-2024 Three.js Authors
 * SPDX-License-Identifier: MIT
 */const Rv="170",Uh={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Vh={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},M7=0,wR=1,I7=2,r0e=3,R7=0,lS=1,Uy=2,ra=3,ol=0,As=1,No=2,Za=0,yd=1,ER=2,AR=3,SR=4,P7=5,Jc=100,N7=101,D7=102,L7=103,k7=104,B7=200,O7=201,F7=202,U7=203,aE=204,lE=205,V7=206,z7=207,H7=208,G7=209,j7=210,W7=211,K7=212,X7=213,q7=214,cE=0,uE=1,hE=2,Od=3,dE=4,fE=5,pE=6,mE=7,Pv=0,Y7=1,$7=2,el=0,J7=1,Q7=2,Z7=3,lD=4,eK=5,tK=6,nK=7,TR="attached",iK="detached",Vu=300,al=301,zu=302,ym=303,O0=304,Km=306,Hu=1e3,Ui=1001,vm=1002,_r=1003,cS=1004,s0e=1004,Jh=1005,o0e=1005,Gn=1006,Bp=1007,a0e=1007,Oo=1008,bR=1008,Ws=1009,uS=1010,hS=1011,_m=1012,Nv=1013,ll=1014,Ai=1015,yr=1016,dS=1017,fS=1018,Fd=1020,cD=35902,uD=1021,hD=1022,Vi=1023,dD=1024,fD=1025,vd=1026,Ud=1027,Dv=1028,Lv=1029,pD=1030,pS=1031,l0e=1032,mS=1033,Vy=33776,zy=33777,Hy=33778,Gy=33779,gE=35840,yE=35841,vE=35842,_E=35843,xE=36196,wE=37492,EE=37496,AE=37808,SE=37809,TE=37810,bE=37811,CE=37812,ME=37813,IE=37814,RE=37815,PE=37816,NE=37817,DE=37818,LE=37819,kE=37820,BE=37821,jy=36492,OE=36494,FE=36495,mD=36283,UE=36284,VE=36285,zE=36286,rK=2200,sK=2201,oK=2202,xm=2300,wm=2301,Ww=2302,Qh=2400,Zh=2401,F0=2402,gS=2500,gD=2501,aK=0,yD=1,HE=2,lK=3200,cK=3201,c0e=3202,u0e=3203,Qu=0,uK=1,Bl="",ys="srgb",cl="srgb-linear",kv="linear",$n="srgb",h0e=0,zh=7680,d0e=7681,f0e=7682,p0e=7683,m0e=34055,g0e=34056,y0e=5386,v0e=512,_0e=513,x0e=514,w0e=515,E0e=516,A0e=517,S0e=518,CR=519,hK=512,dK=513,fK=514,vD=515,pK=516,mK=517,gK=518,yK=519,U0=35044,T0e=35048,b0e=35040,C0e=35045,M0e=35049,I0e=35041,R0e=35046,P0e=35050,N0e=35042,D0e="100",MR="300 es",Ga=2e3,V0=2001;let hl=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}};const Wr=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let WU=1234567;const _d=Math.PI/180,Em=180/Math.PI;function fo(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Wr[n&255]+Wr[n>>8&255]+Wr[n>>16&255]+Wr[n>>24&255]+"-"+Wr[e&255]+Wr[e>>8&255]+"-"+Wr[e>>16&15|64]+Wr[e>>24&255]+"-"+Wr[t&63|128]+Wr[t>>8&255]+"-"+Wr[t>>16&255]+Wr[t>>24&255]+Wr[i&255]+Wr[i>>8&255]+Wr[i>>16&255]+Wr[i>>24&255]).toLowerCase()}function Pi(n,e,t){return Math.max(e,Math.min(t,n))}function _D(n,e){return(n%e+e)%e}function L0e(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function k0e(n,e,t){return n!==e?(t-n)/(e-n):0}function Wy(n,e,t){return(1-t)*n+t*e}function B0e(n,e,t,i){return Wy(n,e,1-Math.exp(-t*i))}function O0e(n,e=1){return e-Math.abs(_D(n,e*2)-e)}function F0e(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function U0e(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function V0e(n,e){return n+Math.floor(Math.random()*(e-n+1))}function z0e(n,e){return n+Math.random()*(e-n)}function H0e(n){return n*(.5-Math.random())}function G0e(n){n!==void 0&&(WU=n);let e=WU+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function j0e(n){return n*_d}function W0e(n){return n*Em}function K0e(n){return(n&n-1)===0&&n!==0}function X0e(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function q0e(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Y0e(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+i)/2),u=o((e+i)/2),h=s((e-i)/2),f=o((e-i)/2),m=s((i-e)/2),y=o((i-e)/2);switch(r){case"XYX":n.set(a*u,l*h,l*f,a*c);break;case"YZY":n.set(l*f,a*u,l*h,a*c);break;case"ZXZ":n.set(l*h,l*f,a*u,a*c);break;case"XZX":n.set(a*u,l*y,l*m,a*c);break;case"YXY":n.set(l*m,a*u,l*y,a*c);break;case"ZYZ":n.set(l*y,l*m,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function _s(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function dn(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const vK={DEG2RAD:_d,RAD2DEG:Em,generateUUID:fo,clamp:Pi,euclideanModulo:_D,mapLinear:L0e,inverseLerp:k0e,lerp:Wy,damp:B0e,pingpong:O0e,smoothstep:F0e,smootherstep:U0e,randInt:V0e,randFloat:z0e,randFloatSpread:H0e,seededRandom:G0e,degToRad:j0e,radToDeg:W0e,isPowerOfTwo:K0e,ceilPowerOfTwo:X0e,floorPowerOfTwo:q0e,setQuaternionFromProperEuler:Y0e,normalize:dn,denormalize:_s};class Fe{constructor(e=0,t=0){Fe.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(Pi(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class cn{constructor(e,t,i,r,s,o,a,l,c){cn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c)}set(e,t,i,r,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],h=i[7],f=i[2],m=i[5],y=i[8],_=r[0],v=r[3],g=r[6],w=r[1],A=r[4],T=r[7],L=r[2],D=r[5],R=r[8];return s[0]=o*_+a*w+l*L,s[3]=o*v+a*A+l*D,s[6]=o*g+a*T+l*R,s[1]=c*_+u*w+h*L,s[4]=c*v+u*A+h*D,s[7]=c*g+u*T+h*R,s[2]=f*_+m*w+y*L,s[5]=f*v+m*A+y*D,s[8]=f*g+m*T+y*R,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-i*s*u+i*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*o-a*c,f=a*l-u*s,m=c*s-o*l,y=t*h+i*f+r*m;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/y;return e[0]=h*_,e[1]=(r*c-u*i)*_,e[2]=(a*i-r*o)*_,e[3]=f*_,e[4]=(u*t-r*l)*_,e[5]=(r*s-a*t)*_,e[6]=m*_,e[7]=(i*l-c*t)*_,e[8]=(o*t-i*s)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(qb.makeScale(e,t)),this}rotate(e){return this.premultiply(qb.makeRotation(-e)),this}translate(e,t){return this.premultiply(qb.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const qb=new cn;function _K(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const $0e={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function yp(n,e){return new $0e[n](e)}function z0(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function xK(){const n=z0("canvas");return n.style.display="block",n}const KU={};function uy(n){n in KU||(KU[n]=!0,console.warn(n))}function J0e(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}function Q0e(n){const e=n.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Z0e(n){const e=n.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const Mn={enabled:!0,workingColorSpace:cl,spaces:{},convert:function(n,e,t){return this.enabled===!1||e===t||!e||!t||(this.spaces[e].transfer===$n&&(n.r=$l(n.r),n.g=$l(n.g),n.b=$l(n.b)),this.spaces[e].primaries!==this.spaces[t].primaries&&(n.applyMatrix3(this.spaces[e].toXYZ),n.applyMatrix3(this.spaces[t].fromXYZ)),this.spaces[t].transfer===$n&&(n.r=Op(n.r),n.g=Op(n.g),n.b=Op(n.b))),n},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)},getPrimaries:function(n){return this.spaces[n].primaries},getTransfer:function(n){return n===Bl?kv:this.spaces[n].transfer},getLuminanceCoefficients:function(n,e=this.workingColorSpace){return n.fromArray(this.spaces[e].luminanceCoefficients)},define:function(n){Object.assign(this.spaces,n)},_getMatrix:function(n,e,t){return n.copy(this.spaces[e].toXYZ).multiply(this.spaces[t].fromXYZ)},_getDrawingBufferColorSpace:function(n){return this.spaces[n].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(n=this.workingColorSpace){return this.spaces[n].workingColorSpaceConfig.unpackColorSpace}};function $l(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Op(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const XU=[.64,.33,.3,.6,.15,.06],qU=[.2126,.7152,.0722],YU=[.3127,.329],$U=new cn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),JU=new cn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);Mn.define({[cl]:{primaries:XU,whitePoint:YU,transfer:kv,toXYZ:$U,fromXYZ:JU,luminanceCoefficients:qU,workingColorSpaceConfig:{unpackColorSpace:ys},outputColorSpaceConfig:{drawingBufferColorSpace:ys}},[ys]:{primaries:XU,whitePoint:YU,transfer:$n,toXYZ:$U,fromXYZ:JU,luminanceCoefficients:qU,outputColorSpaceConfig:{drawingBufferColorSpace:ys}}});let bf;class wK{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{bf===void 0&&(bf=z0("canvas")),bf.width=e.width,bf.height=e.height;const i=bf.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=bf}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=z0("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=$l(s[o]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor($l(t[i]/255)*255):t[i]=$l(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let eve=0;class ed{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:eve++}),this.uuid=fo(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(Yb(r[o].image)):s.push(Yb(r[o]))}else s=Yb(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function Yb(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?wK.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let tve=0;class qn extends hl{constructor(e=qn.DEFAULT_IMAGE,t=qn.DEFAULT_MAPPING,i=Ui,r=Ui,s=Gn,o=Oo,a=Vi,l=Ws,c=qn.DEFAULT_ANISOTROPY,u=Bl){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:tve++}),this.uuid=fo(),this.name="",this.source=new ed(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Fe(0,0),this.repeat=new Fe(1,1),this.center=new Fe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new cn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Vu)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Hu:e.x=e.x-Math.floor(e.x);break;case Ui:e.x=e.x<0?0:1;break;case vm:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Hu:e.y=e.y-Math.floor(e.y);break;case Ui:e.y=e.y<0?0:1;break;case vm:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}qn.DEFAULT_IMAGE=null;qn.DEFAULT_MAPPING=Vu;qn.DEFAULT_ANISOTROPY=1;class Bn{constructor(e=0,t=0,i=0,r=1){Bn.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],u=l[4],h=l[8],f=l[1],m=l[5],y=l[9],_=l[2],v=l[6],g=l[10];if(Math.abs(u-f)<.01&&Math.abs(h-_)<.01&&Math.abs(y-v)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+_)<.1&&Math.abs(y+v)<.1&&Math.abs(c+m+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const A=(c+1)/2,T=(m+1)/2,L=(g+1)/2,D=(u+f)/4,R=(h+_)/4,I=(y+v)/4;return A>T&&A>L?A<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(A),r=D/i,s=R/i):T>L?T<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(T),i=D/r,s=I/r):L<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(L),i=R/s,r=I/s),this.set(i,r,s,t),this}let w=Math.sqrt((v-y)*(v-y)+(h-_)*(h-_)+(f-u)*(f-u));return Math.abs(w)<.001&&(w=1),this.x=(v-y)/w,this.y=(h-_)/w,this.z=(f-u)/w,this.w=Math.acos((c+m+g-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class EK extends hl{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Bn(0,0,e,t),this.scissorTest=!1,this.viewport=new Bn(0,0,e,t);const r={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Gn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const s=new qn(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];const o=i.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let i=0,r=e.textures.length;i<r;i++)this.textures[i]=e.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new ed(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ss extends EK{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class yS extends qn{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=_r,this.minFilter=_r,this.wrapR=Ui,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class nve extends Ss{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new yS(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class xD extends qn{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=_r,this.minFilter=_r,this.wrapR=Ui,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ive extends Ss{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new xD(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class xr{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,o,a){let l=i[r+0],c=i[r+1],u=i[r+2],h=i[r+3];const f=s[o+0],m=s[o+1],y=s[o+2],_=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h;return}if(a===1){e[t+0]=f,e[t+1]=m,e[t+2]=y,e[t+3]=_;return}if(h!==_||l!==f||c!==m||u!==y){let v=1-a;const g=l*f+c*m+u*y+h*_,w=g>=0?1:-1,A=1-g*g;if(A>Number.EPSILON){const L=Math.sqrt(A),D=Math.atan2(L,g*w);v=Math.sin(v*D)/L,a=Math.sin(a*D)/L}const T=a*w;if(l=l*v+f*T,c=c*v+m*T,u=u*v+y*T,h=h*v+_*T,v===1-a){const L=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=L,c*=L,u*=L,h*=L}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],c=i[r+2],u=i[r+3],h=s[o],f=s[o+1],m=s[o+2],y=s[o+3];return e[t]=a*y+u*h+l*m-c*f,e[t+1]=l*y+u*f+c*h-a*m,e[t+2]=c*y+u*m+a*f-l*h,e[t+3]=u*y-a*h-l*f-c*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(r/2),h=a(s/2),f=l(i/2),m=l(r/2),y=l(s/2);switch(o){case"XYZ":this._x=f*u*h+c*m*y,this._y=c*m*h-f*u*y,this._z=c*u*y+f*m*h,this._w=c*u*h-f*m*y;break;case"YXZ":this._x=f*u*h+c*m*y,this._y=c*m*h-f*u*y,this._z=c*u*y-f*m*h,this._w=c*u*h+f*m*y;break;case"ZXY":this._x=f*u*h-c*m*y,this._y=c*m*h+f*u*y,this._z=c*u*y+f*m*h,this._w=c*u*h-f*m*y;break;case"ZYX":this._x=f*u*h-c*m*y,this._y=c*m*h+f*u*y,this._z=c*u*y-f*m*h,this._w=c*u*h+f*m*y;break;case"YZX":this._x=f*u*h+c*m*y,this._y=c*m*h+f*u*y,this._z=c*u*y-f*m*h,this._w=c*u*h-f*m*y;break;case"XZY":this._x=f*u*h-c*m*y,this._y=c*m*h-f*u*y,this._z=c*u*y+f*m*h,this._w=c*u*h+f*m*y;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],f=i+a+h;if(f>0){const m=.5/Math.sqrt(f+1);this._w=.25/m,this._x=(u-l)*m,this._y=(s-c)*m,this._z=(o-r)*m}else if(i>a&&i>h){const m=2*Math.sqrt(1+i-a-h);this._w=(u-l)/m,this._x=.25*m,this._y=(r+o)/m,this._z=(s+c)/m}else if(a>h){const m=2*Math.sqrt(1+a-i-h);this._w=(s-c)/m,this._x=(r+o)/m,this._y=.25*m,this._z=(l+u)/m}else{const m=2*Math.sqrt(1+h-i-a);this._w=(o-r)/m,this._x=(s+c)/m,this._y=(l+u)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Pi(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-i*c,this._z=s*u+o*c+i*l-r*a,this._w=o*u-i*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*e._y+s*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=o,this._x=i,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const m=1-t;return this._w=m*o+t*this._w,this._x=m*i+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),h=Math.sin((1-t)*u)/c,f=Math.sin(t*u)/c;return this._w=o*h+this._w*f,this._x=i*h+this._x*f,this._y=r*h+this._y*f,this._z=s*h+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class q{constructor(e=0,t=0,i=0){q.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(QU.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(QU.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*i),u=2*(a*t-s*r),h=2*(s*i-o*t);return this.x=t+l*c+o*h-a*u,this.y=i+l*u+a*c-s*h,this.z=r+l*h+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return $b.copy(this).projectOnVector(e),this.sub($b)}reflect(e){return this.sub($b.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(Pi(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const $b=new q,QU=new xr;class ns{constructor(e=new q(1/0,1/0,1/0),t=new q(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(Jo.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(Jo.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Jo.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Jo):Jo.fromBufferAttribute(s,o),Jo.applyMatrix4(e.matrixWorld),this.expandByPoint(Jo);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),mx.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),mx.copy(i.boundingBox)),mx.applyMatrix4(e.matrixWorld),this.union(mx)}const r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Jo),Jo.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Bg),gx.subVectors(this.max,Bg),Cf.subVectors(e.a,Bg),Mf.subVectors(e.b,Bg),If.subVectors(e.c,Bg),Rc.subVectors(Mf,Cf),Pc.subVectors(If,Mf),_h.subVectors(Cf,If);let t=[0,-Rc.z,Rc.y,0,-Pc.z,Pc.y,0,-_h.z,_h.y,Rc.z,0,-Rc.x,Pc.z,0,-Pc.x,_h.z,0,-_h.x,-Rc.y,Rc.x,0,-Pc.y,Pc.x,0,-_h.y,_h.x,0];return!Jb(t,Cf,Mf,If,gx)||(t=[1,0,0,0,1,0,0,0,1],!Jb(t,Cf,Mf,If,gx))?!1:(yx.crossVectors(Rc,Pc),t=[yx.x,yx.y,yx.z],Jb(t,Cf,Mf,If,gx))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Jo).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Jo).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:(El[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),El[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),El[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),El[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),El[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),El[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),El[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),El[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(El),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const El=[new q,new q,new q,new q,new q,new q,new q,new q],Jo=new q,mx=new ns,Cf=new q,Mf=new q,If=new q,Rc=new q,Pc=new q,_h=new q,Bg=new q,gx=new q,yx=new q,xh=new q;function Jb(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){xh.fromArray(n,s);const a=r.x*Math.abs(xh.x)+r.y*Math.abs(xh.y)+r.z*Math.abs(xh.z),l=e.dot(xh),c=t.dot(xh),u=i.dot(xh);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const rve=new ns,Og=new q,Qb=new q;class Rr{constructor(e=new q,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):rve.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Og.subVectors(e,this.center);const t=Og.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Og,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Qb.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Og.copy(e.center).add(Qb)),this.expandByPoint(Og.copy(e.center).sub(Qb))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Al=new q,Zb=new q,vx=new q,Nc=new q,eC=new q,_x=new q,tC=new q;class ef{constructor(e=new q,t=new q(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,Al)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Al.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Al.copy(this.origin).addScaledVector(this.direction,t),Al.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Zb.copy(e).add(t).multiplyScalar(.5),vx.copy(t).sub(e).normalize(),Nc.copy(this.origin).sub(Zb);const s=e.distanceTo(t)*.5,o=-this.direction.dot(vx),a=Nc.dot(this.direction),l=-Nc.dot(vx),c=Nc.lengthSq(),u=Math.abs(1-o*o);let h,f,m,y;if(u>0)if(h=o*l-a,f=o*a-l,y=s*u,h>=0)if(f>=-y)if(f<=y){const _=1/u;h*=_,f*=_,m=h*(h+o*f+2*a)+f*(o*h+f+2*l)+c}else f=s,h=Math.max(0,-(o*f+a)),m=-h*h+f*(f+2*l)+c;else f=-s,h=Math.max(0,-(o*f+a)),m=-h*h+f*(f+2*l)+c;else f<=-y?(h=Math.max(0,-(-o*s+a)),f=h>0?-s:Math.min(Math.max(-s,-l),s),m=-h*h+f*(f+2*l)+c):f<=y?(h=0,f=Math.min(Math.max(-s,-l),s),m=f*(f+2*l)+c):(h=Math.max(0,-(o*s+a)),f=h>0?s:Math.min(Math.max(-s,-l),s),m=-h*h+f*(f+2*l)+c);else f=o>0?-s:s,h=Math.max(0,-(o*f+a)),m=-h*h+f*(f+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(Zb).addScaledVector(vx,f),m}intersectSphere(e,t){Al.subVectors(e.center,this.origin);const i=Al.dot(this.direction),r=Al.dot(Al)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,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 i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return c>=0?(i=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(i=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,o=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,o=(e.min.y-f.y)*u),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o<r||isNaN(r))&&(r=o),h>=0?(a=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(a=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),i>l||a>r)||((a>i||i!==i)&&(i=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Al)!==null}intersectTriangle(e,t,i,r,s){eC.subVectors(t,e),_x.subVectors(i,e),tC.crossVectors(eC,_x);let o=this.direction.dot(tC),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Nc.subVectors(this.origin,e);const l=a*this.direction.dot(_x.crossVectors(Nc,_x));if(l<0)return null;const c=a*this.direction.dot(eC.cross(Nc));if(c<0||l+c>o)return null;const u=-a*Nc.dot(tC);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class qt{constructor(e,t,i,r,s,o,a,l,c,u,h,f,m,y,_,v){qt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c,u,h,f,m,y,_,v)}set(e,t,i,r,s,o,a,l,c,u,h,f,m,y,_,v){const g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=r,g[1]=s,g[5]=o,g[9]=a,g[13]=l,g[2]=c,g[6]=u,g[10]=h,g[14]=f,g[3]=m,g[7]=y,g[11]=_,g[15]=v,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 qt().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/Rf.setFromMatrixColumn(e,0).length(),s=1/Rf.setFromMatrixColumn(e,1).length(),o=1/Rf.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const f=o*u,m=o*h,y=a*u,_=a*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=m+y*c,t[5]=f-_*c,t[9]=-a*l,t[2]=_-f*c,t[6]=y+m*c,t[10]=o*l}else if(e.order==="YXZ"){const f=l*u,m=l*h,y=c*u,_=c*h;t[0]=f+_*a,t[4]=y*a-m,t[8]=o*c,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=m*a-y,t[6]=_+f*a,t[10]=o*l}else if(e.order==="ZXY"){const f=l*u,m=l*h,y=c*u,_=c*h;t[0]=f-_*a,t[4]=-o*h,t[8]=y+m*a,t[1]=m+y*a,t[5]=o*u,t[9]=_-f*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const f=o*u,m=o*h,y=a*u,_=a*h;t[0]=l*u,t[4]=y*c-m,t[8]=f*c+_,t[1]=l*h,t[5]=_*c+f,t[9]=m*c-y,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const f=o*l,m=o*c,y=a*l,_=a*c;t[0]=l*u,t[4]=_-f*h,t[8]=y*h+m,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=m*h+y,t[10]=f-_*h}else if(e.order==="XZY"){const f=o*l,m=o*c,y=a*l,_=a*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=f*h+_,t[5]=o*u,t[9]=m*h-y,t[2]=y*h-m,t[6]=a*u,t[10]=_*h+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(sve,e,ove)}lookAt(e,t,i){const r=this.elements;return no.subVectors(e,t),no.lengthSq()===0&&(no.z=1),no.normalize(),Dc.crossVectors(i,no),Dc.lengthSq()===0&&(Math.abs(i.z)===1?no.x+=1e-4:no.z+=1e-4,no.normalize(),Dc.crossVectors(i,no)),Dc.normalize(),xx.crossVectors(no,Dc),r[0]=Dc.x,r[4]=xx.x,r[8]=no.x,r[1]=Dc.y,r[5]=xx.y,r[9]=no.y,r[2]=Dc.z,r[6]=xx.z,r[10]=no.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],h=i[5],f=i[9],m=i[13],y=i[2],_=i[6],v=i[10],g=i[14],w=i[3],A=i[7],T=i[11],L=i[15],D=r[0],R=r[4],I=r[8],M=r[12],C=r[1],k=r[5],B=r[9],O=r[13],X=r[2],le=r[6],ie=r[10],de=r[14],G=r[3],$=r[7],te=r[11],ue=r[15];return s[0]=o*D+a*C+l*X+c*G,s[4]=o*R+a*k+l*le+c*$,s[8]=o*I+a*B+l*ie+c*te,s[12]=o*M+a*O+l*de+c*ue,s[1]=u*D+h*C+f*X+m*G,s[5]=u*R+h*k+f*le+m*$,s[9]=u*I+h*B+f*ie+m*te,s[13]=u*M+h*O+f*de+m*ue,s[2]=y*D+_*C+v*X+g*G,s[6]=y*R+_*k+v*le+g*$,s[10]=y*I+_*B+v*ie+g*te,s[14]=y*M+_*O+v*de+g*ue,s[3]=w*D+A*C+T*X+L*G,s[7]=w*R+A*k+T*le+L*$,s[11]=w*I+A*B+T*ie+L*te,s[15]=w*M+A*O+T*de+L*ue,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],h=e[6],f=e[10],m=e[14],y=e[3],_=e[7],v=e[11],g=e[15];return y*(+s*l*h-r*c*h-s*a*f+i*c*f+r*a*m-i*l*m)+_*(+t*l*m-t*c*f+s*o*f-r*o*m+r*c*u-s*l*u)+v*(+t*c*h-t*a*m-s*o*h+i*o*m+s*a*u-i*c*u)+g*(-r*a*u-t*l*h+t*a*f+r*o*h-i*o*f+i*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],m=e[11],y=e[12],_=e[13],v=e[14],g=e[15],w=h*v*c-_*f*c+_*l*m-a*v*m-h*l*g+a*f*g,A=y*f*c-u*v*c-y*l*m+o*v*m+u*l*g-o*f*g,T=u*_*c-y*h*c+y*a*m-o*_*m-u*a*g+o*h*g,L=y*h*l-u*_*l-y*a*f+o*_*f+u*a*v-o*h*v,D=t*w+i*A+r*T+s*L;if(D===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/D;return e[0]=w*R,e[1]=(_*f*s-h*v*s-_*r*m+i*v*m+h*r*g-i*f*g)*R,e[2]=(a*v*s-_*l*s+_*r*c-i*v*c-a*r*g+i*l*g)*R,e[3]=(h*l*s-a*f*s-h*r*c+i*f*c+a*r*m-i*l*m)*R,e[4]=A*R,e[5]=(u*v*s-y*f*s+y*r*m-t*v*m-u*r*g+t*f*g)*R,e[6]=(y*l*s-o*v*s-y*r*c+t*v*c+o*r*g-t*l*g)*R,e[7]=(o*f*s-u*l*s+u*r*c-t*f*c-o*r*m+t*l*m)*R,e[8]=T*R,e[9]=(y*h*s-u*_*s-y*i*m+t*_*m+u*i*g-t*h*g)*R,e[10]=(o*_*s-y*a*s+y*i*c-t*_*c-o*i*g+t*a*g)*R,e[11]=(u*a*s-o*h*s-u*i*c+t*h*c+o*i*m-t*a*m)*R,e[12]=L*R,e[13]=(u*_*r-y*h*r+y*i*f-t*_*f-u*i*v+t*h*v)*R,e[14]=(y*a*r-o*_*r-y*i*l+t*_*l+o*i*v-t*a*v)*R,e[15]=(o*h*r-u*a*r+u*i*l-t*h*l-o*i*f+t*a*f)*R,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+i,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,h=a+a,f=s*c,m=s*u,y=s*h,_=o*u,v=o*h,g=a*h,w=l*c,A=l*u,T=l*h,L=i.x,D=i.y,R=i.z;return r[0]=(1-(_+g))*L,r[1]=(m+T)*L,r[2]=(y-A)*L,r[3]=0,r[4]=(m-T)*D,r[5]=(1-(f+g))*D,r[6]=(v+w)*D,r[7]=0,r[8]=(y+A)*R,r[9]=(v-w)*R,r[10]=(1-(f+_))*R,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=Rf.set(r[0],r[1],r[2]).length();const o=Rf.set(r[4],r[5],r[6]).length(),a=Rf.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Qo.copy(this);const c=1/s,u=1/o,h=1/a;return Qo.elements[0]*=c,Qo.elements[1]*=c,Qo.elements[2]*=c,Qo.elements[4]*=u,Qo.elements[5]*=u,Qo.elements[6]*=u,Qo.elements[8]*=h,Qo.elements[9]*=h,Qo.elements[10]*=h,t.setFromRotationMatrix(Qo),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=Ga){const l=this.elements,c=2*s/(t-e),u=2*s/(i-r),h=(t+e)/(t-e),f=(i+r)/(i-r);let m,y;if(a===Ga)m=-(o+s)/(o-s),y=-2*o*s/(o-s);else if(a===V0)m=-o/(o-s),y=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=y,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=Ga){const l=this.elements,c=1/(t-e),u=1/(i-r),h=1/(o-s),f=(t+e)*c,m=(i+r)*u;let y,_;if(a===Ga)y=(o+s)*h,_=-2*h;else if(a===V0)y=s*h,_=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=_,l[14]=-y,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const Rf=new q,Qo=new qt,sve=new q(0,0,0),ove=new q(1,1,1),Dc=new q,xx=new q,no=new q,ZU=new qt,e4=new xr;class mo{constructor(e=0,t=0,i=0,r=mo.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],h=r[2],f=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(Pi(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Pi(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(Pi(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,m),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Pi(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Pi(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-Pi(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return ZU.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ZU,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return e4.setFromEuler(this),this.setFromQuaternion(e4,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}mo.DEFAULT_ORDER="XYZ";class xd{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let ave=0;const t4=new q,Pf=new xr,Sl=new qt,wx=new q,Fg=new q,lve=new q,cve=new xr,n4=new q(1,0,0),i4=new q(0,1,0),r4=new q(0,0,1),s4={type:"added"},uve={type:"removed"},Nf={type:"childadded",child:null},nC={type:"childremoved",child:null};class Rn extends hl{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ave++}),this.uuid=fo(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Rn.DEFAULT_UP.clone();const e=new q,t=new mo,i=new xr,r=new q(1,1,1);function s(){i.setFromEuler(t,!1)}function o(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new qt},normalMatrix:{value:new cn}}),this.matrix=new qt,this.matrixWorld=new qt,this.matrixAutoUpdate=Rn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Rn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new xd,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Pf.setFromAxisAngle(e,t),this.quaternion.multiply(Pf),this}rotateOnWorldAxis(e,t){return Pf.setFromAxisAngle(e,t),this.quaternion.premultiply(Pf),this}rotateX(e){return this.rotateOnAxis(n4,e)}rotateY(e){return this.rotateOnAxis(i4,e)}rotateZ(e){return this.rotateOnAxis(r4,e)}translateOnAxis(e,t){return t4.copy(e).applyQuaternion(this.quaternion),this.position.add(t4.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(n4,e)}translateY(e){return this.translateOnAxis(i4,e)}translateZ(e){return this.translateOnAxis(r4,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Sl.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?wx.copy(e):wx.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),Fg.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Sl.lookAt(Fg,wx,this.up):Sl.lookAt(wx,Fg,this.up),this.quaternion.setFromRotationMatrix(Sl),r&&(Sl.extractRotation(r.matrixWorld),Pf.setFromRotationMatrix(Sl),this.quaternion.premultiply(Pf.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(s4),Nf.child=e,this.dispatchEvent(Nf),Nf.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(uve),nC.child=e,this.dispatchEvent(nC),nC.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Sl.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Sl.multiply(e.parent.matrixWorld)),e.applyMatrix4(Sl),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(s4),Nf.child=e,this.dispatchEvent(Nf),Nf.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const o=this.children[i].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Fg,e,lve),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Fg,cve,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const h=l[c];s(e.shapes,h)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),h=o(e.shapes),f=o(e.skeletons),m=o(e.animations),y=o(e.nodes);a.length>0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),h.length>0&&(i.shapes=h),f.length>0&&(i.skeletons=f),m.length>0&&(i.animations=m),y.length>0&&(i.nodes=y)}return i.object=r,i;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}Rn.DEFAULT_UP=new q(0,1,0);Rn.DEFAULT_MATRIX_AUTO_UPDATE=!0;Rn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Zo=new q,Tl=new q,iC=new q,bl=new q,Df=new q,Lf=new q,o4=new q,rC=new q,sC=new q,oC=new q,aC=new Bn,lC=new Bn,cC=new Bn;class ks{constructor(e=new q,t=new q,i=new q){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),Zo.subVectors(e,t),r.cross(Zo);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){Zo.subVectors(r,t),Tl.subVectors(i,t),iC.subVectors(e,t);const o=Zo.dot(Zo),a=Zo.dot(Tl),l=Zo.dot(iC),c=Tl.dot(Tl),u=Tl.dot(iC),h=o*c-a*a;if(h===0)return s.set(0,0,0),null;const f=1/h,m=(c*l-a*u)*f,y=(o*u-a*l)*f;return s.set(1-m-y,y,m)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,bl)===null?!1:bl.x>=0&&bl.y>=0&&bl.x+bl.y<=1}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,bl)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,bl.x),l.addScaledVector(o,bl.y),l.addScaledVector(a,bl.z),l)}static getInterpolatedAttribute(e,t,i,r,s,o){return aC.setScalar(0),lC.setScalar(0),cC.setScalar(0),aC.fromBufferAttribute(e,t),lC.fromBufferAttribute(e,i),cC.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(aC,s.x),o.addScaledVector(lC,s.y),o.addScaledVector(cC,s.z),o}static isFrontFacing(e,t,i,r){return Zo.subVectors(i,t),Tl.subVectors(e,t),Zo.cross(Tl).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Zo.subVectors(this.c,this.b),Tl.subVectors(this.a,this.b),Zo.cross(Tl).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ks.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ks.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return ks.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return ks.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ks.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let o,a;Df.subVectors(r,i),Lf.subVectors(s,i),rC.subVectors(e,i);const l=Df.dot(rC),c=Lf.dot(rC);if(l<=0&&c<=0)return t.copy(i);sC.subVectors(e,r);const u=Df.dot(sC),h=Lf.dot(sC);if(u>=0&&h<=u)return t.copy(r);const f=l*h-u*c;if(f<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(i).addScaledVector(Df,o);oC.subVectors(e,s);const m=Df.dot(oC),y=Lf.dot(oC);if(y>=0&&m<=y)return t.copy(s);const _=m*c-l*y;if(_<=0&&c>=0&&y<=0)return a=c/(c-y),t.copy(i).addScaledVector(Lf,a);const v=u*y-m*h;if(v<=0&&h-u>=0&&m-y>=0)return o4.subVectors(s,r),a=(h-u)/(h-u+(m-y)),t.copy(r).addScaledVector(o4,a);const g=1/(v+_+f);return o=_*g,a=f*g,t.copy(i).addScaledVector(Df,o).addScaledVector(Lf,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const AK={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},Lc={h:0,s:0,l:0},Ex={h:0,s:0,l:0};function uC(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class ft{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ys){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Mn.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=Mn.workingColorSpace){return this.r=e,this.g=t,this.b=i,Mn.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=Mn.workingColorSpace){if(e=_D(e,1),t=Pi(t,0,1),i=Pi(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=uC(o,s,e+1/3),this.g=uC(o,s,e),this.b=uC(o,s,e-1/3)}return Mn.toWorkingColorSpace(this,r),this}setStyle(e,t=ys){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=ys){const i=AK[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=$l(e.r),this.g=$l(e.g),this.b=$l(e.b),this}copyLinearToSRGB(e){return this.r=Op(e.r),this.g=Op(e.g),this.b=Op(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ys){return Mn.fromWorkingColorSpace(Kr.copy(this),e),Math.round(Pi(Kr.r*255,0,255))*65536+Math.round(Pi(Kr.g*255,0,255))*256+Math.round(Pi(Kr.b*255,0,255))}getHexString(e=ys){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Mn.workingColorSpace){Mn.fromWorkingColorSpace(Kr.copy(this),t);const i=Kr.r,r=Kr.g,s=Kr.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const h=o-a;switch(c=u<=.5?h/(o+a):h/(2-o-a),o){case i:l=(r-s)/h+(r<s?6:0);break;case r:l=(s-i)/h+2;break;case s:l=(i-r)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=Mn.workingColorSpace){return Mn.fromWorkingColorSpace(Kr.copy(this),t),e.r=Kr.r,e.g=Kr.g,e.b=Kr.b,e}getStyle(e=ys){Mn.fromWorkingColorSpace(Kr.copy(this),e);const t=Kr.r,i=Kr.g,r=Kr.b;return e!==ys?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(Lc),this.setHSL(Lc.h+e,Lc.s+t,Lc.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(Lc),e.getHSL(Ex);const i=Wy(Lc.h,Ex.h,t),r=Wy(Lc.s,Ex.s,t),s=Wy(Lc.l,Ex.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Kr=new ft;ft.NAMES=AK;let hve=0;class or extends hl{static get type(){return"Material"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:hve++}),this.uuid=fo(),this.name="",this.blending=yd,this.side=ol,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=aE,this.blendDst=lE,this.blendEquation=Jc,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ft(0,0,0),this.blendAlpha=0,this.depthFunc=Od,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=CR,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=zh,this.stencilZFail=zh,this.stencilZPass=zh,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}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==yd&&(i.blending=this.blending),this.side!==ol&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==aE&&(i.blendSrc=this.blendSrc),this.blendDst!==lE&&(i.blendDst=this.blendDst),this.blendEquation!==Jc&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==Od&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==CR&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==zh&&(i.stencilFail=this.stencilFail),this.stencilZFail!==zh&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==zh&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Fs extends or{static get type(){return"MeshBasicMaterial"}constructor(e){super(),this.isMeshBasicMaterial=!0,this.color=new ft(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mo,this.combine=Pv,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Ol=dve();function dve(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;!(c&8388608);)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function Ps(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=Pi(n,-65504,65504),Ol.floatView[0]=n;const e=Ol.uint32View[0],t=e>>23&511;return Ol.baseTable[t]+((e&8388607)>>Ol.shiftTable[t])}function hy(n){const e=n>>10;return Ol.uint32View[0]=Ol.mantissaTable[Ol.offsetTable[e]+(n&1023)]+Ol.exponentTable[e],Ol.floatView[0]}const td={toHalfFloat:Ps,fromHalfFloat:hy},qi=new q,Ax=new Fe;class Fn{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=U0,this.updateRanges=[],this.gpuType=Ai,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Ax.fromBufferAttribute(this,t),Ax.applyMatrix3(e),this.setXY(t,Ax.x,Ax.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)qi.fromBufferAttribute(this,t),qi.applyMatrix3(e),this.setXYZ(t,qi.x,qi.y,qi.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)qi.fromBufferAttribute(this,t),qi.applyMatrix4(e),this.setXYZ(t,qi.x,qi.y,qi.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)qi.fromBufferAttribute(this,t),qi.applyNormalMatrix(e),this.setXYZ(t,qi.x,qi.y,qi.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)qi.fromBufferAttribute(this,t),qi.transformDirection(e),this.setXYZ(t,qi.x,qi.y,qi.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=_s(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=dn(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=_s(t,this.array)),t}setX(e,t){return this.normalized&&(t=dn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=_s(t,this.array)),t}setY(e,t){return this.normalized&&(t=dn(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=_s(t,this.array)),t}setZ(e,t){return this.normalized&&(t=dn(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=_s(t,this.array)),t}setW(e,t){return this.normalized&&(t=dn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=dn(t,this.array),i=dn(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=dn(t,this.array),i=dn(i,this.array),r=dn(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=dn(t,this.array),i=dn(i,this.array),r=dn(r,this.array),s=dn(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==U0&&(e.usage=this.usage),e}}class fve extends Fn{constructor(e,t,i){super(new Int8Array(e),t,i)}}class pve extends Fn{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class mve extends Fn{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class gve extends Fn{constructor(e,t,i){super(new Int16Array(e),t,i)}}class wD extends Fn{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class yve extends Fn{constructor(e,t,i){super(new Int32Array(e),t,i)}}class ED extends Fn{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class vve extends Fn{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}getX(e){let t=hy(this.array[e*this.itemSize]);return this.normalized&&(t=_s(t,this.array)),t}setX(e,t){return this.normalized&&(t=dn(t,this.array)),this.array[e*this.itemSize]=Ps(t),this}getY(e){let t=hy(this.array[e*this.itemSize+1]);return this.normalized&&(t=_s(t,this.array)),t}setY(e,t){return this.normalized&&(t=dn(t,this.array)),this.array[e*this.itemSize+1]=Ps(t),this}getZ(e){let t=hy(this.array[e*this.itemSize+2]);return this.normalized&&(t=_s(t,this.array)),t}setZ(e,t){return this.normalized&&(t=dn(t,this.array)),this.array[e*this.itemSize+2]=Ps(t),this}getW(e){let t=hy(this.array[e*this.itemSize+3]);return this.normalized&&(t=_s(t,this.array)),t}setW(e,t){return this.normalized&&(t=dn(t,this.array)),this.array[e*this.itemSize+3]=Ps(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=dn(t,this.array),i=dn(i,this.array)),this.array[e+0]=Ps(t),this.array[e+1]=Ps(i),this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=dn(t,this.array),i=dn(i,this.array),r=dn(r,this.array)),this.array[e+0]=Ps(t),this.array[e+1]=Ps(i),this.array[e+2]=Ps(r),this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=dn(t,this.array),i=dn(i,this.array),r=dn(r,this.array),s=dn(s,this.array)),this.array[e+0]=Ps(t),this.array[e+1]=Ps(i),this.array[e+2]=Ps(r),this.array[e+3]=Ps(s),this}}class Ot extends Fn{constructor(e,t,i){super(new Float32Array(e),t,i)}}let _ve=0;const Co=new qt,hC=new Rn,kf=new q,io=new ns,Ug=new ns,hr=new q;class un extends hl{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:_ve++}),this.uuid=fo(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(_K(e)?ED:wD)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new cn().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Co.makeRotationFromQuaternion(e),this.applyMatrix4(Co),this}rotateX(e){return Co.makeRotationX(e),this.applyMatrix4(Co),this}rotateY(e){return Co.makeRotationY(e),this.applyMatrix4(Co),this}rotateZ(e){return Co.makeRotationZ(e),this.applyMatrix4(Co),this}translate(e,t,i){return Co.makeTranslation(e,t,i),this.applyMatrix4(Co),this}scale(e,t,i){return Co.makeScale(e,t,i),this.applyMatrix4(Co),this}lookAt(e){return hC.lookAt(e),hC.updateMatrix(),this.applyMatrix4(hC.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(kf).negate(),this.translate(kf.x,kf.y,kf.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const i=[];for(let r=0,s=e.length;r<s;r++){const o=e[r];i.push(o.x,o.y,o.z||0)}this.setAttribute("position",new Ot(i,3))}else{for(let i=0,r=t.count;i<r;i++){const s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ns);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new q(-1/0,-1/0,-1/0),new q(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];io.setFromBufferAttribute(s),this.morphTargetsRelative?(hr.addVectors(this.boundingBox.min,io.min),this.boundingBox.expandByPoint(hr),hr.addVectors(this.boundingBox.max,io.max),this.boundingBox.expandByPoint(hr)):(this.boundingBox.expandByPoint(io.min),this.boundingBox.expandByPoint(io.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 Rr);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new q,1/0);return}if(e){const i=this.boundingSphere.center;if(io.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];Ug.setFromBufferAttribute(a),this.morphTargetsRelative?(hr.addVectors(io.min,Ug.min),io.expandByPoint(hr),hr.addVectors(io.max,Ug.max),io.expandByPoint(hr)):(io.expandByPoint(Ug.min),io.expandByPoint(Ug.max))}io.getCenter(i);let r=0;for(let s=0,o=e.count;s<o;s++)hr.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(hr));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)hr.fromBufferAttribute(a,c),l&&(kf.fromBufferAttribute(e,c),hr.add(kf)),r=Math.max(r,i.distanceToSquared(hr))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Fn(new Float32Array(4*i.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let I=0;I<i.count;I++)a[I]=new q,l[I]=new q;const c=new q,u=new q,h=new q,f=new Fe,m=new Fe,y=new Fe,_=new q,v=new q;function g(I,M,C){c.fromBufferAttribute(i,I),u.fromBufferAttribute(i,M),h.fromBufferAttribute(i,C),f.fromBufferAttribute(s,I),m.fromBufferAttribute(s,M),y.fromBufferAttribute(s,C),u.sub(c),h.sub(c),m.sub(f),y.sub(f);const k=1/(m.x*y.y-y.x*m.y);isFinite(k)&&(_.copy(u).multiplyScalar(y.y).addScaledVector(h,-m.y).multiplyScalar(k),v.copy(h).multiplyScalar(m.x).addScaledVector(u,-y.x).multiplyScalar(k),a[I].add(_),a[M].add(_),a[C].add(_),l[I].add(v),l[M].add(v),l[C].add(v))}let w=this.groups;w.length===0&&(w=[{start:0,count:e.count}]);for(let I=0,M=w.length;I<M;++I){const C=w[I],k=C.start,B=C.count;for(let O=k,X=k+B;O<X;O+=3)g(e.getX(O+0),e.getX(O+1),e.getX(O+2))}const A=new q,T=new q,L=new q,D=new q;function R(I){L.fromBufferAttribute(r,I),D.copy(L);const M=a[I];A.copy(M),A.sub(L.multiplyScalar(L.dot(M))).normalize(),T.crossVectors(D,M);const k=T.dot(l[I])<0?-1:1;o.setXYZW(I,A.x,A.y,A.z,k)}for(let I=0,M=w.length;I<M;++I){const C=w[I],k=C.start,B=C.count;for(let O=k,X=k+B;O<X;O+=3)R(e.getX(O+0)),R(e.getX(O+1)),R(e.getX(O+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Fn(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let f=0,m=i.count;f<m;f++)i.setXYZ(f,0,0,0);const r=new q,s=new q,o=new q,a=new q,l=new q,c=new q,u=new q,h=new q;if(e)for(let f=0,m=e.count;f<m;f+=3){const y=e.getX(f+0),_=e.getX(f+1),v=e.getX(f+2);r.fromBufferAttribute(t,y),s.fromBufferAttribute(t,_),o.fromBufferAttribute(t,v),u.subVectors(o,s),h.subVectors(r,s),u.cross(h),a.fromBufferAttribute(i,y),l.fromBufferAttribute(i,_),c.fromBufferAttribute(i,v),a.add(u),l.add(u),c.add(u),i.setXYZ(y,a.x,a.y,a.z),i.setXYZ(_,l.x,l.y,l.z),i.setXYZ(v,c.x,c.y,c.z)}else for(let f=0,m=t.count;f<m;f+=3)r.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),o.fromBufferAttribute(t,f+2),u.subVectors(o,s),h.subVectors(r,s),u.cross(h),i.setXYZ(f+0,u.x,u.y,u.z),i.setXYZ(f+1,u.x,u.y,u.z),i.setXYZ(f+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)hr.fromBufferAttribute(e,t),hr.normalize(),e.setXYZ(t,hr.x,hr.y,hr.z)}toNonIndexed(){function e(a,l){const c=a.array,u=a.itemSize,h=a.normalized,f=new c.constructor(l.length*u);let m=0,y=0;for(let _=0,v=l.length;_<v;_++){a.isInterleavedBufferAttribute?m=l[_]*a.data.stride+a.offset:m=l[_]*u;for(let g=0;g<u;g++)f[y++]=c[m++]}return new Fn(f,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new un,i=this.index.array,r=this.attributes;for(const a in r){const l=r[a],c=e(l,i);t.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let u=0,h=c.length;u<h;u++){const f=c[u],m=e(f,i);l.push(m)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,f=c.length;h<f;h++){const m=c[h];u.push(m.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let f=0,m=h.length;f<m;f++)u.push(h[f].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,u=o.length;c<u;c++){const h=o[c];this.addGroup(h.start,h.count,h.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const a4=new qt,wh=new ef,Sx=new Rr,l4=new q,Tx=new q,bx=new q,Cx=new q,dC=new q,Mx=new q,c4=new q,Ix=new q;class fi extends Rn{constructor(e=new un,t=new Fs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,o=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const a=this.morphTargetInfluences;if(s&&a){Mx.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=a[l],h=s[l];u!==0&&(dC.fromBufferAttribute(h,e),o?Mx.addScaledVector(dC,u):Mx.addScaledVector(dC.sub(t),u))}t.add(Mx)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Sx.copy(i.boundingSphere),Sx.applyMatrix4(s),wh.copy(e.ray).recast(e.near),!(Sx.containsPoint(wh.origin)===!1&&(wh.intersectSphere(Sx,l4)===null||wh.origin.distanceToSquared(l4)>(e.far-e.near)**2))&&(a4.copy(s).invert(),wh.copy(e.ray).applyMatrix4(a4),!(i.boundingBox!==null&&wh.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,wh)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,f=s.groups,m=s.drawRange;if(a!==null)if(Array.isArray(o))for(let y=0,_=f.length;y<_;y++){const v=f[y],g=o[v.materialIndex],w=Math.max(v.start,m.start),A=Math.min(a.count,Math.min(v.start+v.count,m.start+m.count));for(let T=w,L=A;T<L;T+=3){const D=a.getX(T),R=a.getX(T+1),I=a.getX(T+2);r=Rx(this,g,e,i,c,u,h,D,R,I),r&&(r.faceIndex=Math.floor(T/3),r.face.materialIndex=v.materialIndex,t.push(r))}}else{const y=Math.max(0,m.start),_=Math.min(a.count,m.start+m.count);for(let v=y,g=_;v<g;v+=3){const w=a.getX(v),A=a.getX(v+1),T=a.getX(v+2);r=Rx(this,o,e,i,c,u,h,w,A,T),r&&(r.faceIndex=Math.floor(v/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let y=0,_=f.length;y<_;y++){const v=f[y],g=o[v.materialIndex],w=Math.max(v.start,m.start),A=Math.min(l.count,Math.min(v.start+v.count,m.start+m.count));for(let T=w,L=A;T<L;T+=3){const D=T,R=T+1,I=T+2;r=Rx(this,g,e,i,c,u,h,D,R,I),r&&(r.faceIndex=Math.floor(T/3),r.face.materialIndex=v.materialIndex,t.push(r))}}else{const y=Math.max(0,m.start),_=Math.min(l.count,m.start+m.count);for(let v=y,g=_;v<g;v+=3){const w=v,A=v+1,T=v+2;r=Rx(this,o,e,i,c,u,h,w,A,T),r&&(r.faceIndex=Math.floor(v/3),t.push(r))}}}}function xve(n,e,t,i,r,s,o,a){let l;if(e.side===As?l=i.intersectTriangle(o,s,r,!0,a):l=i.intersectTriangle(r,s,o,e.side===ol,a),l===null)return null;Ix.copy(a),Ix.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(Ix);return c<t.near||c>t.far?null:{distance:c,point:Ix.clone(),object:n}}function Rx(n,e,t,i,r,s,o,a,l,c){n.getVertexPosition(a,Tx),n.getVertexPosition(l,bx),n.getVertexPosition(c,Cx);const u=xve(n,e,t,i,Tx,bx,Cx,c4);if(u){const h=new q;ks.getBarycoord(c4,Tx,bx,Cx,h),r&&(u.uv=ks.getInterpolatedAttribute(r,a,l,c,h,new Fe)),s&&(u.uv1=ks.getInterpolatedAttribute(s,a,l,c,h,new Fe)),o&&(u.normal=ks.getInterpolatedAttribute(o,a,l,c,h,new q),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const f={a,b:l,c,normal:new q,materialIndex:0};ks.getNormal(Tx,bx,Cx,f.normal),u.face=f,u.barycoord=h}return u}class tf extends un{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],h=[];let f=0,m=0;y("z","y","x",-1,-1,i,t,e,o,s,0),y("z","y","x",1,-1,i,t,-e,o,s,1),y("x","z","y",1,1,e,i,t,r,o,2),y("x","z","y",1,-1,e,i,-t,r,o,3),y("x","y","z",1,-1,e,t,i,r,s,4),y("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new Ot(c,3)),this.setAttribute("normal",new Ot(u,3)),this.setAttribute("uv",new Ot(h,2));function y(_,v,g,w,A,T,L,D,R,I,M){const C=T/R,k=L/I,B=T/2,O=L/2,X=D/2,le=R+1,ie=I+1;let de=0,G=0;const $=new q;for(let te=0;te<ie;te++){const ue=te*k-O;for(let ve=0;ve<le;ve++){const be=ve*C-B;$[_]=be*w,$[v]=ue*A,$[g]=X,c.push($.x,$.y,$.z),$[_]=0,$[v]=0,$[g]=D>0?1:-1,u.push($.x,$.y,$.z),h.push(ve/R),h.push(1-te/I),de+=1}}for(let te=0;te<I;te++)for(let ue=0;ue<R;ue++){const ve=f+ue+le*te,be=f+ue+le*(te+1),he=f+(ue+1)+le*(te+1),Pe=f+(ue+1)+le*te;l.push(ve,be,Pe),l.push(be,he,Pe),G+=6}a.addGroup(m,G,M),m+=G,f+=de}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new tf(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Am(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function fs(n){const e={};for(let t=0;t<n.length;t++){const i=Am(n[t]);for(const r in i)e[r]=i[r]}return e}function wve(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function SK(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Mn.workingColorSpace}const TK={clone:Am,merge:fs};var Eve=`void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,Ave=`void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class ss extends or{static get type(){return"ShaderMaterial"}constructor(e){super(),this.isShaderMaterial=!0,this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Eve,this.fragmentShader=Ave,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Am(e.uniforms),this.uniformsGroups=wve(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class Bv extends Rn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new qt,this.projectionMatrix=new qt,this.projectionMatrixInverse=new qt,this.coordinateSystem=Ga}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const kc=new q,u4=new Fe,h4=new Fe;class Ni extends Bv{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Em*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(_d*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Em*2*Math.atan(Math.tan(_d*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){kc.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(kc.x,kc.y).multiplyScalar(-e/kc.z),kc.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(kc.x,kc.y).multiplyScalar(-e/kc.z)}getViewSize(e,t){return this.getViewBounds(e,u4,h4),t.subVectors(h4,u4)}setViewOffset(e,t,i,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(_d*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*i/c,r*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Bf=-90,Of=1;class bK extends Rn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Ni(Bf,Of,e,t);r.layers=this.layers,this.add(r);const s=new Ni(Bf,Of,e,t);s.layers=this.layers,this.add(s);const o=new Ni(Bf,Of,e,t);o.layers=this.layers,this.add(o);const a=new Ni(Bf,Of,e,t);a.layers=this.layers,this.add(a);const l=new Ni(Bf,Of,e,t);l.layers=this.layers,this.add(l);const c=new Ni(Bf,Of,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===Ga)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===V0)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,u]=this.children,h=e.getRenderTarget(),f=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;const _=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,s),e.setRenderTarget(i,1,r),e.render(t,o),e.setRenderTarget(i,2,r),e.render(t,a),e.setRenderTarget(i,3,r),e.render(t,l),e.setRenderTarget(i,4,r),e.render(t,c),i.texture.generateMipmaps=_,e.setRenderTarget(i,5,r),e.render(t,u),e.setRenderTarget(h,f,m),e.xr.enabled=y,i.texture.needsPMREMUpdate=!0}}class Ov extends qn{constructor(e,t,i,r,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:al,super(e,t,i,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class AD extends Ss{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new Ov(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Gn}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`

				varying vec3 vWorldDirection;

				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {

					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );

				}

				void main() {

					vWorldDirection = transformDirection( position, modelMatrix );

					#include <begin_vertex>
					#include <project_vertex>

				}
			`,fragmentShader:`

				uniform sampler2D tEquirect;

				varying vec3 vWorldDirection;

				#include <common>

				void main() {

					vec3 direction = normalize( vWorldDirection );

					vec2 sampleUV = equirectUv( direction );

					gl_FragColor = texture2D( tEquirect, sampleUV );

				}
			`},r=new tf(5,5,5),s=new ss({name:"CubemapFromEquirect",uniforms:Am(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:As,blending:Za});s.uniforms.tEquirect.value=t;const o=new fi(r,s),a=t.minFilter;return t.minFilter===Oo&&(t.minFilter=Gn),new bK(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,r);e.setRenderTarget(s)}}const fC=new q,Sve=new q,Tve=new cn;class Ll{constructor(e=new q(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=fC.subVectors(i,t).cross(Sve.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(fC),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||Tve.getNormalMatrix(e),r=this.coplanarPoint(fC).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Eh=new Rr,Px=new q;class Fv{constructor(e=new Ll,t=new Ll,i=new Ll,r=new Ll,s=new Ll,o=new Ll){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Ga){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],u=r[5],h=r[6],f=r[7],m=r[8],y=r[9],_=r[10],v=r[11],g=r[12],w=r[13],A=r[14],T=r[15];if(i[0].setComponents(l-s,f-c,v-m,T-g).normalize(),i[1].setComponents(l+s,f+c,v+m,T+g).normalize(),i[2].setComponents(l+o,f+u,v+y,T+w).normalize(),i[3].setComponents(l-o,f-u,v-y,T-w).normalize(),i[4].setComponents(l-a,f-h,v-_,T-A).normalize(),t===Ga)i[5].setComponents(l+a,f+h,v+_,T+A).normalize();else if(t===V0)i[5].setComponents(a,h,_,A).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(),Eh.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Eh.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Eh)}intersectsSprite(e){return Eh.center.set(0,0,0),Eh.radius=.7071067811865476,Eh.applyMatrix4(e.matrixWorld),this.intersectsSphere(Eh)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(Px.x=r.normal.x>0?e.max.x:e.min.x,Px.y=r.normal.y>0?e.max.y:e.min.y,Px.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Px)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function CK(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function bve(n){const e=new WeakMap;function t(a,l){const c=a.array,u=a.usage,h=c.byteLength,f=n.createBuffer();n.bindBuffer(l,f),n.bufferData(l,c,u),a.onUploadCallback();let m;if(c instanceof Float32Array)m=n.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?m=n.HALF_FLOAT:m=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)m=n.SHORT;else if(c instanceof Uint32Array)m=n.UNSIGNED_INT;else if(c instanceof Int32Array)m=n.INT;else if(c instanceof Int8Array)m=n.BYTE;else if(c instanceof Uint8Array)m=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)m=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:f,type:m,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:h}}function i(a,l,c){const u=l.array,h=l.updateRanges;if(n.bindBuffer(c,a),h.length===0)n.bufferSubData(c,0,u);else{h.sort((m,y)=>m.start-y.start);let f=0;for(let m=1;m<h.length;m++){const y=h[f],_=h[m];_.start<=y.start+y.count+1?y.count=Math.max(y.count,_.start+_.count-y.start):(++f,h[f]=_)}h.length=f+1;for(let m=0,y=h.length;m<y;m++){const _=h[m];n.bufferSubData(c,_.start*u.BYTES_PER_ELEMENT,u,_.start,_.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);const l=e.get(a);l&&(n.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){const u=e.get(a);(!u||u.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}const c=e.get(a);if(c===void 0)e.set(a,t(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(c.buffer,a,l),c.version=a.version}}return{get:r,remove:s,update:o}}class yc extends un{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,o=t/2,a=Math.floor(i),l=Math.floor(r),c=a+1,u=l+1,h=e/a,f=t/l,m=[],y=[],_=[],v=[];for(let g=0;g<u;g++){const w=g*f-o;for(let A=0;A<c;A++){const T=A*h-s;y.push(T,-w,0),_.push(0,0,1),v.push(A/a),v.push(1-g/l)}}for(let g=0;g<l;g++)for(let w=0;w<a;w++){const A=w+c*g,T=w+c*(g+1),L=w+1+c*(g+1),D=w+1+c*g;m.push(A,T,D),m.push(T,L,D)}this.setIndex(m),this.setAttribute("position",new Ot(y,3)),this.setAttribute("normal",new Ot(_,3)),this.setAttribute("uv",new Ot(v,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new yc(e.width,e.height,e.widthSegments,e.heightSegments)}}var Cve=`#ifdef USE_ALPHAHASH
	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,Mve=`#ifdef USE_ALPHAHASH
	const float ALPHA_HASH_SCALE = 0.05;
	float hash2D( vec2 value ) {
		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
	}
	float hash3D( vec3 value ) {
		return hash2D( vec2( hash2D( value.xy ), value.z ) );
	}
	float getAlphaHashThreshold( vec3 position ) {
		float maxDeriv = max(
			length( dFdx( position.xyz ) ),
			length( dFdy( position.xyz ) )
		);
		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
		vec2 pixScales = vec2(
			exp2( floor( log2( pixScale ) ) ),
			exp2( ceil( log2( pixScale ) ) )
		);
		vec2 alpha = vec2(
			hash3D( floor( pixScales.x * position.xyz ) ),
			hash3D( floor( pixScales.y * position.xyz ) )
		);
		float lerpFactor = fract( log2( pixScale ) );
		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
		float a = min( lerpFactor, 1.0 - lerpFactor );
		vec3 cases = vec3(
			x * x / ( 2.0 * a * ( 1.0 - a ) ),
			( x - 0.5 * a ) / ( 1.0 - a ),
			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
		);
		float threshold = ( x < ( 1.0 - a ) )
			? ( ( x < a ) ? cases.x : cases.y )
			: cases.z;
		return clamp( threshold , 1.0e-6, 1.0 );
	}
#endif`,Ive=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,Rve=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,Pve=`#ifdef USE_ALPHATEST
	#ifdef ALPHA_TO_COVERAGE
	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
	if ( diffuseColor.a == 0.0 ) discard;
	#else
	if ( diffuseColor.a < alphaTest ) discard;
	#endif
#endif`,Nve=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,Dve=`#ifdef USE_AOMAP
	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
	reflectedLight.indirectDiffuse *= ambientOcclusion;
	#if defined( USE_CLEARCOAT ) 
		clearcoatSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_SHEEN ) 
		sheenSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD )
		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
	#endif
#endif`,Lve=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,kve=`#ifdef USE_BATCHING
	#if ! defined( GL_ANGLE_multi_draw )
	#define gl_DrawID _gl_DrawID
	uniform int _gl_DrawID;
	#endif
	uniform highp sampler2D batchingTexture;
	uniform highp usampler2D batchingIdTexture;
	mat4 getBatchingMatrix( const in float i ) {
		int size = textureSize( batchingTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
	float getIndirectIndex( const in int i ) {
		int size = textureSize( batchingIdTexture, 0 ).x;
		int x = i % size;
		int y = i / size;
		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
	}
#endif
#ifdef USE_BATCHING_COLOR
	uniform sampler2D batchingColorTexture;
	vec3 getBatchingColor( const in float i ) {
		int size = textureSize( batchingColorTexture, 0 ).x;
		int j = int( i );
		int x = j % size;
		int y = j / size;
		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
	}
#endif`,Bve=`#ifdef USE_BATCHING
	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,Ove=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
	vPosition = vec3( position );
#endif`,Fve=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,Uve=`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`,Vve=`#ifdef USE_IRIDESCENCE
	const mat3 XYZ_TO_REC709 = mat3(
		 3.2404542, -0.9692660,  0.0556434,
		-1.5371385,  1.8760108, -0.2040259,
		-0.4985314,  0.0415560,  1.0572252
	);
	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
		vec3 sqrtF0 = sqrt( fresnel0 );
		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
	}
	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
	}
	float IorToFresnel0( float transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
	}
	vec3 evalSensitivity( float OPD, vec3 shift ) {
		float phase = 2.0 * PI * OPD * 1.0e-9;
		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
		xyz /= 1.0685e-7;
		vec3 rgb = XYZ_TO_REC709 * xyz;
		return rgb;
	}
	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
		vec3 I;
		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
		float cosTheta2Sq = 1.0 - sinTheta2Sq;
		if ( cosTheta2Sq < 0.0 ) {
			return vec3( 1.0 );
		}
		float cosTheta2 = sqrt( cosTheta2Sq );
		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
		float T121 = 1.0 - R12;
		float phi12 = 0.0;
		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
		float phi21 = PI - phi12;
		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
		vec3 phi23 = vec3( 0.0 );
		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
		vec3 phi = vec3( phi21 ) + phi23;
		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
		vec3 r123 = sqrt( R123 );
		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
		vec3 C0 = R12 + Rs;
		I = C0;
		vec3 Cm = Rs - T121;
		for ( int m = 1; m <= 2; ++ m ) {
			Cm *= r123;
			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
			I += Cm * Sm;
		}
		return max( I, vec3( 0.0 ) );
	}
#endif`,zve=`#ifdef USE_BUMPMAP
	uniform sampler2D bumpMap;
	uniform float bumpScale;
	vec2 dHdxy_fwd() {
		vec2 dSTdx = dFdx( vBumpMapUv );
		vec2 dSTdy = dFdy( vBumpMapUv );
		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
		return vec2( dBx, dBy );
	}
	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
		vec3 vN = surf_norm;
		vec3 R1 = cross( vSigmaY, vN );
		vec3 R2 = cross( vN, vSigmaX );
		float fDet = dot( vSigmaX, R1 ) * faceDirection;
		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
		return normalize( abs( fDet ) * surf_norm - vGrad );
	}
#endif`,Hve=`#if NUM_CLIPPING_PLANES > 0
	vec4 plane;
	#ifdef ALPHA_TO_COVERAGE
		float distanceToPlane, distanceGradient;
		float clipOpacity = 1.0;
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
			distanceGradient = fwidth( distanceToPlane ) / 2.0;
			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			if ( clipOpacity == 0.0 ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			float unionClipOpacity = 1.0;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
				distanceGradient = fwidth( distanceToPlane ) / 2.0;
				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			}
			#pragma unroll_loop_end
			clipOpacity *= 1.0 - unionClipOpacity;
		#endif
		diffuseColor.a *= clipOpacity;
		if ( diffuseColor.a == 0.0 ) discard;
	#else
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			bool clipped = true;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
			}
			#pragma unroll_loop_end
			if ( clipped ) discard;
		#endif
	#endif
#endif`,Gve=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,jve=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`,Wve=`#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`,Kve=`#if defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#elif defined( USE_COLOR )
	diffuseColor.rgb *= vColor;
#endif`,Xve=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR )
	varying vec3 vColor;
#endif`,qve=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	varying vec3 vColor;
#endif`,Yve=`#if defined( USE_COLOR_ALPHA )
	vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
	vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
	vColor.xyz *= instanceColor.xyz;
#endif
#ifdef USE_BATCHING_COLOR
	vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
	vColor.xyz *= batchingColor.xyz;
#endif`,$ve=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
	return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
	float precisionSafeLength( vec3 v ) { return length( v ); }
#else
	float precisionSafeLength( vec3 v ) {
		float maxComponent = max3( abs( v ) );
		return length( v / maxComponent ) * maxComponent;
	}
#endif
struct IncidentLight {
	vec3 color;
	vec3 direction;
	bool visible;
};
struct ReflectedLight {
	vec3 directDiffuse;
	vec3 directSpecular;
	vec3 indirectDiffuse;
	vec3 indirectSpecular;
};
#ifdef USE_ALPHAHASH
	varying vec3 vPosition;
#endif
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
mat3 transposeMat3( const in mat3 m ) {
	mat3 tmp;
	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
	return tmp;
}
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`,Jve=`#ifdef ENVMAP_TYPE_CUBE_UV
	#define cubeUV_minMipLevel 4.0
	#define cubeUV_minTileSize 16.0
	float getFace( vec3 direction ) {
		vec3 absDirection = abs( direction );
		float face = - 1.0;
		if ( absDirection.x > absDirection.z ) {
			if ( absDirection.x > absDirection.y )
				face = direction.x > 0.0 ? 0.0 : 3.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		} else {
			if ( absDirection.z > absDirection.y )
				face = direction.z > 0.0 ? 2.0 : 5.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		}
		return face;
	}
	vec2 getUV( vec3 direction, float face ) {
		vec2 uv;
		if ( face == 0.0 ) {
			uv = vec2( direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 1.0 ) {
			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
		} else if ( face == 2.0 ) {
			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
		} else if ( face == 3.0 ) {
			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 4.0 ) {
			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
		} else {
			uv = vec2( direction.x, direction.y ) / abs( direction.z );
		}
		return 0.5 * ( uv + 1.0 );
	}
	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
		float face = getFace( direction );
		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
		mipInt = max( mipInt, cubeUV_minMipLevel );
		float faceSize = exp2( mipInt );
		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
		if ( face > 2.0 ) {
			uv.y += faceSize;
			face -= 3.0;
		}
		uv.x += face * faceSize;
		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
		uv.x *= CUBEUV_TEXEL_WIDTH;
		uv.y *= CUBEUV_TEXEL_HEIGHT;
		#ifdef texture2DGradEXT
			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
		#else
			return texture2D( envMap, uv ).rgb;
		#endif
	}
	#define cubeUV_r0 1.0
	#define cubeUV_m0 - 2.0
	#define cubeUV_r1 0.8
	#define cubeUV_m1 - 1.0
	#define cubeUV_r4 0.4
	#define cubeUV_m4 2.0
	#define cubeUV_r5 0.305
	#define cubeUV_m5 3.0
	#define cubeUV_r6 0.21
	#define cubeUV_m6 4.0
	float roughnessToMip( float roughness ) {
		float mip = 0.0;
		if ( roughness >= cubeUV_r1 ) {
			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
		} else if ( roughness >= cubeUV_r4 ) {
			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
		} else if ( roughness >= cubeUV_r5 ) {
			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
		} else if ( roughness >= cubeUV_r6 ) {
			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
		} else {
			mip = - 2.0 * log2( 1.16 * roughness );		}
		return mip;
	}
	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
		float mipF = fract( mip );
		float mipInt = floor( mip );
		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
		if ( mipF == 0.0 ) {
			return vec4( color0, 1.0 );
		} else {
			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
			return vec4( mix( color0, color1, mipF ), 1.0 );
		}
	}
#endif`,Qve=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
	vec3 transformedTangent = objectTangent;
#endif
#ifdef USE_BATCHING
	mat3 bm = mat3( batchingMatrix );
	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
	transformedNormal = bm * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = bm * transformedTangent;
	#endif
#endif
#ifdef USE_INSTANCING
	mat3 im = mat3( instanceMatrix );
	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
	transformedNormal = im * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = im * transformedTangent;
	#endif
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
	transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
	#ifdef FLIP_SIDED
		transformedTangent = - transformedTangent;
	#endif
#endif`,Zve=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,e_e=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,t_e=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
		emissiveColor = sRGBTransferEOTF( emissiveColor );
	#endif
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,n_e=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,i_e="gl_FragColor = linearToOutputTexel( gl_FragColor );",r_e=`vec4 LinearTransferOETF( in vec4 value ) {
	return value;
}
vec4 sRGBTransferEOTF( in vec4 value ) {
	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
}
vec4 sRGBTransferOETF( in vec4 value ) {
	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}`,s_e=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vec3 cameraToFrag;
		if ( isOrthographic ) {
			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToFrag = normalize( vWorldPosition - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
		#else
			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
		#endif
	#else
		vec3 reflectVec = vReflect;
	#endif
	#ifdef ENVMAP_TYPE_CUBE
		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
	#else
		vec4 envColor = vec4( 0.0 );
	#endif
	#ifdef ENVMAP_BLENDING_MULTIPLY
		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_MIX )
		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_ADD )
		outgoingLight += envColor.xyz * specularStrength * reflectivity;
	#endif
#endif`,o_e=`#ifdef USE_ENVMAP
	uniform float envMapIntensity;
	uniform float flipEnvMap;
	uniform mat3 envMapRotation;
	#ifdef ENVMAP_TYPE_CUBE
		uniform samplerCube envMap;
	#else
		uniform sampler2D envMap;
	#endif
	
#endif`,a_e=`#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`,l_e=`#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`,c_e=`#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`,u_e=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,h_e=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,d_e=`#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`,f_e=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,p_e=`#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
}`,m_e=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,g_e=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,y_e=`varying vec3 vViewPosition;
struct LambertMaterial {
	vec3 diffuseColor;
	float specularStrength;
};
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Lambert
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,v_e=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
	uniform vec3 lightProbe[ 9 ];
#endif
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
	float x = normal.x, y = normal.y, z = normal.z;
	vec3 result = shCoefficients[ 0 ] * 0.886227;
	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
	return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
	return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
	vec3 irradiance = ambientLightColor;
	return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
	if ( cutoffDistance > 0.0 ) {
		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
	}
	return distanceFalloff;
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
	return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
	struct DirectionalLight {
		vec3 direction;
		vec3 color;
	};
	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
		light.color = directionalLight.color;
		light.direction = directionalLight.direction;
		light.visible = true;
	}
#endif
#if NUM_POINT_LIGHTS > 0
	struct PointLight {
		vec3 position;
		vec3 color;
		float distance;
		float decay;
	};
	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = pointLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float lightDistance = length( lVector );
		light.color = pointLight.color;
		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
		light.visible = ( light.color != vec3( 0.0 ) );
	}
#endif
#if NUM_SPOT_LIGHTS > 0
	struct SpotLight {
		vec3 position;
		vec3 direction;
		vec3 color;
		float distance;
		float decay;
		float coneCos;
		float penumbraCos;
	};
	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = spotLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float angleCos = dot( light.direction, spotLight.direction );
		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
		if ( spotAttenuation > 0.0 ) {
			float lightDistance = length( lVector );
			light.color = spotLight.color * spotAttenuation;
			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
			light.visible = ( light.color != vec3( 0.0 ) );
		} else {
			light.color = vec3( 0.0 );
			light.visible = false;
		}
	}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
	struct RectAreaLight {
		vec3 color;
		vec3 position;
		vec3 halfWidth;
		vec3 halfHeight;
	};
	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
	struct HemisphereLight {
		vec3 direction;
		vec3 skyColor;
		vec3 groundColor;
	};
	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
		float dotNL = dot( normal, hemiLight.direction );
		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
		return irradiance;
	}
#endif`,__e=`#ifdef USE_ENVMAP
	vec3 getIBLIrradiance( const in vec3 normal ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
			return PI * envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 reflectVec = reflect( - viewDir, normal );
			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
			return envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	#ifdef USE_ANISOTROPY
		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
			#ifdef ENVMAP_TYPE_CUBE_UV
				vec3 bentNormal = cross( bitangent, viewDir );
				bentNormal = normalize( cross( bentNormal, bitangent ) );
				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
				return getIBLRadiance( viewDir, bentNormal, roughness );
			#else
				return vec3( 0.0 );
			#endif
		}
	#endif
#endif`,x_e=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,w_e=`varying vec3 vViewPosition;
struct ToonMaterial {
	vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Toon
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,E_e=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,A_e=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
	vec3 diffuseColor;
	vec3 specularColor;
	float specularShininess;
	float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_BlinnPhong
#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,S_e=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
	material.ior = ior;
	#ifdef USE_SPECULAR
		float specularIntensityFactor = specularIntensity;
		vec3 specularColorFactor = specularColor;
		#ifdef USE_SPECULAR_COLORMAP
			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
		#endif
		#ifdef USE_SPECULAR_INTENSITYMAP
			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
		#endif
		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
	#else
		float specularIntensityFactor = 1.0;
		vec3 specularColorFactor = vec3( 1.0 );
		material.specularF90 = 1.0;
	#endif
	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
#else
	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
	material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
	material.clearcoat = clearcoat;
	material.clearcoatRoughness = clearcoatRoughness;
	material.clearcoatF0 = vec3( 0.04 );
	material.clearcoatF90 = 1.0;
	#ifdef USE_CLEARCOATMAP
		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
	#endif
	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
	#endif
	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
	material.clearcoatRoughness += geometryRoughness;
	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_DISPERSION
	material.dispersion = dispersion;
#endif
#ifdef USE_IRIDESCENCE
	material.iridescence = iridescence;
	material.iridescenceIOR = iridescenceIOR;
	#ifdef USE_IRIDESCENCEMAP
		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
	#endif
	#ifdef USE_IRIDESCENCE_THICKNESSMAP
		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
	#else
		material.iridescenceThickness = iridescenceThicknessMaximum;
	#endif
#endif
#ifdef USE_SHEEN
	material.sheenColor = sheenColor;
	#ifdef USE_SHEEN_COLORMAP
		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
	#endif
	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
	#ifdef USE_SHEEN_ROUGHNESSMAP
		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
	#endif
#endif
#ifdef USE_ANISOTROPY
	#ifdef USE_ANISOTROPYMAP
		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
	#else
		vec2 anisotropyV = anisotropyVector;
	#endif
	material.anisotropy = length( anisotropyV );
	if( material.anisotropy == 0.0 ) {
		anisotropyV = vec2( 1.0, 0.0 );
	} else {
		anisotropyV /= material.anisotropy;
		material.anisotropy = saturate( material.anisotropy );
	}
	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
#endif`,T_e=`struct PhysicalMaterial {
	vec3 diffuseColor;
	float roughness;
	vec3 specularColor;
	float specularF90;
	float dispersion;
	#ifdef USE_CLEARCOAT
		float clearcoat;
		float clearcoatRoughness;
		vec3 clearcoatF0;
		float clearcoatF90;
	#endif
	#ifdef USE_IRIDESCENCE
		float iridescence;
		float iridescenceIOR;
		float iridescenceThickness;
		vec3 iridescenceFresnel;
		vec3 iridescenceF0;
	#endif
	#ifdef USE_SHEEN
		vec3 sheenColor;
		float sheenRoughness;
	#endif
	#ifdef IOR
		float ior;
	#endif
	#ifdef USE_TRANSMISSION
		float transmission;
		float transmissionAlpha;
		float thickness;
		float attenuationDistance;
		vec3 attenuationColor;
	#endif
	#ifdef USE_ANISOTROPY
		float anisotropy;
		float alphaT;
		vec3 anisotropyT;
		vec3 anisotropyB;
	#endif
};
vec3 clearcoatSpecularDirect = vec3( 0.0 );
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
vec3 sheenSpecularDirect = vec3( 0.0 );
vec3 sheenSpecularIndirect = vec3(0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
    float x2 = x * x;
    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
	float a2 = pow2( alpha );
	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
	return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
	float a2 = pow2( alpha );
	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
	return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_ANISOTROPY
	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
		float v = 0.5 / ( gv + gl );
		return saturate(v);
	}
	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
		float a2 = alphaT * alphaB;
		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
		highp float v2 = dot( v, v );
		float w2 = a2 / v2;
		return RECIPROCAL_PI * a2 * pow2 ( w2 );
	}
#endif
#ifdef USE_CLEARCOAT
	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
		vec3 f0 = material.clearcoatF0;
		float f90 = material.clearcoatF90;
		float roughness = material.clearcoatRoughness;
		float alpha = pow2( roughness );
		vec3 halfDir = normalize( lightDir + viewDir );
		float dotNL = saturate( dot( normal, lightDir ) );
		float dotNV = saturate( dot( normal, viewDir ) );
		float dotNH = saturate( dot( normal, halfDir ) );
		float dotVH = saturate( dot( viewDir, halfDir ) );
		vec3 F = F_Schlick( f0, f90, dotVH );
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
		return F * ( V * D );
	}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
	vec3 f0 = material.specularColor;
	float f90 = material.specularF90;
	float roughness = material.roughness;
	float alpha = pow2( roughness );
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( f0, f90, dotVH );
	#ifdef USE_IRIDESCENCE
		F = mix( F, material.iridescenceFresnel, material.iridescence );
	#endif
	#ifdef USE_ANISOTROPY
		float dotTL = dot( material.anisotropyT, lightDir );
		float dotTV = dot( material.anisotropyT, viewDir );
		float dotTH = dot( material.anisotropyT, halfDir );
		float dotBL = dot( material.anisotropyB, lightDir );
		float dotBV = dot( material.anisotropyB, viewDir );
		float dotBH = dot( material.anisotropyB, halfDir );
		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
	#else
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
	#endif
	return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
	const float LUT_SIZE = 64.0;
	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
	const float LUT_BIAS = 0.5 / LUT_SIZE;
	float dotNV = saturate( dot( N, V ) );
	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
	uv = uv * LUT_SCALE + LUT_BIAS;
	return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
	float l = length( f );
	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
	float x = dot( v1, v2 );
	float y = abs( x );
	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
	float b = 3.4175940 + ( 4.1616724 + y ) * y;
	float v = a / b;
	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
	return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
	vec3 lightNormal = cross( v1, v2 );
	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
	vec3 T1, T2;
	T1 = normalize( V - N * dot( V, N ) );
	T2 = - cross( N, T1 );
	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
	vec3 coords[ 4 ];
	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
	coords[ 0 ] = normalize( coords[ 0 ] );
	coords[ 1 ] = normalize( coords[ 1 ] );
	coords[ 2 ] = normalize( coords[ 2 ] );
	coords[ 3 ] = normalize( coords[ 3 ] );
	vec3 vectorFormFactor = vec3( 0.0 );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
	return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
	float alpha = pow2( roughness );
	float invAlpha = 1.0 / alpha;
	float cos2h = dotNH * dotNH;
	float sin2h = max( 1.0 - cos2h, 0.0078125 );
	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float D = D_Charlie( sheenRoughness, dotNH );
	float V = V_Neubelt( dotNV, dotNL );
	return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	float r2 = roughness * roughness;
	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
	return saturate( DG * RECIPROCAL_PI );
}
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
	vec4 r = roughness * c0 + c1;
	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
	return fab;
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	#ifdef USE_IRIDESCENCE
		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
	#else
		vec3 Fr = specularColor;
	#endif
	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
	float Ess = fab.x + fab.y;
	float Ems = 1.0 - Ess;
	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
	singleScatter += FssEss;
	multiScatter += Fms * Ems;
}
#if NUM_RECT_AREA_LIGHTS > 0
	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
		vec3 normal = geometryNormal;
		vec3 viewDir = geometryViewDir;
		vec3 position = geometryPosition;
		vec3 lightPos = rectAreaLight.position;
		vec3 halfWidth = rectAreaLight.halfWidth;
		vec3 halfHeight = rectAreaLight.halfHeight;
		vec3 lightColor = rectAreaLight.color;
		float roughness = material.roughness;
		vec3 rectCoords[ 4 ];
		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
		vec2 uv = LTC_Uv( normal, viewDir, roughness );
		vec4 t1 = texture2D( ltc_1, uv );
		vec4 t2 = texture2D( ltc_2, uv );
		mat3 mInv = mat3(
			vec3( t1.x, 0, t1.y ),
			vec3(    0, 1,    0 ),
			vec3( t1.z, 0, t1.w )
		);
		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
	}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	#ifdef USE_CLEARCOAT
		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
		vec3 ccIrradiance = dotNLcc * directLight.color;
		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
	#endif
	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
	#ifdef USE_CLEARCOAT
		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
	#endif
	vec3 singleScattering = vec3( 0.0 );
	vec3 multiScattering = vec3( 0.0 );
	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
	#ifdef USE_IRIDESCENCE
		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
	#else
		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
	#endif
	vec3 totalScattering = singleScattering + multiScattering;
	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
	reflectedLight.indirectSpecular += radiance * singleScattering;
	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct				RE_Direct_Physical
#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,b_e=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryClearcoatNormal = vec3( 0.0 );
#ifdef USE_CLEARCOAT
	geometryClearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
	float dotNVi = saturate( dot( normal, geometryViewDir ) );
	if ( material.iridescenceThickness == 0.0 ) {
		material.iridescence = 0.0;
	} else {
		material.iridescence = saturate( material.iridescence );
	}
	if ( material.iridescence > 0.0 ) {
		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
	}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
	PointLight pointLight;
	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		pointLight = pointLights[ i ];
		getPointLightInfo( pointLight, geometryPosition, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
		pointLightShadow = pointLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
	SpotLight spotLight;
	vec4 spotColor;
	vec3 spotLightCoord;
	bool inSpotLightMap;
	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		spotLight = spotLights[ i ];
		getSpotLightInfo( spotLight, geometryPosition, directLight );
		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
		#else
		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#endif
		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
		#endif
		#undef SPOT_LIGHT_MAP_INDEX
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		spotLightShadow = spotLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
	DirectionalLight directionalLight;
	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		directionalLight = directionalLights[ i ];
		getDirectionalLightInfo( directionalLight, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
		directionalLightShadow = directionalLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
	RectAreaLight rectAreaLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
		rectAreaLight = rectAreaLights[ i ];
		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
	vec3 iblIrradiance = vec3( 0.0 );
	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
	#if defined( USE_LIGHT_PROBES )
		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
	#endif
	#if ( NUM_HEMI_LIGHTS > 0 )
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
		}
		#pragma unroll_loop_end
	#endif
#endif
#if defined( RE_IndirectSpecular )
	vec3 radiance = vec3( 0.0 );
	vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,C_e=`#if defined( RE_IndirectDiffuse )
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
		irradiance += lightMapIrradiance;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
		iblIrradiance += getIBLIrradiance( geometryNormal );
	#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
	#ifdef USE_ANISOTROPY
		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
	#else
		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
	#endif
	#ifdef USE_CLEARCOAT
		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
	#endif
#endif`,M_e=`#if defined( RE_IndirectDiffuse )
	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif`,I_e=`#if defined( USE_LOGDEPTHBUF )
	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,R_e=`#if defined( USE_LOGDEPTHBUF )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,P_e=`#ifdef USE_LOGDEPTHBUF
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,N_e=`#ifdef USE_LOGDEPTHBUF
	vFragDepth = 1.0 + gl_Position.w;
	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,D_e=`#ifdef USE_MAP
	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
	#ifdef DECODE_VIDEO_TEXTURE
		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
	#endif
	diffuseColor *= sampledDiffuseColor;
#endif`,L_e=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,k_e=`#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`,B_e=`#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`,O_e=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
	metalnessFactor *= texelMetalness.b;
#endif`,F_e=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,U_e=`#ifdef USE_INSTANCING_MORPH
	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
	}
#endif`,V_e=`#if defined( USE_MORPHCOLORS )
	vColor *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		#if defined( USE_COLOR_ALPHA )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
		#elif defined( USE_COLOR )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
		#endif
	}
#endif`,z_e=`#ifdef USE_MORPHNORMALS
	objectNormal *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,H_e=`#ifdef USE_MORPHTARGETS
	#ifndef USE_INSTANCING_MORPH
		uniform float morphTargetBaseInfluence;
		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	#endif
	uniform sampler2DArray morphTargetsTexture;
	uniform ivec2 morphTargetsTextureSize;
	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
		int y = texelIndex / morphTargetsTextureSize.x;
		int x = texelIndex - y * morphTargetsTextureSize.x;
		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
		return texelFetch( morphTargetsTexture, morphUV, 0 );
	}
#endif`,G_e=`#ifdef USE_MORPHTARGETS
	transformed *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,j_e=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
	vec3 fdx = dFdx( vViewPosition );
	vec3 fdy = dFdy( vViewPosition );
	vec3 normal = normalize( cross( fdx, fdy ) );
#else
	vec3 normal = normalize( vNormal );
	#ifdef DOUBLE_SIDED
		normal *= faceDirection;
	#endif
#endif
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
	#ifdef USE_TANGENT
		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn = getTangentFrame( - vViewPosition, normal,
		#if defined( USE_NORMALMAP )
			vNormalMapUv
		#elif defined( USE_CLEARCOAT_NORMALMAP )
			vClearcoatNormalMapUv
		#else
			vUv
		#endif
		);
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn[0] *= faceDirection;
		tbn[1] *= faceDirection;
	#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	#ifdef USE_TANGENT
		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn2[0] *= faceDirection;
		tbn2[1] *= faceDirection;
	#endif
#endif
vec3 nonPerturbedNormal = normal;`,W_e=`#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`,K_e=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,X_e=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,q_e=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif`,Y_e=`#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`,$_e=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,J_e=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,Q_e=`#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`,Z_e=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,exe=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,txe=`vec3 packNormalToRGB( const in vec3 normal ) {
	return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
	return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
const float Inv255 = 1. / 255.;
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
vec4 packDepthToRGBA( const in float v ) {
	if( v <= 0.0 )
		return vec4( 0., 0., 0., 0. );
	if( v >= 1.0 )
		return vec4( 1., 1., 1., 1. );
	float vuf;
	float af = modf( v * PackFactors.a, vuf );
	float bf = modf( vuf * ShiftRight8, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
}
vec3 packDepthToRGB( const in float v ) {
	if( v <= 0.0 )
		return vec3( 0., 0., 0. );
	if( v >= 1.0 )
		return vec3( 1., 1., 1. );
	float vuf;
	float bf = modf( v * PackFactors.b, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec3( vuf * Inv255, gf * PackUpscale, bf );
}
vec2 packDepthToRG( const in float v ) {
	if( v <= 0.0 )
		return vec2( 0., 0. );
	if( v >= 1.0 )
		return vec2( 1., 1. );
	float vuf;
	float gf = modf( v * 256., vuf );
	return vec2( vuf * Inv255, gf );
}
float unpackRGBAToDepth( const in vec4 v ) {
	return dot( v, UnpackFactors4 );
}
float unpackRGBToDepth( const in vec3 v ) {
	return dot( v, UnpackFactors3 );
}
float unpackRGToDepth( const in vec2 v ) {
	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
}
vec4 pack2HalfToRGBA( const in vec2 v ) {
	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( const in vec4 v ) {
	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
	return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
	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 );
}`,nxe=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,ixe=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
	mvPosition = batchingMatrix * mvPosition;
#endif
#ifdef USE_INSTANCING
	mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,rxe=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,sxe=`#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`,oxe=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
	roughnessFactor *= texelRoughness.g;
#endif`,axe=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,lxe=`#if NUM_SPOT_LIGHT_COORDS > 0
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
	}
	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
		return unpackRGBATo2Half( texture2D( shadow, uv ) );
	}
	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
		float occlusion = 1.0;
		vec2 distribution = texture2DDistribution( shadow, uv );
		float hard_shadow = step( compare , distribution.x );
		if (hard_shadow != 1.0 ) {
			float distance = compare - distribution.x ;
			float variance = max( 0.00000, distribution.y * distribution.y );
			float softness_probability = variance / (variance + distance * distance );			softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );			occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
		}
		return occlusion;
	}
	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
		float shadow = 1.0;
		shadowCoord.xyz /= shadowCoord.w;
		shadowCoord.z += shadowBias;
		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
		if ( frustumTest ) {
		#if defined( SHADOWMAP_TYPE_PCF )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx0 = - texelSize.x * shadowRadius;
			float dy0 = - texelSize.y * shadowRadius;
			float dx1 = + texelSize.x * shadowRadius;
			float dy1 = + texelSize.y * shadowRadius;
			float dx2 = dx0 / 2.0;
			float dy2 = dy0 / 2.0;
			float dx3 = dx1 / 2.0;
			float dy3 = dy1 / 2.0;
			shadow = (
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
			) * ( 1.0 / 17.0 );
		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx = texelSize.x;
			float dy = texelSize.y;
			vec2 uv = shadowCoord.xy;
			vec2 f = fract( uv * shadowMapSize + 0.5 );
			uv -= f * texelSize;
			shadow = (
				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
						  f.x ),
					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
						  f.x ),
					 f.y )
			) * ( 1.0 / 9.0 );
		#elif defined( SHADOWMAP_TYPE_VSM )
			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
		#else
			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
		#endif
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
	vec2 cubeToUV( vec3 v, float texelSizeY ) {
		vec3 absV = abs( v );
		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
		absV *= scaleToCube;
		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
		vec2 planar = v.xy;
		float almostATexel = 1.5 * texelSizeY;
		float almostOne = 1.0 - almostATexel;
		if ( absV.z >= almostOne ) {
			if ( v.z > 0.0 )
				planar.x = 4.0 - v.x;
		} else if ( absV.x >= almostOne ) {
			float signX = sign( v.x );
			planar.x = v.z * signX + 2.0 * signX;
		} else if ( absV.y >= almostOne ) {
			float signY = sign( v.y );
			planar.x = v.x + 2.0 * signY + 2.0;
			planar.y = v.z * signY - 2.0;
		}
		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
	}
	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		float shadow = 1.0;
		vec3 lightToPosition = shadowCoord.xyz;
		
		float lightToPositionLength = length( lightToPosition );
		if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
			float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );			dp += shadowBias;
			vec3 bd3D = normalize( lightToPosition );
			vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
			#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
				vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
				shadow = (
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
				) * ( 1.0 / 9.0 );
			#else
				shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
			#endif
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
#endif`,cxe=`#if NUM_SPOT_LIGHT_COORDS > 0
	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
#endif`,uxe=`#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`,hxe=`float getShadowMask() {
	float shadow = 1.0;
	#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
		directionalLight = directionalLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
		spotLight = spotLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
		pointLight = pointLightShadows[ i ];
		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#endif
	return shadow;
}`,dxe=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,fxe=`#ifdef USE_SKINNING
	uniform mat4 bindMatrix;
	uniform mat4 bindMatrixInverse;
	uniform highp sampler2D boneTexture;
	mat4 getBoneMatrix( const in float i ) {
		int size = textureSize( boneTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
#endif`,pxe=`#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`,mxe=`#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`,gxe=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,yxe=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,vxe=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,_xe=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
	return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 CineonToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	color = max( vec3( 0.0 ), color - 0.004 );
	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
	return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
	const mat3 ACESInputMat = mat3(
		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
		vec3( 0.04823, 0.01566, 0.83777 )
	);
	const mat3 ACESOutputMat = mat3(
		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
		vec3( -0.07367, -0.00605,  1.07602 )
	);
	color *= toneMappingExposure / 0.6;
	color = ACESInputMat * color;
	color = RRTAndODTFit( color );
	color = ACESOutputMat * color;
	return saturate( color );
}
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
	vec3( 1.6605, - 0.1246, - 0.0182 ),
	vec3( - 0.5876, 1.1329, - 0.1006 ),
	vec3( - 0.0728, - 0.0083, 1.1187 )
);
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
	vec3( 0.6274, 0.0691, 0.0164 ),
	vec3( 0.3293, 0.9195, 0.0880 ),
	vec3( 0.0433, 0.0113, 0.8956 )
);
vec3 agxDefaultContrastApprox( vec3 x ) {
	vec3 x2 = x * x;
	vec3 x4 = x2 * x2;
	return + 15.5 * x4 * x2
		- 40.14 * x4 * x
		+ 31.96 * x4
		- 6.868 * x2 * x
		+ 0.4298 * x2
		+ 0.1191 * x
		- 0.00232;
}
vec3 AgXToneMapping( vec3 color ) {
	const mat3 AgXInsetMatrix = mat3(
		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
	);
	const mat3 AgXOutsetMatrix = mat3(
		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
	);
	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
	color *= toneMappingExposure;
	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
	color = AgXInsetMatrix * color;
	color = max( color, 1e-10 );	color = log2( color );
	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
	color = clamp( color, 0.0, 1.0 );
	color = agxDefaultContrastApprox( color );
	color = AgXOutsetMatrix * color;
	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
	color = clamp( color, 0.0, 1.0 );
	return color;
}
vec3 NeutralToneMapping( vec3 color ) {
	const float StartCompression = 0.8 - 0.04;
	const float Desaturation = 0.15;
	color *= toneMappingExposure;
	float x = min( color.r, min( color.g, color.b ) );
	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
	color -= offset;
	float peak = max( color.r, max( color.g, color.b ) );
	if ( peak < StartCompression ) return color;
	float d = 1. - StartCompression;
	float newPeak = 1. - d * d / ( peak + d - StartCompression );
	color *= newPeak / peak;
	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
	return mix( color, vec3( newPeak ), g );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,xxe=`#ifdef USE_TRANSMISSION
	material.transmission = transmission;
	material.transmissionAlpha = 1.0;
	material.thickness = thickness;
	material.attenuationDistance = attenuationDistance;
	material.attenuationColor = attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
	#endif
	#ifdef USE_THICKNESSMAP
		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
	#endif
	vec3 pos = vWorldPosition;
	vec3 v = normalize( cameraPosition - pos );
	vec3 n = inverseTransformDirection( normal, viewMatrix );
	vec4 transmitted = getIBLVolumeRefraction(
		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
		material.attenuationColor, material.attenuationDistance );
	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
#endif`,wxe=`#ifdef USE_TRANSMISSION
	uniform float transmission;
	uniform float thickness;
	uniform float attenuationDistance;
	uniform vec3 attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		uniform sampler2D transmissionMap;
	#endif
	#ifdef USE_THICKNESSMAP
		uniform sampler2D thicknessMap;
	#endif
	uniform vec2 transmissionSamplerSize;
	uniform sampler2D transmissionSamplerMap;
	uniform mat4 modelMatrix;
	uniform mat4 projectionMatrix;
	varying vec3 vWorldPosition;
	float w0( float a ) {
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
	}
	float w1( float a ) {
		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
	}
	float w2( float a ){
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
	}
	float w3( float a ) {
		return ( 1.0 / 6.0 ) * ( a * a * a );
	}
	float g0( float a ) {
		return w0( a ) + w1( a );
	}
	float g1( float a ) {
		return w2( a ) + w3( a );
	}
	float h0( float a ) {
		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
	}
	float h1( float a ) {
		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
	}
	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
		uv = uv * texelSize.zw + 0.5;
		vec2 iuv = floor( uv );
		vec2 fuv = fract( uv );
		float g0x = g0( fuv.x );
		float g1x = g1( fuv.x );
		float h0x = h0( fuv.x );
		float h1x = h1( fuv.x );
		float h0y = h0( fuv.y );
		float h1y = h1( fuv.y );
		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
	}
	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
		vec2 fLodSizeInv = 1.0 / fLodSize;
		vec2 cLodSizeInv = 1.0 / cLodSize;
		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
		return mix( fSample, cSample, fract( lod ) );
	}
	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
		vec3 modelScale;
		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
		return normalize( refractionVector ) * thickness * modelScale;
	}
	float applyIorToRoughness( const in float roughness, const in float ior ) {
		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
	}
	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
	}
	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
		if ( isinf( attenuationDistance ) ) {
			return vec3( 1.0 );
		} else {
			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
		}
	}
	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
		const in vec3 attenuationColor, const in float attenuationDistance ) {
		vec4 transmittedLight;
		vec3 transmittance;
		#ifdef USE_DISPERSION
			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
			for ( int i = 0; i < 3; i ++ ) {
				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
				vec3 refractedRayExit = position + transmissionRay;
		
				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
				refractionCoords += 1.0;
				refractionCoords /= 2.0;
		
				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
				transmittedLight[ i ] = transmissionSample[ i ];
				transmittedLight.a += transmissionSample.a;
				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
			}
			transmittedLight.a /= 3.0;
		
		#else
		
			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
			vec3 refractedRayExit = position + transmissionRay;
			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
			refractionCoords += 1.0;
			refractionCoords /= 2.0;
			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
		
		#endif
		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
	}
#endif`,Exe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,Axe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	uniform mat3 mapTransform;
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	uniform mat3 alphaMapTransform;
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	uniform mat3 lightMapTransform;
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	uniform mat3 aoMapTransform;
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	uniform mat3 bumpMapTransform;
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	uniform mat3 normalMapTransform;
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
	uniform mat3 displacementMapTransform;
	varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	uniform mat3 emissiveMapTransform;
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	uniform mat3 metalnessMapTransform;
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	uniform mat3 roughnessMapTransform;
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	uniform mat3 anisotropyMapTransform;
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	uniform mat3 clearcoatMapTransform;
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform mat3 clearcoatNormalMapTransform;
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform mat3 clearcoatRoughnessMapTransform;
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	uniform mat3 sheenColorMapTransform;
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	uniform mat3 sheenRoughnessMapTransform;
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	uniform mat3 iridescenceMapTransform;
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform mat3 iridescenceThicknessMapTransform;
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
	uniform mat3 specularMapTransform;
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	uniform mat3 specularColorMapTransform;
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	uniform mat3 specularIntensityMapTransform;
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,Sxe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ANISOTROPYMAP
	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
#endif`,Txe=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
	vec4 worldPosition = vec4( transformed, 1.0 );
	#ifdef USE_BATCHING
		worldPosition = batchingMatrix * worldPosition;
	#endif
	#ifdef USE_INSTANCING
		worldPosition = instanceMatrix * worldPosition;
	#endif
	worldPosition = modelMatrix * worldPosition;
#endif`;const bxe=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,Cxe=`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
	vec4 texColor = texture2D( t2D, vUv );
	#ifdef DECODE_VIDEO_TEXTURE
		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,Mxe=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,Ixe=`#ifdef ENVMAP_TYPE_CUBE
	uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
	uniform sampler2D envMap;
#endif
uniform float flipEnvMap;
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
uniform mat3 backgroundRotation;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
	#ifdef ENVMAP_TYPE_CUBE
		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
	#elif defined( ENVMAP_TYPE_CUBE_UV )
		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
	#else
		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,Rxe=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,Pxe=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
	gl_FragColor = texColor;
	gl_FragColor.a *= opacity;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,Nxe=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vHighPrecisionZW = gl_Position.zw;
}`,Dxe=`#if DEPTH_PACKING == 3200
	uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#if DEPTH_PACKING == 3200
		diffuseColor.a = opacity;
	#endif
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <logdepthbuf_fragment>
	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
	#if DEPTH_PACKING == 3200
		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
	#elif DEPTH_PACKING == 3201
		gl_FragColor = packDepthToRGBA( fragCoordZ );
	#elif DEPTH_PACKING == 3202
		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
	#elif DEPTH_PACKING == 3203
		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
	#endif
}`,Lxe=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <worldpos_vertex>
	#include <clipping_planes_vertex>
	vWorldPosition = worldPosition.xyz;
}`,kxe=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	float dist = length( vWorldPosition - referencePosition );
	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
	dist = saturate( dist );
	gl_FragColor = packDepthToRGBA( dist );
}`,Bxe=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,Oxe=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
	vec3 direction = normalize( vWorldDirection );
	vec2 sampleUV = equirectUv( direction );
	gl_FragColor = texture2D( tEquirect, sampleUV );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,Fxe=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	vLineDistance = scale * lineDistance;
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,Uxe=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	if ( mod( vLineDistance, totalSize ) > dashSize ) {
		discard;
	}
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,Vxe=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinbase_vertex>
		#include <skinnormal_vertex>
		#include <defaultnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <fog_vertex>
}`,zxe=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
	#else
		reflectedLight.indirectDiffuse += vec3( 1.0 );
	#endif
	#include <aomap_fragment>
	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
	vec3 outgoingLight = reflectedLight.indirectDiffuse;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Hxe=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,Gxe=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_lambert_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,jxe=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
	vViewPosition = - mvPosition.xyz;
}`,Wxe=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	vec3 viewDir = normalize( vViewPosition );
	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
	vec3 y = cross( viewDir, x );
	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
	#ifdef USE_MATCAP
		vec4 matcapColor = texture2D( matcap, uv );
	#else
		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
	#endif
	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Kxe=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	vViewPosition = - mvPosition.xyz;
#endif
}`,Xxe=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <packing>
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
	#ifdef OPAQUE
		gl_FragColor.a = 1.0;
	#endif
}`,qxe=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,Yxe=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_phong_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,$xe=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
	varying vec3 vWorldPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
#ifdef USE_TRANSMISSION
	vWorldPosition = worldPosition.xyz;
#endif
}`,Jxe=`#define STANDARD
#ifdef PHYSICAL
	#define IOR
	#define USE_SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
	uniform float ior;
#endif
#ifdef USE_SPECULAR
	uniform float specularIntensity;
	uniform vec3 specularColor;
	#ifdef USE_SPECULAR_COLORMAP
		uniform sampler2D specularColorMap;
	#endif
	#ifdef USE_SPECULAR_INTENSITYMAP
		uniform sampler2D specularIntensityMap;
	#endif
#endif
#ifdef USE_CLEARCOAT
	uniform float clearcoat;
	uniform float clearcoatRoughness;
#endif
#ifdef USE_DISPERSION
	uniform float dispersion;
#endif
#ifdef USE_IRIDESCENCE
	uniform float iridescence;
	uniform float iridescenceIOR;
	uniform float iridescenceThicknessMinimum;
	uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
	uniform vec3 sheenColor;
	uniform float sheenRoughness;
	#ifdef USE_SHEEN_COLORMAP
		uniform sampler2D sheenColorMap;
	#endif
	#ifdef USE_SHEEN_ROUGHNESSMAP
		uniform sampler2D sheenRoughnessMap;
	#endif
#endif
#ifdef USE_ANISOTROPY
	uniform vec2 anisotropyVector;
	#ifdef USE_ANISOTROPYMAP
		uniform sampler2D anisotropyMap;
	#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <roughnessmap_fragment>
	#include <metalnessmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <clearcoat_normal_fragment_begin>
	#include <clearcoat_normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_physical_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
	#include <transmission_fragment>
	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
	#ifdef USE_SHEEN
		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
	#endif
	#ifdef USE_CLEARCOAT
		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
	#endif
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Qxe=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,Zxe=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_toon_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,ewe=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#ifdef USE_POINTS_UV
	varying vec2 vUv;
	uniform mat3 uvTransform;
#endif
void main() {
	#ifdef USE_POINTS_UV
		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	#endif
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	gl_PointSize = size;
	#ifdef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
	#endif
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <fog_vertex>
}`,twe=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_particle_fragment>
	#include <color_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,nwe=`#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,iwe=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
	#include <logdepthbuf_fragment>
	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,rwe=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	vec4 mvPosition = modelViewMatrix[ 3 ];
	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
	#ifndef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) scale *= - mvPosition.z;
	#endif
	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
	vec2 rotatedPosition;
	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
	mvPosition.xy += rotatedPosition;
	gl_Position = projectionMatrix * mvPosition;
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,swe=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,pn={alphahash_fragment:Cve,alphahash_pars_fragment:Mve,alphamap_fragment:Ive,alphamap_pars_fragment:Rve,alphatest_fragment:Pve,alphatest_pars_fragment:Nve,aomap_fragment:Dve,aomap_pars_fragment:Lve,batching_pars_vertex:kve,batching_vertex:Bve,begin_vertex:Ove,beginnormal_vertex:Fve,bsdfs:Uve,iridescence_fragment:Vve,bumpmap_pars_fragment:zve,clipping_planes_fragment:Hve,clipping_planes_pars_fragment:Gve,clipping_planes_pars_vertex:jve,clipping_planes_vertex:Wve,color_fragment:Kve,color_pars_fragment:Xve,color_pars_vertex:qve,color_vertex:Yve,common:$ve,cube_uv_reflection_fragment:Jve,defaultnormal_vertex:Qve,displacementmap_pars_vertex:Zve,displacementmap_vertex:e_e,emissivemap_fragment:t_e,emissivemap_pars_fragment:n_e,colorspace_fragment:i_e,colorspace_pars_fragment:r_e,envmap_fragment:s_e,envmap_common_pars_fragment:o_e,envmap_pars_fragment:a_e,envmap_pars_vertex:l_e,envmap_physical_pars_fragment:__e,envmap_vertex:c_e,fog_vertex:u_e,fog_pars_vertex:h_e,fog_fragment:d_e,fog_pars_fragment:f_e,gradientmap_pars_fragment:p_e,lightmap_pars_fragment:m_e,lights_lambert_fragment:g_e,lights_lambert_pars_fragment:y_e,lights_pars_begin:v_e,lights_toon_fragment:x_e,lights_toon_pars_fragment:w_e,lights_phong_fragment:E_e,lights_phong_pars_fragment:A_e,lights_physical_fragment:S_e,lights_physical_pars_fragment:T_e,lights_fragment_begin:b_e,lights_fragment_maps:C_e,lights_fragment_end:M_e,logdepthbuf_fragment:I_e,logdepthbuf_pars_fragment:R_e,logdepthbuf_pars_vertex:P_e,logdepthbuf_vertex:N_e,map_fragment:D_e,map_pars_fragment:L_e,map_particle_fragment:k_e,map_particle_pars_fragment:B_e,metalnessmap_fragment:O_e,metalnessmap_pars_fragment:F_e,morphinstance_vertex:U_e,morphcolor_vertex:V_e,morphnormal_vertex:z_e,morphtarget_pars_vertex:H_e,morphtarget_vertex:G_e,normal_fragment_begin:j_e,normal_fragment_maps:W_e,normal_pars_fragment:K_e,normal_pars_vertex:X_e,normal_vertex:q_e,normalmap_pars_fragment:Y_e,clearcoat_normal_fragment_begin:$_e,clearcoat_normal_fragment_maps:J_e,clearcoat_pars_fragment:Q_e,iridescence_pars_fragment:Z_e,opaque_fragment:exe,packing:txe,premultiplied_alpha_fragment:nxe,project_vertex:ixe,dithering_fragment:rxe,dithering_pars_fragment:sxe,roughnessmap_fragment:oxe,roughnessmap_pars_fragment:axe,shadowmap_pars_fragment:lxe,shadowmap_pars_vertex:cxe,shadowmap_vertex:uxe,shadowmask_pars_fragment:hxe,skinbase_vertex:dxe,skinning_pars_vertex:fxe,skinning_vertex:pxe,skinnormal_vertex:mxe,specularmap_fragment:gxe,specularmap_pars_fragment:yxe,tonemapping_fragment:vxe,tonemapping_pars_fragment:_xe,transmission_fragment:xxe,transmission_pars_fragment:wxe,uv_pars_fragment:Exe,uv_pars_vertex:Axe,uv_vertex:Sxe,worldpos_vertex:Txe,background_vert:bxe,background_frag:Cxe,backgroundCube_vert:Mxe,backgroundCube_frag:Ixe,cube_vert:Rxe,cube_frag:Pxe,depth_vert:Nxe,depth_frag:Dxe,distanceRGBA_vert:Lxe,distanceRGBA_frag:kxe,equirect_vert:Bxe,equirect_frag:Oxe,linedashed_vert:Fxe,linedashed_frag:Uxe,meshbasic_vert:Vxe,meshbasic_frag:zxe,meshlambert_vert:Hxe,meshlambert_frag:Gxe,meshmatcap_vert:jxe,meshmatcap_frag:Wxe,meshnormal_vert:Kxe,meshnormal_frag:Xxe,meshphong_vert:qxe,meshphong_frag:Yxe,meshphysical_vert:$xe,meshphysical_frag:Jxe,meshtoon_vert:Qxe,meshtoon_frag:Zxe,points_vert:ewe,points_frag:twe,shadow_vert:nwe,shadow_frag:iwe,sprite_vert:rwe,sprite_frag:swe},pt={common:{diffuse:{value:new ft(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new cn},alphaMap:{value:null},alphaMapTransform:{value:new cn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new cn}},envmap:{envMap:{value:null},envMapRotation:{value:new cn},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new cn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new cn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new cn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new cn},normalScale:{value:new Fe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new cn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new cn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new cn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new cn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ft(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ft(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new cn},alphaTest:{value:0},uvTransform:{value:new cn}},sprite:{diffuse:{value:new ft(16777215)},opacity:{value:1},center:{value:new Fe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new cn},alphaMap:{value:null},alphaMapTransform:{value:new cn},alphaTest:{value:0}}},ca={basic:{uniforms:fs([pt.common,pt.specularmap,pt.envmap,pt.aomap,pt.lightmap,pt.fog]),vertexShader:pn.meshbasic_vert,fragmentShader:pn.meshbasic_frag},lambert:{uniforms:fs([pt.common,pt.specularmap,pt.envmap,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.fog,pt.lights,{emissive:{value:new ft(0)}}]),vertexShader:pn.meshlambert_vert,fragmentShader:pn.meshlambert_frag},phong:{uniforms:fs([pt.common,pt.specularmap,pt.envmap,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.fog,pt.lights,{emissive:{value:new ft(0)},specular:{value:new ft(1118481)},shininess:{value:30}}]),vertexShader:pn.meshphong_vert,fragmentShader:pn.meshphong_frag},standard:{uniforms:fs([pt.common,pt.envmap,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.roughnessmap,pt.metalnessmap,pt.fog,pt.lights,{emissive:{value:new ft(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:pn.meshphysical_vert,fragmentShader:pn.meshphysical_frag},toon:{uniforms:fs([pt.common,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.gradientmap,pt.fog,pt.lights,{emissive:{value:new ft(0)}}]),vertexShader:pn.meshtoon_vert,fragmentShader:pn.meshtoon_frag},matcap:{uniforms:fs([pt.common,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.fog,{matcap:{value:null}}]),vertexShader:pn.meshmatcap_vert,fragmentShader:pn.meshmatcap_frag},points:{uniforms:fs([pt.points,pt.fog]),vertexShader:pn.points_vert,fragmentShader:pn.points_frag},dashed:{uniforms:fs([pt.common,pt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:pn.linedashed_vert,fragmentShader:pn.linedashed_frag},depth:{uniforms:fs([pt.common,pt.displacementmap]),vertexShader:pn.depth_vert,fragmentShader:pn.depth_frag},normal:{uniforms:fs([pt.common,pt.bumpmap,pt.normalmap,pt.displacementmap,{opacity:{value:1}}]),vertexShader:pn.meshnormal_vert,fragmentShader:pn.meshnormal_frag},sprite:{uniforms:fs([pt.sprite,pt.fog]),vertexShader:pn.sprite_vert,fragmentShader:pn.sprite_frag},background:{uniforms:{uvTransform:{value:new cn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:pn.background_vert,fragmentShader:pn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new cn}},vertexShader:pn.backgroundCube_vert,fragmentShader:pn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:pn.cube_vert,fragmentShader:pn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:pn.equirect_vert,fragmentShader:pn.equirect_frag},distanceRGBA:{uniforms:fs([pt.common,pt.displacementmap,{referencePosition:{value:new q},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:pn.distanceRGBA_vert,fragmentShader:pn.distanceRGBA_frag},shadow:{uniforms:fs([pt.lights,pt.fog,{color:{value:new ft(0)},opacity:{value:1}}]),vertexShader:pn.shadow_vert,fragmentShader:pn.shadow_frag}};ca.physical={uniforms:fs([ca.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new cn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new cn},clearcoatNormalScale:{value:new Fe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new cn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new cn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new cn},sheen:{value:0},sheenColor:{value:new ft(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new cn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new cn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new cn},transmissionSamplerSize:{value:new Fe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new cn},attenuationDistance:{value:0},attenuationColor:{value:new ft(0)},specularColor:{value:new ft(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new cn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new cn},anisotropyVector:{value:new Fe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new cn}}]),vertexShader:pn.meshphysical_vert,fragmentShader:pn.meshphysical_frag};const Nx={r:0,b:0,g:0},Ah=new mo,owe=new qt;function awe(n,e,t,i,r,s,o){const a=new ft(0);let l=s===!0?0:1,c,u,h=null,f=0,m=null;function y(w){let A=w.isScene===!0?w.background:null;return A&&A.isTexture&&(A=(w.backgroundBlurriness>0?t:e).get(A)),A}function _(w){let A=!1;const T=y(w);T===null?g(a,l):T&&T.isColor&&(g(T,1),A=!0);const L=n.xr.getEnvironmentBlendMode();L==="additive"?i.buffers.color.setClear(0,0,0,1,o):L==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||A)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function v(w,A){const T=y(A);T&&(T.isCubeTexture||T.mapping===Km)?(u===void 0&&(u=new fi(new tf(1,1,1),new ss({name:"BackgroundCubeMaterial",uniforms:Am(ca.backgroundCube.uniforms),vertexShader:ca.backgroundCube.vertexShader,fragmentShader:ca.backgroundCube.fragmentShader,side:As,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(L,D,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),Ah.copy(A.backgroundRotation),Ah.x*=-1,Ah.y*=-1,Ah.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(Ah.y*=-1,Ah.z*=-1),u.material.uniforms.envMap.value=T,u.material.uniforms.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=A.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(owe.makeRotationFromEuler(Ah)),u.material.toneMapped=Mn.getTransfer(T.colorSpace)!==$n,(h!==T||f!==T.version||m!==n.toneMapping)&&(u.material.needsUpdate=!0,h=T,f=T.version,m=n.toneMapping),u.layers.enableAll(),w.unshift(u,u.geometry,u.material,0,0,null)):T&&T.isTexture&&(c===void 0&&(c=new fi(new yc(2,2),new ss({name:"BackgroundMaterial",uniforms:Am(ca.background.uniforms),vertexShader:ca.background.vertexShader,fragmentShader:ca.background.fragmentShader,side:ol,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=T,c.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,c.material.toneMapped=Mn.getTransfer(T.colorSpace)!==$n,T.matrixAutoUpdate===!0&&T.updateMatrix(),c.material.uniforms.uvTransform.value.copy(T.matrix),(h!==T||f!==T.version||m!==n.toneMapping)&&(c.material.needsUpdate=!0,h=T,f=T.version,m=n.toneMapping),c.layers.enableAll(),w.unshift(c,c.geometry,c.material,0,0,null))}function g(w,A){w.getRGB(Nx,SK(n)),i.buffers.color.setClear(Nx.r,Nx.g,Nx.b,A,o)}return{getClearColor:function(){return a},setClearColor:function(w,A=1){a.set(w),l=A,g(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(w){l=w,g(a,l)},render:_,addToRenderList:v}}function lwe(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=f(null);let s=r,o=!1;function a(C,k,B,O,X){let le=!1;const ie=h(O,B,k);s!==ie&&(s=ie,c(s.object)),le=m(C,O,B,X),le&&y(C,O,B,X),X!==null&&e.update(X,n.ELEMENT_ARRAY_BUFFER),(le||o)&&(o=!1,T(C,k,B,O),X!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(X).buffer))}function l(){return n.createVertexArray()}function c(C){return n.bindVertexArray(C)}function u(C){return n.deleteVertexArray(C)}function h(C,k,B){const O=B.wireframe===!0;let X=i[C.id];X===void 0&&(X={},i[C.id]=X);let le=X[k.id];le===void 0&&(le={},X[k.id]=le);let ie=le[O];return ie===void 0&&(ie=f(l()),le[O]=ie),ie}function f(C){const k=[],B=[],O=[];for(let X=0;X<t;X++)k[X]=0,B[X]=0,O[X]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:k,enabledAttributes:B,attributeDivisors:O,object:C,attributes:{},index:null}}function m(C,k,B,O){const X=s.attributes,le=k.attributes;let ie=0;const de=B.getAttributes();for(const G in de)if(de[G].location>=0){const te=X[G];let ue=le[G];if(ue===void 0&&(G==="instanceMatrix"&&C.instanceMatrix&&(ue=C.instanceMatrix),G==="instanceColor"&&C.instanceColor&&(ue=C.instanceColor)),te===void 0||te.attribute!==ue||ue&&te.data!==ue.data)return!0;ie++}return s.attributesNum!==ie||s.index!==O}function y(C,k,B,O){const X={},le=k.attributes;let ie=0;const de=B.getAttributes();for(const G in de)if(de[G].location>=0){let te=le[G];te===void 0&&(G==="instanceMatrix"&&C.instanceMatrix&&(te=C.instanceMatrix),G==="instanceColor"&&C.instanceColor&&(te=C.instanceColor));const ue={};ue.attribute=te,te&&te.data&&(ue.data=te.data),X[G]=ue,ie++}s.attributes=X,s.attributesNum=ie,s.index=O}function _(){const C=s.newAttributes;for(let k=0,B=C.length;k<B;k++)C[k]=0}function v(C){g(C,0)}function g(C,k){const B=s.newAttributes,O=s.enabledAttributes,X=s.attributeDivisors;B[C]=1,O[C]===0&&(n.enableVertexAttribArray(C),O[C]=1),X[C]!==k&&(n.vertexAttribDivisor(C,k),X[C]=k)}function w(){const C=s.newAttributes,k=s.enabledAttributes;for(let B=0,O=k.length;B<O;B++)k[B]!==C[B]&&(n.disableVertexAttribArray(B),k[B]=0)}function A(C,k,B,O,X,le,ie){ie===!0?n.vertexAttribIPointer(C,k,B,X,le):n.vertexAttribPointer(C,k,B,O,X,le)}function T(C,k,B,O){_();const X=O.attributes,le=B.getAttributes(),ie=k.defaultAttributeValues;for(const de in le){const G=le[de];if(G.location>=0){let $=X[de];if($===void 0&&(de==="instanceMatrix"&&C.instanceMatrix&&($=C.instanceMatrix),de==="instanceColor"&&C.instanceColor&&($=C.instanceColor)),$!==void 0){const te=$.normalized,ue=$.itemSize,ve=e.get($);if(ve===void 0)continue;const be=ve.buffer,he=ve.type,Pe=ve.bytesPerElement,Oe=he===n.INT||he===n.UNSIGNED_INT||$.gpuType===Nv;if($.isInterleavedBufferAttribute){const Ce=$.data,mt=Ce.stride,Lt=$.offset;if(Ce.isInstancedInterleavedBuffer){for(let St=0;St<G.locationSize;St++)g(G.location+St,Ce.meshPerAttribute);C.isInstancedMesh!==!0&&O._maxInstanceCount===void 0&&(O._maxInstanceCount=Ce.meshPerAttribute*Ce.count)}else for(let St=0;St<G.locationSize;St++)v(G.location+St);n.bindBuffer(n.ARRAY_BUFFER,be);for(let St=0;St<G.locationSize;St++)A(G.location+St,ue/G.locationSize,he,te,mt*Pe,(Lt+ue/G.locationSize*St)*Pe,Oe)}else{if($.isInstancedBufferAttribute){for(let Ce=0;Ce<G.locationSize;Ce++)g(G.location+Ce,$.meshPerAttribute);C.isInstancedMesh!==!0&&O._maxInstanceCount===void 0&&(O._maxInstanceCount=$.meshPerAttribute*$.count)}else for(let Ce=0;Ce<G.locationSize;Ce++)v(G.location+Ce);n.bindBuffer(n.ARRAY_BUFFER,be);for(let Ce=0;Ce<G.locationSize;Ce++)A(G.location+Ce,ue/G.locationSize,he,te,ue*Pe,ue/G.locationSize*Ce*Pe,Oe)}}else if(ie!==void 0){const te=ie[de];if(te!==void 0)switch(te.length){case 2:n.vertexAttrib2fv(G.location,te);break;case 3:n.vertexAttrib3fv(G.location,te);break;case 4:n.vertexAttrib4fv(G.location,te);break;default:n.vertexAttrib1fv(G.location,te)}}}}w()}function L(){I();for(const C in i){const k=i[C];for(const B in k){const O=k[B];for(const X in O)u(O[X].object),delete O[X];delete k[B]}delete i[C]}}function D(C){if(i[C.id]===void 0)return;const k=i[C.id];for(const B in k){const O=k[B];for(const X in O)u(O[X].object),delete O[X];delete k[B]}delete i[C.id]}function R(C){for(const k in i){const B=i[k];if(B[C.id]===void 0)continue;const O=B[C.id];for(const X in O)u(O[X].object),delete O[X];delete B[C.id]}}function I(){M(),o=!0,s!==r&&(s=r,c(s.object))}function M(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:I,resetDefaultState:M,dispose:L,releaseStatesOfGeometry:D,releaseStatesOfProgram:R,initAttributes:_,enableAttribute:v,disableUnusedAttributes:w}}function cwe(n,e,t){let i;function r(c){i=c}function s(c,u){n.drawArrays(i,c,u),t.update(u,i,1)}function o(c,u,h){h!==0&&(n.drawArraysInstanced(i,c,u,h),t.update(u,i,h))}function a(c,u,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,c,0,u,0,h);let m=0;for(let y=0;y<h;y++)m+=u[y];t.update(m,i,1)}function l(c,u,h,f){if(h===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let y=0;y<c.length;y++)o(c[y],u[y],f[y]);else{m.multiDrawArraysInstancedWEBGL(i,c,0,u,0,f,0,h);let y=0;for(let _=0;_<h;_++)y+=u[_]*f[_];t.update(y,i,1)}}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function uwe(n,e,t,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const R=e.get("EXT_texture_filter_anisotropic");r=n.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(R){return!(R!==Vi&&i.convert(R)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(R){const I=R===yr&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(R!==Ws&&i.convert(R)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&R!==Ai&&!I)}function l(R){if(R==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";R="mediump"}return R==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const u=l(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const h=t.logarithmicDepthBuffer===!0,f=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),m=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),y=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=n.getParameter(n.MAX_TEXTURE_SIZE),v=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),g=n.getParameter(n.MAX_VERTEX_ATTRIBS),w=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),A=n.getParameter(n.MAX_VARYING_VECTORS),T=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),L=y>0,D=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:h,reverseDepthBuffer:f,maxTextures:m,maxVertexTextures:y,maxTextureSize:_,maxCubemapSize:v,maxAttributes:g,maxVertexUniforms:w,maxVaryings:A,maxFragmentUniforms:T,vertexTextures:L,maxSamples:D}}function hwe(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new Ll,a=new cn,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){const m=h.length!==0||f||i!==0||r;return r=f,i=h.length,m},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,f){t=u(h,f,0)},this.setState=function(h,f,m){const y=h.clippingPlanes,_=h.clipIntersection,v=h.clipShadows,g=n.get(h);if(!r||y===null||y.length===0||s&&!v)s?u(null):c();else{const w=s?0:i,A=w*4;let T=g.clippingState||null;l.value=T,T=u(y,f,A,m);for(let L=0;L!==A;++L)T[L]=t[L];g.clippingState=T,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=w}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(h,f,m,y){const _=h!==null?h.length:0;let v=null;if(_!==0){if(v=l.value,y!==!0||v===null){const g=m+_*4,w=f.matrixWorldInverse;a.getNormalMatrix(w),(v===null||v.length<g)&&(v=new Float32Array(g));for(let A=0,T=m;A!==_;++A,T+=4)o.copy(h[A]).applyMatrix4(w,a),o.normal.toArray(v,T),v[T+3]=o.constant}l.value=v,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,v}}function dwe(n){let e=new WeakMap;function t(o,a){return a===ym?o.mapping=al:a===O0&&(o.mapping=zu),o}function i(o){if(o&&o.isTexture){const a=o.mapping;if(a===ym||a===O0)if(e.has(o)){const l=e.get(o).texture;return t(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new AD(l.height);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",r),t(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class tl extends Bv{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,o=i+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const vp=4,d4=[.125,.215,.35,.446,.526,.582],Gh=20,pC=new tl,f4=new ft;let mC=null,gC=0,yC=0,vC=!1;const Hh=(1+Math.sqrt(5))/2,Ff=1/Hh,p4=[new q(-Hh,Ff,0),new q(Hh,Ff,0),new q(-Ff,0,Hh),new q(Ff,0,Hh),new q(0,Hh,-Ff),new q(0,Hh,Ff),new q(-1,1,-1),new q(1,1,-1),new q(-1,1,1),new q(1,1,1)];class IR{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){mC=this._renderer.getRenderTarget(),gC=this._renderer.getActiveCubeFace(),yC=this._renderer.getActiveMipmapLevel(),vC=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=y4(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=g4(),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(mC,gC,yC),this._renderer.xr.enabled=vC,e.scissorTest=!1,Dx(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===al||e.mapping===zu?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),mC=this._renderer.getRenderTarget(),gC=this._renderer.getActiveCubeFace(),yC=this._renderer.getActiveMipmapLevel(),vC=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:Gn,minFilter:Gn,generateMipmaps:!1,type:yr,format:Vi,colorSpace:cl,depthBuffer:!1},r=m4(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=m4(e,t,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=fwe(s)),this._blurMaterial=pwe(s,e,t)}return r}_compileMaterial(e){const t=new fi(this._lodPlanes[0],e);this._renderer.compile(t,pC)}_sceneToCubeUV(e,t,i,r){const a=new Ni(90,1,t,i),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,f=u.toneMapping;u.getClearColor(f4),u.toneMapping=el,u.autoClear=!1;const m=new Fs({name:"PMREM.Background",side:As,depthWrite:!1,depthTest:!1}),y=new fi(new tf,m);let _=!1;const v=e.background;v?v.isColor&&(m.color.copy(v),e.background=null,_=!0):(m.color.copy(f4),_=!0);for(let g=0;g<6;g++){const w=g%3;w===0?(a.up.set(0,l[g],0),a.lookAt(c[g],0,0)):w===1?(a.up.set(0,0,l[g]),a.lookAt(0,c[g],0)):(a.up.set(0,l[g],0),a.lookAt(0,0,c[g]));const A=this._cubeSize;Dx(r,w*A,g>2?A:0,A,A),u.setRenderTarget(r),_&&u.render(y,a),u.render(e,a)}y.geometry.dispose(),y.material.dispose(),u.toneMapping=f,u.autoClear=h,e.background=v}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===al||e.mapping===zu;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=y4()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=g4());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new fi(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Dx(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,pC)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const o=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),a=p4[(r-s-1)%p4.length];this._blur(e,s-1,s,o,a)}t.autoClear=i}_blur(e,t,i,r,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,i,r,"latitudinal",s),this._halfBlur(o,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,s,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,h=new fi(this._lodPlanes[r],c),f=c.uniforms,m=this._sizeLods[i]-1,y=isFinite(s)?Math.PI/(2*m):2*Math.PI/(2*Gh-1),_=s/y,v=isFinite(s)?1+Math.floor(u*_):Gh;v>Gh&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${v} samples when the maximum is set to ${Gh}`);const g=[];let w=0;for(let R=0;R<Gh;++R){const I=R/_,M=Math.exp(-I*I/2);g.push(M),R===0?w+=M:R<v&&(w+=2*M)}for(let R=0;R<g.length;R++)g[R]=g[R]/w;f.envMap.value=e.texture,f.samples.value=v,f.weights.value=g,f.latitudinal.value=o==="latitudinal",a&&(f.poleAxis.value=a);const{_lodMax:A}=this;f.dTheta.value=y,f.mipInt.value=A-i;const T=this._sizeLods[r],L=3*T*(r>A-vp?r-A+vp:0),D=4*(this._cubeSize-T);Dx(t,L,D,3*T,2*T),l.setRenderTarget(t),l.render(h,pC)}}function fwe(n){const e=[],t=[],i=[];let r=n;const s=n-vp+1+d4.length;for(let o=0;o<s;o++){const a=Math.pow(2,r);t.push(a);let l=1/a;o>n-vp?l=d4[o-n+vp-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),u=-c,h=1+c,f=[u,u,h,u,h,h,u,u,h,h,u,h],m=6,y=6,_=3,v=2,g=1,w=new Float32Array(_*y*m),A=new Float32Array(v*y*m),T=new Float32Array(g*y*m);for(let D=0;D<m;D++){const R=D%3*2/3-1,I=D>2?0:-1,M=[R,I,0,R+2/3,I,0,R+2/3,I+1,0,R,I,0,R+2/3,I+1,0,R,I+1,0];w.set(M,_*y*D),A.set(f,v*y*D);const C=[D,D,D,D,D,D];T.set(C,g*y*D)}const L=new un;L.setAttribute("position",new Fn(w,_)),L.setAttribute("uv",new Fn(A,v)),L.setAttribute("faceIndex",new Fn(T,g)),e.push(L),r>vp&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function m4(n,e,t){const i=new Ss(n,e,t);return i.texture.mapping=Km,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Dx(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function pwe(n,e,t){const i=new Float32Array(Gh),r=new q(0,1,0);return new ss({name:"SphericalGaussianBlur",defines:{n:Gh,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:SD(),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:Za,depthTest:!1,depthWrite:!1})}function g4(){return new ss({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:SD(),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:Za,depthTest:!1,depthWrite:!1})}function y4(){return new ss({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:SD(),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:Za,depthTest:!1,depthWrite:!1})}function SD(){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 mwe(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===ym||l===O0,u=l===al||l===zu;if(c||u){let h=e.get(a);const f=h!==void 0?h.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==f)return t===null&&(t=new IR(n)),h=c?t.fromEquirectangular(a,h):t.fromCubemap(a,h),h.texture.pmremVersion=a.pmremVersion,e.set(a,h),h.texture;if(h!==void 0)return h.texture;{const m=a.image;return c&&m&&m.height>0||u&&m&&r(m)?(t===null&&(t=new IR(n)),h=c?t.fromEquirectangular(a):t.fromCubemap(a),h.texture.pmremVersion=a.pmremVersion,e.set(a,h),a.addEventListener("dispose",s),h.texture):null}}}return a}function r(a){let l=0;const c=6;for(let u=0;u<c;u++)a[u]!==void 0&&l++;return l===c}function s(a){const l=a.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:o}}function gwe(n){const e={};function t(i){if(e[i]!==void 0)return e[i];let r;switch(i){case"WEBGL_depth_texture":r=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=n.getExtension(i)}return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(i){const r=t(i);return r===null&&uy("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function ywe(n,e,t,i){const r={},s=new WeakMap;function o(h){const f=h.target;f.index!==null&&e.remove(f.index);for(const y in f.attributes)e.remove(f.attributes[y]);for(const y in f.morphAttributes){const _=f.morphAttributes[y];for(let v=0,g=_.length;v<g;v++)e.remove(_[v])}f.removeEventListener("dispose",o),delete r[f.id];const m=s.get(f);m&&(e.remove(m),s.delete(f)),i.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function a(h,f){return r[f.id]===!0||(f.addEventListener("dispose",o),r[f.id]=!0,t.memory.geometries++),f}function l(h){const f=h.attributes;for(const y in f)e.update(f[y],n.ARRAY_BUFFER);const m=h.morphAttributes;for(const y in m){const _=m[y];for(let v=0,g=_.length;v<g;v++)e.update(_[v],n.ARRAY_BUFFER)}}function c(h){const f=[],m=h.index,y=h.attributes.position;let _=0;if(m!==null){const w=m.array;_=m.version;for(let A=0,T=w.length;A<T;A+=3){const L=w[A+0],D=w[A+1],R=w[A+2];f.push(L,D,D,R,R,L)}}else if(y!==void 0){const w=y.array;_=y.version;for(let A=0,T=w.length/3-1;A<T;A+=3){const L=A+0,D=A+1,R=A+2;f.push(L,D,D,R,R,L)}}else return;const v=new(_K(f)?ED:wD)(f,1);v.version=_;const g=s.get(h);g&&e.remove(g),s.set(h,v)}function u(h){const f=s.get(h);if(f){const m=h.index;m!==null&&f.version<m.version&&c(h)}else c(h);return s.get(h)}return{get:a,update:l,getWireframeAttribute:u}}function vwe(n,e,t){let i;function r(f){i=f}let s,o;function a(f){s=f.type,o=f.bytesPerElement}function l(f,m){n.drawElements(i,m,s,f*o),t.update(m,i,1)}function c(f,m,y){y!==0&&(n.drawElementsInstanced(i,m,s,f*o,y),t.update(m,i,y))}function u(f,m,y){if(y===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,m,0,s,f,0,y);let v=0;for(let g=0;g<y;g++)v+=m[g];t.update(v,i,1)}function h(f,m,y,_){if(y===0)return;const v=e.get("WEBGL_multi_draw");if(v===null)for(let g=0;g<f.length;g++)c(f[g]/o,m[g],_[g]);else{v.multiDrawElementsInstancedWEBGL(i,m,0,s,f,0,_,0,y);let g=0;for(let w=0;w<y;w++)g+=m[w]*_[w];t.update(g,i,1)}}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u,this.renderMultiDrawInstances=h}function _we(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,o,a){switch(t.calls++,o){case n.TRIANGLES:t.triangles+=a*(s/3);break;case n.LINES:t.lines+=a*(s/2);break;case n.LINE_STRIP:t.lines+=a*(s-1);break;case n.LINE_LOOP:t.lines+=a*s;break;case n.POINTS:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function xwe(n,e,t){const i=new WeakMap,r=new Bn;function s(o,a,l){const c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=u!==void 0?u.length:0;let f=i.get(a);if(f===void 0||f.count!==h){let C=function(){I.dispose(),i.delete(a),a.removeEventListener("dispose",C)};var m=C;f!==void 0&&f.texture.dispose();const y=a.morphAttributes.position!==void 0,_=a.morphAttributes.normal!==void 0,v=a.morphAttributes.color!==void 0,g=a.morphAttributes.position||[],w=a.morphAttributes.normal||[],A=a.morphAttributes.color||[];let T=0;y===!0&&(T=1),_===!0&&(T=2),v===!0&&(T=3);let L=a.attributes.position.count*T,D=1;L>e.maxTextureSize&&(D=Math.ceil(L/e.maxTextureSize),L=e.maxTextureSize);const R=new Float32Array(L*D*4*h),I=new yS(R,L,D,h);I.type=Ai,I.needsUpdate=!0;const M=T*4;for(let k=0;k<h;k++){const B=g[k],O=w[k],X=A[k],le=L*D*4*k;for(let ie=0;ie<B.count;ie++){const de=ie*M;y===!0&&(r.fromBufferAttribute(B,ie),R[le+de+0]=r.x,R[le+de+1]=r.y,R[le+de+2]=r.z,R[le+de+3]=0),_===!0&&(r.fromBufferAttribute(O,ie),R[le+de+4]=r.x,R[le+de+5]=r.y,R[le+de+6]=r.z,R[le+de+7]=0),v===!0&&(r.fromBufferAttribute(X,ie),R[le+de+8]=r.x,R[le+de+9]=r.y,R[le+de+10]=r.z,R[le+de+11]=X.itemSize===4?r.w:1)}}f={count:h,texture:I,size:new Fe(L,D)},i.set(a,f),a.addEventListener("dispose",C)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(n,"morphTexture",o.morphTexture,t);else{let y=0;for(let v=0;v<c.length;v++)y+=c[v];const _=a.morphTargetsRelative?1:1-y;l.getUniforms().setValue(n,"morphTargetBaseInfluence",_),l.getUniforms().setValue(n,"morphTargetInfluences",c)}l.getUniforms().setValue(n,"morphTargetsTexture",f.texture,t),l.getUniforms().setValue(n,"morphTargetsTextureSize",f.size)}return{update:s}}function wwe(n,e,t,i){let r=new WeakMap;function s(l){const c=i.render.frame,u=l.geometry,h=e.get(l,u);if(r.get(h)!==c&&(e.update(h),r.set(h,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),r.get(l)!==c&&(t.update(l.instanceMatrix,n.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,n.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const f=l.skeleton;r.get(f)!==c&&(f.update(),r.set(f,c))}return h}function o(){r=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:o}}class TD extends qn{constructor(e,t,i,r,s,o,a,l,c,u=vd){if(u!==vd&&u!==Ud)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===vd&&(i=ll),i===void 0&&u===Ud&&(i=Fd),super(null,r,s,o,a,l,u,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:_r,this.minFilter=l!==void 0?l:_r,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const MK=new qn,v4=new TD(1,1),IK=new yS,RK=new xD,PK=new Ov,_4=[],x4=[],w4=new Float32Array(16),E4=new Float32Array(9),A4=new Float32Array(4);function Xm(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=_4[r];if(s===void 0&&(s=new Float32Array(r),_4[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function ar(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function lr(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function vS(n,e){let t=x4[e];t===void 0&&(t=new Int32Array(e),x4[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function Ewe(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function Awe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(ar(t,e))return;n.uniform2fv(this.addr,e),lr(t,e)}}function Swe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(ar(t,e))return;n.uniform3fv(this.addr,e),lr(t,e)}}function Twe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(ar(t,e))return;n.uniform4fv(this.addr,e),lr(t,e)}}function bwe(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(ar(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),lr(t,e)}else{if(ar(t,i))return;A4.set(i),n.uniformMatrix2fv(this.addr,!1,A4),lr(t,i)}}function Cwe(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(ar(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),lr(t,e)}else{if(ar(t,i))return;E4.set(i),n.uniformMatrix3fv(this.addr,!1,E4),lr(t,i)}}function Mwe(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(ar(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),lr(t,e)}else{if(ar(t,i))return;w4.set(i),n.uniformMatrix4fv(this.addr,!1,w4),lr(t,i)}}function Iwe(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function Rwe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(ar(t,e))return;n.uniform2iv(this.addr,e),lr(t,e)}}function Pwe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(ar(t,e))return;n.uniform3iv(this.addr,e),lr(t,e)}}function Nwe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(ar(t,e))return;n.uniform4iv(this.addr,e),lr(t,e)}}function Dwe(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function Lwe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(ar(t,e))return;n.uniform2uiv(this.addr,e),lr(t,e)}}function kwe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(ar(t,e))return;n.uniform3uiv(this.addr,e),lr(t,e)}}function Bwe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(ar(t,e))return;n.uniform4uiv(this.addr,e),lr(t,e)}}function Owe(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r);let s;this.type===n.SAMPLER_2D_SHADOW?(v4.compareFunction=vD,s=v4):s=MK,t.setTexture2D(e||s,r)}function Fwe(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||RK,r)}function Uwe(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||PK,r)}function Vwe(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||IK,r)}function zwe(n){switch(n){case 5126:return Ewe;case 35664:return Awe;case 35665:return Swe;case 35666:return Twe;case 35674:return bwe;case 35675:return Cwe;case 35676:return Mwe;case 5124:case 35670:return Iwe;case 35667:case 35671:return Rwe;case 35668:case 35672:return Pwe;case 35669:case 35673:return Nwe;case 5125:return Dwe;case 36294:return Lwe;case 36295:return kwe;case 36296:return Bwe;case 35678:case 36198:case 36298:case 36306:case 35682:return Owe;case 35679:case 36299:case 36307:return Fwe;case 35680:case 36300:case 36308:case 36293:return Uwe;case 36289:case 36303:case 36311:case 36292:return Vwe}}function Hwe(n,e){n.uniform1fv(this.addr,e)}function Gwe(n,e){const t=Xm(e,this.size,2);n.uniform2fv(this.addr,t)}function jwe(n,e){const t=Xm(e,this.size,3);n.uniform3fv(this.addr,t)}function Wwe(n,e){const t=Xm(e,this.size,4);n.uniform4fv(this.addr,t)}function Kwe(n,e){const t=Xm(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function Xwe(n,e){const t=Xm(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function qwe(n,e){const t=Xm(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function Ywe(n,e){n.uniform1iv(this.addr,e)}function $we(n,e){n.uniform2iv(this.addr,e)}function Jwe(n,e){n.uniform3iv(this.addr,e)}function Qwe(n,e){n.uniform4iv(this.addr,e)}function Zwe(n,e){n.uniform1uiv(this.addr,e)}function e1e(n,e){n.uniform2uiv(this.addr,e)}function t1e(n,e){n.uniform3uiv(this.addr,e)}function n1e(n,e){n.uniform4uiv(this.addr,e)}function i1e(n,e,t){const i=this.cache,r=e.length,s=vS(t,r);ar(i,s)||(n.uniform1iv(this.addr,s),lr(i,s));for(let o=0;o!==r;++o)t.setTexture2D(e[o]||MK,s[o])}function r1e(n,e,t){const i=this.cache,r=e.length,s=vS(t,r);ar(i,s)||(n.uniform1iv(this.addr,s),lr(i,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||RK,s[o])}function s1e(n,e,t){const i=this.cache,r=e.length,s=vS(t,r);ar(i,s)||(n.uniform1iv(this.addr,s),lr(i,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||PK,s[o])}function o1e(n,e,t){const i=this.cache,r=e.length,s=vS(t,r);ar(i,s)||(n.uniform1iv(this.addr,s),lr(i,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||IK,s[o])}function a1e(n){switch(n){case 5126:return Hwe;case 35664:return Gwe;case 35665:return jwe;case 35666:return Wwe;case 35674:return Kwe;case 35675:return Xwe;case 35676:return qwe;case 5124:case 35670:return Ywe;case 35667:case 35671:return $we;case 35668:case 35672:return Jwe;case 35669:case 35673:return Qwe;case 5125:return Zwe;case 36294:return e1e;case 36295:return t1e;case 36296:return n1e;case 35678:case 36198:case 36298:case 36306:case 35682:return i1e;case 35679:case 36299:case 36307:return r1e;case 35680:case 36300:case 36308:case 36293:return s1e;case 36289:case 36303:case 36311:case 36292:return o1e}}class l1e{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=zwe(t.type)}}class c1e{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=a1e(t.type)}}class u1e{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let s=0,o=r.length;s!==o;++s){const a=r[s];a.setValue(e,t[a.id],i)}}}const _C=/(\w+)(\])?(\[|\.)?/g;function S4(n,e){n.seq.push(e),n.map[e.id]=e}function h1e(n,e,t){const i=n.name,r=i.length;for(_C.lastIndex=0;;){const s=_C.exec(i),o=_C.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){S4(t,c===void 0?new l1e(a,n,e):new c1e(a,n,e));break}else{let h=t.map[a];h===void 0&&(h=new u1e(a),S4(t,h)),t=h}}}class Kw{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){const s=e.getActiveUniform(t,r),o=e.getUniformLocation(t,s.name);h1e(s,o,this)}}setValue(e,t,i,r){const s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,o=t.length;s!==o;++s){const a=t[s],l=i[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,s=e.length;r!==s;++r){const o=e[r];o.id in t&&i.push(o)}return i}}function T4(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}const d1e=37297;let f1e=0;function p1e(n,e){const t=n.split(`
`),i=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=r;o<s;o++){const a=o+1;i.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return i.join(`
`)}const b4=new cn;function m1e(n){Mn._getMatrix(b4,Mn.workingColorSpace,n);const e=`mat3( ${b4.elements.map(t=>t.toFixed(4))} )`;switch(Mn.getTransfer(n)){case kv:return[e,"LinearTransferOETF"];case $n:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function C4(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+`

`+r+`

`+p1e(n.getShaderSource(e),o)}else return r}function g1e(n,e){const t=m1e(e);return[`vec4 ${n}( vec4 value ) {`,`	return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
`)}function y1e(n,e){let t;switch(e){case J7:t="Linear";break;case Q7:t="Reinhard";break;case Z7:t="Cineon";break;case lD:t="ACESFilmic";break;case tK:t="AgX";break;case nK:t="Neutral";break;case eK:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Lx=new q;function v1e(){Mn.getLuminanceCoefficients(Lx);const n=Lx.x.toFixed(4),e=Lx.y.toFixed(4),t=Lx.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${n}, ${e}, ${t} );`,"	return dot( weights, rgb );","}"].join(`
`)}function _1e(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(dy).join(`
`)}function x1e(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
`)}function w1e(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const s=n.getActiveAttrib(e,r),o=s.name;let a=1;s.type===n.FLOAT_MAT2&&(a=2),s.type===n.FLOAT_MAT3&&(a=3),s.type===n.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:n.getAttribLocation(e,o),locationSize:a}}return t}function dy(n){return n!==""}function M4(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function I4(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const E1e=/^[ \t]*#include +<([\w\d./]+)>/gm;function RR(n){return n.replace(E1e,S1e)}const A1e=new Map;function S1e(n,e){let t=pn[e];if(t===void 0){const i=A1e.get(e);if(i!==void 0)t=pn[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return RR(t)}const T1e=/#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 R4(n){return n.replace(T1e,b1e)}function b1e(n,e,t,i){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function P4(n){let e=`precision ${n.precision} float;
	precision ${n.precision} int;
	precision ${n.precision} sampler2D;
	precision ${n.precision} samplerCube;
	precision ${n.precision} sampler3D;
	precision ${n.precision} sampler2DArray;
	precision ${n.precision} sampler2DShadow;
	precision ${n.precision} samplerCubeShadow;
	precision ${n.precision} sampler2DArrayShadow;
	precision ${n.precision} isampler2D;
	precision ${n.precision} isampler3D;
	precision ${n.precision} isamplerCube;
	precision ${n.precision} isampler2DArray;
	precision ${n.precision} usampler2D;
	precision ${n.precision} usampler3D;
	precision ${n.precision} usamplerCube;
	precision ${n.precision} usampler2DArray;
	`;return n.precision==="highp"?e+=`
#define HIGH_PRECISION`:n.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}function C1e(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===lS?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===Uy?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===ra&&(e="SHADOWMAP_TYPE_VSM"),e}function M1e(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case al:case zu:e="ENVMAP_TYPE_CUBE";break;case Km:e="ENVMAP_TYPE_CUBE_UV";break}return e}function I1e(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case zu:e="ENVMAP_MODE_REFRACTION";break}return e}function R1e(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case Pv:e="ENVMAP_BLENDING_MULTIPLY";break;case Y7:e="ENVMAP_BLENDING_MIX";break;case $7:e="ENVMAP_BLENDING_ADD";break}return e}function P1e(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function N1e(n,e,t,i){const r=n.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=C1e(t),c=M1e(t),u=I1e(t),h=R1e(t),f=P1e(t),m=_1e(t),y=x1e(s),_=r.createProgram();let v,g,w=t.glslVersion?"#version "+t.glslVersion+`
`:"";t.isRawShaderMaterial?(v=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(dy).join(`
`),v.length>0&&(v+=`
`),g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(dy).join(`
`),g.length>0&&(g+=`
`)):(v=[P4(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
`].filter(dy).join(`
`),g=[P4(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==el?"#define TONE_MAPPING":"",t.toneMapping!==el?pn.tonemapping_pars_fragment:"",t.toneMapping!==el?y1e("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",pn.colorspace_pars_fragment,g1e("linearToOutputTexel",t.outputColorSpace),v1e(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(dy).join(`
`)),o=RR(o),o=M4(o,t),o=I4(o,t),a=RR(a),a=M4(a,t),a=I4(a,t),o=R4(o),a=R4(a),t.isRawShaderMaterial!==!0&&(w=`#version 300 es
`,v=[m,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+v,g=["#define varying in",t.glslVersion===MR?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===MR?"":"#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(`
`)+`
`+g);const A=w+v+o,T=w+g+a,L=T4(r,r.VERTEX_SHADER,A),D=T4(r,r.FRAGMENT_SHADER,T);r.attachShader(_,L),r.attachShader(_,D),t.index0AttributeName!==void 0?r.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_);function R(k){if(n.debug.checkShaderErrors){const B=r.getProgramInfoLog(_).trim(),O=r.getShaderInfoLog(L).trim(),X=r.getShaderInfoLog(D).trim();let le=!0,ie=!0;if(r.getProgramParameter(_,r.LINK_STATUS)===!1)if(le=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,_,L,D);else{const de=C4(r,L,"vertex"),G=C4(r,D,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,r.VALIDATE_STATUS)+`

Material Name: `+k.name+`
Material Type: `+k.type+`

Program Info Log: `+B+`
`+de+`
`+G)}else B!==""?console.warn("THREE.WebGLProgram: Program Info Log:",B):(O===""||X==="")&&(ie=!1);ie&&(k.diagnostics={runnable:le,programLog:B,vertexShader:{log:O,prefix:v},fragmentShader:{log:X,prefix:g}})}r.deleteShader(L),r.deleteShader(D),I=new Kw(r,_),M=w1e(r,_)}let I;this.getUniforms=function(){return I===void 0&&R(this),I};let M;this.getAttributes=function(){return M===void 0&&R(this),M};let C=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return C===!1&&(C=r.getProgramParameter(_,d1e)),C},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=f1e++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=L,this.fragmentShader=D,this}let D1e=0;class L1e{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new k1e(e),t.set(e,i)),i}}class k1e{constructor(e){this.id=D1e++,this.code=e,this.usedTimes=0}}function B1e(n,e,t,i,r,s,o){const a=new xd,l=new L1e,c=new Set,u=[],h=r.logarithmicDepthBuffer,f=r.vertexTextures;let m=r.precision;const y={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 _(M){return c.add(M),M===0?"uv":`uv${M}`}function v(M,C,k,B,O){const X=B.fog,le=O.geometry,ie=M.isMeshStandardMaterial?B.environment:null,de=(M.isMeshStandardMaterial?t:e).get(M.envMap||ie),G=de&&de.mapping===Km?de.image.height:null,$=y[M.type];M.precision!==null&&(m=r.getMaxPrecision(M.precision),m!==M.precision&&console.warn("THREE.WebGLProgram.getParameters:",M.precision,"not supported, using",m,"instead."));const te=le.morphAttributes.position||le.morphAttributes.normal||le.morphAttributes.color,ue=te!==void 0?te.length:0;let ve=0;le.morphAttributes.position!==void 0&&(ve=1),le.morphAttributes.normal!==void 0&&(ve=2),le.morphAttributes.color!==void 0&&(ve=3);let be,he,Pe,Oe;if($){const Vt=ca[$];be=Vt.vertexShader,he=Vt.fragmentShader}else be=M.vertexShader,he=M.fragmentShader,l.update(M),Pe=l.getVertexShaderID(M),Oe=l.getFragmentShaderID(M);const Ce=n.getRenderTarget(),mt=n.state.buffers.depth.getReversed(),Lt=O.isInstancedMesh===!0,St=O.isBatchedMesh===!0,Nt=!!M.map,ke=!!M.matcap,Ue=!!de,ee=!!M.aoMap,xt=!!M.lightMap,je=!!M.bumpMap,ht=!!M.normalMap,$e=!!M.displacementMap,Mt=!!M.emissiveMap,lt=!!M.metalnessMap,Y=!!M.roughnessMap,j=M.anisotropy>0,pe=M.clearcoat>0,Ie=M.dispersion>0,ze=M.iridescence>0,Ee=M.sheen>0,tt=M.transmission>0,nt=j&&!!M.anisotropyMap,ct=pe&&!!M.clearcoatMap,Yt=pe&&!!M.clearcoatNormalMap,Xe=pe&&!!M.clearcoatRoughnessMap,dt=ze&&!!M.iridescenceMap,It=ze&&!!M.iridescenceThicknessMap,gt=Ee&&!!M.sheenColorMap,ut=Ee&&!!M.sheenRoughnessMap,oe=!!M.specularMap,Te=!!M.specularColorMap,Ye=!!M.specularIntensityMap,se=tt&&!!M.transmissionMap,ye=tt&&!!M.thicknessMap,we=!!M.gradientMap,De=!!M.alphaMap,ot=M.alphaTest>0,it=!!M.alphaHash,Ke=!!M.extensions;let Et=el;M.toneMapped&&(Ce===null||Ce.isXRRenderTarget===!0)&&(Et=n.toneMapping);const Gt={shaderID:$,shaderType:M.type,shaderName:M.name,vertexShader:be,fragmentShader:he,defines:M.defines,customVertexShaderID:Pe,customFragmentShaderID:Oe,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:m,batching:St,batchingColor:St&&O._colorsTexture!==null,instancing:Lt,instancingColor:Lt&&O.instanceColor!==null,instancingMorph:Lt&&O.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:Ce===null?n.outputColorSpace:Ce.isXRRenderTarget===!0?Ce.texture.colorSpace:cl,alphaToCoverage:!!M.alphaToCoverage,map:Nt,matcap:ke,envMap:Ue,envMapMode:Ue&&de.mapping,envMapCubeUVHeight:G,aoMap:ee,lightMap:xt,bumpMap:je,normalMap:ht,displacementMap:f&&$e,emissiveMap:Mt,normalMapObjectSpace:ht&&M.normalMapType===uK,normalMapTangentSpace:ht&&M.normalMapType===Qu,metalnessMap:lt,roughnessMap:Y,anisotropy:j,anisotropyMap:nt,clearcoat:pe,clearcoatMap:ct,clearcoatNormalMap:Yt,clearcoatRoughnessMap:Xe,dispersion:Ie,iridescence:ze,iridescenceMap:dt,iridescenceThicknessMap:It,sheen:Ee,sheenColorMap:gt,sheenRoughnessMap:ut,specularMap:oe,specularColorMap:Te,specularIntensityMap:Ye,transmission:tt,transmissionMap:se,thicknessMap:ye,gradientMap:we,opaque:M.transparent===!1&&M.blending===yd&&M.alphaToCoverage===!1,alphaMap:De,alphaTest:ot,alphaHash:it,combine:M.combine,mapUv:Nt&&_(M.map.channel),aoMapUv:ee&&_(M.aoMap.channel),lightMapUv:xt&&_(M.lightMap.channel),bumpMapUv:je&&_(M.bumpMap.channel),normalMapUv:ht&&_(M.normalMap.channel),displacementMapUv:$e&&_(M.displacementMap.channel),emissiveMapUv:Mt&&_(M.emissiveMap.channel),metalnessMapUv:lt&&_(M.metalnessMap.channel),roughnessMapUv:Y&&_(M.roughnessMap.channel),anisotropyMapUv:nt&&_(M.anisotropyMap.channel),clearcoatMapUv:ct&&_(M.clearcoatMap.channel),clearcoatNormalMapUv:Yt&&_(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Xe&&_(M.clearcoatRoughnessMap.channel),iridescenceMapUv:dt&&_(M.iridescenceMap.channel),iridescenceThicknessMapUv:It&&_(M.iridescenceThicknessMap.channel),sheenColorMapUv:gt&&_(M.sheenColorMap.channel),sheenRoughnessMapUv:ut&&_(M.sheenRoughnessMap.channel),specularMapUv:oe&&_(M.specularMap.channel),specularColorMapUv:Te&&_(M.specularColorMap.channel),specularIntensityMapUv:Ye&&_(M.specularIntensityMap.channel),transmissionMapUv:se&&_(M.transmissionMap.channel),thicknessMapUv:ye&&_(M.thicknessMap.channel),alphaMapUv:De&&_(M.alphaMap.channel),vertexTangents:!!le.attributes.tangent&&(ht||j),vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!le.attributes.color&&le.attributes.color.itemSize===4,pointsUvs:O.isPoints===!0&&!!le.attributes.uv&&(Nt||De),fog:!!X,useFog:M.fog===!0,fogExp2:!!X&&X.isFogExp2,flatShading:M.flatShading===!0,sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:h,reverseDepthBuffer:mt,skinning:O.isSkinnedMesh===!0,morphTargets:le.morphAttributes.position!==void 0,morphNormals:le.morphAttributes.normal!==void 0,morphColors:le.morphAttributes.color!==void 0,morphTargetsCount:ue,morphTextureStride:ve,numDirLights:C.directional.length,numPointLights:C.point.length,numSpotLights:C.spot.length,numSpotLightMaps:C.spotLightMap.length,numRectAreaLights:C.rectArea.length,numHemiLights:C.hemi.length,numDirLightShadows:C.directionalShadowMap.length,numPointLightShadows:C.pointShadowMap.length,numSpotLightShadows:C.spotShadowMap.length,numSpotLightShadowsWithMaps:C.numSpotLightShadowsWithMaps,numLightProbes:C.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:M.dithering,shadowMapEnabled:n.shadowMap.enabled&&k.length>0,shadowMapType:n.shadowMap.type,toneMapping:Et,decodeVideoTexture:Nt&&M.map.isVideoTexture===!0&&Mn.getTransfer(M.map.colorSpace)===$n,decodeVideoTextureEmissive:Mt&&M.emissiveMap.isVideoTexture===!0&&Mn.getTransfer(M.emissiveMap.colorSpace)===$n,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===No,flipSided:M.side===As,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionClipCullDistance:Ke&&M.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ke&&M.extensions.multiDraw===!0||St)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()};return Gt.vertexUv1s=c.has(1),Gt.vertexUv2s=c.has(2),Gt.vertexUv3s=c.has(3),c.clear(),Gt}function g(M){const C=[];if(M.shaderID?C.push(M.shaderID):(C.push(M.customVertexShaderID),C.push(M.customFragmentShaderID)),M.defines!==void 0)for(const k in M.defines)C.push(k),C.push(M.defines[k]);return M.isRawShaderMaterial===!1&&(w(C,M),A(C,M),C.push(n.outputColorSpace)),C.push(M.customProgramCacheKey),C.join()}function w(M,C){M.push(C.precision),M.push(C.outputColorSpace),M.push(C.envMapMode),M.push(C.envMapCubeUVHeight),M.push(C.mapUv),M.push(C.alphaMapUv),M.push(C.lightMapUv),M.push(C.aoMapUv),M.push(C.bumpMapUv),M.push(C.normalMapUv),M.push(C.displacementMapUv),M.push(C.emissiveMapUv),M.push(C.metalnessMapUv),M.push(C.roughnessMapUv),M.push(C.anisotropyMapUv),M.push(C.clearcoatMapUv),M.push(C.clearcoatNormalMapUv),M.push(C.clearcoatRoughnessMapUv),M.push(C.iridescenceMapUv),M.push(C.iridescenceThicknessMapUv),M.push(C.sheenColorMapUv),M.push(C.sheenRoughnessMapUv),M.push(C.specularMapUv),M.push(C.specularColorMapUv),M.push(C.specularIntensityMapUv),M.push(C.transmissionMapUv),M.push(C.thicknessMapUv),M.push(C.combine),M.push(C.fogExp2),M.push(C.sizeAttenuation),M.push(C.morphTargetsCount),M.push(C.morphAttributeCount),M.push(C.numDirLights),M.push(C.numPointLights),M.push(C.numSpotLights),M.push(C.numSpotLightMaps),M.push(C.numHemiLights),M.push(C.numRectAreaLights),M.push(C.numDirLightShadows),M.push(C.numPointLightShadows),M.push(C.numSpotLightShadows),M.push(C.numSpotLightShadowsWithMaps),M.push(C.numLightProbes),M.push(C.shadowMapType),M.push(C.toneMapping),M.push(C.numClippingPlanes),M.push(C.numClipIntersection),M.push(C.depthPacking)}function A(M,C){a.disableAll(),C.supportsVertexTextures&&a.enable(0),C.instancing&&a.enable(1),C.instancingColor&&a.enable(2),C.instancingMorph&&a.enable(3),C.matcap&&a.enable(4),C.envMap&&a.enable(5),C.normalMapObjectSpace&&a.enable(6),C.normalMapTangentSpace&&a.enable(7),C.clearcoat&&a.enable(8),C.iridescence&&a.enable(9),C.alphaTest&&a.enable(10),C.vertexColors&&a.enable(11),C.vertexAlphas&&a.enable(12),C.vertexUv1s&&a.enable(13),C.vertexUv2s&&a.enable(14),C.vertexUv3s&&a.enable(15),C.vertexTangents&&a.enable(16),C.anisotropy&&a.enable(17),C.alphaHash&&a.enable(18),C.batching&&a.enable(19),C.dispersion&&a.enable(20),C.batchingColor&&a.enable(21),M.push(a.mask),a.disableAll(),C.fog&&a.enable(0),C.useFog&&a.enable(1),C.flatShading&&a.enable(2),C.logarithmicDepthBuffer&&a.enable(3),C.reverseDepthBuffer&&a.enable(4),C.skinning&&a.enable(5),C.morphTargets&&a.enable(6),C.morphNormals&&a.enable(7),C.morphColors&&a.enable(8),C.premultipliedAlpha&&a.enable(9),C.shadowMapEnabled&&a.enable(10),C.doubleSided&&a.enable(11),C.flipSided&&a.enable(12),C.useDepthPacking&&a.enable(13),C.dithering&&a.enable(14),C.transmission&&a.enable(15),C.sheen&&a.enable(16),C.opaque&&a.enable(17),C.pointsUvs&&a.enable(18),C.decodeVideoTexture&&a.enable(19),C.decodeVideoTextureEmissive&&a.enable(20),C.alphaToCoverage&&a.enable(21),M.push(a.mask)}function T(M){const C=y[M.type];let k;if(C){const B=ca[C];k=TK.clone(B.uniforms)}else k=M.uniforms;return k}function L(M,C){let k;for(let B=0,O=u.length;B<O;B++){const X=u[B];if(X.cacheKey===C){k=X,++k.usedTimes;break}}return k===void 0&&(k=new N1e(n,C,M,s),u.push(k)),k}function D(M){if(--M.usedTimes===0){const C=u.indexOf(M);u[C]=u[u.length-1],u.pop(),M.destroy()}}function R(M){l.remove(M)}function I(){l.dispose()}return{getParameters:v,getProgramCacheKey:g,getUniforms:T,acquireProgram:L,releaseProgram:D,releaseShaderCache:R,programs:u,dispose:I}}function O1e(){let n=new WeakMap;function e(o){return n.has(o)}function t(o){let a=n.get(o);return a===void 0&&(a={},n.set(o,a)),a}function i(o){n.delete(o)}function r(o,a,l){n.get(o)[a]=l}function s(){n=new WeakMap}return{has:e,get:t,remove:i,update:r,dispose:s}}function F1e(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function N4(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function D4(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function o(h,f,m,y,_,v){let g=n[e];return g===void 0?(g={id:h.id,object:h,geometry:f,material:m,groupOrder:y,renderOrder:h.renderOrder,z:_,group:v},n[e]=g):(g.id=h.id,g.object=h,g.geometry=f,g.material=m,g.groupOrder=y,g.renderOrder=h.renderOrder,g.z=_,g.group=v),e++,g}function a(h,f,m,y,_,v){const g=o(h,f,m,y,_,v);m.transmission>0?i.push(g):m.transparent===!0?r.push(g):t.push(g)}function l(h,f,m,y,_,v){const g=o(h,f,m,y,_,v);m.transmission>0?i.unshift(g):m.transparent===!0?r.unshift(g):t.unshift(g)}function c(h,f){t.length>1&&t.sort(h||F1e),i.length>1&&i.sort(f||N4),r.length>1&&r.sort(f||N4)}function u(){for(let h=e,f=n.length;h<f;h++){const m=n[h];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:a,unshift:l,finish:u,sort:c}}function U1e(){let n=new WeakMap;function e(i,r){const s=n.get(i);let o;return s===void 0?(o=new D4,n.set(i,[o])):r>=s.length?(o=new D4,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function V1e(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new q,color:new ft};break;case"SpotLight":t={position:new q,direction:new q,color:new ft,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new q,color:new ft,distance:0,decay:0};break;case"HemisphereLight":t={direction:new q,skyColor:new ft,groundColor:new ft};break;case"RectAreaLight":t={color:new ft,position:new q,halfWidth:new q,halfHeight:new q};break}return n[e.id]=t,t}}}function z1e(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fe,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let H1e=0;function G1e(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function j1e(n){const e=new V1e,t=z1e(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)i.probe.push(new q);const r=new q,s=new qt,o=new qt;function a(c){let u=0,h=0,f=0;for(let M=0;M<9;M++)i.probe[M].set(0,0,0);let m=0,y=0,_=0,v=0,g=0,w=0,A=0,T=0,L=0,D=0,R=0;c.sort(G1e);for(let M=0,C=c.length;M<C;M++){const k=c[M],B=k.color,O=k.intensity,X=k.distance,le=k.shadow&&k.shadow.map?k.shadow.map.texture:null;if(k.isAmbientLight)u+=B.r*O,h+=B.g*O,f+=B.b*O;else if(k.isLightProbe){for(let ie=0;ie<9;ie++)i.probe[ie].addScaledVector(k.sh.coefficients[ie],O);R++}else if(k.isDirectionalLight){const ie=e.get(k);if(ie.color.copy(k.color).multiplyScalar(k.intensity),k.castShadow){const de=k.shadow,G=t.get(k);G.shadowIntensity=de.intensity,G.shadowBias=de.bias,G.shadowNormalBias=de.normalBias,G.shadowRadius=de.radius,G.shadowMapSize=de.mapSize,i.directionalShadow[m]=G,i.directionalShadowMap[m]=le,i.directionalShadowMatrix[m]=k.shadow.matrix,w++}i.directional[m]=ie,m++}else if(k.isSpotLight){const ie=e.get(k);ie.position.setFromMatrixPosition(k.matrixWorld),ie.color.copy(B).multiplyScalar(O),ie.distance=X,ie.coneCos=Math.cos(k.angle),ie.penumbraCos=Math.cos(k.angle*(1-k.penumbra)),ie.decay=k.decay,i.spot[_]=ie;const de=k.shadow;if(k.map&&(i.spotLightMap[L]=k.map,L++,de.updateMatrices(k),k.castShadow&&D++),i.spotLightMatrix[_]=de.matrix,k.castShadow){const G=t.get(k);G.shadowIntensity=de.intensity,G.shadowBias=de.bias,G.shadowNormalBias=de.normalBias,G.shadowRadius=de.radius,G.shadowMapSize=de.mapSize,i.spotShadow[_]=G,i.spotShadowMap[_]=le,T++}_++}else if(k.isRectAreaLight){const ie=e.get(k);ie.color.copy(B).multiplyScalar(O),ie.halfWidth.set(k.width*.5,0,0),ie.halfHeight.set(0,k.height*.5,0),i.rectArea[v]=ie,v++}else if(k.isPointLight){const ie=e.get(k);if(ie.color.copy(k.color).multiplyScalar(k.intensity),ie.distance=k.distance,ie.decay=k.decay,k.castShadow){const de=k.shadow,G=t.get(k);G.shadowIntensity=de.intensity,G.shadowBias=de.bias,G.shadowNormalBias=de.normalBias,G.shadowRadius=de.radius,G.shadowMapSize=de.mapSize,G.shadowCameraNear=de.camera.near,G.shadowCameraFar=de.camera.far,i.pointShadow[y]=G,i.pointShadowMap[y]=le,i.pointShadowMatrix[y]=k.shadow.matrix,A++}i.point[y]=ie,y++}else if(k.isHemisphereLight){const ie=e.get(k);ie.skyColor.copy(k.color).multiplyScalar(O),ie.groundColor.copy(k.groundColor).multiplyScalar(O),i.hemi[g]=ie,g++}}v>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=pt.LTC_FLOAT_1,i.rectAreaLTC2=pt.LTC_FLOAT_2):(i.rectAreaLTC1=pt.LTC_HALF_1,i.rectAreaLTC2=pt.LTC_HALF_2)),i.ambient[0]=u,i.ambient[1]=h,i.ambient[2]=f;const I=i.hash;(I.directionalLength!==m||I.pointLength!==y||I.spotLength!==_||I.rectAreaLength!==v||I.hemiLength!==g||I.numDirectionalShadows!==w||I.numPointShadows!==A||I.numSpotShadows!==T||I.numSpotMaps!==L||I.numLightProbes!==R)&&(i.directional.length=m,i.spot.length=_,i.rectArea.length=v,i.point.length=y,i.hemi.length=g,i.directionalShadow.length=w,i.directionalShadowMap.length=w,i.pointShadow.length=A,i.pointShadowMap.length=A,i.spotShadow.length=T,i.spotShadowMap.length=T,i.directionalShadowMatrix.length=w,i.pointShadowMatrix.length=A,i.spotLightMatrix.length=T+L-D,i.spotLightMap.length=L,i.numSpotLightShadowsWithMaps=D,i.numLightProbes=R,I.directionalLength=m,I.pointLength=y,I.spotLength=_,I.rectAreaLength=v,I.hemiLength=g,I.numDirectionalShadows=w,I.numPointShadows=A,I.numSpotShadows=T,I.numSpotMaps=L,I.numLightProbes=R,i.version=H1e++)}function l(c,u){let h=0,f=0,m=0,y=0,_=0;const v=u.matrixWorldInverse;for(let g=0,w=c.length;g<w;g++){const A=c[g];if(A.isDirectionalLight){const T=i.directional[h];T.direction.setFromMatrixPosition(A.matrixWorld),r.setFromMatrixPosition(A.target.matrixWorld),T.direction.sub(r),T.direction.transformDirection(v),h++}else if(A.isSpotLight){const T=i.spot[m];T.position.setFromMatrixPosition(A.matrixWorld),T.position.applyMatrix4(v),T.direction.setFromMatrixPosition(A.matrixWorld),r.setFromMatrixPosition(A.target.matrixWorld),T.direction.sub(r),T.direction.transformDirection(v),m++}else if(A.isRectAreaLight){const T=i.rectArea[y];T.position.setFromMatrixPosition(A.matrixWorld),T.position.applyMatrix4(v),o.identity(),s.copy(A.matrixWorld),s.premultiply(v),o.extractRotation(s),T.halfWidth.set(A.width*.5,0,0),T.halfHeight.set(0,A.height*.5,0),T.halfWidth.applyMatrix4(o),T.halfHeight.applyMatrix4(o),y++}else if(A.isPointLight){const T=i.point[f];T.position.setFromMatrixPosition(A.matrixWorld),T.position.applyMatrix4(v),f++}else if(A.isHemisphereLight){const T=i.hemi[_];T.direction.setFromMatrixPosition(A.matrixWorld),T.direction.transformDirection(v),_++}}}return{setup:a,setupView:l,state:i}}function L4(n){const e=new j1e(n),t=[],i=[];function r(u){c.camera=u,t.length=0,i.length=0}function s(u){t.push(u)}function o(u){i.push(u)}function a(){e.setup(t)}function l(u){e.setupView(t,u)}const c={lightsArray:t,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:a,setupLightsView:l,pushLight:s,pushShadow:o}}function W1e(n){let e=new WeakMap;function t(r,s=0){const o=e.get(r);let a;return o===void 0?(a=new L4(n),e.set(r,[a])):s>=o.length?(a=new L4(n),o.push(a)):a=o[s],a}function i(){e=new WeakMap}return{get:t,dispose:i}}class _S extends or{static get type(){return"MeshDepthMaterial"}constructor(e){super(),this.isMeshDepthMaterial=!0,this.depthPacking=lK,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class bD extends or{static get type(){return"MeshDistanceMaterial"}constructor(e){super(),this.isMeshDistanceMaterial=!0,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const K1e=`void main() {
	gl_Position = vec4( position, 1.0 );
}`,X1e=`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 q1e(n,e,t){let i=new Fv;const r=new Fe,s=new Fe,o=new Bn,a=new _S({depthPacking:cK}),l=new bD,c={},u=t.maxTextureSize,h={[ol]:As,[As]:ol,[No]:No},f=new ss({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Fe},radius:{value:4}},vertexShader:K1e,fragmentShader:X1e}),m=f.clone();m.defines.HORIZONTAL_PASS=1;const y=new un;y.setAttribute("position",new Fn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new fi(y,f),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=lS;let g=this.type;this.render=function(D,R,I){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||D.length===0)return;const M=n.getRenderTarget(),C=n.getActiveCubeFace(),k=n.getActiveMipmapLevel(),B=n.state;B.setBlending(Za),B.buffers.color.setClear(1,1,1,1),B.buffers.depth.setTest(!0),B.setScissorTest(!1);const O=g!==ra&&this.type===ra,X=g===ra&&this.type!==ra;for(let le=0,ie=D.length;le<ie;le++){const de=D[le],G=de.shadow;if(G===void 0){console.warn("THREE.WebGLShadowMap:",de,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;r.copy(G.mapSize);const $=G.getFrameExtents();if(r.multiply($),s.copy(G.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/$.x),r.x=s.x*$.x,G.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/$.y),r.y=s.y*$.y,G.mapSize.y=s.y)),G.map===null||O===!0||X===!0){const ue=this.type!==ra?{minFilter:_r,magFilter:_r}:{};G.map!==null&&G.map.dispose(),G.map=new Ss(r.x,r.y,ue),G.map.texture.name=de.name+".shadowMap",G.camera.updateProjectionMatrix()}n.setRenderTarget(G.map),n.clear();const te=G.getViewportCount();for(let ue=0;ue<te;ue++){const ve=G.getViewport(ue);o.set(s.x*ve.x,s.y*ve.y,s.x*ve.z,s.y*ve.w),B.viewport(o),G.updateMatrices(de,ue),i=G.getFrustum(),T(R,I,G.camera,de,this.type)}G.isPointLightShadow!==!0&&this.type===ra&&w(G,I),G.needsUpdate=!1}g=this.type,v.needsUpdate=!1,n.setRenderTarget(M,C,k)};function w(D,R){const I=e.update(_);f.defines.VSM_SAMPLES!==D.blurSamples&&(f.defines.VSM_SAMPLES=D.blurSamples,m.defines.VSM_SAMPLES=D.blurSamples,f.needsUpdate=!0,m.needsUpdate=!0),D.mapPass===null&&(D.mapPass=new Ss(r.x,r.y)),f.uniforms.shadow_pass.value=D.map.texture,f.uniforms.resolution.value=D.mapSize,f.uniforms.radius.value=D.radius,n.setRenderTarget(D.mapPass),n.clear(),n.renderBufferDirect(R,null,I,f,_,null),m.uniforms.shadow_pass.value=D.mapPass.texture,m.uniforms.resolution.value=D.mapSize,m.uniforms.radius.value=D.radius,n.setRenderTarget(D.map),n.clear(),n.renderBufferDirect(R,null,I,m,_,null)}function A(D,R,I,M){let C=null;const k=I.isPointLight===!0?D.customDistanceMaterial:D.customDepthMaterial;if(k!==void 0)C=k;else if(C=I.isPointLight===!0?l:a,n.localClippingEnabled&&R.clipShadows===!0&&Array.isArray(R.clippingPlanes)&&R.clippingPlanes.length!==0||R.displacementMap&&R.displacementScale!==0||R.alphaMap&&R.alphaTest>0||R.map&&R.alphaTest>0){const B=C.uuid,O=R.uuid;let X=c[B];X===void 0&&(X={},c[B]=X);let le=X[O];le===void 0&&(le=C.clone(),X[O]=le,R.addEventListener("dispose",L)),C=le}if(C.visible=R.visible,C.wireframe=R.wireframe,M===ra?C.side=R.shadowSide!==null?R.shadowSide:R.side:C.side=R.shadowSide!==null?R.shadowSide:h[R.side],C.alphaMap=R.alphaMap,C.alphaTest=R.alphaTest,C.map=R.map,C.clipShadows=R.clipShadows,C.clippingPlanes=R.clippingPlanes,C.clipIntersection=R.clipIntersection,C.displacementMap=R.displacementMap,C.displacementScale=R.displacementScale,C.displacementBias=R.displacementBias,C.wireframeLinewidth=R.wireframeLinewidth,C.linewidth=R.linewidth,I.isPointLight===!0&&C.isMeshDistanceMaterial===!0){const B=n.properties.get(C);B.light=I}return C}function T(D,R,I,M,C){if(D.visible===!1)return;if(D.layers.test(R.layers)&&(D.isMesh||D.isLine||D.isPoints)&&(D.castShadow||D.receiveShadow&&C===ra)&&(!D.frustumCulled||i.intersectsObject(D))){D.modelViewMatrix.multiplyMatrices(I.matrixWorldInverse,D.matrixWorld);const O=e.update(D),X=D.material;if(Array.isArray(X)){const le=O.groups;for(let ie=0,de=le.length;ie<de;ie++){const G=le[ie],$=X[G.materialIndex];if($&&$.visible){const te=A(D,$,M,C);D.onBeforeShadow(n,D,R,I,O,te,G),n.renderBufferDirect(I,null,O,te,D,G),D.onAfterShadow(n,D,R,I,O,te,G)}}}else if(X.visible){const le=A(D,X,M,C);D.onBeforeShadow(n,D,R,I,O,le,null),n.renderBufferDirect(I,null,O,le,D,null),D.onAfterShadow(n,D,R,I,O,le,null)}}const B=D.children;for(let O=0,X=B.length;O<X;O++)T(B[O],R,I,M,C)}function L(D){D.target.removeEventListener("dispose",L);for(const I in c){const M=c[I],C=D.target.uuid;C in M&&(M[C].dispose(),delete M[C])}}}const Y1e={[cE]:uE,[hE]:pE,[dE]:mE,[Od]:fE,[uE]:cE,[pE]:hE,[mE]:dE,[fE]:Od};function $1e(n,e){function t(){let se=!1;const ye=new Bn;let we=null;const De=new Bn(0,0,0,0);return{setMask:function(ot){we!==ot&&!se&&(n.colorMask(ot,ot,ot,ot),we=ot)},setLocked:function(ot){se=ot},setClear:function(ot,it,Ke,Et,Gt){Gt===!0&&(ot*=Et,it*=Et,Ke*=Et),ye.set(ot,it,Ke,Et),De.equals(ye)===!1&&(n.clearColor(ot,it,Ke,Et),De.copy(ye))},reset:function(){se=!1,we=null,De.set(-1,0,0,0)}}}function i(){let se=!1,ye=!1,we=null,De=null,ot=null;return{setReversed:function(it){if(ye!==it){const Ke=e.get("EXT_clip_control");ye?Ke.clipControlEXT(Ke.LOWER_LEFT_EXT,Ke.ZERO_TO_ONE_EXT):Ke.clipControlEXT(Ke.LOWER_LEFT_EXT,Ke.NEGATIVE_ONE_TO_ONE_EXT);const Et=ot;ot=null,this.setClear(Et)}ye=it},getReversed:function(){return ye},setTest:function(it){it?Ce(n.DEPTH_TEST):mt(n.DEPTH_TEST)},setMask:function(it){we!==it&&!se&&(n.depthMask(it),we=it)},setFunc:function(it){if(ye&&(it=Y1e[it]),De!==it){switch(it){case cE:n.depthFunc(n.NEVER);break;case uE:n.depthFunc(n.ALWAYS);break;case hE:n.depthFunc(n.LESS);break;case Od:n.depthFunc(n.LEQUAL);break;case dE:n.depthFunc(n.EQUAL);break;case fE:n.depthFunc(n.GEQUAL);break;case pE:n.depthFunc(n.GREATER);break;case mE:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}De=it}},setLocked:function(it){se=it},setClear:function(it){ot!==it&&(ye&&(it=1-it),n.clearDepth(it),ot=it)},reset:function(){se=!1,we=null,De=null,ot=null,ye=!1}}}function r(){let se=!1,ye=null,we=null,De=null,ot=null,it=null,Ke=null,Et=null,Gt=null;return{setTest:function(Vt){se||(Vt?Ce(n.STENCIL_TEST):mt(n.STENCIL_TEST))},setMask:function(Vt){ye!==Vt&&!se&&(n.stencilMask(Vt),ye=Vt)},setFunc:function(Vt,_n,sn){(we!==Vt||De!==_n||ot!==sn)&&(n.stencilFunc(Vt,_n,sn),we=Vt,De=_n,ot=sn)},setOp:function(Vt,_n,sn){(it!==Vt||Ke!==_n||Et!==sn)&&(n.stencilOp(Vt,_n,sn),it=Vt,Ke=_n,Et=sn)},setLocked:function(Vt){se=Vt},setClear:function(Vt){Gt!==Vt&&(n.clearStencil(Vt),Gt=Vt)},reset:function(){se=!1,ye=null,we=null,De=null,ot=null,it=null,Ke=null,Et=null,Gt=null}}}const s=new t,o=new i,a=new r,l=new WeakMap,c=new WeakMap;let u={},h={},f=new WeakMap,m=[],y=null,_=!1,v=null,g=null,w=null,A=null,T=null,L=null,D=null,R=new ft(0,0,0),I=0,M=!1,C=null,k=null,B=null,O=null,X=null;const le=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let ie=!1,de=0;const G=n.getParameter(n.VERSION);G.indexOf("WebGL")!==-1?(de=parseFloat(/^WebGL (\d)/.exec(G)[1]),ie=de>=1):G.indexOf("OpenGL ES")!==-1&&(de=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),ie=de>=2);let $=null,te={};const ue=n.getParameter(n.SCISSOR_BOX),ve=n.getParameter(n.VIEWPORT),be=new Bn().fromArray(ue),he=new Bn().fromArray(ve);function Pe(se,ye,we,De){const ot=new Uint8Array(4),it=n.createTexture();n.bindTexture(se,it),n.texParameteri(se,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(se,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Ke=0;Ke<we;Ke++)se===n.TEXTURE_3D||se===n.TEXTURE_2D_ARRAY?n.texImage3D(ye,0,n.RGBA,1,1,De,0,n.RGBA,n.UNSIGNED_BYTE,ot):n.texImage2D(ye+Ke,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,ot);return it}const Oe={};Oe[n.TEXTURE_2D]=Pe(n.TEXTURE_2D,n.TEXTURE_2D,1),Oe[n.TEXTURE_CUBE_MAP]=Pe(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),Oe[n.TEXTURE_2D_ARRAY]=Pe(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),Oe[n.TEXTURE_3D]=Pe(n.TEXTURE_3D,n.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),Ce(n.DEPTH_TEST),o.setFunc(Od),je(!1),ht(wR),Ce(n.CULL_FACE),ee(Za);function Ce(se){u[se]!==!0&&(n.enable(se),u[se]=!0)}function mt(se){u[se]!==!1&&(n.disable(se),u[se]=!1)}function Lt(se,ye){return h[se]!==ye?(n.bindFramebuffer(se,ye),h[se]=ye,se===n.DRAW_FRAMEBUFFER&&(h[n.FRAMEBUFFER]=ye),se===n.FRAMEBUFFER&&(h[n.DRAW_FRAMEBUFFER]=ye),!0):!1}function St(se,ye){let we=m,De=!1;if(se){we=f.get(ye),we===void 0&&(we=[],f.set(ye,we));const ot=se.textures;if(we.length!==ot.length||we[0]!==n.COLOR_ATTACHMENT0){for(let it=0,Ke=ot.length;it<Ke;it++)we[it]=n.COLOR_ATTACHMENT0+it;we.length=ot.length,De=!0}}else we[0]!==n.BACK&&(we[0]=n.BACK,De=!0);De&&n.drawBuffers(we)}function Nt(se){return y!==se?(n.useProgram(se),y=se,!0):!1}const ke={[Jc]:n.FUNC_ADD,[N7]:n.FUNC_SUBTRACT,[D7]:n.FUNC_REVERSE_SUBTRACT};ke[L7]=n.MIN,ke[k7]=n.MAX;const Ue={[B7]:n.ZERO,[O7]:n.ONE,[F7]:n.SRC_COLOR,[aE]:n.SRC_ALPHA,[j7]:n.SRC_ALPHA_SATURATE,[H7]:n.DST_COLOR,[V7]:n.DST_ALPHA,[U7]:n.ONE_MINUS_SRC_COLOR,[lE]:n.ONE_MINUS_SRC_ALPHA,[G7]:n.ONE_MINUS_DST_COLOR,[z7]:n.ONE_MINUS_DST_ALPHA,[W7]:n.CONSTANT_COLOR,[K7]:n.ONE_MINUS_CONSTANT_COLOR,[X7]:n.CONSTANT_ALPHA,[q7]:n.ONE_MINUS_CONSTANT_ALPHA};function ee(se,ye,we,De,ot,it,Ke,Et,Gt,Vt){if(se===Za){_===!0&&(mt(n.BLEND),_=!1);return}if(_===!1&&(Ce(n.BLEND),_=!0),se!==P7){if(se!==v||Vt!==M){if((g!==Jc||T!==Jc)&&(n.blendEquation(n.FUNC_ADD),g=Jc,T=Jc),Vt)switch(se){case yd:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case ER:n.blendFunc(n.ONE,n.ONE);break;case AR:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case SR:n.blendFuncSeparate(n.ZERO,n.SRC_COLOR,n.ZERO,n.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",se);break}else switch(se){case yd:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case ER:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case AR:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case SR:n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",se);break}w=null,A=null,L=null,D=null,R.set(0,0,0),I=0,v=se,M=Vt}return}ot=ot||ye,it=it||we,Ke=Ke||De,(ye!==g||ot!==T)&&(n.blendEquationSeparate(ke[ye],ke[ot]),g=ye,T=ot),(we!==w||De!==A||it!==L||Ke!==D)&&(n.blendFuncSeparate(Ue[we],Ue[De],Ue[it],Ue[Ke]),w=we,A=De,L=it,D=Ke),(Et.equals(R)===!1||Gt!==I)&&(n.blendColor(Et.r,Et.g,Et.b,Gt),R.copy(Et),I=Gt),v=se,M=!1}function xt(se,ye){se.side===No?mt(n.CULL_FACE):Ce(n.CULL_FACE);let we=se.side===As;ye&&(we=!we),je(we),se.blending===yd&&se.transparent===!1?ee(Za):ee(se.blending,se.blendEquation,se.blendSrc,se.blendDst,se.blendEquationAlpha,se.blendSrcAlpha,se.blendDstAlpha,se.blendColor,se.blendAlpha,se.premultipliedAlpha),o.setFunc(se.depthFunc),o.setTest(se.depthTest),o.setMask(se.depthWrite),s.setMask(se.colorWrite);const De=se.stencilWrite;a.setTest(De),De&&(a.setMask(se.stencilWriteMask),a.setFunc(se.stencilFunc,se.stencilRef,se.stencilFuncMask),a.setOp(se.stencilFail,se.stencilZFail,se.stencilZPass)),Mt(se.polygonOffset,se.polygonOffsetFactor,se.polygonOffsetUnits),se.alphaToCoverage===!0?Ce(n.SAMPLE_ALPHA_TO_COVERAGE):mt(n.SAMPLE_ALPHA_TO_COVERAGE)}function je(se){C!==se&&(se?n.frontFace(n.CW):n.frontFace(n.CCW),C=se)}function ht(se){se!==M7?(Ce(n.CULL_FACE),se!==k&&(se===wR?n.cullFace(n.BACK):se===I7?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):mt(n.CULL_FACE),k=se}function $e(se){se!==B&&(ie&&n.lineWidth(se),B=se)}function Mt(se,ye,we){se?(Ce(n.POLYGON_OFFSET_FILL),(O!==ye||X!==we)&&(n.polygonOffset(ye,we),O=ye,X=we)):mt(n.POLYGON_OFFSET_FILL)}function lt(se){se?Ce(n.SCISSOR_TEST):mt(n.SCISSOR_TEST)}function Y(se){se===void 0&&(se=n.TEXTURE0+le-1),$!==se&&(n.activeTexture(se),$=se)}function j(se,ye,we){we===void 0&&($===null?we=n.TEXTURE0+le-1:we=$);let De=te[we];De===void 0&&(De={type:void 0,texture:void 0},te[we]=De),(De.type!==se||De.texture!==ye)&&($!==we&&(n.activeTexture(we),$=we),n.bindTexture(se,ye||Oe[se]),De.type=se,De.texture=ye)}function pe(){const se=te[$];se!==void 0&&se.type!==void 0&&(n.bindTexture(se.type,null),se.type=void 0,se.texture=void 0)}function Ie(){try{n.compressedTexImage2D.apply(n,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function ze(){try{n.compressedTexImage3D.apply(n,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function Ee(){try{n.texSubImage2D.apply(n,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function tt(){try{n.texSubImage3D.apply(n,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function nt(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function ct(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function Yt(){try{n.texStorage2D.apply(n,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function Xe(){try{n.texStorage3D.apply(n,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function dt(){try{n.texImage2D.apply(n,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function It(){try{n.texImage3D.apply(n,arguments)}catch(se){console.error("THREE.WebGLState:",se)}}function gt(se){be.equals(se)===!1&&(n.scissor(se.x,se.y,se.z,se.w),be.copy(se))}function ut(se){he.equals(se)===!1&&(n.viewport(se.x,se.y,se.z,se.w),he.copy(se))}function oe(se,ye){let we=c.get(ye);we===void 0&&(we=new WeakMap,c.set(ye,we));let De=we.get(se);De===void 0&&(De=n.getUniformBlockIndex(ye,se.name),we.set(se,De))}function Te(se,ye){const De=c.get(ye).get(se);l.get(ye)!==De&&(n.uniformBlockBinding(ye,De,se.__bindingPointIndex),l.set(ye,De))}function Ye(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),o.setReversed(!1),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),u={},$=null,te={},h={},f=new WeakMap,m=[],y=null,_=!1,v=null,g=null,w=null,A=null,T=null,L=null,D=null,R=new ft(0,0,0),I=0,M=!1,C=null,k=null,B=null,O=null,X=null,be.set(0,0,n.canvas.width,n.canvas.height),he.set(0,0,n.canvas.width,n.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:Ce,disable:mt,bindFramebuffer:Lt,drawBuffers:St,useProgram:Nt,setBlending:ee,setMaterial:xt,setFlipSided:je,setCullFace:ht,setLineWidth:$e,setPolygonOffset:Mt,setScissorTest:lt,activeTexture:Y,bindTexture:j,unbindTexture:pe,compressedTexImage2D:Ie,compressedTexImage3D:ze,texImage2D:dt,texImage3D:It,updateUBOMapping:oe,uniformBlockBinding:Te,texStorage2D:Yt,texStorage3D:Xe,texSubImage2D:Ee,texSubImage3D:tt,compressedTexSubImage2D:nt,compressedTexSubImage3D:ct,scissor:gt,viewport:ut,reset:Ye}}function J1e(n,e){const t=n.image&&n.image.width?n.image.width/n.image.height:1;return t>e?(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2):(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0),n}function Q1e(n,e){const t=n.image&&n.image.width?n.image.width/n.image.height:1;return t>e?(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0):(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2),n}function Z1e(n){return n.repeat.x=1,n.repeat.y=1,n.offset.x=0,n.offset.y=0,n}function PR(n,e,t,i){const r=eEe(i);switch(t){case uD:return n*e;case dD:return n*e;case fD:return n*e*2;case Dv:return n*e/r.components*r.byteLength;case Lv:return n*e/r.components*r.byteLength;case pD:return n*e*2/r.components*r.byteLength;case pS:return n*e*2/r.components*r.byteLength;case hD:return n*e*3/r.components*r.byteLength;case Vi:return n*e*4/r.components*r.byteLength;case mS:return n*e*4/r.components*r.byteLength;case Vy:case zy:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Hy:case Gy:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case yE:case _E:return Math.max(n,16)*Math.max(e,8)/4;case gE:case vE:return Math.max(n,8)*Math.max(e,8)/2;case xE:case wE:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case EE:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case AE:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case SE:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case TE:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case bE:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case CE:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case ME:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case IE:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case RE:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case PE:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case NE:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case DE:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case LE:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case kE:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case BE:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case jy:case OE:case FE:return Math.ceil(n/4)*Math.ceil(e/4)*16;case mD:case UE:return Math.ceil(n/4)*Math.ceil(e/4)*8;case VE:case zE:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function eEe(n){switch(n){case Ws:case uS:return{byteLength:1,components:1};case _m:case hS:case yr:return{byteLength:2,components:1};case dS:case fS:return{byteLength:2,components:4};case ll:case Nv:case Ai:return{byteLength:4,components:1};case cD:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}const tEe={contain:J1e,cover:Q1e,fill:Z1e,getByteLength:PR};function nEe(n,e,t,i,r,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Fe,u=new WeakMap;let h;const f=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(Y,j){return m?new OffscreenCanvas(Y,j):z0("canvas")}function _(Y,j,pe){let Ie=1;const ze=lt(Y);if((ze.width>pe||ze.height>pe)&&(Ie=pe/Math.max(ze.width,ze.height)),Ie<1)if(typeof HTMLImageElement<"u"&&Y instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&Y instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&Y instanceof ImageBitmap||typeof VideoFrame<"u"&&Y instanceof VideoFrame){const Ee=Math.floor(Ie*ze.width),tt=Math.floor(Ie*ze.height);h===void 0&&(h=y(Ee,tt));const nt=j?y(Ee,tt):h;return nt.width=Ee,nt.height=tt,nt.getContext("2d").drawImage(Y,0,0,Ee,tt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+ze.width+"x"+ze.height+") to ("+Ee+"x"+tt+")."),nt}else return"data"in Y&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+ze.width+"x"+ze.height+")."),Y;return Y}function v(Y){return Y.generateMipmaps}function g(Y){n.generateMipmap(Y)}function w(Y){return Y.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:Y.isWebGL3DRenderTarget?n.TEXTURE_3D:Y.isWebGLArrayRenderTarget||Y.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function A(Y,j,pe,Ie,ze=!1){if(Y!==null){if(n[Y]!==void 0)return n[Y];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Y+"'")}let Ee=j;if(j===n.RED&&(pe===n.FLOAT&&(Ee=n.R32F),pe===n.HALF_FLOAT&&(Ee=n.R16F),pe===n.UNSIGNED_BYTE&&(Ee=n.R8)),j===n.RED_INTEGER&&(pe===n.UNSIGNED_BYTE&&(Ee=n.R8UI),pe===n.UNSIGNED_SHORT&&(Ee=n.R16UI),pe===n.UNSIGNED_INT&&(Ee=n.R32UI),pe===n.BYTE&&(Ee=n.R8I),pe===n.SHORT&&(Ee=n.R16I),pe===n.INT&&(Ee=n.R32I)),j===n.RG&&(pe===n.FLOAT&&(Ee=n.RG32F),pe===n.HALF_FLOAT&&(Ee=n.RG16F),pe===n.UNSIGNED_BYTE&&(Ee=n.RG8)),j===n.RG_INTEGER&&(pe===n.UNSIGNED_BYTE&&(Ee=n.RG8UI),pe===n.UNSIGNED_SHORT&&(Ee=n.RG16UI),pe===n.UNSIGNED_INT&&(Ee=n.RG32UI),pe===n.BYTE&&(Ee=n.RG8I),pe===n.SHORT&&(Ee=n.RG16I),pe===n.INT&&(Ee=n.RG32I)),j===n.RGB_INTEGER&&(pe===n.UNSIGNED_BYTE&&(Ee=n.RGB8UI),pe===n.UNSIGNED_SHORT&&(Ee=n.RGB16UI),pe===n.UNSIGNED_INT&&(Ee=n.RGB32UI),pe===n.BYTE&&(Ee=n.RGB8I),pe===n.SHORT&&(Ee=n.RGB16I),pe===n.INT&&(Ee=n.RGB32I)),j===n.RGBA_INTEGER&&(pe===n.UNSIGNED_BYTE&&(Ee=n.RGBA8UI),pe===n.UNSIGNED_SHORT&&(Ee=n.RGBA16UI),pe===n.UNSIGNED_INT&&(Ee=n.RGBA32UI),pe===n.BYTE&&(Ee=n.RGBA8I),pe===n.SHORT&&(Ee=n.RGBA16I),pe===n.INT&&(Ee=n.RGBA32I)),j===n.RGB&&pe===n.UNSIGNED_INT_5_9_9_9_REV&&(Ee=n.RGB9_E5),j===n.RGBA){const tt=ze?kv:Mn.getTransfer(Ie);pe===n.FLOAT&&(Ee=n.RGBA32F),pe===n.HALF_FLOAT&&(Ee=n.RGBA16F),pe===n.UNSIGNED_BYTE&&(Ee=tt===$n?n.SRGB8_ALPHA8:n.RGBA8),pe===n.UNSIGNED_SHORT_4_4_4_4&&(Ee=n.RGBA4),pe===n.UNSIGNED_SHORT_5_5_5_1&&(Ee=n.RGB5_A1)}return(Ee===n.R16F||Ee===n.R32F||Ee===n.RG16F||Ee===n.RG32F||Ee===n.RGBA16F||Ee===n.RGBA32F)&&e.get("EXT_color_buffer_float"),Ee}function T(Y,j){let pe;return Y?j===null||j===ll||j===Fd?pe=n.DEPTH24_STENCIL8:j===Ai?pe=n.DEPTH32F_STENCIL8:j===_m&&(pe=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):j===null||j===ll||j===Fd?pe=n.DEPTH_COMPONENT24:j===Ai?pe=n.DEPTH_COMPONENT32F:j===_m&&(pe=n.DEPTH_COMPONENT16),pe}function L(Y,j){return v(Y)===!0||Y.isFramebufferTexture&&Y.minFilter!==_r&&Y.minFilter!==Gn?Math.log2(Math.max(j.width,j.height))+1:Y.mipmaps!==void 0&&Y.mipmaps.length>0?Y.mipmaps.length:Y.isCompressedTexture&&Array.isArray(Y.image)?j.mipmaps.length:1}function D(Y){const j=Y.target;j.removeEventListener("dispose",D),I(j),j.isVideoTexture&&u.delete(j)}function R(Y){const j=Y.target;j.removeEventListener("dispose",R),C(j)}function I(Y){const j=i.get(Y);if(j.__webglInit===void 0)return;const pe=Y.source,Ie=f.get(pe);if(Ie){const ze=Ie[j.__cacheKey];ze.usedTimes--,ze.usedTimes===0&&M(Y),Object.keys(Ie).length===0&&f.delete(pe)}i.remove(Y)}function M(Y){const j=i.get(Y);n.deleteTexture(j.__webglTexture);const pe=Y.source,Ie=f.get(pe);delete Ie[j.__cacheKey],o.memory.textures--}function C(Y){const j=i.get(Y);if(Y.depthTexture&&(Y.depthTexture.dispose(),i.remove(Y.depthTexture)),Y.isWebGLCubeRenderTarget)for(let Ie=0;Ie<6;Ie++){if(Array.isArray(j.__webglFramebuffer[Ie]))for(let ze=0;ze<j.__webglFramebuffer[Ie].length;ze++)n.deleteFramebuffer(j.__webglFramebuffer[Ie][ze]);else n.deleteFramebuffer(j.__webglFramebuffer[Ie]);j.__webglDepthbuffer&&n.deleteRenderbuffer(j.__webglDepthbuffer[Ie])}else{if(Array.isArray(j.__webglFramebuffer))for(let Ie=0;Ie<j.__webglFramebuffer.length;Ie++)n.deleteFramebuffer(j.__webglFramebuffer[Ie]);else n.deleteFramebuffer(j.__webglFramebuffer);if(j.__webglDepthbuffer&&n.deleteRenderbuffer(j.__webglDepthbuffer),j.__webglMultisampledFramebuffer&&n.deleteFramebuffer(j.__webglMultisampledFramebuffer),j.__webglColorRenderbuffer)for(let Ie=0;Ie<j.__webglColorRenderbuffer.length;Ie++)j.__webglColorRenderbuffer[Ie]&&n.deleteRenderbuffer(j.__webglColorRenderbuffer[Ie]);j.__webglDepthRenderbuffer&&n.deleteRenderbuffer(j.__webglDepthRenderbuffer)}const pe=Y.textures;for(let Ie=0,ze=pe.length;Ie<ze;Ie++){const Ee=i.get(pe[Ie]);Ee.__webglTexture&&(n.deleteTexture(Ee.__webglTexture),o.memory.textures--),i.remove(pe[Ie])}i.remove(Y)}let k=0;function B(){k=0}function O(){const Y=k;return Y>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+Y+" texture units while this GPU supports only "+r.maxTextures),k+=1,Y}function X(Y){const j=[];return j.push(Y.wrapS),j.push(Y.wrapT),j.push(Y.wrapR||0),j.push(Y.magFilter),j.push(Y.minFilter),j.push(Y.anisotropy),j.push(Y.internalFormat),j.push(Y.format),j.push(Y.type),j.push(Y.generateMipmaps),j.push(Y.premultiplyAlpha),j.push(Y.flipY),j.push(Y.unpackAlignment),j.push(Y.colorSpace),j.join()}function le(Y,j){const pe=i.get(Y);if(Y.isVideoTexture&&$e(Y),Y.isRenderTargetTexture===!1&&Y.version>0&&pe.__version!==Y.version){const Ie=Y.image;if(Ie===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Ie.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{he(pe,Y,j);return}}t.bindTexture(n.TEXTURE_2D,pe.__webglTexture,n.TEXTURE0+j)}function ie(Y,j){const pe=i.get(Y);if(Y.version>0&&pe.__version!==Y.version){he(pe,Y,j);return}t.bindTexture(n.TEXTURE_2D_ARRAY,pe.__webglTexture,n.TEXTURE0+j)}function de(Y,j){const pe=i.get(Y);if(Y.version>0&&pe.__version!==Y.version){he(pe,Y,j);return}t.bindTexture(n.TEXTURE_3D,pe.__webglTexture,n.TEXTURE0+j)}function G(Y,j){const pe=i.get(Y);if(Y.version>0&&pe.__version!==Y.version){Pe(pe,Y,j);return}t.bindTexture(n.TEXTURE_CUBE_MAP,pe.__webglTexture,n.TEXTURE0+j)}const $={[Hu]:n.REPEAT,[Ui]:n.CLAMP_TO_EDGE,[vm]:n.MIRRORED_REPEAT},te={[_r]:n.NEAREST,[cS]:n.NEAREST_MIPMAP_NEAREST,[Jh]:n.NEAREST_MIPMAP_LINEAR,[Gn]:n.LINEAR,[Bp]:n.LINEAR_MIPMAP_NEAREST,[Oo]:n.LINEAR_MIPMAP_LINEAR},ue={[hK]:n.NEVER,[yK]:n.ALWAYS,[dK]:n.LESS,[vD]:n.LEQUAL,[fK]:n.EQUAL,[gK]:n.GEQUAL,[pK]:n.GREATER,[mK]:n.NOTEQUAL};function ve(Y,j){if(j.type===Ai&&e.has("OES_texture_float_linear")===!1&&(j.magFilter===Gn||j.magFilter===Bp||j.magFilter===Jh||j.magFilter===Oo||j.minFilter===Gn||j.minFilter===Bp||j.minFilter===Jh||j.minFilter===Oo)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(Y,n.TEXTURE_WRAP_S,$[j.wrapS]),n.texParameteri(Y,n.TEXTURE_WRAP_T,$[j.wrapT]),(Y===n.TEXTURE_3D||Y===n.TEXTURE_2D_ARRAY)&&n.texParameteri(Y,n.TEXTURE_WRAP_R,$[j.wrapR]),n.texParameteri(Y,n.TEXTURE_MAG_FILTER,te[j.magFilter]),n.texParameteri(Y,n.TEXTURE_MIN_FILTER,te[j.minFilter]),j.compareFunction&&(n.texParameteri(Y,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(Y,n.TEXTURE_COMPARE_FUNC,ue[j.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(j.magFilter===_r||j.minFilter!==Jh&&j.minFilter!==Oo||j.type===Ai&&e.has("OES_texture_float_linear")===!1)return;if(j.anisotropy>1||i.get(j).__currentAnisotropy){const pe=e.get("EXT_texture_filter_anisotropic");n.texParameterf(Y,pe.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(j.anisotropy,r.getMaxAnisotropy())),i.get(j).__currentAnisotropy=j.anisotropy}}}function be(Y,j){let pe=!1;Y.__webglInit===void 0&&(Y.__webglInit=!0,j.addEventListener("dispose",D));const Ie=j.source;let ze=f.get(Ie);ze===void 0&&(ze={},f.set(Ie,ze));const Ee=X(j);if(Ee!==Y.__cacheKey){ze[Ee]===void 0&&(ze[Ee]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,pe=!0),ze[Ee].usedTimes++;const tt=ze[Y.__cacheKey];tt!==void 0&&(ze[Y.__cacheKey].usedTimes--,tt.usedTimes===0&&M(j)),Y.__cacheKey=Ee,Y.__webglTexture=ze[Ee].texture}return pe}function he(Y,j,pe){let Ie=n.TEXTURE_2D;(j.isDataArrayTexture||j.isCompressedArrayTexture)&&(Ie=n.TEXTURE_2D_ARRAY),j.isData3DTexture&&(Ie=n.TEXTURE_3D);const ze=be(Y,j),Ee=j.source;t.bindTexture(Ie,Y.__webglTexture,n.TEXTURE0+pe);const tt=i.get(Ee);if(Ee.version!==tt.__version||ze===!0){t.activeTexture(n.TEXTURE0+pe);const nt=Mn.getPrimaries(Mn.workingColorSpace),ct=j.colorSpace===Bl?null:Mn.getPrimaries(j.colorSpace),Yt=j.colorSpace===Bl||nt===ct?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,j.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,j.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,j.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Yt);let Xe=_(j.image,!1,r.maxTextureSize);Xe=Mt(j,Xe);const dt=s.convert(j.format,j.colorSpace),It=s.convert(j.type);let gt=A(j.internalFormat,dt,It,j.colorSpace,j.isVideoTexture);ve(Ie,j);let ut;const oe=j.mipmaps,Te=j.isVideoTexture!==!0,Ye=tt.__version===void 0||ze===!0,se=Ee.dataReady,ye=L(j,Xe);if(j.isDepthTexture)gt=T(j.format===Ud,j.type),Ye&&(Te?t.texStorage2D(n.TEXTURE_2D,1,gt,Xe.width,Xe.height):t.texImage2D(n.TEXTURE_2D,0,gt,Xe.width,Xe.height,0,dt,It,null));else if(j.isDataTexture)if(oe.length>0){Te&&Ye&&t.texStorage2D(n.TEXTURE_2D,ye,gt,oe[0].width,oe[0].height);for(let we=0,De=oe.length;we<De;we++)ut=oe[we],Te?se&&t.texSubImage2D(n.TEXTURE_2D,we,0,0,ut.width,ut.height,dt,It,ut.data):t.texImage2D(n.TEXTURE_2D,we,gt,ut.width,ut.height,0,dt,It,ut.data);j.generateMipmaps=!1}else Te?(Ye&&t.texStorage2D(n.TEXTURE_2D,ye,gt,Xe.width,Xe.height),se&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,Xe.width,Xe.height,dt,It,Xe.data)):t.texImage2D(n.TEXTURE_2D,0,gt,Xe.width,Xe.height,0,dt,It,Xe.data);else if(j.isCompressedTexture)if(j.isCompressedArrayTexture){Te&&Ye&&t.texStorage3D(n.TEXTURE_2D_ARRAY,ye,gt,oe[0].width,oe[0].height,Xe.depth);for(let we=0,De=oe.length;we<De;we++)if(ut=oe[we],j.format!==Vi)if(dt!==null)if(Te){if(se)if(j.layerUpdates.size>0){const ot=PR(ut.width,ut.height,j.format,j.type);for(const it of j.layerUpdates){const Ke=ut.data.subarray(it*ot/ut.data.BYTES_PER_ELEMENT,(it+1)*ot/ut.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,we,0,0,it,ut.width,ut.height,1,dt,Ke)}j.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,we,0,0,0,ut.width,ut.height,Xe.depth,dt,ut.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,we,gt,ut.width,ut.height,Xe.depth,0,ut.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Te?se&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,we,0,0,0,ut.width,ut.height,Xe.depth,dt,It,ut.data):t.texImage3D(n.TEXTURE_2D_ARRAY,we,gt,ut.width,ut.height,Xe.depth,0,dt,It,ut.data)}else{Te&&Ye&&t.texStorage2D(n.TEXTURE_2D,ye,gt,oe[0].width,oe[0].height);for(let we=0,De=oe.length;we<De;we++)ut=oe[we],j.format!==Vi?dt!==null?Te?se&&t.compressedTexSubImage2D(n.TEXTURE_2D,we,0,0,ut.width,ut.height,dt,ut.data):t.compressedTexImage2D(n.TEXTURE_2D,we,gt,ut.width,ut.height,0,ut.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Te?se&&t.texSubImage2D(n.TEXTURE_2D,we,0,0,ut.width,ut.height,dt,It,ut.data):t.texImage2D(n.TEXTURE_2D,we,gt,ut.width,ut.height,0,dt,It,ut.data)}else if(j.isDataArrayTexture)if(Te){if(Ye&&t.texStorage3D(n.TEXTURE_2D_ARRAY,ye,gt,Xe.width,Xe.height,Xe.depth),se)if(j.layerUpdates.size>0){const we=PR(Xe.width,Xe.height,j.format,j.type);for(const De of j.layerUpdates){const ot=Xe.data.subarray(De*we/Xe.data.BYTES_PER_ELEMENT,(De+1)*we/Xe.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,De,Xe.width,Xe.height,1,dt,It,ot)}j.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,Xe.width,Xe.height,Xe.depth,dt,It,Xe.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,gt,Xe.width,Xe.height,Xe.depth,0,dt,It,Xe.data);else if(j.isData3DTexture)Te?(Ye&&t.texStorage3D(n.TEXTURE_3D,ye,gt,Xe.width,Xe.height,Xe.depth),se&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,Xe.width,Xe.height,Xe.depth,dt,It,Xe.data)):t.texImage3D(n.TEXTURE_3D,0,gt,Xe.width,Xe.height,Xe.depth,0,dt,It,Xe.data);else if(j.isFramebufferTexture){if(Ye)if(Te)t.texStorage2D(n.TEXTURE_2D,ye,gt,Xe.width,Xe.height);else{let we=Xe.width,De=Xe.height;for(let ot=0;ot<ye;ot++)t.texImage2D(n.TEXTURE_2D,ot,gt,we,De,0,dt,It,null),we>>=1,De>>=1}}else if(oe.length>0){if(Te&&Ye){const we=lt(oe[0]);t.texStorage2D(n.TEXTURE_2D,ye,gt,we.width,we.height)}for(let we=0,De=oe.length;we<De;we++)ut=oe[we],Te?se&&t.texSubImage2D(n.TEXTURE_2D,we,0,0,dt,It,ut):t.texImage2D(n.TEXTURE_2D,we,gt,dt,It,ut);j.generateMipmaps=!1}else if(Te){if(Ye){const we=lt(Xe);t.texStorage2D(n.TEXTURE_2D,ye,gt,we.width,we.height)}se&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,dt,It,Xe)}else t.texImage2D(n.TEXTURE_2D,0,gt,dt,It,Xe);v(j)&&g(Ie),tt.__version=Ee.version,j.onUpdate&&j.onUpdate(j)}Y.__version=j.version}function Pe(Y,j,pe){if(j.image.length!==6)return;const Ie=be(Y,j),ze=j.source;t.bindTexture(n.TEXTURE_CUBE_MAP,Y.__webglTexture,n.TEXTURE0+pe);const Ee=i.get(ze);if(ze.version!==Ee.__version||Ie===!0){t.activeTexture(n.TEXTURE0+pe);const tt=Mn.getPrimaries(Mn.workingColorSpace),nt=j.colorSpace===Bl?null:Mn.getPrimaries(j.colorSpace),ct=j.colorSpace===Bl||tt===nt?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,j.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,j.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,j.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,ct);const Yt=j.isCompressedTexture||j.image[0].isCompressedTexture,Xe=j.image[0]&&j.image[0].isDataTexture,dt=[];for(let De=0;De<6;De++)!Yt&&!Xe?dt[De]=_(j.image[De],!0,r.maxCubemapSize):dt[De]=Xe?j.image[De].image:j.image[De],dt[De]=Mt(j,dt[De]);const It=dt[0],gt=s.convert(j.format,j.colorSpace),ut=s.convert(j.type),oe=A(j.internalFormat,gt,ut,j.colorSpace),Te=j.isVideoTexture!==!0,Ye=Ee.__version===void 0||Ie===!0,se=ze.dataReady;let ye=L(j,It);ve(n.TEXTURE_CUBE_MAP,j);let we;if(Yt){Te&&Ye&&t.texStorage2D(n.TEXTURE_CUBE_MAP,ye,oe,It.width,It.height);for(let De=0;De<6;De++){we=dt[De].mipmaps;for(let ot=0;ot<we.length;ot++){const it=we[ot];j.format!==Vi?gt!==null?Te?se&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+De,ot,0,0,it.width,it.height,gt,it.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+De,ot,oe,it.width,it.height,0,it.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Te?se&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+De,ot,0,0,it.width,it.height,gt,ut,it.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+De,ot,oe,it.width,it.height,0,gt,ut,it.data)}}}else{if(we=j.mipmaps,Te&&Ye){we.length>0&&ye++;const De=lt(dt[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,ye,oe,De.width,De.height)}for(let De=0;De<6;De++)if(Xe){Te?se&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+De,0,0,0,dt[De].width,dt[De].height,gt,ut,dt[De].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+De,0,oe,dt[De].width,dt[De].height,0,gt,ut,dt[De].data);for(let ot=0;ot<we.length;ot++){const Ke=we[ot].image[De].image;Te?se&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+De,ot+1,0,0,Ke.width,Ke.height,gt,ut,Ke.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+De,ot+1,oe,Ke.width,Ke.height,0,gt,ut,Ke.data)}}else{Te?se&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+De,0,0,0,gt,ut,dt[De]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+De,0,oe,gt,ut,dt[De]);for(let ot=0;ot<we.length;ot++){const it=we[ot];Te?se&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+De,ot+1,0,0,gt,ut,it.image[De]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+De,ot+1,oe,gt,ut,it.image[De])}}}v(j)&&g(n.TEXTURE_CUBE_MAP),Ee.__version=ze.version,j.onUpdate&&j.onUpdate(j)}Y.__version=j.version}function Oe(Y,j,pe,Ie,ze,Ee){const tt=s.convert(pe.format,pe.colorSpace),nt=s.convert(pe.type),ct=A(pe.internalFormat,tt,nt,pe.colorSpace),Yt=i.get(j),Xe=i.get(pe);if(Xe.__renderTarget=j,!Yt.__hasExternalTextures){const dt=Math.max(1,j.width>>Ee),It=Math.max(1,j.height>>Ee);ze===n.TEXTURE_3D||ze===n.TEXTURE_2D_ARRAY?t.texImage3D(ze,Ee,ct,dt,It,j.depth,0,tt,nt,null):t.texImage2D(ze,Ee,ct,dt,It,0,tt,nt,null)}t.bindFramebuffer(n.FRAMEBUFFER,Y),ht(j)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Ie,ze,Xe.__webglTexture,0,je(j)):(ze===n.TEXTURE_2D||ze>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&ze<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,Ie,ze,Xe.__webglTexture,Ee),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Ce(Y,j,pe){if(n.bindRenderbuffer(n.RENDERBUFFER,Y),j.depthBuffer){const Ie=j.depthTexture,ze=Ie&&Ie.isDepthTexture?Ie.type:null,Ee=T(j.stencilBuffer,ze),tt=j.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,nt=je(j);ht(j)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,nt,Ee,j.width,j.height):pe?n.renderbufferStorageMultisample(n.RENDERBUFFER,nt,Ee,j.width,j.height):n.renderbufferStorage(n.RENDERBUFFER,Ee,j.width,j.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,tt,n.RENDERBUFFER,Y)}else{const Ie=j.textures;for(let ze=0;ze<Ie.length;ze++){const Ee=Ie[ze],tt=s.convert(Ee.format,Ee.colorSpace),nt=s.convert(Ee.type),ct=A(Ee.internalFormat,tt,nt,Ee.colorSpace),Yt=je(j);pe&&ht(j)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Yt,ct,j.width,j.height):ht(j)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Yt,ct,j.width,j.height):n.renderbufferStorage(n.RENDERBUFFER,ct,j.width,j.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function mt(Y,j){if(j&&j.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(n.FRAMEBUFFER,Y),!(j.depthTexture&&j.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const Ie=i.get(j.depthTexture);Ie.__renderTarget=j,(!Ie.__webglTexture||j.depthTexture.image.width!==j.width||j.depthTexture.image.height!==j.height)&&(j.depthTexture.image.width=j.width,j.depthTexture.image.height=j.height,j.depthTexture.needsUpdate=!0),le(j.depthTexture,0);const ze=Ie.__webglTexture,Ee=je(j);if(j.depthTexture.format===vd)ht(j)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,ze,0,Ee):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,ze,0);else if(j.depthTexture.format===Ud)ht(j)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,ze,0,Ee):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,ze,0);else throw new Error("Unknown depthTexture format")}function Lt(Y){const j=i.get(Y),pe=Y.isWebGLCubeRenderTarget===!0;if(j.__boundDepthTexture!==Y.depthTexture){const Ie=Y.depthTexture;if(j.__depthDisposeCallback&&j.__depthDisposeCallback(),Ie){const ze=()=>{delete j.__boundDepthTexture,delete j.__depthDisposeCallback,Ie.removeEventListener("dispose",ze)};Ie.addEventListener("dispose",ze),j.__depthDisposeCallback=ze}j.__boundDepthTexture=Ie}if(Y.depthTexture&&!j.__autoAllocateDepthBuffer){if(pe)throw new Error("target.depthTexture not supported in Cube render targets");mt(j.__webglFramebuffer,Y)}else if(pe){j.__webglDepthbuffer=[];for(let Ie=0;Ie<6;Ie++)if(t.bindFramebuffer(n.FRAMEBUFFER,j.__webglFramebuffer[Ie]),j.__webglDepthbuffer[Ie]===void 0)j.__webglDepthbuffer[Ie]=n.createRenderbuffer(),Ce(j.__webglDepthbuffer[Ie],Y,!1);else{const ze=Y.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Ee=j.__webglDepthbuffer[Ie];n.bindRenderbuffer(n.RENDERBUFFER,Ee),n.framebufferRenderbuffer(n.FRAMEBUFFER,ze,n.RENDERBUFFER,Ee)}}else if(t.bindFramebuffer(n.FRAMEBUFFER,j.__webglFramebuffer),j.__webglDepthbuffer===void 0)j.__webglDepthbuffer=n.createRenderbuffer(),Ce(j.__webglDepthbuffer,Y,!1);else{const Ie=Y.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ze=j.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,ze),n.framebufferRenderbuffer(n.FRAMEBUFFER,Ie,n.RENDERBUFFER,ze)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function St(Y,j,pe){const Ie=i.get(Y);j!==void 0&&Oe(Ie.__webglFramebuffer,Y,Y.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),pe!==void 0&&Lt(Y)}function Nt(Y){const j=Y.texture,pe=i.get(Y),Ie=i.get(j);Y.addEventListener("dispose",R);const ze=Y.textures,Ee=Y.isWebGLCubeRenderTarget===!0,tt=ze.length>1;if(tt||(Ie.__webglTexture===void 0&&(Ie.__webglTexture=n.createTexture()),Ie.__version=j.version,o.memory.textures++),Ee){pe.__webglFramebuffer=[];for(let nt=0;nt<6;nt++)if(j.mipmaps&&j.mipmaps.length>0){pe.__webglFramebuffer[nt]=[];for(let ct=0;ct<j.mipmaps.length;ct++)pe.__webglFramebuffer[nt][ct]=n.createFramebuffer()}else pe.__webglFramebuffer[nt]=n.createFramebuffer()}else{if(j.mipmaps&&j.mipmaps.length>0){pe.__webglFramebuffer=[];for(let nt=0;nt<j.mipmaps.length;nt++)pe.__webglFramebuffer[nt]=n.createFramebuffer()}else pe.__webglFramebuffer=n.createFramebuffer();if(tt)for(let nt=0,ct=ze.length;nt<ct;nt++){const Yt=i.get(ze[nt]);Yt.__webglTexture===void 0&&(Yt.__webglTexture=n.createTexture(),o.memory.textures++)}if(Y.samples>0&&ht(Y)===!1){pe.__webglMultisampledFramebuffer=n.createFramebuffer(),pe.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,pe.__webglMultisampledFramebuffer);for(let nt=0;nt<ze.length;nt++){const ct=ze[nt];pe.__webglColorRenderbuffer[nt]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,pe.__webglColorRenderbuffer[nt]);const Yt=s.convert(ct.format,ct.colorSpace),Xe=s.convert(ct.type),dt=A(ct.internalFormat,Yt,Xe,ct.colorSpace,Y.isXRRenderTarget===!0),It=je(Y);n.renderbufferStorageMultisample(n.RENDERBUFFER,It,dt,Y.width,Y.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+nt,n.RENDERBUFFER,pe.__webglColorRenderbuffer[nt])}n.bindRenderbuffer(n.RENDERBUFFER,null),Y.depthBuffer&&(pe.__webglDepthRenderbuffer=n.createRenderbuffer(),Ce(pe.__webglDepthRenderbuffer,Y,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(Ee){t.bindTexture(n.TEXTURE_CUBE_MAP,Ie.__webglTexture),ve(n.TEXTURE_CUBE_MAP,j);for(let nt=0;nt<6;nt++)if(j.mipmaps&&j.mipmaps.length>0)for(let ct=0;ct<j.mipmaps.length;ct++)Oe(pe.__webglFramebuffer[nt][ct],Y,j,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+nt,ct);else Oe(pe.__webglFramebuffer[nt],Y,j,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+nt,0);v(j)&&g(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(tt){for(let nt=0,ct=ze.length;nt<ct;nt++){const Yt=ze[nt],Xe=i.get(Yt);t.bindTexture(n.TEXTURE_2D,Xe.__webglTexture),ve(n.TEXTURE_2D,Yt),Oe(pe.__webglFramebuffer,Y,Yt,n.COLOR_ATTACHMENT0+nt,n.TEXTURE_2D,0),v(Yt)&&g(n.TEXTURE_2D)}t.unbindTexture()}else{let nt=n.TEXTURE_2D;if((Y.isWebGL3DRenderTarget||Y.isWebGLArrayRenderTarget)&&(nt=Y.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(nt,Ie.__webglTexture),ve(nt,j),j.mipmaps&&j.mipmaps.length>0)for(let ct=0;ct<j.mipmaps.length;ct++)Oe(pe.__webglFramebuffer[ct],Y,j,n.COLOR_ATTACHMENT0,nt,ct);else Oe(pe.__webglFramebuffer,Y,j,n.COLOR_ATTACHMENT0,nt,0);v(j)&&g(nt),t.unbindTexture()}Y.depthBuffer&&Lt(Y)}function ke(Y){const j=Y.textures;for(let pe=0,Ie=j.length;pe<Ie;pe++){const ze=j[pe];if(v(ze)){const Ee=w(Y),tt=i.get(ze).__webglTexture;t.bindTexture(Ee,tt),g(Ee),t.unbindTexture()}}}const Ue=[],ee=[];function xt(Y){if(Y.samples>0){if(ht(Y)===!1){const j=Y.textures,pe=Y.width,Ie=Y.height;let ze=n.COLOR_BUFFER_BIT;const Ee=Y.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,tt=i.get(Y),nt=j.length>1;if(nt)for(let ct=0;ct<j.length;ct++)t.bindFramebuffer(n.FRAMEBUFFER,tt.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+ct,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,tt.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+ct,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,tt.__webglMultisampledFramebuffer),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,tt.__webglFramebuffer);for(let ct=0;ct<j.length;ct++){if(Y.resolveDepthBuffer&&(Y.depthBuffer&&(ze|=n.DEPTH_BUFFER_BIT),Y.stencilBuffer&&Y.resolveStencilBuffer&&(ze|=n.STENCIL_BUFFER_BIT)),nt){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,tt.__webglColorRenderbuffer[ct]);const Yt=i.get(j[ct]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,Yt,0)}n.blitFramebuffer(0,0,pe,Ie,0,0,pe,Ie,ze,n.NEAREST),l===!0&&(Ue.length=0,ee.length=0,Ue.push(n.COLOR_ATTACHMENT0+ct),Y.depthBuffer&&Y.resolveDepthBuffer===!1&&(Ue.push(Ee),ee.push(Ee),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,ee)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,Ue))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),nt)for(let ct=0;ct<j.length;ct++){t.bindFramebuffer(n.FRAMEBUFFER,tt.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+ct,n.RENDERBUFFER,tt.__webglColorRenderbuffer[ct]);const Yt=i.get(j[ct]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,tt.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+ct,n.TEXTURE_2D,Yt,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,tt.__webglMultisampledFramebuffer)}else if(Y.depthBuffer&&Y.resolveDepthBuffer===!1&&l){const j=Y.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[j])}}}function je(Y){return Math.min(r.maxSamples,Y.samples)}function ht(Y){const j=i.get(Y);return Y.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&j.__useRenderToTexture!==!1}function $e(Y){const j=o.render.frame;u.get(Y)!==j&&(u.set(Y,j),Y.update())}function Mt(Y,j){const pe=Y.colorSpace,Ie=Y.format,ze=Y.type;return Y.isCompressedTexture===!0||Y.isVideoTexture===!0||pe!==cl&&pe!==Bl&&(Mn.getTransfer(pe)===$n?(Ie!==Vi||ze!==Ws)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",pe)),j}function lt(Y){return typeof HTMLImageElement<"u"&&Y instanceof HTMLImageElement?(c.width=Y.naturalWidth||Y.width,c.height=Y.naturalHeight||Y.height):typeof VideoFrame<"u"&&Y instanceof VideoFrame?(c.width=Y.displayWidth,c.height=Y.displayHeight):(c.width=Y.width,c.height=Y.height),c}this.allocateTextureUnit=O,this.resetTextureUnits=B,this.setTexture2D=le,this.setTexture2DArray=ie,this.setTexture3D=de,this.setTextureCube=G,this.rebindTextures=St,this.setupRenderTarget=Nt,this.updateRenderTargetMipmap=ke,this.updateMultisampleRenderTarget=xt,this.setupDepthRenderbuffer=Lt,this.setupFrameBufferTexture=Oe,this.useMultisampledRTT=ht}function NK(n,e){function t(i,r=Bl){let s;const o=Mn.getTransfer(r);if(i===Ws)return n.UNSIGNED_BYTE;if(i===dS)return n.UNSIGNED_SHORT_4_4_4_4;if(i===fS)return n.UNSIGNED_SHORT_5_5_5_1;if(i===cD)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===uS)return n.BYTE;if(i===hS)return n.SHORT;if(i===_m)return n.UNSIGNED_SHORT;if(i===Nv)return n.INT;if(i===ll)return n.UNSIGNED_INT;if(i===Ai)return n.FLOAT;if(i===yr)return n.HALF_FLOAT;if(i===uD)return n.ALPHA;if(i===hD)return n.RGB;if(i===Vi)return n.RGBA;if(i===dD)return n.LUMINANCE;if(i===fD)return n.LUMINANCE_ALPHA;if(i===vd)return n.DEPTH_COMPONENT;if(i===Ud)return n.DEPTH_STENCIL;if(i===Dv)return n.RED;if(i===Lv)return n.RED_INTEGER;if(i===pD)return n.RG;if(i===pS)return n.RG_INTEGER;if(i===mS)return n.RGBA_INTEGER;if(i===Vy||i===zy||i===Hy||i===Gy)if(o===$n)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Vy)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===zy)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Hy)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Gy)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Vy)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===zy)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Hy)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Gy)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===gE||i===yE||i===vE||i===_E)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===gE)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===yE)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===vE)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===_E)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===xE||i===wE||i===EE)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===xE||i===wE)return o===$n?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===EE)return o===$n?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===AE||i===SE||i===TE||i===bE||i===CE||i===ME||i===IE||i===RE||i===PE||i===NE||i===DE||i===LE||i===kE||i===BE)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===AE)return o===$n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===SE)return o===$n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===TE)return o===$n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===bE)return o===$n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===CE)return o===$n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===ME)return o===$n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===IE)return o===$n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===RE)return o===$n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===PE)return o===$n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===NE)return o===$n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===DE)return o===$n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===LE)return o===$n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===kE)return o===$n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===BE)return o===$n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===jy||i===OE||i===FE)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===jy)return o===$n?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===OE)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===FE)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===mD||i===UE||i===VE||i===zE)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===jy)return s.COMPRESSED_RED_RGTC1_EXT;if(i===UE)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===VE)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===zE)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Fd?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}class DK extends Ni{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class jl extends Rn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const iEe={type:"move"};class xC{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new jl,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 jl,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new q,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new q),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new jl,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new q,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new q),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const _ of e.hand.values()){const v=t.getJointPose(_,i),g=this._getHandJoint(c,_);v!==null&&(g.matrix.fromArray(v.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,g.jointRadius=v.radius),g.visible=v!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=u.position.distanceTo(h.position),m=.02,y=.005;c.inputState.pinching&&f>m+y?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=m-y&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(iEe)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new jl;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const rEe=`
void main() {

	gl_Position = vec4( position, 1.0 );

}`,sEe=`
uniform sampler2DArray depthColor;
uniform float depthWidth;
uniform float depthHeight;

void main() {

	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );

	if ( coord.x >= 1.0 ) {

		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;

	} else {

		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;

	}

}`;class oEe{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const r=new qn,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new ss({vertexShader:rEe,fragmentShader:sEe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new fi(new yc(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class aEe extends hl{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,h=null,f=null,m=null,y=null;const _=new oEe,v=t.getContextAttributes();let g=null,w=null;const A=[],T=[],L=new Fe;let D=null;const R=new Ni;R.viewport=new Bn;const I=new Ni;I.viewport=new Bn;const M=[R,I],C=new DK;let k=null,B=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(he){let Pe=A[he];return Pe===void 0&&(Pe=new xC,A[he]=Pe),Pe.getTargetRaySpace()},this.getControllerGrip=function(he){let Pe=A[he];return Pe===void 0&&(Pe=new xC,A[he]=Pe),Pe.getGripSpace()},this.getHand=function(he){let Pe=A[he];return Pe===void 0&&(Pe=new xC,A[he]=Pe),Pe.getHandSpace()};function O(he){const Pe=T.indexOf(he.inputSource);if(Pe===-1)return;const Oe=A[Pe];Oe!==void 0&&(Oe.update(he.inputSource,he.frame,c||o),Oe.dispatchEvent({type:he.type,data:he.inputSource}))}function X(){r.removeEventListener("select",O),r.removeEventListener("selectstart",O),r.removeEventListener("selectend",O),r.removeEventListener("squeeze",O),r.removeEventListener("squeezestart",O),r.removeEventListener("squeezeend",O),r.removeEventListener("end",X),r.removeEventListener("inputsourceschange",le);for(let he=0;he<A.length;he++){const Pe=T[he];Pe!==null&&(T[he]=null,A[he].disconnect(Pe))}k=null,B=null,_.reset(),e.setRenderTarget(g),m=null,f=null,h=null,r=null,w=null,be.stop(),i.isPresenting=!1,e.setPixelRatio(D),e.setSize(L.width,L.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(he){s=he,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(he){a=he,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(he){c=he},this.getBaseLayer=function(){return f!==null?f:m},this.getBinding=function(){return h},this.getFrame=function(){return y},this.getSession=function(){return r},this.setSession=async function(he){if(r=he,r!==null){if(g=e.getRenderTarget(),r.addEventListener("select",O),r.addEventListener("selectstart",O),r.addEventListener("selectend",O),r.addEventListener("squeeze",O),r.addEventListener("squeezestart",O),r.addEventListener("squeezeend",O),r.addEventListener("end",X),r.addEventListener("inputsourceschange",le),v.xrCompatible!==!0&&await t.makeXRCompatible(),D=e.getPixelRatio(),e.getSize(L),r.renderState.layers===void 0){const Pe={antialias:v.antialias,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:s};m=new XRWebGLLayer(r,t,Pe),r.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),w=new Ss(m.framebufferWidth,m.framebufferHeight,{format:Vi,type:Ws,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil})}else{let Pe=null,Oe=null,Ce=null;v.depth&&(Ce=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Pe=v.stencil?Ud:vd,Oe=v.stencil?Fd:ll);const mt={colorFormat:t.RGBA8,depthFormat:Ce,scaleFactor:s};h=new XRWebGLBinding(r,t),f=h.createProjectionLayer(mt),r.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),w=new Ss(f.textureWidth,f.textureHeight,{format:Vi,type:Ws,depthTexture:new TD(f.textureWidth,f.textureHeight,Oe,void 0,void 0,void 0,void 0,void 0,void 0,Pe),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:v.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1})}w.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await r.requestReferenceSpace(a),be.setContext(r),be.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};function le(he){for(let Pe=0;Pe<he.removed.length;Pe++){const Oe=he.removed[Pe],Ce=T.indexOf(Oe);Ce>=0&&(T[Ce]=null,A[Ce].disconnect(Oe))}for(let Pe=0;Pe<he.added.length;Pe++){const Oe=he.added[Pe];let Ce=T.indexOf(Oe);if(Ce===-1){for(let Lt=0;Lt<A.length;Lt++)if(Lt>=T.length){T.push(Oe),Ce=Lt;break}else if(T[Lt]===null){T[Lt]=Oe,Ce=Lt;break}if(Ce===-1)break}const mt=A[Ce];mt&&mt.connect(Oe)}}const ie=new q,de=new q;function G(he,Pe,Oe){ie.setFromMatrixPosition(Pe.matrixWorld),de.setFromMatrixPosition(Oe.matrixWorld);const Ce=ie.distanceTo(de),mt=Pe.projectionMatrix.elements,Lt=Oe.projectionMatrix.elements,St=mt[14]/(mt[10]-1),Nt=mt[14]/(mt[10]+1),ke=(mt[9]+1)/mt[5],Ue=(mt[9]-1)/mt[5],ee=(mt[8]-1)/mt[0],xt=(Lt[8]+1)/Lt[0],je=St*ee,ht=St*xt,$e=Ce/(-ee+xt),Mt=$e*-ee;if(Pe.matrixWorld.decompose(he.position,he.quaternion,he.scale),he.translateX(Mt),he.translateZ($e),he.matrixWorld.compose(he.position,he.quaternion,he.scale),he.matrixWorldInverse.copy(he.matrixWorld).invert(),mt[10]===-1)he.projectionMatrix.copy(Pe.projectionMatrix),he.projectionMatrixInverse.copy(Pe.projectionMatrixInverse);else{const lt=St+$e,Y=Nt+$e,j=je-Mt,pe=ht+(Ce-Mt),Ie=ke*Nt/Y*lt,ze=Ue*Nt/Y*lt;he.projectionMatrix.makePerspective(j,pe,Ie,ze,lt,Y),he.projectionMatrixInverse.copy(he.projectionMatrix).invert()}}function $(he,Pe){Pe===null?he.matrixWorld.copy(he.matrix):he.matrixWorld.multiplyMatrices(Pe.matrixWorld,he.matrix),he.matrixWorldInverse.copy(he.matrixWorld).invert()}this.updateCamera=function(he){if(r===null)return;let Pe=he.near,Oe=he.far;_.texture!==null&&(_.depthNear>0&&(Pe=_.depthNear),_.depthFar>0&&(Oe=_.depthFar)),C.near=I.near=R.near=Pe,C.far=I.far=R.far=Oe,(k!==C.near||B!==C.far)&&(r.updateRenderState({depthNear:C.near,depthFar:C.far}),k=C.near,B=C.far),R.layers.mask=he.layers.mask|2,I.layers.mask=he.layers.mask|4,C.layers.mask=R.layers.mask|I.layers.mask;const Ce=he.parent,mt=C.cameras;$(C,Ce);for(let Lt=0;Lt<mt.length;Lt++)$(mt[Lt],Ce);mt.length===2?G(C,R,I):C.projectionMatrix.copy(R.projectionMatrix),te(he,C,Ce)};function te(he,Pe,Oe){Oe===null?he.matrix.copy(Pe.matrixWorld):(he.matrix.copy(Oe.matrixWorld),he.matrix.invert(),he.matrix.multiply(Pe.matrixWorld)),he.matrix.decompose(he.position,he.quaternion,he.scale),he.updateMatrixWorld(!0),he.projectionMatrix.copy(Pe.projectionMatrix),he.projectionMatrixInverse.copy(Pe.projectionMatrixInverse),he.isPerspectiveCamera&&(he.fov=Em*2*Math.atan(1/he.projectionMatrix.elements[5]),he.zoom=1)}this.getCamera=function(){return C},this.getFoveation=function(){if(!(f===null&&m===null))return l},this.setFoveation=function(he){l=he,f!==null&&(f.fixedFoveation=he),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=he)},this.hasDepthSensing=function(){return _.texture!==null},this.getDepthSensingMesh=function(){return _.getMesh(C)};let ue=null;function ve(he,Pe){if(u=Pe.getViewerPose(c||o),y=Pe,u!==null){const Oe=u.views;m!==null&&(e.setRenderTargetFramebuffer(w,m.framebuffer),e.setRenderTarget(w));let Ce=!1;Oe.length!==C.cameras.length&&(C.cameras.length=0,Ce=!0);for(let Lt=0;Lt<Oe.length;Lt++){const St=Oe[Lt];let Nt=null;if(m!==null)Nt=m.getViewport(St);else{const Ue=h.getViewSubImage(f,St);Nt=Ue.viewport,Lt===0&&(e.setRenderTargetTextures(w,Ue.colorTexture,f.ignoreDepthValues?void 0:Ue.depthStencilTexture),e.setRenderTarget(w))}let ke=M[Lt];ke===void 0&&(ke=new Ni,ke.layers.enable(Lt),ke.viewport=new Bn,M[Lt]=ke),ke.matrix.fromArray(St.transform.matrix),ke.matrix.decompose(ke.position,ke.quaternion,ke.scale),ke.projectionMatrix.fromArray(St.projectionMatrix),ke.projectionMatrixInverse.copy(ke.projectionMatrix).invert(),ke.viewport.set(Nt.x,Nt.y,Nt.width,Nt.height),Lt===0&&(C.matrix.copy(ke.matrix),C.matrix.decompose(C.position,C.quaternion,C.scale)),Ce===!0&&C.cameras.push(ke)}const mt=r.enabledFeatures;if(mt&&mt.includes("depth-sensing")){const Lt=h.getDepthInformation(Oe[0]);Lt&&Lt.isValid&&Lt.texture&&_.init(e,Lt,r.renderState)}}for(let Oe=0;Oe<A.length;Oe++){const Ce=T[Oe],mt=A[Oe];Ce!==null&&mt!==void 0&&mt.update(Ce,Pe,c||o)}ue&&ue(he,Pe),Pe.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:Pe}),y=null}const be=new CK;be.setAnimationLoop(ve),this.setAnimationLoop=function(he){ue=he},this.dispose=function(){}}}const Sh=new mo,lEe=new qt;function cEe(n,e){function t(v,g){v.matrixAutoUpdate===!0&&v.updateMatrix(),g.value.copy(v.matrix)}function i(v,g){g.color.getRGB(v.fogColor.value,SK(n)),g.isFog?(v.fogNear.value=g.near,v.fogFar.value=g.far):g.isFogExp2&&(v.fogDensity.value=g.density)}function r(v,g,w,A,T){g.isMeshBasicMaterial||g.isMeshLambertMaterial?s(v,g):g.isMeshToonMaterial?(s(v,g),h(v,g)):g.isMeshPhongMaterial?(s(v,g),u(v,g)):g.isMeshStandardMaterial?(s(v,g),f(v,g),g.isMeshPhysicalMaterial&&m(v,g,T)):g.isMeshMatcapMaterial?(s(v,g),y(v,g)):g.isMeshDepthMaterial?s(v,g):g.isMeshDistanceMaterial?(s(v,g),_(v,g)):g.isMeshNormalMaterial?s(v,g):g.isLineBasicMaterial?(o(v,g),g.isLineDashedMaterial&&a(v,g)):g.isPointsMaterial?l(v,g,w,A):g.isSpriteMaterial?c(v,g):g.isShadowMaterial?(v.color.value.copy(g.color),v.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function s(v,g){v.opacity.value=g.opacity,g.color&&v.diffuse.value.copy(g.color),g.emissive&&v.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(v.map.value=g.map,t(g.map,v.mapTransform)),g.alphaMap&&(v.alphaMap.value=g.alphaMap,t(g.alphaMap,v.alphaMapTransform)),g.bumpMap&&(v.bumpMap.value=g.bumpMap,t(g.bumpMap,v.bumpMapTransform),v.bumpScale.value=g.bumpScale,g.side===As&&(v.bumpScale.value*=-1)),g.normalMap&&(v.normalMap.value=g.normalMap,t(g.normalMap,v.normalMapTransform),v.normalScale.value.copy(g.normalScale),g.side===As&&v.normalScale.value.negate()),g.displacementMap&&(v.displacementMap.value=g.displacementMap,t(g.displacementMap,v.displacementMapTransform),v.displacementScale.value=g.displacementScale,v.displacementBias.value=g.displacementBias),g.emissiveMap&&(v.emissiveMap.value=g.emissiveMap,t(g.emissiveMap,v.emissiveMapTransform)),g.specularMap&&(v.specularMap.value=g.specularMap,t(g.specularMap,v.specularMapTransform)),g.alphaTest>0&&(v.alphaTest.value=g.alphaTest);const w=e.get(g),A=w.envMap,T=w.envMapRotation;A&&(v.envMap.value=A,Sh.copy(T),Sh.x*=-1,Sh.y*=-1,Sh.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(Sh.y*=-1,Sh.z*=-1),v.envMapRotation.value.setFromMatrix4(lEe.makeRotationFromEuler(Sh)),v.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,v.reflectivity.value=g.reflectivity,v.ior.value=g.ior,v.refractionRatio.value=g.refractionRatio),g.lightMap&&(v.lightMap.value=g.lightMap,v.lightMapIntensity.value=g.lightMapIntensity,t(g.lightMap,v.lightMapTransform)),g.aoMap&&(v.aoMap.value=g.aoMap,v.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,v.aoMapTransform))}function o(v,g){v.diffuse.value.copy(g.color),v.opacity.value=g.opacity,g.map&&(v.map.value=g.map,t(g.map,v.mapTransform))}function a(v,g){v.dashSize.value=g.dashSize,v.totalSize.value=g.dashSize+g.gapSize,v.scale.value=g.scale}function l(v,g,w,A){v.diffuse.value.copy(g.color),v.opacity.value=g.opacity,v.size.value=g.size*w,v.scale.value=A*.5,g.map&&(v.map.value=g.map,t(g.map,v.uvTransform)),g.alphaMap&&(v.alphaMap.value=g.alphaMap,t(g.alphaMap,v.alphaMapTransform)),g.alphaTest>0&&(v.alphaTest.value=g.alphaTest)}function c(v,g){v.diffuse.value.copy(g.color),v.opacity.value=g.opacity,v.rotation.value=g.rotation,g.map&&(v.map.value=g.map,t(g.map,v.mapTransform)),g.alphaMap&&(v.alphaMap.value=g.alphaMap,t(g.alphaMap,v.alphaMapTransform)),g.alphaTest>0&&(v.alphaTest.value=g.alphaTest)}function u(v,g){v.specular.value.copy(g.specular),v.shininess.value=Math.max(g.shininess,1e-4)}function h(v,g){g.gradientMap&&(v.gradientMap.value=g.gradientMap)}function f(v,g){v.metalness.value=g.metalness,g.metalnessMap&&(v.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,v.metalnessMapTransform)),v.roughness.value=g.roughness,g.roughnessMap&&(v.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,v.roughnessMapTransform)),g.envMap&&(v.envMapIntensity.value=g.envMapIntensity)}function m(v,g,w){v.ior.value=g.ior,g.sheen>0&&(v.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),v.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(v.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,v.sheenColorMapTransform)),g.sheenRoughnessMap&&(v.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,v.sheenRoughnessMapTransform))),g.clearcoat>0&&(v.clearcoat.value=g.clearcoat,v.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(v.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,v.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(v.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,v.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(v.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,v.clearcoatNormalMapTransform),v.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===As&&v.clearcoatNormalScale.value.negate())),g.dispersion>0&&(v.dispersion.value=g.dispersion),g.iridescence>0&&(v.iridescence.value=g.iridescence,v.iridescenceIOR.value=g.iridescenceIOR,v.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],v.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(v.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,v.iridescenceMapTransform)),g.iridescenceThicknessMap&&(v.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,v.iridescenceThicknessMapTransform))),g.transmission>0&&(v.transmission.value=g.transmission,v.transmissionSamplerMap.value=w.texture,v.transmissionSamplerSize.value.set(w.width,w.height),g.transmissionMap&&(v.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,v.transmissionMapTransform)),v.thickness.value=g.thickness,g.thicknessMap&&(v.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,v.thicknessMapTransform)),v.attenuationDistance.value=g.attenuationDistance,v.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(v.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(v.anisotropyMap.value=g.anisotropyMap,t(g.anisotropyMap,v.anisotropyMapTransform))),v.specularIntensity.value=g.specularIntensity,v.specularColor.value.copy(g.specularColor),g.specularColorMap&&(v.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,v.specularColorMapTransform)),g.specularIntensityMap&&(v.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,v.specularIntensityMapTransform))}function y(v,g){g.matcap&&(v.matcap.value=g.matcap)}function _(v,g){const w=e.get(g).light;v.referencePosition.value.setFromMatrixPosition(w.matrixWorld),v.nearDistance.value=w.shadow.camera.near,v.farDistance.value=w.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function uEe(n,e,t,i){let r={},s={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(w,A){const T=A.program;i.uniformBlockBinding(w,T)}function c(w,A){let T=r[w.id];T===void 0&&(y(w),T=u(w),r[w.id]=T,w.addEventListener("dispose",v));const L=A.program;i.updateUBOMapping(w,L);const D=e.render.frame;s[w.id]!==D&&(f(w),s[w.id]=D)}function u(w){const A=h();w.__bindingPointIndex=A;const T=n.createBuffer(),L=w.__size,D=w.usage;return n.bindBuffer(n.UNIFORM_BUFFER,T),n.bufferData(n.UNIFORM_BUFFER,L,D),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,A,T),T}function h(){for(let w=0;w<a;w++)if(o.indexOf(w)===-1)return o.push(w),w;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(w){const A=r[w.id],T=w.uniforms,L=w.__cache;n.bindBuffer(n.UNIFORM_BUFFER,A);for(let D=0,R=T.length;D<R;D++){const I=Array.isArray(T[D])?T[D]:[T[D]];for(let M=0,C=I.length;M<C;M++){const k=I[M];if(m(k,D,M,L)===!0){const B=k.__offset,O=Array.isArray(k.value)?k.value:[k.value];let X=0;for(let le=0;le<O.length;le++){const ie=O[le],de=_(ie);typeof ie=="number"||typeof ie=="boolean"?(k.__data[0]=ie,n.bufferSubData(n.UNIFORM_BUFFER,B+X,k.__data)):ie.isMatrix3?(k.__data[0]=ie.elements[0],k.__data[1]=ie.elements[1],k.__data[2]=ie.elements[2],k.__data[3]=0,k.__data[4]=ie.elements[3],k.__data[5]=ie.elements[4],k.__data[6]=ie.elements[5],k.__data[7]=0,k.__data[8]=ie.elements[6],k.__data[9]=ie.elements[7],k.__data[10]=ie.elements[8],k.__data[11]=0):(ie.toArray(k.__data,X),X+=de.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,B,k.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function m(w,A,T,L){const D=w.value,R=A+"_"+T;if(L[R]===void 0)return typeof D=="number"||typeof D=="boolean"?L[R]=D:L[R]=D.clone(),!0;{const I=L[R];if(typeof D=="number"||typeof D=="boolean"){if(I!==D)return L[R]=D,!0}else if(I.equals(D)===!1)return I.copy(D),!0}return!1}function y(w){const A=w.uniforms;let T=0;const L=16;for(let R=0,I=A.length;R<I;R++){const M=Array.isArray(A[R])?A[R]:[A[R]];for(let C=0,k=M.length;C<k;C++){const B=M[C],O=Array.isArray(B.value)?B.value:[B.value];for(let X=0,le=O.length;X<le;X++){const ie=O[X],de=_(ie),G=T%L,$=G%de.boundary,te=G+$;T+=$,te!==0&&L-te<de.storage&&(T+=L-te),B.__data=new Float32Array(de.storage/Float32Array.BYTES_PER_ELEMENT),B.__offset=T,T+=de.storage}}}const D=T%L;return D>0&&(T+=L-D),w.__size=T,w.__cache={},this}function _(w){const A={boundary:0,storage:0};return typeof w=="number"||typeof w=="boolean"?(A.boundary=4,A.storage=4):w.isVector2?(A.boundary=8,A.storage=8):w.isVector3||w.isColor?(A.boundary=16,A.storage=12):w.isVector4?(A.boundary=16,A.storage=16):w.isMatrix3?(A.boundary=48,A.storage=48):w.isMatrix4?(A.boundary=64,A.storage=64):w.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",w),A}function v(w){const A=w.target;A.removeEventListener("dispose",v);const T=o.indexOf(A.__bindingPointIndex);o.splice(T,1),n.deleteBuffer(r[A.id]),delete r[A.id],delete s[A.id]}function g(){for(const w in r)n.deleteBuffer(r[w]);o=[],r={},s={}}return{bind:l,update:c,dispose:g}}class CD{constructor(e={}){const{canvas:t=xK(),context:i=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1,reverseDepthBuffer:f=!1}=e;this.isWebGLRenderer=!0;let m;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=i.getContextAttributes().alpha}else m=o;const y=new Uint32Array(4),_=new Int32Array(4);let v=null,g=null;const w=[],A=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=ys,this.toneMapping=el,this.toneMappingExposure=1;const T=this;let L=!1,D=0,R=0,I=null,M=-1,C=null;const k=new Bn,B=new Bn;let O=null;const X=new ft(0);let le=0,ie=t.width,de=t.height,G=1,$=null,te=null;const ue=new Bn(0,0,ie,de),ve=new Bn(0,0,ie,de);let be=!1;const he=new Fv;let Pe=!1,Oe=!1;const Ce=new qt,mt=new qt,Lt=new q,St=new Bn,Nt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ke=!1;function Ue(){return I===null?G:1}let ee=i;function xt(z,J){return t.getContext(z,J)}try{const z={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Rv}`),t.addEventListener("webglcontextlost",De,!1),t.addEventListener("webglcontextrestored",ot,!1),t.addEventListener("webglcontextcreationerror",it,!1),ee===null){const J="webgl2";if(ee=xt(J,z),ee===null)throw xt(J)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(z){throw console.error("THREE.WebGLRenderer: "+z.message),z}let je,ht,$e,Mt,lt,Y,j,pe,Ie,ze,Ee,tt,nt,ct,Yt,Xe,dt,It,gt,ut,oe,Te,Ye,se;function ye(){je=new gwe(ee),je.init(),Te=new NK(ee,je),ht=new uwe(ee,je,e,Te),$e=new $1e(ee,je),ht.reverseDepthBuffer&&f&&$e.buffers.depth.setReversed(!0),Mt=new _we(ee),lt=new O1e,Y=new nEe(ee,je,$e,lt,ht,Te,Mt),j=new dwe(T),pe=new mwe(T),Ie=new bve(ee),Ye=new lwe(ee,Ie),ze=new ywe(ee,Ie,Mt,Ye),Ee=new wwe(ee,ze,Ie,Mt),gt=new xwe(ee,ht,Y),Xe=new hwe(lt),tt=new B1e(T,j,pe,je,ht,Ye,Xe),nt=new cEe(T,lt),ct=new U1e,Yt=new W1e(je),It=new awe(T,j,pe,$e,Ee,m,l),dt=new q1e(T,Ee,ht),se=new uEe(ee,Mt,ht,$e),ut=new cwe(ee,je,Mt),oe=new vwe(ee,je,Mt),Mt.programs=tt.programs,T.capabilities=ht,T.extensions=je,T.properties=lt,T.renderLists=ct,T.shadowMap=dt,T.state=$e,T.info=Mt}ye();const we=new aEe(T,ee);this.xr=we,this.getContext=function(){return ee},this.getContextAttributes=function(){return ee.getContextAttributes()},this.forceContextLoss=function(){const z=je.get("WEBGL_lose_context");z&&z.loseContext()},this.forceContextRestore=function(){const z=je.get("WEBGL_lose_context");z&&z.restoreContext()},this.getPixelRatio=function(){return G},this.setPixelRatio=function(z){z!==void 0&&(G=z,this.setSize(ie,de,!1))},this.getSize=function(z){return z.set(ie,de)},this.setSize=function(z,J,ne=!0){if(we.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}ie=z,de=J,t.width=Math.floor(z*G),t.height=Math.floor(J*G),ne===!0&&(t.style.width=z+"px",t.style.height=J+"px"),this.setViewport(0,0,z,J)},this.getDrawingBufferSize=function(z){return z.set(ie*G,de*G).floor()},this.setDrawingBufferSize=function(z,J,ne){ie=z,de=J,G=ne,t.width=Math.floor(z*ne),t.height=Math.floor(J*ne),this.setViewport(0,0,z,J)},this.getCurrentViewport=function(z){return z.copy(k)},this.getViewport=function(z){return z.copy(ue)},this.setViewport=function(z,J,ne,re){z.isVector4?ue.set(z.x,z.y,z.z,z.w):ue.set(z,J,ne,re),$e.viewport(k.copy(ue).multiplyScalar(G).round())},this.getScissor=function(z){return z.copy(ve)},this.setScissor=function(z,J,ne,re){z.isVector4?ve.set(z.x,z.y,z.z,z.w):ve.set(z,J,ne,re),$e.scissor(B.copy(ve).multiplyScalar(G).round())},this.getScissorTest=function(){return be},this.setScissorTest=function(z){$e.setScissorTest(be=z)},this.setOpaqueSort=function(z){$=z},this.setTransparentSort=function(z){te=z},this.getClearColor=function(z){return z.copy(It.getClearColor())},this.setClearColor=function(){It.setClearColor.apply(It,arguments)},this.getClearAlpha=function(){return It.getClearAlpha()},this.setClearAlpha=function(){It.setClearAlpha.apply(It,arguments)},this.clear=function(z=!0,J=!0,ne=!0){let re=0;if(z){let Q=!1;if(I!==null){const ge=I.texture.format;Q=ge===mS||ge===pS||ge===Lv}if(Q){const ge=I.texture.type,_e=ge===Ws||ge===ll||ge===_m||ge===Fd||ge===dS||ge===fS,Ze=It.getClearColor(),Be=It.getClearAlpha(),Ge=Ze.r,Je=Ze.g,We=Ze.b;_e?(y[0]=Ge,y[1]=Je,y[2]=We,y[3]=Be,ee.clearBufferuiv(ee.COLOR,0,y)):(_[0]=Ge,_[1]=Je,_[2]=We,_[3]=Be,ee.clearBufferiv(ee.COLOR,0,_))}else re|=ee.COLOR_BUFFER_BIT}J&&(re|=ee.DEPTH_BUFFER_BIT),ne&&(re|=ee.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ee.clear(re)},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",De,!1),t.removeEventListener("webglcontextrestored",ot,!1),t.removeEventListener("webglcontextcreationerror",it,!1),ct.dispose(),Yt.dispose(),lt.dispose(),j.dispose(),pe.dispose(),Ee.dispose(),Ye.dispose(),se.dispose(),tt.dispose(),we.dispose(),we.removeEventListener("sessionstart",wr),we.removeEventListener("sessionend",mi),jn.stop()};function De(z){z.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),L=!0}function ot(){console.log("THREE.WebGLRenderer: Context Restored."),L=!1;const z=Mt.autoReset,J=dt.enabled,ne=dt.autoUpdate,re=dt.needsUpdate,Q=dt.type;ye(),Mt.autoReset=z,dt.enabled=J,dt.autoUpdate=ne,dt.needsUpdate=re,dt.type=Q}function it(z){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",z.statusMessage)}function Ke(z){const J=z.target;J.removeEventListener("dispose",Ke),Et(J)}function Et(z){Gt(z),lt.remove(z)}function Gt(z){const J=lt.get(z).programs;J!==void 0&&(J.forEach(function(ne){tt.releaseProgram(ne)}),z.isShaderMaterial&&tt.releaseShaderCache(z))}this.renderBufferDirect=function(z,J,ne,re,Q,ge){J===null&&(J=Nt);const _e=Q.isMesh&&Q.matrixWorld.determinant()<0,Ze=ae(z,J,ne,re,Q);$e.setMaterial(re,_e);let Be=ne.index,Ge=1;if(re.wireframe===!0){if(Be=ze.getWireframeAttribute(ne),Be===void 0)return;Ge=2}const Je=ne.drawRange,We=ne.attributes.position;let Tt=Je.start*Ge,Rt=(Je.start+Je.count)*Ge;ge!==null&&(Tt=Math.max(Tt,ge.start*Ge),Rt=Math.min(Rt,(ge.start+ge.count)*Ge)),Be!==null?(Tt=Math.max(Tt,0),Rt=Math.min(Rt,Be.count)):We!=null&&(Tt=Math.max(Tt,0),Rt=Math.min(Rt,We.count));const vt=Rt-Tt;if(vt<0||vt===1/0)return;Ye.setup(Q,re,Ze,ne,Be);let Ft,At=ut;if(Be!==null&&(Ft=Ie.get(Be),At=oe,At.setIndex(Ft)),Q.isMesh)re.wireframe===!0?($e.setLineWidth(re.wireframeLinewidth*Ue()),At.setMode(ee.LINES)):At.setMode(ee.TRIANGLES);else if(Q.isLine){let rt=re.linewidth;rt===void 0&&(rt=1),$e.setLineWidth(rt*Ue()),Q.isLineSegments?At.setMode(ee.LINES):Q.isLineLoop?At.setMode(ee.LINE_LOOP):At.setMode(ee.LINE_STRIP)}else Q.isPoints?At.setMode(ee.POINTS):Q.isSprite&&At.setMode(ee.TRIANGLES);if(Q.isBatchedMesh)if(Q._multiDrawInstances!==null)At.renderMultiDrawInstances(Q._multiDrawStarts,Q._multiDrawCounts,Q._multiDrawCount,Q._multiDrawInstances);else if(je.get("WEBGL_multi_draw"))At.renderMultiDraw(Q._multiDrawStarts,Q._multiDrawCounts,Q._multiDrawCount);else{const rt=Q._multiDrawStarts,Wt=Q._multiDrawCounts,Ut=Q._multiDrawCount,Wn=Be?Ie.get(Be).bytesPerElement:1,Yn=lt.get(re).currentProgram.getUniforms();for(let Pn=0;Pn<Ut;Pn++)Yn.setValue(ee,"_gl_DrawID",Pn),At.render(rt[Pn]/Wn,Wt[Pn])}else if(Q.isInstancedMesh)At.renderInstances(Tt,vt,Q.count);else if(ne.isInstancedBufferGeometry){const rt=ne._maxInstanceCount!==void 0?ne._maxInstanceCount:1/0,Wt=Math.min(ne.instanceCount,rt);At.renderInstances(Tt,vt,Wt)}else At.render(Tt,vt)};function Vt(z,J,ne){z.transparent===!0&&z.side===No&&z.forceSinglePass===!1?(z.side=As,z.needsUpdate=!0,Xs(z,J,ne),z.side=ol,z.needsUpdate=!0,Xs(z,J,ne),z.side=No):Xs(z,J,ne)}this.compile=function(z,J,ne=null){ne===null&&(ne=z),g=Yt.get(ne),g.init(J),A.push(g),ne.traverseVisible(function(Q){Q.isLight&&Q.layers.test(J.layers)&&(g.pushLight(Q),Q.castShadow&&g.pushShadow(Q))}),z!==ne&&z.traverseVisible(function(Q){Q.isLight&&Q.layers.test(J.layers)&&(g.pushLight(Q),Q.castShadow&&g.pushShadow(Q))}),g.setupLights();const re=new Set;return z.traverse(function(Q){if(!(Q.isMesh||Q.isPoints||Q.isLine||Q.isSprite))return;const ge=Q.material;if(ge)if(Array.isArray(ge))for(let _e=0;_e<ge.length;_e++){const Ze=ge[_e];Vt(Ze,ne,Q),re.add(Ze)}else Vt(ge,ne,Q),re.add(ge)}),A.pop(),g=null,re},this.compileAsync=function(z,J,ne=null){const re=this.compile(z,J,ne);return new Promise(Q=>{function ge(){if(re.forEach(function(_e){lt.get(_e).currentProgram.isReady()&&re.delete(_e)}),re.size===0){Q(z);return}setTimeout(ge,10)}je.get("KHR_parallel_shader_compile")!==null?ge():setTimeout(ge,10)})};let _n=null;function sn(z){_n&&_n(z)}function wr(){jn.stop()}function mi(){jn.start()}const jn=new CK;jn.setAnimationLoop(sn),typeof self<"u"&&jn.setContext(self),this.setAnimationLoop=function(z){_n=z,we.setAnimationLoop(z),z===null?jn.stop():jn.start()},we.addEventListener("sessionstart",wr),we.addEventListener("sessionend",mi),this.render=function(z,J){if(J!==void 0&&J.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;if(z.matrixWorldAutoUpdate===!0&&z.updateMatrixWorld(),J.parent===null&&J.matrixWorldAutoUpdate===!0&&J.updateMatrixWorld(),we.enabled===!0&&we.isPresenting===!0&&(we.cameraAutoUpdate===!0&&we.updateCamera(J),J=we.getCamera()),z.isScene===!0&&z.onBeforeRender(T,z,J,I),g=Yt.get(z,A.length),g.init(J),A.push(g),mt.multiplyMatrices(J.projectionMatrix,J.matrixWorldInverse),he.setFromProjectionMatrix(mt),Oe=this.localClippingEnabled,Pe=Xe.init(this.clippingPlanes,Oe),v=ct.get(z,w.length),v.init(),w.push(v),we.enabled===!0&&we.isPresenting===!0){const ge=T.xr.getDepthSensingMesh();ge!==null&&jo(ge,J,-1/0,T.sortObjects)}jo(z,J,0,T.sortObjects),v.finish(),T.sortObjects===!0&&v.sort($,te),ke=we.enabled===!1||we.isPresenting===!1||we.hasDepthSensing()===!1,ke&&It.addToRenderList(v,z),this.info.render.frame++,Pe===!0&&Xe.beginShadows();const ne=g.state.shadowsArray;dt.render(ne,z,J),Pe===!0&&Xe.endShadows(),this.info.autoReset===!0&&this.info.reset();const re=v.opaque,Q=v.transmissive;if(g.setupLights(),J.isArrayCamera){const ge=J.cameras;if(Q.length>0)for(let _e=0,Ze=ge.length;_e<Ze;_e++){const Be=ge[_e];Di(re,Q,z,Be)}ke&&It.render(z);for(let _e=0,Ze=ge.length;_e<Ze;_e++){const Be=ge[_e];vo(v,z,Be,Be.viewport)}}else Q.length>0&&Di(re,Q,z,J),ke&&It.render(z),vo(v,z,J);I!==null&&(Y.updateMultisampleRenderTarget(I),Y.updateRenderTargetMipmap(I)),z.isScene===!0&&z.onAfterRender(T,z,J),Ye.resetDefaultState(),M=-1,C=null,A.pop(),A.length>0?(g=A[A.length-1],Pe===!0&&Xe.setGlobalState(T.clippingPlanes,g.state.camera)):g=null,w.pop(),w.length>0?v=w[w.length-1]:v=null};function jo(z,J,ne,re){if(z.visible===!1)return;if(z.layers.test(J.layers)){if(z.isGroup)ne=z.renderOrder;else if(z.isLOD)z.autoUpdate===!0&&z.update(J);else if(z.isLight)g.pushLight(z),z.castShadow&&g.pushShadow(z);else if(z.isSprite){if(!z.frustumCulled||he.intersectsSprite(z)){re&&St.setFromMatrixPosition(z.matrixWorld).applyMatrix4(mt);const _e=Ee.update(z),Ze=z.material;Ze.visible&&v.push(z,_e,Ze,ne,St.z,null)}}else if((z.isMesh||z.isLine||z.isPoints)&&(!z.frustumCulled||he.intersectsObject(z))){const _e=Ee.update(z),Ze=z.material;if(re&&(z.boundingSphere!==void 0?(z.boundingSphere===null&&z.computeBoundingSphere(),St.copy(z.boundingSphere.center)):(_e.boundingSphere===null&&_e.computeBoundingSphere(),St.copy(_e.boundingSphere.center)),St.applyMatrix4(z.matrixWorld).applyMatrix4(mt)),Array.isArray(Ze)){const Be=_e.groups;for(let Ge=0,Je=Be.length;Ge<Je;Ge++){const We=Be[Ge],Tt=Ze[We.materialIndex];Tt&&Tt.visible&&v.push(z,_e,Tt,ne,St.z,We)}}else Ze.visible&&v.push(z,_e,Ze,ne,St.z,null)}}const ge=z.children;for(let _e=0,Ze=ge.length;_e<Ze;_e++)jo(ge[_e],J,ne,re)}function vo(z,J,ne,re){const Q=z.opaque,ge=z.transmissive,_e=z.transparent;g.setupLightsView(ne),Pe===!0&&Xe.setGlobalState(T.clippingPlanes,ne),re&&$e.viewport(k.copy(re)),Q.length>0&&tn(Q,J,ne),ge.length>0&&tn(ge,J,ne),_e.length>0&&tn(_e,J,ne),$e.buffers.depth.setTest(!0),$e.buffers.depth.setMask(!0),$e.buffers.color.setMask(!0),$e.setPolygonOffset(!1)}function Di(z,J,ne,re){if((ne.isScene===!0?ne.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[re.id]===void 0&&(g.state.transmissionRenderTarget[re.id]=new Ss(1,1,{generateMipmaps:!0,type:je.has("EXT_color_buffer_half_float")||je.has("EXT_color_buffer_float")?yr:Ws,minFilter:Oo,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Mn.workingColorSpace}));const ge=g.state.transmissionRenderTarget[re.id],_e=re.viewport||k;ge.setSize(_e.z,_e.w);const Ze=T.getRenderTarget();T.setRenderTarget(ge),T.getClearColor(X),le=T.getClearAlpha(),le<1&&T.setClearColor(16777215,.5),T.clear(),ke&&It.render(ne);const Be=T.toneMapping;T.toneMapping=el;const Ge=re.viewport;if(re.viewport!==void 0&&(re.viewport=void 0),g.setupLightsView(re),Pe===!0&&Xe.setGlobalState(T.clippingPlanes,re),tn(z,ne,re),Y.updateMultisampleRenderTarget(ge),Y.updateRenderTargetMipmap(ge),je.has("WEBGL_multisampled_render_to_texture")===!1){let Je=!1;for(let We=0,Tt=J.length;We<Tt;We++){const Rt=J[We],vt=Rt.object,Ft=Rt.geometry,At=Rt.material,rt=Rt.group;if(At.side===No&&vt.layers.test(re.layers)){const Wt=At.side;At.side=As,At.needsUpdate=!0,dl(vt,ne,re,Ft,At,rt),At.side=Wt,At.needsUpdate=!0,Je=!0}}Je===!0&&(Y.updateMultisampleRenderTarget(ge),Y.updateRenderTargetMipmap(ge))}T.setRenderTarget(Ze),T.setClearColor(X,le),Ge!==void 0&&(re.viewport=Ge),T.toneMapping=Be}function tn(z,J,ne){const re=J.isScene===!0?J.overrideMaterial:null;for(let Q=0,ge=z.length;Q<ge;Q++){const _e=z[Q],Ze=_e.object,Be=_e.geometry,Ge=re===null?_e.material:re,Je=_e.group;Ze.layers.test(ne.layers)&&dl(Ze,J,ne,Be,Ge,Je)}}function dl(z,J,ne,re,Q,ge){z.onBeforeRender(T,J,ne,re,Q,ge),z.modelViewMatrix.multiplyMatrices(ne.matrixWorldInverse,z.matrixWorld),z.normalMatrix.getNormalMatrix(z.modelViewMatrix),Q.onBeforeRender(T,J,ne,re,z,ge),Q.transparent===!0&&Q.side===No&&Q.forceSinglePass===!1?(Q.side=As,Q.needsUpdate=!0,T.renderBufferDirect(ne,J,re,Q,z,ge),Q.side=ol,Q.needsUpdate=!0,T.renderBufferDirect(ne,J,re,Q,z,ge),Q.side=No):T.renderBufferDirect(ne,J,re,Q,z,ge),z.onAfterRender(T,J,ne,re,Q,ge)}function Xs(z,J,ne){J.isScene!==!0&&(J=Nt);const re=lt.get(z),Q=g.state.lights,ge=g.state.shadowsArray,_e=Q.state.version,Ze=tt.getParameters(z,Q.state,ge,J,ne),Be=tt.getProgramCacheKey(Ze);let Ge=re.programs;re.environment=z.isMeshStandardMaterial?J.environment:null,re.fog=J.fog,re.envMap=(z.isMeshStandardMaterial?pe:j).get(z.envMap||re.environment),re.envMapRotation=re.environment!==null&&z.envMap===null?J.environmentRotation:z.envMapRotation,Ge===void 0&&(z.addEventListener("dispose",Ke),Ge=new Map,re.programs=Ge);let Je=Ge.get(Be);if(Je!==void 0){if(re.currentProgram===Je&&re.lightsStateVersion===_e)return K(z,Ze),Je}else Ze.uniforms=tt.getUniforms(z),z.onBeforeCompile(Ze,T),Je=tt.acquireProgram(Ze,Be),Ge.set(Be,Je),re.uniforms=Ze.uniforms;const We=re.uniforms;return(!z.isShaderMaterial&&!z.isRawShaderMaterial||z.clipping===!0)&&(We.clippingPlanes=Xe.uniform),K(z,Ze),re.needsLights=Me(z),re.lightsStateVersion=_e,re.needsLights&&(We.ambientLightColor.value=Q.state.ambient,We.lightProbe.value=Q.state.probe,We.directionalLights.value=Q.state.directional,We.directionalLightShadows.value=Q.state.directionalShadow,We.spotLights.value=Q.state.spot,We.spotLightShadows.value=Q.state.spotShadow,We.rectAreaLights.value=Q.state.rectArea,We.ltc_1.value=Q.state.rectAreaLTC1,We.ltc_2.value=Q.state.rectAreaLTC2,We.pointLights.value=Q.state.point,We.pointLightShadows.value=Q.state.pointShadow,We.hemisphereLights.value=Q.state.hemi,We.directionalShadowMap.value=Q.state.directionalShadowMap,We.directionalShadowMatrix.value=Q.state.directionalShadowMatrix,We.spotShadowMap.value=Q.state.spotShadowMap,We.spotLightMatrix.value=Q.state.spotLightMatrix,We.spotLightMap.value=Q.state.spotLightMap,We.pointShadowMap.value=Q.state.pointShadowMap,We.pointShadowMatrix.value=Q.state.pointShadowMatrix),re.currentProgram=Je,re.uniformsList=null,Je}function H(z){if(z.uniformsList===null){const J=z.currentProgram.getUniforms();z.uniformsList=Kw.seqWithValue(J.seq,z.uniforms)}return z.uniformsList}function K(z,J){const ne=lt.get(z);ne.outputColorSpace=J.outputColorSpace,ne.batching=J.batching,ne.batchingColor=J.batchingColor,ne.instancing=J.instancing,ne.instancingColor=J.instancingColor,ne.instancingMorph=J.instancingMorph,ne.skinning=J.skinning,ne.morphTargets=J.morphTargets,ne.morphNormals=J.morphNormals,ne.morphColors=J.morphColors,ne.morphTargetsCount=J.morphTargetsCount,ne.numClippingPlanes=J.numClippingPlanes,ne.numIntersection=J.numClipIntersection,ne.vertexAlphas=J.vertexAlphas,ne.vertexTangents=J.vertexTangents,ne.toneMapping=J.toneMapping}function ae(z,J,ne,re,Q){J.isScene!==!0&&(J=Nt),Y.resetTextureUnits();const ge=J.fog,_e=re.isMeshStandardMaterial?J.environment:null,Ze=I===null?T.outputColorSpace:I.isXRRenderTarget===!0?I.texture.colorSpace:cl,Be=(re.isMeshStandardMaterial?pe:j).get(re.envMap||_e),Ge=re.vertexColors===!0&&!!ne.attributes.color&&ne.attributes.color.itemSize===4,Je=!!ne.attributes.tangent&&(!!re.normalMap||re.anisotropy>0),We=!!ne.morphAttributes.position,Tt=!!ne.morphAttributes.normal,Rt=!!ne.morphAttributes.color;let vt=el;re.toneMapped&&(I===null||I.isXRRenderTarget===!0)&&(vt=T.toneMapping);const Ft=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,At=Ft!==void 0?Ft.length:0,rt=lt.get(re),Wt=g.state.lights;if(Pe===!0&&(Oe===!0||z!==C)){const hn=z===C&&re.id===M;Xe.setState(re,z,hn)}let Ut=!1;re.version===rt.__version?(rt.needsLights&&rt.lightsStateVersion!==Wt.state.version||rt.outputColorSpace!==Ze||Q.isBatchedMesh&&rt.batching===!1||!Q.isBatchedMesh&&rt.batching===!0||Q.isBatchedMesh&&rt.batchingColor===!0&&Q.colorTexture===null||Q.isBatchedMesh&&rt.batchingColor===!1&&Q.colorTexture!==null||Q.isInstancedMesh&&rt.instancing===!1||!Q.isInstancedMesh&&rt.instancing===!0||Q.isSkinnedMesh&&rt.skinning===!1||!Q.isSkinnedMesh&&rt.skinning===!0||Q.isInstancedMesh&&rt.instancingColor===!0&&Q.instanceColor===null||Q.isInstancedMesh&&rt.instancingColor===!1&&Q.instanceColor!==null||Q.isInstancedMesh&&rt.instancingMorph===!0&&Q.morphTexture===null||Q.isInstancedMesh&&rt.instancingMorph===!1&&Q.morphTexture!==null||rt.envMap!==Be||re.fog===!0&&rt.fog!==ge||rt.numClippingPlanes!==void 0&&(rt.numClippingPlanes!==Xe.numPlanes||rt.numIntersection!==Xe.numIntersection)||rt.vertexAlphas!==Ge||rt.vertexTangents!==Je||rt.morphTargets!==We||rt.morphNormals!==Tt||rt.morphColors!==Rt||rt.toneMapping!==vt||rt.morphTargetsCount!==At)&&(Ut=!0):(Ut=!0,rt.__version=re.version);let Wn=rt.currentProgram;Ut===!0&&(Wn=Xs(re,J,Q));let Yn=!1,Pn=!1,gn=!1;const Zt=Wn.getUniforms(),$t=rt.uniforms;if($e.useProgram(Wn.program)&&(Yn=!0,Pn=!0,gn=!0),re.id!==M&&(M=re.id,Pn=!0),Yn||C!==z){$e.buffers.depth.getReversed()?(Ce.copy(z.projectionMatrix),Q0e(Ce),Z0e(Ce),Zt.setValue(ee,"projectionMatrix",Ce)):Zt.setValue(ee,"projectionMatrix",z.projectionMatrix),Zt.setValue(ee,"viewMatrix",z.matrixWorldInverse);const yi=Zt.map.cameraPosition;yi!==void 0&&yi.setValue(ee,Lt.setFromMatrixPosition(z.matrixWorld)),ht.logarithmicDepthBuffer&&Zt.setValue(ee,"logDepthBufFC",2/(Math.log(z.far+1)/Math.LN2)),(re.isMeshPhongMaterial||re.isMeshToonMaterial||re.isMeshLambertMaterial||re.isMeshBasicMaterial||re.isMeshStandardMaterial||re.isShaderMaterial)&&Zt.setValue(ee,"isOrthographic",z.isOrthographicCamera===!0),C!==z&&(C=z,Pn=!0,gn=!0)}if(Q.isSkinnedMesh){Zt.setOptional(ee,Q,"bindMatrix"),Zt.setOptional(ee,Q,"bindMatrixInverse");const hn=Q.skeleton;hn&&(hn.boneTexture===null&&hn.computeBoneTexture(),Zt.setValue(ee,"boneTexture",hn.boneTexture,Y))}Q.isBatchedMesh&&(Zt.setOptional(ee,Q,"batchingTexture"),Zt.setValue(ee,"batchingTexture",Q._matricesTexture,Y),Zt.setOptional(ee,Q,"batchingIdTexture"),Zt.setValue(ee,"batchingIdTexture",Q._indirectTexture,Y),Zt.setOptional(ee,Q,"batchingColorTexture"),Q._colorsTexture!==null&&Zt.setValue(ee,"batchingColorTexture",Q._colorsTexture,Y));const Jt=ne.morphAttributes;if((Jt.position!==void 0||Jt.normal!==void 0||Jt.color!==void 0)&&gt.update(Q,ne,Wn),(Pn||rt.receiveShadow!==Q.receiveShadow)&&(rt.receiveShadow=Q.receiveShadow,Zt.setValue(ee,"receiveShadow",Q.receiveShadow)),re.isMeshGouraudMaterial&&re.envMap!==null&&($t.envMap.value=Be,$t.flipEnvMap.value=Be.isCubeTexture&&Be.isRenderTargetTexture===!1?-1:1),re.isMeshStandardMaterial&&re.envMap===null&&J.environment!==null&&($t.envMapIntensity.value=J.environmentIntensity),Pn&&(Zt.setValue(ee,"toneMappingExposure",T.toneMappingExposure),rt.needsLights&&xe($t,gn),ge&&re.fog===!0&&nt.refreshFogUniforms($t,ge),nt.refreshMaterialUniforms($t,re,G,de,g.state.transmissionRenderTarget[z.id]),Kw.upload(ee,H(rt),$t,Y)),re.isShaderMaterial&&re.uniformsNeedUpdate===!0&&(Kw.upload(ee,H(rt),$t,Y),re.uniformsNeedUpdate=!1),re.isSpriteMaterial&&Zt.setValue(ee,"center",Q.center),Zt.setValue(ee,"modelViewMatrix",Q.modelViewMatrix),Zt.setValue(ee,"normalMatrix",Q.normalMatrix),Zt.setValue(ee,"modelMatrix",Q.matrixWorld),re.isShaderMaterial||re.isRawShaderMaterial){const hn=re.uniformsGroups;for(let yi=0,ei=hn.length;yi<ei;yi++){const yn=hn[yi];se.update(yn,Wn),se.bind(yn,Wn)}}return Wn}function xe(z,J){z.ambientLightColor.needsUpdate=J,z.lightProbe.needsUpdate=J,z.directionalLights.needsUpdate=J,z.directionalLightShadows.needsUpdate=J,z.pointLights.needsUpdate=J,z.pointLightShadows.needsUpdate=J,z.spotLights.needsUpdate=J,z.spotLightShadows.needsUpdate=J,z.rectAreaLights.needsUpdate=J,z.hemisphereLights.needsUpdate=J}function Me(z){return z.isMeshLambertMaterial||z.isMeshToonMaterial||z.isMeshPhongMaterial||z.isMeshStandardMaterial||z.isShadowMaterial||z.isShaderMaterial&&z.lights===!0}this.getActiveCubeFace=function(){return D},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return I},this.setRenderTargetTextures=function(z,J,ne){lt.get(z.texture).__webglTexture=J,lt.get(z.depthTexture).__webglTexture=ne;const re=lt.get(z);re.__hasExternalTextures=!0,re.__autoAllocateDepthBuffer=ne===void 0,re.__autoAllocateDepthBuffer||je.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),re.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(z,J){const ne=lt.get(z);ne.__webglFramebuffer=J,ne.__useDefaultFramebuffer=J===void 0},this.setRenderTarget=function(z,J=0,ne=0){I=z,D=J,R=ne;let re=!0,Q=null,ge=!1,_e=!1;if(z){const Be=lt.get(z);if(Be.__useDefaultFramebuffer!==void 0)$e.bindFramebuffer(ee.FRAMEBUFFER,null),re=!1;else if(Be.__webglFramebuffer===void 0)Y.setupRenderTarget(z);else if(Be.__hasExternalTextures)Y.rebindTextures(z,lt.get(z.texture).__webglTexture,lt.get(z.depthTexture).__webglTexture);else if(z.depthBuffer){const We=z.depthTexture;if(Be.__boundDepthTexture!==We){if(We!==null&&lt.has(We)&&(z.width!==We.image.width||z.height!==We.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");Y.setupDepthRenderbuffer(z)}}const Ge=z.texture;(Ge.isData3DTexture||Ge.isDataArrayTexture||Ge.isCompressedArrayTexture)&&(_e=!0);const Je=lt.get(z).__webglFramebuffer;z.isWebGLCubeRenderTarget?(Array.isArray(Je[J])?Q=Je[J][ne]:Q=Je[J],ge=!0):z.samples>0&&Y.useMultisampledRTT(z)===!1?Q=lt.get(z).__webglMultisampledFramebuffer:Array.isArray(Je)?Q=Je[ne]:Q=Je,k.copy(z.viewport),B.copy(z.scissor),O=z.scissorTest}else k.copy(ue).multiplyScalar(G).floor(),B.copy(ve).multiplyScalar(G).floor(),O=be;if($e.bindFramebuffer(ee.FRAMEBUFFER,Q)&&re&&$e.drawBuffers(z,Q),$e.viewport(k),$e.scissor(B),$e.setScissorTest(O),ge){const Be=lt.get(z.texture);ee.framebufferTexture2D(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_CUBE_MAP_POSITIVE_X+J,Be.__webglTexture,ne)}else if(_e){const Be=lt.get(z.texture),Ge=J||0;ee.framebufferTextureLayer(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0,Be.__webglTexture,ne||0,Ge)}M=-1},this.readRenderTargetPixels=function(z,J,ne,re,Q,ge,_e){if(!(z&&z.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ze=lt.get(z).__webglFramebuffer;if(z.isWebGLCubeRenderTarget&&_e!==void 0&&(Ze=Ze[_e]),Ze){$e.bindFramebuffer(ee.FRAMEBUFFER,Ze);try{const Be=z.texture,Ge=Be.format,Je=Be.type;if(!ht.textureFormatReadable(Ge)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ht.textureTypeReadable(Je)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}J>=0&&J<=z.width-re&&ne>=0&&ne<=z.height-Q&&ee.readPixels(J,ne,re,Q,Te.convert(Ge),Te.convert(Je),ge)}finally{const Be=I!==null?lt.get(I).__webglFramebuffer:null;$e.bindFramebuffer(ee.FRAMEBUFFER,Be)}}},this.readRenderTargetPixelsAsync=async function(z,J,ne,re,Q,ge,_e){if(!(z&&z.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ze=lt.get(z).__webglFramebuffer;if(z.isWebGLCubeRenderTarget&&_e!==void 0&&(Ze=Ze[_e]),Ze){const Be=z.texture,Ge=Be.format,Je=Be.type;if(!ht.textureFormatReadable(Ge))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ht.textureTypeReadable(Je))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(J>=0&&J<=z.width-re&&ne>=0&&ne<=z.height-Q){$e.bindFramebuffer(ee.FRAMEBUFFER,Ze);const We=ee.createBuffer();ee.bindBuffer(ee.PIXEL_PACK_BUFFER,We),ee.bufferData(ee.PIXEL_PACK_BUFFER,ge.byteLength,ee.STREAM_READ),ee.readPixels(J,ne,re,Q,Te.convert(Ge),Te.convert(Je),0);const Tt=I!==null?lt.get(I).__webglFramebuffer:null;$e.bindFramebuffer(ee.FRAMEBUFFER,Tt);const Rt=ee.fenceSync(ee.SYNC_GPU_COMMANDS_COMPLETE,0);return ee.flush(),await J0e(ee,Rt,4),ee.bindBuffer(ee.PIXEL_PACK_BUFFER,We),ee.getBufferSubData(ee.PIXEL_PACK_BUFFER,0,ge),ee.deleteBuffer(We),ee.deleteSync(Rt),ge}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(z,J=null,ne=0){z.isTexture!==!0&&(uy("WebGLRenderer: copyFramebufferToTexture function signature has changed."),J=arguments[0]||null,z=arguments[1]);const re=Math.pow(2,-ne),Q=Math.floor(z.image.width*re),ge=Math.floor(z.image.height*re),_e=J!==null?J.x:0,Ze=J!==null?J.y:0;Y.setTexture2D(z,0),ee.copyTexSubImage2D(ee.TEXTURE_2D,ne,0,0,_e,Ze,Q,ge),$e.unbindTexture()},this.copyTextureToTexture=function(z,J,ne=null,re=null,Q=0){z.isTexture!==!0&&(uy("WebGLRenderer: copyTextureToTexture function signature has changed."),re=arguments[0]||null,z=arguments[1],J=arguments[2],Q=arguments[3]||0,ne=null);let ge,_e,Ze,Be,Ge,Je,We,Tt,Rt;const vt=z.isCompressedTexture?z.mipmaps[Q]:z.image;ne!==null?(ge=ne.max.x-ne.min.x,_e=ne.max.y-ne.min.y,Ze=ne.isBox3?ne.max.z-ne.min.z:1,Be=ne.min.x,Ge=ne.min.y,Je=ne.isBox3?ne.min.z:0):(ge=vt.width,_e=vt.height,Ze=vt.depth||1,Be=0,Ge=0,Je=0),re!==null?(We=re.x,Tt=re.y,Rt=re.z):(We=0,Tt=0,Rt=0);const Ft=Te.convert(J.format),At=Te.convert(J.type);let rt;J.isData3DTexture?(Y.setTexture3D(J,0),rt=ee.TEXTURE_3D):J.isDataArrayTexture||J.isCompressedArrayTexture?(Y.setTexture2DArray(J,0),rt=ee.TEXTURE_2D_ARRAY):(Y.setTexture2D(J,0),rt=ee.TEXTURE_2D),ee.pixelStorei(ee.UNPACK_FLIP_Y_WEBGL,J.flipY),ee.pixelStorei(ee.UNPACK_PREMULTIPLY_ALPHA_WEBGL,J.premultiplyAlpha),ee.pixelStorei(ee.UNPACK_ALIGNMENT,J.unpackAlignment);const Wt=ee.getParameter(ee.UNPACK_ROW_LENGTH),Ut=ee.getParameter(ee.UNPACK_IMAGE_HEIGHT),Wn=ee.getParameter(ee.UNPACK_SKIP_PIXELS),Yn=ee.getParameter(ee.UNPACK_SKIP_ROWS),Pn=ee.getParameter(ee.UNPACK_SKIP_IMAGES);ee.pixelStorei(ee.UNPACK_ROW_LENGTH,vt.width),ee.pixelStorei(ee.UNPACK_IMAGE_HEIGHT,vt.height),ee.pixelStorei(ee.UNPACK_SKIP_PIXELS,Be),ee.pixelStorei(ee.UNPACK_SKIP_ROWS,Ge),ee.pixelStorei(ee.UNPACK_SKIP_IMAGES,Je);const gn=z.isDataArrayTexture||z.isData3DTexture,Zt=J.isDataArrayTexture||J.isData3DTexture;if(z.isRenderTargetTexture||z.isDepthTexture){const $t=lt.get(z),Jt=lt.get(J),hn=lt.get($t.__renderTarget),yi=lt.get(Jt.__renderTarget);$e.bindFramebuffer(ee.READ_FRAMEBUFFER,hn.__webglFramebuffer),$e.bindFramebuffer(ee.DRAW_FRAMEBUFFER,yi.__webglFramebuffer);for(let ei=0;ei<Ze;ei++)gn&&ee.framebufferTextureLayer(ee.READ_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,lt.get(z).__webglTexture,Q,Je+ei),z.isDepthTexture?(Zt&&ee.framebufferTextureLayer(ee.DRAW_FRAMEBUFFER,ee.COLOR_ATTACHMENT0,lt.get(J).__webglTexture,Q,Rt+ei),ee.blitFramebuffer(Be,Ge,ge,_e,We,Tt,ge,_e,ee.DEPTH_BUFFER_BIT,ee.NEAREST)):Zt?ee.copyTexSubImage3D(rt,Q,We,Tt,Rt+ei,Be,Ge,ge,_e):ee.copyTexSubImage2D(rt,Q,We,Tt,Rt+ei,Be,Ge,ge,_e);$e.bindFramebuffer(ee.READ_FRAMEBUFFER,null),$e.bindFramebuffer(ee.DRAW_FRAMEBUFFER,null)}else Zt?z.isDataTexture||z.isData3DTexture?ee.texSubImage3D(rt,Q,We,Tt,Rt,ge,_e,Ze,Ft,At,vt.data):J.isCompressedArrayTexture?ee.compressedTexSubImage3D(rt,Q,We,Tt,Rt,ge,_e,Ze,Ft,vt.data):ee.texSubImage3D(rt,Q,We,Tt,Rt,ge,_e,Ze,Ft,At,vt):z.isDataTexture?ee.texSubImage2D(ee.TEXTURE_2D,Q,We,Tt,ge,_e,Ft,At,vt.data):z.isCompressedTexture?ee.compressedTexSubImage2D(ee.TEXTURE_2D,Q,We,Tt,vt.width,vt.height,Ft,vt.data):ee.texSubImage2D(ee.TEXTURE_2D,Q,We,Tt,ge,_e,Ft,At,vt);ee.pixelStorei(ee.UNPACK_ROW_LENGTH,Wt),ee.pixelStorei(ee.UNPACK_IMAGE_HEIGHT,Ut),ee.pixelStorei(ee.UNPACK_SKIP_PIXELS,Wn),ee.pixelStorei(ee.UNPACK_SKIP_ROWS,Yn),ee.pixelStorei(ee.UNPACK_SKIP_IMAGES,Pn),Q===0&&J.generateMipmaps&&ee.generateMipmap(rt),$e.unbindTexture()},this.copyTextureToTexture3D=function(z,J,ne=null,re=null,Q=0){return z.isTexture!==!0&&(uy("WebGLRenderer: copyTextureToTexture3D function signature has changed."),ne=arguments[0]||null,re=arguments[1]||null,z=arguments[2],J=arguments[3],Q=arguments[4]||0),uy('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(z,J,ne,re,Q)},this.initRenderTarget=function(z){lt.get(z).__webglFramebuffer===void 0&&Y.setupRenderTarget(z)},this.initTexture=function(z){z.isCubeTexture?Y.setTextureCube(z,0):z.isData3DTexture?Y.setTexture3D(z,0):z.isDataArrayTexture||z.isCompressedArrayTexture?Y.setTexture2DArray(z,0):Y.setTexture2D(z,0),$e.unbindTexture()},this.resetState=function(){D=0,R=0,I=null,$e.reset(),Ye.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ga}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorspace=Mn._getDrawingBufferColorSpace(e),t.unpackColorSpace=Mn._getUnpackColorSpace()}}class xS{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new ft(e),this.density=t}clone(){return new xS(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class wS{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new ft(e),this.near=t,this.far=i}clone(){return new wS(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Uv extends Rn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new mo,this.environmentIntensity=1,this.environmentRotation=new mo,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Vv{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=U0,this.updateRanges=[],this.version=0,this.uuid=fo()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=fo()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=fo()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const ds=new q;class Gu{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)ds.fromBufferAttribute(this,t),ds.applyMatrix4(e),this.setXYZ(t,ds.x,ds.y,ds.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)ds.fromBufferAttribute(this,t),ds.applyNormalMatrix(e),this.setXYZ(t,ds.x,ds.y,ds.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)ds.fromBufferAttribute(this,t),ds.transformDirection(e),this.setXYZ(t,ds.x,ds.y,ds.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=_s(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=dn(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=dn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=dn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=dn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=dn(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=_s(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=_s(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=_s(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=_s(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=dn(t,this.array),i=dn(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=dn(t,this.array),i=dn(i,this.array),r=dn(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=dn(t,this.array),i=dn(i,this.array),r=dn(r,this.array),s=dn(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new Fn(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Gu(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class MD extends or{static get type(){return"SpriteMaterial"}constructor(e){super(),this.isSpriteMaterial=!0,this.color=new ft(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}}let Uf;const Vg=new q,Vf=new q,zf=new q,Hf=new Fe,zg=new Fe,LK=new qt,kx=new q,Hg=new q,Bx=new q,k4=new Fe,wC=new Fe,B4=new Fe;class kK extends Rn{constructor(e=new MD){if(super(),this.isSprite=!0,this.type="Sprite",Uf===void 0){Uf=new un;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new Vv(t,5);Uf.setIndex([0,1,2,0,2,3]),Uf.setAttribute("position",new Gu(i,3,0,!1)),Uf.setAttribute("uv",new Gu(i,2,3,!1))}this.geometry=Uf,this.material=e,this.center=new Fe(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Vf.setFromMatrixScale(this.matrixWorld),LK.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),zf.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Vf.multiplyScalar(-zf.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const o=this.center;Ox(kx.set(-.5,-.5,0),zf,o,Vf,r,s),Ox(Hg.set(.5,-.5,0),zf,o,Vf,r,s),Ox(Bx.set(.5,.5,0),zf,o,Vf,r,s),k4.set(0,0),wC.set(1,0),B4.set(1,1);let a=e.ray.intersectTriangle(kx,Hg,Bx,!1,Vg);if(a===null&&(Ox(Hg.set(-.5,.5,0),zf,o,Vf,r,s),wC.set(0,1),a=e.ray.intersectTriangle(kx,Bx,Hg,!1,Vg),a===null))return;const l=e.ray.origin.distanceTo(Vg);l<e.near||l>e.far||t.push({distance:l,point:Vg.clone(),uv:ks.getInterpolation(Vg,kx,Hg,Bx,k4,wC,B4,new Fe),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 Ox(n,e,t,i,r,s){Hf.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(zg.x=s*Hf.x-r*Hf.y,zg.y=r*Hf.x+s*Hf.y):zg.copy(Hf),n.copy(e),n.x+=zg.x,n.y+=zg.y,n.applyMatrix4(LK)}const Fx=new q,O4=new q;class BK extends Rn{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 i=0,r=t.length;i<r;i++){const s=t[i];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,i=0){t=Math.abs(t);const r=this.levels;let s;for(s=0;s<r.length&&!(t<r[s].distance);s++);return r.splice(s,0,{distance:t,hysteresis:i,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let i=0;i<t.length;i++)if(t[i].distance===e){const r=t.splice(i,1);return this.remove(r[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>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),e<s)break}return t[i-1].object}return null}raycast(e,t){if(this.levels.length>0){Fx.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(Fx);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Fx.setFromMatrixPosition(e.matrixWorld),O4.setFromMatrixPosition(this.matrixWorld);const i=Fx.distanceTo(O4)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r<s;r++){let o=t[r].distance;if(t[r].object.visible&&(o-=o*t[r].hysteresis),i>=o)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<s;r++)t[r].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const i=this.levels;for(let r=0,s=i.length;r<s;r++){const o=i[r];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const F4=new q,U4=new Bn,V4=new Bn,hEe=new q,z4=new qt,Ux=new q,EC=new Rr,H4=new qt,AC=new ef;class ID extends fi{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=TR,this.bindMatrix=new qt,this.bindMatrixInverse=new qt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new ns),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Ux),this.boundingBox.expandByPoint(Ux)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Rr),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Ux),this.boundingSphere.expandByPoint(Ux)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const i=this.material,r=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),EC.copy(this.boundingSphere),EC.applyMatrix4(r),e.ray.intersectsSphere(EC)!==!1&&(H4.copy(r).invert(),AC.copy(e.ray).applyMatrix4(H4),!(this.boundingBox!==null&&AC.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,AC)))}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 Bn,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===TR?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===iK?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const i=this.skeleton,r=this.geometry;U4.fromBufferAttribute(r.attributes.skinIndex,e),V4.fromBufferAttribute(r.attributes.skinWeight,e),F4.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=V4.getComponent(s);if(o!==0){const a=U4.getComponent(s);z4.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(hEe.copy(F4).applyMatrix4(z4),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class ES extends Rn{constructor(){super(),this.isBone=!0,this.type="Bone"}}class ya extends qn{constructor(e=null,t=1,i=1,r,s,o,a,l,c=_r,u=_r,h,f){super(null,o,a,l,c,u,r,s,h,f),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const G4=new qt,dEe=new qt;class zv{constructor(e=[],t=[]){this.uuid=fo(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new qt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new qt;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:dEe;G4.multiplyMatrices(a,t[s]),G4.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new zv(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const i=new ya(t,e,e,Vi,Ai);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){const s=e.bones[i];let o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new ES),this.bones.push(o),this.boneInverses.push(new qt().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,i=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const o=t[r];e.bones.push(o.uuid);const a=i[r];e.boneInverses.push(a.toArray())}return e}}class Vd extends Fn{constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Gf=new qt,j4=new qt,Vx=[],W4=new ns,fEe=new qt,Gg=new fi,jg=new Rr;class RD extends fi{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Vd(new Float32Array(i*16),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<i;r++)this.setMatrixAt(r,fEe)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new ns),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Gf),W4.copy(e.boundingBox).applyMatrix4(Gf),this.boundingBox.union(W4)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Rr),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Gf),jg.copy(e.boundingSphere).applyMatrix4(Gf),this.boundingSphere.union(jg)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const i=t.morphTargetInfluences,r=this.morphTexture.source.data.data,s=i.length+1,o=e*s+1;for(let a=0;a<i.length;a++)i[a]=r[o+a]}raycast(e,t){const i=this.matrixWorld,r=this.count;if(Gg.geometry=this.geometry,Gg.material=this.material,Gg.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),jg.copy(this.boundingSphere),jg.applyMatrix4(i),e.ray.intersectsSphere(jg)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,Gf),j4.multiplyMatrices(i,Gf),Gg.matrixWorld=j4,Gg.raycast(e,Vx);for(let o=0,a=Vx.length;o<a;o++){const l=Vx[o];l.instanceId=s,l.object=this,t.push(l)}Vx.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Vd(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const i=t.morphTargetInfluences,r=i.length+1;this.morphTexture===null&&(this.morphTexture=new ya(new Float32Array(r*this.count),r,this.count,Dv,Ai));const s=this.morphTexture.source.data.data;let o=0;for(let c=0;c<i.length;c++)o+=i[c];const a=this.geometry.morphTargetsRelative?1:1-o,l=r*e;s[l]=a,s.set(i,l+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function SC(n,e){return n-e}function pEe(n,e){return n.z-e.z}function mEe(n,e){return e.z-n.z}class gEe{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,i,r){const s=this.pool,o=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const a=s[this.index];o.push(a),this.index++,a.start=e,a.count=t,a.z=i,a.index=r}reset(){this.list.length=0,this.index=0}}const Rs=new qt,yEe=new ft(1,1,1),TC=new Fv,zx=new ns,Th=new Rr,Wg=new q,K4=new q,vEe=new q,bC=new gEe,Xr=new fi,Hx=[];function _Ee(n,e,t=0){const i=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const r=n.count;for(let s=0;s<r;s++)for(let o=0;o<i;o++)e.setComponent(s+t,o,n.getComponent(s,o))}else e.array.set(n.array,t*i);e.needsUpdate=!0}function bh(n,e){if(n.constructor!==e.constructor){const t=Math.min(n.length,e.length);for(let i=0;i<t;i++)e[i]=n[i]}else{const t=Math.min(n.length,e.length);e.set(new n.constructor(n.buffer,0,t))}}class OK extends fi{get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}constructor(e,t,i=t*2,r){super(new un,r),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=i,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),i=new ya(t,e,e,Vi,Ai);this._matricesTexture=i}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),i=new ya(t,e,e,Lv,ll);this._indirectTexture=i}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),i=new ya(t,e,e,Vi,Ai);i.colorSpace=Mn.workingColorSpace,this._colorsTexture=i}_initializeGeometry(e){const t=this.geometry,i=this._maxVertexCount,r=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const o=e.getAttribute(s),{array:a,itemSize:l,normalized:c}=o,u=new a.constructor(i*l),h=new Fn(u,l,c);t.setAttribute(s,h)}if(e.getIndex()!==null){const s=i>65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new Fn(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const i in t.attributes){if(!e.hasAttribute(i))throw new Error(`BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const r=e.getAttribute(i),s=t.getAttribute(i);if(r.itemSize!==s.itemSize||r.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ns);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let i=0,r=t.length;i<r;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,Rs),this.getBoundingBoxAt(s,zx).applyMatrix4(Rs),e.union(zx)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Rr);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let i=0,r=t.length;i<r;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,Rs),this.getBoundingSphereAt(s,Th).applyMatrix4(Rs),e.union(Th)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("BatchedMesh: Maximum item count reached.");const i={visible:!0,active:!0,geometryIndex:e};let r=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(SC),r=this._availableInstanceIds.shift(),this._instanceInfo[r]=i):(r=this._instanceInfo.length,this._instanceInfo.push(i));const s=this._matricesTexture;Rs.identity().toArray(s.image.data,r*16),s.needsUpdate=!0;const o=this._colorsTexture;return o&&(yEe.toArray(o.image.data,r*4),o.needsUpdate=!0),this._visibilityChanged=!0,r}addGeometry(e,t=-1,i=-1){this._initializeGeometry(e),this._validateGeometry(e);const r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},s=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const o=e.getIndex();if(o!==null&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=i===-1?o.count:i),r.indexStart!==-1&&r.indexStart+r.reservedIndexCount>this._maxIndexCount||r.vertexStart+r.reservedVertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");let l;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(SC),l=this._availableGeometryIds.shift(),s[l]=r):(l=this._geometryCount,this._geometryCount++,s.push(r)),this.setGeometryAt(l,e),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,l}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const i=this.geometry,r=i.getIndex()!==null,s=i.getIndex(),o=t.getIndex(),a=this._geometryInfo[e];if(r&&o.count>a.reservedIndexCount||t.attributes.position.count>a.reservedVertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.reservedVertexCount;a.vertexCount=t.getAttribute("position").count;for(const u in i.attributes){const h=t.getAttribute(u),f=i.getAttribute(u);_Ee(h,f,l);const m=h.itemSize;for(let y=h.count,_=c;y<_;y++){const v=l+y;for(let g=0;g<m;g++)f.setComponent(v,g,0)}f.needsUpdate=!0,f.addUpdateRange(l*m,c*m)}if(r){const u=a.indexStart,h=a.reservedIndexCount;a.indexCount=t.getIndex().count;for(let f=0;f<o.count;f++)s.setX(u+f,l+o.getX(f));for(let f=o.count,m=h;f<m;f++)s.setX(u+f,l);s.needsUpdate=!0,s.addUpdateRange(u,a.reservedIndexCount)}return a.start=r?a.indexStart:a.vertexStart,a.count=r?a.indexCount:a.vertexCount,a.boundingBox=null,t.boundingBox!==null&&(a.boundingBox=t.boundingBox.clone()),a.boundingSphere=null,t.boundingSphere!==null&&(a.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;const i=this._instanceInfo;for(let r=0,s=i.length;r<s;r++)i[r].geometryIndex===e&&this.deleteInstance(r);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){const t=this._instanceInfo;return e>=t.length||t[e].active===!1?this:(t[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this)}optimize(){let e=0,t=0;const i=this._geometryInfo,r=i.map((o,a)=>a).sort((o,a)=>i[o].vertexStart-i[a].vertexStart),s=this.geometry;for(let o=0,a=i.length;o<a;o++){const l=r[o],c=i[l];if(c.active!==!1){if(s.index!==null){if(c.indexStart!==t){const{indexStart:u,vertexStart:h,reservedIndexCount:f}=c,m=s.index,y=m.array,_=e-h;for(let v=u;v<u+f;v++)y[v]=y[v]+_;m.array.copyWithin(t,u,u+f),m.addUpdateRange(t,f),c.indexStart=t}t+=c.reservedIndexCount}if(c.vertexStart!==e){const{vertexStart:u,reservedVertexCount:h}=c,f=s.attributes;for(const m in f){const y=f[m],{array:_,itemSize:v}=y;_.copyWithin(e*v,u*v,(u+h)*v),y.addUpdateRange(e*v,h*v)}c.vertexStart=e}e+=c.reservedVertexCount,c.start=s.index?c.indexStart:c.vertexStart,this._nextIndexStart=s.index?c.indexStart+c.reservedIndexCount:0,this._nextVertexStart=c.vertexStart+c.reservedVertexCount}}return this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const i=this.geometry,r=this._geometryInfo[e];if(r.boundingBox===null){const s=new ns,o=i.index,a=i.attributes.position;for(let l=r.start,c=r.start+r.count;l<c;l++){let u=l;o&&(u=o.getX(u)),s.expandByPoint(Wg.fromBufferAttribute(a,u))}r.boundingBox=s}return t.copy(r.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const i=this.geometry,r=this._geometryInfo[e];if(r.boundingSphere===null){const s=new Rr;this.getBoundingBoxAt(e,zx),zx.getCenter(s.center);const o=i.index,a=i.attributes.position;let l=0;for(let c=r.start,u=r.start+r.count;c<u;c++){let h=c;o&&(h=o.getX(h)),Wg.fromBufferAttribute(a,h),l=Math.max(l,s.center.distanceToSquared(Wg))}s.radius=Math.sqrt(l),r.boundingSphere=s}return t.copy(r.boundingSphere),t}setMatrixAt(e,t){const i=this._instanceInfo,r=this._matricesTexture,s=this._matricesTexture.image.data;return e>=i.length||i[e].active===!1?this:(t.toArray(s,e*16),r.needsUpdate=!0,this)}getMatrixAt(e,t){const i=this._instanceInfo,r=this._matricesTexture.image.data;return e>=i.length||i[e].active===!1?null:t.fromArray(r,e*16)}setColorAt(e,t){this._colorsTexture===null&&this._initColorsTexture();const i=this._colorsTexture,r=this._colorsTexture.image.data,s=this._instanceInfo;return e>=s.length||s[e].active===!1?this:(t.toArray(r,e*4),i.needsUpdate=!0,this)}getColorAt(e,t){const i=this._colorsTexture.image.data,r=this._instanceInfo;return e>=r.length||r[e].active===!1?null:t.fromArray(i,e*4)}setVisibleAt(e,t){const i=this._instanceInfo;return e>=i.length||i[e].active===!1||i[e].visible===t?this:(i[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._instanceInfo;return e>=t.length||t[e].active===!1?!1:t[e].visible}setGeometryIdAt(e,t){const i=this._instanceInfo,r=this._geometryInfo;return e>=i.length||i[e].active===!1||t>=r.length||r[t].active===!1?null:(i[e].geometryIndex=t,this)}getGeometryIdAt(e){const t=this._instanceInfo;return e>=t.length||t[e].active===!1?-1:t[e].geometryIndex}getGeometryRangeAt(e,t={}){if(e<0||e>=this._geometryCount)return null;const i=this._geometryInfo[e];return t.vertexStart=i.vertexStart,t.vertexCount=i.vertexCount,t.reservedVertexCount=i.reservedVertexCount,t.indexStart=i.indexStart,t.indexCount=i.indexCount,t.reservedIndexCount=i.reservedIndexCount,t.start=i.start,t.count=i.count,t}setInstanceCount(e){const t=this._availableInstanceIds,i=this._instanceInfo;for(t.sort(SC);t[t.length-1]===i.length;)i.pop(),t.pop();if(e<i.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const r=new Int32Array(e),s=new Int32Array(e);bh(this._multiDrawCounts,r),bh(this._multiDrawStarts,s),this._multiDrawCounts=r,this._multiDrawStarts=s,this._maxInstanceCount=e;const o=this._indirectTexture,a=this._matricesTexture,l=this._colorsTexture;o.dispose(),this._initIndirectTexture(),bh(o.image.data,this._indirectTexture.image.data),a.dispose(),this._initMatricesTexture(),bh(a.image.data,this._matricesTexture.image.data),l&&(l.dispose(),this._initColorsTexture(),bh(l.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const i=[...this._geometryInfo].filter(a=>a.active);if(Math.max(...i.map(a=>a.vertexStart+a.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...i.map(l=>l.indexStart+l.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const s=this.geometry;s.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new un,this._initializeGeometry(s));const o=this.geometry;s.index&&bh(s.index.array,o.index.array);for(const a in s.attributes)bh(s.attributes[a].array,o.attributes[a].array)}raycast(e,t){const i=this._instanceInfo,r=this._geometryInfo,s=this.matrixWorld,o=this.geometry;Xr.material=this.material,Xr.geometry.index=o.index,Xr.geometry.attributes=o.attributes,Xr.geometry.boundingBox===null&&(Xr.geometry.boundingBox=new ns),Xr.geometry.boundingSphere===null&&(Xr.geometry.boundingSphere=new Rr);for(let a=0,l=i.length;a<l;a++){if(!i[a].visible||!i[a].active)continue;const c=i[a].geometryIndex,u=r[c];Xr.geometry.setDrawRange(u.start,u.count),this.getMatrixAt(a,Xr.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,Xr.geometry.boundingBox),this.getBoundingSphereAt(c,Xr.geometry.boundingSphere),Xr.raycast(e,Hx);for(let h=0,f=Hx.length;h<f;h++){const m=Hx[h];m.object=this,m.batchId=a,t.push(m)}Hx.length=0}Xr.material=null,Xr.geometry.index=null,Xr.geometry.attributes={},Xr.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,i,r,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=r.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._instanceInfo,c=this._multiDrawStarts,u=this._multiDrawCounts,h=this._geometryInfo,f=this.perObjectFrustumCulled,m=this._indirectTexture,y=m.image.data;f&&(Rs.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),TC.setFromProjectionMatrix(Rs,e.coordinateSystem));let _=0;if(this.sortObjects){Rs.copy(this.matrixWorld).invert(),Wg.setFromMatrixPosition(i.matrixWorld).applyMatrix4(Rs),K4.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(Rs);for(let w=0,A=l.length;w<A;w++)if(l[w].visible&&l[w].active){const T=l[w].geometryIndex;this.getMatrixAt(w,Rs),this.getBoundingSphereAt(T,Th).applyMatrix4(Rs);let L=!1;if(f&&(L=!TC.intersectsSphere(Th)),!L){const D=h[T],R=vEe.subVectors(Th.center,Wg).dot(K4);bC.push(D.start,D.count,R,w)}}const v=bC.list,g=this.customSort;g===null?v.sort(s.transparent?mEe:pEe):g.call(this,v,i);for(let w=0,A=v.length;w<A;w++){const T=v[w];c[_]=T.start*a,u[_]=T.count,y[_]=T.index,_++}bC.reset()}else for(let v=0,g=l.length;v<g;v++)if(l[v].visible&&l[v].active){const w=l[v].geometryIndex;let A=!1;if(f&&(this.getMatrixAt(v,Rs),this.getBoundingSphereAt(w,Th).applyMatrix4(Rs),A=!TC.intersectsSphere(Th)),!A){const T=h[w];c[_]=T.start*a,u[_]=T.count,y[_]=v,_++}}m.needsUpdate=!0,this._multiDrawCount=_,this._visibilityChanged=!1}onBeforeShadow(e,t,i,r,s,o){this.onBeforeRender(e,null,r,s,o)}}class as extends or{static get type(){return"LineBasicMaterial"}constructor(e){super(),this.isLineBasicMaterial=!0,this.color=new ft(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const GE=new q,jE=new q,X4=new qt,Kg=new ef,Gx=new Rr,CC=new q,q4=new q;class uc extends Rn{constructor(e=new un,t=new as){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)GE.fromBufferAttribute(t,r-1),jE.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=GE.distanceTo(jE);e.setAttribute("lineDistance",new Ot(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Gx.copy(i.boundingSphere),Gx.applyMatrix4(r),Gx.radius+=s,e.ray.intersectsSphere(Gx)===!1)return;X4.copy(r).invert(),Kg.copy(e.ray).applyMatrix4(X4);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=i.index,f=i.attributes.position;if(u!==null){const m=Math.max(0,o.start),y=Math.min(u.count,o.start+o.count);for(let _=m,v=y-1;_<v;_+=c){const g=u.getX(_),w=u.getX(_+1),A=jx(this,e,Kg,l,g,w);A&&t.push(A)}if(this.isLineLoop){const _=u.getX(y-1),v=u.getX(m),g=jx(this,e,Kg,l,_,v);g&&t.push(g)}}else{const m=Math.max(0,o.start),y=Math.min(f.count,o.start+o.count);for(let _=m,v=y-1;_<v;_+=c){const g=jx(this,e,Kg,l,_,_+1);g&&t.push(g)}if(this.isLineLoop){const _=jx(this,e,Kg,l,y-1,m);_&&t.push(_)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function jx(n,e,t,i,r,s){const o=n.geometry.attributes.position;if(GE.fromBufferAttribute(o,r),jE.fromBufferAttribute(o,s),t.distanceSqToSegment(GE,jE,CC,q4)>i)return;CC.applyMatrix4(n.matrixWorld);const l=e.ray.origin.distanceTo(CC);if(!(l<e.near||l>e.far))return{distance:l,point:q4.clone().applyMatrix4(n.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:n}}const Y4=new q,$4=new q;class Sa extends uc{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let r=0,s=t.count;r<s;r+=2)Y4.fromBufferAttribute(t,r),$4.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+Y4.distanceTo($4);e.setAttribute("lineDistance",new Ot(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class PD extends uc{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class AS extends or{static get type(){return"PointsMaterial"}constructor(e){super(),this.isPointsMaterial=!0,this.color=new ft(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const J4=new qt,NR=new ef,Wx=new Rr,Kx=new q;class ND extends Rn{constructor(e=new un,t=new AS){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Wx.copy(i.boundingSphere),Wx.applyMatrix4(r),Wx.radius+=s,e.ray.intersectsSphere(Wx)===!1)return;J4.copy(r).invert(),NR.copy(e.ray).applyMatrix4(J4);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=i.index,h=i.attributes.position;if(c!==null){const f=Math.max(0,o.start),m=Math.min(c.count,o.start+o.count);for(let y=f,_=m;y<_;y++){const v=c.getX(y);Kx.fromBufferAttribute(h,v),Q4(Kx,v,l,r,e,t,this)}}else{const f=Math.max(0,o.start),m=Math.min(h.count,o.start+o.count);for(let y=f,_=m;y<_;y++)Kx.fromBufferAttribute(h,y),Q4(Kx,y,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function Q4(n,e,t,i,r,s,o){const a=NR.distanceSqToPoint(n);if(a<t){const l=new q;NR.closestPointToPoint(n,l),l.applyMatrix4(i);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class xEe extends qn{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Gn,this.magFilter=s!==void 0?s:Gn,this.generateMipmaps=!1;const u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class wEe extends qn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=_r,this.minFilter=_r,this.generateMipmaps=!1,this.needsUpdate=!0}}class SS extends qn{constructor(e,t,i,r,s,o,a,l,c,u,h,f){super(null,o,a,l,c,u,r,s,h,f),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class EEe extends SS{constructor(e,t,i,r,s,o){super(e,t,i,s,o),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=Ui,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class AEe extends SS{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,al),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class SEe extends qn{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Ta{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let o;t?o=t:o=e*i[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=i[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,i[r]===o)return r/(s-1);const u=i[r],f=i[r+1]-u,m=(o-u)/f;return(r+m)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new Fe:new q);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new q,r=[],s=[],o=[],a=new q,l=new qt;for(let m=0;m<=e;m++){const y=m/e;r[m]=this.getTangentAt(y,new q)}s[0]=new q,o[0]=new q;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),h=Math.abs(r[0].y),f=Math.abs(r[0].z);u<=c&&(c=u,i.set(1,0,0)),h<=c&&(c=h,i.set(0,1,0)),f<=c&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let m=1;m<=e;m++){if(s[m]=s[m-1].clone(),o[m]=o[m-1].clone(),a.crossVectors(r[m-1],r[m]),a.length()>Number.EPSILON){a.normalize();const y=Math.acos(Pi(r[m-1].dot(r[m]),-1,1));s[m].applyMatrix4(l.makeRotationAxis(a,y))}o[m].crossVectors(r[m],s[m])}if(t===!0){let m=Math.acos(Pi(s[0].dot(s[e]),-1,1));m/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(m=-m);for(let y=1;y<=e;y++)s[y].applyMatrix4(l.makeRotationAxis(r[y],m*y)),o[y].crossVectors(r[y],s[y])}return{tangents:r,normals:s,binormals:o}}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}}class TS extends Ta{constructor(e=0,t=0,i=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Fe){const i=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),f=l-this.aX,m=c-this.aY;l=f*u-m*h+this.aX,c=f*h+m*u+this.aY}return i.set(l,c)}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}}class FK extends TS{constructor(e,t,i,r,s,o){super(e,t,i,i,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function DD(){let n=0,e=0,t=0,i=0;function r(s,o,a,l){n=s,e=a,t=-3*s+3*o-2*a-l,i=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,h){let f=(o-s)/c-(a-s)/(c+u)+(a-o)/u,m=(a-o)/u-(l-o)/(u+h)+(l-a)/h;f*=u,m*=u,r(o,a,f,m)},calc:function(s){const o=s*s,a=o*s;return n+e*s+t*o+i*a}}}const Xx=new q,MC=new DD,IC=new DD,RC=new DD;class UK extends Ta{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new q){const i=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=r[(a-1)%s]:(Xx.subVectors(r[0],r[1]).add(r[0]),c=Xx);const h=r[a%s],f=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(Xx.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=Xx),this.curveType==="centripetal"||this.curveType==="chordal"){const m=this.curveType==="chordal"?.5:.25;let y=Math.pow(c.distanceToSquared(h),m),_=Math.pow(h.distanceToSquared(f),m),v=Math.pow(f.distanceToSquared(u),m);_<1e-4&&(_=1),y<1e-4&&(y=_),v<1e-4&&(v=_),MC.initNonuniformCatmullRom(c.x,h.x,f.x,u.x,y,_,v),IC.initNonuniformCatmullRom(c.y,h.y,f.y,u.y,y,_,v),RC.initNonuniformCatmullRom(c.z,h.z,f.z,u.z,y,_,v)}else this.curveType==="catmullrom"&&(MC.initCatmullRom(c.x,h.x,f.x,u.x,this.tension),IC.initCatmullRom(c.y,h.y,f.y,u.y,this.tension),RC.initCatmullRom(c.z,h.z,f.z,u.z,this.tension));return i.set(MC.calc(l),IC.calc(l),RC.calc(l)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.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,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new q().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Z4(n,e,t,i,r){const s=(i-e)*.5,o=(r-t)*.5,a=n*n,l=n*a;return(2*t-2*i+s+o)*l+(-3*t+3*i-2*s-o)*a+s*n+t}function TEe(n,e){const t=1-n;return t*t*e}function bEe(n,e){return 2*(1-n)*n*e}function CEe(n,e){return n*n*e}function Ky(n,e,t,i){return TEe(n,e)+bEe(n,t)+CEe(n,i)}function MEe(n,e){const t=1-n;return t*t*t*e}function IEe(n,e){const t=1-n;return 3*t*t*n*e}function REe(n,e){return 3*(1-n)*n*n*e}function PEe(n,e){return n*n*n*e}function Xy(n,e,t,i,r){return MEe(n,e)+IEe(n,t)+REe(n,i)+PEe(n,r)}class LD extends Ta{constructor(e=new Fe,t=new Fe,i=new Fe,r=new Fe){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new Fe){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Xy(e,r.x,s.x,o.x,a.x),Xy(e,r.y,s.y,o.y,a.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){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}}class VK extends Ta{constructor(e=new q,t=new q,i=new q,r=new q){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new q){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Xy(e,r.x,s.x,o.x,a.x),Xy(e,r.y,s.y,o.y,a.y),Xy(e,r.z,s.z,o.z,a.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){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}}class kD extends Ta{constructor(e=new Fe,t=new Fe){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Fe){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Fe){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}}class zK extends Ta{constructor(e=new q,t=new q){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new q){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new q){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}}class BD extends Ta{constructor(e=new Fe,t=new Fe,i=new Fe){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new Fe){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(Ky(e,r.x,s.x,o.x),Ky(e,r.y,s.y,o.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){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}}class OD extends Ta{constructor(e=new q,t=new q,i=new q){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new q){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(Ky(e,r.x,s.x,o.x),Ky(e,r.y,s.y,o.y),Ky(e,r.z,s.z,o.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){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}}class FD extends Ta{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Fe){const i=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],c=r[o],u=r[o>r.length-2?r.length-1:o+1],h=r[o>r.length-3?r.length-1:o+2];return i.set(Z4(a,l.x,c.x,u.x,h.x),Z4(a,l.y,c.y,u.y,h.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new Fe().fromArray(r))}return this}}var WE=Object.freeze({__proto__:null,ArcCurve:FK,CatmullRomCurve3:UK,CubicBezierCurve:LD,CubicBezierCurve3:VK,EllipseCurve:TS,LineCurve:kD,LineCurve3:zK,QuadraticBezierCurve:BD,QuadraticBezierCurve3:OD,SplineCurve:FD});class HK extends Ta{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);if(!e.equals(t)){const i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new WE[i](t,e))}return this}getPoint(e,t){const i=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=i){const o=r[s]-i,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}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 i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let i;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){const u=l[c];i&&i.equals(u)||(t.push(u),i=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){const r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(new WE[r.type]().fromJSON(r))}return this}}class H0 extends HK{constructor(e){super(),this.type="Path",this.currentPoint=new Fe,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const i=new kD(this.currentPoint.clone(),new Fe(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){const s=new BD(this.currentPoint.clone(),new Fe(e,t),new Fe(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,o){const a=new LD(this.currentPoint.clone(),new Fe(e,t),new Fe(i,r),new Fe(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new FD(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,i,r,s,o),this}absarc(e,t,i,r,s,o){return this.absellipse(e,t,i,i,r,s,o),this}ellipse(e,t,i,r,s,o,a,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,i,r,s,o,a,l),this}absellipse(e,t,i,r,s,o,a,l){const c=new TS(e,t,i,r,s,o,a,l);if(this.curves.length>0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),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}}class Hv extends un{constructor(e=[new Fe(0,-.5),new Fe(.5,0),new Fe(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=Pi(r,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],u=1/t,h=new q,f=new Fe,m=new q,y=new q,_=new q;let v=0,g=0;for(let w=0;w<=e.length-1;w++)switch(w){case 0:v=e[w+1].x-e[w].x,g=e[w+1].y-e[w].y,m.x=g*1,m.y=-v,m.z=g*0,_.copy(m),m.normalize(),l.push(m.x,m.y,m.z);break;case e.length-1:l.push(_.x,_.y,_.z);break;default:v=e[w+1].x-e[w].x,g=e[w+1].y-e[w].y,m.x=g*1,m.y=-v,m.z=g*0,y.copy(m),m.x+=_.x,m.y+=_.y,m.z+=_.z,m.normalize(),l.push(m.x,m.y,m.z),_.copy(y)}for(let w=0;w<=t;w++){const A=i+w*u*r,T=Math.sin(A),L=Math.cos(A);for(let D=0;D<=e.length-1;D++){h.x=e[D].x*T,h.y=e[D].y,h.z=e[D].x*L,o.push(h.x,h.y,h.z),f.x=w/t,f.y=D/(e.length-1),a.push(f.x,f.y);const R=l[3*D+0]*T,I=l[3*D+1],M=l[3*D+0]*L;c.push(R,I,M)}}for(let w=0;w<t;w++)for(let A=0;A<e.length-1;A++){const T=A+w*e.length,L=T,D=T+e.length,R=T+e.length+1,I=T+1;s.push(L,D,I),s.push(R,I,D)}this.setIndex(s),this.setAttribute("position",new Ot(o,3)),this.setAttribute("uv",new Ot(a,2)),this.setAttribute("normal",new Ot(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Hv(e.points,e.segments,e.phiStart,e.phiLength)}}class bS extends Hv{constructor(e=1,t=1,i=4,r=8){const s=new H0;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(i),r),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:i,radialSegments:r}}static fromJSON(e){return new bS(e.radius,e.length,e.capSegments,e.radialSegments)}}class CS extends un{constructor(e=1,t=32,i=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},t=Math.max(3,t);const s=[],o=[],a=[],l=[],c=new q,u=new Fe;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let h=0,f=3;h<=t;h++,f+=3){const m=i+h/t*r;c.x=e*Math.cos(m),c.y=e*Math.sin(m),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[f]/e+1)/2,u.y=(o[f+1]/e+1)/2,l.push(u.x,u.y)}for(let h=1;h<=t;h++)s.push(h,h+1,0);this.setIndex(s),this.setAttribute("position",new Ot(o,3)),this.setAttribute("normal",new Ot(a,3)),this.setAttribute("uv",new Ot(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new CS(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class qm extends un{constructor(e=1,t=1,i=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const u=[],h=[],f=[],m=[];let y=0;const _=[],v=i/2;let g=0;w(),o===!1&&(e>0&&A(!0),t>0&&A(!1)),this.setIndex(u),this.setAttribute("position",new Ot(h,3)),this.setAttribute("normal",new Ot(f,3)),this.setAttribute("uv",new Ot(m,2));function w(){const T=new q,L=new q;let D=0;const R=(t-e)/i;for(let I=0;I<=s;I++){const M=[],C=I/s,k=C*(t-e)+e;for(let B=0;B<=r;B++){const O=B/r,X=O*l+a,le=Math.sin(X),ie=Math.cos(X);L.x=k*le,L.y=-C*i+v,L.z=k*ie,h.push(L.x,L.y,L.z),T.set(le,R,ie).normalize(),f.push(T.x,T.y,T.z),m.push(O,1-C),M.push(y++)}_.push(M)}for(let I=0;I<r;I++)for(let M=0;M<s;M++){const C=_[M][I],k=_[M+1][I],B=_[M+1][I+1],O=_[M][I+1];(e>0||M!==0)&&(u.push(C,k,O),D+=3),(t>0||M!==s-1)&&(u.push(k,B,O),D+=3)}c.addGroup(g,D,0),g+=D}function A(T){const L=y,D=new Fe,R=new q;let I=0;const M=T===!0?e:t,C=T===!0?1:-1;for(let B=1;B<=r;B++)h.push(0,v*C,0),f.push(0,C,0),m.push(.5,.5),y++;const k=y;for(let B=0;B<=r;B++){const X=B/r*l+a,le=Math.cos(X),ie=Math.sin(X);R.x=M*ie,R.y=v*C,R.z=M*le,h.push(R.x,R.y,R.z),f.push(0,C,0),D.x=le*.5+.5,D.y=ie*.5*C+.5,m.push(D.x,D.y),y++}for(let B=0;B<r;B++){const O=L+B,X=k+B;T===!0?u.push(X,X+1,O):u.push(X+1,X,O),I+=3}c.addGroup(g,I,T===!0?1:2),g+=I}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qm(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class MS extends qm{constructor(e=1,t=1,i=32,r=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,i,r,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new MS(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Zu extends un{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};const s=[],o=[];a(r),c(i),u(),this.setAttribute("position",new Ot(s,3)),this.setAttribute("normal",new Ot(s.slice(),3)),this.setAttribute("uv",new Ot(o,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function a(w){const A=new q,T=new q,L=new q;for(let D=0;D<t.length;D+=3)m(t[D+0],A),m(t[D+1],T),m(t[D+2],L),l(A,T,L,w)}function l(w,A,T,L){const D=L+1,R=[];for(let I=0;I<=D;I++){R[I]=[];const M=w.clone().lerp(T,I/D),C=A.clone().lerp(T,I/D),k=D-I;for(let B=0;B<=k;B++)B===0&&I===D?R[I][B]=M:R[I][B]=M.clone().lerp(C,B/k)}for(let I=0;I<D;I++)for(let M=0;M<2*(D-I)-1;M++){const C=Math.floor(M/2);M%2===0?(f(R[I][C+1]),f(R[I+1][C]),f(R[I][C])):(f(R[I][C+1]),f(R[I+1][C+1]),f(R[I+1][C]))}}function c(w){const A=new q;for(let T=0;T<s.length;T+=3)A.x=s[T+0],A.y=s[T+1],A.z=s[T+2],A.normalize().multiplyScalar(w),s[T+0]=A.x,s[T+1]=A.y,s[T+2]=A.z}function u(){const w=new q;for(let A=0;A<s.length;A+=3){w.x=s[A+0],w.y=s[A+1],w.z=s[A+2];const T=v(w)/2/Math.PI+.5,L=g(w)/Math.PI+.5;o.push(T,1-L)}y(),h()}function h(){for(let w=0;w<o.length;w+=6){const A=o[w+0],T=o[w+2],L=o[w+4],D=Math.max(A,T,L),R=Math.min(A,T,L);D>.9&&R<.1&&(A<.2&&(o[w+0]+=1),T<.2&&(o[w+2]+=1),L<.2&&(o[w+4]+=1))}}function f(w){s.push(w.x,w.y,w.z)}function m(w,A){const T=w*3;A.x=e[T+0],A.y=e[T+1],A.z=e[T+2]}function y(){const w=new q,A=new q,T=new q,L=new q,D=new Fe,R=new Fe,I=new Fe;for(let M=0,C=0;M<s.length;M+=9,C+=6){w.set(s[M+0],s[M+1],s[M+2]),A.set(s[M+3],s[M+4],s[M+5]),T.set(s[M+6],s[M+7],s[M+8]),D.set(o[C+0],o[C+1]),R.set(o[C+2],o[C+3]),I.set(o[C+4],o[C+5]),L.copy(w).add(A).add(T).divideScalar(3);const k=v(L);_(D,C+0,w,k),_(R,C+2,A,k),_(I,C+4,T,k)}}function _(w,A,T,L){L<0&&w.x===1&&(o[A]=w.x-1),T.x===0&&T.z===0&&(o[A]=L/2/Math.PI+.5)}function v(w){return Math.atan2(w.z,-w.x)}function g(w){return Math.atan2(-w.y,Math.sqrt(w.x*w.x+w.z*w.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Zu(e.vertices,e.indices,e.radius,e.details)}}class IS extends Zu{constructor(e=1,t=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],o=[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];super(s,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new IS(e.radius,e.detail)}}const qx=new q,Yx=new q,PC=new q,$x=new ks;class GK extends un{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(_d*t),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],u=["a","b","c"],h=new Array(3),f={},m=[];for(let y=0;y<l;y+=3){o?(c[0]=o.getX(y),c[1]=o.getX(y+1),c[2]=o.getX(y+2)):(c[0]=y,c[1]=y+1,c[2]=y+2);const{a:_,b:v,c:g}=$x;if(_.fromBufferAttribute(a,c[0]),v.fromBufferAttribute(a,c[1]),g.fromBufferAttribute(a,c[2]),$x.getNormal(PC),h[0]=`${Math.round(_.x*r)},${Math.round(_.y*r)},${Math.round(_.z*r)}`,h[1]=`${Math.round(v.x*r)},${Math.round(v.y*r)},${Math.round(v.z*r)}`,h[2]=`${Math.round(g.x*r)},${Math.round(g.y*r)},${Math.round(g.z*r)}`,!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let w=0;w<3;w++){const A=(w+1)%3,T=h[w],L=h[A],D=$x[u[w]],R=$x[u[A]],I=`${T}_${L}`,M=`${L}_${T}`;M in f&&f[M]?(PC.dot(f[M].normal)<=s&&(m.push(D.x,D.y,D.z),m.push(R.x,R.y,R.z)),f[M]=null):I in f||(f[I]={index0:c[w],index1:c[A],normal:PC.clone()})}}for(const y in f)if(f[y]){const{index0:_,index1:v}=f[y];qx.fromBufferAttribute(a,_),Yx.fromBufferAttribute(a,v),m.push(qx.x,qx.y,qx.z),m.push(Yx.x,Yx.y,Yx.z)}this.setAttribute("position",new Ot(m,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class wd extends H0{constructor(e){super(e),this.uuid=fo(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){const r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(new H0().fromJSON(r))}return this}}const NEe={triangulate:function(n,e,t=2){const i=e&&e.length,r=i?e[0]*t:n.length;let s=jK(n,0,r,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,u,h,f,m;if(i&&(s=OEe(n,e,s,t)),n.length>80*t){a=c=n[0],l=u=n[1];for(let y=t;y<r;y+=t)h=n[y],f=n[y+1],h<a&&(a=h),f<l&&(l=f),h>c&&(c=h),f>u&&(u=f);m=Math.max(c-a,u-l),m=m!==0?32767/m:0}return G0(s,o,t,a,l,m,0),o}};function jK(n,e,t,i,r){let s,o;if(r===qEe(n,e,t,i)>0)for(s=e;s<t;s+=i)o=e5(s,n[s],n[s+1],o);else for(s=t-i;s>=e;s-=i)o=e5(s,n[s],n[s+1],o);return o&&RS(o,o.next)&&(W0(o),o=o.next),o}function zd(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(RS(t,t.next)||Ei(t.prev,t,t.next)===0)){if(W0(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function G0(n,e,t,i,r,s,o){if(!n)return;!o&&s&&HEe(n,i,r,s);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?LEe(n,i,r,s):DEe(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),W0(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=kEe(zd(n),e,t),G0(n,e,t,i,r,s,2)):o===2&&BEe(n,e,t,i,r,s):G0(zd(n),e,t,i,r,s,1);break}}}function DEe(n){const e=n.prev,t=n,i=n.next;if(Ei(e,t,i)>=0)return!1;const r=e.x,s=t.x,o=i.x,a=e.y,l=t.y,c=i.y,u=r<s?r<o?r:o:s<o?s:o,h=a<l?a<c?a:c:l<c?l:c,f=r>s?r>o?r:o:s>o?s:o,m=a>l?a>c?a:c:l>c?l:c;let y=i.next;for(;y!==e;){if(y.x>=u&&y.x<=f&&y.y>=h&&y.y<=m&&_p(r,a,s,l,o,c,y.x,y.y)&&Ei(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function LEe(n,e,t,i){const r=n.prev,s=n,o=n.next;if(Ei(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,u=r.y,h=s.y,f=o.y,m=a<l?a<c?a:c:l<c?l:c,y=u<h?u<f?u:f:h<f?h:f,_=a>l?a>c?a:c:l>c?l:c,v=u>h?u>f?u:f:h>f?h:f,g=DR(m,y,e,t,i),w=DR(_,v,e,t,i);let A=n.prevZ,T=n.nextZ;for(;A&&A.z>=g&&T&&T.z<=w;){if(A.x>=m&&A.x<=_&&A.y>=y&&A.y<=v&&A!==r&&A!==o&&_p(a,u,l,h,c,f,A.x,A.y)&&Ei(A.prev,A,A.next)>=0||(A=A.prevZ,T.x>=m&&T.x<=_&&T.y>=y&&T.y<=v&&T!==r&&T!==o&&_p(a,u,l,h,c,f,T.x,T.y)&&Ei(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;A&&A.z>=g;){if(A.x>=m&&A.x<=_&&A.y>=y&&A.y<=v&&A!==r&&A!==o&&_p(a,u,l,h,c,f,A.x,A.y)&&Ei(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;T&&T.z<=w;){if(T.x>=m&&T.x<=_&&T.y>=y&&T.y<=v&&T!==r&&T!==o&&_p(a,u,l,h,c,f,T.x,T.y)&&Ei(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function kEe(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!RS(r,s)&&WK(r,i,i.next,s)&&j0(r,s)&&j0(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),W0(i),W0(i.next),i=n=s),i=i.next}while(i!==n);return zd(i)}function BEe(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&WEe(o,a)){let l=KK(o,a);o=zd(o,o.next),l=zd(l,l.next),G0(o,e,t,i,r,s,0),G0(l,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function OEe(n,e,t,i){const r=[];let s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*i,l=s<o-1?e[s+1]*i:n.length,c=jK(n,a,l,i,!1),c===c.next&&(c.steiner=!0),r.push(jEe(c));for(r.sort(FEe),s=0;s<r.length;s++)t=UEe(r[s],t);return t}function FEe(n,e){return n.x-e.x}function UEe(n,e){const t=VEe(n,e);if(!t)return e;const i=KK(t,n);return zd(i,i.next),zd(t,t.next)}function VEe(n,e){let t=e,i=-1/0,r;const s=n.x,o=n.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){const f=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=s&&f>i&&(i=f,r=t.x<t.next.x?t:t.next,f===s))return r}t=t.next}while(t!==e);if(!r)return null;const a=r,l=r.x,c=r.y;let u=1/0,h;t=r;do s>=t.x&&t.x>=l&&s!==t.x&&_p(o<c?s:i,o,l,c,o<c?i:s,o,t.x,t.y)&&(h=Math.abs(o-t.y)/(s-t.x),j0(t,n)&&(h<u||h===u&&(t.x>r.x||t.x===r.x&&zEe(r,t)))&&(r=t,u=h)),t=t.next;while(t!==a);return r}function zEe(n,e){return Ei(n.prev,n,e.prev)<0&&Ei(e.next,n,n.next)<0}function HEe(n,e,t,i){let r=n;do r.z===0&&(r.z=DR(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,GEe(r)}function GEe(n){let e,t,i,r,s,o,a,l,c=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e<c&&(a++,i=i.nextZ,!!i);e++);for(l=c;a>0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,c*=2}while(o>1);return n}function DR(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function jEe(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function _p(n,e,t,i,r,s,o,a){return(r-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(i-a)}function WEe(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!KEe(n,e)&&(j0(n,e)&&j0(e,n)&&XEe(n,e)&&(Ei(n.prev,n,e.prev)||Ei(n,e.prev,e))||RS(n,e)&&Ei(n.prev,n,n.next)>0&&Ei(e.prev,e,e.next)>0)}function Ei(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function RS(n,e){return n.x===e.x&&n.y===e.y}function WK(n,e,t,i){const r=Qx(Ei(n,e,t)),s=Qx(Ei(n,e,i)),o=Qx(Ei(t,i,n)),a=Qx(Ei(t,i,e));return!!(r!==s&&o!==a||r===0&&Jx(n,t,e)||s===0&&Jx(n,i,e)||o===0&&Jx(t,n,i)||a===0&&Jx(t,e,i))}function Jx(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Qx(n){return n>0?1:n<0?-1:0}function KEe(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&WK(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function j0(n,e){return Ei(n.prev,n,n.next)<0?Ei(n,e,n.next)>=0&&Ei(n,n.prev,e)>=0:Ei(n,e,n.prev)<0||Ei(n,n.next,e)<0}function XEe(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function KK(n,e){const t=new LR(n.i,n.x,n.y),i=new LR(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function e5(n,e,t,i){const r=new LR(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function W0(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function LR(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function qEe(n,e,t,i){let r=0;for(let s=e,o=t-i;s<t;s+=i)r+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return r}class nl{static area(e){const t=e.length;let i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return nl.area(e)<0}static triangulateShape(e,t){const i=[],r=[],s=[];t5(e),n5(i,e);let o=e.length;t.forEach(t5);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,n5(i,t[l]);const a=NEe.triangulate(i,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function t5(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function n5(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class PS extends un{constructor(e=new wd([new Fe(.5,.5),new Fe(-.5,.5),new Fe(-.5,-.5),new Fe(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new Ot(r,3)),this.setAttribute("uv",new Ot(s,2)),this.computeVertexNormals();function o(a){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1;let f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,m=t.bevelThickness!==void 0?t.bevelThickness:.2,y=t.bevelSize!==void 0?t.bevelSize:m-.1,_=t.bevelOffset!==void 0?t.bevelOffset:0,v=t.bevelSegments!==void 0?t.bevelSegments:3;const g=t.extrudePath,w=t.UVGenerator!==void 0?t.UVGenerator:YEe;let A,T=!1,L,D,R,I;g&&(A=g.getSpacedPoints(u),T=!0,f=!1,L=g.computeFrenetFrames(u,!1),D=new q,R=new q,I=new q),f||(v=0,m=0,y=0,_=0);const M=a.extractPoints(c);let C=M.shape;const k=M.holes;if(!nl.isClockWise(C)){C=C.reverse();for(let ke=0,Ue=k.length;ke<Ue;ke++){const ee=k[ke];nl.isClockWise(ee)&&(k[ke]=ee.reverse())}}const O=nl.triangulateShape(C,k),X=C;for(let ke=0,Ue=k.length;ke<Ue;ke++){const ee=k[ke];C=C.concat(ee)}function le(ke,Ue,ee){return Ue||console.error("THREE.ExtrudeGeometry: vec does not exist"),ke.clone().addScaledVector(Ue,ee)}const ie=C.length,de=O.length;function G(ke,Ue,ee){let xt,je,ht;const $e=ke.x-Ue.x,Mt=ke.y-Ue.y,lt=ee.x-ke.x,Y=ee.y-ke.y,j=$e*$e+Mt*Mt,pe=$e*Y-Mt*lt;if(Math.abs(pe)>Number.EPSILON){const Ie=Math.sqrt(j),ze=Math.sqrt(lt*lt+Y*Y),Ee=Ue.x-Mt/Ie,tt=Ue.y+$e/Ie,nt=ee.x-Y/ze,ct=ee.y+lt/ze,Yt=((nt-Ee)*Y-(ct-tt)*lt)/($e*Y-Mt*lt);xt=Ee+$e*Yt-ke.x,je=tt+Mt*Yt-ke.y;const Xe=xt*xt+je*je;if(Xe<=2)return new Fe(xt,je);ht=Math.sqrt(Xe/2)}else{let Ie=!1;$e>Number.EPSILON?lt>Number.EPSILON&&(Ie=!0):$e<-Number.EPSILON?lt<-Number.EPSILON&&(Ie=!0):Math.sign(Mt)===Math.sign(Y)&&(Ie=!0),Ie?(xt=-Mt,je=$e,ht=Math.sqrt(j)):(xt=$e,je=Mt,ht=Math.sqrt(j/2))}return new Fe(xt/ht,je/ht)}const $=[];for(let ke=0,Ue=X.length,ee=Ue-1,xt=ke+1;ke<Ue;ke++,ee++,xt++)ee===Ue&&(ee=0),xt===Ue&&(xt=0),$[ke]=G(X[ke],X[ee],X[xt]);const te=[];let ue,ve=$.concat();for(let ke=0,Ue=k.length;ke<Ue;ke++){const ee=k[ke];ue=[];for(let xt=0,je=ee.length,ht=je-1,$e=xt+1;xt<je;xt++,ht++,$e++)ht===je&&(ht=0),$e===je&&($e=0),ue[xt]=G(ee[xt],ee[ht],ee[$e]);te.push(ue),ve=ve.concat(ue)}for(let ke=0;ke<v;ke++){const Ue=ke/v,ee=m*Math.cos(Ue*Math.PI/2),xt=y*Math.sin(Ue*Math.PI/2)+_;for(let je=0,ht=X.length;je<ht;je++){const $e=le(X[je],$[je],xt);Ce($e.x,$e.y,-ee)}for(let je=0,ht=k.length;je<ht;je++){const $e=k[je];ue=te[je];for(let Mt=0,lt=$e.length;Mt<lt;Mt++){const Y=le($e[Mt],ue[Mt],xt);Ce(Y.x,Y.y,-ee)}}}const be=y+_;for(let ke=0;ke<ie;ke++){const Ue=f?le(C[ke],ve[ke],be):C[ke];T?(R.copy(L.normals[0]).multiplyScalar(Ue.x),D.copy(L.binormals[0]).multiplyScalar(Ue.y),I.copy(A[0]).add(R).add(D),Ce(I.x,I.y,I.z)):Ce(Ue.x,Ue.y,0)}for(let ke=1;ke<=u;ke++)for(let Ue=0;Ue<ie;Ue++){const ee=f?le(C[Ue],ve[Ue],be):C[Ue];T?(R.copy(L.normals[ke]).multiplyScalar(ee.x),D.copy(L.binormals[ke]).multiplyScalar(ee.y),I.copy(A[ke]).add(R).add(D),Ce(I.x,I.y,I.z)):Ce(ee.x,ee.y,h/u*ke)}for(let ke=v-1;ke>=0;ke--){const Ue=ke/v,ee=m*Math.cos(Ue*Math.PI/2),xt=y*Math.sin(Ue*Math.PI/2)+_;for(let je=0,ht=X.length;je<ht;je++){const $e=le(X[je],$[je],xt);Ce($e.x,$e.y,h+ee)}for(let je=0,ht=k.length;je<ht;je++){const $e=k[je];ue=te[je];for(let Mt=0,lt=$e.length;Mt<lt;Mt++){const Y=le($e[Mt],ue[Mt],xt);T?Ce(Y.x,Y.y+A[u-1].y,A[u-1].x+ee):Ce(Y.x,Y.y,h+ee)}}}he(),Pe();function he(){const ke=r.length/3;if(f){let Ue=0,ee=ie*Ue;for(let xt=0;xt<de;xt++){const je=O[xt];mt(je[2]+ee,je[1]+ee,je[0]+ee)}Ue=u+v*2,ee=ie*Ue;for(let xt=0;xt<de;xt++){const je=O[xt];mt(je[0]+ee,je[1]+ee,je[2]+ee)}}else{for(let Ue=0;Ue<de;Ue++){const ee=O[Ue];mt(ee[2],ee[1],ee[0])}for(let Ue=0;Ue<de;Ue++){const ee=O[Ue];mt(ee[0]+ie*u,ee[1]+ie*u,ee[2]+ie*u)}}i.addGroup(ke,r.length/3-ke,0)}function Pe(){const ke=r.length/3;let Ue=0;Oe(X,Ue),Ue+=X.length;for(let ee=0,xt=k.length;ee<xt;ee++){const je=k[ee];Oe(je,Ue),Ue+=je.length}i.addGroup(ke,r.length/3-ke,1)}function Oe(ke,Ue){let ee=ke.length;for(;--ee>=0;){const xt=ee;let je=ee-1;je<0&&(je=ke.length-1);for(let ht=0,$e=u+v*2;ht<$e;ht++){const Mt=ie*ht,lt=ie*(ht+1),Y=Ue+xt+Mt,j=Ue+je+Mt,pe=Ue+je+lt,Ie=Ue+xt+lt;Lt(Y,j,pe,Ie)}}}function Ce(ke,Ue,ee){l.push(ke),l.push(Ue),l.push(ee)}function mt(ke,Ue,ee){St(ke),St(Ue),St(ee);const xt=r.length/3,je=w.generateTopUV(i,r,xt-3,xt-2,xt-1);Nt(je[0]),Nt(je[1]),Nt(je[2])}function Lt(ke,Ue,ee,xt){St(ke),St(Ue),St(xt),St(Ue),St(ee),St(xt);const je=r.length/3,ht=w.generateSideWallUV(i,r,je-6,je-3,je-2,je-1);Nt(ht[0]),Nt(ht[1]),Nt(ht[3]),Nt(ht[1]),Nt(ht[2]),Nt(ht[3])}function St(ke){r.push(l[ke*3+0]),r.push(l[ke*3+1]),r.push(l[ke*3+2])}function Nt(ke){s.push(ke.x),s.push(ke.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return $Ee(t,i,e)}static fromJSON(e,t){const i=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];i.push(a)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new WE[r.type]().fromJSON(r)),new PS(i,e.options)}}const YEe={generateTopUV:function(n,e,t,i,r){const s=e[t*3],o=e[t*3+1],a=e[i*3],l=e[i*3+1],c=e[r*3],u=e[r*3+1];return[new Fe(s,o),new Fe(a,l),new Fe(c,u)]},generateSideWallUV:function(n,e,t,i,r,s){const o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[i*3],u=e[i*3+1],h=e[i*3+2],f=e[r*3],m=e[r*3+1],y=e[r*3+2],_=e[s*3],v=e[s*3+1],g=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new Fe(o,1-l),new Fe(c,1-h),new Fe(f,1-y),new Fe(_,1-g)]:[new Fe(a,1-l),new Fe(u,1-h),new Fe(m,1-y),new Fe(v,1-g)]}};function $Ee(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,r=n.length;i<r;i++){const s=n[i];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Gv extends Zu{constructor(e=1,t=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],s=[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];super(r,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Gv(e.radius,e.detail)}}class jv extends Zu{constructor(e=1,t=0){const i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(i,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new jv(e.radius,e.detail)}}class NS extends un{constructor(e=.5,t=1,i=32,r=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:s,thetaLength:o},i=Math.max(3,i),r=Math.max(1,r);const a=[],l=[],c=[],u=[];let h=e;const f=(t-e)/r,m=new q,y=new Fe;for(let _=0;_<=r;_++){for(let v=0;v<=i;v++){const g=s+v/i*o;m.x=h*Math.cos(g),m.y=h*Math.sin(g),l.push(m.x,m.y,m.z),c.push(0,0,1),y.x=(m.x/t+1)/2,y.y=(m.y/t+1)/2,u.push(y.x,y.y)}h+=f}for(let _=0;_<r;_++){const v=_*(i+1);for(let g=0;g<i;g++){const w=g+v,A=w,T=w+i+1,L=w+i+2,D=w+1;a.push(A,T,D),a.push(T,L,D)}}this.setIndex(a),this.setAttribute("position",new Ot(l,3)),this.setAttribute("normal",new Ot(c,3)),this.setAttribute("uv",new Ot(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new NS(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class DS extends un{constructor(e=new wd([new Fe(0,.5),new Fe(-.5,-.5),new Fe(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],r=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(a,l,u),a+=l,l=0;this.setIndex(i),this.setAttribute("position",new Ot(r,3)),this.setAttribute("normal",new Ot(s,3)),this.setAttribute("uv",new Ot(o,2));function c(u){const h=r.length/3,f=u.extractPoints(t);let m=f.shape;const y=f.holes;nl.isClockWise(m)===!1&&(m=m.reverse());for(let v=0,g=y.length;v<g;v++){const w=y[v];nl.isClockWise(w)===!0&&(y[v]=w.reverse())}const _=nl.triangulateShape(m,y);for(let v=0,g=y.length;v<g;v++){const w=y[v];m=m.concat(w)}for(let v=0,g=m.length;v<g;v++){const w=m[v];r.push(w.x,w.y,0),s.push(0,0,1),o.push(w.x,w.y)}for(let v=0,g=_.length;v<g;v++){const w=_[v],A=w[0]+h,T=w[1]+h,L=w[2]+h;i.push(A,T,L),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return JEe(t,e)}static fromJSON(e,t){const i=[];for(let r=0,s=e.shapes.length;r<s;r++){const o=t[e.shapes[r]];i.push(o)}return new DS(i,e.curveSegments)}}function JEe(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const r=n[t];e.shapes.push(r.uuid)}else e.shapes.push(n.uuid);return e}class Wv extends un{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(o+a,Math.PI);let c=0;const u=[],h=new q,f=new q,m=[],y=[],_=[],v=[];for(let g=0;g<=i;g++){const w=[],A=g/i;let T=0;g===0&&o===0?T=.5/t:g===i&&l===Math.PI&&(T=-.5/t);for(let L=0;L<=t;L++){const D=L/t;h.x=-e*Math.cos(r+D*s)*Math.sin(o+A*a),h.y=e*Math.cos(o+A*a),h.z=e*Math.sin(r+D*s)*Math.sin(o+A*a),y.push(h.x,h.y,h.z),f.copy(h).normalize(),_.push(f.x,f.y,f.z),v.push(D+T,1-A),w.push(c++)}u.push(w)}for(let g=0;g<i;g++)for(let w=0;w<t;w++){const A=u[g][w+1],T=u[g][w],L=u[g+1][w],D=u[g+1][w+1];(g!==0||o>0)&&m.push(A,T,D),(g!==i-1||l<Math.PI)&&m.push(T,L,D)}this.setIndex(m),this.setAttribute("position",new Ot(y,3)),this.setAttribute("normal",new Ot(_,3)),this.setAttribute("uv",new Ot(v,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Wv(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class LS extends Zu{constructor(e=1,t=0){const i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];super(i,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new LS(e.radius,e.detail)}}class kS extends un{constructor(e=1,t=.4,i=12,r=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:s},i=Math.floor(i),r=Math.floor(r);const o=[],a=[],l=[],c=[],u=new q,h=new q,f=new q;for(let m=0;m<=i;m++)for(let y=0;y<=r;y++){const _=y/r*s,v=m/i*Math.PI*2;h.x=(e+t*Math.cos(v))*Math.cos(_),h.y=(e+t*Math.cos(v))*Math.sin(_),h.z=t*Math.sin(v),a.push(h.x,h.y,h.z),u.x=e*Math.cos(_),u.y=e*Math.sin(_),f.subVectors(h,u).normalize(),l.push(f.x,f.y,f.z),c.push(y/r),c.push(m/i)}for(let m=1;m<=i;m++)for(let y=1;y<=r;y++){const _=(r+1)*m+y-1,v=(r+1)*(m-1)+y-1,g=(r+1)*(m-1)+y,w=(r+1)*m+y;o.push(_,v,w),o.push(v,g,w)}this.setIndex(o),this.setAttribute("position",new Ot(a,3)),this.setAttribute("normal",new Ot(l,3)),this.setAttribute("uv",new Ot(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new kS(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class BS extends un{constructor(e=1,t=.4,i=64,r=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:s,q:o},i=Math.floor(i),r=Math.floor(r);const a=[],l=[],c=[],u=[],h=new q,f=new q,m=new q,y=new q,_=new q,v=new q,g=new q;for(let A=0;A<=i;++A){const T=A/i*s*Math.PI*2;w(T,s,o,e,m),w(T+.01,s,o,e,y),v.subVectors(y,m),g.addVectors(y,m),_.crossVectors(v,g),g.crossVectors(_,v),_.normalize(),g.normalize();for(let L=0;L<=r;++L){const D=L/r*Math.PI*2,R=-t*Math.cos(D),I=t*Math.sin(D);h.x=m.x+(R*g.x+I*_.x),h.y=m.y+(R*g.y+I*_.y),h.z=m.z+(R*g.z+I*_.z),l.push(h.x,h.y,h.z),f.subVectors(h,m).normalize(),c.push(f.x,f.y,f.z),u.push(A/i),u.push(L/r)}}for(let A=1;A<=i;A++)for(let T=1;T<=r;T++){const L=(r+1)*(A-1)+(T-1),D=(r+1)*A+(T-1),R=(r+1)*A+T,I=(r+1)*(A-1)+T;a.push(L,D,I),a.push(D,R,I)}this.setIndex(a),this.setAttribute("position",new Ot(l,3)),this.setAttribute("normal",new Ot(c,3)),this.setAttribute("uv",new Ot(u,2));function w(A,T,L,D,R){const I=Math.cos(A),M=Math.sin(A),C=L/T*A,k=Math.cos(C);R.x=D*(2+k)*.5*I,R.y=D*(2+k)*M*.5,R.z=D*Math.sin(C)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new BS(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class OS extends un{constructor(e=new OD(new q(-1,-1,0),new q(-1,1,0),new q(1,1,0)),t=64,i=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new q,l=new q,c=new Fe;let u=new q;const h=[],f=[],m=[],y=[];_(),this.setIndex(y),this.setAttribute("position",new Ot(h,3)),this.setAttribute("normal",new Ot(f,3)),this.setAttribute("uv",new Ot(m,2));function _(){for(let A=0;A<t;A++)v(A);v(s===!1?t:0),w(),g()}function v(A){u=e.getPointAt(A/t,u);const T=o.normals[A],L=o.binormals[A];for(let D=0;D<=r;D++){const R=D/r*Math.PI*2,I=Math.sin(R),M=-Math.cos(R);l.x=M*T.x+I*L.x,l.y=M*T.y+I*L.y,l.z=M*T.z+I*L.z,l.normalize(),f.push(l.x,l.y,l.z),a.x=u.x+i*l.x,a.y=u.y+i*l.y,a.z=u.z+i*l.z,h.push(a.x,a.y,a.z)}}function g(){for(let A=1;A<=t;A++)for(let T=1;T<=r;T++){const L=(r+1)*(A-1)+(T-1),D=(r+1)*A+(T-1),R=(r+1)*A+T,I=(r+1)*(A-1)+T;y.push(L,D,I),y.push(D,R,I)}}function w(){for(let A=0;A<=t;A++)for(let T=0;T<=r;T++)c.x=A/t,c.y=T/r,m.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new OS(new WE[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class XK extends un{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new q,s=new q;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const h=l[c],f=h.start,m=h.count;for(let y=f,_=f+m;y<_;y+=3)for(let v=0;v<3;v++){const g=a.getX(y+v),w=a.getX(y+(v+1)%3);r.fromBufferAttribute(o,g),s.fromBufferAttribute(o,w),i5(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){const u=3*a+c,h=3*a+(c+1)%3;r.fromBufferAttribute(o,u),s.fromBufferAttribute(o,h),i5(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Ot(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function i5(n,e,t){const i=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}var r5=Object.freeze({__proto__:null,BoxGeometry:tf,CapsuleGeometry:bS,CircleGeometry:CS,ConeGeometry:MS,CylinderGeometry:qm,DodecahedronGeometry:IS,EdgesGeometry:GK,ExtrudeGeometry:PS,IcosahedronGeometry:Gv,LatheGeometry:Hv,OctahedronGeometry:jv,PlaneGeometry:yc,PolyhedronGeometry:Zu,RingGeometry:NS,ShapeGeometry:DS,SphereGeometry:Wv,TetrahedronGeometry:LS,TorusGeometry:kS,TorusKnotGeometry:BS,TubeGeometry:OS,WireframeGeometry:XK});class qK extends or{static get type(){return"ShadowMaterial"}constructor(e){super(),this.isShadowMaterial=!0,this.color=new ft(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}}class YK extends ss{static get type(){return"RawShaderMaterial"}constructor(e){super(e),this.isRawShaderMaterial=!0}}class Kv extends or{static get type(){return"MeshStandardMaterial"}constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.color=new ft(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 ft(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qu,this.normalScale=new Fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mo,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Go extends Kv{static get type(){return"MeshPhysicalMaterial"}constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Fe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Pi(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 ft(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 ft(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new ft(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class $K extends or{static get type(){return"MeshPhongMaterial"}constructor(e){super(),this.isMeshPhongMaterial=!0,this.color=new ft(16777215),this.specular=new ft(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ft(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qu,this.normalScale=new Fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mo,this.combine=Pv,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class JK extends or{static get type(){return"MeshToonMaterial"}constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.color=new ft(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ft(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qu,this.normalScale=new Fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class QK extends or{static get type(){return"MeshNormalMaterial"}constructor(e){super(),this.isMeshNormalMaterial=!0,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qu,this.normalScale=new Fe(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}}class ZK extends or{static get type(){return"MeshLambertMaterial"}constructor(e){super(),this.isMeshLambertMaterial=!0,this.color=new ft(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ft(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qu,this.normalScale=new Fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mo,this.combine=Pv,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class eX extends or{static get type(){return"MeshMatcapMaterial"}constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.color=new ft(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qu,this.normalScale=new Fe(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}}class tX extends as{static get type(){return"LineDashedMaterial"}constructor(e){super(),this.isLineDashedMaterial=!0,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 nd(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function nX(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function iX(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function kR(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,o=0;o!==i;++s){const a=t[s]*e;for(let l=0;l!==e;++l)r[o++]=n[a+l]}return r}function UD(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),t.push(o)),s=n[r++];while(s!==void 0)}function QEe(n,e,t,i,r=30){const s=n.clone();s.name=e;const o=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],u=c.getValueSize(),h=[],f=[];for(let m=0;m<c.times.length;++m){const y=c.times[m]*r;if(!(y<t||y>=i)){h.push(c.times[m]);for(let _=0;_<u;++_)f.push(c.values[m*u+_])}}h.length!==0&&(c.times=nd(h,c.times.constructor),c.values=nd(f,c.values.constructor),o.push(c))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s}function ZEe(n,e=0,t=n,i=30){i<=0&&(i=30);const r=t.tracks.length,s=e/i;for(let o=0;o<r;++o){const a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;const c=n.tracks.find(function(g){return g.name===a.name&&g.ValueTypeName===l});if(c===void 0)continue;let u=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let f=0;const m=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=m/3);const y=a.times.length-1;let _;if(s<=a.times[0]){const g=u,w=h-u;_=a.values.slice(g,w)}else if(s>=a.times[y]){const g=y*h+u,w=g+h-u;_=a.values.slice(g,w)}else{const g=a.createInterpolant(),w=u,A=h-u;g.evaluate(s),_=g.resultBuffer.slice(w,A)}l==="quaternion"&&new xr().fromArray(_).normalize().conjugate().toArray(_);const v=c.times.length;for(let g=0;g<v;++g){const w=g*m+f;if(l==="quaternion")xr.multiplyQuaternionsFlat(c.values,w,_,0,c.values,w);else{const A=m-f*2;for(let T=0;T<A;++T)c.values[w+T]-=_[T]}}}return n.blendMode=gD,n}const eAe={convertArray:nd,isTypedArray:nX,getKeyframeOrder:iX,sortedArray:kR,flattenJSON:UD,subclip:QEe,makeClipAdditive:ZEe};class Ym{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=i+2;;){if(r===void 0){if(e<s)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(s=r,r=t[++i],e<r)break t}o=t.length;break n}if(!(e>=s)){const a=t[1];e<a&&(i=2,s=a);for(let l=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(r=s,s=t[--i-1],e>=s)break t}o=i,i=0;break n}break e}for(;i<o;){const a=i+o>>>1;e<t[a]?o=a:i=a+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=i[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class rX extends Ym{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Qh,endingEnd:Qh}}intervalChanged_(e,t,i){const r=this.parameterPositions;let s=e-2,o=e+1,a=r[s],l=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case Zh:s=e,a=2*t-i;break;case F0:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=i}if(l===void 0)switch(this.getSettings_().endingEnd){case Zh:o=e,l=2*i-t;break;case F0:o=1,l=i+r[1]-r[0];break;default:o=e-1,l=t}const c=(i-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-i),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,h=this._offsetNext,f=this._weightPrev,m=this._weightNext,y=(i-t)/(r-t),_=y*y,v=_*y,g=-f*v+2*f*_-f*y,w=(1+f)*v+(-1.5-2*f)*_+(-.5+f)*y+1,A=(-1-m)*v+(1.5+m)*_+.5*y,T=m*v-m*_;for(let L=0;L!==a;++L)s[L]=g*o[u+L]+w*o[c+L]+A*o[l+L]+T*o[h+L];return s}}class VD extends Ym{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(i-t)/(r-t),h=1-u;for(let f=0;f!==a;++f)s[f]=o[c+f]*h+o[l+f]*u;return s}}class sX extends Ym{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class ba{constructor(e,t,i,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=nd(t,this.TimeBufferType),this.values=nd(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:nd(e.times,Array),values:nd(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new sX(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new VD(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new rX(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case xm:t=this.InterpolantFactoryMethodDiscrete;break;case wm:t=this.InterpolantFactoryMethodLinear;break;case Ww:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return xm;case this.InterpolantFactoryMethodLinear:return wm;case this.InterpolantFactoryMethodSmooth:return Ww}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){const i=this.times,r=i.length;let s=0,o=r-1;for(;s!==r&&i[s]<e;)++s;for(;o!==-1&&i[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=i.slice(s,o),this.values=this.values.slice(s*a,o*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 i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&nX(r))for(let a=0,l=r.length;a!==l;++a){const c=r[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===Ww,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(r)l=!0;else{const h=a*i,f=h-i,m=h+i;for(let y=0;y!==i;++y){const _=t[h+y];if(_!==t[f+y]||_!==t[m+y]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const h=a*i,f=o*i;for(let m=0;m!==i;++m)t[f+m]=t[h+m]}++o}}if(s>0){e[o]=e[s];for(let a=s*i,l=o*i,c=0;c!==i;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}ba.prototype.TimeBufferType=Float32Array;ba.prototype.ValueBufferType=Float32Array;ba.prototype.DefaultInterpolation=wm;class nf extends ba{constructor(e,t,i){super(e,t,i)}}nf.prototype.ValueTypeName="bool";nf.prototype.ValueBufferType=Array;nf.prototype.DefaultInterpolation=xm;nf.prototype.InterpolantFactoryMethodLinear=void 0;nf.prototype.InterpolantFactoryMethodSmooth=void 0;class zD extends ba{}zD.prototype.ValueTypeName="color";class Hd extends ba{}Hd.prototype.ValueTypeName="number";class oX extends Ym{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(r-t);let c=e*a;for(let u=c+a;c!==u;c+=4)xr.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Gd extends ba{InterpolantFactoryMethodLinear(e){return new oX(this.times,this.values,this.getValueSize(),e)}}Gd.prototype.ValueTypeName="quaternion";Gd.prototype.InterpolantFactoryMethodSmooth=void 0;class rf extends ba{constructor(e,t,i){super(e,t,i)}}rf.prototype.ValueTypeName="string";rf.prototype.ValueBufferType=Array;rf.prototype.DefaultInterpolation=xm;rf.prototype.InterpolantFactoryMethodLinear=void 0;rf.prototype.InterpolantFactoryMethodSmooth=void 0;class jd extends ba{}jd.prototype.ValueTypeName="vector";class Sm{constructor(e="",t=-1,i=[],r=gS){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=fo(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(nAe(i[o]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=i.length;s!==o;++s)t.push(ba.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);const u=iX(l);l=kR(l,1,u),c=kR(c,1,u),!r&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new Hd(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/i))}return new this(e,-1,o)}static findByName(e,t){let i=e;if(!Array.isArray(e)){const r=e;i=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null}static CreateClipsFromMorphTargetSequences(e,t,i){const r={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){const c=e[a],u=c.name.match(s);if(u&&u.length>1){const h=u[1];let f=r[h];f||(r[h]=f=[]),f.push(c)}}const o=[];for(const a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(h,f,m,y,_){if(m.length!==0){const v=[],g=[];UD(m,v,g,y),v.length!==0&&_.push(new h(f,v,g))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h<c.length;h++){const f=c[h].keys;if(!(!f||f.length===0))if(f[0].morphTargets){const m={};let y;for(y=0;y<f.length;y++)if(f[y].morphTargets)for(let _=0;_<f[y].morphTargets.length;_++)m[f[y].morphTargets[_]]=-1;for(const _ in m){const v=[],g=[];for(let w=0;w!==f[y].morphTargets.length;++w){const A=f[y];v.push(A.time),g.push(A.morphTarget===_?1:0)}r.push(new Hd(".morphTargetInfluence["+_+"]",v,g))}l=m.length*o}else{const m=".bones["+t[h].name+"]";i(jd,m+".position",f,"pos",r),i(Gd,m+".quaternion",f,"rot",r),i(jd,m+".scale",f,"scl",r)}}return r.length===0?null:new this(s,l,r,a)}resetDuration(){const e=this.tracks;let t=0;for(let i=0,r=e.length;i!==r;++i){const s=this.tracks[i];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function tAe(n){switch(n.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Hd;case"vector":case"vector2":case"vector3":case"vector4":return jd;case"color":return zD;case"quaternion":return Gd;case"bool":case"boolean":return nf;case"string":return rf}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+n)}function nAe(n){if(n.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=tAe(n.type);if(n.times===void 0){const t=[],i=[];UD(n.keys,t,i,"value"),n.times=t,n.values=i}return e.parse!==void 0?e.parse(n):new e(n.name,n.times,n.values,n.interpolation)}const Wl={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(this.files[n]=e)},get:function(n){if(this.enabled!==!1)return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};class FS{constructor(e,t,i){const r=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){const h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,f=c.length;h<f;h+=2){const m=c[h],y=c[h+1];if(m.global&&(m.lastIndex=0),m.test(u))return y}return null}}}const aX=new FS;class Lr{constructor(e){this.manager=e!==void 0?e:aX,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const i=this;return new Promise(function(r,s){i.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}Lr.DEFAULT_MATERIAL_NAME="__DEFAULT";const Cl={};class iAe extends Error{constructor(e,t){super(e),this.response=t}}class Pr extends Lr{constructor(e){super(e)}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Wl.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Cl[e]!==void 0){Cl[e].push({onLoad:t,onProgress:i,onError:r});return}Cl[e]=[],Cl[e].push({onLoad:t,onProgress:i,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=Cl[e],h=c.body.getReader(),f=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),m=f?parseInt(f):0,y=m!==0;let _=0;const v=new ReadableStream({start(g){w();function w(){h.read().then(({done:A,value:T})=>{if(A)g.close();else{_+=T.byteLength;const L=new ProgressEvent("progress",{lengthComputable:y,loaded:_,total:m});for(let D=0,R=u.length;D<R;D++){const I=u[D];I.onProgress&&I.onProgress(L)}g.enqueue(T),w()}},A=>{g.error(A)})}}});return new Response(v)}else throw new iAe(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),f=h&&h[1]?h[1].toLowerCase():void 0,m=new TextDecoder(f);return c.arrayBuffer().then(y=>m.decode(y))}}}).then(c=>{Wl.add(e,c);const u=Cl[e];delete Cl[e];for(let h=0,f=u.length;h<f;h++){const m=u[h];m.onLoad&&m.onLoad(c)}}).catch(c=>{const u=Cl[e];if(u===void 0)throw this.manager.itemError(e),c;delete Cl[e];for(let h=0,f=u.length;h<f;h++){const m=u[h];m.onError&&m.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class rAe extends Lr{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Pr(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=[];for(let i=0;i<e.length;i++){const r=Sm.parse(e[i]);t.push(r)}return t}}class sAe extends Lr{constructor(e){super(e)}load(e,t,i,r){const s=this,o=[],a=new SS,l=new Pr(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function u(h){l.load(e[h],function(f){const m=s.parse(f,!0);o[h]={width:m.width,height:m.height,format:m.format,mipmaps:m.mipmaps},c+=1,c===6&&(m.mipmapCount===1&&(a.minFilter=Gn),a.image=o,a.format=m.format,a.needsUpdate=!0,t&&t(a))},i,r)}if(Array.isArray(e))for(let h=0,f=e.length;h<f;++h)u(h);else l.load(e,function(h){const f=s.parse(h,!0);if(f.isCubemap){const m=f.mipmaps.length/f.mipmapCount;for(let y=0;y<m;y++){o[y]={mipmaps:[]};for(let _=0;_<f.mipmapCount;_++)o[y].mipmaps.push(f.mipmaps[y*f.mipmapCount+_]),o[y].format=f.format,o[y].width=f.width,o[y].height=f.height}a.image=o}else a.image.width=f.width,a.image.height=f.height,a.mipmaps=f.mipmaps;f.mipmapCount===1&&(a.minFilter=Gn),a.format=f.format,a.needsUpdate=!0,t&&t(a)},i,r);return a}}class K0 extends Lr{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Wl.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=z0("img");function l(){u(),Wl.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),r&&r(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class lX extends Lr{constructor(e){super(e)}load(e,t,i,r){const s=new Ov;s.colorSpace=ys;const o=new K0(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(u){s.images[c]=u,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,r)}for(let c=0;c<e.length;++c)l(c);return s}}class HD extends Lr{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new ya,a=new Pr(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(l){let c;try{c=s.parse(l)}catch(u){if(r!==void 0)r(u);else{console.error(u);return}}c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:Ui,o.wrapT=c.wrapT!==void 0?c.wrapT:Ui,o.magFilter=c.magFilter!==void 0?c.magFilter:Gn,o.minFilter=c.minFilter!==void 0?c.minFilter:Gn,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(o.colorSpace=c.colorSpace),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=Oo),c.mipmapCount===1&&(o.minFilter=Gn),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c)},i,r),o}}class cX extends Lr{constructor(e){super(e)}load(e,t,i,r){const s=new qn,o=new K0(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class eh extends Rn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ft(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class uX extends eh{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Rn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ft(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const NC=new qt,s5=new q,o5=new q;class GD{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Fe(512,512),this.map=null,this.mapPass=null,this.matrix=new qt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Fv,this._frameExtents=new Fe(1,1),this._viewportCount=1,this._viewports=[new Bn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;s5.setFromMatrixPosition(e.matrixWorld),t.position.copy(s5),o5.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(o5),t.updateMatrixWorld(),NC.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(NC),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(NC)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class oAe extends GD{constructor(){super(new Ni(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=Em*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class jD extends eh{constructor(e,t,i=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Rn.DEFAULT_UP),this.updateMatrix(),this.target=new Rn,this.distance=i,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new oAe}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const a5=new qt,Xg=new q,DC=new q;class aAe extends GD{constructor(){super(new Ni(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Fe(4,2),this._viewportCount=6,this._viewports=[new Bn(2,1,1,1),new Bn(0,1,1,1),new Bn(3,1,1,1),new Bn(1,1,1,1),new Bn(3,0,1,1),new Bn(1,0,1,1)],this._cubeDirections=[new q(1,0,0),new q(-1,0,0),new q(0,0,1),new q(0,0,-1),new q(0,1,0),new q(0,-1,0)],this._cubeUps=[new q(0,1,0),new q(0,1,0),new q(0,1,0),new q(0,1,0),new q(0,0,1),new q(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),Xg.setFromMatrixPosition(e.matrixWorld),i.position.copy(Xg),DC.copy(i.position),DC.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(DC),i.updateMatrixWorld(),r.makeTranslation(-Xg.x,-Xg.y,-Xg.z),a5.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(a5)}}class WD extends eh{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new aAe}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class lAe extends GD{constructor(){super(new tl(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class KD extends eh{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Rn.DEFAULT_UP),this.updateMatrix(),this.target=new Rn,this.shadow=new lAe}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class hX extends eh{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class dX extends eh{constructor(e,t,i=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=r}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}}class fX{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new q)}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 i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*i),t.addScaledVector(o[4],1.092548*(i*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(i*s)),t.addScaledVector(o[8],.546274*(i*i-r*r)),t}getIrradianceAt(e,t){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*i),t.addScaledVector(o[4],2*.429043*i*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*i*s),t.addScaledVector(o[8],.429043*(i*i-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],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 i=this.coefficients;for(let r=0;r<9;r++)i[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const i=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*i,t[4]=1.092548*i*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*i*s,t[8]=.546274*(i*i-r*r)}}class pX extends eh{constructor(e=new fX,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}}class US extends Lr{constructor(e){super(e),this.textures={}}load(e,t,i,r){const s=this,o=new Pr(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=this.textures;function i(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const r=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=e.sheen),e.sheenColor!==void 0&&(r.sheenColor=new ft().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(r.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&r.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular!==void 0&&r.specular.setHex(e.specular),e.specularIntensity!==void 0&&(r.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&r.specularColor!==void 0&&r.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(r.dispersion=e.dispersion),e.iridescence!==void 0&&(r.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(r.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(r.transmission=e.transmission),e.thickness!==void 0&&(r.thickness=e.thickness),e.attenuationDistance!==void 0&&(r.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&r.attenuationColor!==void 0&&r.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(r.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(r.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.shadowSide!==void 0&&(r.shadowSide=e.shadowSide),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(r.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(r.depthFunc=e.depthFunc),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(r.blendSrc=e.blendSrc),e.blendDst!==void 0&&(r.blendDst=e.blendDst),e.blendEquation!==void 0&&(r.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(r.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(r.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(r.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&r.blendColor!==void 0&&r.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(r.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==void 0&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(r.dithering=e.dithering),e.alphaToCoverage!==void 0&&(r.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(r.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(r.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(r.uniforms[s]={},o.type){case"t":r.uniforms[s].value=i(o.value);break;case"c":r.uniforms[s].value=new ft().setHex(o.value);break;case"v2":r.uniforms[s].value=new Fe().fromArray(o.value);break;case"v3":r.uniforms[s].value=new q().fromArray(o.value);break;case"v4":r.uniforms[s].value=new Bn().fromArray(o.value);break;case"m3":r.uniforms[s].value=new cn().fromArray(o.value);break;case"m4":r.uniforms[s].value=new qt().fromArray(o.value);break;default:r.uniforms[s].value=o.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=i(e.map)),e.matcap!==void 0&&(r.matcap=i(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new Fe().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=i(e.envMap)),e.envMapRotation!==void 0&&r.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new Fe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return US.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:qK,SpriteMaterial:MD,RawShaderMaterial:YK,ShaderMaterial:ss,PointsMaterial:AS,MeshPhysicalMaterial:Go,MeshStandardMaterial:Kv,MeshPhongMaterial:$K,MeshToonMaterial:JK,MeshNormalMaterial:QK,MeshLambertMaterial:ZK,MeshDepthMaterial:_S,MeshDistanceMaterial:bD,MeshBasicMaterial:Fs,MeshMatcapMaterial:eX,LineDashedMaterial:tX,LineBasicMaterial:as,Material:or};return new t[e]}}class Su{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i<r;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class mX extends un{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}}class gX extends Lr{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Pr(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t={},i={};function r(m,y){if(t[y]!==void 0)return t[y];const v=m.interleavedBuffers[y],g=s(m,v.buffer),w=yp(v.type,g),A=new Vv(w,v.stride);return A.uuid=v.uuid,t[y]=A,A}function s(m,y){if(i[y]!==void 0)return i[y];const v=m.arrayBuffers[y],g=new Uint32Array(v).buffer;return i[y]=g,g}const o=e.isInstancedBufferGeometry?new mX:new un,a=e.data.index;if(a!==void 0){const m=yp(a.type,a.array);o.setIndex(new Fn(m,1))}const l=e.data.attributes;for(const m in l){const y=l[m];let _;if(y.isInterleavedBufferAttribute){const v=r(e.data,y.data);_=new Gu(v,y.itemSize,y.offset,y.normalized)}else{const v=yp(y.type,y.array),g=y.isInstancedBufferAttribute?Vd:Fn;_=new g(v,y.itemSize,y.normalized)}y.name!==void 0&&(_.name=y.name),y.usage!==void 0&&_.setUsage(y.usage),o.setAttribute(m,_)}const c=e.data.morphAttributes;if(c)for(const m in c){const y=c[m],_=[];for(let v=0,g=y.length;v<g;v++){const w=y[v];let A;if(w.isInterleavedBufferAttribute){const T=r(e.data,w.data);A=new Gu(T,w.itemSize,w.offset,w.normalized)}else{const T=yp(w.type,w.array);A=new Fn(T,w.itemSize,w.normalized)}w.name!==void 0&&(A.name=w.name),_.push(A)}o.morphAttributes[m]=_}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let m=0,y=h.length;m!==y;++m){const _=h[m];o.addGroup(_.start,_.count,_.materialIndex)}const f=e.data.boundingSphere;if(f!==void 0){const m=new q;f.center!==void 0&&m.fromArray(f.center),o.boundingSphere=new Rr(m,f.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class cAe extends Lr{constructor(e){super(e)}load(e,t,i,r){const s=this,o=this.path===""?Su.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new Pr(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(h){r!==void 0&&r(h),console.error("THREE:ObjectLoader: Can't parse "+e+".",h.message);return}const u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){r!==void 0&&r(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},i,r)}async loadAsync(e,t){const i=this,r=this.path===""?Su.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||r;const s=new Pr(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=await s.loadAsync(e,t),a=JSON.parse(o),l=a.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await i.parseAsync(a)}parse(e,t){const i=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,r),o=this.parseImages(e.images,function(){t!==void 0&&t(c)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),c=this.parseObject(e.object,s,l,a,i),u=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,u),this.bindLightTargets(c),t!==void 0){let h=!1;for(const f in o)if(o[f].data instanceof HTMLImageElement){h=!0;break}h===!1&&t(c)}return c}async parseAsync(e){const t=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),s=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,r,a,o,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),this.bindLightTargets(l),l}parseShapes(e){const t={};if(e!==void 0)for(let i=0,r=e.length;i<r;i++){const s=new wd().fromJSON(e[i]);t[s.uuid]=s}return t}parseSkeletons(e,t){const i={},r={};if(t.traverse(function(s){s.isBone&&(r[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=new zv().fromJSON(e[s],r);i[a.uuid]=a}return i}parseGeometries(e,t){const i={};if(e!==void 0){const r=new gX;for(let s=0,o=e.length;s<o;s++){let a;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=r.parse(l);break;default:l.type in r5?a=r5[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),l.userData!==void 0&&(a.userData=l.userData),i[l.uuid]=a}}return i}parseMaterials(e,t){const i={},r={};if(e!==void 0){const s=new US;s.setTextures(t);for(let o=0,a=e.length;o<a;o++){const l=e[o];i[l.uuid]===void 0&&(i[l.uuid]=s.parse(l)),r[l.uuid]=i[l.uuid]}}return r}parseAnimations(e){const t={};if(e!==void 0)for(let i=0;i<e.length;i++){const r=e[i],s=Sm.parse(r);t[s.uuid]=s}return t}parseImages(e,t){const i=this,r={};let s;function o(l){return i.manager.itemStart(l),s.load(l,function(){i.manager.itemEnd(l)},void 0,function(){i.manager.itemError(l),i.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){const c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:i.resourcePath+c;return o(u)}else return l.data?{data:yp(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new FS(t);s=new K0(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c<u;c++){const h=e[c],f=h.url;if(Array.isArray(f)){const m=[];for(let y=0,_=f.length;y<_;y++){const v=f[y],g=a(v);g!==null&&(g instanceof HTMLImageElement?m.push(g):m.push(new ya(g.data,g.width,g.height)))}r[h.uuid]=new ed(m)}else{const m=a(h.url);r[h.uuid]=new ed(m)}}}return r}async parseImagesAsync(e){const t=this,i={};let r;async function s(o){if(typeof o=="string"){const a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await r.loadAsync(l)}else return o.data?{data:yp(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){r=new K0(this.manager),r.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const l=e[o],c=l.url;if(Array.isArray(c)){const u=[];for(let h=0,f=c.length;h<f;h++){const m=c[h],y=await s(m);y!==null&&(y instanceof HTMLImageElement?u.push(y):u.push(new ya(y.data,y.width,y.height)))}i[l.uuid]=new ed(u)}else{const u=await s(l.url);i[l.uuid]=new ed(u)}}}return i}parseTextures(e,t){function i(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const r={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=e[s];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 l=t[a.image],c=l.data;let u;Array.isArray(c)?(u=new Ov,c.length===6&&(u.needsUpdate=!0)):(c&&c.data?u=new ya:u=new qn,c&&(u.needsUpdate=!0)),u.source=l,u.uuid=a.uuid,a.name!==void 0&&(u.name=a.name),a.mapping!==void 0&&(u.mapping=i(a.mapping,uAe)),a.channel!==void 0&&(u.channel=a.channel),a.offset!==void 0&&u.offset.fromArray(a.offset),a.repeat!==void 0&&u.repeat.fromArray(a.repeat),a.center!==void 0&&u.center.fromArray(a.center),a.rotation!==void 0&&(u.rotation=a.rotation),a.wrap!==void 0&&(u.wrapS=i(a.wrap[0],l5),u.wrapT=i(a.wrap[1],l5)),a.format!==void 0&&(u.format=a.format),a.internalFormat!==void 0&&(u.internalFormat=a.internalFormat),a.type!==void 0&&(u.type=a.type),a.colorSpace!==void 0&&(u.colorSpace=a.colorSpace),a.minFilter!==void 0&&(u.minFilter=i(a.minFilter,c5)),a.magFilter!==void 0&&(u.magFilter=i(a.magFilter,c5)),a.anisotropy!==void 0&&(u.anisotropy=a.anisotropy),a.flipY!==void 0&&(u.flipY=a.flipY),a.generateMipmaps!==void 0&&(u.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(u.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(u.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(u.compareFunction=a.compareFunction),a.userData!==void 0&&(u.userData=a.userData),r[a.uuid]=u}return r}parseObject(e,t,i,r,s){let o;function a(f){return t[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",f),t[f]}function l(f){if(f!==void 0){if(Array.isArray(f)){const m=[];for(let y=0,_=f.length;y<_;y++){const v=f[y];i[v]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",v),m.push(i[v])}return m}return i[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",f),i[f]}}function c(f){return r[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",f),r[f]}let u,h;switch(e.type){case"Scene":o=new Uv,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new ft(e.background):o.background=c(e.background)),e.environment!==void 0&&(o.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new wS(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new xS(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(o.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new Ni(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new tl(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new hX(e.color,e.intensity);break;case"DirectionalLight":o=new KD(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new WD(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new dX(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new jD(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new uX(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new pX().fromJSON(e);break;case"SkinnedMesh":u=a(e.geometry),h=l(e.material),o=new ID(u,h),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":u=a(e.geometry),h=l(e.material),o=new fi(u,h);break;case"InstancedMesh":u=a(e.geometry),h=l(e.material);const f=e.count,m=e.instanceMatrix,y=e.instanceColor;o=new RD(u,h,f),o.instanceMatrix=new Vd(new Float32Array(m.array),16),y!==void 0&&(o.instanceColor=new Vd(new Float32Array(y.array),y.itemSize));break;case"BatchedMesh":u=a(e.geometry),h=l(e.material),o=new OK(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,h),o.geometry=u,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._visibility=e.visibility,o._active=e.active,o._bounds=e.bounds.map(_=>{const v=new ns;v.min.fromArray(_.boxMin),v.max.fromArray(_.boxMax);const g=new Rr;return g.radius=_.sphereRadius,g.center.fromArray(_.sphereCenter),{boxInitialized:_.boxInitialized,box:v,sphereInitialized:_.sphereInitialized,sphere:g}}),o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=c(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=c(e.colorsTexture.uuid));break;case"LOD":o=new BK;break;case"Line":o=new uc(a(e.geometry),l(e.material));break;case"LineLoop":o=new PD(a(e.geometry),l(e.material));break;case"LineSegments":o=new Sa(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new ND(a(e.geometry),l(e.material));break;case"Sprite":o=new kK(l(e.material));break;case"Group":o=new jl;break;case"Bone":o=new ES;break;default:o=new Rn}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const f=e.children;for(let m=0;m<f.length;m++)o.add(this.parseObject(f[m],t,i,r,s))}if(e.animations!==void 0){const f=e.animations;for(let m=0;m<f.length;m++){const y=f[m];o.animations.push(s[y])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const f=e.levels;for(let m=0;m<f.length;m++){const y=f[m],_=o.getObjectByProperty("uuid",y.object);_!==void 0&&o.addLevel(_,y.distance,y.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(i){if(i.isSkinnedMesh===!0&&i.skeleton!==void 0){const r=t[i.skeleton];r===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",i.skeleton):i.bind(r,i.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const i=t.target,r=e.getObjectByProperty("uuid",i);r!==void 0?t.target=r:t.target=new Rn}})}}const uAe={UVMapping:Vu,CubeReflectionMapping:al,CubeRefractionMapping:zu,EquirectangularReflectionMapping:ym,EquirectangularRefractionMapping:O0,CubeUVReflectionMapping:Km},l5={RepeatWrapping:Hu,ClampToEdgeWrapping:Ui,MirroredRepeatWrapping:vm},c5={NearestFilter:_r,NearestMipmapNearestFilter:cS,NearestMipmapLinearFilter:Jh,LinearFilter:Gn,LinearMipmapNearestFilter:Bp,LinearMipmapLinearFilter:Oo};class yX extends Lr{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Wl.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{t&&t(c),s.manager.itemEnd(e)}).catch(c=>{r&&r(c)});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Wl.add(e,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){r&&r(c),Wl.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Wl.add(e,l),s.manager.itemStart(e)}}let Zx;class XD{static getContext(){return Zx===void 0&&(Zx=new(window.AudioContext||window.webkitAudioContext)),Zx}static setContext(e){Zx=e}}class hAe extends Lr{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Pr(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);XD.getContext().decodeAudioData(c,function(h){t(h)}).catch(a)}catch(c){a(c)}},i,r);function a(l){r?r(l):console.error(l),s.manager.itemError(e)}}}const u5=new qt,h5=new qt,Ch=new qt;class dAe{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ni,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ni,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,Ch.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,o=t.near*Math.tan(_d*t.fov*.5)/t.zoom;let a,l;h5.elements[12]=-r,u5.elements[12]=r,a=-o*t.aspect+s,l=o*t.aspect+s,Ch.elements[0]=2*t.near/(l-a),Ch.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Ch),a=-o*t.aspect-s,l=o*t.aspect-s,Ch.elements[0]=2*t.near/(l-a),Ch.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Ch)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(h5),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(u5)}}class qD{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=d5(),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=d5();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function d5(){return performance.now()}const Mh=new q,f5=new xr,fAe=new q,Ih=new q;class pAe extends Rn{constructor(){super(),this.type="AudioListener",this.context=XD.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new qD}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,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Mh,f5,fAe),Ih.set(0,0,-1).applyQuaternion(f5),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Mh.x,r),t.positionY.linearRampToValueAtTime(Mh.y,r),t.positionZ.linearRampToValueAtTime(Mh.z,r),t.forwardX.linearRampToValueAtTime(Ih.x,r),t.forwardY.linearRampToValueAtTime(Ih.y,r),t.forwardZ.linearRampToValueAtTime(Ih.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(Mh.x,Mh.y,Mh.z),t.setOrientation(Ih.x,Ih.y,Ih.z,i.x,i.y,i.z)}}class vX extends Rn{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(e=0){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.context.currentTime+e),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._connected!==!1){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){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 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}}const Rh=new q,p5=new xr,mAe=new q,Ph=new q;class gAe extends vX{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,i){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=i,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Rh,p5,mAe),Ph.set(0,0,1).applyQuaternion(p5);const t=this.panner;if(t.positionX){const i=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Rh.x,i),t.positionY.linearRampToValueAtTime(Rh.y,i),t.positionZ.linearRampToValueAtTime(Rh.z,i),t.orientationX.linearRampToValueAtTime(Ph.x,i),t.orientationY.linearRampToValueAtTime(Ph.y,i),t.orientationZ.linearRampToValueAtTime(Ph.z,i)}else t.setPosition(Rh.x,Rh.y,Rh.z),t.setOrientation(Ph.x,Ph.y,Ph.z)}}class yAe{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 i=0;i<t.length;i++)e+=t[i];return e/t.length}}class _X{constructor(e,t,i){this.binding=e,this.valueSize=i;let r,s,o;switch(t){case"quaternion":r=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":r=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:r=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const i=this.buffer,r=this.valueSize,s=e*r+r;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==r;++a)i[s+a]=i[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(i,s,0,a,r)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,i=this.valueSize,r=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,i=this.buffer,r=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(i,r,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){a.setValue(i,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let s=i,o=r;s!==o;++s)t[s]=t[r+s%i];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 i=e;i<t;i++)this.buffer[i]=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 i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,r,s){if(r>=.5)for(let o=0;o!==s;++o)e[t+o]=e[i+o]}_slerp(e,t,i,r){xr.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const o=this._workIndex*s;xr.multiplyQuaternionsFlat(e,o,e,t,e,i),xr.slerpFlat(e,t,e,t,e,o,r)}_lerp(e,t,i,r,s){const o=1-r;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[i+a]*r}}_lerpAdditive(e,t,i,r,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[i+o]*r}}}const YD="\\[\\]\\.:\\/",vAe=new RegExp("["+YD+"]","g"),$D="[^"+YD+"]",_Ae="[^"+YD.replace("\\.","")+"]",xAe=/((?:WC+[\/:])*)/.source.replace("WC",$D),wAe=/(WCOD+)?/.source.replace("WCOD",_Ae),EAe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",$D),AAe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",$D),SAe=new RegExp("^"+xAe+wAe+EAe+AAe+"$"),TAe=["material","materials","bones","map"];class bAe{constructor(e,t,i){const r=i||Dn.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class Dn{constructor(e,t,i){this.path=t,this.parsedPath=i||Dn.parseTrackName(t),this.node=Dn.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new Dn.Composite(e,t,i):new Dn(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(vAe,"")}static parseTrackName(e){const t=SAe.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);TAe.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===t||a.uuid===t)return a;const l=i(a.children);if(l)return l}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,i=t.objectName,r=t.propertyName;let s=t.propertyIndex;if(e||(e=Dn.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let c=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const o=e[r];if(o===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Dn.Composite=bAe;Dn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Dn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Dn.prototype.GetterByBindingType=[Dn.prototype._getValue_direct,Dn.prototype._getValue_array,Dn.prototype._getValue_arrayElement,Dn.prototype._getValue_toArray];Dn.prototype.SetterByBindingTypeAndVersioning=[[Dn.prototype._setValue_direct,Dn.prototype._setValue_direct_setNeedsUpdate,Dn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Dn.prototype._setValue_array,Dn.prototype._setValue_array_setNeedsUpdate,Dn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Dn.prototype._setValue_arrayElement,Dn.prototype._setValue_arrayElement_setNeedsUpdate,Dn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Dn.prototype._setValue_fromArray,Dn.prototype._setValue_fromArray_setNeedsUpdate,Dn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class CAe{constructor(){this.isAnimationObjectGroup=!0,this.uuid=fo(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let i=0,r=arguments.length;i!==r;++i)e[arguments[i].uuid]=i;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,i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length;let a,l=e.length,c=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){const f=arguments[u],m=f.uuid;let y=t[m];if(y===void 0){y=l++,t[m]=y,e.push(f);for(let _=0,v=o;_!==v;++_)s[_].push(new Dn(f,i[_],r[_]))}else if(y<c){a=e[y];const _=--c,v=e[_];t[v.uuid]=y,e[y]=v,t[m]=_,e[_]=f;for(let g=0,w=o;g!==w;++g){const A=s[g],T=A[_];let L=A[y];A[y]=T,L===void 0&&(L=new Dn(f,i[g],r[g])),A[_]=L}}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_=c}remove(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const l=arguments[o],c=l.uuid,u=t[c];if(u!==void 0&&u>=s){const h=s++,f=e[h];t[f.uuid]=u,e[u]=f,t[c]=h,e[h]=l;for(let m=0,y=r;m!==y;++m){const _=i[m],v=_[h],g=_[u];_[u]=v,_[h]=g}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,h=t[u];if(h!==void 0)if(delete t[u],h<s){const f=--s,m=e[f],y=--o,_=e[y];t[m.uuid]=h,e[h]=m,t[_.uuid]=f,e[f]=_,e.pop();for(let v=0,g=r;v!==g;++v){const w=i[v],A=w[f],T=w[y];w[h]=A,w[f]=T,w.pop()}}else{const f=--o,m=e[f];f>0&&(t[m.uuid]=h),e[h]=m,e.pop();for(let y=0,_=r;y!==_;++y){const v=i[y];v[h]=v[f],v.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let r=i[e];const s=this._bindings;if(r!==void 0)return s[r];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);r=s.length,i[e]=r,o.push(e),a.push(t),s.push(h);for(let f=u,m=l.length;f!==m;++f){const y=l[f];h[f]=new Dn(y,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const r=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=i,o[i]=l,o.pop(),s[i]=s[a],s.pop(),r[i]=r[a],r.pop()}}}class xX{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:Qh,endingEnd:Qh};for(let c=0;c!==o;++c){const u=s[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=sK,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,i){if(e.fadeOut(t),this.fadeIn(t),i){const r=this._clip.duration,s=e._clip.duration,o=s/r,a=r/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}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,i){const r=this._mixer,s=r.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+i,c[0]=e/o,c[1]=t/o,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,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case gD:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case gS:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(r,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const o=i===oK;if(e===0)return s===-1?r:o&&(s&1)===1?t-r:r;if(i===rK){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),r>=t||r<0){const a=Math.floor(r/t);r-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=r;if(o&&(s&1)===1)return t-r}return r}_setEndings(e,t,i){const r=this._interpolantSettings;i?(r.endingStart=Zh,r.endingEnd=Zh):(e?r.endingStart=this.zeroSlopeAtStart?Zh:Qh:r.endingStart=F0,t?r.endingEnd=this.zeroSlopeAtEnd?Zh:Qh:r.endingEnd=F0)}_scheduleFading(e,t,i){const r=this._mixer,s=r.time;let o=this._weightInterpolant;o===null&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=i,this}}const MAe=new Float32Array(1);class IAe extends hl{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,o=e._propertyBindings,a=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){const f=r[h],m=f.name;let y=u[m];if(y!==void 0)++y.referenceCount,o[h]=y;else{if(y=o[h],y!==void 0){y._cacheIndex===null&&(++y.referenceCount,this._addInactiveBinding(y,l,m));continue}const _=t&&t._propertyBindings[h].binding.parsedPath;y=new _X(Dn.create(i,m,_),f.ValueTypeName,f.getValueSize()),++y.referenceCount,this._addInactiveBinding(y,l,m),o[h]=y}a[h].resultBuffer=y.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}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,i){const r=this._actions,s=this._actionsByClip;let o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=r.length,r.push(e),o.actionByRoot[i]=e}_removeInactiveAction(e){const t=this._actions,i=t[t.length-1],r=e._cacheIndex;i._cacheIndex=r,t[r]=i,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;const h=a.actionByRoot,f=(e._localRoot||this._root).uuid;delete h[f],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackAction(e){const t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_addInactiveBinding(e,t,i){const r=this._bindingsByRootAndName,s=this._bindings;let o=r[t];o===void 0&&(o={},r[t]=o),o[i]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,i=e.binding,r=i.rootNode.uuid,s=i.path,o=this._bindingsByRootAndName,a=o[r],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[r]}_lendBinding(e){const t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackBinding(e){const t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let i=e[t];return i===void 0&&(i=new VD(new Float32Array(2),new Float32Array(2),1,MAe),i.__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){const t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,s=t[r];e.__cacheIndex=r,t[r]=e,s.__cacheIndex=i,t[i]=s}clipAction(e,t,i){const r=t||this._root,s=r.uuid;let o=typeof e=="string"?Sm.findByName(r,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let c=null;if(i===void 0&&(o!==null?i=o.blendMode:i=gS),l!==void 0){const h=l.actionByRoot[s];if(h!==void 0&&h.blendMode===i)return h;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;const u=new xX(this,o,t,i);return this._bindAction(u,c),this._addInactiveAction(u,a,s),u}existingAction(e,t){const i=t||this._root,r=i.uuid,s=typeof e=="string"?Sm.findByName(i,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[r]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(r,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);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,i=e.uuid,r=this._actionsByClip,s=r[i];if(s!==void 0){const o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){const c=o[a];this._deactivateAction(c);const u=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[i]}}uncacheRoot(e){const t=e.uuid,i=this._actionsByClip;for(const o in i){const a=i[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const r=this._bindingsByRootAndName,s=r[t];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class JD{constructor(e){this.value=e}clone(){return new JD(this.value.clone===void 0?this.value:this.value.clone())}}let RAe=0;class PAe extends hl{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:RAe++}),this.name="",this.usage=U0,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 i=0,r=t.length;i<r;i++){const s=Array.isArray(t[i])?t[i]:[t[i]];for(let o=0;o<s.length;o++)this.uniforms.push(s[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class NAe extends Vv{constructor(e,t,i=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}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}}class DAe{constructor(e,t,i,r,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=i,this.elementSize=r,this.count=s,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}}const m5=new qt;class QD{constructor(e,t,i=0,r=1/0){this.ray=new ef(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new xd,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return m5.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(m5),this}intersectObject(e,t=!0,i=[]){return BR(e,this,i,t),i.sort(g5),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)BR(e[r],this,i,t);return i.sort(g5),i}}function g5(n,e){return n.distance-e.distance}function BR(n,e,t,i){let r=!0;if(n.layers.test(e.layers)&&n.raycast(e,t)===!1&&(r=!1),r===!0&&i===!0){const s=n.children;for(let o=0,a=s.length;o<a;o++)BR(s[o],e,t,!0)}}class OR{constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(Pi(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class LAe{constructor(e=1,t=0,i=0){return this.radius=e,this.theta=t,this.y=i,this}set(e,t,i){return this.radius=e,this.theta=t,this.y=i,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,i){return this.radius=Math.sqrt(e*e+i*i),this.theta=Math.atan2(e,i),this.y=t,this}clone(){return new this.constructor().copy(this)}}class ZD{constructor(e,t,i,r){ZD.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,i,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let i=0;i<4;i++)this.elements[i]=e[i+t];return this}set(e,t,i,r){const s=this.elements;return s[0]=e,s[2]=t,s[1]=i,s[3]=r,this}}const y5=new Fe;class kAe{constructor(e=new Fe(1/0,1/0),t=new Fe(-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,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=y5.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),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,y5).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)}}const v5=new q,ew=new q;class BAe{constructor(e=new q,t=new q){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){v5.subVectors(e,this.start),ew.subVectors(this.end,this.start);const i=ew.dot(ew);let s=ew.dot(v5)/i;return t&&(s=Pi(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).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)}}const _5=new q;class OAe extends Rn{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new un,r=[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 o=0,a=1,l=32;o<l;o++,a++){const c=o/l*Math.PI*2,u=a/l*Math.PI*2;r.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}i.setAttribute("position",new Ot(r,3));const s=new as({fog:!1,toneMapped:!1});this.cone=new Sa(i,s),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),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),_5.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(_5),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Bc=new q,tw=new qt,LC=new qt;class FAe extends Sa{constructor(e){const t=wX(e),i=new un,r=[],s=[],o=new ft(0,0,1),a=new ft(0,1,0);for(let c=0;c<t.length;c++){const u=t[c];u.parent&&u.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}i.setAttribute("position",new Ot(r,3)),i.setAttribute("color",new Ot(s,3));const l=new as({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,l),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,i=this.geometry,r=i.getAttribute("position");LC.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const a=t[s];a.parent&&a.parent.isBone&&(tw.multiplyMatrices(LC,a.matrixWorld),Bc.setFromMatrixPosition(tw),r.setXYZ(o,Bc.x,Bc.y,Bc.z),tw.multiplyMatrices(LC,a.parent.matrixWorld),Bc.setFromMatrixPosition(tw),r.setXYZ(o+1,Bc.x,Bc.y,Bc.z),o+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function wX(n){const e=[];n.isBone===!0&&e.push(n);for(let t=0;t<n.children.length;t++)e.push.apply(e,wX(n.children[t]));return e}class UAe extends fi{constructor(e,t,i){const r=new Wv(t,4,2),s=new Fs({wireframe:!0,fog:!1,toneMapped:!1});super(r,s),this.light=e,this.color=i,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)}}const VAe=new q,x5=new ft,w5=new ft;class zAe extends Rn{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const r=new jv(t);r.rotateY(Math.PI*.5),this.material=new Fs({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=r.getAttribute("position"),o=new Float32Array(s.count*3);r.setAttribute("color",new Fn(o,3)),this.add(new fi(r,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");x5.copy(this.light.color),w5.copy(this.light.groundColor);for(let i=0,r=t.count;i<r;i++){const s=i<r/2?x5:w5;t.setXYZ(i,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(VAe.setFromMatrixPosition(this.light.matrixWorld).negate())}}class HAe extends Sa{constructor(e=10,t=10,i=4473924,r=8947848){i=new ft(i),r=new ft(r);const s=t/2,o=e/t,a=e/2,l=[],c=[];for(let f=0,m=0,y=-a;f<=t;f++,y+=o){l.push(-a,0,y,a,0,y),l.push(y,0,-a,y,0,a);const _=f===s?i:r;_.toArray(c,m),m+=3,_.toArray(c,m),m+=3,_.toArray(c,m),m+=3,_.toArray(c,m),m+=3}const u=new un;u.setAttribute("position",new Ot(l,3)),u.setAttribute("color",new Ot(c,3));const h=new as({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class GAe extends Sa{constructor(e=10,t=16,i=8,r=64,s=4473924,o=8947848){s=new ft(s),o=new ft(o);const a=[],l=[];if(t>1)for(let h=0;h<t;h++){const f=h/t*(Math.PI*2),m=Math.sin(f)*e,y=Math.cos(f)*e;a.push(0,0,0),a.push(m,0,y);const _=h&1?s:o;l.push(_.r,_.g,_.b),l.push(_.r,_.g,_.b)}for(let h=0;h<i;h++){const f=h&1?s:o,m=e-e/i*h;for(let y=0;y<r;y++){let _=y/r*(Math.PI*2),v=Math.sin(_)*m,g=Math.cos(_)*m;a.push(v,0,g),l.push(f.r,f.g,f.b),_=(y+1)/r*(Math.PI*2),v=Math.sin(_)*m,g=Math.cos(_)*m,a.push(v,0,g),l.push(f.r,f.g,f.b)}}const c=new un;c.setAttribute("position",new Ot(a,3)),c.setAttribute("color",new Ot(l,3));const u=new as({vertexColors:!0,toneMapped:!1});super(c,u),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const E5=new q,nw=new q,A5=new q;class jAe extends Rn{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",t===void 0&&(t=1);let r=new un;r.setAttribute("position",new Ot([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new as({fog:!1,toneMapped:!1});this.lightPlane=new uc(r,s),this.add(this.lightPlane),r=new un,r.setAttribute("position",new Ot([0,0,0,0,0,1],3)),this.targetLine=new uc(r,s),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),E5.setFromMatrixPosition(this.light.matrixWorld),nw.setFromMatrixPosition(this.light.target.matrixWorld),A5.subVectors(nw,E5),this.lightPlane.lookAt(nw),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(nw),this.targetLine.scale.z=A5.length()}}const iw=new q,Mi=new Bv;class WAe extends Sa{constructor(e){const t=new un,i=new as({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],o={};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,_){l(y),l(_)}function l(y){r.push(0,0,0),s.push(0,0,0),o[y]===void 0&&(o[y]=[]),o[y].push(r.length/3-1)}t.setAttribute("position",new Ot(r,3)),t.setAttribute("color",new Ot(s,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const c=new ft(16755200),u=new ft(16711680),h=new ft(43775),f=new ft(16777215),m=new ft(3355443);this.setColors(c,u,h,f,m)}setColors(e,t,i,r,s){const a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,i.r,i.g,i.b),a.setXYZ(33,i.r,i.g,i.b),a.setXYZ(34,i.r,i.g,i.b),a.setXYZ(35,i.r,i.g,i.b),a.setXYZ(36,i.r,i.g,i.b),a.setXYZ(37,i.r,i.g,i.b),a.setXYZ(38,r.r,r.g,r.b),a.setXYZ(39,r.r,r.g,r.b),a.setXYZ(40,s.r,s.g,s.b),a.setXYZ(41,s.r,s.g,s.b),a.setXYZ(42,s.r,s.g,s.b),a.setXYZ(43,s.r,s.g,s.b),a.setXYZ(44,s.r,s.g,s.b),a.setXYZ(45,s.r,s.g,s.b),a.setXYZ(46,s.r,s.g,s.b),a.setXYZ(47,s.r,s.g,s.b),a.setXYZ(48,s.r,s.g,s.b),a.setXYZ(49,s.r,s.g,s.b),a.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,i=1,r=1;Mi.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Bi("c",t,e,Mi,0,0,-1),Bi("t",t,e,Mi,0,0,1),Bi("n1",t,e,Mi,-i,-r,-1),Bi("n2",t,e,Mi,i,-r,-1),Bi("n3",t,e,Mi,-i,r,-1),Bi("n4",t,e,Mi,i,r,-1),Bi("f1",t,e,Mi,-i,-r,1),Bi("f2",t,e,Mi,i,-r,1),Bi("f3",t,e,Mi,-i,r,1),Bi("f4",t,e,Mi,i,r,1),Bi("u1",t,e,Mi,i*.7,r*1.1,-1),Bi("u2",t,e,Mi,-i*.7,r*1.1,-1),Bi("u3",t,e,Mi,0,r*2,-1),Bi("cf1",t,e,Mi,-i,0,1),Bi("cf2",t,e,Mi,i,0,1),Bi("cf3",t,e,Mi,0,-r,1),Bi("cf4",t,e,Mi,0,r,1),Bi("cn1",t,e,Mi,-i,0,-1),Bi("cn2",t,e,Mi,i,0,-1),Bi("cn3",t,e,Mi,0,-r,-1),Bi("cn4",t,e,Mi,0,r,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Bi(n,e,t,i,r,s,o){iw.set(r,s,o).unproject(i);const a=e[n];if(a!==void 0){const l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],iw.x,iw.y,iw.z)}}const rw=new ns;class KAe extends Sa{constructor(e,t=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(8*3),s=new un;s.setIndex(new Fn(i,1)),s.setAttribute("position",new Fn(r,3)),super(s,new as({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&&rw.setFromObject(this.object),rw.isEmpty())return;const t=rw.min,i=rw.max,r=this.geometry.attributes.position,s=r.array;s[0]=i.x,s[1]=i.y,s[2]=i.z,s[3]=t.x,s[4]=i.y,s[5]=i.z,s[6]=t.x,s[7]=t.y,s[8]=i.z,s[9]=i.x,s[10]=t.y,s[11]=i.z,s[12]=i.x,s[13]=i.y,s[14]=t.z,s[15]=t.x,s[16]=i.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=i.x,s[22]=t.y,s[23]=t.z,r.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()}}class XAe extends Sa{constructor(e,t=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new un;s.setIndex(new Fn(i,1)),s.setAttribute("position",new Ot(r,3)),super(s,new as({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()}}class qAe extends uc{constructor(e,t=1,i=16776960){const r=i,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new un;o.setAttribute("position",new Ot(s,3)),o.computeBoundingSphere(),super(o,new as({color:r,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],l=new un;l.setAttribute("position",new Ot(a,3)),l.computeBoundingSphere(),this.add(new fi(l,new Fs({color:r,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()}}const S5=new q;let sw,kC;class YAe extends Rn{constructor(e=new q(0,0,1),t=new q(0,0,0),i=1,r=16776960,s=i*.2,o=s*.2){super(),this.type="ArrowHelper",sw===void 0&&(sw=new un,sw.setAttribute("position",new Ot([0,0,0,0,1,0],3)),kC=new qm(0,.5,1,5,1),kC.translate(0,-.5,0)),this.position.copy(t),this.line=new uc(sw,new as({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new fi(kC,new Fs({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,s,o)}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{S5.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(S5,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),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()}}class $Ae extends Sa{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new un;r.setAttribute("position",new Ot(t,3)),r.setAttribute("color",new Ot(i,3));const s=new as({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new ft,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class JAe{constructor(){this.type="ShapePath",this.color=new ft,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new H0,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,o){return this.currentPath.bezierCurveTo(e,t,i,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(g){const w=[];for(let A=0,T=g.length;A<T;A++){const L=g[A],D=new wd;D.curves=L.curves,w.push(D)}return w}function i(g,w){const A=w.length;let T=!1;for(let L=A-1,D=0;D<A;L=D++){let R=w[L],I=w[D],M=I.x-R.x,C=I.y-R.y;if(Math.abs(C)>Number.EPSILON){if(C<0&&(R=w[D],M=-M,I=w[L],C=-C),g.y<R.y||g.y>I.y)continue;if(g.y===R.y){if(g.x===R.x)return!0}else{const k=C*(g.x-R.x)-M*(g.y-R.y);if(k===0)return!0;if(k<0)continue;T=!T}}else{if(g.y!==R.y)continue;if(I.x<=g.x&&g.x<=R.x||R.x<=g.x&&g.x<=I.x)return!0}}return T}const r=nl.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new wd,l.curves=a.curves,c.push(l),c;let u=!r(s[0].getPoints());u=e?!u:u;const h=[],f=[];let m=[],y=0,_;f[y]=void 0,m[y]=[];for(let g=0,w=s.length;g<w;g++)a=s[g],_=a.getPoints(),o=r(_),o=e?!o:o,o?(!u&&f[y]&&y++,f[y]={s:new wd,p:_},f[y].s.curves=a.curves,u&&y++,m[y]=[]):m[y].push({h:a,p:_[0]});if(!f[0])return t(s);if(f.length>1){let g=!1,w=0;for(let A=0,T=f.length;A<T;A++)h[A]=[];for(let A=0,T=f.length;A<T;A++){const L=m[A];for(let D=0;D<L.length;D++){const R=L[D];let I=!0;for(let M=0;M<f.length;M++)i(R.p,f[M].p)&&(A!==M&&w++,I?(I=!1,h[M].push(R)):g=!0);I&&h[A].push(R)}}w>0&&g===!1&&(m=h)}let v;for(let g=0,w=f.length;g<w;g++){l=f[g].s,c.push(l),v=m[g];for(let A=0,T=v.length;A<T;A++)l.holes.push(v[A].h)}return c}}class QAe extends hl{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}class ZAe extends Ss{constructor(e=1,t=1,i=1,r={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(e,t,{...r,count:i}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Rv}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Rv);const eSe=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:lD,AddEquation:Jc,AddOperation:$7,AdditiveAnimationBlendMode:gD,AdditiveBlending:ER,AgXToneMapping:tK,AlphaFormat:uD,AlwaysCompare:yK,AlwaysDepth:uE,AlwaysStencilFunc:CR,AmbientLight:hX,AnimationAction:xX,AnimationClip:Sm,AnimationLoader:rAe,AnimationMixer:IAe,AnimationObjectGroup:CAe,AnimationUtils:eAe,ArcCurve:FK,ArrayCamera:DK,ArrowHelper:YAe,AttachedBindMode:TR,Audio:vX,AudioAnalyser:yAe,AudioContext:XD,AudioListener:pAe,AudioLoader:hAe,AxesHelper:$Ae,BackSide:As,BasicDepthPacking:lK,BasicShadowMap:R7,BatchedMesh:OK,Bone:ES,BooleanKeyframeTrack:nf,Box2:kAe,Box3:ns,Box3Helper:XAe,BoxGeometry:tf,BoxHelper:KAe,BufferAttribute:Fn,BufferGeometry:un,BufferGeometryLoader:gX,ByteType:uS,Cache:Wl,Camera:Bv,CameraHelper:WAe,CanvasTexture:SEe,CapsuleGeometry:bS,CatmullRomCurve3:UK,CineonToneMapping:Z7,CircleGeometry:CS,ClampToEdgeWrapping:Ui,Clock:qD,Color:ft,ColorKeyframeTrack:zD,ColorManagement:Mn,CompressedArrayTexture:EEe,CompressedCubeTexture:AEe,CompressedTexture:SS,CompressedTextureLoader:sAe,ConeGeometry:MS,ConstantAlphaFactor:X7,ConstantColorFactor:W7,Controls:QAe,CubeCamera:bK,CubeReflectionMapping:al,CubeRefractionMapping:zu,CubeTexture:Ov,CubeTextureLoader:lX,CubeUVReflectionMapping:Km,CubicBezierCurve:LD,CubicBezierCurve3:VK,CubicInterpolant:rX,CullFaceBack:wR,CullFaceFront:I7,CullFaceFrontBack:r0e,CullFaceNone:M7,Curve:Ta,CurvePath:HK,CustomBlending:P7,CustomToneMapping:eK,CylinderGeometry:qm,Cylindrical:LAe,Data3DTexture:xD,DataArrayTexture:yS,DataTexture:ya,DataTextureLoader:HD,DataUtils:td,DecrementStencilOp:p0e,DecrementWrapStencilOp:g0e,DefaultLoadingManager:aX,DepthFormat:vd,DepthStencilFormat:Ud,DepthTexture:TD,DetachedBindMode:iK,DirectionalLight:KD,DirectionalLightHelper:jAe,DiscreteInterpolant:sX,DodecahedronGeometry:IS,DoubleSide:No,DstAlphaFactor:V7,DstColorFactor:H7,DynamicCopyUsage:P0e,DynamicDrawUsage:T0e,DynamicReadUsage:M0e,EdgesGeometry:GK,EllipseCurve:TS,EqualCompare:fK,EqualDepth:dE,EqualStencilFunc:x0e,EquirectangularReflectionMapping:ym,EquirectangularRefractionMapping:O0,Euler:mo,EventDispatcher:hl,ExtrudeGeometry:PS,FileLoader:Pr,Float16BufferAttribute:vve,Float32BufferAttribute:Ot,FloatType:Ai,Fog:wS,FogExp2:xS,FramebufferTexture:wEe,FrontSide:ol,Frustum:Fv,GLBufferAttribute:DAe,GLSL1:D0e,GLSL3:MR,GreaterCompare:pK,GreaterDepth:pE,GreaterEqualCompare:gK,GreaterEqualDepth:fE,GreaterEqualStencilFunc:S0e,GreaterStencilFunc:E0e,GridHelper:HAe,Group:jl,HalfFloatType:yr,HemisphereLight:uX,HemisphereLightHelper:zAe,IcosahedronGeometry:Gv,ImageBitmapLoader:yX,ImageLoader:K0,ImageUtils:wK,IncrementStencilOp:f0e,IncrementWrapStencilOp:m0e,InstancedBufferAttribute:Vd,InstancedBufferGeometry:mX,InstancedInterleavedBuffer:NAe,InstancedMesh:RD,Int16BufferAttribute:gve,Int32BufferAttribute:yve,Int8BufferAttribute:fve,IntType:Nv,InterleavedBuffer:Vv,InterleavedBufferAttribute:Gu,Interpolant:Ym,InterpolateDiscrete:xm,InterpolateLinear:wm,InterpolateSmooth:Ww,InvertStencilOp:y0e,KeepStencilOp:zh,KeyframeTrack:ba,LOD:BK,LatheGeometry:Hv,Layers:xd,LessCompare:dK,LessDepth:hE,LessEqualCompare:vD,LessEqualDepth:Od,LessEqualStencilFunc:w0e,LessStencilFunc:_0e,Light:eh,LightProbe:pX,Line:uc,Line3:BAe,LineBasicMaterial:as,LineCurve:kD,LineCurve3:zK,LineDashedMaterial:tX,LineLoop:PD,LineSegments:Sa,LinearFilter:Gn,LinearInterpolant:VD,LinearMipMapLinearFilter:bR,LinearMipMapNearestFilter:a0e,LinearMipmapLinearFilter:Oo,LinearMipmapNearestFilter:Bp,LinearSRGBColorSpace:cl,LinearToneMapping:J7,LinearTransfer:kv,Loader:Lr,LoaderUtils:Su,LoadingManager:FS,LoopOnce:rK,LoopPingPong:oK,LoopRepeat:sK,LuminanceAlphaFormat:fD,LuminanceFormat:dD,MOUSE:Uh,Material:or,MaterialLoader:US,MathUtils:vK,Matrix2:ZD,Matrix3:cn,Matrix4:qt,MaxEquation:k7,Mesh:fi,MeshBasicMaterial:Fs,MeshDepthMaterial:_S,MeshDistanceMaterial:bD,MeshLambertMaterial:ZK,MeshMatcapMaterial:eX,MeshNormalMaterial:QK,MeshPhongMaterial:$K,MeshPhysicalMaterial:Go,MeshStandardMaterial:Kv,MeshToonMaterial:JK,MinEquation:L7,MirroredRepeatWrapping:vm,MixOperation:Y7,MultiplyBlending:SR,MultiplyOperation:Pv,NearestFilter:_r,NearestMipMapLinearFilter:o0e,NearestMipMapNearestFilter:s0e,NearestMipmapLinearFilter:Jh,NearestMipmapNearestFilter:cS,NeutralToneMapping:nK,NeverCompare:hK,NeverDepth:cE,NeverStencilFunc:v0e,NoBlending:Za,NoColorSpace:Bl,NoToneMapping:el,NormalAnimationBlendMode:gS,NormalBlending:yd,NotEqualCompare:mK,NotEqualDepth:mE,NotEqualStencilFunc:A0e,NumberKeyframeTrack:Hd,Object3D:Rn,ObjectLoader:cAe,ObjectSpaceNormalMap:uK,OctahedronGeometry:jv,OneFactor:O7,OneMinusConstantAlphaFactor:q7,OneMinusConstantColorFactor:K7,OneMinusDstAlphaFactor:z7,OneMinusDstColorFactor:G7,OneMinusSrcAlphaFactor:lE,OneMinusSrcColorFactor:U7,OrthographicCamera:tl,PCFShadowMap:lS,PCFSoftShadowMap:Uy,PMREMGenerator:IR,Path:H0,PerspectiveCamera:Ni,Plane:Ll,PlaneGeometry:yc,PlaneHelper:qAe,PointLight:WD,PointLightHelper:UAe,Points:ND,PointsMaterial:AS,PolarGridHelper:GAe,PolyhedronGeometry:Zu,PositionalAudio:gAe,PropertyBinding:Dn,PropertyMixer:_X,QuadraticBezierCurve:BD,QuadraticBezierCurve3:OD,Quaternion:xr,QuaternionKeyframeTrack:Gd,QuaternionLinearInterpolant:oX,RED_GREEN_RGTC2_Format:VE,RED_RGTC1_Format:mD,REVISION:Rv,RGBADepthPacking:cK,RGBAFormat:Vi,RGBAIntegerFormat:mS,RGBA_ASTC_10x10_Format:LE,RGBA_ASTC_10x5_Format:PE,RGBA_ASTC_10x6_Format:NE,RGBA_ASTC_10x8_Format:DE,RGBA_ASTC_12x10_Format:kE,RGBA_ASTC_12x12_Format:BE,RGBA_ASTC_4x4_Format:AE,RGBA_ASTC_5x4_Format:SE,RGBA_ASTC_5x5_Format:TE,RGBA_ASTC_6x5_Format:bE,RGBA_ASTC_6x6_Format:CE,RGBA_ASTC_8x5_Format:ME,RGBA_ASTC_8x6_Format:IE,RGBA_ASTC_8x8_Format:RE,RGBA_BPTC_Format:jy,RGBA_ETC2_EAC_Format:EE,RGBA_PVRTC_2BPPV1_Format:_E,RGBA_PVRTC_4BPPV1_Format:vE,RGBA_S3TC_DXT1_Format:zy,RGBA_S3TC_DXT3_Format:Hy,RGBA_S3TC_DXT5_Format:Gy,RGBDepthPacking:c0e,RGBFormat:hD,RGBIntegerFormat:l0e,RGB_BPTC_SIGNED_Format:OE,RGB_BPTC_UNSIGNED_Format:FE,RGB_ETC1_Format:xE,RGB_ETC2_Format:wE,RGB_PVRTC_2BPPV1_Format:yE,RGB_PVRTC_4BPPV1_Format:gE,RGB_S3TC_DXT1_Format:Vy,RGDepthPacking:u0e,RGFormat:pD,RGIntegerFormat:pS,RawShaderMaterial:YK,Ray:ef,Raycaster:QD,RectAreaLight:dX,RedFormat:Dv,RedIntegerFormat:Lv,ReinhardToneMapping:Q7,RenderTarget:EK,RepeatWrapping:Hu,ReplaceStencilOp:d0e,ReverseSubtractEquation:D7,RingGeometry:NS,SIGNED_RED_GREEN_RGTC2_Format:zE,SIGNED_RED_RGTC1_Format:UE,SRGBColorSpace:ys,SRGBTransfer:$n,Scene:Uv,ShaderChunk:pn,ShaderLib:ca,ShaderMaterial:ss,ShadowMaterial:qK,Shape:wd,ShapeGeometry:DS,ShapePath:JAe,ShapeUtils:nl,ShortType:hS,Skeleton:zv,SkeletonHelper:FAe,SkinnedMesh:ID,Source:ed,Sphere:Rr,SphereGeometry:Wv,Spherical:OR,SphericalHarmonics3:fX,SplineCurve:FD,SpotLight:jD,SpotLightHelper:OAe,Sprite:kK,SpriteMaterial:MD,SrcAlphaFactor:aE,SrcAlphaSaturateFactor:j7,SrcColorFactor:F7,StaticCopyUsage:R0e,StaticDrawUsage:U0,StaticReadUsage:C0e,StereoCamera:dAe,StreamCopyUsage:N0e,StreamDrawUsage:b0e,StreamReadUsage:I0e,StringKeyframeTrack:rf,SubtractEquation:N7,SubtractiveBlending:AR,TOUCH:Vh,TangentSpaceNormalMap:Qu,TetrahedronGeometry:LS,Texture:qn,TextureLoader:cX,TextureUtils:tEe,TorusGeometry:kS,TorusKnotGeometry:BS,Triangle:ks,TriangleFanDrawMode:HE,TriangleStripDrawMode:yD,TrianglesDrawMode:aK,TubeGeometry:OS,UVMapping:Vu,Uint16BufferAttribute:wD,Uint32BufferAttribute:ED,Uint8BufferAttribute:pve,Uint8ClampedBufferAttribute:mve,Uniform:JD,UniformsGroup:PAe,UniformsLib:pt,UniformsUtils:TK,UnsignedByteType:Ws,UnsignedInt248Type:Fd,UnsignedInt5999Type:cD,UnsignedIntType:ll,UnsignedShort4444Type:dS,UnsignedShort5551Type:fS,UnsignedShortType:_m,VSMShadowMap:ra,Vector2:Fe,Vector3:q,Vector4:Bn,VectorKeyframeTrack:jd,VideoTexture:xEe,WebGL3DRenderTarget:ive,WebGLArrayRenderTarget:nve,WebGLCoordinateSystem:Ga,WebGLCubeRenderTarget:AD,WebGLMultipleRenderTargets:ZAe,WebGLRenderTarget:Ss,WebGLRenderer:CD,WebGLUtils:NK,WebGPUCoordinateSystem:V0,WireframeGeometry:XK,WrapAroundEnding:F0,ZeroCurvatureEnding:Qh,ZeroFactor:B7,ZeroSlopeEnding:Zh,ZeroStencilOp:h0e,createCanvasElement:xK},Symbol.toStringTag,{value:"Module"}));var EX={exports:{}},sf={};/**
 * @license React
 * react-reconciler-constants.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */sf.ConcurrentRoot=1;sf.ContinuousEventPriority=4;sf.DefaultEventPriority=16;sf.DiscreteEventPriority=1;sf.IdleEventPriority=536870912;sf.LegacyRoot=0;EX.exports=sf;var xp=EX.exports;function tSe(n){let e;const t=new Set,i=(c,u)=>{const h=typeof c=="function"?c(e):c;if(h!==e){const f=e;e=u?h:Object.assign({},e,h),t.forEach(m=>m(e,f))}},r=()=>e,s=(c,u=r,h=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let f=u(e);function m(){const y=u(e);if(!h(f,y)){const _=f;c(f=y,_)}}return t.add(m),()=>t.delete(m)},l={setState:i,getState:r,subscribe:(c,u,h)=>u||h?s(c,u,h):(t.add(c),()=>t.delete(c)),destroy:()=>t.clear()};return e=n(i,r,l),l}const nSe=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),T5=nSe?V.useEffect:V.useLayoutEffect;function AX(n){const e=typeof n=="function"?tSe(n):n,t=(i=e.getState,r=Object.is)=>{const[,s]=V.useReducer(v=>v+1,0),o=e.getState(),a=V.useRef(o),l=V.useRef(i),c=V.useRef(r),u=V.useRef(!1),h=V.useRef();h.current===void 0&&(h.current=i(o));let f,m=!1;(a.current!==o||l.current!==i||c.current!==r||u.current)&&(f=i(o),m=!r(h.current,f)),T5(()=>{m&&(h.current=f),a.current=o,l.current=i,c.current=r,u.current=!1});const y=V.useRef(o);T5(()=>{const v=()=>{try{const w=e.getState(),A=l.current(w);c.current(h.current,A)||(a.current=w,h.current=A,s())}catch{u.current=!0,s()}},g=e.subscribe(v);return e.getState()!==y.current&&v(),g},[]);const _=m?f:h.current;return V.useDebugValue(_),_};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const i=[t,e];return{next(){const r=i.length<=0;return{value:i.shift(),done:r}}}},t}const iSe=n=>typeof n=="object"&&typeof n.then=="function",id=[];function SX(n,e,t=(i,r)=>i===r){if(n===e)return!0;if(!n||!e)return!1;const i=n.length;if(e.length!==i)return!1;for(let r=0;r<i;r++)if(!t(n[r],e[r]))return!1;return!0}function TX(n,e=null,t=!1,i={}){e===null&&(e=[n]);for(const s of id)if(SX(e,s.keys,s.equal)){if(t)return;if(Object.prototype.hasOwnProperty.call(s,"error"))throw s.error;if(Object.prototype.hasOwnProperty.call(s,"response"))return i.lifespan&&i.lifespan>0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,i.lifespan)),s.response;if(!t)throw s.promise}const r={keys:e,equal:i.equal,remove:()=>{const s=id.indexOf(r);s!==-1&&id.splice(s,1)},promise:(iSe(n)?n:n(...e)).then(s=>{r.response=s,i.lifespan&&i.lifespan>0&&(r.timeout=setTimeout(r.remove,i.lifespan))}).catch(s=>r.error=s)};if(id.push(r),!t)throw r.promise}const rSe=(n,e,t)=>TX(n,e,!1,t),sSe=(n,e,t)=>void TX(n,e,!0,t),oSe=n=>{if(n===void 0||n.length===0)id.splice(0,id.length);else{const e=id.find(t=>SX(n,t.keys,t.equal));e&&e.remove()}};var bX={exports:{}},CX={exports:{}},MX={};/**
 * @license React
 * scheduler.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(n){function e(G,$){var te=G.length;G.push($);e:for(;0<te;){var ue=te-1>>>1,ve=G[ue];if(0<r(ve,$))G[ue]=$,G[te]=ve,te=ue;else break e}}function t(G){return G.length===0?null:G[0]}function i(G){if(G.length===0)return null;var $=G[0],te=G.pop();if(te!==$){G[0]=te;e:for(var ue=0,ve=G.length,be=ve>>>1;ue<be;){var he=2*(ue+1)-1,Pe=G[he],Oe=he+1,Ce=G[Oe];if(0>r(Pe,te))Oe<ve&&0>r(Ce,Pe)?(G[ue]=Ce,G[Oe]=te,ue=Oe):(G[ue]=Pe,G[he]=te,ue=he);else if(Oe<ve&&0>r(Ce,te))G[ue]=Ce,G[Oe]=te,ue=Oe;else break e}}return $}function r(G,$){var te=G.sortIndex-$.sortIndex;return te!==0?te:G.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,h=null,f=3,m=!1,y=!1,_=!1,v=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function A(G){for(var $=t(c);$!==null;){if($.callback===null)i(c);else if($.startTime<=G)i(c),$.sortIndex=$.expirationTime,e(l,$);else break;$=t(c)}}function T(G){if(_=!1,A(G),!y)if(t(l)!==null)y=!0,ie(L);else{var $=t(c);$!==null&&de(T,$.startTime-G)}}function L(G,$){y=!1,_&&(_=!1,g(I),I=-1),m=!0;var te=f;try{for(A($),h=t(l);h!==null&&(!(h.expirationTime>$)||G&&!k());){var ue=h.callback;if(typeof ue=="function"){h.callback=null,f=h.priorityLevel;var ve=ue(h.expirationTime<=$);$=n.unstable_now(),typeof ve=="function"?h.callback=ve:h===t(l)&&i(l),A($)}else i(l);h=t(l)}if(h!==null)var be=!0;else{var he=t(c);he!==null&&de(T,he.startTime-$),be=!1}return be}finally{h=null,f=te,m=!1}}var D=!1,R=null,I=-1,M=5,C=-1;function k(){return!(n.unstable_now()-C<M)}function B(){if(R!==null){var G=n.unstable_now();C=G;var $=!0;try{$=R(!0,G)}finally{$?O():(D=!1,R=null)}}else D=!1}var O;if(typeof w=="function")O=function(){w(B)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,le=X.port2;X.port1.onmessage=B,O=function(){le.postMessage(null)}}else O=function(){v(B,0)};function ie(G){R=G,D||(D=!0,O())}function de(G,$){I=v(function(){G(n.unstable_now())},$)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(G){G.callback=null},n.unstable_continueExecution=function(){y||m||(y=!0,ie(L))},n.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<G?Math.floor(1e3/G):5},n.unstable_getCurrentPriorityLevel=function(){return f},n.unstable_getFirstCallbackNode=function(){return t(l)},n.unstable_next=function(G){switch(f){case 1:case 2:case 3:var $=3;break;default:$=f}var te=f;f=$;try{return G()}finally{f=te}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(G,$){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var te=f;f=G;try{return $()}finally{f=te}},n.unstable_scheduleCallback=function(G,$,te){var ue=n.unstable_now();switch(typeof te=="object"&&te!==null?(te=te.delay,te=typeof te=="number"&&0<te?ue+te:ue):te=ue,G){case 1:var ve=-1;break;case 2:ve=250;break;case 5:ve=1073741823;break;case 4:ve=1e4;break;default:ve=5e3}return ve=te+ve,G={id:u++,callback:$,priorityLevel:G,startTime:te,expirationTime:ve,sortIndex:-1},te>ue?(G.sortIndex=te,e(c,G),t(l)===null&&G===t(c)&&(_?(g(I),I=-1):_=!0,de(T,te-ue))):(G.sortIndex=ve,e(l,G),y||m||(y=!0,ie(L))),G},n.unstable_shouldYield=k,n.unstable_wrapCallback=function(G){var $=f;return function(){var te=f;f=$;try{return G.apply(this,arguments)}finally{f=te}}}})(MX);CX.exports=MX;var FR=CX.exports;/**
 * @license React
 * react-reconciler.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var aSe=function(e){var t={},i=V,r=FR,s=Object.assign;function o(d){for(var p="https://reactjs.org/docs/error-decoder.html?invariant="+d,E=1;E<arguments.length;E++)p+="&args[]="+encodeURIComponent(arguments[E]);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."}var a=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,l=Symbol.for("react.element"),c=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),y=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),T=Symbol.for("react.offscreen"),L=Symbol.iterator;function D(d){return d===null||typeof d!="object"?null:(d=L&&d[L]||d["@@iterator"],typeof d=="function"?d:null)}function R(d){if(d==null)return null;if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d;switch(d){case u:return"Fragment";case c:return"Portal";case f:return"Profiler";case h:return"StrictMode";case v:return"Suspense";case g:return"SuspenseList"}if(typeof d=="object")switch(d.$$typeof){case y:return(d.displayName||"Context")+".Consumer";case m:return(d._context.displayName||"Context")+".Provider";case _:var p=d.render;return d=d.displayName,d||(d=p.displayName||p.name||"",d=d!==""?"ForwardRef("+d+")":"ForwardRef"),d;case w:return p=d.displayName||null,p!==null?p:R(d.type)||"Memo";case A:p=d._payload,d=d._init;try{return R(d(p))}catch{}}return null}function I(d){var p=d.type;switch(d.tag){case 24:return"Cache";case 9:return(p.displayName||"Context")+".Consumer";case 10:return(p._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return d=p.render,d=d.displayName||d.name||"",p.displayName||(d!==""?"ForwardRef("+d+")":"ForwardRef");case 7:return"Fragment";case 5:return p;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return R(p);case 8:return p===h?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof p=="function")return p.displayName||p.name||null;if(typeof p=="string")return p}return null}function M(d){var p=d,E=d;if(d.alternate)for(;p.return;)p=p.return;else{d=p;do p=d,p.flags&4098&&(E=p.return),d=p.return;while(d)}return p.tag===3?E:null}function C(d){if(M(d)!==d)throw Error(o(188))}function k(d){var p=d.alternate;if(!p){if(p=M(d),p===null)throw Error(o(188));return p!==d?null:d}for(var E=d,b=p;;){var P=E.return;if(P===null)break;var U=P.alternate;if(U===null){if(b=P.return,b!==null){E=b;continue}break}if(P.child===U.child){for(U=P.child;U;){if(U===E)return C(P),d;if(U===b)return C(P),p;U=U.sibling}throw Error(o(188))}if(E.return!==b.return)E=P,b=U;else{for(var Z=!1,ce=P.child;ce;){if(ce===E){Z=!0,E=P,b=U;break}if(ce===b){Z=!0,b=P,E=U;break}ce=ce.sibling}if(!Z){for(ce=U.child;ce;){if(ce===E){Z=!0,E=U,b=P;break}if(ce===b){Z=!0,b=U,E=P;break}ce=ce.sibling}if(!Z)throw Error(o(189))}}if(E.alternate!==b)throw Error(o(190))}if(E.tag!==3)throw Error(o(188));return E.stateNode.current===E?d:p}function B(d){return d=k(d),d!==null?O(d):null}function O(d){if(d.tag===5||d.tag===6)return d;for(d=d.child;d!==null;){var p=O(d);if(p!==null)return p;d=d.sibling}return null}function X(d){if(d.tag===5||d.tag===6)return d;for(d=d.child;d!==null;){if(d.tag!==4){var p=X(d);if(p!==null)return p}d=d.sibling}return null}var le=Array.isArray,ie=e.getPublicInstance,de=e.getRootHostContext,G=e.getChildHostContext,$=e.prepareForCommit,te=e.resetAfterCommit,ue=e.createInstance,ve=e.appendInitialChild,be=e.finalizeInitialChildren,he=e.prepareUpdate,Pe=e.shouldSetTextContent,Oe=e.createTextInstance,Ce=e.scheduleTimeout,mt=e.cancelTimeout,Lt=e.noTimeout,St=e.isPrimaryRenderer,Nt=e.supportsMutation,ke=e.supportsPersistence,Ue=e.supportsHydration,ee=e.getInstanceFromNode,xt=e.preparePortalMount,je=e.getCurrentEventPriority,ht=e.detachDeletedInstance,$e=e.supportsMicrotasks,Mt=e.scheduleMicrotask,lt=e.supportsTestSelectors,Y=e.findFiberRoot,j=e.getBoundingRect,pe=e.getTextContent,Ie=e.isHiddenSubtree,ze=e.matchAccessibilityRole,Ee=e.setFocusIfFocusable,tt=e.setupIntersectionObserver,nt=e.appendChild,ct=e.appendChildToContainer,Yt=e.commitTextUpdate,Xe=e.commitMount,dt=e.commitUpdate,It=e.insertBefore,gt=e.insertInContainerBefore,ut=e.removeChild,oe=e.removeChildFromContainer,Te=e.resetTextContent,Ye=e.hideInstance,se=e.hideTextInstance,ye=e.unhideInstance,we=e.unhideTextInstance,De=e.clearContainer,ot=e.cloneInstance,it=e.createContainerChildSet,Ke=e.appendChildToContainerChildSet,Et=e.finalizeContainerChildren,Gt=e.replaceContainerChildren,Vt=e.cloneHiddenInstance,_n=e.cloneHiddenTextInstance,sn=e.canHydrateInstance,wr=e.canHydrateTextInstance,mi=e.canHydrateSuspenseInstance,jn=e.isSuspenseInstancePending,jo=e.isSuspenseInstanceFallback,vo=e.registerSuspenseInstanceRetry,Di=e.getNextHydratableSibling,tn=e.getFirstHydratableChild,dl=e.getFirstHydratableChildWithinContainer,Xs=e.getFirstHydratableChildWithinSuspenseInstance,H=e.hydrateInstance,K=e.hydrateTextInstance,ae=e.hydrateSuspenseInstance,xe=e.getNextHydratableInstanceAfterSuspenseInstance,Me=e.commitHydratedContainer,z=e.commitHydratedSuspenseInstance,J=e.clearSuspenseBoundary,ne=e.clearSuspenseBoundaryFromContainer,re=e.shouldDeleteUnhydratedTailInstances,Q=e.didNotMatchHydratedContainerTextInstance,ge=e.didNotMatchHydratedTextInstance,_e;function Ze(d){if(_e===void 0)try{throw Error()}catch(E){var p=E.stack.trim().match(/\n( *(at )?)/);_e=p&&p[1]||""}return`
`+_e+d}var Be=!1;function Ge(d,p){if(!d||Be)return"";Be=!0;var E=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(p)if(p=function(){throw Error()},Object.defineProperty(p.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(p,[])}catch(st){var b=st}Reflect.construct(d,[],p)}else{try{p.call()}catch(st){b=st}d.call(p.prototype)}else{try{throw Error()}catch(st){b=st}d()}}catch(st){if(st&&b&&typeof st.stack=="string"){for(var P=st.stack.split(`
`),U=b.stack.split(`
`),Z=P.length-1,ce=U.length-1;1<=Z&&0<=ce&&P[Z]!==U[ce];)ce--;for(;1<=Z&&0<=ce;Z--,ce--)if(P[Z]!==U[ce]){if(Z!==1||ce!==1)do if(Z--,ce--,0>ce||P[Z]!==U[ce]){var Ne=`
`+P[Z].replace(" at new "," at ");return d.displayName&&Ne.includes("<anonymous>")&&(Ne=Ne.replace("<anonymous>",d.displayName)),Ne}while(1<=Z&&0<=ce);break}}}finally{Be=!1,Error.prepareStackTrace=E}return(d=d?d.displayName||d.name:"")?Ze(d):""}var Je=Object.prototype.hasOwnProperty,We=[],Tt=-1;function Rt(d){return{current:d}}function vt(d){0>Tt||(d.current=We[Tt],We[Tt]=null,Tt--)}function Ft(d,p){Tt++,We[Tt]=d.current,d.current=p}var At={},rt=Rt(At),Wt=Rt(!1),Ut=At;function Wn(d,p){var E=d.type.contextTypes;if(!E)return At;var b=d.stateNode;if(b&&b.__reactInternalMemoizedUnmaskedChildContext===p)return b.__reactInternalMemoizedMaskedChildContext;var P={},U;for(U in E)P[U]=p[U];return b&&(d=d.stateNode,d.__reactInternalMemoizedUnmaskedChildContext=p,d.__reactInternalMemoizedMaskedChildContext=P),P}function Yn(d){return d=d.childContextTypes,d!=null}function Pn(){vt(Wt),vt(rt)}function gn(d,p,E){if(rt.current!==At)throw Error(o(168));Ft(rt,p),Ft(Wt,E)}function Zt(d,p,E){var b=d.stateNode;if(p=p.childContextTypes,typeof b.getChildContext!="function")return E;b=b.getChildContext();for(var P in b)if(!(P in p))throw Error(o(108,I(d)||"Unknown",P));return s({},E,b)}function $t(d){return d=(d=d.stateNode)&&d.__reactInternalMemoizedMergedChildContext||At,Ut=rt.current,Ft(rt,d),Ft(Wt,Wt.current),!0}function Jt(d,p,E){var b=d.stateNode;if(!b)throw Error(o(169));E?(d=Zt(d,p,Ut),b.__reactInternalMemoizedMergedChildContext=d,vt(Wt),vt(rt),Ft(rt,d)):vt(Wt),Ft(Wt,E)}var hn=Math.clz32?Math.clz32:yn,yi=Math.log,ei=Math.LN2;function yn(d){return d>>>=0,d===0?32:31-(yi(d)/ei|0)|0}var fl=64,Ca=4194304;function Wo(d){switch(d&-d){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return d&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return d}}function of(d,p){var E=d.pendingLanes;if(E===0)return 0;var b=0,P=d.suspendedLanes,U=d.pingedLanes,Z=E&268435455;if(Z!==0){var ce=Z&~P;ce!==0?b=Wo(ce):(U&=Z,U!==0&&(b=Wo(U)))}else Z=E&~P,Z!==0?b=Wo(Z):U!==0&&(b=Wo(U));if(b===0)return 0;if(p!==0&&p!==b&&!(p&P)&&(P=b&-b,U=p&-p,P>=U||P===16&&(U&4194240)!==0))return p;if(b&4&&(b|=E&16),p=d.entangledLanes,p!==0)for(d=d.entanglements,p&=b;0<p;)E=31-hn(p),P=1<<E,b|=d[E],p&=~P;return b}function $v(d,p){switch(d){case 1:case 2:case 4:return p+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return p+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function zS(d,p){for(var E=d.suspendedLanes,b=d.pingedLanes,P=d.expirationTimes,U=d.pendingLanes;0<U;){var Z=31-hn(U),ce=1<<Z,Ne=P[Z];Ne===-1?(!(ce&E)||ce&b)&&(P[Z]=$v(ce,p)):Ne<=p&&(d.expiredLanes|=ce),U&=~ce}}function $m(d){return d=d.pendingLanes&-1073741825,d!==0?d:d&1073741824?1073741824:0}function Jm(d){for(var p=[],E=0;31>E;E++)p.push(d);return p}function th(d,p,E){d.pendingLanes|=p,p!==536870912&&(d.suspendedLanes=0,d.pingedLanes=0),d=d.eventTimes,p=31-hn(p),d[p]=E}function nh(d,p){var E=d.pendingLanes&~p;d.pendingLanes=p,d.suspendedLanes=0,d.pingedLanes=0,d.expiredLanes&=p,d.mutableReadLanes&=p,d.entangledLanes&=p,p=d.entanglements;var b=d.eventTimes;for(d=d.expirationTimes;0<E;){var P=31-hn(E),U=1<<P;p[P]=0,b[P]=-1,d[P]=-1,E&=~U}}function _o(d,p){var E=d.entangledLanes|=p;for(d=d.entanglements;E;){var b=31-hn(E),P=1<<b;P&p|d[b]&p&&(d[b]|=p),E&=~P}}var bn=0;function Qm(d){return d&=-d,1<d?4<d?d&268435455?16:536870912:4:1}var af=r.unstable_scheduleCallback,pl=r.unstable_cancelCallback,HS=r.unstable_shouldYield,GS=r.unstable_requestPaint,Hi=r.unstable_now,xo=r.unstable_ImmediatePriority,jS=r.unstable_UserBlockingPriority,Zm=r.unstable_NormalPriority,lf=r.unstable_IdlePriority,ml=null,qs=null;function ih(d){if(qs&&typeof qs.onCommitFiberRoot=="function")try{qs.onCommitFiberRoot(ml,d,void 0,(d.current.flags&128)===128)}catch{}}function rh(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var Ys=typeof Object.is=="function"?Object.is:rh,$s=null,ti=!1,eg=!1;function Jv(d){$s===null?$s=[d]:$s.push(d)}function Qv(d){ti=!0,Jv(d)}function Js(){if(!eg&&$s!==null){eg=!0;var d=0,p=bn;try{var E=$s;for(bn=1;d<E.length;d++){var b=E[d];do b=b(!0);while(b!==null)}$s=null,ti=!1}catch(P){throw $s!==null&&($s=$s.slice(d+1)),af(xo,Js),P}finally{bn=p,eg=!1}}return null}var Zv=a.ReactCurrentBatchConfig;function gl(d,p){if(Ys(d,p))return!0;if(typeof d!="object"||d===null||typeof p!="object"||p===null)return!1;var E=Object.keys(d),b=Object.keys(p);if(E.length!==b.length)return!1;for(b=0;b<E.length;b++){var P=E[b];if(!Je.call(p,P)||!Ys(d[P],p[P]))return!1}return!0}function e_(d){switch(d.tag){case 5:return Ze(d.type);case 16:return Ze("Lazy");case 13:return Ze("Suspense");case 19:return Ze("SuspenseList");case 0:case 2:case 15:return d=Ge(d.type,!1),d;case 11:return d=Ge(d.type.render,!1),d;case 1:return d=Ge(d.type,!0),d;default:return""}}function Li(d,p){if(d&&d.defaultProps){p=s({},p),d=d.defaultProps;for(var E in d)p[E]===void 0&&(p[E]=d[E]);return p}return p}var sh=Rt(null),cf=null,wo=null,uf=null;function oh(){uf=wo=cf=null}function ah(d,p,E){St?(Ft(sh,p._currentValue),p._currentValue=E):(Ft(sh,p._currentValue2),p._currentValue2=E)}function hf(d){var p=sh.current;vt(sh),St?d._currentValue=p:d._currentValue2=p}function vc(d,p,E){for(;d!==null;){var b=d.alternate;if((d.childLanes&p)!==p?(d.childLanes|=p,b!==null&&(b.childLanes|=p)):b!==null&&(b.childLanes&p)!==p&&(b.childLanes|=p),d===E)break;d=d.return}}function _c(d,p){cf=d,uf=wo=null,d=d.dependencies,d!==null&&d.firstContext!==null&&(d.lanes&p&&(eo=!0),d.firstContext=null)}function ls(d){var p=St?d._currentValue:d._currentValue2;if(uf!==d)if(d={context:d,memoizedValue:p,next:null},wo===null){if(cf===null)throw Error(o(308));wo=d,cf.dependencies={lanes:0,firstContext:d}}else wo=wo.next=d;return p}var kr=null,Ko=!1;function df(d){d.updateQueue={baseState:d.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ff(d,p){d=d.updateQueue,p.updateQueue===d&&(p.updateQueue={baseState:d.baseState,firstBaseUpdate:d.firstBaseUpdate,lastBaseUpdate:d.lastBaseUpdate,shared:d.shared,effects:d.effects})}function Qs(d,p){return{eventTime:d,lane:p,tag:0,payload:null,callback:null,next:null}}function Xo(d,p){var E=d.updateQueue;E!==null&&(E=E.shared,Ki!==null&&d.mode&1&&!(vn&2)?(d=E.interleaved,d===null?(p.next=p,kr===null?kr=[E]:kr.push(E)):(p.next=d.next,d.next=p),E.interleaved=p):(d=E.pending,d===null?p.next=p:(p.next=d.next,d.next=p),E.pending=p))}function yl(d,p,E){if(p=p.updateQueue,p!==null&&(p=p.shared,(E&4194240)!==0)){var b=p.lanes;b&=d.pendingLanes,E|=b,p.lanes=E,_o(d,E)}}function tg(d,p){var E=d.updateQueue,b=d.alternate;if(b!==null&&(b=b.updateQueue,E===b)){var P=null,U=null;if(E=E.firstBaseUpdate,E!==null){do{var Z={eventTime:E.eventTime,lane:E.lane,tag:E.tag,payload:E.payload,callback:E.callback,next:null};U===null?P=U=Z:U=U.next=Z,E=E.next}while(E!==null);U===null?P=U=p:U=U.next=p}else P=U=p;E={baseState:b.baseState,firstBaseUpdate:P,lastBaseUpdate:U,shared:b.shared,effects:b.effects},d.updateQueue=E;return}d=E.lastBaseUpdate,d===null?E.firstBaseUpdate=p:d.next=p,E.lastBaseUpdate=p}function lh(d,p,E,b){var P=d.updateQueue;Ko=!1;var U=P.firstBaseUpdate,Z=P.lastBaseUpdate,ce=P.shared.pending;if(ce!==null){P.shared.pending=null;var Ne=ce,st=Ne.next;Ne.next=null,Z===null?U=st:Z.next=st,Z=Ne;var Pt=d.alternate;Pt!==null&&(Pt=Pt.updateQueue,ce=Pt.lastBaseUpdate,ce!==Z&&(ce===null?Pt.firstBaseUpdate=st:ce.next=st,Pt.lastBaseUpdate=Ne))}if(U!==null){var on=P.baseState;Z=0,Pt=st=Ne=null,ce=U;do{var Kt=ce.lane,ni=ce.eventTime;if((b&Kt)===Kt){Pt!==null&&(Pt=Pt.next={eventTime:ni,lane:0,tag:ce.tag,payload:ce.payload,callback:ce.callback,next:null});e:{var Ht=d,Vr=ce;switch(Kt=p,ni=E,Vr.tag){case 1:if(Ht=Vr.payload,typeof Ht=="function"){on=Ht.call(ni,on,Kt);break e}on=Ht;break e;case 3:Ht.flags=Ht.flags&-65537|128;case 0:if(Ht=Vr.payload,Kt=typeof Ht=="function"?Ht.call(ni,on,Kt):Ht,Kt==null)break e;on=s({},on,Kt);break e;case 2:Ko=!0}}ce.callback!==null&&ce.lane!==0&&(d.flags|=64,Kt=P.effects,Kt===null?P.effects=[ce]:Kt.push(ce))}else ni={eventTime:ni,lane:Kt,tag:ce.tag,payload:ce.payload,callback:ce.callback,next:null},Pt===null?(st=Pt=ni,Ne=on):Pt=Pt.next=ni,Z|=Kt;if(ce=ce.next,ce===null){if(ce=P.shared.pending,ce===null)break;Kt=ce,ce=Kt.next,Kt.next=null,P.lastBaseUpdate=Kt,P.shared.pending=null}}while(!0);if(Pt===null&&(Ne=on),P.baseState=Ne,P.firstBaseUpdate=st,P.lastBaseUpdate=Pt,p=P.shared.interleaved,p!==null){P=p;do Z|=P.lane,P=P.next;while(P!==p)}else U===null&&(P.shared.lanes=0);Ef|=Z,d.lanes=Z,d.memoizedState=on}}function Ma(d,p,E){if(d=p.effects,p.effects=null,d!==null)for(p=0;p<d.length;p++){var b=d[p],P=b.callback;if(P!==null){if(b.callback=null,b=E,typeof P!="function")throw Error(o(191,P));P.call(b)}}}var ng=new i.Component().refs;function pf(d,p,E,b){p=d.memoizedState,E=E(b,p),E=E==null?p:s({},p,E),d.memoizedState=E,d.lanes===0&&(d.updateQueue.baseState=E)}var ch={isMounted:function(d){return(d=d._reactInternals)?M(d)===d:!1},enqueueSetState:function(d,p,E){d=d._reactInternals;var b=hs(),P=Ec(d),U=Qs(b,P);U.payload=p,E!=null&&(U.callback=E),Xo(d,U),p=So(d,P,b),p!==null&&yl(p,d,P)},enqueueReplaceState:function(d,p,E){d=d._reactInternals;var b=hs(),P=Ec(d),U=Qs(b,P);U.tag=1,U.payload=p,E!=null&&(U.callback=E),Xo(d,U),p=So(d,P,b),p!==null&&yl(p,d,P)},enqueueForceUpdate:function(d,p){d=d._reactInternals;var E=hs(),b=Ec(d),P=Qs(E,b);P.tag=2,p!=null&&(P.callback=p),Xo(d,P),p=So(d,b,E),p!==null&&yl(p,d,b)}};function ig(d,p,E,b,P,U,Z){return d=d.stateNode,typeof d.shouldComponentUpdate=="function"?d.shouldComponentUpdate(b,U,Z):p.prototype&&p.prototype.isPureReactComponent?!gl(E,b)||!gl(P,U):!0}function uh(d,p,E){var b=!1,P=At,U=p.contextType;return typeof U=="object"&&U!==null?U=ls(U):(P=Yn(p)?Ut:rt.current,b=p.contextTypes,U=(b=b!=null)?Wn(d,P):At),p=new p(E,U),d.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=ch,d.stateNode=p,p._reactInternals=d,b&&(d=d.stateNode,d.__reactInternalMemoizedUnmaskedChildContext=P,d.__reactInternalMemoizedMaskedChildContext=U),p}function Br(d,p,E,b){d=p.state,typeof p.componentWillReceiveProps=="function"&&p.componentWillReceiveProps(E,b),typeof p.UNSAFE_componentWillReceiveProps=="function"&&p.UNSAFE_componentWillReceiveProps(E,b),p.state!==d&&ch.enqueueReplaceState(p,p.state,null)}function mf(d,p,E,b){var P=d.stateNode;P.props=E,P.state=d.memoizedState,P.refs=ng,df(d);var U=p.contextType;typeof U=="object"&&U!==null?P.context=ls(U):(U=Yn(p)?Ut:rt.current,P.context=Wn(d,U)),P.state=d.memoizedState,U=p.getDerivedStateFromProps,typeof U=="function"&&(pf(d,p,U,E),P.state=d.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof P.getSnapshotBeforeUpdate=="function"||typeof P.UNSAFE_componentWillMount!="function"&&typeof P.componentWillMount!="function"||(p=P.state,typeof P.componentWillMount=="function"&&P.componentWillMount(),typeof P.UNSAFE_componentWillMount=="function"&&P.UNSAFE_componentWillMount(),p!==P.state&&ch.enqueueReplaceState(P,P.state,null),lh(d,E,P,b),P.state=d.memoizedState),typeof P.componentDidMount=="function"&&(d.flags|=4194308)}var vl=[],Zs=0,x=null,N=0,F=[],W=0,me=null,Se=1,et="";function Cn(d,p){vl[Zs++]=N,vl[Zs++]=x,x=d,N=p}function Gi(d,p,E){F[W++]=Se,F[W++]=et,F[W++]=me,me=d;var b=Se;d=et;var P=32-hn(b)-1;b&=~(1<<P),E+=1;var U=32-hn(p)+P;if(30<U){var Z=P-P%5;U=(b&(1<<Z)-1).toString(32),b>>=Z,P-=Z,Se=1<<32-hn(p)+P|E<<P|b,et=U+d}else Se=1<<U|E<<P|b,et=d}function En(d){d.return!==null&&(Cn(d,1),Gi(d,1,0))}function ji(d){for(;d===x;)x=vl[--Zs],vl[Zs]=null,N=vl[--Zs],vl[Zs]=null;for(;d===me;)me=F[--W],F[W]=null,et=F[--W],F[W]=null,Se=F[--W],F[W]=null}var Kn=null,Wi=null,An=!1,Ia=!1,cs=null;function pL(d,p){var E=To(5,null,null,0);E.elementType="DELETED",E.stateNode=p,E.return=d,p=d.deletions,p===null?(d.deletions=[E],d.flags|=16):p.push(E)}function mL(d,p){switch(d.tag){case 5:return p=sn(p,d.type,d.pendingProps),p!==null?(d.stateNode=p,Kn=d,Wi=tn(p),!0):!1;case 6:return p=wr(p,d.pendingProps),p!==null?(d.stateNode=p,Kn=d,Wi=null,!0):!1;case 13:if(p=mi(p),p!==null){var E=me!==null?{id:Se,overflow:et}:null;return d.memoizedState={dehydrated:p,treeContext:E,retryLane:1073741824},E=To(18,null,null,0),E.stateNode=p,E.return=d,d.child=E,Kn=d,Wi=null,!0}return!1;default:return!1}}function WS(d){return(d.mode&1)!==0&&(d.flags&128)===0}function KS(d){if(An){var p=Wi;if(p){var E=p;if(!mL(d,p)){if(WS(d))throw Error(o(418));p=Di(E);var b=Kn;p&&mL(d,p)?pL(b,E):(d.flags=d.flags&-4097|2,An=!1,Kn=d)}}else{if(WS(d))throw Error(o(418));d.flags=d.flags&-4097|2,An=!1,Kn=d}}}function gL(d){for(d=d.return;d!==null&&d.tag!==5&&d.tag!==3&&d.tag!==13;)d=d.return;Kn=d}function rg(d){if(!Ue||d!==Kn)return!1;if(!An)return gL(d),An=!0,!1;if(d.tag!==3&&(d.tag!==5||re(d.type)&&!Pe(d.type,d.memoizedProps))){var p=Wi;if(p){if(WS(d)){for(d=Wi;d;)d=Di(d);throw Error(o(418))}for(;p;)pL(d,p),p=Di(p)}}if(gL(d),d.tag===13){if(!Ue)throw Error(o(316));if(d=d.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(o(317));Wi=xe(d)}else Wi=Kn?Di(d.stateNode):null;return!0}function gf(){Ue&&(Wi=Kn=null,Ia=An=!1)}function XS(d){cs===null?cs=[d]:cs.push(d)}function sg(d,p,E){if(d=E.ref,d!==null&&typeof d!="function"&&typeof d!="object"){if(E._owner){if(E=E._owner,E){if(E.tag!==1)throw Error(o(309));var b=E.stateNode}if(!b)throw Error(o(147,d));var P=b,U=""+d;return p!==null&&p.ref!==null&&typeof p.ref=="function"&&p.ref._stringRef===U?p.ref:(p=function(Z){var ce=P.refs;ce===ng&&(ce=P.refs={}),Z===null?delete ce[U]:ce[U]=Z},p._stringRef=U,p)}if(typeof d!="string")throw Error(o(284));if(!E._owner)throw Error(o(290,d))}return d}function t_(d,p){throw d=Object.prototype.toString.call(p),Error(o(31,d==="[object Object]"?"object with keys {"+Object.keys(p).join(", ")+"}":d))}function yL(d){var p=d._init;return p(d._payload)}function vL(d){function p(Ae,fe){if(d){var Re=Ae.deletions;Re===null?(Ae.deletions=[fe],Ae.flags|=16):Re.push(fe)}}function E(Ae,fe){if(!d)return null;for(;fe!==null;)p(Ae,fe),fe=fe.sibling;return null}function b(Ae,fe){for(Ae=new Map;fe!==null;)fe.key!==null?Ae.set(fe.key,fe):Ae.set(fe.index,fe),fe=fe.sibling;return Ae}function P(Ae,fe){return Ae=Sc(Ae,fe),Ae.index=0,Ae.sibling=null,Ae}function U(Ae,fe,Re){return Ae.index=Re,d?(Re=Ae.alternate,Re!==null?(Re=Re.index,Re<fe?(Ae.flags|=2,fe):Re):(Ae.flags|=2,fe)):(Ae.flags|=1048576,fe)}function Z(Ae){return d&&Ae.alternate===null&&(Ae.flags|=2),Ae}function ce(Ae,fe,Re,wt){return fe===null||fe.tag!==6?(fe=RT(Re,Ae.mode,wt),fe.return=Ae,fe):(fe=P(fe,Re),fe.return=Ae,fe)}function Ne(Ae,fe,Re,wt){var zt=Re.type;return zt===u?Pt(Ae,fe,Re.props.children,wt,Re.key):fe!==null&&(fe.elementType===zt||typeof zt=="object"&&zt!==null&&zt.$$typeof===A&&yL(zt)===fe.type)?(wt=P(fe,Re.props),wt.ref=sg(Ae,fe,Re),wt.return=Ae,wt):(wt=N_(Re.type,Re.key,Re.props,null,Ae.mode,wt),wt.ref=sg(Ae,fe,Re),wt.return=Ae,wt)}function st(Ae,fe,Re,wt){return fe===null||fe.tag!==4||fe.stateNode.containerInfo!==Re.containerInfo||fe.stateNode.implementation!==Re.implementation?(fe=PT(Re,Ae.mode,wt),fe.return=Ae,fe):(fe=P(fe,Re.children||[]),fe.return=Ae,fe)}function Pt(Ae,fe,Re,wt,zt){return fe===null||fe.tag!==7?(fe=yh(Re,Ae.mode,wt,zt),fe.return=Ae,fe):(fe=P(fe,Re),fe.return=Ae,fe)}function on(Ae,fe,Re){if(typeof fe=="string"&&fe!==""||typeof fe=="number")return fe=RT(""+fe,Ae.mode,Re),fe.return=Ae,fe;if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case l:return Re=N_(fe.type,fe.key,fe.props,null,Ae.mode,Re),Re.ref=sg(Ae,null,fe),Re.return=Ae,Re;case c:return fe=PT(fe,Ae.mode,Re),fe.return=Ae,fe;case A:var wt=fe._init;return on(Ae,wt(fe._payload),Re)}if(le(fe)||D(fe))return fe=yh(fe,Ae.mode,Re,null),fe.return=Ae,fe;t_(Ae,fe)}return null}function Kt(Ae,fe,Re,wt){var zt=fe!==null?fe.key:null;if(typeof Re=="string"&&Re!==""||typeof Re=="number")return zt!==null?null:ce(Ae,fe,""+Re,wt);if(typeof Re=="object"&&Re!==null){switch(Re.$$typeof){case l:return Re.key===zt?Ne(Ae,fe,Re,wt):null;case c:return Re.key===zt?st(Ae,fe,Re,wt):null;case A:return zt=Re._init,Kt(Ae,fe,zt(Re._payload),wt)}if(le(Re)||D(Re))return zt!==null?null:Pt(Ae,fe,Re,wt,null);t_(Ae,Re)}return null}function ni(Ae,fe,Re,wt,zt){if(typeof wt=="string"&&wt!==""||typeof wt=="number")return Ae=Ae.get(Re)||null,ce(fe,Ae,""+wt,zt);if(typeof wt=="object"&&wt!==null){switch(wt.$$typeof){case l:return Ae=Ae.get(wt.key===null?Re:wt.key)||null,Ne(fe,Ae,wt,zt);case c:return Ae=Ae.get(wt.key===null?Re:wt.key)||null,st(fe,Ae,wt,zt);case A:var mn=wt._init;return ni(Ae,fe,Re,mn(wt._payload),zt)}if(le(wt)||D(wt))return Ae=Ae.get(Re)||null,Pt(fe,Ae,wt,zt,null);t_(fe,wt)}return null}function Ht(Ae,fe,Re,wt){for(var zt=null,mn=null,an=fe,Un=fe=0,ur=null;an!==null&&Un<Re.length;Un++){an.index>Un?(ur=an,an=null):ur=an.sibling;var Vn=Kt(Ae,an,Re[Un],wt);if(Vn===null){an===null&&(an=ur);break}d&&an&&Vn.alternate===null&&p(Ae,an),fe=U(Vn,fe,Un),mn===null?zt=Vn:mn.sibling=Vn,mn=Vn,an=ur}if(Un===Re.length)return E(Ae,an),An&&Cn(Ae,Un),zt;if(an===null){for(;Un<Re.length;Un++)an=on(Ae,Re[Un],wt),an!==null&&(fe=U(an,fe,Un),mn===null?zt=an:mn.sibling=an,mn=an);return An&&Cn(Ae,Un),zt}for(an=b(Ae,an);Un<Re.length;Un++)ur=ni(an,Ae,Un,Re[Un],wt),ur!==null&&(d&&ur.alternate!==null&&an.delete(ur.key===null?Un:ur.key),fe=U(ur,fe,Un),mn===null?zt=ur:mn.sibling=ur,mn=ur);return d&&an.forEach(function(Tc){return p(Ae,Tc)}),An&&Cn(Ae,Un),zt}function Vr(Ae,fe,Re,wt){var zt=D(Re);if(typeof zt!="function")throw Error(o(150));if(Re=zt.call(Re),Re==null)throw Error(o(151));for(var mn=zt=null,an=fe,Un=fe=0,ur=null,Vn=Re.next();an!==null&&!Vn.done;Un++,Vn=Re.next()){an.index>Un?(ur=an,an=null):ur=an.sibling;var Tc=Kt(Ae,an,Vn.value,wt);if(Tc===null){an===null&&(an=ur);break}d&&an&&Tc.alternate===null&&p(Ae,an),fe=U(Tc,fe,Un),mn===null?zt=Tc:mn.sibling=Tc,mn=Tc,an=ur}if(Vn.done)return E(Ae,an),An&&Cn(Ae,Un),zt;if(an===null){for(;!Vn.done;Un++,Vn=Re.next())Vn=on(Ae,Vn.value,wt),Vn!==null&&(fe=U(Vn,fe,Un),mn===null?zt=Vn:mn.sibling=Vn,mn=Vn);return An&&Cn(Ae,Un),zt}for(an=b(Ae,an);!Vn.done;Un++,Vn=Re.next())Vn=ni(an,Ae,Un,Vn.value,wt),Vn!==null&&(d&&Vn.alternate!==null&&an.delete(Vn.key===null?Un:Vn.key),fe=U(Vn,fe,Un),mn===null?zt=Vn:mn.sibling=Vn,mn=Vn);return d&&an.forEach(function(Oq){return p(Ae,Oq)}),An&&Cn(Ae,Un),zt}function bo(Ae,fe,Re,wt){if(typeof Re=="object"&&Re!==null&&Re.type===u&&Re.key===null&&(Re=Re.props.children),typeof Re=="object"&&Re!==null){switch(Re.$$typeof){case l:e:{for(var zt=Re.key,mn=fe;mn!==null;){if(mn.key===zt){if(zt=Re.type,zt===u){if(mn.tag===7){E(Ae,mn.sibling),fe=P(mn,Re.props.children),fe.return=Ae,Ae=fe;break e}}else if(mn.elementType===zt||typeof zt=="object"&&zt!==null&&zt.$$typeof===A&&yL(zt)===mn.type){E(Ae,mn.sibling),fe=P(mn,Re.props),fe.ref=sg(Ae,mn,Re),fe.return=Ae,Ae=fe;break e}E(Ae,mn);break}else p(Ae,mn);mn=mn.sibling}Re.type===u?(fe=yh(Re.props.children,Ae.mode,wt,Re.key),fe.return=Ae,Ae=fe):(wt=N_(Re.type,Re.key,Re.props,null,Ae.mode,wt),wt.ref=sg(Ae,fe,Re),wt.return=Ae,Ae=wt)}return Z(Ae);case c:e:{for(mn=Re.key;fe!==null;){if(fe.key===mn)if(fe.tag===4&&fe.stateNode.containerInfo===Re.containerInfo&&fe.stateNode.implementation===Re.implementation){E(Ae,fe.sibling),fe=P(fe,Re.children||[]),fe.return=Ae,Ae=fe;break e}else{E(Ae,fe);break}else p(Ae,fe);fe=fe.sibling}fe=PT(Re,Ae.mode,wt),fe.return=Ae,Ae=fe}return Z(Ae);case A:return mn=Re._init,bo(Ae,fe,mn(Re._payload),wt)}if(le(Re))return Ht(Ae,fe,Re,wt);if(D(Re))return Vr(Ae,fe,Re,wt);t_(Ae,Re)}return typeof Re=="string"&&Re!==""||typeof Re=="number"?(Re=""+Re,fe!==null&&fe.tag===6?(E(Ae,fe.sibling),fe=P(fe,Re),fe.return=Ae,Ae=fe):(E(Ae,fe),fe=RT(Re,Ae.mode,wt),fe.return=Ae,Ae=fe),Z(Ae)):E(Ae,fe)}return bo}var yf=vL(!0),_L=vL(!1),og={},Eo=Rt(og),ag=Rt(og),vf=Rt(og);function Ra(d){if(d===og)throw Error(o(174));return d}function qS(d,p){Ft(vf,p),Ft(ag,d),Ft(Eo,og),d=de(p),vt(Eo),Ft(Eo,d)}function _f(){vt(Eo),vt(ag),vt(vf)}function xL(d){var p=Ra(vf.current),E=Ra(Eo.current);p=G(E,d.type,p),E!==p&&(Ft(ag,d),Ft(Eo,p))}function YS(d){ag.current===d&&(vt(Eo),vt(ag))}var vi=Rt(0);function n_(d){for(var p=d;p!==null;){if(p.tag===13){var E=p.memoizedState;if(E!==null&&(E=E.dehydrated,E===null||jn(E)||jo(E)))return p}else if(p.tag===19&&p.memoizedProps.revealOrder!==void 0){if(p.flags&128)return p}else if(p.child!==null){p.child.return=p,p=p.child;continue}if(p===d)break;for(;p.sibling===null;){if(p.return===null||p.return===d)return null;p=p.return}p.sibling.return=p.return,p=p.sibling}return null}var $S=[];function JS(){for(var d=0;d<$S.length;d++){var p=$S[d];St?p._workInProgressVersionPrimary=null:p._workInProgressVersionSecondary=null}$S.length=0}var i_=a.ReactCurrentDispatcher,Ao=a.ReactCurrentBatchConfig,xf=0,bi=null,Or=null,cr=null,r_=!1,lg=!1,cg=0,lq=0;function Fr(){throw Error(o(321))}function QS(d,p){if(p===null)return!1;for(var E=0;E<p.length&&E<d.length;E++)if(!Ys(d[E],p[E]))return!1;return!0}function ZS(d,p,E,b,P,U){if(xf=U,bi=p,p.memoizedState=null,p.updateQueue=null,p.lanes=0,i_.current=d===null||d.memoizedState===null?dq:fq,d=E(b,P),lg){U=0;do{if(lg=!1,cg=0,25<=U)throw Error(o(301));U+=1,cr=Or=null,p.updateQueue=null,i_.current=pq,d=E(b,P)}while(lg)}if(i_.current=c_,p=Or!==null&&Or.next!==null,xf=0,cr=Or=bi=null,r_=!1,p)throw Error(o(300));return d}function eT(){var d=cg!==0;return cg=0,d}function _l(){var d={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return cr===null?bi.memoizedState=cr=d:cr=cr.next=d,cr}function Pa(){if(Or===null){var d=bi.alternate;d=d!==null?d.memoizedState:null}else d=Or.next;var p=cr===null?bi.memoizedState:cr.next;if(p!==null)cr=p,Or=d;else{if(d===null)throw Error(o(310));Or=d,d={memoizedState:Or.memoizedState,baseState:Or.baseState,baseQueue:Or.baseQueue,queue:Or.queue,next:null},cr===null?bi.memoizedState=cr=d:cr=cr.next=d}return cr}function hh(d,p){return typeof p=="function"?p(d):p}function s_(d){var p=Pa(),E=p.queue;if(E===null)throw Error(o(311));E.lastRenderedReducer=d;var b=Or,P=b.baseQueue,U=E.pending;if(U!==null){if(P!==null){var Z=P.next;P.next=U.next,U.next=Z}b.baseQueue=P=U,E.pending=null}if(P!==null){U=P.next,b=b.baseState;var ce=Z=null,Ne=null,st=U;do{var Pt=st.lane;if((xf&Pt)===Pt)Ne!==null&&(Ne=Ne.next={lane:0,action:st.action,hasEagerState:st.hasEagerState,eagerState:st.eagerState,next:null}),b=st.hasEagerState?st.eagerState:d(b,st.action);else{var on={lane:Pt,action:st.action,hasEagerState:st.hasEagerState,eagerState:st.eagerState,next:null};Ne===null?(ce=Ne=on,Z=b):Ne=Ne.next=on,bi.lanes|=Pt,Ef|=Pt}st=st.next}while(st!==null&&st!==U);Ne===null?Z=b:Ne.next=ce,Ys(b,p.memoizedState)||(eo=!0),p.memoizedState=b,p.baseState=Z,p.baseQueue=Ne,E.lastRenderedState=b}if(d=E.interleaved,d!==null){P=d;do U=P.lane,bi.lanes|=U,Ef|=U,P=P.next;while(P!==d)}else P===null&&(E.lanes=0);return[p.memoizedState,E.dispatch]}function o_(d){var p=Pa(),E=p.queue;if(E===null)throw Error(o(311));E.lastRenderedReducer=d;var b=E.dispatch,P=E.pending,U=p.memoizedState;if(P!==null){E.pending=null;var Z=P=P.next;do U=d(U,Z.action),Z=Z.next;while(Z!==P);Ys(U,p.memoizedState)||(eo=!0),p.memoizedState=U,p.baseQueue===null&&(p.baseState=U),E.lastRenderedState=U}return[U,b]}function wL(){}function EL(d,p){var E=bi,b=Pa(),P=p(),U=!Ys(b.memoizedState,P);if(U&&(b.memoizedState=P,eo=!0),b=b.queue,hg(TL.bind(null,E,b,d),[d]),b.getSnapshot!==p||U||cr!==null&&cr.memoizedState.tag&1){if(E.flags|=2048,ug(9,SL.bind(null,E,b,P,p),void 0,null),Ki===null)throw Error(o(349));xf&30||AL(E,p,P)}return P}function AL(d,p,E){d.flags|=16384,d={getSnapshot:p,value:E},p=bi.updateQueue,p===null?(p={lastEffect:null,stores:null},bi.updateQueue=p,p.stores=[d]):(E=p.stores,E===null?p.stores=[d]:E.push(d))}function SL(d,p,E,b){p.value=E,p.getSnapshot=b,bL(p)&&So(d,1,-1)}function TL(d,p,E){return E(function(){bL(p)&&So(d,1,-1)})}function bL(d){var p=d.getSnapshot;d=d.value;try{var E=p();return!Ys(d,E)}catch{return!0}}function tT(d){var p=_l();return typeof d=="function"&&(d=d()),p.memoizedState=p.baseState=d,d={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:hh,lastRenderedState:d},p.queue=d,d=d.dispatch=hq.bind(null,bi,d),[p.memoizedState,d]}function ug(d,p,E,b){return d={tag:d,create:p,destroy:E,deps:b,next:null},p=bi.updateQueue,p===null?(p={lastEffect:null,stores:null},bi.updateQueue=p,p.lastEffect=d.next=d):(E=p.lastEffect,E===null?p.lastEffect=d.next=d:(b=E.next,E.next=d,d.next=b,p.lastEffect=d)),d}function CL(){return Pa().memoizedState}function a_(d,p,E,b){var P=_l();bi.flags|=d,P.memoizedState=ug(1|p,E,void 0,b===void 0?null:b)}function l_(d,p,E,b){var P=Pa();b=b===void 0?null:b;var U=void 0;if(Or!==null){var Z=Or.memoizedState;if(U=Z.destroy,b!==null&&QS(b,Z.deps)){P.memoizedState=ug(p,E,U,b);return}}bi.flags|=d,P.memoizedState=ug(1|p,E,U,b)}function nT(d,p){return a_(8390656,8,d,p)}function hg(d,p){return l_(2048,8,d,p)}function ML(d,p){return l_(4,2,d,p)}function IL(d,p){return l_(4,4,d,p)}function RL(d,p){if(typeof p=="function")return d=d(),p(d),function(){p(null)};if(p!=null)return d=d(),p.current=d,function(){p.current=null}}function PL(d,p,E){return E=E!=null?E.concat([d]):null,l_(4,4,RL.bind(null,p,d),E)}function iT(){}function NL(d,p){var E=Pa();p=p===void 0?null:p;var b=E.memoizedState;return b!==null&&p!==null&&QS(p,b[1])?b[0]:(E.memoizedState=[d,p],d)}function DL(d,p){var E=Pa();p=p===void 0?null:p;var b=E.memoizedState;return b!==null&&p!==null&&QS(p,b[1])?b[0]:(d=d(),E.memoizedState=[d,p],d)}function cq(d,p){var E=bn;bn=E!==0&&4>E?E:4,d(!0);var b=Ao.transition;Ao.transition={};try{d(!1),p()}finally{bn=E,Ao.transition=b}}function LL(){return Pa().memoizedState}function uq(d,p,E){var b=Ec(d);E={lane:b,action:E,hasEagerState:!1,eagerState:null,next:null},kL(d)?BL(p,E):(OL(d,p,E),E=hs(),d=So(d,b,E),d!==null&&FL(d,p,b))}function hq(d,p,E){var b=Ec(d),P={lane:b,action:E,hasEagerState:!1,eagerState:null,next:null};if(kL(d))BL(p,P);else{OL(d,p,P);var U=d.alternate;if(d.lanes===0&&(U===null||U.lanes===0)&&(U=p.lastRenderedReducer,U!==null))try{var Z=p.lastRenderedState,ce=U(Z,E);if(P.hasEagerState=!0,P.eagerState=ce,Ys(ce,Z))return}catch{}finally{}E=hs(),d=So(d,b,E),d!==null&&FL(d,p,b)}}function kL(d){var p=d.alternate;return d===bi||p!==null&&p===bi}function BL(d,p){lg=r_=!0;var E=d.pending;E===null?p.next=p:(p.next=E.next,E.next=p),d.pending=p}function OL(d,p,E){Ki!==null&&d.mode&1&&!(vn&2)?(d=p.interleaved,d===null?(E.next=E,kr===null?kr=[p]:kr.push(p)):(E.next=d.next,d.next=E),p.interleaved=E):(d=p.pending,d===null?E.next=E:(E.next=d.next,d.next=E),p.pending=E)}function FL(d,p,E){if(E&4194240){var b=p.lanes;b&=d.pendingLanes,E|=b,p.lanes=E,_o(d,E)}}var c_={readContext:ls,useCallback:Fr,useContext:Fr,useEffect:Fr,useImperativeHandle:Fr,useInsertionEffect:Fr,useLayoutEffect:Fr,useMemo:Fr,useReducer:Fr,useRef:Fr,useState:Fr,useDebugValue:Fr,useDeferredValue:Fr,useTransition:Fr,useMutableSource:Fr,useSyncExternalStore:Fr,useId:Fr,unstable_isNewReconciler:!1},dq={readContext:ls,useCallback:function(d,p){return _l().memoizedState=[d,p===void 0?null:p],d},useContext:ls,useEffect:nT,useImperativeHandle:function(d,p,E){return E=E!=null?E.concat([d]):null,a_(4194308,4,RL.bind(null,p,d),E)},useLayoutEffect:function(d,p){return a_(4194308,4,d,p)},useInsertionEffect:function(d,p){return a_(4,2,d,p)},useMemo:function(d,p){var E=_l();return p=p===void 0?null:p,d=d(),E.memoizedState=[d,p],d},useReducer:function(d,p,E){var b=_l();return p=E!==void 0?E(p):p,b.memoizedState=b.baseState=p,d={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:d,lastRenderedState:p},b.queue=d,d=d.dispatch=uq.bind(null,bi,d),[b.memoizedState,d]},useRef:function(d){var p=_l();return d={current:d},p.memoizedState=d},useState:tT,useDebugValue:iT,useDeferredValue:function(d){var p=tT(d),E=p[0],b=p[1];return nT(function(){var P=Ao.transition;Ao.transition={};try{b(d)}finally{Ao.transition=P}},[d]),E},useTransition:function(){var d=tT(!1),p=d[0];return d=cq.bind(null,d[1]),_l().memoizedState=d,[p,d]},useMutableSource:function(){},useSyncExternalStore:function(d,p,E){var b=bi,P=_l();if(An){if(E===void 0)throw Error(o(407));E=E()}else{if(E=p(),Ki===null)throw Error(o(349));xf&30||AL(b,p,E)}P.memoizedState=E;var U={value:E,getSnapshot:p};return P.queue=U,nT(TL.bind(null,b,U,d),[d]),b.flags|=2048,ug(9,SL.bind(null,b,U,E,p),void 0,null),E},useId:function(){var d=_l(),p=Ki.identifierPrefix;if(An){var E=et,b=Se;E=(b&~(1<<32-hn(b)-1)).toString(32)+E,p=":"+p+"R"+E,E=cg++,0<E&&(p+="H"+E.toString(32)),p+=":"}else E=lq++,p=":"+p+"r"+E.toString(32)+":";return d.memoizedState=p},unstable_isNewReconciler:!1},fq={readContext:ls,useCallback:NL,useContext:ls,useEffect:hg,useImperativeHandle:PL,useInsertionEffect:ML,useLayoutEffect:IL,useMemo:DL,useReducer:s_,useRef:CL,useState:function(){return s_(hh)},useDebugValue:iT,useDeferredValue:function(d){var p=s_(hh),E=p[0],b=p[1];return hg(function(){var P=Ao.transition;Ao.transition={};try{b(d)}finally{Ao.transition=P}},[d]),E},useTransition:function(){var d=s_(hh)[0],p=Pa().memoizedState;return[d,p]},useMutableSource:wL,useSyncExternalStore:EL,useId:LL,unstable_isNewReconciler:!1},pq={readContext:ls,useCallback:NL,useContext:ls,useEffect:hg,useImperativeHandle:PL,useInsertionEffect:ML,useLayoutEffect:IL,useMemo:DL,useReducer:o_,useRef:CL,useState:function(){return o_(hh)},useDebugValue:iT,useDeferredValue:function(d){var p=o_(hh),E=p[0],b=p[1];return hg(function(){var P=Ao.transition;Ao.transition={};try{b(d)}finally{Ao.transition=P}},[d]),E},useTransition:function(){var d=o_(hh)[0],p=Pa().memoizedState;return[d,p]},useMutableSource:wL,useSyncExternalStore:EL,useId:LL,unstable_isNewReconciler:!1};function rT(d,p){try{var E="",b=p;do E+=e_(b),b=b.return;while(b);var P=E}catch(U){P=`
Error generating stack: `+U.message+`
`+U.stack}return{value:d,source:p,stack:P}}function sT(d,p){try{console.error(p.value)}catch(E){setTimeout(function(){throw E})}}var mq=typeof WeakMap=="function"?WeakMap:Map;function UL(d,p,E){E=Qs(-1,E),E.tag=3,E.payload={element:null};var b=p.value;return E.callback=function(){T_||(T_=!0,AT=b),sT(d,p)},E}function VL(d,p,E){E=Qs(-1,E),E.tag=3;var b=d.type.getDerivedStateFromError;if(typeof b=="function"){var P=p.value;E.payload=function(){return b(P)},E.callback=function(){sT(d,p)}}var U=d.stateNode;return U!==null&&typeof U.componentDidCatch=="function"&&(E.callback=function(){sT(d,p),typeof b!="function"&&(xc===null?xc=new Set([this]):xc.add(this));var Z=p.stack;this.componentDidCatch(p.value,{componentStack:Z!==null?Z:""})}),E}function zL(d,p,E){var b=d.pingCache;if(b===null){b=d.pingCache=new mq;var P=new Set;b.set(p,P)}else P=b.get(p),P===void 0&&(P=new Set,b.set(p,P));P.has(E)||(P.add(E),d=Iq.bind(null,d,p,E),p.then(d,d))}function HL(d){do{var p;if((p=d.tag===13)&&(p=d.memoizedState,p=p!==null?p.dehydrated!==null:!0),p)return d;d=d.return}while(d!==null);return null}function GL(d,p,E,b,P){return d.mode&1?(d.flags|=65536,d.lanes=P,d):(d===p?d.flags|=65536:(d.flags|=128,E.flags|=131072,E.flags&=-52805,E.tag===1&&(E.alternate===null?E.tag=17:(p=Qs(-1,1),p.tag=2,Xo(E,p))),E.lanes|=1),d)}function Na(d){d.flags|=4}function jL(d,p){if(d!==null&&d.child===p.child)return!0;if(p.flags&16)return!1;for(d=p.child;d!==null;){if(d.flags&12854||d.subtreeFlags&12854)return!1;d=d.sibling}return!0}var dg,fg,u_,h_;if(Nt)dg=function(d,p){for(var E=p.child;E!==null;){if(E.tag===5||E.tag===6)ve(d,E.stateNode);else if(E.tag!==4&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===p)break;for(;E.sibling===null;){if(E.return===null||E.return===p)return;E=E.return}E.sibling.return=E.return,E=E.sibling}},fg=function(){},u_=function(d,p,E,b,P){if(d=d.memoizedProps,d!==b){var U=p.stateNode,Z=Ra(Eo.current);E=he(U,E,d,b,P,Z),(p.updateQueue=E)&&Na(p)}},h_=function(d,p,E,b){E!==b&&Na(p)};else if(ke){dg=function(d,p,E,b){for(var P=p.child;P!==null;){if(P.tag===5){var U=P.stateNode;E&&b&&(U=Vt(U,P.type,P.memoizedProps,P)),ve(d,U)}else if(P.tag===6)U=P.stateNode,E&&b&&(U=_n(U,P.memoizedProps,P)),ve(d,U);else if(P.tag!==4){if(P.tag===22&&P.memoizedState!==null)U=P.child,U!==null&&(U.return=P),dg(d,P,!0,!0);else if(P.child!==null){P.child.return=P,P=P.child;continue}}if(P===p)break;for(;P.sibling===null;){if(P.return===null||P.return===p)return;P=P.return}P.sibling.return=P.return,P=P.sibling}};var WL=function(d,p,E,b){for(var P=p.child;P!==null;){if(P.tag===5){var U=P.stateNode;E&&b&&(U=Vt(U,P.type,P.memoizedProps,P)),Ke(d,U)}else if(P.tag===6)U=P.stateNode,E&&b&&(U=_n(U,P.memoizedProps,P)),Ke(d,U);else if(P.tag!==4){if(P.tag===22&&P.memoizedState!==null)U=P.child,U!==null&&(U.return=P),WL(d,P,!0,!0);else if(P.child!==null){P.child.return=P,P=P.child;continue}}if(P===p)break;for(;P.sibling===null;){if(P.return===null||P.return===p)return;P=P.return}P.sibling.return=P.return,P=P.sibling}};fg=function(d,p){var E=p.stateNode;if(!jL(d,p)){d=E.containerInfo;var b=it(d);WL(b,p,!1,!1),E.pendingChildren=b,Na(p),Et(d,b)}},u_=function(d,p,E,b,P){var U=d.stateNode,Z=d.memoizedProps;if((d=jL(d,p))&&Z===b)p.stateNode=U;else{var ce=p.stateNode,Ne=Ra(Eo.current),st=null;Z!==b&&(st=he(ce,E,Z,b,P,Ne)),d&&st===null?p.stateNode=U:(U=ot(U,st,E,Z,b,p,d,ce),be(U,E,b,P,Ne)&&Na(p),p.stateNode=U,d?Na(p):dg(U,p,!1,!1))}},h_=function(d,p,E,b){E!==b?(d=Ra(vf.current),E=Ra(Eo.current),p.stateNode=Oe(b,d,E,p),Na(p)):p.stateNode=d.stateNode}}else fg=function(){},u_=function(){},h_=function(){};function pg(d,p){if(!An)switch(d.tailMode){case"hidden":p=d.tail;for(var E=null;p!==null;)p.alternate!==null&&(E=p),p=p.sibling;E===null?d.tail=null:E.sibling=null;break;case"collapsed":E=d.tail;for(var b=null;E!==null;)E.alternate!==null&&(b=E),E=E.sibling;b===null?p||d.tail===null?d.tail=null:d.tail.sibling=null:b.sibling=null}}function Ur(d){var p=d.alternate!==null&&d.alternate.child===d.child,E=0,b=0;if(p)for(var P=d.child;P!==null;)E|=P.lanes|P.childLanes,b|=P.subtreeFlags&14680064,b|=P.flags&14680064,P.return=d,P=P.sibling;else for(P=d.child;P!==null;)E|=P.lanes|P.childLanes,b|=P.subtreeFlags,b|=P.flags,P.return=d,P=P.sibling;return d.subtreeFlags|=b,d.childLanes=E,p}function gq(d,p,E){var b=p.pendingProps;switch(ji(p),p.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ur(p),null;case 1:return Yn(p.type)&&Pn(),Ur(p),null;case 3:return b=p.stateNode,_f(),vt(Wt),vt(rt),JS(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),(d===null||d.child===null)&&(rg(p)?Na(p):d===null||d.memoizedState.isDehydrated&&!(p.flags&256)||(p.flags|=1024,cs!==null&&(bT(cs),cs=null))),fg(d,p),Ur(p),null;case 5:YS(p),E=Ra(vf.current);var P=p.type;if(d!==null&&p.stateNode!=null)u_(d,p,P,b,E),d.ref!==p.ref&&(p.flags|=512,p.flags|=2097152);else{if(!b){if(p.stateNode===null)throw Error(o(166));return Ur(p),null}if(d=Ra(Eo.current),rg(p)){if(!Ue)throw Error(o(175));d=H(p.stateNode,p.type,p.memoizedProps,E,d,p,!Ia),p.updateQueue=d,d!==null&&Na(p)}else{var U=ue(P,b,E,d,p);dg(U,p,!1,!1),p.stateNode=U,be(U,P,b,E,d)&&Na(p)}p.ref!==null&&(p.flags|=512,p.flags|=2097152)}return Ur(p),null;case 6:if(d&&p.stateNode!=null)h_(d,p,d.memoizedProps,b);else{if(typeof b!="string"&&p.stateNode===null)throw Error(o(166));if(d=Ra(vf.current),E=Ra(Eo.current),rg(p)){if(!Ue)throw Error(o(176));if(d=p.stateNode,b=p.memoizedProps,(E=K(d,b,p,!Ia))&&(P=Kn,P!==null))switch(U=(P.mode&1)!==0,P.tag){case 3:Q(P.stateNode.containerInfo,d,b,U);break;case 5:ge(P.type,P.memoizedProps,P.stateNode,d,b,U)}E&&Na(p)}else p.stateNode=Oe(b,d,E,p)}return Ur(p),null;case 13:if(vt(vi),b=p.memoizedState,An&&Wi!==null&&p.mode&1&&!(p.flags&128)){for(d=Wi;d;)d=Di(d);return gf(),p.flags|=98560,p}if(b!==null&&b.dehydrated!==null){if(b=rg(p),d===null){if(!b)throw Error(o(318));if(!Ue)throw Error(o(344));if(d=p.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(o(317));ae(d,p)}else gf(),!(p.flags&128)&&(p.memoizedState=null),p.flags|=4;return Ur(p),null}return cs!==null&&(bT(cs),cs=null),p.flags&128?(p.lanes=E,p):(b=b!==null,E=!1,d===null?rg(p):E=d.memoizedState!==null,b&&!E&&(p.child.flags|=8192,p.mode&1&&(d===null||vi.current&1?er===0&&(er=3):MT())),p.updateQueue!==null&&(p.flags|=4),Ur(p),null);case 4:return _f(),fg(d,p),d===null&&xt(p.stateNode.containerInfo),Ur(p),null;case 10:return hf(p.type._context),Ur(p),null;case 17:return Yn(p.type)&&Pn(),Ur(p),null;case 19:if(vt(vi),P=p.memoizedState,P===null)return Ur(p),null;if(b=(p.flags&128)!==0,U=P.rendering,U===null)if(b)pg(P,!1);else{if(er!==0||d!==null&&d.flags&128)for(d=p.child;d!==null;){if(U=n_(d),U!==null){for(p.flags|=128,pg(P,!1),d=U.updateQueue,d!==null&&(p.updateQueue=d,p.flags|=4),p.subtreeFlags=0,d=E,b=p.child;b!==null;)E=b,P=d,E.flags&=14680066,U=E.alternate,U===null?(E.childLanes=0,E.lanes=P,E.child=null,E.subtreeFlags=0,E.memoizedProps=null,E.memoizedState=null,E.updateQueue=null,E.dependencies=null,E.stateNode=null):(E.childLanes=U.childLanes,E.lanes=U.lanes,E.child=U.child,E.subtreeFlags=0,E.deletions=null,E.memoizedProps=U.memoizedProps,E.memoizedState=U.memoizedState,E.updateQueue=U.updateQueue,E.type=U.type,P=U.dependencies,E.dependencies=P===null?null:{lanes:P.lanes,firstContext:P.firstContext}),b=b.sibling;return Ft(vi,vi.current&1|2),p.child}d=d.sibling}P.tail!==null&&Hi()>ET&&(p.flags|=128,b=!0,pg(P,!1),p.lanes=4194304)}else{if(!b)if(d=n_(U),d!==null){if(p.flags|=128,b=!0,d=d.updateQueue,d!==null&&(p.updateQueue=d,p.flags|=4),pg(P,!0),P.tail===null&&P.tailMode==="hidden"&&!U.alternate&&!An)return Ur(p),null}else 2*Hi()-P.renderingStartTime>ET&&E!==1073741824&&(p.flags|=128,b=!0,pg(P,!1),p.lanes=4194304);P.isBackwards?(U.sibling=p.child,p.child=U):(d=P.last,d!==null?d.sibling=U:p.child=U,P.last=U)}return P.tail!==null?(p=P.tail,P.rendering=p,P.tail=p.sibling,P.renderingStartTime=Hi(),p.sibling=null,d=vi.current,Ft(vi,b?d&1|2:d&1),p):(Ur(p),null);case 22:case 23:return CT(),b=p.memoizedState!==null,d!==null&&d.memoizedState!==null!==b&&(p.flags|=8192),b&&p.mode&1?to&1073741824&&(Ur(p),Nt&&p.subtreeFlags&6&&(p.flags|=8192)):Ur(p),null;case 24:return null;case 25:return null}throw Error(o(156,p.tag))}var yq=a.ReactCurrentOwner,eo=!1;function us(d,p,E,b){p.child=d===null?_L(p,null,E,b):yf(p,d.child,E,b)}function KL(d,p,E,b,P){E=E.render;var U=p.ref;return _c(p,P),b=ZS(d,p,E,b,U,P),E=eT(),d!==null&&!eo?(p.updateQueue=d.updateQueue,p.flags&=-2053,d.lanes&=~P,xl(d,p,P)):(An&&E&&En(p),p.flags|=1,us(d,p,b,P),p.child)}function XL(d,p,E,b,P){if(d===null){var U=E.type;return typeof U=="function"&&!IT(U)&&U.defaultProps===void 0&&E.compare===null&&E.defaultProps===void 0?(p.tag=15,p.type=U,qL(d,p,U,b,P)):(d=N_(E.type,null,b,p,p.mode,P),d.ref=p.ref,d.return=p,p.child=d)}if(U=d.child,!(d.lanes&P)){var Z=U.memoizedProps;if(E=E.compare,E=E!==null?E:gl,E(Z,b)&&d.ref===p.ref)return xl(d,p,P)}return p.flags|=1,d=Sc(U,b),d.ref=p.ref,d.return=p,p.child=d}function qL(d,p,E,b,P){if(d!==null&&gl(d.memoizedProps,b)&&d.ref===p.ref)if(eo=!1,(d.lanes&P)!==0)d.flags&131072&&(eo=!0);else return p.lanes=d.lanes,xl(d,p,P);return oT(d,p,E,b,P)}function YL(d,p,E){var b=p.pendingProps,P=b.children,U=d!==null?d.memoizedState:null;if(b.mode==="hidden")if(!(p.mode&1))p.memoizedState={baseLanes:0,cachePool:null},Ft(wf,to),to|=E;else if(E&1073741824)p.memoizedState={baseLanes:0,cachePool:null},b=U!==null?U.baseLanes:E,Ft(wf,to),to|=b;else return d=U!==null?U.baseLanes|E:E,p.lanes=p.childLanes=1073741824,p.memoizedState={baseLanes:d,cachePool:null},p.updateQueue=null,Ft(wf,to),to|=d,null;else U!==null?(b=U.baseLanes|E,p.memoizedState=null):b=E,Ft(wf,to),to|=b;return us(d,p,P,E),p.child}function $L(d,p){var E=p.ref;(d===null&&E!==null||d!==null&&d.ref!==E)&&(p.flags|=512,p.flags|=2097152)}function oT(d,p,E,b,P){var U=Yn(E)?Ut:rt.current;return U=Wn(p,U),_c(p,P),E=ZS(d,p,E,b,U,P),b=eT(),d!==null&&!eo?(p.updateQueue=d.updateQueue,p.flags&=-2053,d.lanes&=~P,xl(d,p,P)):(An&&b&&En(p),p.flags|=1,us(d,p,E,P),p.child)}function JL(d,p,E,b,P){if(Yn(E)){var U=!0;$t(p)}else U=!1;if(_c(p,P),p.stateNode===null)d!==null&&(d.alternate=null,p.alternate=null,p.flags|=2),uh(p,E,b),mf(p,E,b,P),b=!0;else if(d===null){var Z=p.stateNode,ce=p.memoizedProps;Z.props=ce;var Ne=Z.context,st=E.contextType;typeof st=="object"&&st!==null?st=ls(st):(st=Yn(E)?Ut:rt.current,st=Wn(p,st));var Pt=E.getDerivedStateFromProps,on=typeof Pt=="function"||typeof Z.getSnapshotBeforeUpdate=="function";on||typeof Z.UNSAFE_componentWillReceiveProps!="function"&&typeof Z.componentWillReceiveProps!="function"||(ce!==b||Ne!==st)&&Br(p,Z,b,st),Ko=!1;var Kt=p.memoizedState;Z.state=Kt,lh(p,b,Z,P),Ne=p.memoizedState,ce!==b||Kt!==Ne||Wt.current||Ko?(typeof Pt=="function"&&(pf(p,E,Pt,b),Ne=p.memoizedState),(ce=Ko||ig(p,E,ce,b,Kt,Ne,st))?(on||typeof Z.UNSAFE_componentWillMount!="function"&&typeof Z.componentWillMount!="function"||(typeof Z.componentWillMount=="function"&&Z.componentWillMount(),typeof Z.UNSAFE_componentWillMount=="function"&&Z.UNSAFE_componentWillMount()),typeof Z.componentDidMount=="function"&&(p.flags|=4194308)):(typeof Z.componentDidMount=="function"&&(p.flags|=4194308),p.memoizedProps=b,p.memoizedState=Ne),Z.props=b,Z.state=Ne,Z.context=st,b=ce):(typeof Z.componentDidMount=="function"&&(p.flags|=4194308),b=!1)}else{Z=p.stateNode,ff(d,p),ce=p.memoizedProps,st=p.type===p.elementType?ce:Li(p.type,ce),Z.props=st,on=p.pendingProps,Kt=Z.context,Ne=E.contextType,typeof Ne=="object"&&Ne!==null?Ne=ls(Ne):(Ne=Yn(E)?Ut:rt.current,Ne=Wn(p,Ne));var ni=E.getDerivedStateFromProps;(Pt=typeof ni=="function"||typeof Z.getSnapshotBeforeUpdate=="function")||typeof Z.UNSAFE_componentWillReceiveProps!="function"&&typeof Z.componentWillReceiveProps!="function"||(ce!==on||Kt!==Ne)&&Br(p,Z,b,Ne),Ko=!1,Kt=p.memoizedState,Z.state=Kt,lh(p,b,Z,P);var Ht=p.memoizedState;ce!==on||Kt!==Ht||Wt.current||Ko?(typeof ni=="function"&&(pf(p,E,ni,b),Ht=p.memoizedState),(st=Ko||ig(p,E,st,b,Kt,Ht,Ne)||!1)?(Pt||typeof Z.UNSAFE_componentWillUpdate!="function"&&typeof Z.componentWillUpdate!="function"||(typeof Z.componentWillUpdate=="function"&&Z.componentWillUpdate(b,Ht,Ne),typeof Z.UNSAFE_componentWillUpdate=="function"&&Z.UNSAFE_componentWillUpdate(b,Ht,Ne)),typeof Z.componentDidUpdate=="function"&&(p.flags|=4),typeof Z.getSnapshotBeforeUpdate=="function"&&(p.flags|=1024)):(typeof Z.componentDidUpdate!="function"||ce===d.memoizedProps&&Kt===d.memoizedState||(p.flags|=4),typeof Z.getSnapshotBeforeUpdate!="function"||ce===d.memoizedProps&&Kt===d.memoizedState||(p.flags|=1024),p.memoizedProps=b,p.memoizedState=Ht),Z.props=b,Z.state=Ht,Z.context=Ne,b=st):(typeof Z.componentDidUpdate!="function"||ce===d.memoizedProps&&Kt===d.memoizedState||(p.flags|=4),typeof Z.getSnapshotBeforeUpdate!="function"||ce===d.memoizedProps&&Kt===d.memoizedState||(p.flags|=1024),b=!1)}return aT(d,p,E,b,U,P)}function aT(d,p,E,b,P,U){$L(d,p);var Z=(p.flags&128)!==0;if(!b&&!Z)return P&&Jt(p,E,!1),xl(d,p,U);b=p.stateNode,yq.current=p;var ce=Z&&typeof E.getDerivedStateFromError!="function"?null:b.render();return p.flags|=1,d!==null&&Z?(p.child=yf(p,d.child,null,U),p.child=yf(p,null,ce,U)):us(d,p,ce,U),p.memoizedState=b.state,P&&Jt(p,E,!0),p.child}function QL(d){var p=d.stateNode;p.pendingContext?gn(d,p.pendingContext,p.pendingContext!==p.context):p.context&&gn(d,p.context,!1),qS(d,p.containerInfo)}function ZL(d,p,E,b,P){return gf(),XS(P),p.flags|=256,us(d,p,E,b),p.child}var d_={dehydrated:null,treeContext:null,retryLane:0};function f_(d){return{baseLanes:d,cachePool:null}}function ek(d,p,E){var b=p.pendingProps,P=vi.current,U=!1,Z=(p.flags&128)!==0,ce;if((ce=Z)||(ce=d!==null&&d.memoizedState===null?!1:(P&2)!==0),ce?(U=!0,p.flags&=-129):(d===null||d.memoizedState!==null)&&(P|=1),Ft(vi,P&1),d===null)return KS(p),d=p.memoizedState,d!==null&&(d=d.dehydrated,d!==null)?(p.mode&1?jo(d)?p.lanes=8:p.lanes=1073741824:p.lanes=1,null):(P=b.children,d=b.fallback,U?(b=p.mode,U=p.child,P={mode:"hidden",children:P},!(b&1)&&U!==null?(U.childLanes=0,U.pendingProps=P):U=D_(P,b,0,null),d=yh(d,b,E,null),U.return=p,d.return=p,U.sibling=d,p.child=U,p.child.memoizedState=f_(E),p.memoizedState=d_,d):lT(p,P));if(P=d.memoizedState,P!==null){if(ce=P.dehydrated,ce!==null){if(Z)return p.flags&256?(p.flags&=-257,p_(d,p,E,Error(o(422)))):p.memoizedState!==null?(p.child=d.child,p.flags|=128,null):(U=b.fallback,P=p.mode,b=D_({mode:"visible",children:b.children},P,0,null),U=yh(U,P,E,null),U.flags|=2,b.return=p,U.return=p,b.sibling=U,p.child=b,p.mode&1&&yf(p,d.child,null,E),p.child.memoizedState=f_(E),p.memoizedState=d_,U);if(!(p.mode&1))p=p_(d,p,E,null);else if(jo(ce))p=p_(d,p,E,Error(o(419)));else if(b=(E&d.childLanes)!==0,eo||b){if(b=Ki,b!==null){switch(E&-E){case 4:U=2;break;case 16:U=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:U=32;break;case 536870912:U=268435456;break;default:U=0}b=U&(b.suspendedLanes|E)?0:U,b!==0&&b!==P.retryLane&&(P.retryLane=b,So(d,b,-1))}MT(),p=p_(d,p,E,Error(o(421)))}else jn(ce)?(p.flags|=128,p.child=d.child,p=Rq.bind(null,d),vo(ce,p),p=null):(E=P.treeContext,Ue&&(Wi=Xs(ce),Kn=p,An=!0,cs=null,Ia=!1,E!==null&&(F[W++]=Se,F[W++]=et,F[W++]=me,Se=E.id,et=E.overflow,me=p)),p=lT(p,p.pendingProps.children),p.flags|=4096);return p}return U?(b=nk(d,p,b.children,b.fallback,E),U=p.child,P=d.child.memoizedState,U.memoizedState=P===null?f_(E):{baseLanes:P.baseLanes|E,cachePool:null},U.childLanes=d.childLanes&~E,p.memoizedState=d_,b):(E=tk(d,p,b.children,E),p.memoizedState=null,E)}return U?(b=nk(d,p,b.children,b.fallback,E),U=p.child,P=d.child.memoizedState,U.memoizedState=P===null?f_(E):{baseLanes:P.baseLanes|E,cachePool:null},U.childLanes=d.childLanes&~E,p.memoizedState=d_,b):(E=tk(d,p,b.children,E),p.memoizedState=null,E)}function lT(d,p){return p=D_({mode:"visible",children:p},d.mode,0,null),p.return=d,d.child=p}function tk(d,p,E,b){var P=d.child;return d=P.sibling,E=Sc(P,{mode:"visible",children:E}),!(p.mode&1)&&(E.lanes=b),E.return=p,E.sibling=null,d!==null&&(b=p.deletions,b===null?(p.deletions=[d],p.flags|=16):b.push(d)),p.child=E}function nk(d,p,E,b,P){var U=p.mode;d=d.child;var Z=d.sibling,ce={mode:"hidden",children:E};return!(U&1)&&p.child!==d?(E=p.child,E.childLanes=0,E.pendingProps=ce,p.deletions=null):(E=Sc(d,ce),E.subtreeFlags=d.subtreeFlags&14680064),Z!==null?b=Sc(Z,b):(b=yh(b,U,P,null),b.flags|=2),b.return=p,E.return=p,E.sibling=b,p.child=E,b}function p_(d,p,E,b){return b!==null&&XS(b),yf(p,d.child,null,E),d=lT(p,p.pendingProps.children),d.flags|=2,p.memoizedState=null,d}function ik(d,p,E){d.lanes|=p;var b=d.alternate;b!==null&&(b.lanes|=p),vc(d.return,p,E)}function cT(d,p,E,b,P){var U=d.memoizedState;U===null?d.memoizedState={isBackwards:p,rendering:null,renderingStartTime:0,last:b,tail:E,tailMode:P}:(U.isBackwards=p,U.rendering=null,U.renderingStartTime=0,U.last=b,U.tail=E,U.tailMode=P)}function rk(d,p,E){var b=p.pendingProps,P=b.revealOrder,U=b.tail;if(us(d,p,b.children,E),b=vi.current,b&2)b=b&1|2,p.flags|=128;else{if(d!==null&&d.flags&128)e:for(d=p.child;d!==null;){if(d.tag===13)d.memoizedState!==null&&ik(d,E,p);else if(d.tag===19)ik(d,E,p);else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===p)break e;for(;d.sibling===null;){if(d.return===null||d.return===p)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}b&=1}if(Ft(vi,b),!(p.mode&1))p.memoizedState=null;else switch(P){case"forwards":for(E=p.child,P=null;E!==null;)d=E.alternate,d!==null&&n_(d)===null&&(P=E),E=E.sibling;E=P,E===null?(P=p.child,p.child=null):(P=E.sibling,E.sibling=null),cT(p,!1,P,E,U);break;case"backwards":for(E=null,P=p.child,p.child=null;P!==null;){if(d=P.alternate,d!==null&&n_(d)===null){p.child=P;break}d=P.sibling,P.sibling=E,E=P,P=d}cT(p,!0,E,null,U);break;case"together":cT(p,!1,null,null,void 0);break;default:p.memoizedState=null}return p.child}function xl(d,p,E){if(d!==null&&(p.dependencies=d.dependencies),Ef|=p.lanes,!(E&p.childLanes))return null;if(d!==null&&p.child!==d.child)throw Error(o(153));if(p.child!==null){for(d=p.child,E=Sc(d,d.pendingProps),p.child=E,E.return=p;d.sibling!==null;)d=d.sibling,E=E.sibling=Sc(d,d.pendingProps),E.return=p;E.sibling=null}return p.child}function vq(d,p,E){switch(p.tag){case 3:QL(p),gf();break;case 5:xL(p);break;case 1:Yn(p.type)&&$t(p);break;case 4:qS(p,p.stateNode.containerInfo);break;case 10:ah(p,p.type._context,p.memoizedProps.value);break;case 13:var b=p.memoizedState;if(b!==null)return b.dehydrated!==null?(Ft(vi,vi.current&1),p.flags|=128,null):E&p.child.childLanes?ek(d,p,E):(Ft(vi,vi.current&1),d=xl(d,p,E),d!==null?d.sibling:null);Ft(vi,vi.current&1);break;case 19:if(b=(E&p.childLanes)!==0,d.flags&128){if(b)return rk(d,p,E);p.flags|=128}var P=p.memoizedState;if(P!==null&&(P.rendering=null,P.tail=null,P.lastEffect=null),Ft(vi,vi.current),b)break;return null;case 22:case 23:return p.lanes=0,YL(d,p,E)}return xl(d,p,E)}function _q(d,p){switch(ji(p),p.tag){case 1:return Yn(p.type)&&Pn(),d=p.flags,d&65536?(p.flags=d&-65537|128,p):null;case 3:return _f(),vt(Wt),vt(rt),JS(),d=p.flags,d&65536&&!(d&128)?(p.flags=d&-65537|128,p):null;case 5:return YS(p),null;case 13:if(vt(vi),d=p.memoizedState,d!==null&&d.dehydrated!==null){if(p.alternate===null)throw Error(o(340));gf()}return d=p.flags,d&65536?(p.flags=d&-65537|128,p):null;case 19:return vt(vi),null;case 4:return _f(),null;case 10:return hf(p.type._context),null;case 22:case 23:return CT(),null;case 24:return null;default:return null}}var m_=!1,dh=!1,xq=typeof WeakSet=="function"?WeakSet:Set,_t=null;function g_(d,p){var E=d.ref;if(E!==null)if(typeof E=="function")try{E(null)}catch(b){Is(d,p,b)}else E.current=null}function uT(d,p,E){try{E()}catch(b){Is(d,p,b)}}var sk=!1;function wq(d,p){for($(d.containerInfo),_t=p;_t!==null;)if(d=_t,p=d.child,(d.subtreeFlags&1028)!==0&&p!==null)p.return=d,_t=p;else for(;_t!==null;){d=_t;try{var E=d.alternate;if(d.flags&1024)switch(d.tag){case 0:case 11:case 15:break;case 1:if(E!==null){var b=E.memoizedProps,P=E.memoizedState,U=d.stateNode,Z=U.getSnapshotBeforeUpdate(d.elementType===d.type?b:Li(d.type,b),P);U.__reactInternalSnapshotBeforeUpdate=Z}break;case 3:Nt&&De(d.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(ce){Is(d,d.return,ce)}if(p=d.sibling,p!==null){p.return=d.return,_t=p;break}_t=d.return}return E=sk,sk=!1,E}function fh(d,p,E){var b=p.updateQueue;if(b=b!==null?b.lastEffect:null,b!==null){var P=b=b.next;do{if((P.tag&d)===d){var U=P.destroy;P.destroy=void 0,U!==void 0&&uT(p,E,U)}P=P.next}while(P!==b)}}function mg(d,p){if(p=p.updateQueue,p=p!==null?p.lastEffect:null,p!==null){var E=p=p.next;do{if((E.tag&d)===d){var b=E.create;E.destroy=b()}E=E.next}while(E!==p)}}function hT(d){var p=d.ref;if(p!==null){var E=d.stateNode;switch(d.tag){case 5:d=ie(E);break;default:d=E}typeof p=="function"?p(d):p.current=d}}function ok(d,p,E){if(qs&&typeof qs.onCommitFiberUnmount=="function")try{qs.onCommitFiberUnmount(ml,p)}catch{}switch(p.tag){case 0:case 11:case 14:case 15:if(d=p.updateQueue,d!==null&&(d=d.lastEffect,d!==null)){var b=d=d.next;do{var P=b,U=P.destroy;P=P.tag,U!==void 0&&(P&2||P&4)&&uT(p,E,U),b=b.next}while(b!==d)}break;case 1:if(g_(p,E),d=p.stateNode,typeof d.componentWillUnmount=="function")try{d.props=p.memoizedProps,d.state=p.memoizedState,d.componentWillUnmount()}catch(Z){Is(p,E,Z)}break;case 5:g_(p,E);break;case 4:Nt?dk(d,p,E):ke&&ke&&(p=p.stateNode.containerInfo,E=it(p),Gt(p,E))}}function ak(d,p,E){for(var b=p;;)if(ok(d,b,E),b.child===null||Nt&&b.tag===4){if(b===p)break;for(;b.sibling===null;){if(b.return===null||b.return===p)return;b=b.return}b.sibling.return=b.return,b=b.sibling}else b.child.return=b,b=b.child}function lk(d){var p=d.alternate;p!==null&&(d.alternate=null,lk(p)),d.child=null,d.deletions=null,d.sibling=null,d.tag===5&&(p=d.stateNode,p!==null&&ht(p)),d.stateNode=null,d.return=null,d.dependencies=null,d.memoizedProps=null,d.memoizedState=null,d.pendingProps=null,d.stateNode=null,d.updateQueue=null}function ck(d){return d.tag===5||d.tag===3||d.tag===4}function uk(d){e:for(;;){for(;d.sibling===null;){if(d.return===null||ck(d.return))return null;d=d.return}for(d.sibling.return=d.return,d=d.sibling;d.tag!==5&&d.tag!==6&&d.tag!==18;){if(d.flags&2||d.child===null||d.tag===4)continue e;d.child.return=d,d=d.child}if(!(d.flags&2))return d.stateNode}}function hk(d){if(Nt){e:{for(var p=d.return;p!==null;){if(ck(p))break e;p=p.return}throw Error(o(160))}var E=p;switch(E.tag){case 5:p=E.stateNode,E.flags&32&&(Te(p),E.flags&=-33),E=uk(d),fT(d,E,p);break;case 3:case 4:p=E.stateNode.containerInfo,E=uk(d),dT(d,E,p);break;default:throw Error(o(161))}}}function dT(d,p,E){var b=d.tag;if(b===5||b===6)d=d.stateNode,p?gt(E,d,p):ct(E,d);else if(b!==4&&(d=d.child,d!==null))for(dT(d,p,E),d=d.sibling;d!==null;)dT(d,p,E),d=d.sibling}function fT(d,p,E){var b=d.tag;if(b===5||b===6)d=d.stateNode,p?It(E,d,p):nt(E,d);else if(b!==4&&(d=d.child,d!==null))for(fT(d,p,E),d=d.sibling;d!==null;)fT(d,p,E),d=d.sibling}function dk(d,p,E){for(var b=p,P=!1,U,Z;;){if(!P){P=b.return;e:for(;;){if(P===null)throw Error(o(160));switch(U=P.stateNode,P.tag){case 5:Z=!1;break e;case 3:U=U.containerInfo,Z=!0;break e;case 4:U=U.containerInfo,Z=!0;break e}P=P.return}P=!0}if(b.tag===5||b.tag===6)ak(d,b,E),Z?oe(U,b.stateNode):ut(U,b.stateNode);else if(b.tag===18)Z?ne(U,b.stateNode):J(U,b.stateNode);else if(b.tag===4){if(b.child!==null){U=b.stateNode.containerInfo,Z=!0,b.child.return=b,b=b.child;continue}}else if(ok(d,b,E),b.child!==null){b.child.return=b,b=b.child;continue}if(b===p)break;for(;b.sibling===null;){if(b.return===null||b.return===p)return;b=b.return,b.tag===4&&(P=!1)}b.sibling.return=b.return,b=b.sibling}}function pT(d,p){if(Nt){switch(p.tag){case 0:case 11:case 14:case 15:fh(3,p,p.return),mg(3,p),fh(5,p,p.return);return;case 1:return;case 5:var E=p.stateNode;if(E!=null){var b=p.memoizedProps;d=d!==null?d.memoizedProps:b;var P=p.type,U=p.updateQueue;p.updateQueue=null,U!==null&&dt(E,U,P,d,b,p)}return;case 6:if(p.stateNode===null)throw Error(o(162));E=p.memoizedProps,Yt(p.stateNode,d!==null?d.memoizedProps:E,E);return;case 3:Ue&&d!==null&&d.memoizedState.isDehydrated&&Me(p.stateNode.containerInfo);return;case 12:return;case 13:y_(p);return;case 19:y_(p);return;case 17:return}throw Error(o(163))}switch(p.tag){case 0:case 11:case 14:case 15:fh(3,p,p.return),mg(3,p),fh(5,p,p.return);return;case 12:return;case 13:y_(p);return;case 19:y_(p);return;case 3:Ue&&d!==null&&d.memoizedState.isDehydrated&&Me(p.stateNode.containerInfo);break;case 22:case 23:return}e:if(ke){switch(p.tag){case 1:case 5:case 6:break e;case 3:case 4:p=p.stateNode,Gt(p.containerInfo,p.pendingChildren);break e}throw Error(o(163))}}function y_(d){var p=d.updateQueue;if(p!==null){d.updateQueue=null;var E=d.stateNode;E===null&&(E=d.stateNode=new xq),p.forEach(function(b){var P=Pq.bind(null,d,b);E.has(b)||(E.add(b),b.then(P,P))})}}function Eq(d,p){for(_t=p;_t!==null;){p=_t;var E=p.deletions;if(E!==null)for(var b=0;b<E.length;b++){var P=E[b];try{var U=d;Nt?dk(U,P,p):ak(U,P,p);var Z=P.alternate;Z!==null&&(Z.return=null),P.return=null}catch(zt){Is(P,p,zt)}}if(E=p.child,p.subtreeFlags&12854&&E!==null)E.return=p,_t=E;else for(;_t!==null;){p=_t;try{var ce=p.flags;if(ce&32&&Nt&&Te(p.stateNode),ce&512){var Ne=p.alternate;if(Ne!==null){var st=Ne.ref;st!==null&&(typeof st=="function"?st(null):st.current=null)}}if(ce&8192)switch(p.tag){case 13:if(p.memoizedState!==null){var Pt=p.alternate;(Pt===null||Pt.memoizedState===null)&&(wT=Hi())}break;case 22:var on=p.memoizedState!==null,Kt=p.alternate,ni=Kt!==null&&Kt.memoizedState!==null;if(E=p,Nt){e:if(b=E,P=on,U=null,Nt)for(var Ht=b;;){if(Ht.tag===5){if(U===null){U=Ht;var Vr=Ht.stateNode;P?Ye(Vr):ye(Ht.stateNode,Ht.memoizedProps)}}else if(Ht.tag===6){if(U===null){var bo=Ht.stateNode;P?se(bo):we(bo,Ht.memoizedProps)}}else if((Ht.tag!==22&&Ht.tag!==23||Ht.memoizedState===null||Ht===b)&&Ht.child!==null){Ht.child.return=Ht,Ht=Ht.child;continue}if(Ht===b)break;for(;Ht.sibling===null;){if(Ht.return===null||Ht.return===b)break e;U===Ht&&(U=null),Ht=Ht.return}U===Ht&&(U=null),Ht.sibling.return=Ht.return,Ht=Ht.sibling}}if(on&&!ni&&E.mode&1){_t=E;for(var Ae=E.child;Ae!==null;){for(E=_t=Ae;_t!==null;){b=_t;var fe=b.child;switch(b.tag){case 0:case 11:case 14:case 15:fh(4,b,b.return);break;case 1:g_(b,b.return);var Re=b.stateNode;if(typeof Re.componentWillUnmount=="function"){var wt=b.return;try{Re.props=b.memoizedProps,Re.state=b.memoizedState,Re.componentWillUnmount()}catch(zt){Is(b,wt,zt)}}break;case 5:g_(b,b.return);break;case 22:if(b.memoizedState!==null){mk(E);continue}}fe!==null?(fe.return=b,_t=fe):mk(E)}Ae=Ae.sibling}}}switch(ce&4102){case 2:hk(p),p.flags&=-3;break;case 6:hk(p),p.flags&=-3,pT(p.alternate,p);break;case 4096:p.flags&=-4097;break;case 4100:p.flags&=-4097,pT(p.alternate,p);break;case 4:pT(p.alternate,p)}}catch(zt){Is(p,p.return,zt)}if(E=p.sibling,E!==null){E.return=p.return,_t=E;break}_t=p.return}}}function Aq(d,p,E){_t=d,fk(d)}function fk(d,p,E){for(var b=(d.mode&1)!==0;_t!==null;){var P=_t,U=P.child;if(P.tag===22&&b){var Z=P.memoizedState!==null||m_;if(!Z){var ce=P.alternate,Ne=ce!==null&&ce.memoizedState!==null||dh;ce=m_;var st=dh;if(m_=Z,(dh=Ne)&&!st)for(_t=P;_t!==null;)Z=_t,Ne=Z.child,Z.tag===22&&Z.memoizedState!==null?gk(P):Ne!==null?(Ne.return=Z,_t=Ne):gk(P);for(;U!==null;)_t=U,fk(U),U=U.sibling;_t=P,m_=ce,dh=st}pk(d)}else P.subtreeFlags&8772&&U!==null?(U.return=P,_t=U):pk(d)}}function pk(d){for(;_t!==null;){var p=_t;if(p.flags&8772){var E=p.alternate;try{if(p.flags&8772)switch(p.tag){case 0:case 11:case 15:dh||mg(5,p);break;case 1:var b=p.stateNode;if(p.flags&4&&!dh)if(E===null)b.componentDidMount();else{var P=p.elementType===p.type?E.memoizedProps:Li(p.type,E.memoizedProps);b.componentDidUpdate(P,E.memoizedState,b.__reactInternalSnapshotBeforeUpdate)}var U=p.updateQueue;U!==null&&Ma(p,U,b);break;case 3:var Z=p.updateQueue;if(Z!==null){if(E=null,p.child!==null)switch(p.child.tag){case 5:E=ie(p.child.stateNode);break;case 1:E=p.child.stateNode}Ma(p,Z,E)}break;case 5:var ce=p.stateNode;E===null&&p.flags&4&&Xe(ce,p.type,p.memoizedProps,p);break;case 6:break;case 4:break;case 12:break;case 13:if(Ue&&p.memoizedState===null){var Ne=p.alternate;if(Ne!==null){var st=Ne.memoizedState;if(st!==null){var Pt=st.dehydrated;Pt!==null&&z(Pt)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(o(163))}dh||p.flags&512&&hT(p)}catch(on){Is(p,p.return,on)}}if(p===d){_t=null;break}if(E=p.sibling,E!==null){E.return=p.return,_t=E;break}_t=p.return}}function mk(d){for(;_t!==null;){var p=_t;if(p===d){_t=null;break}var E=p.sibling;if(E!==null){E.return=p.return,_t=E;break}_t=p.return}}function gk(d){for(;_t!==null;){var p=_t;try{switch(p.tag){case 0:case 11:case 15:var E=p.return;try{mg(4,p)}catch(Ne){Is(p,E,Ne)}break;case 1:var b=p.stateNode;if(typeof b.componentDidMount=="function"){var P=p.return;try{b.componentDidMount()}catch(Ne){Is(p,P,Ne)}}var U=p.return;try{hT(p)}catch(Ne){Is(p,U,Ne)}break;case 5:var Z=p.return;try{hT(p)}catch(Ne){Is(p,Z,Ne)}}}catch(Ne){Is(p,p.return,Ne)}if(p===d){_t=null;break}var ce=p.sibling;if(ce!==null){ce.return=p.return,_t=ce;break}_t=p.return}}var v_=0,__=1,x_=2,w_=3,E_=4;if(typeof Symbol=="function"&&Symbol.for){var gg=Symbol.for;v_=gg("selector.component"),__=gg("selector.has_pseudo_class"),x_=gg("selector.role"),w_=gg("selector.test_id"),E_=gg("selector.text")}function mT(d){var p=ee(d);if(p!=null){if(typeof p.memoizedProps["data-testname"]!="string")throw Error(o(364));return p}if(d=Y(d),d===null)throw Error(o(362));return d.stateNode.current}function gT(d,p){switch(p.$$typeof){case v_:if(d.type===p.value)return!0;break;case __:e:{p=p.value,d=[d,0];for(var E=0;E<d.length;){var b=d[E++],P=d[E++],U=p[P];if(b.tag!==5||!Ie(b)){for(;U!=null&&gT(b,U);)P++,U=p[P];if(P===p.length){p=!0;break e}else for(b=b.child;b!==null;)d.push(b,P),b=b.sibling}}p=!1}return p;case x_:if(d.tag===5&&ze(d.stateNode,p.value))return!0;break;case E_:if((d.tag===5||d.tag===6)&&(d=pe(d),d!==null&&0<=d.indexOf(p.value)))return!0;break;case w_:if(d.tag===5&&(d=d.memoizedProps["data-testname"],typeof d=="string"&&d.toLowerCase()===p.value.toLowerCase()))return!0;break;default:throw Error(o(365))}return!1}function yT(d){switch(d.$$typeof){case v_:return"<"+(R(d.value)||"Unknown")+">";case __:return":has("+(yT(d)||"")+")";case x_:return'[role="'+d.value+'"]';case E_:return'"'+d.value+'"';case w_:return'[data-testname="'+d.value+'"]';default:throw Error(o(365))}}function yk(d,p){var E=[];d=[d,0];for(var b=0;b<d.length;){var P=d[b++],U=d[b++],Z=p[U];if(P.tag!==5||!Ie(P)){for(;Z!=null&&gT(P,Z);)U++,Z=p[U];if(U===p.length)E.push(P);else for(P=P.child;P!==null;)d.push(P,U),P=P.sibling}}return E}function vT(d,p){if(!lt)throw Error(o(363));d=mT(d),d=yk(d,p),p=[],d=Array.from(d);for(var E=0;E<d.length;){var b=d[E++];if(b.tag===5)Ie(b)||p.push(b.stateNode);else for(b=b.child;b!==null;)d.push(b),b=b.sibling}return p}var Sq=Math.ceil,A_=a.ReactCurrentDispatcher,_T=a.ReactCurrentOwner,ki=a.ReactCurrentBatchConfig,vn=0,Ki=null,Xi=null,Er=0,to=0,wf=Rt(0),er=0,yg=null,Ef=0,S_=0,xT=0,vg=null,Cs=null,wT=0,ET=1/0;function Af(){ET=Hi()+500}var T_=!1,AT=null,xc=null,b_=!1,wc=null,C_=0,_g=0,ST=null,M_=-1,I_=0;function hs(){return vn&6?Hi():M_!==-1?M_:M_=Hi()}function Ec(d){return d.mode&1?vn&2&&Er!==0?Er&-Er:Zv.transition!==null?(I_===0&&(d=fl,fl<<=1,!(fl&4194240)&&(fl=64),I_=d),I_):(d=bn,d!==0?d:je()):1}function So(d,p,E){if(50<_g)throw _g=0,ST=null,Error(o(185));var b=R_(d,p);return b===null?null:(th(b,p,E),(!(vn&2)||b!==Ki)&&(b===Ki&&(!(vn&2)&&(S_|=p),er===4&&Ac(b,Er)),Ms(b,E),p===1&&vn===0&&!(d.mode&1)&&(Af(),ti&&Js())),b)}function R_(d,p){d.lanes|=p;var E=d.alternate;for(E!==null&&(E.lanes|=p),E=d,d=d.return;d!==null;)d.childLanes|=p,E=d.alternate,E!==null&&(E.childLanes|=p),E=d,d=d.return;return E.tag===3?E.stateNode:null}function Ms(d,p){var E=d.callbackNode;zS(d,p);var b=of(d,d===Ki?Er:0);if(b===0)E!==null&&pl(E),d.callbackNode=null,d.callbackPriority=0;else if(p=b&-b,d.callbackPriority!==p){if(E!=null&&pl(E),p===1)d.tag===0?Qv(_k.bind(null,d)):Jv(_k.bind(null,d)),$e?Mt(function(){vn===0&&Js()}):af(xo,Js),E=null;else{switch(Qm(b)){case 1:E=xo;break;case 4:E=jS;break;case 16:E=Zm;break;case 536870912:E=lf;break;default:E=Zm}E=Mk(E,vk.bind(null,d))}d.callbackPriority=p,d.callbackNode=E}}function vk(d,p){if(M_=-1,I_=0,vn&6)throw Error(o(327));var E=d.callbackNode;if(gh()&&d.callbackNode!==E)return null;var b=of(d,d===Ki?Er:0);if(b===0)return null;if(b&30||b&d.expiredLanes||p)p=P_(d,b);else{p=b;var P=vn;vn|=2;var U=Ek();(Ki!==d||Er!==p)&&(Af(),ph(d,p));do try{Cq();break}catch(ce){wk(d,ce)}while(!0);oh(),A_.current=U,vn=P,Xi!==null?p=0:(Ki=null,Er=0,p=er)}if(p!==0){if(p===2&&(P=$m(d),P!==0&&(b=P,p=TT(d,P))),p===1)throw E=yg,ph(d,0),Ac(d,b),Ms(d,Hi()),E;if(p===6)Ac(d,b);else{if(P=d.current.alternate,!(b&30)&&!Tq(P)&&(p=P_(d,b),p===2&&(U=$m(d),U!==0&&(b=U,p=TT(d,U))),p===1))throw E=yg,ph(d,0),Ac(d,b),Ms(d,Hi()),E;switch(d.finishedWork=P,d.finishedLanes=b,p){case 0:case 1:throw Error(o(345));case 2:mh(d,Cs);break;case 3:if(Ac(d,b),(b&130023424)===b&&(p=wT+500-Hi(),10<p)){if(of(d,0)!==0)break;if(P=d.suspendedLanes,(P&b)!==b){hs(),d.pingedLanes|=d.suspendedLanes&P;break}d.timeoutHandle=Ce(mh.bind(null,d,Cs),p);break}mh(d,Cs);break;case 4:if(Ac(d,b),(b&4194240)===b)break;for(p=d.eventTimes,P=-1;0<b;){var Z=31-hn(b);U=1<<Z,Z=p[Z],Z>P&&(P=Z),b&=~U}if(b=P,b=Hi()-b,b=(120>b?120:480>b?480:1080>b?1080:1920>b?1920:3e3>b?3e3:4320>b?4320:1960*Sq(b/1960))-b,10<b){d.timeoutHandle=Ce(mh.bind(null,d,Cs),b);break}mh(d,Cs);break;case 5:mh(d,Cs);break;default:throw Error(o(329))}}}return Ms(d,Hi()),d.callbackNode===E?vk.bind(null,d):null}function TT(d,p){var E=vg;return d.current.memoizedState.isDehydrated&&(ph(d,p).flags|=256),d=P_(d,p),d!==2&&(p=Cs,Cs=E,p!==null&&bT(p)),d}function bT(d){Cs===null?Cs=d:Cs.push.apply(Cs,d)}function Tq(d){for(var p=d;;){if(p.flags&16384){var E=p.updateQueue;if(E!==null&&(E=E.stores,E!==null))for(var b=0;b<E.length;b++){var P=E[b],U=P.getSnapshot;P=P.value;try{if(!Ys(U(),P))return!1}catch{return!1}}}if(E=p.child,p.subtreeFlags&16384&&E!==null)E.return=p,p=E;else{if(p===d)break;for(;p.sibling===null;){if(p.return===null||p.return===d)return!0;p=p.return}p.sibling.return=p.return,p=p.sibling}}return!0}function Ac(d,p){for(p&=~xT,p&=~S_,d.suspendedLanes|=p,d.pingedLanes&=~p,d=d.expirationTimes;0<p;){var E=31-hn(p),b=1<<E;d[E]=-1,p&=~b}}function _k(d){if(vn&6)throw Error(o(327));gh();var p=of(d,0);if(!(p&1))return Ms(d,Hi()),null;var E=P_(d,p);if(d.tag!==0&&E===2){var b=$m(d);b!==0&&(p=b,E=TT(d,b))}if(E===1)throw E=yg,ph(d,0),Ac(d,p),Ms(d,Hi()),E;if(E===6)throw Error(o(345));return d.finishedWork=d.current.alternate,d.finishedLanes=p,mh(d,Cs),Ms(d,Hi()),null}function xk(d){wc!==null&&wc.tag===0&&!(vn&6)&&gh();var p=vn;vn|=1;var E=ki.transition,b=bn;try{if(ki.transition=null,bn=1,d)return d()}finally{bn=b,ki.transition=E,vn=p,!(vn&6)&&Js()}}function CT(){to=wf.current,vt(wf)}function ph(d,p){d.finishedWork=null,d.finishedLanes=0;var E=d.timeoutHandle;if(E!==Lt&&(d.timeoutHandle=Lt,mt(E)),Xi!==null)for(E=Xi.return;E!==null;){var b=E;switch(ji(b),b.tag){case 1:b=b.type.childContextTypes,b!=null&&Pn();break;case 3:_f(),vt(Wt),vt(rt),JS();break;case 5:YS(b);break;case 4:_f();break;case 13:vt(vi);break;case 19:vt(vi);break;case 10:hf(b.type._context);break;case 22:case 23:CT()}E=E.return}if(Ki=d,Xi=d=Sc(d.current,null),Er=to=p,er=0,yg=null,xT=S_=Ef=0,Cs=vg=null,kr!==null){for(p=0;p<kr.length;p++)if(E=kr[p],b=E.interleaved,b!==null){E.interleaved=null;var P=b.next,U=E.pending;if(U!==null){var Z=U.next;U.next=P,b.next=Z}E.pending=b}kr=null}return d}function wk(d,p){do{var E=Xi;try{if(oh(),i_.current=c_,r_){for(var b=bi.memoizedState;b!==null;){var P=b.queue;P!==null&&(P.pending=null),b=b.next}r_=!1}if(xf=0,cr=Or=bi=null,lg=!1,cg=0,_T.current=null,E===null||E.return===null){er=1,yg=p,Xi=null;break}e:{var U=d,Z=E.return,ce=E,Ne=p;if(p=Er,ce.flags|=32768,Ne!==null&&typeof Ne=="object"&&typeof Ne.then=="function"){var st=Ne,Pt=ce,on=Pt.tag;if(!(Pt.mode&1)&&(on===0||on===11||on===15)){var Kt=Pt.alternate;Kt?(Pt.updateQueue=Kt.updateQueue,Pt.memoizedState=Kt.memoizedState,Pt.lanes=Kt.lanes):(Pt.updateQueue=null,Pt.memoizedState=null)}var ni=HL(Z);if(ni!==null){ni.flags&=-257,GL(ni,Z,ce,U,p),ni.mode&1&&zL(U,st,p),p=ni,Ne=st;var Ht=p.updateQueue;if(Ht===null){var Vr=new Set;Vr.add(Ne),p.updateQueue=Vr}else Ht.add(Ne);break e}else{if(!(p&1)){zL(U,st,p),MT();break e}Ne=Error(o(426))}}else if(An&&ce.mode&1){var bo=HL(Z);if(bo!==null){!(bo.flags&65536)&&(bo.flags|=256),GL(bo,Z,ce,U,p),XS(Ne);break e}}U=Ne,er!==4&&(er=2),vg===null?vg=[U]:vg.push(U),Ne=rT(Ne,ce),ce=Z;do{switch(ce.tag){case 3:ce.flags|=65536,p&=-p,ce.lanes|=p;var Ae=UL(ce,Ne,p);tg(ce,Ae);break e;case 1:U=Ne;var fe=ce.type,Re=ce.stateNode;if(!(ce.flags&128)&&(typeof fe.getDerivedStateFromError=="function"||Re!==null&&typeof Re.componentDidCatch=="function"&&(xc===null||!xc.has(Re)))){ce.flags|=65536,p&=-p,ce.lanes|=p;var wt=VL(ce,U,p);tg(ce,wt);break e}}ce=ce.return}while(ce!==null)}Sk(E)}catch(zt){p=zt,Xi===E&&E!==null&&(Xi=E=E.return);continue}break}while(!0)}function Ek(){var d=A_.current;return A_.current=c_,d===null?c_:d}function MT(){(er===0||er===3||er===2)&&(er=4),Ki===null||!(Ef&268435455)&&!(S_&268435455)||Ac(Ki,Er)}function P_(d,p){var E=vn;vn|=2;var b=Ek();Ki===d&&Er===p||ph(d,p);do try{bq();break}catch(P){wk(d,P)}while(!0);if(oh(),vn=E,A_.current=b,Xi!==null)throw Error(o(261));return Ki=null,Er=0,er}function bq(){for(;Xi!==null;)Ak(Xi)}function Cq(){for(;Xi!==null&&!HS();)Ak(Xi)}function Ak(d){var p=Ck(d.alternate,d,to);d.memoizedProps=d.pendingProps,p===null?Sk(d):Xi=p,_T.current=null}function Sk(d){var p=d;do{var E=p.alternate;if(d=p.return,p.flags&32768){if(E=_q(E,p),E!==null){E.flags&=32767,Xi=E;return}if(d!==null)d.flags|=32768,d.subtreeFlags=0,d.deletions=null;else{er=6,Xi=null;return}}else if(E=gq(E,p,to),E!==null){Xi=E;return}if(p=p.sibling,p!==null){Xi=p;return}Xi=p=d}while(p!==null);er===0&&(er=5)}function mh(d,p){var E=bn,b=ki.transition;try{ki.transition=null,bn=1,Mq(d,p,E)}finally{ki.transition=b,bn=E}return null}function Mq(d,p,E){do gh();while(wc!==null);if(vn&6)throw Error(o(327));var b=d.finishedWork,P=d.finishedLanes;if(b===null)return null;if(d.finishedWork=null,d.finishedLanes=0,b===d.current)throw Error(o(177));d.callbackNode=null,d.callbackPriority=0;var U=b.lanes|b.childLanes;if(nh(d,U),d===Ki&&(Xi=Ki=null,Er=0),!(b.subtreeFlags&2064)&&!(b.flags&2064)||b_||(b_=!0,Mk(Zm,function(){return gh(),null})),U=(b.flags&15990)!==0,b.subtreeFlags&15990||U){U=ki.transition,ki.transition=null;var Z=bn;bn=1;var ce=vn;vn|=4,_T.current=null,wq(d,b),Eq(d,b),te(d.containerInfo),d.current=b,Aq(b),GS(),vn=ce,bn=Z,ki.transition=U}else d.current=b;if(b_&&(b_=!1,wc=d,C_=P),U=d.pendingLanes,U===0&&(xc=null),ih(b.stateNode),Ms(d,Hi()),p!==null)for(E=d.onRecoverableError,b=0;b<p.length;b++)E(p[b]);if(T_)throw T_=!1,d=AT,AT=null,d;return C_&1&&d.tag!==0&&gh(),U=d.pendingLanes,U&1?d===ST?_g++:(_g=0,ST=d):_g=0,Js(),null}function gh(){if(wc!==null){var d=Qm(C_),p=ki.transition,E=bn;try{if(ki.transition=null,bn=16>d?16:d,wc===null)var b=!1;else{if(d=wc,wc=null,C_=0,vn&6)throw Error(o(331));var P=vn;for(vn|=4,_t=d.current;_t!==null;){var U=_t,Z=U.child;if(_t.flags&16){var ce=U.deletions;if(ce!==null){for(var Ne=0;Ne<ce.length;Ne++){var st=ce[Ne];for(_t=st;_t!==null;){var Pt=_t;switch(Pt.tag){case 0:case 11:case 15:fh(8,Pt,U)}var on=Pt.child;if(on!==null)on.return=Pt,_t=on;else for(;_t!==null;){Pt=_t;var Kt=Pt.sibling,ni=Pt.return;if(lk(Pt),Pt===st){_t=null;break}if(Kt!==null){Kt.return=ni,_t=Kt;break}_t=ni}}}var Ht=U.alternate;if(Ht!==null){var Vr=Ht.child;if(Vr!==null){Ht.child=null;do{var bo=Vr.sibling;Vr.sibling=null,Vr=bo}while(Vr!==null)}}_t=U}}if(U.subtreeFlags&2064&&Z!==null)Z.return=U,_t=Z;else e:for(;_t!==null;){if(U=_t,U.flags&2048)switch(U.tag){case 0:case 11:case 15:fh(9,U,U.return)}var Ae=U.sibling;if(Ae!==null){Ae.return=U.return,_t=Ae;break e}_t=U.return}}var fe=d.current;for(_t=fe;_t!==null;){Z=_t;var Re=Z.child;if(Z.subtreeFlags&2064&&Re!==null)Re.return=Z,_t=Re;else e:for(Z=fe;_t!==null;){if(ce=_t,ce.flags&2048)try{switch(ce.tag){case 0:case 11:case 15:mg(9,ce)}}catch(zt){Is(ce,ce.return,zt)}if(ce===Z){_t=null;break e}var wt=ce.sibling;if(wt!==null){wt.return=ce.return,_t=wt;break e}_t=ce.return}}if(vn=P,Js(),qs&&typeof qs.onPostCommitFiberRoot=="function")try{qs.onPostCommitFiberRoot(ml,d)}catch{}b=!0}return b}finally{bn=E,ki.transition=p}}return!1}function Tk(d,p,E){p=rT(E,p),p=UL(d,p,1),Xo(d,p),p=hs(),d=R_(d,1),d!==null&&(th(d,1,p),Ms(d,p))}function Is(d,p,E){if(d.tag===3)Tk(d,d,E);else for(;p!==null;){if(p.tag===3){Tk(p,d,E);break}else if(p.tag===1){var b=p.stateNode;if(typeof p.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(xc===null||!xc.has(b))){d=rT(E,d),d=VL(p,d,1),Xo(p,d),d=hs(),p=R_(p,1),p!==null&&(th(p,1,d),Ms(p,d));break}}p=p.return}}function Iq(d,p,E){var b=d.pingCache;b!==null&&b.delete(p),p=hs(),d.pingedLanes|=d.suspendedLanes&E,Ki===d&&(Er&E)===E&&(er===4||er===3&&(Er&130023424)===Er&&500>Hi()-wT?ph(d,0):xT|=E),Ms(d,p)}function bk(d,p){p===0&&(d.mode&1?(p=Ca,Ca<<=1,!(Ca&130023424)&&(Ca=4194304)):p=1);var E=hs();d=R_(d,p),d!==null&&(th(d,p,E),Ms(d,E))}function Rq(d){var p=d.memoizedState,E=0;p!==null&&(E=p.retryLane),bk(d,E)}function Pq(d,p){var E=0;switch(d.tag){case 13:var b=d.stateNode,P=d.memoizedState;P!==null&&(E=P.retryLane);break;case 19:b=d.stateNode;break;default:throw Error(o(314))}b!==null&&b.delete(p),bk(d,E)}var Ck;Ck=function(d,p,E){if(d!==null)if(d.memoizedProps!==p.pendingProps||Wt.current)eo=!0;else{if(!(d.lanes&E)&&!(p.flags&128))return eo=!1,vq(d,p,E);eo=!!(d.flags&131072)}else eo=!1,An&&p.flags&1048576&&Gi(p,N,p.index);switch(p.lanes=0,p.tag){case 2:var b=p.type;d!==null&&(d.alternate=null,p.alternate=null,p.flags|=2),d=p.pendingProps;var P=Wn(p,rt.current);_c(p,E),P=ZS(null,p,b,d,P,E);var U=eT();return p.flags|=1,typeof P=="object"&&P!==null&&typeof P.render=="function"&&P.$$typeof===void 0?(p.tag=1,p.memoizedState=null,p.updateQueue=null,Yn(b)?(U=!0,$t(p)):U=!1,p.memoizedState=P.state!==null&&P.state!==void 0?P.state:null,df(p),P.updater=ch,p.stateNode=P,P._reactInternals=p,mf(p,b,d,E),p=aT(null,p,b,!0,U,E)):(p.tag=0,An&&U&&En(p),us(null,p,P,E),p=p.child),p;case 16:b=p.elementType;e:{switch(d!==null&&(d.alternate=null,p.alternate=null,p.flags|=2),d=p.pendingProps,P=b._init,b=P(b._payload),p.type=b,P=p.tag=Dq(b),d=Li(b,d),P){case 0:p=oT(null,p,b,d,E);break e;case 1:p=JL(null,p,b,d,E);break e;case 11:p=KL(null,p,b,d,E);break e;case 14:p=XL(null,p,b,Li(b.type,d),E);break e}throw Error(o(306,b,""))}return p;case 0:return b=p.type,P=p.pendingProps,P=p.elementType===b?P:Li(b,P),oT(d,p,b,P,E);case 1:return b=p.type,P=p.pendingProps,P=p.elementType===b?P:Li(b,P),JL(d,p,b,P,E);case 3:e:{if(QL(p),d===null)throw Error(o(387));b=p.pendingProps,U=p.memoizedState,P=U.element,ff(d,p),lh(p,b,null,E);var Z=p.memoizedState;if(b=Z.element,Ue&&U.isDehydrated)if(U={element:b,isDehydrated:!1,cache:Z.cache,transitions:Z.transitions},p.updateQueue.baseState=U,p.memoizedState=U,p.flags&256){P=Error(o(423)),p=ZL(d,p,b,E,P);break e}else if(b!==P){P=Error(o(424)),p=ZL(d,p,b,E,P);break e}else for(Ue&&(Wi=dl(p.stateNode.containerInfo),Kn=p,An=!0,cs=null,Ia=!1),E=_L(p,null,b,E),p.child=E;E;)E.flags=E.flags&-3|4096,E=E.sibling;else{if(gf(),b===P){p=xl(d,p,E);break e}us(d,p,b,E)}p=p.child}return p;case 5:return xL(p),d===null&&KS(p),b=p.type,P=p.pendingProps,U=d!==null?d.memoizedProps:null,Z=P.children,Pe(b,P)?Z=null:U!==null&&Pe(b,U)&&(p.flags|=32),$L(d,p),us(d,p,Z,E),p.child;case 6:return d===null&&KS(p),null;case 13:return ek(d,p,E);case 4:return qS(p,p.stateNode.containerInfo),b=p.pendingProps,d===null?p.child=yf(p,null,b,E):us(d,p,b,E),p.child;case 11:return b=p.type,P=p.pendingProps,P=p.elementType===b?P:Li(b,P),KL(d,p,b,P,E);case 7:return us(d,p,p.pendingProps,E),p.child;case 8:return us(d,p,p.pendingProps.children,E),p.child;case 12:return us(d,p,p.pendingProps.children,E),p.child;case 10:e:{if(b=p.type._context,P=p.pendingProps,U=p.memoizedProps,Z=P.value,ah(p,b,Z),U!==null)if(Ys(U.value,Z)){if(U.children===P.children&&!Wt.current){p=xl(d,p,E);break e}}else for(U=p.child,U!==null&&(U.return=p);U!==null;){var ce=U.dependencies;if(ce!==null){Z=U.child;for(var Ne=ce.firstContext;Ne!==null;){if(Ne.context===b){if(U.tag===1){Ne=Qs(-1,E&-E),Ne.tag=2;var st=U.updateQueue;if(st!==null){st=st.shared;var Pt=st.pending;Pt===null?Ne.next=Ne:(Ne.next=Pt.next,Pt.next=Ne),st.pending=Ne}}U.lanes|=E,Ne=U.alternate,Ne!==null&&(Ne.lanes|=E),vc(U.return,E,p),ce.lanes|=E;break}Ne=Ne.next}}else if(U.tag===10)Z=U.type===p.type?null:U.child;else if(U.tag===18){if(Z=U.return,Z===null)throw Error(o(341));Z.lanes|=E,ce=Z.alternate,ce!==null&&(ce.lanes|=E),vc(Z,E,p),Z=U.sibling}else Z=U.child;if(Z!==null)Z.return=U;else for(Z=U;Z!==null;){if(Z===p){Z=null;break}if(U=Z.sibling,U!==null){U.return=Z.return,Z=U;break}Z=Z.return}U=Z}us(d,p,P.children,E),p=p.child}return p;case 9:return P=p.type,b=p.pendingProps.children,_c(p,E),P=ls(P),b=b(P),p.flags|=1,us(d,p,b,E),p.child;case 14:return b=p.type,P=Li(b,p.pendingProps),P=Li(b.type,P),XL(d,p,b,P,E);case 15:return qL(d,p,p.type,p.pendingProps,E);case 17:return b=p.type,P=p.pendingProps,P=p.elementType===b?P:Li(b,P),d!==null&&(d.alternate=null,p.alternate=null,p.flags|=2),p.tag=1,Yn(b)?(d=!0,$t(p)):d=!1,_c(p,E),uh(p,b,P),mf(p,b,P,E),aT(null,p,b,!0,d,E);case 19:return rk(d,p,E);case 22:return YL(d,p,E)}throw Error(o(156,p.tag))};function Mk(d,p){return af(d,p)}function Nq(d,p,E,b){this.tag=d,this.key=E,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=p,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=b,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function To(d,p,E,b){return new Nq(d,p,E,b)}function IT(d){return d=d.prototype,!(!d||!d.isReactComponent)}function Dq(d){if(typeof d=="function")return IT(d)?1:0;if(d!=null){if(d=d.$$typeof,d===_)return 11;if(d===w)return 14}return 2}function Sc(d,p){var E=d.alternate;return E===null?(E=To(d.tag,p,d.key,d.mode),E.elementType=d.elementType,E.type=d.type,E.stateNode=d.stateNode,E.alternate=d,d.alternate=E):(E.pendingProps=p,E.type=d.type,E.flags=0,E.subtreeFlags=0,E.deletions=null),E.flags=d.flags&14680064,E.childLanes=d.childLanes,E.lanes=d.lanes,E.child=d.child,E.memoizedProps=d.memoizedProps,E.memoizedState=d.memoizedState,E.updateQueue=d.updateQueue,p=d.dependencies,E.dependencies=p===null?null:{lanes:p.lanes,firstContext:p.firstContext},E.sibling=d.sibling,E.index=d.index,E.ref=d.ref,E}function N_(d,p,E,b,P,U){var Z=2;if(b=d,typeof d=="function")IT(d)&&(Z=1);else if(typeof d=="string")Z=5;else e:switch(d){case u:return yh(E.children,P,U,p);case h:Z=8,P|=8;break;case f:return d=To(12,E,p,P|2),d.elementType=f,d.lanes=U,d;case v:return d=To(13,E,p,P),d.elementType=v,d.lanes=U,d;case g:return d=To(19,E,p,P),d.elementType=g,d.lanes=U,d;case T:return D_(E,P,U,p);default:if(typeof d=="object"&&d!==null)switch(d.$$typeof){case m:Z=10;break e;case y:Z=9;break e;case _:Z=11;break e;case w:Z=14;break e;case A:Z=16,b=null;break e}throw Error(o(130,d==null?d:typeof d,""))}return p=To(Z,E,p,P),p.elementType=d,p.type=b,p.lanes=U,p}function yh(d,p,E,b){return d=To(7,d,b,p),d.lanes=E,d}function D_(d,p,E,b){return d=To(22,d,b,p),d.elementType=T,d.lanes=E,d.stateNode={},d}function RT(d,p,E){return d=To(6,d,null,p),d.lanes=E,d}function PT(d,p,E){return p=To(4,d.children!==null?d.children:[],d.key,p),p.lanes=E,p.stateNode={containerInfo:d.containerInfo,pendingChildren:null,implementation:d.implementation},p}function Lq(d,p,E,b,P){this.tag=p,this.containerInfo=d,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Lt,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Jm(0),this.expirationTimes=Jm(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jm(0),this.identifierPrefix=b,this.onRecoverableError=P,Ue&&(this.mutableSourceEagerHydrationData=null)}function Ik(d,p,E,b,P,U,Z,ce,Ne){return d=new Lq(d,p,E,ce,Ne),p===1?(p=1,U===!0&&(p|=8)):p=0,U=To(3,null,null,p),d.current=U,U.stateNode=d,U.memoizedState={element:b,isDehydrated:E,cache:null,transitions:null},df(U),d}function Rk(d){if(!d)return At;d=d._reactInternals;e:{if(M(d)!==d||d.tag!==1)throw Error(o(170));var p=d;do{switch(p.tag){case 3:p=p.stateNode.context;break e;case 1:if(Yn(p.type)){p=p.stateNode.__reactInternalMemoizedMergedChildContext;break e}}p=p.return}while(p!==null);throw Error(o(171))}if(d.tag===1){var E=d.type;if(Yn(E))return Zt(d,E,p)}return p}function Pk(d){var p=d._reactInternals;if(p===void 0)throw typeof d.render=="function"?Error(o(188)):(d=Object.keys(d).join(","),Error(o(268,d)));return d=B(p),d===null?null:d.stateNode}function Nk(d,p){if(d=d.memoizedState,d!==null&&d.dehydrated!==null){var E=d.retryLane;d.retryLane=E!==0&&E<p?E:p}}function NT(d,p){Nk(d,p),(d=d.alternate)&&Nk(d,p)}function kq(d){return d=B(d),d===null?null:d.stateNode}function Bq(){return null}return t.attemptContinuousHydration=function(d){if(d.tag===13){var p=hs();So(d,134217728,p),NT(d,134217728)}},t.attemptHydrationAtCurrentPriority=function(d){if(d.tag===13){var p=hs(),E=Ec(d);So(d,E,p),NT(d,E)}},t.attemptSynchronousHydration=function(d){switch(d.tag){case 3:var p=d.stateNode;if(p.current.memoizedState.isDehydrated){var E=Wo(p.pendingLanes);E!==0&&(_o(p,E|1),Ms(p,Hi()),!(vn&6)&&(Af(),Js()))}break;case 13:var b=hs();xk(function(){return So(d,1,b)}),NT(d,1)}},t.batchedUpdates=function(d,p){var E=vn;vn|=1;try{return d(p)}finally{vn=E,vn===0&&(Af(),ti&&Js())}},t.createComponentSelector=function(d){return{$$typeof:v_,value:d}},t.createContainer=function(d,p,E,b,P,U,Z){return Ik(d,p,!1,null,E,b,P,U,Z)},t.createHasPseudoClassSelector=function(d){return{$$typeof:__,value:d}},t.createHydrationContainer=function(d,p,E,b,P,U,Z,ce,Ne){return d=Ik(E,b,!0,d,P,U,Z,ce,Ne),d.context=Rk(null),E=d.current,b=hs(),P=Ec(E),U=Qs(b,P),U.callback=p??null,Xo(E,U),d.current.lanes=P,th(d,P,b),Ms(d,b),d},t.createPortal=function(d,p,E){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:b==null?null:""+b,children:d,containerInfo:p,implementation:E}},t.createRoleSelector=function(d){return{$$typeof:x_,value:d}},t.createTestNameSelector=function(d){return{$$typeof:w_,value:d}},t.createTextSelector=function(d){return{$$typeof:E_,value:d}},t.deferredUpdates=function(d){var p=bn,E=ki.transition;try{return ki.transition=null,bn=16,d()}finally{bn=p,ki.transition=E}},t.discreteUpdates=function(d,p,E,b,P){var U=bn,Z=ki.transition;try{return ki.transition=null,bn=1,d(p,E,b,P)}finally{bn=U,ki.transition=Z,vn===0&&Af()}},t.findAllNodes=vT,t.findBoundingRects=function(d,p){if(!lt)throw Error(o(363));p=vT(d,p),d=[];for(var E=0;E<p.length;E++)d.push(j(p[E]));for(p=d.length-1;0<p;p--){E=d[p];for(var b=E.x,P=b+E.width,U=E.y,Z=U+E.height,ce=p-1;0<=ce;ce--)if(p!==ce){var Ne=d[ce],st=Ne.x,Pt=st+Ne.width,on=Ne.y,Kt=on+Ne.height;if(b>=st&&U>=on&&P<=Pt&&Z<=Kt){d.splice(p,1);break}else if(b!==st||E.width!==Ne.width||Kt<U||on>Z){if(!(U!==on||E.height!==Ne.height||Pt<b||st>P)){st>b&&(Ne.width+=st-b,Ne.x=b),Pt<P&&(Ne.width=P-st),d.splice(p,1);break}}else{on>U&&(Ne.height+=on-U,Ne.y=U),Kt<Z&&(Ne.height=Z-on),d.splice(p,1);break}}}return d},t.findHostInstance=Pk,t.findHostInstanceWithNoPortals=function(d){return d=k(d),d=d!==null?X(d):null,d===null?null:d.stateNode},t.findHostInstanceWithWarning=function(d){return Pk(d)},t.flushControlled=function(d){var p=vn;vn|=1;var E=ki.transition,b=bn;try{ki.transition=null,bn=1,d()}finally{bn=b,ki.transition=E,vn=p,vn===0&&(Af(),Js())}},t.flushPassiveEffects=gh,t.flushSync=xk,t.focusWithin=function(d,p){if(!lt)throw Error(o(363));for(d=mT(d),p=yk(d,p),p=Array.from(p),d=0;d<p.length;){var E=p[d++];if(!Ie(E)){if(E.tag===5&&Ee(E.stateNode))return!0;for(E=E.child;E!==null;)p.push(E),E=E.sibling}}return!1},t.getCurrentUpdatePriority=function(){return bn},t.getFindAllNodesFailureDescription=function(d,p){if(!lt)throw Error(o(363));var E=0,b=[];d=[mT(d),0];for(var P=0;P<d.length;){var U=d[P++],Z=d[P++],ce=p[Z];if((U.tag!==5||!Ie(U))&&(gT(U,ce)&&(b.push(yT(ce)),Z++,Z>E&&(E=Z)),Z<p.length))for(U=U.child;U!==null;)d.push(U,Z),U=U.sibling}if(E<p.length){for(d=[];E<p.length;E++)d.push(yT(p[E]));return`findAllNodes was able to match part of the selector:
  `+(b.join(" > ")+`

No matching component was found for:
  `)+d.join(" > ")}return null},t.getPublicRootInstance=function(d){if(d=d.current,!d.child)return null;switch(d.child.tag){case 5:return ie(d.child.stateNode);default:return d.child.stateNode}},t.injectIntoDevTools=function(d){if(d={bundleType:d.bundleType,version:d.version,rendererPackageName:d.rendererPackageName,rendererConfig:d.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:kq,findFiberByHostInstance:d.findFiberByHostInstance||Bq,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")d=!1;else{var p=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(p.isDisabled||!p.supportsFiber)d=!0;else{try{ml=p.inject(d),qs=p}catch{}d=!!p.checkDCE}}return d},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(d,p,E,b){if(!lt)throw Error(o(363));d=vT(d,p);var P=tt(d,E,b).disconnect;return{disconnect:function(){P()}}},t.registerMutableSourceForHydration=function(d,p){var E=p._getVersion;E=E(p._source),d.mutableSourceEagerHydrationData==null?d.mutableSourceEagerHydrationData=[p,E]:d.mutableSourceEagerHydrationData.push(p,E)},t.runWithPriority=function(d,p){var E=bn;try{return bn=d,p()}finally{bn=E}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(d,p,E,b){var P=p.current,U=hs(),Z=Ec(P);return E=Rk(E),p.context===null?p.context=E:p.pendingContext=E,p=Qs(U,Z),p.payload={element:d},b=b===void 0?null:b,b!==null&&(p.callback=b),Xo(P,p),d=So(P,Z,U),d!==null&&yl(d,P,Z),Z},t};bX.exports=aSe;var lSe=bX.exports;const cSe=KR(lSe),eL={},IX=n=>void Object.assign(eL,n);function uSe(n,e){function t(u,{args:h=[],attach:f,...m},y){let _=`${u[0].toUpperCase()}${u.slice(1)}`,v;if(u==="primitive"){if(m.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const g=m.object;v=Yf(g,{type:u,root:y,attach:f,primitive:!0})}else{const g=eL[_];if(!g)throw new Error(`R3F: ${_} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(h))throw new Error("R3F: The args prop must be an array!");v=Yf(new g(...h),{type:u,root:y,attach:f,memoizedProps:{args:h}})}return v.__r3f.attach===void 0&&(v.isBufferGeometry?v.__r3f.attach="geometry":v.isMaterial&&(v.__r3f.attach="material")),_!=="inject"&&FC(v,m),v}function i(u,h){let f=!1;if(h){var m,y;(m=h.__r3f)!=null&&m.attach?OC(u,h,h.__r3f.attach):h.isObject3D&&u.isObject3D&&(u.add(h),f=!0),f||(y=u.__r3f)==null||y.objects.push(h),h.__r3f||Yf(h,{}),h.__r3f.parent=u,VR(h),$f(h)}}function r(u,h,f){let m=!1;if(h){var y,_;if((y=h.__r3f)!=null&&y.attach)OC(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){h.parent=u,h.dispatchEvent({type:"added"}),u.dispatchEvent({type:"childadded",child:h});const v=u.children.filter(w=>w!==h),g=v.indexOf(f);u.children=[...v.slice(0,g),h,...v.slice(g)],m=!0}m||(_=u.__r3f)==null||_.objects.push(h),h.__r3f||Yf(h,{}),h.__r3f.parent=u,VR(h),$f(h)}}function s(u,h,f=!1){u&&[...u].forEach(m=>o(h,m,f))}function o(u,h,f){if(h){var m,y,_;if(h.__r3f&&(h.__r3f.parent=null),(m=u.__r3f)!=null&&m.objects&&(u.__r3f.objects=u.__r3f.objects.filter(T=>T!==h)),(y=h.__r3f)!=null&&y.attach)R5(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){var v;u.remove(h),(v=h.__r3f)!=null&&v.root&&vSe(Xw(h),h)}const w=(_=h.__r3f)==null?void 0:_.primitive,A=!w&&(f===void 0?h.dispose!==null:f);if(!w){var g;s((g=h.__r3f)==null?void 0:g.objects,h,A),s(h.children,h,A)}if(delete h.__r3f,A&&h.dispose&&h.type!=="Scene"){const T=()=>{try{h.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?FR.unstable_scheduleCallback(FR.unstable_IdlePriority,T):T()}$f(u)}}function a(u,h,f,m){var y;const _=(y=u.__r3f)==null?void 0:y.parent;if(!_)return;const v=t(h,f,u.__r3f.root);if(u.children){for(const g of u.children)g.__r3f&&i(v,g);u.children=u.children.filter(g=>!g.__r3f)}u.__r3f.objects.forEach(g=>i(v,g)),u.__r3f.objects=[],u.__r3f.autoRemovedBeforeAppend||o(_,u),v.parent&&(v.__r3f.autoRemovedBeforeAppend=!0),i(_,v),v.raycast&&v.__r3f.eventCount&&Xw(v).getState().internal.interaction.push(v),[m,m.alternate].forEach(g=>{g!==null&&(g.stateNode=v,g.ref&&(typeof g.ref=="function"?g.ref(v):g.ref.current=v))})}const l=()=>{};return{reconciler:cSe({createInstance:t,removeChild:o,appendChild:i,appendInitialChild:i,insertBefore:r,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(u,h)=>{if(!h)return;const f=u.getState().scene;f.__r3f&&(f.__r3f.root=u,i(f,h))},removeChildFromContainer:(u,h)=>{h&&o(u.getState().scene,h)},insertInContainerBefore:(u,h,f)=>{if(!h||!f)return;const m=u.getState().scene;m.__r3f&&r(m,h,f)},getRootHostContext:()=>null,getChildHostContext:u=>u,finalizeInitialChildren(u){var h;return!!((h=u==null?void 0:u.__r3f)!=null?h:{}).handlers},prepareUpdate(u,h,f,m){var y;if(((y=u==null?void 0:u.__r3f)!=null?y:{}).primitive&&m.object&&m.object!==u)return[!0];{const{args:v=[],children:g,...w}=m,{args:A=[],children:T,...L}=f;if(!Array.isArray(v))throw new Error("R3F: the args prop must be an array!");if(v.some((R,I)=>R!==A[I]))return[!0];const D=BX(u,w,L,!0);return D.changes.length?[!1,D]:null}},commitUpdate(u,[h,f],m,y,_,v){h?a(u,m,_,v):FC(u,f)},commitMount(u,h,f,m){var y;const _=(y=u.__r3f)!=null?y:{};u.raycast&&_.handlers&&_.eventCount&&Xw(u).getState().internal.interaction.push(u)},getPublicInstance:u=>u,prepareForCommit:()=>null,preparePortalMount:u=>Yf(u.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(u){var h;const{attach:f,parent:m}=(h=u.__r3f)!=null?h:{};f&&m&&R5(m,u,f),u.isObject3D&&(u.visible=!1),$f(u)},unhideInstance(u,h){var f;const{attach:m,parent:y}=(f=u.__r3f)!=null?f:{};m&&y&&OC(y,u,m),(u.isObject3D&&h.visible==null||h.visible)&&(u.visible=!0),$f(u)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():xp.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&ii.fun(performance.now)?performance.now:ii.fun(Date.now)?Date.now:()=>0,scheduleTimeout:ii.fun(setTimeout)?setTimeout:void 0,cancelTimeout:ii.fun(clearTimeout)?clearTimeout:void 0}),applyProps:FC}}var b5,C5;const BC=n=>"colorSpace"in n||"outputColorSpace"in n,RX=()=>{var n;return(n=eL.ColorManagement)!=null?n:null},PX=n=>n&&n.isOrthographicCamera,hSe=n=>n&&n.hasOwnProperty("current"),Xv=typeof window<"u"&&((b5=window.document)!=null&&b5.createElement||((C5=window.navigator)==null?void 0:C5.product)==="ReactNative")?V.useLayoutEffect:V.useEffect;function NX(n){const e=V.useRef(n);return Xv(()=>void(e.current=n),[n]),e}function dSe({set:n}){return Xv(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}class DX extends V.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}DX.getDerivedStateFromError=()=>({error:!0});const LX="__default",M5=new Map,fSe=n=>n&&!!n.memoized&&!!n.changes;function kX(n){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(n)?Math.min(Math.max(n[0],t),n[1]):n}const qg=n=>{var e;return(e=n.__r3f)==null?void 0:e.root.getState()};function Xw(n){let e=n.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const ii={obj:n=>n===Object(n)&&!ii.arr(n)&&typeof n!="function",fun:n=>typeof n=="function",str:n=>typeof n=="string",num:n=>typeof n=="number",boo:n=>typeof n=="boolean",und:n=>n===void 0,arr:n=>Array.isArray(n),equ(n,e,{arrays:t="shallow",objects:i="reference",strict:r=!0}={}){if(typeof n!=typeof e||!!n!=!!e)return!1;if(ii.str(n)||ii.num(n)||ii.boo(n))return n===e;const s=ii.obj(n);if(s&&i==="reference")return n===e;const o=ii.arr(n);if(o&&t==="reference")return n===e;if((o||s)&&n===e)return!0;let a;for(a in n)if(!(a in e))return!1;if(s&&t==="shallow"&&i==="shallow"){for(a in r?e:n)if(!ii.equ(n[a],e[a],{strict:r,objects:"reference"}))return!1}else for(a in r?e:n)if(n[a]!==e[a])return!1;if(ii.und(a)){if(o&&n.length===0&&e.length===0||s&&Object.keys(n).length===0&&Object.keys(e).length===0)return!0;if(n!==e)return!1}return!0}};function pSe(n){const e={nodes:{},materials:{}};return n&&n.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material)}),e}function mSe(n){n.dispose&&n.type!=="Scene"&&n.dispose();for(const e in n)e.dispose==null||e.dispose(),delete n[e]}function Yf(n,e){const t=n;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},n}function UR(n,e){let t=n;if(e.includes("-")){const i=e.split("-"),r=i.pop();return t=i.reduce((s,o)=>s[o],n),{target:t,key:r}}else return{target:t,key:e}}const I5=/-\d+$/;function OC(n,e,t){if(ii.str(t)){if(I5.test(t)){const s=t.replace(I5,""),{target:o,key:a}=UR(n,s);Array.isArray(o[a])||(o[a]=[])}const{target:i,key:r}=UR(n,t);e.__r3f.previousAttach=i[r],i[r]=e}else e.__r3f.previousAttach=t(n,e)}function R5(n,e,t){var i,r;if(ii.str(t)){const{target:s,key:o}=UR(n,t),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(i=e.__r3f)==null||i.previousAttach==null||i.previousAttach(n,e);(r=e.__r3f)==null||delete r.previousAttach}function BX(n,{children:e,key:t,ref:i,...r},{children:s,key:o,ref:a,...l}={},c=!1){const u=n.__r3f,h=Object.entries(r),f=[];if(c){const y=Object.keys(l);for(let _=0;_<y.length;_++)r.hasOwnProperty(y[_])||h.unshift([y[_],LX+"remove"])}h.forEach(([y,_])=>{var v;if((v=n.__r3f)!=null&&v.primitive&&y==="object"||ii.equ(_,l[y]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(y))return f.push([y,_,!0,[]]);let g=[];y.includes("-")&&(g=y.split("-")),f.push([y,_,!1,g]);for(const w in r){const A=r[w];w.startsWith(`${y}-`)&&f.push([w,A,!1,w.split("-")])}});const m={...r};return u!=null&&u.memoizedProps&&u!=null&&u.memoizedProps.args&&(m.args=u.memoizedProps.args),u!=null&&u.memoizedProps&&u!=null&&u.memoizedProps.attach&&(m.attach=u.memoizedProps.attach),{memoized:m,changes:f}}const gSe=typeof process<"u"&&!1;function FC(n,e){var t;const i=n.__r3f,r=i==null?void 0:i.root,s=r==null||r.getState==null?void 0:r.getState(),{memoized:o,changes:a}=fSe(e)?e:BX(n,e),l=i==null?void 0:i.eventCount;n.__r3f&&(n.__r3f.memoizedProps=o);for(let f=0;f<a.length;f++){let[m,y,_,v]=a[f];if(BC(n)){const T="srgb",L="srgb-linear";m==="encoding"?(m="colorSpace",y=y===3001?T:L):m==="outputEncoding"&&(m="outputColorSpace",y=y===3001?T:L)}let g=n,w=g[m];if(v.length&&(w=v.reduce((A,T)=>A[T],n),!(w&&w.set))){const[A,...T]=v.reverse();g=T.reverse().reduce((L,D)=>L[D],n),m=A}if(y===LX+"remove")if(g.constructor){let A=M5.get(g.constructor);A||(A=new g.constructor,M5.set(g.constructor,A)),y=A[m]}else y=0;if(_&&i)y?i.handlers[m]=y:delete i.handlers[m],i.eventCount=Object.keys(i.handlers).length;else if(w&&w.set&&(w.copy||w instanceof xd)){if(Array.isArray(y))w.fromArray?w.fromArray(y):w.set(...y);else if(w.copy&&y&&y.constructor&&(gSe?w.constructor.name===y.constructor.name:w.constructor===y.constructor))w.copy(y);else if(y!==void 0){var c;const A=(c=w)==null?void 0:c.isColor;!A&&w.setScalar?w.setScalar(y):w instanceof xd&&y instanceof xd?w.mask=y.mask:w.set(y),!RX()&&s&&!s.linear&&A&&w.convertSRGBToLinear()}}else{var u;if(g[m]=y,(u=g[m])!=null&&u.isTexture&&g[m].format===Vi&&g[m].type===Ws&&s){const A=g[m];BC(A)&&BC(s.gl)?A.colorSpace=s.gl.outputColorSpace:A.encoding=s.gl.outputEncoding}}$f(n)}if(i&&i.parent&&n.raycast&&l!==i.eventCount){const f=Xw(n).getState().internal,m=f.interaction.indexOf(n);m>-1&&f.interaction.splice(m,1),i.eventCount&&f.interaction.push(n)}return!(a.length===1&&a[0][0]==="onUpdate")&&a.length&&(t=n.__r3f)!=null&&t.parent&&VR(n),n}function $f(n){var e,t;const i=(e=n.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();i&&i.internal.frames===0&&i.invalidate()}function VR(n){n.onUpdate==null||n.onUpdate(n)}function OX(n,e){n.manual||(PX(n)?(n.left=e.width/-2,n.right=e.width/2,n.top=e.height/2,n.bottom=e.height/-2):n.aspect=e.width/e.height,n.updateProjectionMatrix(),n.updateMatrixWorld())}function ow(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function ySe(){var n;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return xp.DefaultEventPriority;switch((n=e.event)==null?void 0:n.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return xp.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return xp.ContinuousEventPriority;default:return xp.DefaultEventPriority}}function FX(n,e,t,i){const r=t.get(e);r&&(t.delete(e),t.size===0&&(n.delete(i),r.target.releasePointerCapture(i)))}function vSe(n,e){const{internal:t}=n.getState();t.interaction=t.interaction.filter(i=>i!==e),t.initialHits=t.initialHits.filter(i=>i!==e),t.hovered.forEach((i,r)=>{(i.eventObject===e||i.object===e)&&t.hovered.delete(r)}),t.capturedMap.forEach((i,r)=>{FX(t.capturedMap,e,i,r)})}function _Se(n){function e(l){const{internal:c}=n.getState(),u=l.offsetX-c.initialClick[0],h=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(u*u+h*h))}function t(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(u=>{var h;return(h=c.__r3f)==null?void 0:h.handlers["onPointer"+u]}))}function i(l,c){const u=n.getState(),h=new Set,f=[],m=c?c(u.internal.interaction):u.internal.interaction;for(let g=0;g<m.length;g++){const w=qg(m[g]);w&&(w.raycaster.camera=void 0)}u.previousRoot||u.events.compute==null||u.events.compute(l,u);function y(g){const w=qg(g);if(!w||!w.events.enabled||w.raycaster.camera===null)return[];if(w.raycaster.camera===void 0){var A;w.events.compute==null||w.events.compute(l,w,(A=w.previousRoot)==null?void 0:A.getState()),w.raycaster.camera===void 0&&(w.raycaster.camera=null)}return w.raycaster.camera?w.raycaster.intersectObject(g,!0):[]}let _=m.flatMap(y).sort((g,w)=>{const A=qg(g.object),T=qg(w.object);return!A||!T?g.distance-w.distance:T.events.priority-A.events.priority||g.distance-w.distance}).filter(g=>{const w=ow(g);return h.has(w)?!1:(h.add(w),!0)});u.events.filter&&(_=u.events.filter(_,u));for(const g of _){let w=g.object;for(;w;){var v;(v=w.__r3f)!=null&&v.eventCount&&f.push({...g,eventObject:w}),w=w.parent}}if("pointerId"in l&&u.internal.capturedMap.has(l.pointerId))for(let g of u.internal.capturedMap.get(l.pointerId).values())h.has(ow(g.intersection))||f.push(g.intersection);return f}function r(l,c,u,h){const f=n.getState();if(l.length){const m={stopped:!1};for(const y of l){const _=qg(y.object)||f,{raycaster:v,pointer:g,camera:w,internal:A}=_,T=new q(g.x,g.y,0).unproject(w),L=C=>{var k,B;return(k=(B=A.capturedMap.get(C))==null?void 0:B.has(y.eventObject))!=null?k:!1},D=C=>{const k={intersection:y,target:c.target};A.capturedMap.has(C)?A.capturedMap.get(C).set(y.eventObject,k):A.capturedMap.set(C,new Map([[y.eventObject,k]])),c.target.setPointerCapture(C)},R=C=>{const k=A.capturedMap.get(C);k&&FX(A.capturedMap,y.eventObject,k,C)};let I={};for(let C in c){let k=c[C];typeof k!="function"&&(I[C]=k)}let M={...y,...I,pointer:g,intersections:l,stopped:m.stopped,delta:u,unprojectedPoint:T,ray:v.ray,camera:w,stopPropagation(){const C="pointerId"in c&&A.capturedMap.get(c.pointerId);if((!C||C.has(y.eventObject))&&(M.stopped=m.stopped=!0,A.hovered.size&&Array.from(A.hovered.values()).find(k=>k.eventObject===y.eventObject))){const k=l.slice(0,l.indexOf(y));s([...k,y])}},target:{hasPointerCapture:L,setPointerCapture:D,releasePointerCapture:R},currentTarget:{hasPointerCapture:L,setPointerCapture:D,releasePointerCapture:R},nativeEvent:c};if(h(M),m.stopped===!0)break}}return l}function s(l){const{internal:c}=n.getState();for(const u of c.hovered.values())if(!l.length||!l.find(h=>h.object===u.object&&h.index===u.index&&h.instanceId===u.instanceId)){const f=u.eventObject.__r3f,m=f==null?void 0:f.handlers;if(c.hovered.delete(ow(u)),f!=null&&f.eventCount){const y={...u,intersections:l};m.onPointerOut==null||m.onPointerOut(y),m.onPointerLeave==null||m.onPointerLeave(y)}}}function o(l,c){for(let u=0;u<c.length;u++){const h=c[u].__r3f;h==null||h.handlers.onPointerMissed==null||h.handlers.onPointerMissed(l)}}function a(l){switch(l){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return c=>{const{internal:u}=n.getState();"pointerId"in c&&u.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{u.capturedMap.has(c.pointerId)&&(u.capturedMap.delete(c.pointerId),s([]))})}}return function(u){const{onPointerMissed:h,internal:f}=n.getState();f.lastEvent.current=u;const m=l==="onPointerMove",y=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",v=i(u,m?t:void 0),g=y?e(u):0;l==="onPointerDown"&&(f.initialClick=[u.offsetX,u.offsetY],f.initialHits=v.map(A=>A.eventObject)),y&&!v.length&&g<=2&&(o(u,f.interaction),h&&h(u)),m&&s(v);function w(A){const T=A.eventObject,L=T.__r3f,D=L==null?void 0:L.handlers;if(L!=null&&L.eventCount)if(m){if(D.onPointerOver||D.onPointerEnter||D.onPointerOut||D.onPointerLeave){const R=ow(A),I=f.hovered.get(R);I?I.stopped&&A.stopPropagation():(f.hovered.set(R,A),D.onPointerOver==null||D.onPointerOver(A),D.onPointerEnter==null||D.onPointerEnter(A))}D.onPointerMove==null||D.onPointerMove(A)}else{const R=D[l];R?(!y||f.initialHits.includes(T))&&(o(u,f.interaction.filter(I=>!f.initialHits.includes(I))),R(A)):y&&f.initialHits.includes(T)&&o(u,f.interaction.filter(I=>!f.initialHits.includes(I)))}}r(v,u,g,w)}}return{handlePointer:a}}const xSe=["set","get","setSize","setFrameloop","setDpr","events","invalidate","advance","size","viewport"],UX=n=>!!(n!=null&&n.render),tL=V.createContext(null),wSe=(n,e)=>{const t=AX((a,l)=>{const c=new q,u=new q,h=new q;function f(g=l().camera,w=u,A=l().size){const{width:T,height:L,top:D,left:R}=A,I=T/L;w.isVector3?h.copy(w):h.set(...w);const M=g.getWorldPosition(c).distanceTo(h);if(PX(g))return{width:T/g.zoom,height:L/g.zoom,top:D,left:R,factor:1,distance:M,aspect:I};{const C=g.fov*Math.PI/180,k=2*Math.tan(C/2)*M,B=k*(T/L);return{width:B,height:k,top:D,left:R,factor:T/B,distance:M,aspect:I}}}let m;const y=g=>a(w=>({performance:{...w.performance,current:g}})),_=new Fe;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(g=1)=>n(l(),g),advance:(g,w)=>e(g,w,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new qD,pointer:_,mouse:_,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const g=l();m&&clearTimeout(m),g.performance.current!==g.performance.min&&y(g.performance.min),m=setTimeout(()=>y(l().performance.max),g.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:f},setEvents:g=>a(w=>({...w,events:{...w.events,...g}})),setSize:(g,w,A,T,L)=>{const D=l().camera,R={width:g,height:w,top:T||0,left:L||0,updateStyle:A};a(I=>({size:R,viewport:{...I.viewport,...f(D,u,R)}}))},setDpr:g=>a(w=>{const A=kX(g);return{viewport:{...w.viewport,dpr:A,initialDpr:w.viewport.initialDpr||A}}}),setFrameloop:(g="always")=>{const w=l().clock;w.stop(),w.elapsedTime=0,g!=="never"&&(w.start(),w.elapsedTime=0),a(()=>({frameloop:g}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:V.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(g,w,A)=>{const T=l().internal;return T.priority=T.priority+(w>0?1:0),T.subscribers.push({ref:g,priority:w,store:A}),T.subscribers=T.subscribers.sort((L,D)=>L.priority-D.priority),()=>{const L=l().internal;L!=null&&L.subscribers&&(L.priority=L.priority-(w>0?1:0),L.subscribers=L.subscribers.filter(D=>D.ref!==g))}}}}}),i=t.getState();let r=i.size,s=i.viewport.dpr,o=i.camera;return t.subscribe(()=>{const{camera:a,size:l,viewport:c,gl:u,set:h}=t.getState();if(l.width!==r.width||l.height!==r.height||c.dpr!==s){var f;r=l,s=c.dpr,OX(a,l),u.setPixelRatio(c.dpr);const m=(f=l.updateStyle)!=null?f:typeof HTMLCanvasElement<"u"&&u.domElement instanceof HTMLCanvasElement;u.setSize(l.width,l.height,m)}a!==o&&(o=a,h(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(a)}})))}),t.subscribe(a=>n(a)),t};let aw,ESe=new Set,ASe=new Set,SSe=new Set;function UC(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function Yg(n,e){switch(n){case"before":return UC(ESe,e);case"after":return UC(ASe,e);case"tail":return UC(SSe,e)}}let VC,zC;function HC(n,e,t){let i=e.clock.getDelta();for(e.frameloop==="never"&&typeof n=="number"&&(i=n-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=n),VC=e.internal.subscribers,aw=0;aw<VC.length;aw++)zC=VC[aw],zC.ref.current(zC.store.getState(),i,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}function TSe(n){let e=!1,t=!1,i,r,s;function o(c){r=requestAnimationFrame(o),e=!0,i=0,Yg("before",c),t=!0;for(const h of n.values()){var u;s=h.store.getState(),s.internal.active&&(s.frameloop==="always"||s.internal.frames>0)&&!((u=s.gl.xr)!=null&&u.isPresenting)&&(i+=HC(c,s))}if(t=!1,Yg("after",c),i===0)return Yg("tail",c),e=!1,cancelAnimationFrame(r)}function a(c,u=1){var h;if(!c)return n.forEach(f=>a(f.store.getState(),u));(h=c.gl.xr)!=null&&h.isPresenting||!c.internal.active||c.frameloop==="never"||(u>1?c.internal.frames=Math.min(60,c.internal.frames+u):t?c.internal.frames=2:c.internal.frames=1,e||(e=!0,requestAnimationFrame(o)))}function l(c,u=!0,h,f){if(u&&Yg("before",c),h)HC(c,h,f);else for(const m of n.values())HC(c,m.store.getState());u&&Yg("after",c)}return{loop:o,invalidate:a,advance:l}}function nL(){const n=V.useContext(tL);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function gs(n=t=>t,e){return nL()(n,e)}function iL(n,e=0){const t=nL(),i=t.getState().internal.subscribe,r=NX(n);return Xv(()=>i(r,e,t),[e,i,t]),null}const P5=new WeakMap;function VX(n,e){return function(t,...i){let r=P5.get(t);return r||(r=new t,P5.set(t,r)),n&&n(r),Promise.all(i.map(s=>new Promise((o,a)=>r.load(s,l=>{l.scene&&Object.assign(l,pSe(l.scene)),o(l)},e,l=>a(new Error(`Could not load ${s}: ${l==null?void 0:l.message}`))))))}}function hc(n,e,t,i){const r=Array.isArray(e)?e:[e],s=rSe(VX(t,i),[n,...r],{equal:ii.equ});return Array.isArray(e)?s:s[0]}hc.preload=function(n,e,t){const i=Array.isArray(e)?e:[e];return sSe(VX(t),[n,...i])};hc.clear=function(n,e){const t=Array.isArray(e)?e:[e];return oSe([n,...t])};const Tm=new Map,{invalidate:N5,advance:D5}=TSe(Tm),{reconciler:X0,applyProps:jc}=uSe(Tm,ySe),jf={objects:"shallow",strict:!1},bSe=(n,e)=>{const t=typeof n=="function"?n(e):n;return UX(t)?t:new CD({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...n})};function CSe(n,e){const t=typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement;if(e){const{width:i,height:r,top:s,left:o,updateStyle:a=t}=e;return{width:i,height:r,top:s,left:o,updateStyle:a}}else if(typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement&&n.parentElement){const{width:i,height:r,top:s,left:o}=n.parentElement.getBoundingClientRect();return{width:i,height:r,top:s,left:o,updateStyle:t}}else if(typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas)return{width:n.width,height:n.height,top:0,left:0,updateStyle:t};return{width:0,height:0,top:0,left:0}}function MSe(n){const e=Tm.get(n),t=e==null?void 0:e.fiber,i=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,s=i||wSe(N5,D5),o=t||X0.createContainer(s,xp.ConcurrentRoot,null,!1,null,"",r,null);e||Tm.set(n,{fiber:o,store:s});let a,l=!1,c;return{configure(u={}){let{gl:h,size:f,scene:m,events:y,onCreated:_,shadows:v=!1,linear:g=!1,flat:w=!1,legacy:A=!1,orthographic:T=!1,frameloop:L="always",dpr:D=[1,2],performance:R,raycaster:I,camera:M,onPointerMissed:C}=u,k=s.getState(),B=k.gl;k.gl||k.set({gl:B=bSe(h,n)});let O=k.raycaster;O||k.set({raycaster:O=new QD});const{params:X,...le}=I||{};if(ii.equ(le,O,jf)||jc(O,{...le}),ii.equ(X,O.params,jf)||jc(O,{params:{...O.params,...X}}),!k.camera||k.camera===c&&!ii.equ(c,M,jf)){c=M;const te=M instanceof Bv,ue=te?M:T?new tl(0,0,0,0,.1,1e3):new Ni(75,0,.1,1e3);te||(ue.position.z=5,M&&(jc(ue,M),("aspect"in M||"left"in M||"right"in M||"bottom"in M||"top"in M)&&(ue.manual=!0,ue.updateProjectionMatrix())),!k.camera&&!(M!=null&&M.rotation)&&ue.lookAt(0,0,0)),k.set({camera:ue}),O.camera=ue}if(!k.scene){let te;m!=null&&m.isScene?te=m:(te=new Uv,m&&jc(te,m)),k.set({scene:Yf(te)})}if(!k.xr){var ie;const te=(be,he)=>{const Pe=s.getState();Pe.frameloop!=="never"&&D5(be,!0,Pe,he)},ue=()=>{const be=s.getState();be.gl.xr.enabled=be.gl.xr.isPresenting,be.gl.xr.setAnimationLoop(be.gl.xr.isPresenting?te:null),be.gl.xr.isPresenting||N5(be)},ve={connect(){const be=s.getState().gl;be.xr.addEventListener("sessionstart",ue),be.xr.addEventListener("sessionend",ue)},disconnect(){const be=s.getState().gl;be.xr.removeEventListener("sessionstart",ue),be.xr.removeEventListener("sessionend",ue)}};typeof((ie=B.xr)==null?void 0:ie.addEventListener)=="function"&&ve.connect(),k.set({xr:ve})}if(B.shadowMap){const te=B.shadowMap.enabled,ue=B.shadowMap.type;if(B.shadowMap.enabled=!!v,ii.boo(v))B.shadowMap.type=Uy;else if(ii.str(v)){var de;const ve={basic:R7,percentage:lS,soft:Uy,variance:ra};B.shadowMap.type=(de=ve[v])!=null?de:Uy}else ii.obj(v)&&Object.assign(B.shadowMap,v);(te!==B.shadowMap.enabled||ue!==B.shadowMap.type)&&(B.shadowMap.needsUpdate=!0)}const G=RX();G&&("enabled"in G?G.enabled=!A:"legacyMode"in G&&(G.legacyMode=A)),l||jc(B,{outputEncoding:g?3e3:3001,toneMapping:w?el:lD}),k.legacy!==A&&k.set(()=>({legacy:A})),k.linear!==g&&k.set(()=>({linear:g})),k.flat!==w&&k.set(()=>({flat:w})),h&&!ii.fun(h)&&!UX(h)&&!ii.equ(h,B,jf)&&jc(B,h),y&&!k.events.handlers&&k.set({events:y(s)});const $=CSe(n,f);return ii.equ($,k.size,jf)||k.setSize($.width,$.height,$.updateStyle,$.top,$.left),D&&k.viewport.dpr!==kX(D)&&k.setDpr(D),k.frameloop!==L&&k.setFrameloop(L),k.onPointerMissed||k.set({onPointerMissed:C}),R&&!ii.equ(R,k.performance,jf)&&k.set(te=>({performance:{...te.performance,...R}})),a=_,l=!0,this},render(u){return l||this.configure(),X0.updateContainer(S.jsx(ISe,{store:s,children:u,onCreated:a,rootElement:n}),o,null,()=>{}),s},unmount(){zX(n)}}}function ISe({store:n,children:e,onCreated:t,rootElement:i}){return Xv(()=>{const r=n.getState();r.set(s=>({internal:{...s.internal,active:!0}})),t&&t(r),n.getState().events.connected||r.events.connect==null||r.events.connect(i)},[]),S.jsx(tL.Provider,{value:n,children:e})}function zX(n,e){const t=Tm.get(n),i=t==null?void 0:t.fiber;if(i){const r=t==null?void 0:t.store.getState();r&&(r.internal.active=!1),X0.updateContainer(null,i,null,()=>{r&&setTimeout(()=>{try{var s,o,a,l;r.events.disconnect==null||r.events.disconnect(),(s=r.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=r.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=r.gl)!=null&&l.xr&&r.xr.disconnect(),mSe(r),Tm.delete(n)}catch{}},500)})}}function RSe(n,e,t){return S.jsx(PSe,{children:n,container:e,state:t},e.uuid)}function PSe({state:n={},children:e,container:t}){const{events:i,size:r,...s}=n,o=nL(),[a]=V.useState(()=>new QD),[l]=V.useState(()=>new Fe),c=V.useCallback((h,f)=>{const m={...h};Object.keys(h).forEach(_=>{(xSe.includes(_)||h[_]!==f[_]&&f[_])&&delete m[_]});let y;if(f&&r){const _=f.camera;y=h.viewport.getCurrentViewport(_,new q,r),_!==h.camera&&OX(_,r)}return{...m,scene:t,raycaster:a,pointer:l,mouse:l,previousRoot:o,events:{...h.events,...f==null?void 0:f.events,...i},size:{...h.size,...r},viewport:{...h.viewport,...y},...s}},[n]),[u]=V.useState(()=>{const h=o.getState();return AX((m,y)=>({...h,scene:t,raycaster:a,pointer:l,mouse:l,previousRoot:o,events:{...h.events,...i},size:{...h.size,...r},...s,set:m,get:y,setEvents:_=>m(v=>({...v,events:{...v.events,..._}}))}))});return V.useEffect(()=>{const h=o.subscribe(f=>u.setState(m=>c(f,m)));return()=>{h()}},[c]),V.useEffect(()=>{u.setState(h=>c(o.getState(),h))},[c]),V.useEffect(()=>()=>{u.destroy()},[]),S.jsx(S.Fragment,{children:X0.createPortal(S.jsx(tL.Provider,{value:u,children:e}),u,null)})}X0.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:V.version});const GC={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function NSe(n){const{handlePointer:e}=_Se(n);return{priority:1,enabled:!0,compute(t,i,r){i.pointer.set(t.offsetX/i.size.width*2-1,-(t.offsetY/i.size.height)*2+1),i.raycaster.setFromCamera(i.pointer,i.camera)},connected:void 0,handlers:Object.keys(GC).reduce((t,i)=>({...t,[i]:e(i)}),{}),update:()=>{var t;const{events:i,internal:r}=n.getState();(t=r.lastEvent)!=null&&t.current&&i.handlers&&i.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{var i;const{set:r,events:s}=n.getState();s.disconnect==null||s.disconnect(),r(o=>({events:{...o.events,connected:t}})),Object.entries((i=s.handlers)!=null?i:[]).forEach(([o,a])=>{const[l,c]=GC[o];t.addEventListener(l,a,{passive:c})})},disconnect:()=>{const{set:t,events:i}=n.getState();if(i.connected){var r;Object.entries((r=i.handlers)!=null?r:[]).forEach(([s,o])=>{if(i&&i.connected instanceof HTMLElement){const[a]=GC[s];i.connected.removeEventListener(a,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}function L5(n,e){let t;return(...i)=>{window.clearTimeout(t),t=window.setTimeout(()=>n(...i),e)}}function DSe({debounce:n,scroll:e,polyfill:t,offsetSize:i}={debounce:0,scroll:!1,offsetSize:!1}){const r=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!r)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,o]=V.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),a=V.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),l=n?typeof n=="number"?n:n.scroll:null,c=n?typeof n=="number"?n:n.resize:null,u=V.useRef(!1);V.useEffect(()=>(u.current=!0,()=>void(u.current=!1)));const[h,f,m]=V.useMemo(()=>{const g=()=>{if(!a.current.element)return;const{left:w,top:A,width:T,height:L,bottom:D,right:R,x:I,y:M}=a.current.element.getBoundingClientRect(),C={left:w,top:A,width:T,height:L,bottom:D,right:R,x:I,y:M};a.current.element instanceof HTMLElement&&i&&(C.height=a.current.element.offsetHeight,C.width=a.current.element.offsetWidth),Object.freeze(C),u.current&&!OSe(a.current.lastBounds,C)&&o(a.current.lastBounds=C)};return[g,c?L5(g,c):g,l?L5(g,l):g]},[o,i,l,c]);function y(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(g=>g.removeEventListener("scroll",m,!0)),a.current.scrollContainers=null),a.current.resizeObserver&&(a.current.resizeObserver.disconnect(),a.current.resizeObserver=null),a.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",a.current.orientationHandler))}function _(){a.current.element&&(a.current.resizeObserver=new r(m),a.current.resizeObserver.observe(a.current.element),e&&a.current.scrollContainers&&a.current.scrollContainers.forEach(g=>g.addEventListener("scroll",m,{capture:!0,passive:!0})),a.current.orientationHandler=()=>{m()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",a.current.orientationHandler))}const v=g=>{!g||g===a.current.element||(y(),a.current.element=g,a.current.scrollContainers=HX(g),_())};return kSe(m,!!e),LSe(f),V.useEffect(()=>{y(),_()},[e,m,f]),V.useEffect(()=>y,[]),[v,s,h]}function LSe(n){V.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function kSe(n,e){V.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function HX(n){const e=[];if(!n||n===document.body)return e;const{overflow:t,overflowX:i,overflowY:r}=window.getComputedStyle(n);return[t,i,r].some(s=>s==="auto"||s==="scroll")&&e.push(n),[...e,...HX(n.parentElement)]}const BSe=["x","y","top","bottom","left","right","width","height"],OSe=(n,e)=>BSe.every(t=>n[t]===e[t]);var FSe=Object.defineProperty,USe=Object.defineProperties,VSe=Object.getOwnPropertyDescriptors,k5=Object.getOwnPropertySymbols,zSe=Object.prototype.hasOwnProperty,HSe=Object.prototype.propertyIsEnumerable,B5=(n,e,t)=>e in n?FSe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,O5=(n,e)=>{for(var t in e||(e={}))zSe.call(e,t)&&B5(n,t,e[t]);if(k5)for(var t of k5(e))HSe.call(e,t)&&B5(n,t,e[t]);return n},GSe=(n,e)=>USe(n,VSe(e)),F5,U5;typeof window<"u"&&((F5=window.document)!=null&&F5.createElement||((U5=window.navigator)==null?void 0:U5.product)==="ReactNative")?V.useLayoutEffect:V.useEffect;function GX(n,e,t){if(!n)return;if(t(n)===!0)return n;let i=n.child;for(;i;){const r=GX(i,e,t);if(r)return r;i=i.sibling}}function jX(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const V5=console.error;console.error=function(){const n=[...arguments].join("");if(n!=null&&n.startsWith("Warning:")&&n.includes("useContext")){console.error=V5;return}return V5.apply(this,arguments)};const rL=jX(V.createContext(null));class WX extends V.Component{render(){return V.createElement(rL.Provider,{value:this._reactInternals},this.props.children)}}function jSe(){const n=V.useContext(rL);if(n===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=V.useId();return V.useMemo(()=>{for(const i of[n,n==null?void 0:n.alternate]){if(!i)continue;const r=GX(i,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(r)return r}},[n,e])}function WSe(){const n=jSe(),[e]=V.useState(()=>new Map);e.clear();let t=n;for(;t;){if(t.type&&typeof t.type=="object"){const r=t.type._context===void 0&&t.type.Provider===t.type?t.type:t.type._context;r&&r!==rL&&!e.has(r)&&e.set(r,V.useContext(jX(r)))}t=t.return}return e}function KSe(){const n=WSe();return V.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>i=>V.createElement(e,null,V.createElement(t.Provider,GSe(O5({},i),{value:n.get(t)}))),e=>V.createElement(WX,O5({},e))),[n])}const XSe=V.forwardRef(function({children:e,fallback:t,resize:i,style:r,gl:s,events:o=NSe,eventSource:a,eventPrefix:l,shadows:c,linear:u,flat:h,legacy:f,orthographic:m,frameloop:y,dpr:_,performance:v,raycaster:g,camera:w,scene:A,onPointerMissed:T,onCreated:L,...D},R){V.useMemo(()=>IX(eSe),[]);const I=KSe(),[M,C]=DSe({scroll:!0,debounce:{scroll:50,resize:0},...i}),k=V.useRef(null),B=V.useRef(null);V.useImperativeHandle(R,()=>k.current);const O=NX(T),[X,le]=V.useState(!1),[ie,de]=V.useState(!1);if(X)throw X;if(ie)throw ie;const G=V.useRef(null);Xv(()=>{const te=k.current;C.width>0&&C.height>0&&te&&(G.current||(G.current=MSe(te)),G.current.configure({gl:s,events:o,shadows:c,linear:u,flat:h,legacy:f,orthographic:m,frameloop:y,dpr:_,performance:v,raycaster:g,camera:w,scene:A,size:C,onPointerMissed:(...ue)=>O.current==null?void 0:O.current(...ue),onCreated:ue=>{ue.events.connect==null||ue.events.connect(a?hSe(a)?a.current:a:B.current),l&&ue.setEvents({compute:(ve,be)=>{const he=ve[l+"X"],Pe=ve[l+"Y"];be.pointer.set(he/be.size.width*2-1,-(Pe/be.size.height)*2+1),be.raycaster.setFromCamera(be.pointer,be.camera)}}),L==null||L(ue)}}),G.current.render(S.jsx(I,{children:S.jsx(DX,{set:de,children:S.jsx(V.Suspense,{fallback:S.jsx(dSe,{set:le}),children:e??null})})})))}),V.useEffect(()=>{const te=k.current;if(te)return()=>zX(te)},[]);const $=a?"none":"auto";return S.jsx("div",{ref:B,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:$,...r},...D,children:S.jsx("div",{ref:M,style:{width:"100%",height:"100%"},children:S.jsx("canvas",{ref:k,style:{display:"block"},children:t})})})}),qSe=V.forwardRef(function(e,t){return S.jsx(WX,{children:S.jsx(XSe,{...e,ref:t})})});function q0(){return q0=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},q0.apply(null,arguments)}const sL=parseInt(Rv.replace(/\D+/g,""));function z5(n,e){if(e===aK)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),n;if(e===HE||e===yD){let t=n.getIndex();if(t===null){const o=[],a=n.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);n.setIndex(o),t=n.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),n}const i=t.count-2,r=[];if(t)if(e===HE)for(let o=1;o<=i;o++)r.push(t.getX(0)),r.push(t.getX(o)),r.push(t.getX(o+1));else for(let o=0;o<i;o++)o%2===0?(r.push(t.getX(o)),r.push(t.getX(o+1)),r.push(t.getX(o+2))):(r.push(t.getX(o+2)),r.push(t.getX(o+1)),r.push(t.getX(o)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=n.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),n}var Do=Uint8Array,cu=Uint16Array,zR=Uint32Array,KX=new Do([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),XX=new Do([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),YSe=new Do([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qX=function(n,e){for(var t=new cu(31),i=0;i<31;++i)t[i]=e+=1<<n[i-1];for(var r=new zR(t[30]),i=1;i<30;++i)for(var s=t[i];s<t[i+1];++s)r[s]=s-t[i]<<5|i;return[t,r]},YX=qX(KX,2),$X=YX[0],$Se=YX[1];$X[28]=258,$Se[258]=28;var JSe=qX(XX,0),QSe=JSe[0],HR=new cu(32768);for(var hi=0;hi<32768;++hi){var Oc=(hi&43690)>>>1|(hi&21845)<<1;Oc=(Oc&52428)>>>2|(Oc&13107)<<2,Oc=(Oc&61680)>>>4|(Oc&3855)<<4,HR[hi]=((Oc&65280)>>>8|(Oc&255)<<8)>>>1}var qy=function(n,e,t){for(var i=n.length,r=0,s=new cu(e);r<i;++r)++s[n[r]-1];var o=new cu(e);for(r=0;r<e;++r)o[r]=o[r-1]+s[r-1]<<1;var a;if(t){a=new cu(1<<e);var l=15-e;for(r=0;r<i;++r)if(n[r])for(var c=r<<4|n[r],u=e-n[r],h=o[n[r]-1]++<<u,f=h|(1<<u)-1;h<=f;++h)a[HR[h]>>>l]=c}else for(a=new cu(i),r=0;r<i;++r)n[r]&&(a[r]=HR[o[n[r]-1]++]>>>15-n[r]);return a},qv=new Do(288);for(var hi=0;hi<144;++hi)qv[hi]=8;for(var hi=144;hi<256;++hi)qv[hi]=9;for(var hi=256;hi<280;++hi)qv[hi]=7;for(var hi=280;hi<288;++hi)qv[hi]=8;var JX=new Do(32);for(var hi=0;hi<32;++hi)JX[hi]=5;var ZSe=qy(qv,9,1),eTe=qy(JX,5,1),jC=function(n){for(var e=n[0],t=1;t<n.length;++t)n[t]>e&&(e=n[t]);return e},ea=function(n,e,t){var i=e/8|0;return(n[i]|n[i+1]<<8)>>(e&7)&t},WC=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},tTe=function(n){return(n/8|0)+(n&7&&1)},nTe=function(n,e,t){(t==null||t>n.length)&&(t=n.length);var i=new(n instanceof cu?cu:n instanceof zR?zR:Do)(t-e);return i.set(n.subarray(e,t)),i},iTe=function(n,e,t){var i=n.length;if(!i||t&&!t.l&&i<5)return e||new Do(0);var r=!e||t,s=!t||t.i;t||(t={}),e||(e=new Do(i*3));var o=function(Oe){var Ce=e.length;if(Oe>Ce){var mt=new Do(Math.max(Ce*2,Oe));mt.set(e),e=mt}},a=t.f||0,l=t.p||0,c=t.b||0,u=t.l,h=t.d,f=t.m,m=t.n,y=i*8;do{if(!u){t.f=a=ea(n,l,1);var _=ea(n,l+1,3);if(l+=3,_)if(_==1)u=ZSe,h=eTe,f=9,m=5;else if(_==2){var A=ea(n,l,31)+257,T=ea(n,l+10,15)+4,L=A+ea(n,l+5,31)+1;l+=14;for(var D=new Do(L),R=new Do(19),I=0;I<T;++I)R[YSe[I]]=ea(n,l+I*3,7);l+=T*3;for(var M=jC(R),C=(1<<M)-1,k=qy(R,M,1),I=0;I<L;){var B=k[ea(n,l,C)];l+=B&15;var v=B>>>4;if(v<16)D[I++]=v;else{var O=0,X=0;for(v==16?(X=3+ea(n,l,3),l+=2,O=D[I-1]):v==17?(X=3+ea(n,l,7),l+=3):v==18&&(X=11+ea(n,l,127),l+=7);X--;)D[I++]=O}}var le=D.subarray(0,A),ie=D.subarray(A);f=jC(le),m=jC(ie),u=qy(le,f,1),h=qy(ie,m,1)}else throw"invalid block type";else{var v=tTe(l)+4,g=n[v-4]|n[v-3]<<8,w=v+g;if(w>i){if(s)throw"unexpected EOF";break}r&&o(c+g),e.set(n.subarray(v,w),c),t.b=c+=g,t.p=l=w*8;continue}if(l>y){if(s)throw"unexpected EOF";break}}r&&o(c+131072);for(var de=(1<<f)-1,G=(1<<m)-1,$=l;;$=l){var O=u[WC(n,l)&de],te=O>>>4;if(l+=O&15,l>y){if(s)throw"unexpected EOF";break}if(!O)throw"invalid length/literal";if(te<256)e[c++]=te;else if(te==256){$=l,u=null;break}else{var ue=te-254;if(te>264){var I=te-257,ve=KX[I];ue=ea(n,l,(1<<ve)-1)+$X[I],l+=ve}var be=h[WC(n,l)&G],he=be>>>4;if(!be)throw"invalid distance";l+=be&15;var ie=QSe[he];if(he>3){var ve=XX[he];ie+=WC(n,l)&(1<<ve)-1,l+=ve}if(l>y){if(s)throw"unexpected EOF";break}r&&o(c+131072);for(var Pe=c+ue;c<Pe;c+=4)e[c]=e[c-ie],e[c+1]=e[c+1-ie],e[c+2]=e[c+2-ie],e[c+3]=e[c+3-ie];c=Pe}}t.l=u,t.p=$,t.b=c,u&&(a=1,t.m=f,t.d=h,t.n=m)}while(!a);return c==e.length?e:nTe(e,0,c)},rTe=new Do(0),sTe=function(n){if((n[0]&15)!=8||n[0]>>>4>7||(n[0]<<8|n[1])%31)throw"invalid zlib data";if(n[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function lw(n,e){return iTe((sTe(n),n.subarray(2,-4)),e)}var oTe=typeof TextDecoder<"u"&&new TextDecoder,aTe=0;try{oTe.decode(rTe,{stream:!0}),aTe=1}catch{}const lTe=n=>n&&n.isCubeTexture;class cTe extends fi{constructor(e,t){var i,r;const s=lTe(e),a=((r=s?(i=e.image[0])==null?void 0:i.width:e.image.width)!=null?r:1024)/4,l=Math.floor(Math.log2(a)),c=Math.pow(2,l),u=3*Math.max(c,16*7),h=4*c,f=[s?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/u}`,`#define CUBEUV_TEXEL_HEIGHT ${1/h}`,`#define CUBEUV_MAX_MIP ${l}.0`],m=`
        varying vec3 vWorldPosition;
        void main() 
        {
            vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) );
            vWorldPosition = worldPosition.xyz;
            
            gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
        }
        `,y=f.join(`
`)+`
        #define ENVMAP_TYPE_CUBE_UV
        varying vec3 vWorldPosition;
        uniform float radius;
        uniform float height;
        uniform float angle;
        #ifdef ENVMAP_TYPE_CUBE
            uniform samplerCube map;
        #else
            uniform sampler2D map;
        #endif
        // From: https://www.shadertoy.com/view/4tsBD7
        float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) 
        {
            float d = dot ( rd, n );
            
            if( d > 0.0 ) { return 1e6; }
            
            vec3  o = ro - c;
            float t = - dot( n, o ) / d;
            vec3  q = o + rd * t;
            
            return ( dot( q, q ) < r * r ) ? t : 1e6;
        }
        // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm
        float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) 
        {
            vec3 oc = ro - ce;
            float b = dot( oc, rd );
            float c = dot( oc, oc ) - ra * ra;
            float h = b * b - c;
            
            if( h < 0.0 ) { return -1.0; }
            
            h = sqrt( h );
            
            return - b + h;
        }
        vec3 project() 
        {
            vec3 p = normalize( vWorldPosition );
            vec3 camPos = cameraPosition;
            camPos.y -= height;
            float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius );
            if( intersection > 0.0 ) {
                
                vec3 h = vec3( 0.0, - height, 0.0 );
                float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius );
                p = ( camPos + min( intersection, intersection2 ) * p ) / radius;
            } else {
                p = vec3( 0.0, 1.0, 0.0 );
            }
            return p;
        }
        #include <common>
        #include <cube_uv_reflection_fragment>
        void main() 
        {
            vec3 projectedWorldPosition = project();
            
            #ifdef ENVMAP_TYPE_CUBE
                vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb;
            #else
                vec3 direction = normalize( projectedWorldPosition );
                vec2 uv = equirectUv( direction );
                vec3 outcolor = texture2D( map, uv ).rgb;
            #endif
            gl_FragColor = vec4( outcolor, 1.0 );
            #include <tonemapping_fragment>
            #include <${sL>=154?"colorspace_fragment":"encodings_fragment"}>
        }
        `,_={map:{value:e},height:{value:(t==null?void 0:t.height)||15},radius:{value:(t==null?void 0:t.radius)||100}},v=new Gv(1,16),g=new ss({uniforms:_,fragmentShader:y,vertexShader:m,side:No});super(v,g)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}var uTe=Object.defineProperty,hTe=(n,e,t)=>e in n?uTe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,dTe=(n,e,t)=>(hTe(n,e+"",t),t);class fTe{constructor(){dTe(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}}var pTe=Object.defineProperty,mTe=(n,e,t)=>e in n?pTe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Xt=(n,e,t)=>(mTe(n,typeof e!="symbol"?e+"":e,t),t);const cw=new ef,H5=new Ll,gTe=Math.cos(70*(Math.PI/180)),G5=(n,e)=>(n%e+e)%e;let yTe=class extends fTe{constructor(e,t){super(),Xt(this,"object"),Xt(this,"domElement"),Xt(this,"enabled",!0),Xt(this,"target",new q),Xt(this,"minDistance",0),Xt(this,"maxDistance",1/0),Xt(this,"minZoom",0),Xt(this,"maxZoom",1/0),Xt(this,"minPolarAngle",0),Xt(this,"maxPolarAngle",Math.PI),Xt(this,"minAzimuthAngle",-1/0),Xt(this,"maxAzimuthAngle",1/0),Xt(this,"enableDamping",!1),Xt(this,"dampingFactor",.05),Xt(this,"enableZoom",!0),Xt(this,"zoomSpeed",1),Xt(this,"enableRotate",!0),Xt(this,"rotateSpeed",1),Xt(this,"enablePan",!0),Xt(this,"panSpeed",1),Xt(this,"screenSpacePanning",!0),Xt(this,"keyPanSpeed",7),Xt(this,"zoomToCursor",!1),Xt(this,"autoRotate",!1),Xt(this,"autoRotateSpeed",2),Xt(this,"reverseOrbit",!1),Xt(this,"reverseHorizontalOrbit",!1),Xt(this,"reverseVerticalOrbit",!1),Xt(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Xt(this,"mouseButtons",{LEFT:Uh.ROTATE,MIDDLE:Uh.DOLLY,RIGHT:Uh.PAN}),Xt(this,"touches",{ONE:Vh.ROTATE,TWO:Vh.DOLLY_PAN}),Xt(this,"target0"),Xt(this,"position0"),Xt(this,"zoom0"),Xt(this,"_domElementKeyEvents",null),Xt(this,"getPolarAngle"),Xt(this,"getAzimuthalAngle"),Xt(this,"setPolarAngle"),Xt(this,"setAzimuthalAngle"),Xt(this,"getDistance"),Xt(this,"getZoomScale"),Xt(this,"listenToKeyEvents"),Xt(this,"stopListenToKeyEvents"),Xt(this,"saveState"),Xt(this,"reset"),Xt(this,"update"),Xt(this,"connect"),Xt(this,"dispose"),Xt(this,"dollyIn"),Xt(this,"dollyOut"),Xt(this,"getScale"),Xt(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>u.phi,this.getAzimuthalAngle=()=>u.theta,this.setPolarAngle=oe=>{let Te=G5(oe,2*Math.PI),Ye=u.phi;Ye<0&&(Ye+=2*Math.PI),Te<0&&(Te+=2*Math.PI);let se=Math.abs(Te-Ye);2*Math.PI-se<se&&(Te<Ye?Te+=2*Math.PI:Ye+=2*Math.PI),h.phi=Te-Ye,i.update()},this.setAzimuthalAngle=oe=>{let Te=G5(oe,2*Math.PI),Ye=u.theta;Ye<0&&(Ye+=2*Math.PI),Te<0&&(Te+=2*Math.PI);let se=Math.abs(Te-Ye);2*Math.PI-se<se&&(Te<Ye?Te+=2*Math.PI:Ye+=2*Math.PI),h.theta=Te-Ye,i.update()},this.getDistance=()=>i.object.position.distanceTo(i.target),this.listenToKeyEvents=oe=>{oe.addEventListener("keydown",nt),this._domElementKeyEvents=oe},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",nt),this._domElementKeyEvents=null},this.saveState=()=>{i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=()=>{i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(r),i.update(),l=a.NONE},this.update=(()=>{const oe=new q,Te=new q(0,1,0),Ye=new xr().setFromUnitVectors(e.up,Te),se=Ye.clone().invert(),ye=new q,we=new xr,De=2*Math.PI;return function(){const it=i.object.position;Ye.setFromUnitVectors(e.up,Te),se.copy(Ye).invert(),oe.copy(it).sub(i.target),oe.applyQuaternion(Ye),u.setFromVector3(oe),i.autoRotate&&l===a.NONE&&X(B()),i.enableDamping?(u.theta+=h.theta*i.dampingFactor,u.phi+=h.phi*i.dampingFactor):(u.theta+=h.theta,u.phi+=h.phi);let Ke=i.minAzimuthAngle,Et=i.maxAzimuthAngle;isFinite(Ke)&&isFinite(Et)&&(Ke<-Math.PI?Ke+=De:Ke>Math.PI&&(Ke-=De),Et<-Math.PI?Et+=De:Et>Math.PI&&(Et-=De),Ke<=Et?u.theta=Math.max(Ke,Math.min(Et,u.theta)):u.theta=u.theta>(Ke+Et)/2?Math.max(Ke,u.theta):Math.min(Et,u.theta)),u.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,u.phi)),u.makeSafe(),i.enableDamping===!0?i.target.addScaledVector(m,i.dampingFactor):i.target.add(m),i.zoomToCursor&&M||i.object.isOrthographicCamera?u.radius=be(u.radius):u.radius=be(u.radius*f),oe.setFromSpherical(u),oe.applyQuaternion(se),it.copy(i.target).add(oe),i.object.matrixAutoUpdate||i.object.updateMatrix(),i.object.lookAt(i.target),i.enableDamping===!0?(h.theta*=1-i.dampingFactor,h.phi*=1-i.dampingFactor,m.multiplyScalar(1-i.dampingFactor)):(h.set(0,0,0),m.set(0,0,0));let Gt=!1;if(i.zoomToCursor&&M){let Vt=null;if(i.object instanceof Ni&&i.object.isPerspectiveCamera){const _n=oe.length();Vt=be(_n*f);const sn=_n-Vt;i.object.position.addScaledVector(R,sn),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){const _n=new q(I.x,I.y,0);_n.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/f)),i.object.updateProjectionMatrix(),Gt=!0;const sn=new q(I.x,I.y,0);sn.unproject(i.object),i.object.position.sub(sn).add(_n),i.object.updateMatrixWorld(),Vt=oe.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;Vt!==null&&(i.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(Vt).add(i.object.position):(cw.origin.copy(i.object.position),cw.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(cw.direction))<gTe?e.lookAt(i.target):(H5.setFromNormalAndCoplanarPoint(i.object.up,i.target),cw.intersectPlane(H5,i.target))))}else i.object instanceof tl&&i.object.isOrthographicCamera&&(Gt=f!==1,Gt&&(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/f)),i.object.updateProjectionMatrix()));return f=1,M=!1,Gt||ye.distanceToSquared(i.object.position)>c||8*(1-we.dot(i.object.quaternion))>c?(i.dispatchEvent(r),ye.copy(i.object.position),we.copy(i.object.quaternion),Gt=!1,!0):!1}})(),this.connect=oe=>{i.domElement=oe,i.domElement.style.touchAction="none",i.domElement.addEventListener("contextmenu",Xe),i.domElement.addEventListener("pointerdown",j),i.domElement.addEventListener("pointercancel",Ie),i.domElement.addEventListener("wheel",tt)},this.dispose=()=>{var oe,Te,Ye,se,ye,we;i.domElement&&(i.domElement.style.touchAction="auto"),(oe=i.domElement)==null||oe.removeEventListener("contextmenu",Xe),(Te=i.domElement)==null||Te.removeEventListener("pointerdown",j),(Ye=i.domElement)==null||Ye.removeEventListener("pointercancel",Ie),(se=i.domElement)==null||se.removeEventListener("wheel",tt),(ye=i.domElement)==null||ye.ownerDocument.removeEventListener("pointermove",pe),(we=i.domElement)==null||we.ownerDocument.removeEventListener("pointerup",Ie),i._domElementKeyEvents!==null&&i._domElementKeyEvents.removeEventListener("keydown",nt)};const i=this,r={type:"change"},s={type:"start"},o={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const c=1e-6,u=new OR,h=new OR;let f=1;const m=new q,y=new Fe,_=new Fe,v=new Fe,g=new Fe,w=new Fe,A=new Fe,T=new Fe,L=new Fe,D=new Fe,R=new q,I=new Fe;let M=!1;const C=[],k={};function B(){return 2*Math.PI/60/60*i.autoRotateSpeed}function O(){return Math.pow(.95,i.zoomSpeed)}function X(oe){i.reverseOrbit||i.reverseHorizontalOrbit?h.theta+=oe:h.theta-=oe}function le(oe){i.reverseOrbit||i.reverseVerticalOrbit?h.phi+=oe:h.phi-=oe}const ie=(()=>{const oe=new q;return function(Ye,se){oe.setFromMatrixColumn(se,0),oe.multiplyScalar(-Ye),m.add(oe)}})(),de=(()=>{const oe=new q;return function(Ye,se){i.screenSpacePanning===!0?oe.setFromMatrixColumn(se,1):(oe.setFromMatrixColumn(se,0),oe.crossVectors(i.object.up,oe)),oe.multiplyScalar(Ye),m.add(oe)}})(),G=(()=>{const oe=new q;return function(Ye,se){const ye=i.domElement;if(ye&&i.object instanceof Ni&&i.object.isPerspectiveCamera){const we=i.object.position;oe.copy(we).sub(i.target);let De=oe.length();De*=Math.tan(i.object.fov/2*Math.PI/180),ie(2*Ye*De/ye.clientHeight,i.object.matrix),de(2*se*De/ye.clientHeight,i.object.matrix)}else ye&&i.object instanceof tl&&i.object.isOrthographicCamera?(ie(Ye*(i.object.right-i.object.left)/i.object.zoom/ye.clientWidth,i.object.matrix),de(se*(i.object.top-i.object.bottom)/i.object.zoom/ye.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}})();function $(oe){i.object instanceof Ni&&i.object.isPerspectiveCamera||i.object instanceof tl&&i.object.isOrthographicCamera?f=oe:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function te(oe){$(f/oe)}function ue(oe){$(f*oe)}function ve(oe){if(!i.zoomToCursor||!i.domElement)return;M=!0;const Te=i.domElement.getBoundingClientRect(),Ye=oe.clientX-Te.left,se=oe.clientY-Te.top,ye=Te.width,we=Te.height;I.x=Ye/ye*2-1,I.y=-(se/we)*2+1,R.set(I.x,I.y,1).unproject(i.object).sub(i.object.position).normalize()}function be(oe){return Math.max(i.minDistance,Math.min(i.maxDistance,oe))}function he(oe){y.set(oe.clientX,oe.clientY)}function Pe(oe){ve(oe),T.set(oe.clientX,oe.clientY)}function Oe(oe){g.set(oe.clientX,oe.clientY)}function Ce(oe){_.set(oe.clientX,oe.clientY),v.subVectors(_,y).multiplyScalar(i.rotateSpeed);const Te=i.domElement;Te&&(X(2*Math.PI*v.x/Te.clientHeight),le(2*Math.PI*v.y/Te.clientHeight)),y.copy(_),i.update()}function mt(oe){L.set(oe.clientX,oe.clientY),D.subVectors(L,T),D.y>0?te(O()):D.y<0&&ue(O()),T.copy(L),i.update()}function Lt(oe){w.set(oe.clientX,oe.clientY),A.subVectors(w,g).multiplyScalar(i.panSpeed),G(A.x,A.y),g.copy(w),i.update()}function St(oe){ve(oe),oe.deltaY<0?ue(O()):oe.deltaY>0&&te(O()),i.update()}function Nt(oe){let Te=!1;switch(oe.code){case i.keys.UP:G(0,i.keyPanSpeed),Te=!0;break;case i.keys.BOTTOM:G(0,-i.keyPanSpeed),Te=!0;break;case i.keys.LEFT:G(i.keyPanSpeed,0),Te=!0;break;case i.keys.RIGHT:G(-i.keyPanSpeed,0),Te=!0;break}Te&&(oe.preventDefault(),i.update())}function ke(){if(C.length==1)y.set(C[0].pageX,C[0].pageY);else{const oe=.5*(C[0].pageX+C[1].pageX),Te=.5*(C[0].pageY+C[1].pageY);y.set(oe,Te)}}function Ue(){if(C.length==1)g.set(C[0].pageX,C[0].pageY);else{const oe=.5*(C[0].pageX+C[1].pageX),Te=.5*(C[0].pageY+C[1].pageY);g.set(oe,Te)}}function ee(){const oe=C[0].pageX-C[1].pageX,Te=C[0].pageY-C[1].pageY,Ye=Math.sqrt(oe*oe+Te*Te);T.set(0,Ye)}function xt(){i.enableZoom&&ee(),i.enablePan&&Ue()}function je(){i.enableZoom&&ee(),i.enableRotate&&ke()}function ht(oe){if(C.length==1)_.set(oe.pageX,oe.pageY);else{const Ye=ut(oe),se=.5*(oe.pageX+Ye.x),ye=.5*(oe.pageY+Ye.y);_.set(se,ye)}v.subVectors(_,y).multiplyScalar(i.rotateSpeed);const Te=i.domElement;Te&&(X(2*Math.PI*v.x/Te.clientHeight),le(2*Math.PI*v.y/Te.clientHeight)),y.copy(_)}function $e(oe){if(C.length==1)w.set(oe.pageX,oe.pageY);else{const Te=ut(oe),Ye=.5*(oe.pageX+Te.x),se=.5*(oe.pageY+Te.y);w.set(Ye,se)}A.subVectors(w,g).multiplyScalar(i.panSpeed),G(A.x,A.y),g.copy(w)}function Mt(oe){const Te=ut(oe),Ye=oe.pageX-Te.x,se=oe.pageY-Te.y,ye=Math.sqrt(Ye*Ye+se*se);L.set(0,ye),D.set(0,Math.pow(L.y/T.y,i.zoomSpeed)),te(D.y),T.copy(L)}function lt(oe){i.enableZoom&&Mt(oe),i.enablePan&&$e(oe)}function Y(oe){i.enableZoom&&Mt(oe),i.enableRotate&&ht(oe)}function j(oe){var Te,Ye;i.enabled!==!1&&(C.length===0&&((Te=i.domElement)==null||Te.ownerDocument.addEventListener("pointermove",pe),(Ye=i.domElement)==null||Ye.ownerDocument.addEventListener("pointerup",Ie)),dt(oe),oe.pointerType==="touch"?ct(oe):ze(oe))}function pe(oe){i.enabled!==!1&&(oe.pointerType==="touch"?Yt(oe):Ee(oe))}function Ie(oe){var Te,Ye,se;It(oe),C.length===0&&((Te=i.domElement)==null||Te.releasePointerCapture(oe.pointerId),(Ye=i.domElement)==null||Ye.ownerDocument.removeEventListener("pointermove",pe),(se=i.domElement)==null||se.ownerDocument.removeEventListener("pointerup",Ie)),i.dispatchEvent(o),l=a.NONE}function ze(oe){let Te;switch(oe.button){case 0:Te=i.mouseButtons.LEFT;break;case 1:Te=i.mouseButtons.MIDDLE;break;case 2:Te=i.mouseButtons.RIGHT;break;default:Te=-1}switch(Te){case Uh.DOLLY:if(i.enableZoom===!1)return;Pe(oe),l=a.DOLLY;break;case Uh.ROTATE:if(oe.ctrlKey||oe.metaKey||oe.shiftKey){if(i.enablePan===!1)return;Oe(oe),l=a.PAN}else{if(i.enableRotate===!1)return;he(oe),l=a.ROTATE}break;case Uh.PAN:if(oe.ctrlKey||oe.metaKey||oe.shiftKey){if(i.enableRotate===!1)return;he(oe),l=a.ROTATE}else{if(i.enablePan===!1)return;Oe(oe),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&i.dispatchEvent(s)}function Ee(oe){if(i.enabled!==!1)switch(l){case a.ROTATE:if(i.enableRotate===!1)return;Ce(oe);break;case a.DOLLY:if(i.enableZoom===!1)return;mt(oe);break;case a.PAN:if(i.enablePan===!1)return;Lt(oe);break}}function tt(oe){i.enabled===!1||i.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(oe.preventDefault(),i.dispatchEvent(s),St(oe),i.dispatchEvent(o))}function nt(oe){i.enabled===!1||i.enablePan===!1||Nt(oe)}function ct(oe){switch(gt(oe),C.length){case 1:switch(i.touches.ONE){case Vh.ROTATE:if(i.enableRotate===!1)return;ke(),l=a.TOUCH_ROTATE;break;case Vh.PAN:if(i.enablePan===!1)return;Ue(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(i.touches.TWO){case Vh.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;xt(),l=a.TOUCH_DOLLY_PAN;break;case Vh.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;je(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&i.dispatchEvent(s)}function Yt(oe){switch(gt(oe),l){case a.TOUCH_ROTATE:if(i.enableRotate===!1)return;ht(oe),i.update();break;case a.TOUCH_PAN:if(i.enablePan===!1)return;$e(oe),i.update();break;case a.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;lt(oe),i.update();break;case a.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Y(oe),i.update();break;default:l=a.NONE}}function Xe(oe){i.enabled!==!1&&oe.preventDefault()}function dt(oe){C.push(oe)}function It(oe){delete k[oe.pointerId];for(let Te=0;Te<C.length;Te++)if(C[Te].pointerId==oe.pointerId){C.splice(Te,1);return}}function gt(oe){let Te=k[oe.pointerId];Te===void 0&&(Te=new Fe,k[oe.pointerId]=Te),Te.set(oe.pageX,oe.pageY)}function ut(oe){const Te=oe.pointerId===C[0].pointerId?C[1]:C[0];return k[Te.pointerId]}this.dollyIn=(oe=O())=>{ue(oe),i.update()},this.dollyOut=(oe=O())=>{te(oe),i.update()},this.getScale=()=>f,this.setScale=oe=>{$(oe),i.update()},this.getZoomScale=()=>O(),t!==void 0&&this.connect(t),this.update()}};function KE(n){if(typeof TextDecoder<"u")return new TextDecoder().decode(n);let e="";for(let t=0,i=n.length;t<i;t++)e+=String.fromCharCode(n[t]);try{return decodeURIComponent(escape(e))}catch{return e}}const rd="srgb",Jl="srgb-linear",j5=3001,vTe=3e3;class oL extends Lr{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new ATe(t)}),this.register(function(t){return new STe(t)}),this.register(function(t){return new DTe(t)}),this.register(function(t){return new LTe(t)}),this.register(function(t){return new kTe(t)}),this.register(function(t){return new bTe(t)}),this.register(function(t){return new CTe(t)}),this.register(function(t){return new MTe(t)}),this.register(function(t){return new ITe(t)}),this.register(function(t){return new ETe(t)}),this.register(function(t){return new RTe(t)}),this.register(function(t){return new TTe(t)}),this.register(function(t){return new NTe(t)}),this.register(function(t){return new PTe(t)}),this.register(function(t){return new xTe(t)}),this.register(function(t){return new BTe(t)}),this.register(function(t){return new OTe(t)})}load(e,t,i,r){const s=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const c=Su.extractUrlBase(e);o=Su.resolveURL(c,this.path)}else o=Su.extractUrlBase(e);this.manager.itemStart(e);const a=function(c){r?r(c):console.error(c),s.manager.itemError(e),s.manager.itemEnd(e)},l=new Pr(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{s.parse(c,o,function(u){t(u),s.manager.itemEnd(e)},a)}catch(u){a(u)}},i,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,i,r){let s;const o={},a={};if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(KE(new Uint8Array(e.slice(0,4)))===QX){try{o[xn.KHR_BINARY_GLTF]=new FTe(e)}catch(u){r&&r(u);return}s=JSON.parse(o[xn.KHR_BINARY_GLTF].content)}else s=JSON.parse(KE(new Uint8Array(e)));else s=e;if(s.asset===void 0||s.asset.version[0]<2){r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const l=new JTe(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let c=0;c<this.pluginCallbacks.length;c++){const u=this.pluginCallbacks[c](l);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[u.name]=u,o[u.name]=!0}if(s.extensionsUsed)for(let c=0;c<s.extensionsUsed.length;++c){const u=s.extensionsUsed[c],h=s.extensionsRequired||[];switch(u){case xn.KHR_MATERIALS_UNLIT:o[u]=new wTe;break;case xn.KHR_DRACO_MESH_COMPRESSION:o[u]=new UTe(s,this.dracoLoader);break;case xn.KHR_TEXTURE_TRANSFORM:o[u]=new VTe;break;case xn.KHR_MESH_QUANTIZATION:o[u]=new zTe;break;default:h.indexOf(u)>=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}l.setExtensions(o),l.setPlugins(a),l.parse(i,r)}parseAsync(e,t){const i=this;return new Promise(function(r,s){i.parse(e,t,r,s)})}}function _Te(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const xn={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class xTe{constructor(e){this.parser=e,this.name=xn.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i<r;i++){const s=t[i];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,i="light:"+e;let r=t.cache.get(i);if(r)return r;const s=t.json,l=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let c;const u=new ft(16777215);l.color!==void 0&&u.setRGB(l.color[0],l.color[1],l.color[2],Jl);const h=l.range!==void 0?l.range:0;switch(l.type){case"directional":c=new KD(u),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new WD(u),c.distance=h;break;case"spot":c=new jD(u),c.distance=h,l.spot=l.spot||{},l.spot.innerConeAngle=l.spot.innerConeAngle!==void 0?l.spot.innerConeAngle:0,l.spot.outerConeAngle=l.spot.outerConeAngle!==void 0?l.spot.outerConeAngle:Math.PI/4,c.angle=l.spot.outerConeAngle,c.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return c.position.set(0,0,0),c.decay=2,Pl(c,l),l.intensity!==void 0&&(c.intensity=l.intensity),c.name=t.createUniqueName(l.name||"light_"+e),r=Promise.resolve(c),t.cache.add(i,r),r}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,i=this.parser,s=i.json.nodes[e],a=(s.extensions&&s.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(l){return i._getNodeRef(t.cache,a,l)})}}class wTe{constructor(){this.name=xn.KHR_MATERIALS_UNLIT}getMaterialType(){return Fs}extendParams(e,t,i){const r=[];e.color=new ft(1,1,1),e.opacity=1;const s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const o=s.baseColorFactor;e.color.setRGB(o[0],o[1],o[2],Jl),e.opacity=o[3]}s.baseColorTexture!==void 0&&r.push(i.assignTexture(e,"map",s.baseColorTexture,rd))}return Promise.all(r)}}class ETe{constructor(e){this.parser=e,this.name=xn.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name].emissiveStrength;return s!==void 0&&(t.emissiveIntensity=s),Promise.resolve()}}class ATe{constructor(e){this.parser=e,this.name=xn.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Go}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&s.push(i.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&s.push(i.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(s.push(i.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const a=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Fe(a,a)}return Promise.all(s)}}class STe{constructor(e){this.parser=e,this.name=xn.KHR_MATERIALS_DISPERSION}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Go}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return t.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}}class TTe{constructor(e){this.parser=e,this.name=xn.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Go}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];return o.iridescenceFactor!==void 0&&(t.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&s.push(i.assignTexture(t,"iridescenceMap",o.iridescenceTexture)),o.iridescenceIor!==void 0&&(t.iridescenceIOR=o.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),o.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),o.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),o.iridescenceThicknessTexture!==void 0&&s.push(i.assignTexture(t,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(s)}}class bTe{constructor(e){this.parser=e,this.name=xn.KHR_MATERIALS_SHEEN}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Go}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[];t.sheenColor=new ft(0,0,0),t.sheenRoughness=0,t.sheen=1;const o=r.extensions[this.name];if(o.sheenColorFactor!==void 0){const a=o.sheenColorFactor;t.sheenColor.setRGB(a[0],a[1],a[2],Jl)}return o.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&s.push(i.assignTexture(t,"sheenColorMap",o.sheenColorTexture,rd)),o.sheenRoughnessTexture!==void 0&&s.push(i.assignTexture(t,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(s)}}class CTe{constructor(e){this.parser=e,this.name=xn.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Go}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&s.push(i.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(s)}}class MTe{constructor(e){this.parser=e,this.name=xn.KHR_MATERIALS_VOLUME}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Go}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];t.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&s.push(i.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;const a=o.attenuationColor||[1,1,1];return t.attenuationColor=new ft().setRGB(a[0],a[1],a[2],Jl),Promise.all(s)}}class ITe{constructor(e){this.parser=e,this.name=xn.KHR_MATERIALS_IOR}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Go}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return t.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class RTe{constructor(e){this.parser=e,this.name=xn.KHR_MATERIALS_SPECULAR}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Go}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];t.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&s.push(i.assignTexture(t,"specularIntensityMap",o.specularTexture));const a=o.specularColorFactor||[1,1,1];return t.specularColor=new ft().setRGB(a[0],a[1],a[2],Jl),o.specularColorTexture!==void 0&&s.push(i.assignTexture(t,"specularColorMap",o.specularColorTexture,rd)),Promise.all(s)}}class PTe{constructor(e){this.parser=e,this.name=xn.EXT_MATERIALS_BUMP}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Go}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];return t.bumpScale=o.bumpFactor!==void 0?o.bumpFactor:1,o.bumpTexture!==void 0&&s.push(i.assignTexture(t,"bumpMap",o.bumpTexture)),Promise.all(s)}}class NTe{constructor(e){this.parser=e,this.name=xn.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Go}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];return o.anisotropyStrength!==void 0&&(t.anisotropy=o.anisotropyStrength),o.anisotropyRotation!==void 0&&(t.anisotropyRotation=o.anisotropyRotation),o.anisotropyTexture!==void 0&&s.push(i.assignTexture(t,"anisotropyMap",o.anisotropyTexture)),Promise.all(s)}}class DTe{constructor(e){this.parser=e,this.name=xn.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,i=t.json,r=i.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const s=r.extensions[this.name],o=t.options.ktx2Loader;if(!o){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class LTe{constructor(e){this.parser=e,this.name=xn.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class kTe{constructor(e){this.parser=e,this.name=xn.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class BTe{constructor(e){this.name=xn.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const r=i.extensions[this.name],s=this.parser.getDependency("buffer",r.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=r.byteOffset||0,c=r.byteLength||0,u=r.count,h=r.byteStride,f=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(u,h,f,r.mode,r.filter).then(function(m){return m.buffer}):o.ready.then(function(){const m=new ArrayBuffer(u*h);return o.decodeGltfBuffer(new Uint8Array(m),u,h,f,r.mode,r.filter),m})})}else return null}}class OTe{constructor(e){this.name=xn.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const r=t.meshes[i.mesh];for(const c of r.primitives)if(c.mode!==Mo.TRIANGLES&&c.mode!==Mo.TRIANGLE_STRIP&&c.mode!==Mo.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=i.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(u=>(l[c]=u,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const u=c.pop(),h=u.isGroup?u.children:[u],f=c[0].count,m=[];for(const y of h){const _=new qt,v=new q,g=new xr,w=new q(1,1,1),A=new RD(y.geometry,y.material,f);for(let T=0;T<f;T++)l.TRANSLATION&&v.fromBufferAttribute(l.TRANSLATION,T),l.ROTATION&&g.fromBufferAttribute(l.ROTATION,T),l.SCALE&&w.fromBufferAttribute(l.SCALE,T),A.setMatrixAt(T,_.compose(v,g,w));for(const T in l)if(T==="_COLOR_0"){const L=l[T];A.instanceColor=new Vd(L.array,L.itemSize,L.normalized)}else T!=="TRANSLATION"&&T!=="ROTATION"&&T!=="SCALE"&&y.geometry.setAttribute(T,l[T]);Rn.prototype.copy.call(A,y),this.parser.assignFinalMaterial(A),m.push(A)}return u.isGroup?(u.clear(),u.add(...m),u):m[0]}))}}const QX="glTF",$g=12,W5={JSON:1313821514,BIN:5130562};class FTe{constructor(e){this.name=xn.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,$g);if(this.header={magic:KE(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==QX)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-$g,r=new DataView(e,$g);let s=0;for(;s<i;){const o=r.getUint32(s,!0);s+=4;const a=r.getUint32(s,!0);if(s+=4,a===W5.JSON){const l=new Uint8Array(e,$g+s,o);this.content=KE(l)}else if(a===W5.BIN){const l=$g+s;this.body=e.slice(l,l+o)}s+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class UTe{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=xn.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const i=this.json,r=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},l={},c={};for(const u in o){const h=GR[u]||u.toLowerCase();a[h]=o[u]}for(const u in e.attributes){const h=GR[u]||u.toLowerCase();if(o[u]!==void 0){const f=i.accessors[e.attributes[u]],m=Fp[f.componentType];c[h]=m.name,l[h]=f.normalized===!0}}return t.getDependency("bufferView",s).then(function(u){return new Promise(function(h,f){r.decodeDracoFile(u,function(m){for(const y in m.attributes){const _=m.attributes[y],v=l[y];v!==void 0&&(_.normalized=v)}h(m)},a,c,Jl,f)})})}}class VTe{constructor(){this.name=xn.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class zTe{constructor(){this.name=xn.KHR_MESH_QUANTIZATION}}class ZX extends Ym{constructor(e,t,i,r){super(e,t,i,r)}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r*3+r;for(let o=0;o!==r;o++)t[o]=i[s+o];return t}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=a*2,c=a*3,u=r-t,h=(i-t)/u,f=h*h,m=f*h,y=e*c,_=y-c,v=-2*m+3*f,g=m-f,w=1-v,A=g-f+h;for(let T=0;T!==a;T++){const L=o[_+T+a],D=o[_+T+l]*u,R=o[y+T+a],I=o[y+T]*u;s[T]=w*L+A*D+v*R+g*I}return s}}const HTe=new xr;class GTe extends ZX{interpolate_(e,t,i,r){const s=super.interpolate_(e,t,i,r);return HTe.fromArray(s).normalize().toArray(s),s}}const Mo={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Fp={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},K5={9728:_r,9729:Gn,9984:cS,9985:Bp,9986:Jh,9987:Oo},X5={33071:Ui,33648:vm,10497:Hu},KC={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},GR={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...sL>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Fc={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},jTe={CUBICSPLINE:void 0,LINEAR:wm,STEP:xm},XC={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function WTe(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new Kv({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:ol})),n.DefaultMaterial}function Nh(n,e,t){for(const i in t.extensions)n[i]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=t.extensions[i])}function Pl(n,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(n.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function KTe(n,e,t){let i=!1,r=!1,s=!1;for(let c=0,u=e.length;c<u;c++){const h=e[c];if(h.POSITION!==void 0&&(i=!0),h.NORMAL!==void 0&&(r=!0),h.COLOR_0!==void 0&&(s=!0),i&&r&&s)break}if(!i&&!r&&!s)return Promise.resolve(n);const o=[],a=[],l=[];for(let c=0,u=e.length;c<u;c++){const h=e[c];if(i){const f=h.POSITION!==void 0?t.getDependency("accessor",h.POSITION):n.attributes.position;o.push(f)}if(r){const f=h.NORMAL!==void 0?t.getDependency("accessor",h.NORMAL):n.attributes.normal;a.push(f)}if(s){const f=h.COLOR_0!==void 0?t.getDependency("accessor",h.COLOR_0):n.attributes.color;l.push(f)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l)]).then(function(c){const u=c[0],h=c[1],f=c[2];return i&&(n.morphAttributes.position=u),r&&(n.morphAttributes.normal=h),s&&(n.morphAttributes.color=f),n.morphTargetsRelative=!0,n})}function XTe(n,e){if(n.updateMorphTargets(),e.weights!==void 0)for(let t=0,i=e.weights.length;t<i;t++)n.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(n.morphTargetInfluences.length===t.length){n.morphTargetDictionary={};for(let i=0,r=t.length;i<r;i++)n.morphTargetDictionary[t[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function qTe(n){let e;const t=n.extensions&&n.extensions[xn.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+qC(t.attributes):e=n.indices+":"+qC(n.attributes)+":"+n.mode,n.targets!==void 0)for(let i=0,r=n.targets.length;i<r;i++)e+=":"+qC(n.targets[i]);return e}function qC(n){let e="";const t=Object.keys(n).sort();for(let i=0,r=t.length;i<r;i++)e+=t[i]+":"+n[t[i]]+";";return e}function jR(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function YTe(n){return n.search(/\.jpe?g($|\?)/i)>0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const $Te=new qt;class JTe{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new _Te,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,r=!1,s=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,r=navigator.userAgent.indexOf("Firefox")>-1,s=r?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||i||r&&s<98?this.textureLoader=new cX(this.options.manager):this.textureLoader=new yX(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Pr(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,r=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(o){const a={scene:o[0][r.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:r.asset,parser:i,userData:{}};return Nh(s,a,r),Pl(a,r),Promise.all(i._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let r=0,s=t.length;r<s;r++){const o=t[r].joints;for(let a=0,l=o.length;a<l;a++)e[o[a]].isBone=!0}for(let r=0,s=e.length;r<s;r++){const o=e[r];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(i[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,i){if(e.refs[t]<=1)return i;const r=i.clone(),s=(o,a)=>{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,u]of o.children.entries())s(u,a.children[c])};return s(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i<t.length;i++){const r=e(t[i]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const i=[];for(let r=0;r<t.length;r++){const s=e(t[r]);s&&i.push(s)}return i}getDependency(e,t){const i=e+":"+t;let r=this.cache.get(i);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne(function(s){return s.loadNode&&s.loadNode(t)});break;case"mesh":r=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!r)throw new Error("Unknown type: "+e);break}this.cache.add(i,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const i=this,r=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(r.map(function(s,o){return i.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],i=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[xn.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(s,o){i.load(Su.resolveURL(t.uri,r.path),s,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(i){const r=t.byteLength||0,s=t.byteOffset||0;return i.slice(s,s+r)})}loadAccessor(e){const t=this,i=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){const o=KC[r.type],a=Fp[r.componentType],l=r.normalized===!0,c=new a(r.count*o);return Promise.resolve(new Fn(c,o,l))}const s=[];return r.bufferView!==void 0?s.push(this.getDependency("bufferView",r.bufferView)):s.push(null),r.sparse!==void 0&&(s.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(s).then(function(o){const a=o[0],l=KC[r.type],c=Fp[r.componentType],u=c.BYTES_PER_ELEMENT,h=u*l,f=r.byteOffset||0,m=r.bufferView!==void 0?i.bufferViews[r.bufferView].byteStride:void 0,y=r.normalized===!0;let _,v;if(m&&m!==h){const g=Math.floor(f/m),w="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+g+":"+r.count;let A=t.cache.get(w);A||(_=new c(a,g*m,r.count*m/u),A=new Vv(_,m/u),t.cache.add(w,A)),v=new Gu(A,l,f%m/u,y)}else a===null?_=new c(r.count*l):_=new c(a,f,r.count*l),v=new Fn(_,l,y);if(r.sparse!==void 0){const g=KC.SCALAR,w=Fp[r.sparse.indices.componentType],A=r.sparse.indices.byteOffset||0,T=r.sparse.values.byteOffset||0,L=new w(o[1],A,r.sparse.count*g),D=new c(o[2],T,r.sparse.count*l);a!==null&&(v=new Fn(v.array.slice(),v.itemSize,v.normalized));for(let R=0,I=L.length;R<I;R++){const M=L[R];if(v.setX(M,D[R*l]),l>=2&&v.setY(M,D[R*l+1]),l>=3&&v.setZ(M,D[R*l+2]),l>=4&&v.setW(M,D[R*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return v})}loadTexture(e){const t=this.json,i=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=i.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,i){const r=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,i).then(function(u){u.flipY=!1,u.name=o.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const f=(s.samplers||{})[o.sampler]||{};return u.magFilter=K5[f.magFilter]||Gn,u.minFilter=K5[f.minFilter]||Oo,u.wrapS=X5[f.wrapS]||Hu,u.wrapT=X5[f.wrapT]||Hu,r.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const i=this,r=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());const o=r.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=i.getDependency("bufferView",o.bufferView).then(function(h){c=!0;const f=new Blob([h],{type:o.mimeType});return l=a.createObjectURL(f),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(l).then(function(h){return new Promise(function(f,m){let y=f;t.isImageBitmapLoader===!0&&(y=function(_){const v=new qn(_);v.needsUpdate=!0,f(v)}),t.load(Su.resolveURL(h,s.path),y,void 0,m)})}).then(function(h){return c===!0&&a.revokeObjectURL(l),Pl(h,o),h.userData.mimeType=o.mimeType||YTe(o.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),h});return this.sourceCache[e]=u,u}assignTexture(e,t,i,r){const s=this;return this.getDependency("texture",i.index).then(function(o){if(!o)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(o=o.clone(),o.channel=i.texCoord),s.extensions[xn.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[xn.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[xn.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return r!==void 0&&(typeof r=="number"&&(r=r===j5?rd:Jl),"colorSpace"in o?o.colorSpace=r:o.encoding=r===rd?j5:vTe),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const r=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new AS,or.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,l.sizeAttenuation=!1,this.cache.add(a,l)),i=l}else if(e.isLine){const a="LineBasicMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new as,or.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,this.cache.add(a,l)),i=l}if(r||s||o){let a="ClonedMaterial:"+i.uuid+":";r&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=i.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),r&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(i))),i=l}e.material=i}getMaterialType(){return Kv}loadMaterial(e){const t=this,i=this.json,r=this.extensions,s=i.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[xn.KHR_MATERIALS_UNLIT]){const h=r[xn.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),c.push(h.extendParams(a,s,t))}else{const h=s.pbrMetallicRoughness||{};if(a.color=new ft(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){const f=h.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],Jl),a.opacity=f[3]}h.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",h.baseColorTexture,rd)),a.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,a.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=No);const u=s.alphaMode||XC.OPAQUE;if(u===XC.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===XC.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Fs&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new Fe(1,1),s.normalTexture.scale!==void 0)){const h=s.normalTexture.scale;a.normalScale.set(h,h)}if(s.occlusionTexture!==void 0&&o!==Fs&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Fs){const h=s.emissiveFactor;a.emissive=new ft().setRGB(h[0],h[1],h[2],Jl)}return s.emissiveTexture!==void 0&&o!==Fs&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,rd)),Promise.all(c).then(function(){const h=new o(a);return s.name&&(h.name=s.name),Pl(h,s),t.associations.set(h,{materials:e}),s.extensions&&Nh(r,h,s),h})}createUniqueName(e){const t=Dn.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,r=this.primitiveCache;function s(a){return i[xn.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return q5(l,a,t)})}const o=[];for(let a=0,l=e.length;a<l;a++){const c=e[a],u=qTe(c),h=r[u];if(h)o.push(h.promise);else{let f;c.extensions&&c.extensions[xn.KHR_DRACO_MESH_COMPRESSION]?f=s(c):f=q5(new un,c,t),r[u]={primitive:c,promise:f},o.push(f)}}return Promise.all(o)}loadMesh(e){const t=this,i=this.json,r=this.extensions,s=i.meshes[e],o=s.primitives,a=[];for(let l=0,c=o.length;l<c;l++){const u=o[l].material===void 0?WTe(this.cache):this.getDependency("material",o[l].material);a.push(u)}return a.push(t.loadGeometries(o)),Promise.all(a).then(function(l){const c=l.slice(0,l.length-1),u=l[l.length-1],h=[];for(let m=0,y=u.length;m<y;m++){const _=u[m],v=o[m];let g;const w=c[m];if(v.mode===Mo.TRIANGLES||v.mode===Mo.TRIANGLE_STRIP||v.mode===Mo.TRIANGLE_FAN||v.mode===void 0)g=s.isSkinnedMesh===!0?new ID(_,w):new fi(_,w),g.isSkinnedMesh===!0&&g.normalizeSkinWeights(),v.mode===Mo.TRIANGLE_STRIP?g.geometry=z5(g.geometry,yD):v.mode===Mo.TRIANGLE_FAN&&(g.geometry=z5(g.geometry,HE));else if(v.mode===Mo.LINES)g=new Sa(_,w);else if(v.mode===Mo.LINE_STRIP)g=new uc(_,w);else if(v.mode===Mo.LINE_LOOP)g=new PD(_,w);else if(v.mode===Mo.POINTS)g=new ND(_,w);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+v.mode);Object.keys(g.geometry.morphAttributes).length>0&&XTe(g,s),g.name=t.createUniqueName(s.name||"mesh_"+e),Pl(g,s),v.extensions&&Nh(r,g,v),t.assignFinalMaterial(g),h.push(g)}for(let m=0,y=h.length;m<y;m++)t.associations.set(h[m],{meshes:e,primitives:m});if(h.length===1)return s.extensions&&Nh(r,h[0],s),h[0];const f=new jl;s.extensions&&Nh(r,f,s),t.associations.set(f,{meshes:e});for(let m=0,y=h.length;m<y;m++)f.add(h[m]);return f})}loadCamera(e){let t;const i=this.json.cameras[e],r=i[i.type];if(!r){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return i.type==="perspective"?t=new Ni(vK.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):i.type==="orthographic"&&(t=new tl(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),Pl(t,i),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],i=[];for(let r=0,s=t.joints.length;r<s;r++)i.push(this._loadNodeShallow(t.joints[r]));return t.inverseBindMatrices!==void 0?i.push(this.getDependency("accessor",t.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(r){const s=r.pop(),o=r,a=[],l=[];for(let c=0,u=o.length;c<u;c++){const h=o[c];if(h){a.push(h);const f=new qt;s!==null&&f.fromArray(s.array,c*16),l.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[c])}return new zv(a,l)})}loadAnimation(e){const t=this.json,i=this,r=t.animations[e],s=r.name?r.name:"animation_"+e,o=[],a=[],l=[],c=[],u=[];for(let h=0,f=r.channels.length;h<f;h++){const m=r.channels[h],y=r.samplers[m.sampler],_=m.target,v=_.node,g=r.parameters!==void 0?r.parameters[y.input]:y.input,w=r.parameters!==void 0?r.parameters[y.output]:y.output;_.node!==void 0&&(o.push(this.getDependency("node",v)),a.push(this.getDependency("accessor",g)),l.push(this.getDependency("accessor",w)),c.push(y),u.push(_))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l),Promise.all(c),Promise.all(u)]).then(function(h){const f=h[0],m=h[1],y=h[2],_=h[3],v=h[4],g=[];for(let w=0,A=f.length;w<A;w++){const T=f[w],L=m[w],D=y[w],R=_[w],I=v[w];if(T===void 0)continue;T.updateMatrix&&T.updateMatrix();const M=i._createAnimationTracks(T,L,D,R,I);if(M)for(let C=0;C<M.length;C++)g.push(M[C])}return new Sm(s,void 0,g)})}createNodeMesh(e){const t=this.json,i=this,r=t.nodes[e];return r.mesh===void 0?null:i.getDependency("mesh",r.mesh).then(function(s){const o=i._getNodeRef(i.meshCache,r.mesh,s);return r.weights!==void 0&&o.traverse(function(a){if(a.isMesh)for(let l=0,c=r.weights.length;l<c;l++)a.morphTargetInfluences[l]=r.weights[l]}),o})}loadNode(e){const t=this.json,i=this,r=t.nodes[e],s=i._loadNodeShallow(e),o=[],a=r.children||[];for(let c=0,u=a.length;c<u;c++)o.push(i.getDependency("node",a[c]));const l=r.skin===void 0?Promise.resolve(null):i.getDependency("skin",r.skin);return Promise.all([s,Promise.all(o),l]).then(function(c){const u=c[0],h=c[1],f=c[2];f!==null&&u.traverse(function(m){m.isSkinnedMesh&&m.bind(f,$Te)});for(let m=0,y=h.length;m<y;m++)u.add(h[m]);return u})}_loadNodeShallow(e){const t=this.json,i=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=t.nodes[e],o=s.name?r.createUniqueName(s.name):"",a=[],l=r._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return l&&a.push(l),s.camera!==void 0&&a.push(r.getDependency("camera",s.camera).then(function(c){return r._getNodeRef(r.cameraCache,s.camera,c)})),r._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){a.push(c)}),this.nodeCache[e]=Promise.all(a).then(function(c){let u;if(s.isBone===!0?u=new ES:c.length>1?u=new jl:c.length===1?u=c[0]:u=new Rn,u!==c[0])for(let h=0,f=c.length;h<f;h++)u.add(c[h]);if(s.name&&(u.userData.name=s.name,u.name=o),Pl(u,s),s.extensions&&Nh(i,u,s),s.matrix!==void 0){const h=new qt;h.fromArray(s.matrix),u.applyMatrix4(h)}else s.translation!==void 0&&u.position.fromArray(s.translation),s.rotation!==void 0&&u.quaternion.fromArray(s.rotation),s.scale!==void 0&&u.scale.fromArray(s.scale);return r.associations.has(u)||r.associations.set(u,{}),r.associations.get(u).nodes=e,u}),this.nodeCache[e]}loadScene(e){const t=this.extensions,i=this.json.scenes[e],r=this,s=new jl;i.name&&(s.name=r.createUniqueName(i.name)),Pl(s,i),i.extensions&&Nh(t,s,i);const o=i.nodes||[],a=[];for(let l=0,c=o.length;l<c;l++)a.push(r.getDependency("node",o[l]));return Promise.all(a).then(function(l){for(let u=0,h=l.length;u<h;u++)s.add(l[u]);const c=u=>{const h=new Map;for(const[f,m]of r.associations)(f instanceof or||f instanceof qn)&&h.set(f,m);return u.traverse(f=>{const m=r.associations.get(f);m!=null&&h.set(f,m)}),h};return r.associations=c(s),s})}_createAnimationTracks(e,t,i,r,s){const o=[],a=e.name?e.name:e.uuid,l=[];Fc[s.path]===Fc.weights?e.traverse(function(f){f.morphTargetInfluences&&l.push(f.name?f.name:f.uuid)}):l.push(a);let c;switch(Fc[s.path]){case Fc.weights:c=Hd;break;case Fc.rotation:c=Gd;break;case Fc.position:case Fc.scale:c=jd;break;default:switch(i.itemSize){case 1:c=Hd;break;case 2:case 3:default:c=jd;break}break}const u=r.interpolation!==void 0?jTe[r.interpolation]:wm,h=this._getArrayFromAccessor(i);for(let f=0,m=l.length;f<m;f++){const y=new c(l[f]+"."+Fc[s.path],t.array,h,u);r.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(y),o.push(y)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const i=jR(t.constructor),r=new Float32Array(t.length);for(let s=0,o=t.length;s<o;s++)r[s]=t[s]*i;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(i){const r=this instanceof Gd?GTe:ZX;return new r(this.times,this.values,this.getValueSize()/3,i)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function QTe(n,e,t){const i=e.attributes,r=new ns;if(i.POSITION!==void 0){const a=t.json.accessors[i.POSITION],l=a.min,c=a.max;if(l!==void 0&&c!==void 0){if(r.set(new q(l[0],l[1],l[2]),new q(c[0],c[1],c[2])),a.normalized){const u=jR(Fp[a.componentType]);r.min.multiplyScalar(u),r.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const a=new q,l=new q;for(let c=0,u=s.length;c<u;c++){const h=s[c];if(h.POSITION!==void 0){const f=t.json.accessors[h.POSITION],m=f.min,y=f.max;if(m!==void 0&&y!==void 0){if(l.setX(Math.max(Math.abs(m[0]),Math.abs(y[0]))),l.setY(Math.max(Math.abs(m[1]),Math.abs(y[1]))),l.setZ(Math.max(Math.abs(m[2]),Math.abs(y[2]))),f.normalized){const _=jR(Fp[f.componentType]);l.multiplyScalar(_)}a.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(a)}n.boundingBox=r;const o=new Rr;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,n.boundingSphere=o}function q5(n,e,t){const i=e.attributes,r=[];function s(o,a){return t.getDependency("accessor",o).then(function(l){n.setAttribute(a,l)})}for(const o in i){const a=GR[o]||o.toLowerCase();a in n.attributes||r.push(s(i[o],a))}if(e.indices!==void 0&&!n.index){const o=t.getDependency("accessor",e.indices).then(function(a){n.setIndex(a)});r.push(o)}return Pl(n,e),QTe(n,e,t),Promise.all(r).then(function(){return e.targets!==void 0?KTe(n,e.targets,t):n})}const ZTe={uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:`
      varying vec2 vUv;

      void main() {

        vUv = uv;
        gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );

      }
  `,fragmentShader:`
    uniform sampler2D tDiffuse;
    uniform float h;

    varying vec2 vUv;

    void main() {

    	vec4 sum = vec4( 0.0 );

    	sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;
    	sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;
    	sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;
    	sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;
    	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
    	sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;
    	sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;
    	sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;
    	sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;

    	gl_FragColor = sum;

    }
  `},ebe={uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:`
    varying vec2 vUv;

    void main() {

      vUv = uv;
      gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );

    }
  `,fragmentShader:`

  uniform sampler2D tDiffuse;
  uniform float v;

  varying vec2 vUv;

  void main() {

    vec4 sum = vec4( 0.0 );

    sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;
    sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;
    sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;
    sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;
    sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
    sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;
    sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;
    sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;
    sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;

    gl_FragColor = sum;

  }
  `};class tbe extends HD{constructor(e){super(e),this.type=yr}parse(e){const o=function(I,M){switch(I){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(M||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(M||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(M||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(M||""))}},u=`
`,h=function(I,M,C){M=M||1024;let B=I.pos,O=-1,X=0,le="",ie=String.fromCharCode.apply(null,new Uint16Array(I.subarray(B,B+128)));for(;0>(O=ie.indexOf(u))&&X<M&&B<I.byteLength;)le+=ie,X+=ie.length,B+=128,ie+=String.fromCharCode.apply(null,new Uint16Array(I.subarray(B,B+128)));return-1<O?(I.pos+=X+O+1,le+ie.slice(0,O)):!1},f=function(I){const M=/^#\?(\S+)/,C=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,k=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,B=/^\s*FORMAT=(\S+)\s*$/,O=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,X={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let le,ie;for((I.pos>=I.byteLength||!(le=h(I)))&&o(1,"no header found"),(ie=le.match(M))||o(3,"bad initial token"),X.valid|=1,X.programtype=ie[1],X.string+=le+`
`;le=h(I),le!==!1;){if(X.string+=le+`
`,le.charAt(0)==="#"){X.comments+=le+`
`;continue}if((ie=le.match(C))&&(X.gamma=parseFloat(ie[1])),(ie=le.match(k))&&(X.exposure=parseFloat(ie[1])),(ie=le.match(B))&&(X.valid|=2,X.format=ie[1]),(ie=le.match(O))&&(X.valid|=4,X.height=parseInt(ie[1],10),X.width=parseInt(ie[2],10)),X.valid&2&&X.valid&4)break}return X.valid&2||o(3,"missing format specifier"),X.valid&4||o(3,"missing image size specifier"),X},m=function(I,M,C){const k=M;if(k<8||k>32767||I[0]!==2||I[1]!==2||I[2]&128)return new Uint8Array(I);k!==(I[2]<<8|I[3])&&o(3,"wrong scanline width");const B=new Uint8Array(4*M*C);B.length||o(4,"unable to allocate buffer space");let O=0,X=0;const le=4*k,ie=new Uint8Array(4),de=new Uint8Array(le);let G=C;for(;G>0&&X<I.byteLength;){X+4>I.byteLength&&o(1),ie[0]=I[X++],ie[1]=I[X++],ie[2]=I[X++],ie[3]=I[X++],(ie[0]!=2||ie[1]!=2||(ie[2]<<8|ie[3])!=k)&&o(3,"bad rgbe scanline format");let $=0,te;for(;$<le&&X<I.byteLength;){te=I[X++];const ve=te>128;if(ve&&(te-=128),(te===0||$+te>le)&&o(3,"bad scanline data"),ve){const be=I[X++];for(let he=0;he<te;he++)de[$++]=be}else de.set(I.subarray(X,X+te),$),$+=te,X+=te}const ue=k;for(let ve=0;ve<ue;ve++){let be=0;B[O]=de[ve+be],be+=k,B[O+1]=de[ve+be],be+=k,B[O+2]=de[ve+be],be+=k,B[O+3]=de[ve+be],O+=4}G--}return B},y=function(I,M,C,k){const B=I[M+3],O=Math.pow(2,B-128)/255;C[k+0]=I[M+0]*O,C[k+1]=I[M+1]*O,C[k+2]=I[M+2]*O,C[k+3]=1},_=function(I,M,C,k){const B=I[M+3],O=Math.pow(2,B-128)/255;C[k+0]=td.toHalfFloat(Math.min(I[M+0]*O,65504)),C[k+1]=td.toHalfFloat(Math.min(I[M+1]*O,65504)),C[k+2]=td.toHalfFloat(Math.min(I[M+2]*O,65504)),C[k+3]=td.toHalfFloat(1)},v=new Uint8Array(e);v.pos=0;const g=f(v),w=g.width,A=g.height,T=m(v.subarray(v.pos),w,A);let L,D,R;switch(this.type){case Ai:R=T.length/4;const I=new Float32Array(R*4);for(let C=0;C<R;C++)y(T,C*4,I,C*4);L=I,D=Ai;break;case yr:R=T.length/4;const M=new Uint16Array(R*4);for(let C=0;C<R;C++)_(T,C*4,M,C*4);L=M,D=yr;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:w,height:A,data:L,header:g.string,gamma:g.gamma,exposure:g.exposure,type:D}}setDataType(e){return this.type=e,this}load(e,t,i,r){function s(o,a){switch(o.type){case Ai:case yr:"colorSpace"in o?o.colorSpace="srgb-linear":o.encoding=3e3,o.minFilter=Gn,o.magFilter=Gn,o.generateMipmaps=!1,o.flipY=!0;break}t&&t(o,a)}return super.load(e,s,i,r)}}const Jg=sL>=152;class nbe extends HD{constructor(e){super(e),this.type=yr}parse(e){const M=Math.pow(2.7182818,2.2);function C(H,K){for(var ae=0,xe=0;xe<65536;++xe)(xe==0||H[xe>>3]&1<<(xe&7))&&(K[ae++]=xe);for(var Me=ae-1;ae<65536;)K[ae++]=0;return Me}function k(H){for(var K=0;K<16384;K++)H[K]={},H[K].len=0,H[K].lit=0,H[K].p=null}const B={l:0,c:0,lc:0};function O(H,K,ae,xe,Me){for(;ae<H;)K=K<<8|ut(xe,Me),ae+=8;ae-=H,B.l=K>>ae&(1<<H)-1,B.c=K,B.lc=ae}const X=new Array(59);function le(H){for(var K=0;K<=58;++K)X[K]=0;for(var K=0;K<65537;++K)X[H[K]]+=1;for(var ae=0,K=58;K>0;--K){var xe=ae+X[K]>>1;X[K]=ae,ae=xe}for(var K=0;K<65537;++K){var Me=H[K];Me>0&&(H[K]=Me|X[Me]++<<6)}}function ie(H,K,ae,xe,Me,z,J){for(var ne=ae,re=0,Q=0;Me<=z;Me++){if(ne.value-ae.value>xe)return!1;O(6,re,Q,H,ne);var ge=B.l;if(re=B.c,Q=B.lc,J[Me]=ge,ge==63){if(ne.value-ae.value>xe)throw"Something wrong with hufUnpackEncTable";O(8,re,Q,H,ne);var _e=B.l+6;if(re=B.c,Q=B.lc,Me+_e>z+1)throw"Something wrong with hufUnpackEncTable";for(;_e--;)J[Me++]=0;Me--}else if(ge>=59){var _e=ge-59+2;if(Me+_e>z+1)throw"Something wrong with hufUnpackEncTable";for(;_e--;)J[Me++]=0;Me--}}le(J)}function de(H){return H&63}function G(H){return H>>6}function $(H,K,ae,xe){for(;K<=ae;K++){var Me=G(H[K]),z=de(H[K]);if(Me>>z)throw"Invalid table entry";if(z>14){var J=xe[Me>>z-14];if(J.len)throw"Invalid table entry";if(J.lit++,J.p){var ne=J.p;J.p=new Array(J.lit);for(var re=0;re<J.lit-1;++re)J.p[re]=ne[re]}else J.p=new Array(1);J.p[J.lit-1]=K}else if(z)for(var Q=0,re=1<<14-z;re>0;re--){var J=xe[(Me<<14-z)+Q];if(J.len||J.p)throw"Invalid table entry";J.len=z,J.lit=K,Q++}}return!0}const te={c:0,lc:0};function ue(H,K,ae,xe){H=H<<8|ut(ae,xe),K+=8,te.c=H,te.lc=K}const ve={c:0,lc:0};function be(H,K,ae,xe,Me,z,J,ne,re,Q){if(H==K){xe<8&&(ue(ae,xe,Me,J),ae=te.c,xe=te.lc),xe-=8;var ge=ae>>xe,ge=new Uint8Array([ge])[0];if(re.value+ge>Q)return!1;for(var _e=ne[re.value-1];ge-- >0;)ne[re.value++]=_e}else if(re.value<Q)ne[re.value++]=H;else return!1;ve.c=ae,ve.lc=xe}function he(H){return H&65535}function Pe(H){var K=he(H);return K>32767?K-65536:K}const Oe={a:0,b:0};function Ce(H,K){var ae=Pe(H),xe=Pe(K),Me=xe,z=ae+(Me&1)+(Me>>1),J=z,ne=z-Me;Oe.a=J,Oe.b=ne}function mt(H,K){var ae=he(H),xe=he(K),Me=ae-(xe>>1)&65535,z=xe+Me-32768&65535;Oe.a=z,Oe.b=Me}function Lt(H,K,ae,xe,Me,z,J){for(var ne=J<16384,re=ae>Me?Me:ae,Q=1,ge;Q<=re;)Q<<=1;for(Q>>=1,ge=Q,Q>>=1;Q>=1;){for(var _e=0,Ze=_e+z*(Me-ge),Be=z*Q,Ge=z*ge,Je=xe*Q,We=xe*ge,Tt,Rt,vt,Ft;_e<=Ze;_e+=Ge){for(var At=_e,rt=_e+xe*(ae-ge);At<=rt;At+=We){var Wt=At+Je,Ut=At+Be,Wn=Ut+Je;ne?(Ce(H[At+K],H[Ut+K]),Tt=Oe.a,vt=Oe.b,Ce(H[Wt+K],H[Wn+K]),Rt=Oe.a,Ft=Oe.b,Ce(Tt,Rt),H[At+K]=Oe.a,H[Wt+K]=Oe.b,Ce(vt,Ft),H[Ut+K]=Oe.a,H[Wn+K]=Oe.b):(mt(H[At+K],H[Ut+K]),Tt=Oe.a,vt=Oe.b,mt(H[Wt+K],H[Wn+K]),Rt=Oe.a,Ft=Oe.b,mt(Tt,Rt),H[At+K]=Oe.a,H[Wt+K]=Oe.b,mt(vt,Ft),H[Ut+K]=Oe.a,H[Wn+K]=Oe.b)}if(ae&Q){var Ut=At+Be;ne?Ce(H[At+K],H[Ut+K]):mt(H[At+K],H[Ut+K]),Tt=Oe.a,H[Ut+K]=Oe.b,H[At+K]=Tt}}if(Me&Q)for(var At=_e,rt=_e+xe*(ae-ge);At<=rt;At+=We){var Wt=At+Je;ne?Ce(H[At+K],H[Wt+K]):mt(H[At+K],H[Wt+K]),Tt=Oe.a,H[Wt+K]=Oe.b,H[At+K]=Tt}ge=Q,Q>>=1}return _e}function St(H,K,ae,xe,Me,z,J,ne,re,Q){for(var ge=0,_e=0,Ze=ne,Be=Math.trunc(Me.value+(z+7)/8);Me.value<Be;)for(ue(ge,_e,ae,Me),ge=te.c,_e=te.lc;_e>=14;){var Ge=ge>>_e-14&16383,Je=K[Ge];if(Je.len)_e-=Je.len,be(Je.lit,J,ge,_e,ae,xe,Me,re,Q,Ze),ge=ve.c,_e=ve.lc;else{if(!Je.p)throw"hufDecode issues";var We;for(We=0;We<Je.lit;We++){for(var Tt=de(H[Je.p[We]]);_e<Tt&&Me.value<Be;)ue(ge,_e,ae,Me),ge=te.c,_e=te.lc;if(_e>=Tt&&G(H[Je.p[We]])==(ge>>_e-Tt&(1<<Tt)-1)){_e-=Tt,be(Je.p[We],J,ge,_e,ae,xe,Me,re,Q,Ze),ge=ve.c,_e=ve.lc;break}}if(We==Je.lit)throw"hufDecode issues"}}var Rt=8-z&7;for(ge>>=Rt,_e-=Rt;_e>0;){var Je=K[ge<<14-_e&16383];if(Je.len)_e-=Je.len,be(Je.lit,J,ge,_e,ae,xe,Me,re,Q,Ze),ge=ve.c,_e=ve.lc;else throw"hufDecode issues"}return!0}function Nt(H,K,ae,xe,Me,z){var J={value:0},ne=ae.value,re=gt(K,ae),Q=gt(K,ae);ae.value+=4;var ge=gt(K,ae);if(ae.value+=4,re<0||re>=65537||Q<0||Q>=65537)throw"Something wrong with HUF_ENCSIZE";var _e=new Array(65537),Ze=new Array(16384);k(Ze);var Be=xe-(ae.value-ne);if(ie(H,K,ae,Be,re,Q,_e),ge>8*(xe-(ae.value-ne)))throw"Something wrong with hufUncompress";$(_e,re,Q,Ze),St(_e,Ze,H,K,ae,ge,Q,z,Me,J)}function ke(H,K,ae){for(var xe=0;xe<ae;++xe)K[xe]=H[K[xe]]}function Ue(H){for(var K=1;K<H.length;K++){var ae=H[K-1]+H[K]-128;H[K]=ae}}function ee(H,K){for(var ae=0,xe=Math.floor((H.length+1)/2),Me=0,z=H.length-1;!(Me>z||(K[Me++]=H[ae++],Me>z));)K[Me++]=H[xe++]}function xt(H){for(var K=H.byteLength,ae=new Array,xe=0,Me=new DataView(H);K>0;){var z=Me.getInt8(xe++);if(z<0){var J=-z;K-=J+1;for(var ne=0;ne<J;ne++)ae.push(Me.getUint8(xe++))}else{var J=z;K-=2;for(var re=Me.getUint8(xe++),ne=0;ne<J+1;ne++)ae.push(re)}}return ae}function je(H,K,ae,xe,Me,z){var Wt=new DataView(z.buffer),J=ae[H.idx[0]].width,ne=ae[H.idx[0]].height,re=3,Q=Math.floor(J/8),ge=Math.ceil(J/8),_e=Math.ceil(ne/8),Ze=J-(ge-1)*8,Be=ne-(_e-1)*8,Ge={value:0},Je=new Array(re),We=new Array(re),Tt=new Array(re),Rt=new Array(re),vt=new Array(re);for(let gn=0;gn<re;++gn)vt[gn]=K[H.idx[gn]],Je[gn]=gn<1?0:Je[gn-1]+ge*_e,We[gn]=new Float32Array(64),Tt[gn]=new Uint16Array(64),Rt[gn]=new Uint16Array(ge*64);for(let gn=0;gn<_e;++gn){var Ft=8;gn==_e-1&&(Ft=Be);var At=8;for(let $t=0;$t<ge;++$t){$t==ge-1&&(At=Ze);for(let Jt=0;Jt<re;++Jt)Tt[Jt].fill(0),Tt[Jt][0]=Me[Je[Jt]++],ht(Ge,xe,Tt[Jt]),$e(Tt[Jt],We[Jt]),Mt(We[Jt]);lt(We);for(let Jt=0;Jt<re;++Jt)Y(We[Jt],Rt[Jt],$t*64)}let Zt=0;for(let $t=0;$t<re;++$t){const Jt=ae[H.idx[$t]].type;for(let hn=8*gn;hn<8*gn+Ft;++hn){Zt=vt[$t][hn];for(let yi=0;yi<Q;++yi){const ei=yi*64+(hn&7)*8;Wt.setUint16(Zt+0*2*Jt,Rt[$t][ei+0],!0),Wt.setUint16(Zt+1*2*Jt,Rt[$t][ei+1],!0),Wt.setUint16(Zt+2*2*Jt,Rt[$t][ei+2],!0),Wt.setUint16(Zt+3*2*Jt,Rt[$t][ei+3],!0),Wt.setUint16(Zt+4*2*Jt,Rt[$t][ei+4],!0),Wt.setUint16(Zt+5*2*Jt,Rt[$t][ei+5],!0),Wt.setUint16(Zt+6*2*Jt,Rt[$t][ei+6],!0),Wt.setUint16(Zt+7*2*Jt,Rt[$t][ei+7],!0),Zt+=8*2*Jt}}if(Q!=ge)for(let hn=8*gn;hn<8*gn+Ft;++hn){const yi=vt[$t][hn]+8*Q*2*Jt,ei=Q*64+(hn&7)*8;for(let yn=0;yn<At;++yn)Wt.setUint16(yi+yn*2*Jt,Rt[$t][ei+yn],!0)}}}for(var rt=new Uint16Array(J),Wt=new DataView(z.buffer),Ut=0;Ut<re;++Ut){ae[H.idx[Ut]].decoded=!0;var Wn=ae[H.idx[Ut]].type;if(ae[Ut].type==2)for(var Yn=0;Yn<ne;++Yn){const gn=vt[Ut][Yn];for(var Pn=0;Pn<J;++Pn)rt[Pn]=Wt.getUint16(gn+Pn*2*Wn,!0);for(var Pn=0;Pn<J;++Pn)Wt.setFloat32(gn+Pn*2*Wn,ye(rt[Pn]),!0)}}}function ht(H,K,ae){for(var xe,Me=1;Me<64;)xe=K[H.value],xe==65280?Me=64:xe>>8==255?Me+=xe&255:(ae[Me]=xe,Me++),H.value++}function $e(H,K){K[0]=ye(H[0]),K[1]=ye(H[1]),K[2]=ye(H[5]),K[3]=ye(H[6]),K[4]=ye(H[14]),K[5]=ye(H[15]),K[6]=ye(H[27]),K[7]=ye(H[28]),K[8]=ye(H[2]),K[9]=ye(H[4]),K[10]=ye(H[7]),K[11]=ye(H[13]),K[12]=ye(H[16]),K[13]=ye(H[26]),K[14]=ye(H[29]),K[15]=ye(H[42]),K[16]=ye(H[3]),K[17]=ye(H[8]),K[18]=ye(H[12]),K[19]=ye(H[17]),K[20]=ye(H[25]),K[21]=ye(H[30]),K[22]=ye(H[41]),K[23]=ye(H[43]),K[24]=ye(H[9]),K[25]=ye(H[11]),K[26]=ye(H[18]),K[27]=ye(H[24]),K[28]=ye(H[31]),K[29]=ye(H[40]),K[30]=ye(H[44]),K[31]=ye(H[53]),K[32]=ye(H[10]),K[33]=ye(H[19]),K[34]=ye(H[23]),K[35]=ye(H[32]),K[36]=ye(H[39]),K[37]=ye(H[45]),K[38]=ye(H[52]),K[39]=ye(H[54]),K[40]=ye(H[20]),K[41]=ye(H[22]),K[42]=ye(H[33]),K[43]=ye(H[38]),K[44]=ye(H[46]),K[45]=ye(H[51]),K[46]=ye(H[55]),K[47]=ye(H[60]),K[48]=ye(H[21]),K[49]=ye(H[34]),K[50]=ye(H[37]),K[51]=ye(H[47]),K[52]=ye(H[50]),K[53]=ye(H[56]),K[54]=ye(H[59]),K[55]=ye(H[61]),K[56]=ye(H[35]),K[57]=ye(H[36]),K[58]=ye(H[48]),K[59]=ye(H[49]),K[60]=ye(H[57]),K[61]=ye(H[58]),K[62]=ye(H[62]),K[63]=ye(H[63])}function Mt(H){const K=.5*Math.cos(.7853975),ae=.5*Math.cos(3.14159/16),xe=.5*Math.cos(3.14159/8),Me=.5*Math.cos(3*3.14159/16),z=.5*Math.cos(5*3.14159/16),J=.5*Math.cos(3*3.14159/8),ne=.5*Math.cos(7*3.14159/16);for(var re=new Array(4),Q=new Array(4),ge=new Array(4),_e=new Array(4),Ze=0;Ze<8;++Ze){var Be=Ze*8;re[0]=xe*H[Be+2],re[1]=J*H[Be+2],re[2]=xe*H[Be+6],re[3]=J*H[Be+6],Q[0]=ae*H[Be+1]+Me*H[Be+3]+z*H[Be+5]+ne*H[Be+7],Q[1]=Me*H[Be+1]-ne*H[Be+3]-ae*H[Be+5]-z*H[Be+7],Q[2]=z*H[Be+1]-ae*H[Be+3]+ne*H[Be+5]+Me*H[Be+7],Q[3]=ne*H[Be+1]-z*H[Be+3]+Me*H[Be+5]-ae*H[Be+7],ge[0]=K*(H[Be+0]+H[Be+4]),ge[3]=K*(H[Be+0]-H[Be+4]),ge[1]=re[0]+re[3],ge[2]=re[1]-re[2],_e[0]=ge[0]+ge[1],_e[1]=ge[3]+ge[2],_e[2]=ge[3]-ge[2],_e[3]=ge[0]-ge[1],H[Be+0]=_e[0]+Q[0],H[Be+1]=_e[1]+Q[1],H[Be+2]=_e[2]+Q[2],H[Be+3]=_e[3]+Q[3],H[Be+4]=_e[3]-Q[3],H[Be+5]=_e[2]-Q[2],H[Be+6]=_e[1]-Q[1],H[Be+7]=_e[0]-Q[0]}for(var Ge=0;Ge<8;++Ge)re[0]=xe*H[16+Ge],re[1]=J*H[16+Ge],re[2]=xe*H[48+Ge],re[3]=J*H[48+Ge],Q[0]=ae*H[8+Ge]+Me*H[24+Ge]+z*H[40+Ge]+ne*H[56+Ge],Q[1]=Me*H[8+Ge]-ne*H[24+Ge]-ae*H[40+Ge]-z*H[56+Ge],Q[2]=z*H[8+Ge]-ae*H[24+Ge]+ne*H[40+Ge]+Me*H[56+Ge],Q[3]=ne*H[8+Ge]-z*H[24+Ge]+Me*H[40+Ge]-ae*H[56+Ge],ge[0]=K*(H[Ge]+H[32+Ge]),ge[3]=K*(H[Ge]-H[32+Ge]),ge[1]=re[0]+re[3],ge[2]=re[1]-re[2],_e[0]=ge[0]+ge[1],_e[1]=ge[3]+ge[2],_e[2]=ge[3]-ge[2],_e[3]=ge[0]-ge[1],H[0+Ge]=_e[0]+Q[0],H[8+Ge]=_e[1]+Q[1],H[16+Ge]=_e[2]+Q[2],H[24+Ge]=_e[3]+Q[3],H[32+Ge]=_e[3]-Q[3],H[40+Ge]=_e[2]-Q[2],H[48+Ge]=_e[1]-Q[1],H[56+Ge]=_e[0]-Q[0]}function lt(H){for(var K=0;K<64;++K){var ae=H[0][K],xe=H[1][K],Me=H[2][K];H[0][K]=ae+1.5747*Me,H[1][K]=ae-.1873*xe-.4682*Me,H[2][K]=ae+1.8556*xe}}function Y(H,K,ae){for(var xe=0;xe<64;++xe)K[ae+xe]=td.toHalfFloat(j(H[xe]))}function j(H){return H<=1?Math.sign(H)*Math.pow(Math.abs(H),2.2):Math.sign(H)*Math.pow(M,Math.abs(H)-1)}function pe(H){return new DataView(H.array.buffer,H.offset.value,H.size)}function Ie(H){var K=H.viewer.buffer.slice(H.offset.value,H.offset.value+H.size),ae=new Uint8Array(xt(K)),xe=new Uint8Array(ae.length);return Ue(ae),ee(ae,xe),new DataView(xe.buffer)}function ze(H){var K=H.array.slice(H.offset.value,H.offset.value+H.size),ae=lw(K),xe=new Uint8Array(ae.length);return Ue(ae),ee(ae,xe),new DataView(xe.buffer)}function Ee(H){for(var K=H.viewer,ae={value:H.offset.value},xe=new Uint16Array(H.width*H.scanlineBlockSize*(H.channels*H.type)),Me=new Uint8Array(8192),z=0,J=new Array(H.channels),ne=0;ne<H.channels;ne++)J[ne]={},J[ne].start=z,J[ne].end=J[ne].start,J[ne].nx=H.width,J[ne].ny=H.lines,J[ne].size=H.type,z+=J[ne].nx*J[ne].ny*J[ne].size;var re=we(K,ae),Q=we(K,ae);if(Q>=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(re<=Q)for(var ne=0;ne<Q-re+1;ne++)Me[ne+re]=oe(K,ae);var ge=new Uint16Array(65536),_e=C(Me,ge),Ze=gt(K,ae);Nt(H.array,K,ae,Ze,xe,z);for(var ne=0;ne<H.channels;++ne)for(var Be=J[ne],Ge=0;Ge<J[ne].size;++Ge)Lt(xe,Be.start+Ge,Be.nx,Be.size,Be.ny,Be.nx*Be.size,_e);ke(ge,xe,z);for(var Je=0,We=new Uint8Array(xe.buffer.byteLength),Tt=0;Tt<H.lines;Tt++)for(var Rt=0;Rt<H.channels;Rt++){var Be=J[Rt],vt=Be.nx*Be.size,Ft=new Uint8Array(xe.buffer,Be.end*2,vt*2);We.set(Ft,Je),Je+=vt*2,Be.end+=vt}return new DataView(We.buffer)}function tt(H){var K=H.array.slice(H.offset.value,H.offset.value+H.size),ae=lw(K);const xe=H.lines*H.channels*H.width,Me=H.type==1?new Uint16Array(xe):new Uint32Array(xe);let z=0,J=0;const ne=new Array(4);for(let re=0;re<H.lines;re++)for(let Q=0;Q<H.channels;Q++){let ge=0;switch(H.type){case 1:ne[0]=z,ne[1]=ne[0]+H.width,z=ne[1]+H.width;for(let _e=0;_e<H.width;++_e){const Ze=ae[ne[0]++]<<8|ae[ne[1]++];ge+=Ze,Me[J]=ge,J++}break;case 2:ne[0]=z,ne[1]=ne[0]+H.width,ne[2]=ne[1]+H.width,z=ne[2]+H.width;for(let _e=0;_e<H.width;++_e){const Ze=ae[ne[0]++]<<24|ae[ne[1]++]<<16|ae[ne[2]++]<<8;ge+=Ze,Me[J]=ge,J++}break}}return new DataView(Me.buffer)}function nt(H){var K=H.viewer,ae={value:H.offset.value},xe=new Uint8Array(H.width*H.lines*(H.channels*H.type*2)),Me={version:Te(K,ae),unknownUncompressedSize:Te(K,ae),unknownCompressedSize:Te(K,ae),acCompressedSize:Te(K,ae),dcCompressedSize:Te(K,ae),rleCompressedSize:Te(K,ae),rleUncompressedSize:Te(K,ae),rleRawSize:Te(K,ae),totalAcUncompressedCount:Te(K,ae),totalDcUncompressedCount:Te(K,ae),acCompression:Te(K,ae)};if(Me.version<2)throw"EXRLoader.parse: "+Di.compression+" version "+Me.version+" is unsupported";for(var z=new Array,J=we(K,ae)-2;J>0;){var ne=ct(K.buffer,ae),re=oe(K,ae),Q=re>>2&3,ge=(re>>4)-1,_e=new Int8Array([ge])[0],Ze=oe(K,ae);z.push({name:ne,index:_e,type:Ze,compression:Q}),J-=ne.length+3}for(var Be=Di.channels,Ge=new Array(H.channels),Je=0;Je<H.channels;++Je){var We=Ge[Je]={},Tt=Be[Je];We.name=Tt.name,We.compression=0,We.decoded=!1,We.type=Tt.pixelType,We.pLinear=Tt.pLinear,We.width=H.width,We.height=H.lines}for(var Rt={idx:new Array(3)},vt=0;vt<H.channels;++vt)for(var We=Ge[vt],Je=0;Je<z.length;++Je){var Ft=z[Je];We.name==Ft.name&&(We.compression=Ft.compression,Ft.index>=0&&(Rt.idx[Ft.index]=vt),We.offset=vt)}if(Me.acCompressedSize>0)switch(Me.acCompression){case 0:var Wt=new Uint16Array(Me.totalAcUncompressedCount);Nt(H.array,K,ae,Me.acCompressedSize,Wt,Me.totalAcUncompressedCount);break;case 1:var At=H.array.slice(ae.value,ae.value+Me.totalAcUncompressedCount),rt=lw(At),Wt=new Uint16Array(rt.buffer);ae.value+=Me.totalAcUncompressedCount;break}if(Me.dcCompressedSize>0){var Ut={array:H.array,offset:ae,size:Me.dcCompressedSize},Wn=new Uint16Array(ze(Ut).buffer);ae.value+=Me.dcCompressedSize}if(Me.rleRawSize>0){var At=H.array.slice(ae.value,ae.value+Me.rleCompressedSize),rt=lw(At),Yn=xt(rt.buffer);ae.value+=Me.rleCompressedSize}for(var Pn=0,gn=new Array(Ge.length),Je=0;Je<gn.length;++Je)gn[Je]=new Array;for(var Zt=0;Zt<H.lines;++Zt)for(var $t=0;$t<Ge.length;++$t)gn[$t].push(Pn),Pn+=Ge[$t].width*H.type*2;je(Rt,gn,Ge,Wt,Wn,xe);for(var Je=0;Je<Ge.length;++Je){var We=Ge[Je];if(!We.decoded)switch(We.compression){case 2:for(var Jt=0,hn=0,Zt=0;Zt<H.lines;++Zt){for(var yi=gn[Je][Jt],ei=0;ei<We.width;++ei){for(var yn=0;yn<2*We.type;++yn)xe[yi++]=Yn[hn+yn*We.width*We.height];hn++}Jt++}break;case 1:default:throw"EXRLoader.parse: unsupported channel compression"}}return new DataView(xe.buffer)}function ct(H,K){for(var ae=new Uint8Array(H),xe=0;ae[K.value+xe]!=0;)xe+=1;var Me=new TextDecoder().decode(ae.slice(K.value,K.value+xe));return K.value=K.value+xe+1,Me}function Yt(H,K,ae){var xe=new TextDecoder().decode(new Uint8Array(H).slice(K.value,K.value+ae));return K.value=K.value+ae,xe}function Xe(H,K){var ae=It(H,K),xe=gt(H,K);return[ae,xe]}function dt(H,K){var ae=gt(H,K),xe=gt(H,K);return[ae,xe]}function It(H,K){var ae=H.getInt32(K.value,!0);return K.value=K.value+4,ae}function gt(H,K){var ae=H.getUint32(K.value,!0);return K.value=K.value+4,ae}function ut(H,K){var ae=H[K.value];return K.value=K.value+1,ae}function oe(H,K){var ae=H.getUint8(K.value);return K.value=K.value+1,ae}const Te=function(H,K){let ae;return"getBigInt64"in DataView.prototype?ae=Number(H.getBigInt64(K.value,!0)):ae=H.getUint32(K.value+4,!0)+Number(H.getUint32(K.value,!0)<<32),K.value+=8,ae};function Ye(H,K){var ae=H.getFloat32(K.value,!0);return K.value+=4,ae}function se(H,K){return td.toHalfFloat(Ye(H,K))}function ye(H){var K=(H&31744)>>10,ae=H&1023;return(H>>15?-1:1)*(K?K===31?ae?NaN:1/0:Math.pow(2,K-15)*(1+ae/1024):6103515625e-14*(ae/1024))}function we(H,K){var ae=H.getUint16(K.value,!0);return K.value+=2,ae}function De(H,K){return ye(we(H,K))}function ot(H,K,ae,xe){for(var Me=ae.value,z=[];ae.value<Me+xe-1;){var J=ct(K,ae),ne=It(H,ae),re=oe(H,ae);ae.value+=3;var Q=It(H,ae),ge=It(H,ae);z.push({name:J,pixelType:ne,pLinear:re,xSampling:Q,ySampling:ge})}return ae.value+=1,z}function it(H,K){var ae=Ye(H,K),xe=Ye(H,K),Me=Ye(H,K),z=Ye(H,K),J=Ye(H,K),ne=Ye(H,K),re=Ye(H,K),Q=Ye(H,K);return{redX:ae,redY:xe,greenX:Me,greenY:z,blueX:J,blueY:ne,whiteX:re,whiteY:Q}}function Ke(H,K){var ae=["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"],xe=oe(H,K);return ae[xe]}function Et(H,K){var ae=gt(H,K),xe=gt(H,K),Me=gt(H,K),z=gt(H,K);return{xMin:ae,yMin:xe,xMax:Me,yMax:z}}function Gt(H,K){var ae=["INCREASING_Y"],xe=oe(H,K);return ae[xe]}function Vt(H,K){var ae=Ye(H,K),xe=Ye(H,K);return[ae,xe]}function _n(H,K){var ae=Ye(H,K),xe=Ye(H,K),Me=Ye(H,K);return[ae,xe,Me]}function sn(H,K,ae,xe,Me){if(xe==="string"||xe==="stringvector"||xe==="iccProfile")return Yt(K,ae,Me);if(xe==="chlist")return ot(H,K,ae,Me);if(xe==="chromaticities")return it(H,ae);if(xe==="compression")return Ke(H,ae);if(xe==="box2i")return Et(H,ae);if(xe==="lineOrder")return Gt(H,ae);if(xe==="float")return Ye(H,ae);if(xe==="v2f")return Vt(H,ae);if(xe==="v3f")return _n(H,ae);if(xe==="int")return It(H,ae);if(xe==="rational")return Xe(H,ae);if(xe==="timecode")return dt(H,ae);if(xe==="preview")return ae.value+=Me,"skipped";ae.value+=Me}function wr(H,K,ae){const xe={};if(H.getUint32(0,!0)!=20000630)throw"THREE.EXRLoader: provided file doesn't appear to be in OpenEXR format.";xe.version=H.getUint8(4);const Me=H.getUint8(5);xe.spec={singleTile:!!(Me&2),longName:!!(Me&4),deepFormat:!!(Me&8),multiPart:!!(Me&16)},ae.value=8;for(var z=!0;z;){var J=ct(K,ae);if(J==0)z=!1;else{var ne=ct(K,ae),re=gt(H,ae),Q=sn(H,K,ae,ne,re);Q===void 0?console.warn(`EXRLoader.parse: skipped unknown header attribute type '${ne}'.`):xe[J]=Q}}if(Me&-5)throw console.error("EXRHeader:",xe),"THREE.EXRLoader: provided file is currently unsupported.";return xe}function mi(H,K,ae,xe,Me){const z={size:0,viewer:K,array:ae,offset:xe,width:H.dataWindow.xMax-H.dataWindow.xMin+1,height:H.dataWindow.yMax-H.dataWindow.yMin+1,channels:H.channels.length,bytesPerLine:null,lines:null,inputSize:null,type:H.channels[0].pixelType,uncompress:null,getter:null,format:null,[Jg?"colorSpace":"encoding"]:null};switch(H.compression){case"NO_COMPRESSION":z.lines=1,z.uncompress=pe;break;case"RLE_COMPRESSION":z.lines=1,z.uncompress=Ie;break;case"ZIPS_COMPRESSION":z.lines=1,z.uncompress=ze;break;case"ZIP_COMPRESSION":z.lines=16,z.uncompress=ze;break;case"PIZ_COMPRESSION":z.lines=32,z.uncompress=Ee;break;case"PXR24_COMPRESSION":z.lines=16,z.uncompress=tt;break;case"DWAA_COMPRESSION":z.lines=32,z.uncompress=nt;break;case"DWAB_COMPRESSION":z.lines=256,z.uncompress=nt;break;default:throw"EXRLoader.parse: "+H.compression+" is unsupported"}if(z.scanlineBlockSize=z.lines,z.type==1)switch(Me){case Ai:z.getter=De,z.inputSize=2;break;case yr:z.getter=we,z.inputSize=2;break}else if(z.type==2)switch(Me){case Ai:z.getter=Ye,z.inputSize=4;break;case yr:z.getter=se,z.inputSize=4}else throw"EXRLoader.parse: unsupported pixelType "+z.type+" for "+H.compression+".";z.blockCount=(H.dataWindow.yMax+1)/z.scanlineBlockSize;for(var J=0;J<z.blockCount;J++)Te(K,xe);z.outputChannels=z.channels==3?4:z.channels;const ne=z.width*z.height*z.outputChannels;switch(Me){case Ai:z.byteArray=new Float32Array(ne),z.channels<z.outputChannels&&z.byteArray.fill(1,0,ne);break;case yr:z.byteArray=new Uint16Array(ne),z.channels<z.outputChannels&&z.byteArray.fill(15360,0,ne);break;default:console.error("THREE.EXRLoader: unsupported type: ",Me);break}return z.bytesPerLine=z.width*z.inputSize*z.channels,z.outputChannels==4?z.format=Vi:z.format=Dv,Jg?z.colorSpace="srgb-linear":z.encoding=3e3,z}const jn=new DataView(e),jo=new Uint8Array(e),vo={value:0},Di=wr(jn,e,vo),tn=mi(Di,jn,jo,vo,this.type),dl={value:0},Xs={R:0,G:1,B:2,A:3,Y:0};for(let H=0;H<tn.height/tn.scanlineBlockSize;H++){const K=gt(jn,vo);tn.size=gt(jn,vo),tn.lines=K+tn.scanlineBlockSize>tn.height?tn.height-K:tn.scanlineBlockSize;const xe=tn.size<tn.lines*tn.bytesPerLine?tn.uncompress(tn):pe(tn);vo.value+=tn.size;for(let Me=0;Me<tn.scanlineBlockSize;Me++){const z=Me+H*tn.scanlineBlockSize;if(z>=tn.height)break;for(let J=0;J<tn.channels;J++){const ne=Xs[Di.channels[J].name];for(let re=0;re<tn.width;re++){dl.value=(Me*(tn.channels*tn.width)+J*tn.width+re)*tn.inputSize;const Q=(tn.height-1-z)*(tn.width*tn.outputChannels)+re*tn.outputChannels+ne;tn.byteArray[Q]=tn.getter(xe,dl)}}}}return{header:Di,width:tn.width,height:tn.height,data:tn.byteArray,format:tn.format,[Jg?"colorSpace":"encoding"]:tn[Jg?"colorSpace":"encoding"],type:this.type}}setDataType(e){return this.type=e,this}load(e,t,i,r){function s(o,a){Jg?o.colorSpace=a.colorSpace:o.encoding=a.encoding,o.minFilter=Gn,o.magFilter=Gn,o.generateMipmaps=!1,o.flipY=!1,t&&t(o,a)}return super.load(e,s,i,r)}}const YC=new WeakMap;class ibe extends Lr{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,r){const s=new Pr(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,o=>{const a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(o,a).then(t).catch(r)},i,r)}decodeDracoFile(e,t,i,r){const s={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i};this.decodeGeometry(e,s).then(t)}decodeGeometry(e,t){for(const l in t.attributeTypes){const c=t.attributeTypes[l];c.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[l]=c.name)}const i=JSON.stringify(t);if(YC.has(e)){const l=YC.get(e);if(l.key===i)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r;const s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(l=>(r=l,new Promise((c,u)=>{r._callbacks[s]={resolve:c,reject:u},r.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{r&&s&&this._releaseTask(r,s)}),YC.set(e,{key:i,promise:a}),a}_createGeometry(e){const t=new un;e.index&&t.setIndex(new Fn(e.index.array,1));for(let i=0;i<e.attributes.length;i++){const r=e.attributes[i],s=r.name,o=r.array,a=r.itemSize;t.setAttribute(s,new Fn(o,a))}return t}_loadLibrary(e,t){const i=new Pr(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((r,s)=>{i.load(e,r,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(i=>{const r=i[0];e||(this.decoderConfig.wasmBinary=i[1]);const s=rbe.toString(),o=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
`);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const r=new Worker(this.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(s){const o=s.data;switch(o.type){case"decode":r._callbacks[o.id].resolve(o);break;case"error":r._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,s){return r._taskLoad>s._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function rbe(){let n,e;onmessage=function(o){const a=o.data;switch(a.type){case"init":n=a.decoderConfig,e=new Promise(function(u){n.onModuleLoaded=function(h){u({draco:h})},DracoDecoderModule(n)});break;case"decode":const l=a.buffer,c=a.taskConfig;e.then(u=>{const h=u.draco,f=new h.Decoder,m=new h.DecoderBuffer;m.Init(new Int8Array(l),l.byteLength);try{const y=t(h,f,m,c),_=y.attributes.map(v=>v.array.buffer);y.index&&_.push(y.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:y},_)}catch(y){console.error(y),self.postMessage({type:"error",id:a.id,error:y.message})}finally{h.destroy(m),h.destroy(f)}});break}};function t(o,a,l,c){const u=c.attributeIDs,h=c.attributeTypes;let f,m;const y=a.GetEncodedGeometryType(l);if(y===o.TRIANGULAR_MESH)f=new o.Mesh,m=a.DecodeBufferToMesh(l,f);else if(y===o.POINT_CLOUD)f=new o.PointCloud,m=a.DecodeBufferToPointCloud(l,f);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!m.ok()||f.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+m.error_msg());const _={index:null,attributes:[]};for(const v in u){const g=self[h[v]];let w,A;if(c.useUniqueIDs)A=u[v],w=a.GetAttributeByUniqueId(f,A);else{if(A=a.GetAttributeId(f,o[u[v]]),A===-1)continue;w=a.GetAttribute(f,A)}_.attributes.push(r(o,a,f,v,g,w))}return y===o.TRIANGULAR_MESH&&(_.index=i(o,a,f)),o.destroy(f),_}function i(o,a,l){const u=l.num_faces()*3,h=u*4,f=o._malloc(h);a.GetTrianglesUInt32Array(l,h,f);const m=new Uint32Array(o.HEAPF32.buffer,f,u).slice();return o._free(f),{array:m,itemSize:1}}function r(o,a,l,c,u,h){const f=h.num_components(),y=l.num_points()*f,_=y*u.BYTES_PER_ELEMENT,v=s(o,u),g=o._malloc(_);a.GetAttributeDataArrayForAllPoints(l,h,v,_,g);const w=new u(o.HEAPF32.buffer,g,y).slice();return o._free(g),{name:c,array:w,itemSize:f}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}let uw;const $C=()=>{if(uw)return uw;const n="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",e="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),i=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if(typeof WebAssembly!="object")return{supported:!1};let r=n;WebAssembly.validate(t)&&(r=e);let s;const o=WebAssembly.instantiate(a(r),{}).then(h=>{s=h.instance,s.exports.__wasm_call_ctors()});function a(h){const f=new Uint8Array(h.length);for(let y=0;y<h.length;++y){const _=h.charCodeAt(y);f[y]=_>96?_-71:_>64?_-65:_>47?_+4:_>46?63:62}let m=0;for(let y=0;y<h.length;++y)f[m++]=f[y]<60?i[f[y]]:(f[y]-60)*64+f[++y];return f.buffer.slice(0,m)}function l(h,f,m,y,_,v){const g=s.exports.sbrk,w=m+3&-4,A=g(w*y),T=g(_.length),L=new Uint8Array(s.exports.memory.buffer);L.set(_,T);const D=h(A,m,y,T,_.length);if(D===0&&v&&v(A,w,y),f.set(L.subarray(A,A+m*y)),g(A-g(0)),D!==0)throw new Error(`Malformed buffer data: ${D}`)}const c={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},u={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return uw={ready:o,supported:!0,decodeVertexBuffer(h,f,m,y,_){l(s.exports.meshopt_decodeVertexBuffer,h,f,m,y,s.exports[c[_]])},decodeIndexBuffer(h,f,m,y){l(s.exports.meshopt_decodeIndexBuffer,h,f,m,y)},decodeIndexSequence(h,f,m,y){l(s.exports.meshopt_decodeIndexSequence,h,f,m,y)},decodeGltfBuffer(h,f,m,y,_,v){l(s.exports[u[_]],h,f,m,y,s.exports[c[v]])}},uw};let hw=null,eq="https://www.gstatic.com/draco/versioned/decoders/1.5.5/";function tq(n=!0,e=!0,t){return i=>{t&&t(i),n&&(hw||(hw=new ibe),hw.setDecoderPath(typeof n=="string"?n:eq),i.setDRACOLoader(hw)),e&&i.setMeshoptDecoder(typeof $C=="function"?$C():$C)}}const Yv=(n,e,t,i)=>hc(oL,n,tq(e,t,i));Yv.preload=(n,e,t,i)=>hc.preload(oL,n,tq(e,t,i));Yv.clear=n=>hc.clear(oL,n);Yv.setDecoderPath=n=>{eq=n};const sbe=V.forwardRef(({makeDefault:n,camera:e,regress:t,domElement:i,enableDamping:r=!0,keyEvents:s=!1,onChange:o,onStart:a,onEnd:l,...c},u)=>{const h=gs(D=>D.invalidate),f=gs(D=>D.camera),m=gs(D=>D.gl),y=gs(D=>D.events),_=gs(D=>D.setEvents),v=gs(D=>D.set),g=gs(D=>D.get),w=gs(D=>D.performance),A=e||f,T=i||y.connected||m.domElement,L=V.useMemo(()=>new yTe(A),[A]);return iL(()=>{L.enabled&&L.update()},-1),V.useEffect(()=>(s&&L.connect(s===!0?T:s),L.connect(T),()=>void L.dispose()),[s,T,t,L,h]),V.useEffect(()=>{const D=M=>{h(),t&&w.regress(),o&&o(M)},R=M=>{a&&a(M)},I=M=>{l&&l(M)};return L.addEventListener("change",D),L.addEventListener("start",R),L.addEventListener("end",I),()=>{L.removeEventListener("start",R),L.removeEventListener("end",I),L.removeEventListener("change",D)}},[o,a,l,L,h,_]),V.useEffect(()=>{if(n){const D=g().controls;return v({controls:L}),()=>v({controls:D})}},[n,L]),V.createElement("primitive",q0({ref:u,object:L,enableDamping:r},c))}),obe=3e3,abe=3001,nq=(n,e,t)=>{let i;switch(n){case Ws:i=new Uint8ClampedArray(e*t*4);break;case yr:i=new Uint16Array(e*t*4);break;case ll:i=new Uint32Array(e*t*4);break;case uS:i=new Int8Array(e*t*4);break;case hS:i=new Int16Array(e*t*4);break;case Nv:i=new Int32Array(e*t*4);break;case Ai:i=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return i};let dw;const lbe=(n,e,t,i)=>{if(dw!==void 0)return dw;const r=new Ss(1,1,i);e.setRenderTarget(r);const s=new fi(new yc,new Fs({color:16777215}));e.render(s,t),e.setRenderTarget(null);const o=nq(n,r.width,r.height);return e.readRenderTargetPixels(r,0,0,r.width,r.height,o),r.dispose(),s.geometry.dispose(),s.material.dispose(),dw=o[0]!==0,dw};class aL{constructor(e){Ci(this,"_renderer");Ci(this,"_rendererIsDisposable",!1);Ci(this,"_material");Ci(this,"_scene");Ci(this,"_camera");Ci(this,"_quad");Ci(this,"_renderTarget");Ci(this,"_width");Ci(this,"_height");Ci(this,"_type");Ci(this,"_colorSpace");Ci(this,"_supportsReadPixels",!0);Ci(this,"render",()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)});var i,r,s,o,a,l,c,u,h,f,m,y,_,v,g,w;this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const t={format:Vi,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:((i=e.renderTargetOptions)==null?void 0:i.anisotropy)!==void 0?(r=e.renderTargetOptions)==null?void 0:r.anisotropy:1,generateMipmaps:((s=e.renderTargetOptions)==null?void 0:s.generateMipmaps)!==void 0?(o=e.renderTargetOptions)==null?void 0:o.generateMipmaps:!1,magFilter:((a=e.renderTargetOptions)==null?void 0:a.magFilter)!==void 0?(l=e.renderTargetOptions)==null?void 0:l.magFilter:Gn,minFilter:((c=e.renderTargetOptions)==null?void 0:c.minFilter)!==void 0?(u=e.renderTargetOptions)==null?void 0:u.minFilter:Gn,samples:((h=e.renderTargetOptions)==null?void 0:h.samples)!==void 0?(f=e.renderTargetOptions)==null?void 0:f.samples:void 0,wrapS:((m=e.renderTargetOptions)==null?void 0:m.wrapS)!==void 0?(y=e.renderTargetOptions)==null?void 0:y.wrapS:Ui,wrapT:((_=e.renderTargetOptions)==null?void 0:_.wrapT)!==void 0?(v=e.renderTargetOptions)==null?void 0:v.wrapT:Ui};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=aL.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new Uv,this._camera=new tl,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!lbe(this._type,this._renderer,this._camera,t)){let A;switch(this._type){case yr:A=this._renderer.extensions.has("EXT_color_buffer_float")?Ai:void 0;break}A!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${Ai}`),this._type=A):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new fi(new yc,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new Ss(this.width,this.height,t),this._renderTarget.texture.mapping=((g=e.renderTargetOptions)==null?void 0:g.mapping)!==void 0?(w=e.renderTargetOptions)==null?void 0:w.mapping:Vu}static instantiateRenderer(){const e=new CD;return e.setSize(128,128),e}toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=nq(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new ya(this.toArray(),this.width,this.height,Vi,this._type,(e==null?void 0:e.mapping)||Vu,(e==null?void 0:e.wrapS)||Ui,(e==null?void 0:e.wrapT)||Ui,(e==null?void 0:e.magFilter)||Gn,(e==null?void 0:e.minFilter)||Gn,(e==null?void 0:e.anisotropy)||1,cl);return t.generateMipmaps=(e==null?void 0:e.generateMipmaps)!==void 0?e==null?void 0:e.generateMipmaps:!1,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof ss&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof qn&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof qn&&t.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class iq extends Error{}class rq extends Error{}const Qg=(n,e,t)=>{const i=new RegExp(`${e}="([^"]*)"`,"i").exec(n);if(i)return i[1];const r=new RegExp(`<${e}[^>]*>([\\s\\S]*?)</${e}>`,"i").exec(n);if(r){const s=r[1].match(/<rdf:li>([^<]*)<\/rdf:li>/g);return s&&s.length===3?s.map(o=>o.replace(/<\/?rdf:li>/g,"")):r[1].trim()}if(t!==void 0)return t;throw new Error(`Can't find ${e} in gainmap metadata`)},cbe=n=>{let e;typeof TextDecoder<"u"?e=new TextDecoder().decode(n):e=n.toString();let t=e.indexOf("<x:xmpmeta");for(;t!==-1;){const i=e.indexOf("x:xmpmeta>",t),r=e.slice(t,i+10);try{const s=Qg(r,"hdrgm:GainMapMin","0"),o=Qg(r,"hdrgm:GainMapMax"),a=Qg(r,"hdrgm:Gamma","1"),l=Qg(r,"hdrgm:OffsetSDR","0.015625"),c=Qg(r,"hdrgm:OffsetHDR","0.015625"),u=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(r),h=u?u[1]:"0",f=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(r);if(!f)throw new Error("Incomplete gainmap metadata");const m=f[1];return{gainMapMin:Array.isArray(s)?s.map(y=>parseFloat(y)):[parseFloat(s),parseFloat(s),parseFloat(s)],gainMapMax:Array.isArray(o)?o.map(y=>parseFloat(y)):[parseFloat(o),parseFloat(o),parseFloat(o)],gamma:Array.isArray(a)?a.map(y=>parseFloat(y)):[parseFloat(a),parseFloat(a),parseFloat(a)],offsetSdr:Array.isArray(l)?l.map(y=>parseFloat(y)):[parseFloat(l),parseFloat(l),parseFloat(l)],offsetHdr:Array.isArray(c)?c.map(y=>parseFloat(y)):[parseFloat(c),parseFloat(c),parseFloat(c)],hdrCapacityMin:parseFloat(h),hdrCapacityMax:parseFloat(m)}}catch{}t=e.indexOf("<x:xmpmeta",i)}};class ube{constructor(e){Ci(this,"options");this.options={debug:e&&e.debug!==void 0?e.debug:!1,extractFII:e&&e.extractFII!==void 0?e.extractFII:!0,extractNonFII:e&&e.extractNonFII!==void 0?e.extractNonFII:!0}}extract(e){return new Promise((t,i)=>{const r=this.options.debug,s=new DataView(e.buffer);if(s.getUint16(0)!==65496){i(new Error("Not a valid jpeg"));return}const o=s.byteLength;let a=2,l=0,c;for(;a<o;){if(++l>250){i(new Error(`Found no marker after ${l} loops 😵`));return}if(s.getUint8(a)!==255){i(new Error(`Not a valid marker at offset 0x${a.toString(16)}, found: 0x${s.getUint8(a).toString(16)}`));return}if(c=s.getUint8(a+1),r&&console.log(`Marker: ${c.toString(16)}`),c===226){r&&console.log("Found APP2 marker (0xffe2)");const u=a+4;if(s.getUint32(u)===1297106432){const h=u+4;let f;if(s.getUint16(h)===18761)f=!1;else if(s.getUint16(h)===19789)f=!0;else{i(new Error("No valid endianness marker found in TIFF header"));return}if(s.getUint16(h+2,!f)!==42){i(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const m=s.getUint32(h+4,!f);if(m<8){i(new Error("Not valid TIFF data! (First offset less than 8)"));return}const y=h+m,_=s.getUint16(y,!f),v=y+2;let g=0;for(let L=v;L<v+12*_;L+=12)s.getUint16(L,!f)===45057&&(g=s.getUint32(L+8,!f));const A=y+2+_*12+4,T=[];for(let L=A;L<A+g*16;L+=16){const D={MPType:s.getUint32(L,!f),size:s.getUint32(L+4,!f),dataOffset:s.getUint32(L+8,!f),dependantImages:s.getUint32(L+12,!f),start:-1,end:-1,isFII:!1};D.dataOffset?(D.start=h+D.dataOffset,D.isFII=!1):(D.start=0,D.isFII=!0),D.end=D.start+D.size,T.push(D)}if(this.options.extractNonFII&&T.length){const L=new Blob([s]),D=[];for(const R of T){if(R.isFII&&!this.options.extractFII)continue;const I=L.slice(R.start,R.end+1,"image/jpeg");D.push(I)}t(D)}}}a+=2+s.getUint16(a+2)}})}}const hbe=async n=>{const e=cbe(n);if(!e)throw new rq("Gain map XMP metadata not found");const i=await new ube({extractFII:!0,extractNonFII:!0}).extract(n);if(i.length!==2)throw new iq("Gain map recovery image not found");return{sdr:new Uint8Array(await i[0].arrayBuffer()),gainMap:new Uint8Array(await i[1].arrayBuffer()),metadata:e}},Y5=n=>new Promise((e,t)=>{const i=document.createElement("img");i.onload=()=>{e(i)},i.onerror=r=>{t(r)},i.src=URL.createObjectURL(n)});class dbe extends Lr{constructor(t,i){super(i);Ci(this,"_renderer");Ci(this,"_renderTargetOptions");Ci(this,"_internalLoadingManager");Ci(this,"_config");this._config=t,t.renderer&&(this._renderer=t.renderer),this._internalLoadingManager=new FS}setRenderer(t){return this._renderer=t,this}setRenderTargetOptions(t){return this._renderTargetOptions=t,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const t=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new qn,sdr:new qn});return this._config.createQuadRenderer({width:16,height:16,type:yr,colorSpace:cl,material:t,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(t,i,r){const s=i?new Blob([i],{type:"image/jpeg"}):void 0,o=new Blob([t],{type:"image/jpeg"});let a,l,c=!1;if(typeof createImageBitmap>"u"){const u=await Promise.all([s?Y5(s):Promise.resolve(void 0),Y5(o)]);l=u[0],a=u[1],c=r==="flipY"}else{const u=await Promise.all([s?createImageBitmap(s,{imageOrientation:r||"flipY"}):Promise.resolve(void 0),createImageBitmap(o,{imageOrientation:r||"flipY"})]);l=u[0],a=u[1]}return{sdrImage:a,gainMapImage:l,needsFlip:c}}createTextures(t,i,r){const s=new qn(i||new ImageData(2,2),Vu,Ui,Ui,Gn,bR,Vi,Ws,1,cl);s.flipY=r,s.needsUpdate=!0;const o=new qn(t,Vu,Ui,Ui,Gn,bR,Vi,Ws,1,ys);return o.flipY=r,o.needsUpdate=!0,{gainMap:s,sdr:o}}updateQuadRenderer(t,i,r,s,o){t.width=i.width,t.height=i.height,t.material.gainMap=r,t.material.sdr=s,t.material.gainMapMin=o.gainMapMin,t.material.gainMapMax=o.gainMapMax,t.material.offsetHdr=o.offsetHdr,t.material.offsetSdr=o.offsetSdr,t.material.gamma=o.gamma,t.material.hdrCapacityMin=o.hdrCapacityMin,t.material.hdrCapacityMax=o.hdrCapacityMax,t.material.maxDisplayBoost=Math.pow(2,o.hdrCapacityMax),t.material.needsUpdate=!0}}const fbe=`
varying vec2 vUv;

void main() {
  vUv = uv;
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
`,pbe=`
// min half float value
#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )
// max half float value
#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )

uniform sampler2D sdr;
uniform sampler2D gainMap;
uniform vec3 gamma;
uniform vec3 offsetHdr;
uniform vec3 offsetSdr;
uniform vec3 gainMapMin;
uniform vec3 gainMapMax;
uniform float weightFactor;

varying vec2 vUv;

void main() {
  vec3 rgb = texture2D( sdr, vUv ).rgb;
  vec3 recovery = texture2D( gainMap, vUv ).rgb;
  vec3 logRecovery = pow( recovery, gamma );
  vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;
  vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;
  vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));
  gl_FragColor = vec4( clampedHdrColor , 1.0 );
}
`;class mbe extends ss{constructor({gamma:t,offsetHdr:i,offsetSdr:r,gainMapMin:s,gainMapMax:o,maxDisplayBoost:a,hdrCapacityMin:l,hdrCapacityMax:c,sdr:u,gainMap:h}){super({name:"GainMapDecoderMaterial",vertexShader:fbe,fragmentShader:pbe,uniforms:{sdr:{value:u},gainMap:{value:h},gamma:{value:new q(1/t[0],1/t[1],1/t[2])},offsetHdr:{value:new q().fromArray(i)},offsetSdr:{value:new q().fromArray(r)},gainMapMin:{value:new q().fromArray(s)},gainMapMax:{value:new q().fromArray(o)},weightFactor:{value:(Math.log2(a)-l)/(c-l)}},blending:Za,depthTest:!1,depthWrite:!1});Ci(this,"_maxDisplayBoost");Ci(this,"_hdrCapacityMin");Ci(this,"_hdrCapacityMax");this._maxDisplayBoost=a,this._hdrCapacityMin=l,this._hdrCapacityMax=c,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(t){this.uniforms.sdr.value=t}get gainMap(){return this.uniforms.gainMap.value}set gainMap(t){this.uniforms.gainMap.value=t}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(t){this.uniforms.offsetHdr.value.fromArray(t)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(t){this.uniforms.offsetSdr.value.fromArray(t)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(t){this.uniforms.gainMapMin.value.fromArray(t)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(t){this.uniforms.gainMapMax.value.fromArray(t)}get gamma(){const t=this.uniforms.gamma.value;return[1/t.x,1/t.y,1/t.z]}set gamma(t){const i=this.uniforms.gamma.value;i.x=1/t[0],i.y=1/t[1],i.z=1/t[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(t){this._hdrCapacityMin=t,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(t){this._hdrCapacityMax=t,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(t){this._maxDisplayBoost=Math.max(1,Math.min(65504,t)),this.calculateWeight()}calculateWeight(){const t=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,t))}}class sq extends dbe{constructor(e,t){super({renderer:e,createMaterial:i=>new mbe(i),createQuadRenderer:i=>new aL(i)},t)}async render(e,t,i,r){const{sdrImage:s,gainMapImage:o,needsFlip:a}=await this.processImages(i,r,"flipY"),{gainMap:l,sdr:c}=this.createTextures(s,o,a);this.updateQuadRenderer(e,s,l,c,t),e.render()}}class gbe extends sq{load([e,t,i],r,s,o){const a=this.prepareQuadRenderer();let l,c,u;const h=async()=>{if(l&&c&&u){try{await this.render(a,u,l,c)}catch(M){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(i),typeof o=="function"&&o(M),a.disposeOnDemandRenderer();return}typeof r=="function"&&r(a),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(i),a.disposeOnDemandRenderer()}};let f=!0,m=0,y=0,_=!0,v=0,g=0,w=!0,A=0,T=0;const L=()=>{if(typeof s=="function"){const M=m+v+A,C=y+g+T,k=f&&_&&w;s(new ProgressEvent("progress",{lengthComputable:k,loaded:C,total:M}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(i);const D=new Pr(this._internalLoadingManager);D.setResponseType("arraybuffer"),D.setRequestHeader(this.requestHeader),D.setPath(this.path),D.setWithCredentials(this.withCredentials),D.load(e,async M=>{if(typeof M=="string")throw new Error("Invalid sdr buffer");l=M,await h()},M=>{f=M.lengthComputable,y=M.loaded,m=M.total,L()},M=>{this.manager.itemError(e),typeof o=="function"&&o(M)});const R=new Pr(this._internalLoadingManager);R.setResponseType("arraybuffer"),R.setRequestHeader(this.requestHeader),R.setPath(this.path),R.setWithCredentials(this.withCredentials),R.load(t,async M=>{if(typeof M=="string")throw new Error("Invalid gainmap buffer");c=M,await h()},M=>{_=M.lengthComputable,g=M.loaded,v=M.total,L()},M=>{this.manager.itemError(t),typeof o=="function"&&o(M)});const I=new Pr(this._internalLoadingManager);return I.setRequestHeader(this.requestHeader),I.setPath(this.path),I.setWithCredentials(this.withCredentials),I.load(i,async M=>{if(typeof M!="string")throw new Error("Invalid metadata string");u=JSON.parse(M),await h()},M=>{w=M.lengthComputable,T=M.loaded,A=M.total,L()},M=>{this.manager.itemError(i),typeof o=="function"&&o(M)}),a}}class ybe extends sq{load(e,t,i,r){const s=this.prepareQuadRenderer(),o=new Pr(this._internalLoadingManager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(this.withCredentials),this.manager.itemStart(e),o.load(e,async a=>{if(typeof a=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const l=new Uint8Array(a);let c,u,h;try{const f=await hbe(l);c=f.sdr,u=f.gainMap,h=f.metadata}catch(f){if(f instanceof rq||f instanceof iq)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),h={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},c=l;else throw f}try{await this.render(s,h,c.buffer,u==null?void 0:u.buffer)}catch(f){this.manager.itemError(e),typeof r=="function"&&r(f),s.disposeOnDemandRenderer();return}typeof t=="function"&&t(s),this.manager.itemEnd(e),s.disposeOnDemandRenderer()},i,a=>{this.manager.itemError(e),typeof r=="function"&&r(a)}),s}}const Y0={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},oq="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",Up=n=>Array.isArray(n),lL=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function VS({files:n=lL,path:e="",preset:t=void 0,encoding:i=void 0,extensions:r}={}){let s=null,o=!1;t&&(cL(t),n=Y0[t],e=oq),o=Up(n);const{extension:a,isCubemap:l}=uL(n);if(s=hL(a),!s)throw new Error("useEnvironment: Unrecognized file extension: "+n);const c=gs(m=>m.gl);V.useLayoutEffect(()=>{if(a!=="webp"&&a!=="jpg"&&a!=="jpeg")return;function m(){hc.clear(s,o?[n]:n)}c.domElement.addEventListener("webglcontextlost",m,{once:!0})},[n,c.domElement]);const u=hc(s,o?[n]:n,m=>{(a==="webp"||a==="jpg"||a==="jpeg")&&m.setRenderer(c),m.setPath==null||m.setPath(e),r&&r(m)});let h=o?u[0]:u;if(a==="jpg"||a==="jpeg"||a==="webp"){var f;h=(f=h.renderTarget)==null?void 0:f.texture}return h.mapping=l?al:ym,"colorSpace"in h?h.colorSpace=i??l?"srgb":"srgb-linear":h.encoding=i??l?abe:obe,h}const vbe={files:lL,path:"",preset:void 0,extensions:void 0};VS.preload=n=>{const e={...vbe,...n};let{files:t,path:i=""}=e;const{preset:r,extensions:s}=e;r&&(cL(r),t=Y0[r],i=oq);const{extension:o}=uL(t);if(o==="webp"||o==="jpg"||o==="jpeg")throw new Error("useEnvironment: Preloading gainmaps is not supported");const a=hL(o);if(!a)throw new Error("useEnvironment: Unrecognized file extension: "+t);hc.preload(a,Up(t)?[t]:t,l=>{l.setPath==null||l.setPath(i),s&&s(l)})};const _be={files:lL,preset:void 0};VS.clear=n=>{const e={..._be,...n};let{files:t}=e;const{preset:i}=e;i&&(cL(i),t=Y0[i]);const{extension:r}=uL(t),s=hL(r);if(!s)throw new Error("useEnvironment: Unrecognized file extension: "+t);hc.clear(s,Up(t)?[t]:t)};function cL(n){if(!(n in Y0))throw new Error("Preset must be one of: "+Object.keys(Y0).join(", "))}function uL(n){var e;const t=Up(n)&&n.length===6,i=Up(n)&&n.length===3&&n.some(o=>o.endsWith("json")),r=Up(n)?n[0]:n;return{extension:t?"cube":i?"webp":r.startsWith("data:application/exr")?"exr":r.startsWith("data:application/hdr")?"hdr":r.startsWith("data:image/jpeg")?"jpg":(e=r.split(".").pop())==null||(e=e.split("?"))==null||(e=e.shift())==null?void 0:e.toLowerCase(),isCubemap:t,isGainmap:i}}function hL(n){return n==="cube"?lX:n==="hdr"?tbe:n==="exr"?nbe:n==="jpg"||n==="jpeg"?ybe:n==="webp"?gbe:null}const xbe=n=>n.current&&n.current.isScene,wbe=n=>xbe(n)?n.current:n;function dL(n,e,t,i,r={}){var s,o,a,l;r={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...r};const c=wbe(e||t),u=c.background,h=c.environment,f={backgroundBlurriness:c.backgroundBlurriness,backgroundIntensity:c.backgroundIntensity,backgroundRotation:(s=(o=c.backgroundRotation)==null||o.clone==null?void 0:o.clone())!==null&&s!==void 0?s:[0,0,0],environmentIntensity:c.environmentIntensity,environmentRotation:(a=(l=c.environmentRotation)==null||l.clone==null?void 0:l.clone())!==null&&a!==void 0?a:[0,0,0]};return n!=="only"&&(c.environment=i),n&&(c.background=i),jc(c,r),()=>{n!=="only"&&(c.environment=h),n&&(c.background=u),jc(c,f)}}function fL({scene:n,background:e=!1,map:t,...i}){const r=gs(s=>s.scene);return V.useLayoutEffect(()=>{if(t)return dL(e,n,r,t,i)}),null}function aq({background:n=!1,scene:e,blur:t,backgroundBlurriness:i,backgroundIntensity:r,backgroundRotation:s,environmentIntensity:o,environmentRotation:a,...l}){const c=VS(l),u=gs(h=>h.scene);return V.useLayoutEffect(()=>dL(n,e,u,c,{backgroundBlurriness:t??i,backgroundIntensity:r,backgroundRotation:s,environmentIntensity:o,environmentRotation:a})),V.useEffect(()=>()=>{c.dispose()},[c]),null}function Ebe({children:n,near:e=.1,far:t=1e3,resolution:i=256,frames:r=1,map:s,background:o=!1,blur:a,backgroundBlurriness:l,backgroundIntensity:c,backgroundRotation:u,environmentIntensity:h,environmentRotation:f,scene:m,files:y,path:_,preset:v=void 0,extensions:g}){const w=gs(I=>I.gl),A=gs(I=>I.scene),T=V.useRef(null),[L]=V.useState(()=>new Uv),D=V.useMemo(()=>{const I=new AD(i);return I.texture.type=yr,I},[i]);V.useEffect(()=>()=>{D.dispose()},[D]),V.useLayoutEffect(()=>{if(r===1){const I=w.autoClear;w.autoClear=!0,T.current.update(w,L),w.autoClear=I}return dL(o,m,A,D.texture,{backgroundBlurriness:a??l,backgroundIntensity:c,backgroundRotation:u,environmentIntensity:h,environmentRotation:f})},[n,L,D.texture,m,A,o,r,w]);let R=1;return iL(()=>{if(r===1/0||R<r){const I=w.autoClear;w.autoClear=!0,T.current.update(w,L),w.autoClear=I,R++}}),V.createElement(V.Fragment,null,RSe(V.createElement(V.Fragment,null,n,V.createElement("cubeCamera",{ref:T,args:[e,t,D]}),y||v?V.createElement(aq,{background:!0,files:y,preset:v,path:_,extensions:g}):s?V.createElement(fL,{background:!0,map:s,extensions:g}):null),L))}function Abe(n){var e,t,i,r;const s=VS(n),o=n.map||s;V.useMemo(()=>IX({GroundProjectedEnvImpl:cTe}),[]),V.useEffect(()=>()=>{s.dispose()},[s]);const a=V.useMemo(()=>[o],[o]),l=(e=n.ground)==null?void 0:e.height,c=(t=n.ground)==null?void 0:t.radius,u=(i=(r=n.ground)==null?void 0:r.scale)!==null&&i!==void 0?i:1e3;return V.createElement(V.Fragment,null,V.createElement(fL,q0({},n,{map:o})),V.createElement("groundProjectedEnvImpl",{args:a,scale:u,height:l,radius:c}))}function Sbe(n){return n.ground?V.createElement(Abe,n):n.map?V.createElement(fL,n):n.children?V.createElement(Ebe,n):V.createElement(aq,n)}const Tbe=V.forwardRef(({scale:n=10,frames:e=1/0,opacity:t=1,width:i=1,height:r=1,blur:s=1,near:o=0,far:a=10,resolution:l=512,smooth:c=!0,color:u="#000000",depthWrite:h=!1,renderOrder:f,...m},y)=>{const _=V.useRef(null),v=gs(X=>X.scene),g=gs(X=>X.gl),w=V.useRef(null);i=i*(Array.isArray(n)?n[0]:n||1),r=r*(Array.isArray(n)?n[1]:n||1);const[A,T,L,D,R,I,M]=V.useMemo(()=>{const X=new Ss(l,l),le=new Ss(l,l);le.texture.generateMipmaps=X.texture.generateMipmaps=!1;const ie=new yc(i,r).rotateX(Math.PI/2),de=new fi(ie),G=new _S;G.depthTest=G.depthWrite=!1,G.onBeforeCompile=ue=>{ue.uniforms={...ue.uniforms,ucolor:{value:new ft(u)}},ue.fragmentShader=ue.fragmentShader.replace("void main() {",`uniform vec3 ucolor;
           void main() {
          `),ue.fragmentShader=ue.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const $=new ss(ZTe),te=new ss(ebe);return te.depthTest=$.depthTest=!1,[X,ie,G,de,$,te,le]},[l,i,r,n,u]),C=X=>{D.visible=!0,D.material=R,R.uniforms.tDiffuse.value=A.texture,R.uniforms.h.value=X*1/256,g.setRenderTarget(M),g.render(D,w.current),D.material=I,I.uniforms.tDiffuse.value=M.texture,I.uniforms.v.value=X*1/256,g.setRenderTarget(A),g.render(D,w.current),D.visible=!1};let k=0,B,O;return iL(()=>{w.current&&(e===1/0||k<e)&&(k++,B=v.background,O=v.overrideMaterial,_.current.visible=!1,v.background=null,v.overrideMaterial=L,g.setRenderTarget(A),g.render(v,w.current),C(s),c&&C(s*.4),g.setRenderTarget(null),_.current.visible=!0,v.overrideMaterial=O,v.background=B)}),V.useImperativeHandle(y,()=>_.current,[]),V.createElement("group",q0({"rotation-x":Math.PI/2},m,{ref:_}),V.createElement("mesh",{renderOrder:f,geometry:T,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},V.createElement("meshBasicMaterial",{transparent:!0,map:A.texture,opacity:t,depthWrite:h})),V.createElement("orthographicCamera",{ref:w,args:[-i/2,i/2,r/2,-r/2,o,a]}))}),bbe="https://cdn.discordapp.com/attachments/1475095229186179095/1475153775680557340/Untitled17_20250215003249.png?ex=699c7383&is=699b2203&hm=339648575ff0039eb743f8bee6cd3b53b3a428419ddfb64e0b56f61d6e801320&";function Cbe(){const{scene:n}=Yv("/models/Model_2.glb");return S.jsx("primitive",{object:n,scale:.9,position:[0,-.95,0],rotation:[0,0,0]})}Yv.preload("/models/Model_2.glb");const Mbe=[{name:"Shirt",icon:nG,rarity:"common"},{name:"Crown",icon:fd,rarity:"legendary"},{name:"Glasses",icon:TQ,rarity:"rare"},{name:"Backpack",icon:vQ,rarity:"common"}],Ibe=[{name:"Wings",icon:KP,price:"500",rarity:"epic"},{name:"Shield",icon:OQ,price:"350",rarity:"rare"},{name:"Crown",icon:fd,price:"1200",rarity:"legendary"},{name:"Cape",icon:nG,price:"200",rarity:"common"}],Rbe={common:"from-zinc-500/15 via-zinc-400/5 to-transparent",rare:"from-blue-500/20 via-blue-400/5 to-transparent",epic:"from-purple-500/25 via-purple-400/5 to-transparent",legendary:"from-amber-400/30 via-yellow-300/8 to-transparent"},Pbe={common:"",rare:"shadow-[0_4px_20px_-4px_rgba(59,130,246,0.25)]",epic:"shadow-[0_4px_20px_-4px_rgba(147,51,234,0.3)]",legendary:"shadow-[0_4px_20px_-4px_rgba(245,158,11,0.35)]"},Nbe={common:"border-border/30",rare:"border-blue-400/30",epic:"border-purple-400/30",legendary:"border-amber-400/40"},Dbe=()=>{const[n,e]=V.useState("personalize"),[t,i]=V.useState("All"),[r,s]=V.useState(""),[o,a]=V.useState(!1),[l,c]=V.useState(1),[u,h]=V.useState(null),f=["All","Avatars","Clothes","Accessory"],y=(n==="personalize"?Mbe:Ibe).filter(_=>_.name.toLowerCase().includes(r.toLowerCase()));return S.jsxs("div",{className:"flex flex-col min-h-full pb-32 bg-background",children:[S.jsxs("div",{className:"h-[42vh] relative overflow-hidden flex items-center justify-center",style:{background:"linear-gradient(180deg, #08080c 0%, #0e0e18 40%, #141420 100%)"},children:[S.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[200px] h-[200px] rounded-full blur-[100px] opacity-40",style:{background:"radial-gradient(circle, hsl(var(--primary) / 0.3), transparent 70%)"}}),S.jsx("div",{className:"absolute top-[60%] left-1/2 -translate-x-1/2 -translate-y-1/2 w-[300px] h-[80px] rounded-full blur-[60px] opacity-30",style:{background:"radial-gradient(ellipse, hsl(var(--primary) / 0.2), transparent 70%)"}}),S.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-28 z-[2]",style:{background:"linear-gradient(to top, hsl(var(--card)), transparent)"}}),S.jsxs(qSe,{camera:{position:[0,.15,2.6],fov:40},style:{position:"absolute",inset:0,zIndex:1},gl:{antialias:!0,alpha:!0},children:[S.jsx("ambientLight",{intensity:.3}),S.jsx("directionalLight",{position:[3,5,4],intensity:2.5,castShadow:!0,color:"#ffffff"}),S.jsx("directionalLight",{position:[-4,3,-2],intensity:.4,color:"#4466aa"}),S.jsx("spotLight",{position:[0,4,2],intensity:.8,angle:.5,penumbra:.8,color:"#ff5533"}),S.jsxs(V.Suspense,{fallback:null,children:[S.jsx(Cbe,{}),S.jsx(Tbe,{position:[0,-1.05,0],opacity:.8,scale:5,blur:2.5,far:4,color:"#000000"}),S.jsx(Sbe,{preset:"night"})]}),S.jsx(sbe,{enableZoom:!1,enablePan:!1,minPolarAngle:Math.PI/2.2,maxPolarAngle:Math.PI/2.2,autoRotate:!1,rotateSpeed:.6})]}),S.jsxs("div",{className:"absolute inset-0 p-5 pointer-events-none z-10",children:[S.jsx("div",{className:"pointer-events-auto flex justify-center mt-2",children:S.jsx(Le.div,{layout:!0,className:"bg-black/70 backdrop-blur-2xl rounded-2xl p-1 flex gap-0 shadow-[0_8px_32px_-8px_rgba(0,0,0,0.6)] border border-white/8",children:["Market","Personalize"].map(_=>S.jsxs("button",{onClick:()=>e(_.toLowerCase()),className:`relative px-5 py-2 rounded-xl text-[13px] font-medium transition-all ${n===_.toLowerCase()?"text-white font-semibold":"text-white/40 hover:text-white/60"}`,children:[n===_.toLowerCase()&&S.jsx(Le.div,{layoutId:"avatar-tab",className:"absolute inset-0 bg-white/12 rounded-xl shadow-[0_0_20px_rgba(255,255,255,0.05)]",transition:{type:"spring",bounce:.25,duration:.5}}),S.jsx("span",{className:"relative z-10",children:_})]},_))})}),S.jsxs(Le.div,{whileTap:{scale:.9},className:"pointer-events-auto absolute top-[72px] right-5 bg-black/70 backdrop-blur-xl px-4 py-2 rounded-2xl font-medium flex items-center gap-2 text-sm shadow-[0_4px_24px_-4px_rgba(0,0,0,0.5)] border border-white/8",children:[S.jsx(iG,{size:12,className:"text-primary"}),S.jsx("span",{className:"text-white font-bold tracking-tight",children:"999,999"})]}),S.jsx(Le.div,{whileTap:{scale:.9},className:"pointer-events-auto absolute top-[65px] left-5 bg-black/70 backdrop-blur-xl rounded-2xl w-12 py-2.5 flex flex-col items-center shadow-[0_4px_24px_-4px_rgba(0,0,0,0.5)] border border-white/8",children:S.jsx("img",{src:bbe,alt:"User",className:"w-8 h-8 rounded-full object-cover ring-2 ring-white/10"})}),S.jsxs("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 flex items-center gap-1.5 text-white/20 text-[10px] font-medium tracking-wide",children:[S.jsx(eG,{size:10}),S.jsx("span",{children:"Swipe to rotate"})]})]})]}),S.jsxs("div",{className:"flex-1 bg-card rounded-t-[28px] -mt-6 z-30 shadow-[0_-16px_60px_rgba(0,0,0,0.25)] flex flex-col overflow-hidden border-t border-border/15",children:[S.jsx("div",{className:"flex overflow-x-auto px-5 pt-5 pb-3 gap-7 border-b border-border/30 no-scrollbar",children:f.map(_=>S.jsxs("button",{onClick:()=>i(_),className:`whitespace-nowrap font-medium pb-3 text-[14px] relative cursor-pointer transition-all ${t===_?"text-foreground font-bold":"text-muted-foreground/60"}`,children:[_,t===_&&S.jsx(Le.div,{layoutId:"avatar-cat",className:"absolute bottom-[-1px] left-0 right-0 h-[3px] bg-primary rounded-full shadow-[0_0_12px_hsl(var(--primary)/0.5)]",transition:{type:"spring",bounce:.3}})]},_))}),S.jsxs("div",{className:"px-5 py-3.5 flex items-center gap-3",children:[S.jsxs("div",{className:"flex-1 bg-secondary/50 rounded-2xl px-4 py-2.5 flex items-center gap-2.5 border border-border/20 shadow-[inset_0_2px_4px_rgba(0,0,0,0.06)]",children:[S.jsx(d0,{size:14,className:"text-muted-foreground/50"}),S.jsx("input",{type:"text",value:r,onChange:_=>s(_.target.value),placeholder:"Search items...",className:"bg-transparent border-none outline-none w-full text-sm text-foreground placeholder:text-muted-foreground/30"})]}),S.jsx(Le.button,{whileTap:{scale:.85,rotate:90},onClick:()=>a(!o),className:"p-2.5 bg-secondary/50 rounded-2xl border border-border/20 hover:bg-secondary transition-colors",children:S.jsx(UQ,{size:16,className:"text-muted-foreground/60"})})]}),S.jsx(Gs,{children:o&&S.jsx(Le.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"bg-secondary/30 px-5 border-b border-border/20 overflow-hidden backdrop-blur-sm",children:S.jsxs("div",{className:"py-4 flex flex-col gap-2",children:[S.jsxs("div",{className:"flex justify-between",children:[S.jsx("label",{className:"text-[11px] font-bold text-muted-foreground/70 uppercase tracking-wider",children:"Accessory Scale"}),S.jsxs("span",{className:"text-xs font-bold text-foreground",children:[l.toFixed(1),"x"]})]}),S.jsx("input",{type:"range",min:"0.5",max:"2.0",step:"0.1",value:l,onChange:_=>c(parseFloat(_.target.value)),className:"w-full accent-primary"})]})})}),S.jsxs("div",{className:"px-5 pt-4 pb-8 overflow-y-auto flex-1",children:[S.jsx("p",{className:"text-[10px] font-bold text-muted-foreground/50 uppercase tracking-[0.15em] mb-4",children:n==="personalize"?"My Collection":"Marketplace"}),S.jsx("div",{className:"grid grid-cols-4 gap-3",children:y.map((_,v)=>{const g=_.icon,w=u===v;return S.jsxs(Le.button,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:v*.05,type:"spring",bounce:.3},whileTap:{scale:.88},onClick:()=>h(w?null:v),className:`aspect-square bg-gradient-to-br ${Rbe[_.rarity]} rounded-2xl flex flex-col items-center justify-center relative border backdrop-blur-sm transition-all duration-200
                    ${w?"border-primary/60 shadow-[0_0_20px_hsl(var(--primary)/0.3),inset_0_1px_0_rgba(255,255,255,0.1)] scale-[1.02]":`${Nbe[_.rarity]} ${Pbe[_.rarity]} hover:border-border/60`}
                  `,children:[S.jsx("div",{className:"absolute inset-x-0 top-0 h-1/2 bg-gradient-to-b from-white/[0.06] to-transparent rounded-t-2xl pointer-events-none"}),S.jsx(g,{size:22,strokeWidth:1.5,className:`relative z-10 ${w?"text-primary":"text-muted-foreground/40"} transition-colors`}),n==="personalize"&&S.jsx("div",{className:"absolute top-2 right-2 w-2.5 h-2.5 bg-emerald-500 rounded-full shadow-[0_0_6px_rgba(16,185,129,0.4)]"}),"price"in _&&S.jsxs("span",{className:"text-[8px] font-bold text-muted-foreground/50 mt-1.5 relative z-10",children:["◆ ",_.price]}),w&&S.jsx(Le.div,{initial:{scale:0},animate:{scale:1},className:"absolute -bottom-1 -right-1 w-5 h-5 bg-primary rounded-full flex items-center justify-center shadow-[0_2px_8px_hsl(var(--primary)/0.4)]",children:S.jsx("span",{className:"text-primary-foreground text-[10px] font-bold",children:"✓"})})]},v)})})]})]})]})},WR="https://file.garden/aS2_Au6dLxrEuvxH/122_Sem_Titulo_20260111083529.png",Lbe=({onClose:n,onSubmit:e})=>{const[t,i]=V.useState(""),r=["Spam","Harassment","Inappropriate Content","Misinformation","Other"];return S.jsxs("div",{className:"fixed inset-0 z-[70] flex items-center justify-center",children:[S.jsx(Le.div,{initial:{opacity:0},animate:{opacity:1},className:"absolute inset-0 bg-foreground/30 backdrop-blur-sm",onClick:n}),S.jsxs(Le.div,{initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},transition:{type:"spring",bounce:.3},className:"relative bg-card rounded-3xl p-6 w-[85%] max-w-sm shadow-2xl",children:[S.jsxs("div",{className:"flex items-center justify-between mb-4",children:[S.jsx("h3",{className:"text-base font-bold text-foreground",children:"Report Post"}),S.jsx("button",{onClick:n,className:"p-1 text-muted-foreground",children:S.jsx(sv,{size:18})})]}),S.jsx("div",{className:"space-y-2 mb-5",children:r.map((s,o)=>S.jsx(Le.button,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:o*.04},onClick:()=>i(s),className:`w-full text-left px-4 py-3 rounded-2xl text-sm font-medium transition-all ${t===s?"bg-primary/10 text-primary border border-primary/30":"bg-secondary text-foreground border border-border/50"}`,children:s},s))}),S.jsx("button",{onClick:()=>{t&&e(t)},disabled:!t,className:"w-full key-button-red py-3 rounded-2xl text-primary-foreground font-bold text-sm disabled:opacity-40",children:"Submit Report"})]})]})},kbe=({postId:n,uid:e,username:t})=>{const[i,r]=V.useState([]),[s,o]=V.useState("");V.useEffect(()=>Jye(n,r),[n]);const a=async()=>{s.trim()&&(await Qye(n,e,t,s),o(""))};return S.jsxs(Le.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{type:"spring",bounce:.15},className:"overflow-hidden border-t border-border/30 bg-secondary/30",children:[S.jsxs("div",{className:"px-4 py-3 space-y-3 max-h-52 overflow-y-auto",children:[i.length===0&&S.jsx("p",{className:"text-[12px] text-muted-foreground text-center py-2",children:"No comments yet. Be the first!"}),i.map((l,c)=>S.jsxs(Le.div,{initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{delay:c*.04},className:"flex gap-2.5",children:[S.jsx("div",{className:"w-7 h-7 rounded-lg overflow-hidden border border-border flex-shrink-0",children:S.jsx("img",{src:WR,alt:l.authorName,className:"w-full h-full object-cover"})}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsx("div",{className:"flex items-baseline gap-2",children:S.jsx("span",{className:"text-[12px] font-semibold text-foreground",children:l.authorName})}),S.jsx("p",{className:"text-[13px] text-foreground/80 leading-snug",children:l.text})]})]},l.id))]}),S.jsxs("div",{className:"px-4 pb-3 flex items-center gap-2",children:[S.jsx("input",{type:"text",value:s,onChange:l=>o(l.target.value),onKeyDown:l=>l.key==="Enter"&&a(),placeholder:"Write a comment...",className:"flex-1 bg-secondary rounded-xl border border-border/50 px-3 py-2 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/50"}),S.jsx(Le.button,{whileTap:{scale:.85},onClick:a,disabled:!s.trim(),className:"p-2 bg-primary rounded-xl text-primary-foreground disabled:opacity-40",children:S.jsx(XP,{size:14})})]})]})},Bbe=({onBack:n,uid:e,username:t})=>{const[i,r]=V.useState([]),[s,o]=V.useState("feed"),[a,l]=V.useState(null),[c,u]=V.useState(new Set),[h,f]=V.useState(null),[m,y]=V.useState(""),[_,v]=V.useState(new Set),[g,w]=V.useState(new Set),[A,T]=V.useState(new Set);V.useEffect(()=>Xye(r),[]);const L=V.useCallback(async B=>{const O=g.has(B);w(X=>{const le=new Set(X);return O?le.delete(B):le.add(B),le}),O?await $ye(B):await Yye(B)},[g]),D=B=>{T(O=>{const X=new Set(O);return X.has(B)?X.delete(B):X.add(B),X})},R=B=>{v(O=>{const X=new Set(O);return X.has(B)?X.delete(B):X.add(B),X})},I=B=>{a!==null&&(u(O=>new Set(O).add(a)),l(null))},M=async()=>{m.trim()&&(await qye(e,t,m),y(""))},C=s==="trending"?[...i].sort((B,O)=>(O.likes||0)-(B.likes||0)):i,k=B=>{if(!(B!=null&&B.toDate))return"Just now";const O=Date.now()-B.toDate().getTime(),X=Math.floor(O/6e4);if(X<1)return"Just now";if(X<60)return`${X}m ago`;const le=Math.floor(X/60);return le<24?`${le}h ago`:`${Math.floor(le/24)}d ago`};return S.jsxs(Le.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",bounce:.12,duration:.4},className:"fixed inset-0 z-[55] bg-background flex flex-col",children:[S.jsxs("header",{className:"flex items-center gap-3 px-4 pt-10 pb-3 bg-card/80 backdrop-blur-md border-b border-border/50",children:[S.jsx(Le.button,{whileTap:{scale:.85},onClick:n,className:"p-2 bg-secondary rounded-xl border border-border",children:S.jsx(Im,{size:18,className:"text-muted-foreground"})}),S.jsx("h1",{className:"text-lg font-bold text-foreground tracking-tight flex-1",children:"Community News"})]}),S.jsx("div",{className:"flex bg-card border-b border-border/50 px-2",children:["feed","trending"].map(B=>S.jsxs("button",{onClick:()=>o(B),className:`flex-1 py-3 text-[13px] font-semibold capitalize transition-all relative ${s===B?"text-primary":"text-muted-foreground"}`,children:[B,s===B&&S.jsx(Le.div,{layoutId:"news-tab",className:"absolute bottom-0 left-1/4 right-1/4 h-[3px] bg-primary rounded-full"})]},B))}),S.jsxs("div",{className:"bg-card border-b border-border/50 px-4 py-3 flex items-center gap-3",children:[S.jsx("div",{className:"w-9 h-9 rounded-xl overflow-hidden border border-border flex-shrink-0",children:S.jsx("img",{src:WR,alt:"you",className:"w-full h-full object-cover"})}),S.jsxs("div",{className:"flex-1 flex items-center bg-secondary rounded-xl border border-border/50 px-3 py-2",children:[S.jsx("input",{type:"text",value:m,onChange:B=>y(B.target.value),placeholder:"What's on your mind?",className:"flex-1 bg-transparent outline-none text-sm text-foreground placeholder:text-muted-foreground/60",onKeyDown:B=>B.key==="Enter"&&M()}),S.jsx("button",{className:"text-muted-foreground ml-2",children:S.jsx(bQ,{size:18})})]}),S.jsx(Le.button,{whileTap:{scale:.85},onClick:M,disabled:!m.trim(),className:"p-2.5 bg-primary rounded-xl text-primary-foreground disabled:opacity-40",children:S.jsx(XP,{size:16})})]}),S.jsxs("div",{className:"flex-1 overflow-y-auto",children:[C.length===0&&S.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-muted-foreground",children:[S.jsx(QM,{size:40,className:"mb-3 opacity-30"}),S.jsx("p",{className:"text-sm font-medium",children:"No posts yet"}),S.jsx("p",{className:"text-xs mt-1",children:"Be the first to share something!"})]}),C.map((B,O)=>S.jsxs(Le.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:O*.05},className:`bg-card border-b border-border/30 ${c.has(B.id)?"opacity-40":""}`,children:[S.jsxs("div",{className:"flex items-center px-4 pt-4 pb-2",children:[S.jsx("div",{className:"w-10 h-10 rounded-xl overflow-hidden border border-border mr-3 flex-shrink-0",children:S.jsx("img",{src:WR,alt:B.authorName,className:"w-full h-full object-cover"})}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsx("p",{className:"text-[14px] font-semibold text-foreground truncate",children:B.authorName}),S.jsx("p",{className:"text-[11px] text-muted-foreground",children:k(B.createdAt)})]}),S.jsxs("div",{className:"relative",children:[S.jsx("button",{onClick:()=>f(h===B.id?null:B.id),className:"p-2 text-muted-foreground active:scale-90 transition-transform",children:S.jsx(EQ,{size:18})}),S.jsx(Gs,{children:h===B.id&&S.jsxs(Le.div,{initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.9,opacity:0},className:"absolute right-0 top-10 bg-card rounded-2xl shadow-xl border border-border/50 py-2 w-40 z-10",children:[S.jsxs("button",{onClick:()=>{D(B.id),f(null)},className:"w-full flex items-center gap-2 px-4 py-2.5 text-sm text-foreground hover:bg-secondary transition-colors",children:[A.has(B.id)?S.jsx(gQ,{size:16,className:"text-primary"}):S.jsx(yQ,{size:16}),A.has(B.id)?"Unsave":"Save Post"]}),S.jsxs("button",{onClick:()=>{l(B.id),f(null)},className:"w-full flex items-center gap-2 px-4 py-2.5 text-sm text-primary hover:bg-secondary transition-colors",children:[S.jsx(QH,{size:16})," Report"]})]})})]})]}),S.jsx("div",{className:"px-4 pb-3",children:S.jsx("p",{className:"text-[14px] text-foreground leading-relaxed",children:B.content})}),B.image&&S.jsx("div",{className:"px-4 pb-3",children:S.jsx("img",{src:B.image,alt:"",className:"w-full rounded-2xl object-cover max-h-52 border border-border/30"})}),S.jsx("div",{className:"px-4 pb-2 flex items-center gap-4 text-[11px] text-muted-foreground",children:S.jsxs("span",{className:"flex items-center gap-1",children:[S.jsx(KP,{size:12})," ",B.views||0]})}),S.jsxs("div",{className:"flex border-t border-border/30",children:[S.jsxs(Le.button,{whileTap:{scale:.9},onClick:()=>L(B.id),className:`flex-1 flex items-center justify-center gap-1.5 py-3 text-[13px] font-medium transition-all ${g.has(B.id)?"text-primary":"text-muted-foreground"}`,children:[g.has(B.id)?S.jsx(JB,{size:16,className:"fill-current"}):S.jsx(JB,{size:16}),B.likes||0]}),S.jsxs(Le.button,{whileTap:{scale:.9},onClick:()=>R(B.id),className:`flex-1 flex items-center justify-center gap-1.5 py-3 text-[13px] font-medium transition-all ${_.has(B.id)?"text-primary":"text-muted-foreground"}`,children:[S.jsx(QM,{size:16})," Comment"]}),S.jsxs(Le.button,{whileTap:{scale:.9},className:"flex-1 flex items-center justify-center gap-1.5 py-3 text-[13px] font-medium text-muted-foreground",children:[S.jsx(BQ,{size:16})," Share"]})]}),S.jsx(Gs,{children:_.has(B.id)&&S.jsx(kbe,{postId:B.id,uid:e,username:t})}),c.has(B.id)&&S.jsxs(Le.div,{initial:{opacity:0},animate:{opacity:1},className:"px-4 pb-3 flex items-center gap-2 text-[11px] text-primary font-medium",children:[S.jsx(dA,{size:14})," Post reported. Thank you."]})]},B.id))]}),S.jsx(Gs,{children:a!==null&&S.jsx(Lbe,{onClose:()=>l(null),onSubmit:I})})]})},Obe={shop:{title:"Shop Centre",subtitle:"Cubbies & Game Coins",icon:FQ,items:[{name:"100 Cubbies",price:"$0.99",icon:JH,iconColor:"text-yellow-500",rarity:"Common"},{name:"500 Cubbies",price:"$3.99",icon:$B,iconColor:"text-blue-500",rarity:"Rare",tag:"POPULAR"},{name:"1,200 Cubbies",price:"$7.99",icon:$B,iconColor:"text-purple-500",rarity:"Epic",tag:"BEST VALUE"},{name:"3,000 Cubbies",price:"$14.99",icon:fd,iconColor:"text-amber-500",rarity:"Legendary",tag:"HOT"},{name:"50 Cubbies + Bonus",price:"$0.49",icon:SQ,iconColor:"text-emerald-500",rarity:"Common"},{name:"10,000 Cubbies",price:"$39.99",icon:tm,iconColor:"text-amber-600",rarity:"Legendary",tag:"LIMITED"}]},propshop:{title:"Prop Shop",subtitle:"Cosmetics & accessories",icon:iG,items:[],empty:!0},gamify:{title:"Gamify",subtitle:"Boosts & passes",icon:Ay,items:[],empty:!0}},Fbe={Common:"border-border/60",Rare:"border-blue-200/80",Epic:"border-purple-200/80",Legendary:"border-amber-200/80"},Ube={Common:"text-muted-foreground",Rare:"text-blue-500",Epic:"text-purple-500",Legendary:"text-amber-600"},Vbe={HOT:"bg-red-500 text-white",LIMITED:"bg-amber-500 text-white",POPULAR:"bg-blue-500 text-white","BEST VALUE":"bg-emerald-500 text-white"},JC=({type:n,onBack:e})=>{const t=Obe[n],[i,r]=V.useState("featured"),s=t.icon;return S.jsxs(Le.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",bounce:.12,duration:.4},className:"fixed inset-0 z-[55] bg-background flex flex-col",children:[S.jsxs("div",{className:"relative bg-card px-5 pt-10 pb-6 border-b border-border/30",style:{background:"linear-gradient(180deg, hsl(var(--card)) 0%, hsl(var(--secondary)) 100%)",boxShadow:"0 8px 30px -4px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,1)"},children:[S.jsxs("div",{className:"flex items-center justify-between mb-5",children:[S.jsx(Le.button,{whileTap:{scale:.85},onClick:e,className:"p-2.5 rounded-2xl border border-border/50",style:{background:"linear-gradient(180deg, #ffffff 0%, hsl(var(--secondary)) 100%)",boxShadow:"inset 0 -2px 0 0 hsl(var(--border)), 0 2px 8px -2px rgba(0,0,0,0.06)"},children:S.jsx(Im,{size:18,className:"text-muted-foreground"})}),S.jsxs("div",{className:"rounded-full px-4 py-1.5 border border-border/50 flex items-center gap-1.5",style:{background:"linear-gradient(180deg, #ffffff 0%, hsl(var(--secondary)) 100%)",boxShadow:"inset 0 -2px 0 0 hsl(var(--border)), 0 2px 8px -2px rgba(0,0,0,0.06)"},children:[S.jsx(JH,{size:14,className:"text-yellow-500"}),S.jsx("span",{className:"text-foreground text-xs font-bold",children:"1,250"})]})]}),S.jsxs("div",{className:"flex items-center gap-3.5",children:[S.jsx(Le.div,{initial:{rotate:-15,scale:0},animate:{rotate:0,scale:1},transition:{delay:.2,type:"spring",bounce:.5},className:"w-14 h-14 rounded-2xl flex items-center justify-center border border-border/50",style:{background:"linear-gradient(180deg, #ffffff 0%, hsl(var(--secondary)) 100%)",boxShadow:"0 8px 20px -6px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,1)"},children:S.jsx(s,{size:26,className:"text-foreground"})}),S.jsxs("div",{children:[S.jsx("h1",{className:"text-xl font-black text-foreground",children:t.title}),S.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:t.subtitle})]})]})]}),t.empty?S.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6",children:[S.jsx(Le.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"w-20 h-20 rounded-3xl bg-secondary flex items-center justify-center mb-4",style:{boxShadow:"0 8px 20px -6px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,1)"},children:S.jsx(s,{size:36,className:"text-muted-foreground/30"})}),S.jsx("p",{className:"text-base font-bold text-foreground mb-1",children:"Nothing here yet"}),S.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"New items will appear here soon. Check back later!"})]}):S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"px-5 py-3 flex gap-2 border-b border-border/20",children:["featured","all"].map(o=>S.jsx(Le.button,{whileTap:{scale:.95},onClick:()=>r(o),className:`px-4 py-2 rounded-xl text-xs font-bold uppercase tracking-wider transition-all ${i===o?"bg-foreground text-card shadow-[0_4px_12px_-2px_rgba(0,0,0,0.15)]":"text-muted-foreground border border-border/50"}`,style:i!==o?{background:"linear-gradient(180deg, #ffffff 0%, hsl(var(--secondary)) 100%)",boxShadow:"inset 0 -2px 0 0 hsl(var(--border)), 0 1px 3px rgba(0,0,0,0.04)"}:void 0,children:o==="featured"?S.jsxs("span",{className:"flex items-center gap-1",children:[S.jsx(su,{size:12})," Featured"]}):S.jsxs("span",{className:"flex items-center gap-1",children:[S.jsx(_1,{size:12})," All Items"]})},o))}),S.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:S.jsx("div",{className:"grid grid-cols-2 gap-3",children:t.items.filter(o=>i==="all"||o.tag).map((o,a)=>{const l=o.icon;return S.jsxs(Le.button,{initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1},transition:{delay:a*.06,type:"spring",bounce:.3},whileTap:{scale:.95},className:`relative rounded-3xl border p-4 text-left transition-all ${Fbe[o.rarity]||"border-border/50"}`,style:{background:"linear-gradient(180deg, hsl(var(--card)) 0%, hsl(var(--secondary)) 100%)",boxShadow:"0 8px 25px -6px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,1)"},children:[o.tag&&S.jsx("span",{className:`absolute top-2.5 right-2.5 text-[8px] font-black px-2 py-0.5 rounded-full shadow-sm ${Vbe[o.tag]||"bg-foreground text-card"}`,children:o.tag}),S.jsx("div",{className:"w-12 h-12 rounded-2xl flex items-center justify-center mb-3",style:{background:"linear-gradient(180deg, #ffffff 0%, hsl(var(--secondary)) 100%)",boxShadow:"0 4px 12px -4px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,1)"},children:S.jsx(l,{size:24,className:o.iconColor})}),S.jsx("p",{className:"text-sm font-bold text-foreground leading-tight mb-1",children:o.name}),S.jsx("p",{className:`text-[10px] font-bold uppercase tracking-wider mb-2 ${Ube[o.rarity]||"text-muted-foreground"}`,children:o.rarity}),S.jsx("div",{className:"flex items-center gap-1",children:S.jsx("span",{className:"text-xs font-black text-foreground",children:o.price})})]},o.name)})})})]})]})},$5="https://file.garden/aS2_Au6dLxrEuvxH/122_Sem_Titulo_20260111083529.png",QC={SHOP:"https://file.garden/aS2_Au6dLxrEuvxH/IMG_8303.png",WORLDS:"https://file.garden/aS2_Au6dLxrEuvxH/IMG_8304.png",EVENTS:"https://file.garden/aS2_Au6dLxrEuvxH/IMG_8305.png",GAMIFY:"https://file.garden/aS2_Au6dLxrEuvxH/IMG_8306.png"},zbe=({Icon:n,from:e,to:t,size:i=24})=>{const r=at.useId();return S.jsx("div",{className:"flex items-center justify-center mr-5 flex-shrink-0",children:S.jsxs("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:"none",children:[S.jsx("defs",{children:S.jsxs("linearGradient",{id:r,x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[S.jsx("stop",{offset:"0%",stopColor:e}),S.jsx("stop",{offset:"100%",stopColor:t})]})}),S.jsx(n,{size:i,stroke:`url(#${r})`,strokeWidth:1.5})]})})},Dh=({title:n,onBack:e,children:t})=>S.jsxs(Le.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",bounce:.12,duration:.4},className:"fixed inset-0 z-[55] bg-background flex flex-col",children:[S.jsxs("header",{className:"flex items-center gap-3 px-4 pt-10 pb-3 bg-card/80 backdrop-blur-md border-b border-border/50",children:[S.jsx(Le.button,{whileTap:{scale:.85},onClick:e,className:"p-2 rounded-xl key-button-white",children:S.jsx(Im,{size:18,className:"text-muted-foreground"})}),S.jsx("h1",{className:"text-lg font-bold text-foreground tracking-tight flex-1",children:n})]}),S.jsx("div",{className:"flex-1 overflow-y-auto",children:t})]}),Hbe=({username:n,uid:e,onLogout:t})=>{const[i,r]=V.useState("profile"),[s,o]=V.useState(!1),[a,l]=V.useState(n||"Newbie9974612"),[c,u]=V.useState(!1),[h,f]=V.useState([{label:"Two-Factor Auth",active:!0},{label:"Login Alerts",active:!0},{label:"Trade Protection",active:!1},{label:"Anti-Phishing Code",active:!1},{label:"Device Verification",active:!0},{label:"Session Lock",active:!1}]),m=()=>{var g;(g=navigator.clipboard)==null||g.writeText("9974612").catch(()=>{}),u(!0),setTimeout(()=>u(!1),2e3)},y=g=>{f(w=>w.map((A,T)=>T===g?{...A,active:!A.active}:A))},_=()=>{const g=[],w=localStorage.getItem("cubic_user");if(w)try{const A=JSON.parse(w);A.username&&g.push({username:A.username,sex:A.sex})}catch{}return g},v=[{icon:LQ,label:"Recent Entry",from:"#60A5FA",to:"#22D3EE",viewKey:"recent"},{icon:su,label:"Creator Center",from:"#FBBF24",to:"#FB923C",viewKey:"creator"},{icon:Ty,label:"My Coupons",from:"#C084FC",to:"#F472B6",viewKey:"coupons"},{icon:Dl,label:"My Protection",from:"#818CF8",to:"#3B82F6",viewKey:"protection"},{icon:RQ,label:"Community News",from:"#F87171",to:"#FB7185",viewKey:"news"}];if(i==="news")return S.jsx(Bbe,{onBack:()=>r("profile"),uid:e||"",username:n||"Player"});if(i==="shop")return S.jsx(JC,{type:"shop",onBack:()=>r("profile")});if(i==="propshop")return S.jsx(JC,{type:"propshop",onBack:()=>r("profile")});if(i==="gamify")return S.jsx(JC,{type:"gamify",onBack:()=>r("profile")});if(i==="myprofile")return S.jsx(C7,{onBack:()=>r("profile")});if(i==="vip")return S.jsxs(Dh,{title:"VIP Premium",onBack:()=>r("profile"),children:[S.jsx("div",{className:"px-4 pt-5 pb-4",children:S.jsxs(Le.div,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},className:"relative overflow-hidden rounded-[28px] bg-gradient-to-br from-[#F6E8CC] via-[#EED6A5] to-[#D4B57E] p-6 shadow-[0_16px_40px_-10px_rgba(212,181,126,0.5)]",children:[S.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-white/10 rounded-full -translate-y-1/2 translate-x-1/4"}),S.jsx("div",{className:"absolute top-0 -left-full w-[150%] h-full bg-gradient-to-r from-transparent via-white/40 to-transparent skew-x-[-30deg] pointer-events-none",style:{animation:"shimmer 3s infinite"}}),S.jsxs("div",{className:"relative z-10 text-center",children:[S.jsx(Le.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.2,type:"spring",bounce:.5},className:"w-16 h-16 rounded-2xl bg-[#8B6E32]/20 flex items-center justify-center mx-auto mb-3",children:S.jsx(fd,{size:32,fill:"#8B6E32",className:"text-[#8B6E32]"})}),S.jsx("h2",{className:"text-xl font-black text-[#5C4820]",children:"VIP Premium"}),S.jsx("p",{className:"text-[#8B6E32] text-xs mt-1",children:"Unlock exclusive perks & rewards"})]})]})}),S.jsxs("div",{className:"px-4 space-y-3",children:[S.jsx("h3",{className:"text-[11px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:"Benefits"}),[{icon:Ty,title:"2x XP Boost",desc:"Double experience in all games",color:"text-amber-500"},{icon:su,title:"Exclusive Skins",desc:"Access premium cosmetics",color:"text-purple-500"},{icon:pQ,title:"Name Colors",desc:"Custom colored username",color:"text-blue-500"},{icon:fd,title:"VIP Badge",desc:"Show off your status",color:"text-amber-600"},{icon:QB,title:"Daily Rewards",desc:"Bonus coins every day",color:"text-emerald-500"}].map((g,w)=>S.jsxs(Le.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:.15+w*.06},className:"flex items-center gap-3.5 bg-card rounded-2xl px-4 py-3.5 border border-border/30",style:{boxShadow:"0 6px 18px -6px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.8)"},children:[S.jsx("div",{className:"w-10 h-10 rounded-xl bg-secondary flex items-center justify-center",children:S.jsx(g.icon,{size:20,fill:"currentColor",className:g.color})}),S.jsxs("div",{className:"flex-1",children:[S.jsx("p",{className:"text-sm font-bold text-foreground",children:g.title}),S.jsx("p",{className:"text-[11px] text-muted-foreground",children:g.desc})]})]},g.title))]}),S.jsx("div",{className:"px-4 pt-6 pb-10",children:S.jsx(Le.button,{whileTap:{scale:.97},className:"w-full py-4 rounded-2xl font-black text-sm uppercase tracking-wider bg-gradient-to-r from-[#D4A853] to-[#B8872E] text-white shadow-[0_8px_25px_-5px_rgba(180,135,46,0.5)]",children:"Activate VIP — 500 coins/month"})})]});if(i==="creator")return S.jsx(Dh,{title:"Creator Center",onBack:()=>r("profile"),children:S.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-6 text-center",children:[S.jsx("div",{className:"w-16 h-16 rounded-xl bg-secondary flex items-center justify-center mb-4",children:S.jsx(su,{size:28,fill:"currentColor",className:"text-muted-foreground/30"})}),S.jsx("h2",{className:"text-base font-bold text-foreground mb-1",children:"Become a Creator"}),S.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed mb-6 max-w-xs",children:"Apply to join the Creator Program and unlock tools to build content, grow your audience, and earn rewards."}),S.jsx("div",{className:"w-full space-y-2 mb-6",children:[{label:"Minimum Level 5",met:!1},{label:"Account age 30+ days",met:!1},{label:"No active bans",met:!0}].map((g,w)=>S.jsxs("div",{className:"flex items-center gap-2.5 bg-card rounded-lg px-3.5 py-2.5 border border-border/50",children:[S.jsx("div",{className:`w-5 h-5 rounded flex items-center justify-center ${g.met?"bg-emerald-100 text-emerald-600":"bg-secondary text-muted-foreground/40"}`,children:g.met?S.jsx(dA,{size:12}):S.jsx(sv,{size:12})}),S.jsx("span",{className:`text-xs font-medium ${g.met?"text-foreground":"text-muted-foreground"}`,children:g.label})]},w))}),S.jsx("button",{className:"w-full key-button-red py-3 rounded-lg text-primary-foreground font-bold text-xs uppercase tracking-wider opacity-50 cursor-not-allowed",children:"Apply for Creator Program"}),S.jsx("p",{className:"text-[10px] text-muted-foreground mt-2",children:"You don't meet all requirements yet"})]})});if(i==="protection"){const g=h.filter(L=>L.active).length,w=Math.round(g/h.length*100),A=g>=4,T=_();return S.jsxs(Dh,{title:"My Protection",onBack:()=>r("profile"),children:[S.jsx("div",{className:"px-4 pt-5 pb-2",children:S.jsxs(Le.div,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},className:"relative overflow-hidden rounded-[28px] bg-gradient-to-br from-indigo-500 via-blue-600 to-blue-700 p-6 shadow-[0_16px_40px_-10px_rgba(59,130,246,0.4)]",children:[S.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-white/5 rounded-full -translate-y-1/2 translate-x-1/4"}),S.jsx("div",{className:"absolute bottom-0 left-0 w-32 h-32 bg-white/5 rounded-full translate-y-1/2 -translate-x-1/4"}),S.jsxs("div",{className:"relative z-10 flex items-center gap-4 mb-5",children:[S.jsx(Le.div,{initial:{rotate:-20,scale:0},animate:{rotate:0,scale:1},transition:{delay:.2,type:"spring",bounce:.5},className:"w-16 h-16 rounded-2xl bg-white/15 backdrop-blur-sm flex items-center justify-center border border-white/20 shadow-[0_8px_20px_rgba(0,0,0,0.15)]",children:S.jsx(Dl,{size:32,fill:"white",className:"text-white drop-shadow-md"})}),S.jsxs("div",{className:"flex-1",children:[S.jsx("p",{className:"text-white font-bold text-lg",children:A?"Well Protected":"Needs Attention"}),S.jsxs("p",{className:"text-white/60 text-[12px] font-medium",children:[g,"/",h.length," features active"]})]}),S.jsx(Le.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.3,type:"spring"},className:"w-14 h-14 rounded-full bg-white/15 backdrop-blur-sm flex items-center justify-center border border-white/20",children:S.jsxs("span",{className:"text-white font-black text-lg",children:[w,"%"]})})]}),S.jsx("div",{className:"w-full h-3 bg-white/15 rounded-full overflow-hidden backdrop-blur-sm",children:S.jsx(Le.div,{initial:{width:0},animate:{width:`${w}%`},transition:{delay:.4,duration:.8,ease:"easeOut"},className:`h-full rounded-full ${A?"bg-gradient-to-r from-emerald-300 to-green-400":"bg-gradient-to-r from-yellow-300 to-amber-400"}`,style:{boxShadow:`0 0 12px ${A?"rgba(52,211,153,0.5)":"rgba(251,191,36,0.5)"}`}})})]})}),S.jsxs("div",{className:"px-4 py-4 space-y-2.5",children:[S.jsx("h3",{className:"text-[11px] font-bold text-muted-foreground uppercase tracking-widest px-1 mb-1",children:"Security Features"}),h.map((L,D)=>S.jsxs(Le.div,{initial:{opacity:0,x:-15},animate:{opacity:1,x:0},transition:{delay:.15+D*.07,type:"spring",bounce:.25},className:`flex items-center justify-between rounded-2xl px-4 py-4 border transition-all ${L.active?"bg-card border-border/50":"bg-secondary/50 border-border/30"}`,style:L.active?{boxShadow:"0 6px 20px -6px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.8)"}:void 0,children:[S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx(Le.div,{animate:{scale:L.active?1:.9,opacity:L.active?1:.5},className:`w-9 h-9 rounded-xl flex items-center justify-center ${L.active?"bg-primary/10":"bg-secondary"}`,children:S.jsx(Dl,{size:16,fill:L.active?"currentColor":"none",className:L.active?"text-primary":"text-muted-foreground/40"})}),S.jsx("span",{className:`text-sm font-medium transition-colors ${L.active?"text-foreground":"text-muted-foreground"}`,children:L.label})]}),S.jsx(Le.button,{whileTap:{scale:.85},onClick:()=>y(D),className:`h-7 rounded-full flex items-center transition-colors duration-300 ${L.active?"bg-primary justify-end":"bg-border/60 justify-start"}`,style:{width:52},children:S.jsx(Le.div,{layout:!0,transition:{type:"spring",stiffness:500,damping:30},className:"w-[22px] h-[22px] bg-card rounded-full mx-1 shadow-[0_2px_6px_rgba(0,0,0,0.15)]"})})]},L.label))]}),S.jsx("div",{className:"px-4 py-3",children:S.jsxs(Le.button,{whileTap:{scale:.97},onClick:()=>o(!0),className:"w-full flex items-center gap-2.5 bg-card rounded-xl px-3 py-3 border border-border/50 text-left",style:{boxShadow:"0 4px 14px -4px rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,0.8)"},children:[S.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary/10 flex items-center justify-center",children:S.jsx(CQ,{size:16,fill:"currentColor",className:"text-primary"})}),S.jsxs("div",{className:"flex-1",children:[S.jsx("p",{className:"text-xs font-bold text-primary",children:"Log Out"}),S.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Switch or manage accounts"})]}),S.jsx(vu,{size:14,className:"text-muted-foreground/40"})]})}),S.jsx(Gs,{children:s&&S.jsxs(Le.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:{type:"spring",bounce:.08,duration:.45},className:"fixed inset-0 z-[200] bg-background flex flex-col",children:[S.jsxs("header",{className:"flex items-center gap-3 px-4 pt-10 pb-3 bg-card/80 backdrop-blur-md border-b border-border/50",children:[S.jsx(Le.button,{whileTap:{scale:.85},onClick:()=>o(!1),className:"p-2 rounded-lg key-button-white",children:S.jsx(Im,{size:18,className:"text-muted-foreground"})}),S.jsx("h1",{className:"text-lg font-bold text-foreground tracking-tight flex-1",children:"Your Accounts"})]}),S.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pt-5",children:[S.jsx("p",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-widest mb-3",children:"Saved Accounts"}),S.jsx("div",{className:"space-y-2 mb-6",children:T.map((L,D)=>S.jsxs(Le.button,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:D*.06},whileTap:{scale:.97},onClick:()=>{o(!1),t==null||t()},className:"w-full flex items-center gap-3 bg-card border border-border/50 rounded-none px-4 py-4 text-left",style:{boxShadow:"0 4px 14px -4px rgba(0,0,0,0.05)"},children:[S.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center border-2 border-primary/30",children:S.jsx("div",{className:"w-7 h-7 rounded-full bg-primary"})}),S.jsxs("div",{className:"flex-1",children:[S.jsx("p",{className:"text-sm font-bold text-foreground",children:L.username}),S.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tap to switch"})]}),S.jsx(vu,{size:16,className:"text-muted-foreground/40"})]},D))})]}),S.jsx("div",{className:"px-4 pb-10 pt-3",children:S.jsx(Le.button,{whileTap:{scale:.97},onClick:()=>{o(!1),localStorage.removeItem("cubic_user"),t==null||t()},className:"w-full py-4 rounded-none text-primary-foreground font-bold text-sm uppercase tracking-wider",style:{background:"linear-gradient(-225deg, hsl(var(--primary)), hsl(0 80% 65%))",boxShadow:"inset 0 -3px 0 0 hsl(0 60% 30%), inset 0 2px 0 0 hsl(0 80% 70%), 0 6px 20px -2px hsl(var(--glow-red))"},children:S.jsxs("div",{className:"flex items-center justify-center gap-2",children:[S.jsx(Sy,{size:16}),"Create New Account"]})})})]})}),S.jsx("div",{className:"px-4 pb-8 pt-2",children:S.jsxs(Le.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.6},className:"bg-card rounded-2xl p-5 border border-border/50",style:{boxShadow:"0 8px 25px -8px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.8)"},children:[S.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[S.jsx(Dl,{size:14,fill:"currentColor",className:"text-primary"}),S.jsx("p",{className:"text-[11px] font-bold text-muted-foreground uppercase tracking-widest",children:"Security Tips"})]}),S.jsx("p",{className:"text-[13px] text-muted-foreground leading-relaxed",children:"Enable all security features to maximize your account protection. Two-Factor Auth and Device Verification are recommended for all users."})]})})]})}if(i==="recent"){const g=[{name:"Dynamite Arena",time:"2 hours ago",duration:"45 min",icon:Ty,color:"text-orange-500",result:"Win"},{name:"Bedwars Duo",time:"5 hours ago",duration:"32 min",icon:Dl,color:"text-blue-500",result:"Loss"},{name:"Sky Wars Solo",time:"Yesterday",duration:"18 min",icon:tm,color:"text-amber-500",result:"Win"},{name:"Dynamite Dodgeball",time:"2 days ago",duration:"25 min",icon:su,color:"text-purple-500",result:"Win"},{name:"Bedwars 4v4",time:"3 days ago",duration:"51 min",icon:Dl,color:"text-blue-500",result:"Loss"},{name:"Sky Wars Duo",time:"4 days ago",duration:"22 min",icon:tm,color:"text-amber-500",result:"Win"}];return S.jsx(Dh,{title:"Recent Sessions",onBack:()=>r("profile"),children:S.jsxs("div",{className:"px-4 py-4 space-y-3",children:[S.jsx("p",{className:"text-[11px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:"Your Sessions"}),g.map((w,A)=>S.jsxs(Le.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:A*.05},className:"flex items-center bg-card rounded-2xl px-4 py-3.5 border border-border/50",style:{boxShadow:"0 4px 15px -4px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.8)"},children:[S.jsx("div",{className:"w-10 h-10 rounded-xl bg-secondary flex items-center justify-center mr-3",children:S.jsx(w.icon,{size:18,fill:"currentColor",className:w.color})}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsx("p",{className:"text-sm font-semibold text-foreground",children:w.name}),S.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[S.jsx("span",{children:w.time}),S.jsx("span",{children:"•"}),S.jsx("span",{children:w.duration})]})]}),S.jsx("span",{className:`text-[11px] font-bold px-2.5 py-1 rounded-lg ${w.result==="Win"?"bg-green-100 text-green-600":"bg-primary/10 text-primary"}`,children:w.result})]},A))]})})}return i==="notifications"?S.jsx(Dh,{title:"Notifications",onBack:()=>r("profile"),children:S.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-muted-foreground/50 gap-2 py-20",children:[S.jsx($M,{size:40,fill:"currentColor"}),S.jsx("p",{className:"text-sm font-medium",children:"No alerts yet"})]})}):i==="coupons"?S.jsx(Dh,{title:"My Coupons",onBack:()=>r("profile"),children:S.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-20 gap-3 px-6",children:[S.jsx(QB,{size:48,fill:"currentColor",className:"text-muted-foreground/30"}),S.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"No coupons available"}),S.jsx("p",{className:"text-[11px] text-muted-foreground/60 text-center",children:"Check back during events for special offers!"})]})}):i==="settings"?S.jsx(Dh,{title:"Settings",onBack:()=>r("profile"),children:S.jsx("div",{className:"px-4 py-5",children:S.jsxs("div",{className:"bg-card rounded-[28px] p-6 border border-border/50 space-y-6 flex flex-col",style:{boxShadow:"0 20px 40px -15px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.8)"},children:[S.jsxs("div",{className:"flex items-center gap-4 py-2",children:[S.jsxs("div",{className:"relative active:scale-95 transition-transform",children:[S.jsx("div",{className:"w-20 h-20 rounded-[22px] border-4 border-card shadow-md overflow-hidden bg-secondary",children:S.jsx("img",{src:$5,alt:"pfp",className:"w-full h-full object-cover"})}),S.jsx("button",{className:"absolute -bottom-1 -right-1 p-2 rounded-xl shadow-lg border border-card",style:{background:"linear-gradient(-225deg, hsl(var(--primary)), hsl(0 80% 65%))",boxShadow:"0 3px 10px -2px hsl(var(--glow-red))"},children:S.jsx(_Q,{size:14,className:"text-primary-foreground"})})]}),S.jsxs("div",{className:"flex-1",children:[S.jsx("p",{className:"text-sm font-bold text-foreground",children:"Avatar Image"}),S.jsx("p",{className:"text-[10px] text-muted-foreground font-medium uppercase tracking-wider mt-0.5",children:"Change your profile photo"})]})]}),S.jsxs("div",{className:"space-y-2.5",children:[S.jsx("label",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-widest ml-1",children:"Username"}),S.jsxs("div",{className:"relative",children:[S.jsx("div",{className:"absolute left-4 top-1/2 -translate-y-1/2 text-muted-foreground/50",children:S.jsx(qP,{size:16})}),S.jsx("input",{type:"text",value:a,onChange:g=>l(g.target.value),className:"w-full bg-secondary/50 border border-border focus:border-primary/30 focus:bg-card rounded-2xl py-3.5 pl-11 pr-4 text-foreground font-medium transition-all text-sm outline-none",placeholder:"Username"})]})]}),S.jsx("button",{onClick:()=>r("profile"),className:"w-full py-4 rounded-2xl font-bold text-xs uppercase tracking-[0.15em] mt-2 text-primary-foreground",style:{background:"linear-gradient(-225deg, hsl(var(--primary)), hsl(0 80% 65%))",boxShadow:"inset 0 -4px 0 0 hsl(0 60% 30%), inset 0 2px 0 0 hsl(0 80% 70%), 0 6px 20px -2px hsl(var(--glow-red))"},children:"Update Profile"})]})})}):S.jsxs("div",{className:"flex flex-col min-h-full pb-32 animate-in fade-in zoom-in-95 duration-300",children:[S.jsxs("div",{className:"px-6 pt-10 pb-6 flex items-center justify-between flex-shrink-0",children:[S.jsxs("div",{className:"flex items-center gap-4",children:[S.jsx("div",{className:"relative",children:S.jsx(Le.button,{whileTap:{scale:1.1},onClick:()=>r("myprofile"),className:"w-14 h-14 rounded-2xl border-[3px] border-card shadow-[0_8px_20px_rgba(0,0,0,0.12)] overflow-hidden bg-secondary flex-shrink-0",children:S.jsx("img",{src:$5,alt:"pfp",className:"w-full h-full object-cover"})})}),S.jsxs("div",{className:"min-w-0",children:[S.jsx("h2",{className:"text-[17px] font-bold text-foreground flex items-center gap-2 truncate leading-tight",children:a}),S.jsx("div",{className:"flex items-center gap-2 mt-1",children:S.jsxs(Le.button,{whileTap:{scale:.9},onClick:m,className:`flex items-center gap-1 uppercase tracking-tighter font-mono font-medium text-[9px] px-2 py-1 rounded-lg transition-all ${c?"bg-green-100 text-green-600":"bg-secondary text-muted-foreground border border-border/50"}`,children:["ID 9974612 ",c?S.jsx(xQ,{size:10}):S.jsx("span",{className:"text-[8px] opacity-60",children:"copy"})]})})]})]}),S.jsxs("div",{className:"flex gap-2",children:[S.jsx(Le.button,{whileTap:{scale:.85},onClick:()=>r("notifications"),className:"p-2.5 rounded-2xl key-button-white",children:S.jsx($M,{size:18,fill:"currentColor",className:"text-muted-foreground"})}),S.jsxs(Le.button,{whileTap:{scale:.85},onClick:()=>r("settings"),className:"p-2.5 rounded-2xl key-button-white relative",children:[S.jsx(tG,{size:18,fill:"currentColor",className:"text-muted-foreground"}),S.jsx("div",{className:"absolute top-2.5 right-2.5 w-2 h-2 bg-primary rounded-full border-2 border-card"})]})]})]}),S.jsx(Le.button,{whileTap:{scale:.98},onClick:()=>r("vip"),className:"mx-5 mb-6 relative overflow-hidden h-14 rounded-2xl bg-gradient-to-br from-[#F6E8CC] via-[#EED6A5] to-[#D4B57E] p-[1px] shadow-[0_10px_25px_-5px_rgba(212,181,126,0.5)] flex-shrink-0",children:S.jsxs("div",{className:"w-full h-full rounded-2xl flex items-center justify-between px-4 bg-gradient-to-r from-[#F6E8CC] to-[#EED6A5] relative overflow-hidden",children:[S.jsx("div",{className:"absolute inset-0 bg-gradient-to-tr from-white/30 via-transparent to-transparent opacity-40"}),S.jsx("div",{className:"absolute top-0 -left-full w-[150%] h-full bg-gradient-to-r from-transparent via-white/50 to-transparent skew-x-[-30deg] pointer-events-none",style:{animation:"shimmer 3s infinite"}}),S.jsxs("div",{className:"flex items-center gap-2.5 relative z-10",children:[S.jsx("div",{className:"p-1.5 bg-black/10 rounded-full shadow-inner",children:S.jsx(fd,{size:14,fill:"#8B6E32",className:"text-[#8B6E32]"})}),S.jsx("span",{className:"text-[#8B6E32] text-[12px] font-bold tracking-tight uppercase",children:"VIP Premium Status"})]}),S.jsx("span",{className:"bg-foreground text-[#EED6A5] text-[10px] px-4 py-1.5 rounded-xl font-bold shadow-[0_4px_10px_rgba(0,0,0,0.2)] uppercase relative z-10",children:"Activate"})]})}),S.jsx("div",{className:"mx-5 grid grid-cols-3 gap-2 bg-card p-5 rounded-[32px] mb-6 border border-border/50 items-start flex-shrink-0 shadow-elevated",style:{boxShadow:"0 12px 30px -10px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.8)"},children:[{img:QC.SHOP,label:"Shop Centre",viewKey:"shop"},{img:QC.EVENTS,label:"Prop Shop",viewKey:"propshop"},{img:QC.GAMIFY,label:"Gamify",viewKey:"gamify"}].map((g,w)=>S.jsxs(Le.button,{whileTap:{scale:1.15},onClick:()=>r(g.viewKey),className:"flex flex-col items-center gap-2 cursor-pointer",children:[S.jsx("div",{className:"w-12 h-12 flex items-center justify-center p-0.5",children:S.jsx("img",{src:g.img,alt:g.label,className:"w-full h-full object-contain drop-shadow-md"})}),S.jsx("span",{className:"text-[10px] text-muted-foreground font-medium tracking-tight text-center leading-tight uppercase opacity-80",children:g.label})]},w))}),S.jsx("div",{className:"mx-5 mb-8 flex-1 bg-card rounded-[32px] overflow-hidden flex flex-col border border-border/50",style:{boxShadow:"0 12px 40px -12px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.8)"},children:v.map((g,w)=>S.jsxs(Le.button,{whileTap:{scale:.98},onClick:()=>r(g.viewKey),className:"relative flex-1 flex items-center justify-between px-7 py-4 bg-card active:bg-secondary/80 transition-all cursor-pointer overflow-hidden text-left",children:[S.jsxs("div",{className:"flex items-center",children:[S.jsx(zbe,{Icon:g.icon,from:g.from,to:g.to,size:24}),S.jsx("span",{className:"text-[16px] text-foreground/80 font-medium tracking-tight",children:g.label})]}),S.jsx(vu,{size:20,className:"text-muted-foreground/30"}),w!==v.length-1&&S.jsx("div",{className:"absolute bottom-0 left-[76px] right-6 h-[1.5px] bg-border/40"})]},w))})]})},Gbe="https://file.garden/aS2_Au6dLxrEuvxH/122_Sem_Titulo_20260111083529.png",jbe=[{id:1,type:"game",title:"Dynamite",image:"https://file.garden/aS2_Au6dLxrEuvxH/Cubic/983a8c9d-a658-47e0-8d9d-ef2be734cb05.jpeg",players:"12.5k",category:"Action"},{id:2,type:"game",title:"Bedwars",image:"https://file.garden/aS2_Au6dLxrEuvxH/Cubic/a48c612e-71b8-4605-ad98-abf09a4d8e12.jpeg",players:"45.2k",category:"PvP"},{id:3,type:"game",title:"Sky Wars",image:"https://file.garden/aS2_Au6dLxrEuvxH/Cubic/983a8c9d-a658-47e0-8d9d-ef2be734cb05.jpeg",players:"5.2k",category:"PvP"},{id:4,type:"game",title:"Alien Arena",image:"https://file.garden/aS2_Au6dLxrEuvxH/Cubic/a48c612e-71b8-4605-ad98-abf09a4d8e12.jpeg",players:"3.8k",category:"Shooter"},{id:5,type:"game",title:"Sky Realms",image:"https://file.garden/aS2_Au6dLxrEuvxH/Cubic/DCE5F85A-6F03-4FC8-B705-C42B37479506.jpeg",players:"6.7k",category:"Adventure"}],Wbe=["Bedwars","Season 4","Diamond rank","New skins","Battle Pass"],Kbe=()=>{const[n,e]=V.useState(""),[t,i]=V.useState(["Dynamite","Bedwars"]),[r,s]=V.useState([]),[o,a]=V.useState(!1);V.useEffect(()=>{if(!n.trim()){s([]);return}const h=setTimeout(async()=>{a(!0);try{const f=await b7(n);s(f)}catch{s([])}a(!1)},400);return()=>clearTimeout(h)},[n]);const l=n.trim()?jbe.filter(h=>h.title.toLowerCase().includes(n.toLowerCase())):[],c=h=>{e(h),h.trim()&&!t.includes(h)&&i(f=>[h,...f].slice(0,5))},u=l.length>0||r.length>0;return S.jsxs("div",{className:"flex flex-col min-h-full pb-32",children:[S.jsxs("header",{className:"px-4 pt-10 pb-3",children:[S.jsx("h1",{className:"text-xl font-bold text-foreground mb-4",children:"Search"}),S.jsxs("div",{className:"flex items-center bg-card border border-border rounded-xl px-3 py-2.5 shadow-depth",children:[S.jsx(d0,{size:18,className:"text-muted-foreground mr-2"}),S.jsx("input",{type:"text",value:n,onChange:h=>e(h.target.value),placeholder:"Search games or players...",className:"bg-transparent outline-none flex-1 text-sm text-foreground placeholder:text-muted-foreground/50"}),n&&S.jsx(Le.button,{whileTap:{scale:.8},onClick:()=>e(""),className:"p-1 text-muted-foreground",children:S.jsx(sv,{size:16})})]})]}),S.jsx("div",{className:"flex-1 overflow-y-auto px-4",children:n.trim()?!u&&!o?S.jsxs(Le.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center py-20 text-muted-foreground",children:[S.jsx(d0,{size:40,className:"mb-3 opacity-30"}),S.jsxs("p",{className:"text-sm font-medium",children:['No results for "',n,'"']})]}):S.jsxs("div",{className:"space-y-5 pt-2",children:[o&&S.jsx("div",{className:"flex items-center justify-center py-4",children:S.jsx(ZH,{size:20,className:"animate-spin text-primary"})}),r.length>0&&S.jsxs("div",{children:[S.jsxs("h3",{className:"text-[11px] font-bold text-muted-foreground uppercase tracking-widest mb-3 px-1 flex items-center gap-1.5",children:[S.jsx(fA,{size:12})," Players"]}),S.jsx("div",{className:"space-y-2",children:r.map((h,f)=>S.jsxs(Le.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:f*.04},className:"flex items-center gap-3 bg-card rounded-xl px-4 py-3 border border-border/50 shadow-depth",children:[S.jsxs("div",{className:"relative",children:[S.jsx("img",{src:Gbe,alt:h.username,className:"w-12 h-12 rounded-xl object-cover flex-shrink-0"}),h.isOnline&&S.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 bg-green-500 border-2 border-card rounded-full"})]}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsx("p",{className:"text-sm font-semibold text-foreground truncate",children:h.username}),S.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[h.isOnline?S.jsx("span",{className:"text-green-500",children:"Online"}):"Offline"," • Lv.",h.level||1]})]}),S.jsx(vu,{size:16,className:"text-muted-foreground/30 flex-shrink-0"})]},h.uid))})]}),l.length>0&&S.jsxs("div",{children:[S.jsx("h3",{className:"text-[11px] font-bold text-muted-foreground uppercase tracking-widest mb-3 px-1",children:"Games"}),S.jsx("div",{className:"space-y-2",children:l.map((h,f)=>S.jsxs(Le.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:f*.04},className:"flex items-center gap-3 bg-card rounded-xl px-4 py-3 border border-border/50 shadow-depth",children:[S.jsx("img",{src:h.image,alt:h.title,className:"w-12 h-12 rounded-xl object-cover flex-shrink-0"}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsx("p",{className:"text-sm font-semibold text-foreground truncate",children:h.title}),S.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[h.category," • ",h.players]})]}),S.jsx(vu,{size:16,className:"text-muted-foreground/30 flex-shrink-0"})]},h.id))})]})]}):S.jsxs("div",{className:"space-y-6 pt-2",children:[t.length>0&&S.jsxs("div",{children:[S.jsxs("div",{className:"flex items-center justify-between mb-3",children:[S.jsxs("h3",{className:"text-[11px] font-bold text-muted-foreground uppercase tracking-widest flex items-center gap-1.5",children:[S.jsx($H,{size:12})," Recent"]}),S.jsx("button",{onClick:()=>i([]),className:"text-[11px] text-primary font-medium",children:"Clear"})]}),S.jsx("div",{className:"flex flex-wrap gap-2",children:t.map((h,f)=>S.jsx(Le.button,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{delay:f*.04},onClick:()=>c(h),className:"bg-card border border-border/50 rounded-xl px-3 py-1.5 text-[13px] text-foreground font-medium active:scale-95 transition-transform shadow-depth",children:h},h))})]}),S.jsxs("div",{children:[S.jsxs("h3",{className:"text-[11px] font-bold text-muted-foreground uppercase tracking-widest flex items-center gap-1.5 mb-3",children:[S.jsx(zQ,{size:12})," Trending"]}),S.jsx("div",{className:"space-y-2",children:Wbe.map((h,f)=>S.jsxs(Le.button,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{delay:f*.05},onClick:()=>c(h),className:"w-full flex items-center gap-3 bg-card rounded-xl px-4 py-3 border border-border/50 active:scale-[0.98] transition-transform text-left shadow-depth",children:[S.jsx("span",{className:"text-[14px] font-bold text-primary/60",children:f+1}),S.jsx("span",{className:"text-sm font-medium text-foreground",children:h}),S.jsx(vu,{size:14,className:"text-muted-foreground/30 ml-auto"})]},h))})]})]})})]})};async function Xbe(n,e,t){if(!T7(n))throw new Error("Invalid email address");if(!zye(t))throw new Error("Username must be 3-20 chars, alphanumeric/underscores only");const i=cc(t.trim()),r=await kfe(B0,n.trim().toLowerCase(),e),s=Hye();return await MN(Yu(os,"users",r.user.uid),{username:i,email:n.trim().toLowerCase(),uid:r.user.uid,displayId:s,createdAt:Fu(),isOnline:!0,lastSeen:Fu(),level:1,avatar:"",bio:""}),r.user}async function qbe(n,e){if(!T7(n))throw new Error("Invalid email address");const t=await Bfe(B0,n.trim().toLowerCase(),e);return await MN(Yu(os,"users",t.user.uid),{isOnline:!0,lastSeen:Fu()},{merge:!0}),t.user}async function Ybe(){const n=B0.currentUser;n&&await MN(Yu(os,"users",n.uid),{isOnline:!1,lastSeen:Fu()},{merge:!0}),await Vfe(B0)}function $be(n){return Ufe(B0,n)}async function Jbe(n){const e=await Bde(Yu(os,"users",n));return e.exists()?e.data():null}const Qbe=({onDone:n})=>{const[e,t]=V.useState("glass");return V.useEffect(()=>{const i=setTimeout(()=>t("check"),1200),r=setTimeout(()=>t("done"),2400),s=setTimeout(n,2800);return()=>{clearTimeout(i),clearTimeout(r),clearTimeout(s)}},[n]),S.jsxs(Le.div,{exit:{opacity:0,scale:1.05},transition:{duration:.4},className:"fixed inset-0 z-[300] flex items-center justify-center",style:{background:"linear-gradient(135deg, hsl(220 20% 12%), hsl(220 30% 8%))"},children:[S.jsx("div",{className:"absolute top-1/3 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[300px] h-[300px] rounded-full blur-[120px] opacity-15",style:{background:"radial-gradient(circle, hsl(var(--primary)), transparent 70%)"}}),S.jsxs(Le.div,{initial:{opacity:0,scale:.8,y:30},animate:{opacity:1,scale:1,y:0},transition:{type:"spring",bounce:.3,duration:.8},className:"relative w-52 h-64 rounded-3xl overflow-hidden",style:{background:"linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02))",backdropFilter:"blur(40px)",border:"1px solid rgba(255,255,255,0.12)",boxShadow:"0 32px 64px -16px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1)"},children:[S.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:"linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(255,255,255,0.03) 100%)"}}),S.jsxs("div",{className:"flex flex-col items-center justify-center h-full relative z-10",children:[S.jsx(Le.div,{animate:{scale:e==="check"?.8:1},className:"w-16 h-16 rounded-2xl bg-gradient-to-br from-primary to-primary/60 flex items-center justify-center mb-4",style:{boxShadow:"0 12px 30px -6px hsl(var(--glow-red))"},children:S.jsxs(Gs,{mode:"wait",children:[e==="glass"&&S.jsx(Le.span,{exit:{scale:0,opacity:0},className:"text-primary-foreground text-2xl font-black",children:"C"},"c"),(e==="check"||e==="done")&&S.jsx(Le.div,{initial:{scale:0,rotate:-180},animate:{scale:1,rotate:0},transition:{type:"spring",bounce:.5},children:S.jsx(dA,{size:28,className:"text-primary-foreground",strokeWidth:3})},"check")]})}),S.jsx(Le.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.3},className:"text-white/50 text-xs font-medium",children:e==="glass"?"Loading...":e==="check"?"Welcome back!":"Entering..."}),S.jsx("div",{className:"w-24 h-1 bg-white/10 rounded-full mt-4 overflow-hidden",children:S.jsx(Le.div,{initial:{width:0},animate:{width:e==="glass"?"40%":e==="check"?"80%":"100%"},transition:{duration:.8,ease:"easeOut"},className:"h-full rounded-full",style:{background:"linear-gradient(90deg, hsl(var(--primary)), hsl(var(--primary) / 0.6))"}})})]})]})]})},Zbe=({onLogin:n,onBack:e})=>{const[t,i]=V.useState("login"),[r,s]=V.useState(""),[o,a]=V.useState(""),[l,c]=V.useState(""),[u,h]=V.useState(""),[f,m]=V.useState(!1),[y,_]=V.useState(""),[v,g]=V.useState(!1),[w,A]=V.useState(!1),[T,L]=V.useState(null),D=async()=>{if(_(""),!r.trim()||!l.trim()){_("Please fill in all fields");return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r.trim())){_("Please enter a valid email address");return}if(t==="register"&&!o.trim()){_("Please enter a username");return}if(t==="register"&&!/^[a-zA-Z0-9_]{3,20}$/.test(o.trim())){_("Username: 3-20 chars, letters/numbers/underscores");return}if(t==="register"&&l!==u){_("Passwords do not match");return}if(l.length<6){_("Password must be at least 6 characters");return}g(!0);try{if(t==="register"){const I=await Xbe(r.trim(),l,o.trim());L({name:o.trim(),uid:I.uid}),A(!0)}else{const I=await qbe(r.trim(),l);L({name:"",uid:I.uid}),A(!0)}}catch(I){const M=(I==null?void 0:I.code)||"";_(M==="auth/email-already-in-use"?"Email already registered":M==="auth/user-not-found"||M==="auth/wrong-password"||M==="auth/invalid-credential"?"Invalid email or password":M==="auth/weak-password"?"Password too weak (min 6 chars)":M==="auth/invalid-email"?"Invalid email address":(I==null?void 0:I.message)||"Something went wrong")}finally{g(!1)}},R=()=>{T&&n(T.name,T.uid)};return S.jsxs(S.Fragment,{children:[S.jsx(Gs,{children:w&&S.jsx(Qbe,{onDone:R})}),S.jsxs("div",{className:"fixed inset-0 z-[100] bg-card flex flex-col",children:[S.jsxs("header",{className:"flex items-center justify-between px-4 pt-12 pb-4",children:[S.jsx(Le.button,{whileTap:{scale:.85},onClick:e,className:"p-2.5 rounded-2xl key-button-white shadow-depth",children:S.jsx(Im,{size:18,className:"text-muted-foreground"})}),S.jsx(Le.button,{whileTap:{scale:.9},className:"p-2.5 rounded-2xl key-button-white shadow-depth",children:S.jsx(wQ,{size:18,className:"text-muted-foreground"})})]}),S.jsxs("div",{className:"flex-1 flex flex-col px-6 pt-6",children:[S.jsxs(Le.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"text-center mb-10",children:[S.jsx("h1",{className:"text-xl font-black text-foreground tracking-tight",children:t==="login"?"Welcome Back":"Create Account"}),S.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t==="login"?"Sign in with your email":"Join the community"})]}),S.jsxs(Le.div,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},transition:{delay:.1},className:"space-y-4",children:[S.jsxs("div",{className:"relative",children:[S.jsx("div",{className:"absolute left-4 top-1/2 -translate-y-1/2 text-muted-foreground/40",children:S.jsx(MQ,{size:18})}),S.jsx("input",{type:"email",value:r,onChange:I=>s(I.target.value),placeholder:"Email address",className:"w-full bg-secondary/60 border border-border/50 focus:border-primary/30 focus:bg-card rounded-2xl py-4 pl-12 pr-4 text-foreground font-medium text-sm outline-none transition-all shadow-depth"})]}),t==="register"&&S.jsxs(Le.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},className:"relative",children:[S.jsx("div",{className:"absolute left-4 top-1/2 -translate-y-1/2 text-muted-foreground/40",children:S.jsx(qP,{size:18})}),S.jsx("input",{type:"text",value:o,onChange:I=>a(I.target.value),placeholder:"Username (3-20 chars)",maxLength:20,className:"w-full bg-secondary/60 border border-border/50 focus:border-primary/30 focus:bg-card rounded-2xl py-4 pl-12 pr-4 text-foreground font-medium text-sm outline-none transition-all shadow-depth"})]}),S.jsxs("div",{className:"relative",children:[S.jsx("div",{className:"absolute left-4 top-1/2 -translate-y-1/2 text-muted-foreground/40",children:S.jsx(_1,{size:18})}),S.jsx("input",{type:f?"text":"password",value:l,onChange:I=>c(I.target.value),placeholder:"Password",className:"w-full bg-secondary/60 border border-border/50 focus:border-primary/30 focus:bg-card rounded-2xl py-4 pl-12 pr-12 text-foreground font-medium text-sm outline-none transition-all shadow-depth"}),S.jsx("button",{onClick:()=>m(!f),className:"absolute right-4 top-1/2 -translate-y-1/2 text-muted-foreground/40",children:f?S.jsx(AQ,{size:18}):S.jsx(KP,{size:18})})]}),t==="register"&&S.jsxs(Le.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},className:"relative",children:[S.jsx("div",{className:"absolute left-4 top-1/2 -translate-y-1/2 text-muted-foreground/40",children:S.jsx(_1,{size:18})}),S.jsx("input",{type:f?"text":"password",value:u,onChange:I=>h(I.target.value),placeholder:"Confirm Password",className:"w-full bg-secondary/60 border border-border/50 focus:border-primary/30 focus:bg-card rounded-2xl py-4 pl-12 pr-4 text-foreground font-medium text-sm outline-none transition-all shadow-depth"})]}),y&&S.jsx(Le.p,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},className:"text-xs text-destructive font-medium text-center",children:y}),S.jsxs(Le.button,{whileTap:{scale:.97},onClick:D,disabled:v,className:"w-full py-4 rounded-2xl text-primary-foreground font-bold text-sm uppercase tracking-wider disabled:opacity-60 flex items-center justify-center gap-2",style:{background:"linear-gradient(-225deg, hsl(var(--primary)), hsl(0 80% 65%))",boxShadow:"inset 0 -4px 0 0 hsl(0 60% 30%), inset 0 2px 0 0 hsl(0 80% 70%), 0 8px 25px -5px hsl(var(--glow-red))"},children:[v&&S.jsx(ZH,{size:16,className:"animate-spin"}),t==="login"?"Login":"Register"]})]}),S.jsx("div",{className:"mt-6 text-center",children:S.jsx("button",{onClick:()=>{i(t==="login"?"register":"login"),_("")},className:"text-xs text-muted-foreground",children:t==="login"?S.jsxs(S.Fragment,{children:["Don't have an account? ",S.jsx("span",{className:"text-primary font-bold",children:"Register"})]}):S.jsxs(S.Fragment,{children:["Already have an account? ",S.jsx("span",{className:"text-primary font-bold",children:"Login"})]})})}),t==="login"&&S.jsx("button",{className:"text-[11px] text-muted-foreground/60 mt-3 text-center",children:"Forgot password?"})]}),S.jsx("div",{className:"px-6 pb-10 pt-4 text-center",children:S.jsx("p",{className:"text-[9px] text-muted-foreground/40 uppercase tracking-wider",children:"By continuing you agree to our Terms of Service"})})]})]})},eCe=()=>{const[n,e]=V.useState(!1),[t,i]=V.useState("home"),[r,s]=V.useState(!1),[o,a]=V.useState(""),[l,c]=V.useState(""),[u,h]=V.useState(!1),[f,m]=V.useState(!1),[y,_]=V.useState(!1);V.useEffect(()=>$be(async T=>{if(T){const L=await Jbe(T.uid);a((L==null?void 0:L.username)||"Player"),c(T.uid),e(!0)}else e(!1),a(""),c("");_(!0)}),[]);const v=V.useCallback((A,T)=>{A&&a(A),T&&c(T),e(!0)},[]),g=V.useCallback(async()=>{await Ybe(),e(!1)},[]);if(!y)return S.jsx("div",{className:"fixed inset-0 bg-background flex items-center justify-center",children:S.jsx("div",{className:"w-8 h-8 border-3 border-border border-t-primary rounded-full animate-spin"})});if(!n)return S.jsx(Zbe,{onLogin:v,onBack:()=>{}});const w=u||f;return S.jsxs("div",{className:"fixed inset-0 bg-background flex flex-col overflow-hidden font-sans",children:[S.jsx("div",{className:"absolute top-[-10%] left-[-10%] w-[40%] h-[40%] bg-blue-100/40 rounded-full blur-[120px] pointer-events-none"}),S.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] w-[40%] h-[40%] bg-red-100/40 rounded-full blur-[120px] pointer-events-none"}),S.jsxs("div",{className:"flex-1 overflow-y-auto relative z-10",children:[t==="home"&&S.jsx(ole,{onGameModalChange:m}),t==="search"&&S.jsx(Kbe,{}),t==="chat"&&S.jsx(e0e,{uid:l,username:o,onOpenProfile:()=>s(!0),onChatOpen:h}),t==="settings"&&S.jsx(Hbe,{username:o,uid:l,onLogout:g}),t==="avatar"&&S.jsx(Dbe,{})]}),S.jsx(Gs,{children:r&&S.jsx(C7,{onBack:()=>s(!1)})}),!w&&S.jsx(ele,{activeTab:t,onTabChange:A=>{i(A),s(!1)}})]})},tCe=()=>{const n=s9();return V.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",n.pathname)},[n.pathname]),S.jsx("div",{className:"flex min-h-screen items-center justify-center bg-muted",children:S.jsxs("div",{className:"text-center",children:[S.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),S.jsx("p",{className:"mb-4 text-xl text-muted-foreground",children:"Oops! Page not found"}),S.jsx("a",{href:"/",className:"text-primary underline hover:text-primary/90",children:"Return to Home"})]})})},nCe=new une,iCe=()=>S.jsx(dne,{client:nCe,children:S.jsxs(Vte,{children:[S.jsx(AZ,{}),S.jsx(tee,{}),S.jsx(Jne,{children:S.jsxs(qne,{children:[S.jsx(cI,{path:"/",element:S.jsx(eCe,{})}),S.jsx(cI,{path:"*",element:S.jsx(tCe,{})})]})})]})});_H(document.getElementById("root")).render(S.jsx(iCe,{}));
