function vy(e,t){for(var r=0;rn[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();function wu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zh={exports:{}},Fo={},Jh={exports:{}},K={};/** * @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 si=Symbol.for("react.element"),xy=Symbol.for("react.portal"),wy=Symbol.for("react.fragment"),by=Symbol.for("react.strict_mode"),Sy=Symbol.for("react.profiler"),ky=Symbol.for("react.provider"),jy=Symbol.for("react.context"),Cy=Symbol.for("react.forward_ref"),Ny=Symbol.for("react.suspense"),Py=Symbol.for("react.memo"),Ey=Symbol.for("react.lazy"),Jc=Symbol.iterator;function Ty(e){return e===null||typeof e!="object"?null:(e=Jc&&e[Jc]||e["@@iterator"],typeof e=="function"?e:null)}var ep={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},tp=Object.assign,rp={};function Wn(e,t,r){this.props=e,this.context=t,this.refs=rp,this.updater=r||ep}Wn.prototype.isReactComponent={};Wn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};Wn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function np(){}np.prototype=Wn.prototype;function bu(e,t,r){this.props=e,this.context=t,this.refs=rp,this.updater=r||ep}var Su=bu.prototype=new np;Su.constructor=bu;tp(Su,Wn.prototype);Su.isPureReactComponent=!0;var ed=Array.isArray,sp=Object.prototype.hasOwnProperty,ku={current:null},ip={key:!0,ref:!0,__self:!0,__source:!0};function op(e,t,r){var n,s={},i=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)sp.call(t,n)&&!ip.hasOwnProperty(n)&&(s[n]=t[n]);var a=arguments.length-2;if(a===1)s.children=r;else if(1>>1,E=_[R];if(0>>1;Rs(ee,I))qs(me,ee)?(_[R]=me,_[q]=I,R=q):(_[R]=ee,_[X]=I,R=X);else if(qs(me,I))_[R]=me,_[q]=I,R=q;else break e}}return A}function s(_,A){var I=_.sortIndex-A.sortIndex;return I!==0?I:_.id-A.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,u=3,p=!1,m=!1,g=!1,w=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(_){for(var A=r(c);A!==null;){if(A.callback===null)n(c);else if(A.startTime<=_)n(c),A.sortIndex=A.expirationTime,t(l,A);else break;A=r(c)}}function b(_){if(g=!1,x(_),!m)if(r(l)!==null)m=!0,M(k);else{var A=r(c);A!==null&&W(b,A.startTime-_)}}function k(_,A){m=!1,g&&(g=!1,v(P),P=-1),p=!0;var I=u;try{for(x(A),f=r(l);f!==null&&(!(f.expirationTime>A)||_&&!O());){var R=f.callback;if(typeof R=="function"){f.callback=null,u=f.priorityLevel;var E=R(f.expirationTime<=A);A=e.unstable_now(),typeof E=="function"?f.callback=E:f===r(l)&&n(l),x(A)}else n(l);f=r(l)}if(f!==null)var H=!0;else{var X=r(c);X!==null&&W(b,X.startTime-A),H=!1}return H}finally{f=null,u=I,p=!1}}var C=!1,N=null,P=-1,V=5,T=-1;function O(){return!(e.unstable_now()-T_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<_?Math.floor(1e3/_):5},e.unstable_getCurrentPriorityLevel=function(){return u},e.unstable_getFirstCallbackNode=function(){return r(l)},e.unstable_next=function(_){switch(u){case 1:case 2:case 3:var A=3;break;default:A=u}var I=u;u=A;try{return _()}finally{u=I}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(_,A){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var I=u;u=_;try{return A()}finally{u=I}},e.unstable_scheduleCallback=function(_,A,I){var R=e.unstable_now();switch(typeof I=="object"&&I!==null?(I=I.delay,I=typeof I=="number"&&0R?(_.sortIndex=I,t(c,_),r(l)===null&&_===r(c)&&(g?(v(P),P=-1):g=!0,W(b,I-R))):(_.sortIndex=E,t(l,_),m||p||(m=!0,M(k))),_},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(_){var A=u;return function(){var I=u;u=A;try{return _.apply(this,arguments)}finally{u=I}}}})(dp);cp.exports=dp;var $y=cp.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 By=S,rt=$y;function L(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ol=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]*$/,rd={},nd={};function Wy(e){return ol.call(nd,e)?!0:ol.call(rd,e)?!1:Uy.test(e)?nd[e]=!0:(rd[e]=!0,!1)}function Hy(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function qy(e,t,r,n){if(t===null||typeof t>"u"||Hy(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ue(e,t,r,n,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=s,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var Ae={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ae[e]=new Ue(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ae[t]=new Ue(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ae[e]=new Ue(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ae[e]=new Ue(e,2,!1,e,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(e){Ae[e]=new Ue(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ae[e]=new Ue(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ae[e]=new Ue(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ae[e]=new Ue(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ae[e]=new Ue(e,5,!1,e.toLowerCase(),null,!1,!1)});var Cu=/[\-:]([a-z])/g;function Nu(e){return e[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(e){var t=e.replace(Cu,Nu);Ae[t]=new Ue(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Cu,Nu);Ae[t]=new Ue(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Cu,Nu);Ae[t]=new Ue(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ae[e]=new Ue(e,1,!1,e.toLowerCase(),null,!1,!1)});Ae.xlinkHref=new Ue("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ae[e]=new Ue(e,1,!1,e.toLowerCase(),null,!0,!0)});function Pu(e,t,r,n){var s=Ae.hasOwnProperty(t)?Ae[t]:null;(s!==null?s.type!==0:n||!(2a||s[o]!==i[a]){var l=` `+s[o].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{pa=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?fs(e):""}function Gy(e){switch(e.tag){case 5:return fs(e.type);case 16:return fs("Lazy");case 13:return fs("Suspense");case 19:return fs("SuspenseList");case 0:case 2:case 15:return e=ma(e.type,!1),e;case 11:return e=ma(e.type.render,!1),e;case 1:return e=ma(e.type,!0),e;default:return""}}function cl(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case cn:return"Fragment";case un:return"Portal";case al:return"Profiler";case Eu:return"StrictMode";case ll:return"Suspense";case ul:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case pp:return(e.displayName||"Context")+".Consumer";case hp:return(e._context.displayName||"Context")+".Provider";case Tu:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Mu:return t=e.displayName||null,t!==null?t:cl(e.type)||"Memo";case nr:t=e._payload,e=e._init;try{return cl(e(t))}catch{}}return null}function Yy(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return cl(t);case 8:return t===Eu?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Sr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function gp(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ky(e){var t=gp(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){n=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function yi(e){e._valueTracker||(e._valueTracker=Ky(e))}function yp(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=gp(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function eo(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function dl(e,t){var r=t.checked;return pe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function id(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=Sr(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function vp(e,t){t=t.checked,t!=null&&Pu(e,"checked",t,!1)}function fl(e,t){vp(e,t);var r=Sr(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?hl(e,t.type,r):t.hasOwnProperty("defaultValue")&&hl(e,t.type,Sr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function od(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function hl(e,t,r){(t!=="number"||eo(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var hs=Array.isArray;function Cn(e,t,r,n){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=vi.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Vs(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var ys={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},Xy=["Webkit","ms","Moz","O"];Object.keys(ys).forEach(function(e){Xy.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ys[t]=ys[e]})});function Sp(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||ys.hasOwnProperty(e)&&ys[e]?(""+t).trim():t+"px"}function kp(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,s=Sp(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,s):e[r]=s}}var Qy=pe({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 gl(e,t){if(t){if(Qy[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(L(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(L(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(L(61))}if(t.style!=null&&typeof t.style!="object")throw Error(L(62))}}function yl(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 vl=null;function Au(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var xl=null,Nn=null,Pn=null;function ud(e){if(e=li(e)){if(typeof xl!="function")throw Error(L(280));var t=e.stateNode;t&&(t=Bo(t),xl(e.stateNode,e.type,t))}}function jp(e){Nn?Pn?Pn.push(e):Pn=[e]:Nn=e}function Cp(){if(Nn){var e=Nn,t=Pn;if(Pn=Nn=null,ud(e),t)for(e=0;e>>=0,e===0?32:31-(l1(e)/u1|0)|0}var xi=64,wi=4194304;function ps(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function so(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,s=e.suspendedLanes,i=e.pingedLanes,o=r&268435455;if(o!==0){var a=o&~s;a!==0?n=ps(a):(i&=o,i!==0&&(n=ps(i)))}else o=r&~s,o!==0?n=ps(o):i!==0&&(n=ps(i));if(n===0)return 0;if(t!==0&&t!==n&&!(t&s)&&(s=n&-n,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0r;r++)t.push(e);return t}function oi(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-xt(t),e[t]=r}function h1(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0=xs),vd=" ",xd=!1;function Hp(e,t){switch(e){case"keyup":return $1.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qp(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var dn=!1;function U1(e,t){switch(e){case"compositionend":return qp(t);case"keypress":return t.which!==32?null:(xd=!0,vd);case"textInput":return e=t.data,e===vd&&xd?null:e;default:return null}}function W1(e,t){if(dn)return e==="compositionend"||!zu&&Hp(e,t)?(e=Up(),$i=Vu=ur=null,dn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=kd(r)}}function Xp(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Xp(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qp(){for(var e=window,t=eo();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=eo(e.document)}return t}function Ou(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function J1(e){var t=Qp(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&Xp(r.ownerDocument.documentElement,r)){if(n!==null&&Ou(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=r.textContent.length,i=Math.min(n.start,s);n=n.end===void 0?i:Math.min(n.end,s),!e.extend&&i>n&&(s=n,n=i,i=s),s=jd(r,i);var o=jd(r,n);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,fn=null,Cl=null,bs=null,Nl=!1;function Cd(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Nl||fn==null||fn!==eo(n)||(n=fn,"selectionStart"in n&&Ou(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),bs&&Bs(bs,n)||(bs=n,n=ao(Cl,"onSelect"),0mn||(e.current=_l[mn],_l[mn]=null,mn--)}function re(e,t){mn++,_l[mn]=e.current,e.current=t}var kr={},Ve=Er(kr),qe=Er(!1),Kr=kr;function Dn(e,t){var r=e.type.contextTypes;if(!r)return kr;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in r)s[i]=t[i];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Ge(e){return e=e.childContextTypes,e!=null}function uo(){ae(qe),ae(Ve)}function _d(e,t,r){if(Ve.current!==kr)throw Error(L(168));re(Ve,t),re(qe,r)}function om(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var s in n)if(!(s in t))throw Error(L(108,Yy(e)||"Unknown",s));return pe({},r,n)}function co(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||kr,Kr=Ve.current,re(Ve,e),re(qe,qe.current),!0}function Ld(e,t,r){var n=e.stateNode;if(!n)throw Error(L(169));r?(e=om(e,t,Kr),n.__reactInternalMemoizedMergedChildContext=e,ae(qe),ae(Ve),re(Ve,e)):ae(qe),re(qe,r)}var Ft=null,Uo=!1,Ta=!1;function am(e){Ft===null?Ft=[e]:Ft.push(e)}function dv(e){Uo=!0,am(e)}function Tr(){if(!Ta&&Ft!==null){Ta=!0;var e=0,t=J;try{var r=Ft;for(J=1;e>=o,s-=o,It=1<<32-xt(t)+s|r<P?(V=N,N=null):V=N.sibling;var T=u(v,N,x[P],b);if(T===null){N===null&&(N=V);break}e&&N&&T.alternate===null&&t(v,N),y=i(T,y,P),C===null?k=T:C.sibling=T,C=T,N=V}if(P===x.length)return r(v,N),ue&&Fr(v,P),k;if(N===null){for(;PP?(V=N,N=null):V=N.sibling;var O=u(v,N,T.value,b);if(O===null){N===null&&(N=V);break}e&&N&&O.alternate===null&&t(v,N),y=i(O,y,P),C===null?k=O:C.sibling=O,C=O,N=V}if(T.done)return r(v,N),ue&&Fr(v,P),k;if(N===null){for(;!T.done;P++,T=x.next())T=f(v,T.value,b),T!==null&&(y=i(T,y,P),C===null?k=T:C.sibling=T,C=T);return ue&&Fr(v,P),k}for(N=n(v,N);!T.done;P++,T=x.next())T=p(N,v,P,T.value,b),T!==null&&(e&&T.alternate!==null&&N.delete(T.key===null?P:T.key),y=i(T,y,P),C===null?k=T:C.sibling=T,C=T);return e&&N.forEach(function(j){return t(v,j)}),ue&&Fr(v,P),k}function w(v,y,x,b){if(typeof x=="object"&&x!==null&&x.type===cn&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case gi:e:{for(var k=x.key,C=y;C!==null;){if(C.key===k){if(k=x.type,k===cn){if(C.tag===7){r(v,C.sibling),y=s(C,x.props.children),y.return=v,v=y;break e}}else if(C.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===nr&&Vd(k)===C.type){r(v,C.sibling),y=s(C,x.props),y.ref=is(v,C,x),y.return=v,v=y;break e}r(v,C);break}else t(v,C);C=C.sibling}x.type===cn?(y=Gr(x.props.children,v.mode,b,x.key),y.return=v,v=y):(b=Ki(x.type,x.key,x.props,null,v.mode,b),b.ref=is(v,y,x),b.return=v,v=b)}return o(v);case un:e:{for(C=x.key;y!==null;){if(y.key===C)if(y.tag===4&&y.stateNode.containerInfo===x.containerInfo&&y.stateNode.implementation===x.implementation){r(v,y.sibling),y=s(y,x.children||[]),y.return=v,v=y;break e}else{r(v,y);break}else t(v,y);y=y.sibling}y=Fa(x,v.mode,b),y.return=v,v=y}return o(v);case nr:return C=x._init,w(v,y,C(x._payload),b)}if(hs(x))return m(v,y,x,b);if(es(x))return g(v,y,x,b);Pi(v,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,y!==null&&y.tag===6?(r(v,y.sibling),y=s(y,x),y.return=v,v=y):(r(v,y),y=Va(x,v.mode,b),y.return=v,v=y),o(v)):r(v,y)}return w}var Vn=dm(!0),fm=dm(!1),po=Er(null),mo=null,vn=null,Wu=null;function Hu(){Wu=vn=mo=null}function qu(e){var t=po.current;ae(po),e._currentValue=t}function Rl(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function Tn(e,t){mo=e,Wu=vn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(He=!0),e.firstContext=null)}function ft(e){var t=e._currentValue;if(Wu!==e)if(e={context:e,memoizedValue:t,next:null},vn===null){if(mo===null)throw Error(L(308));vn=e,mo.dependencies={lanes:0,firstContext:e}}else vn=vn.next=e;return t}var Ur=null;function Gu(e){Ur===null?Ur=[e]:Ur.push(e)}function hm(e,t,r,n){var s=t.interleaved;return s===null?(r.next=r,Gu(t)):(r.next=s.next,s.next=r),t.interleaved=r,qt(e,n)}function qt(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var sr=!1;function Yu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function pm(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function $t(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function gr(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Q&2){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,qt(e,r)}return s=n.interleaved,s===null?(t.next=t,Gu(n)):(t.next=s.next,s.next=t),n.interleaved=t,qt(e,r)}function Ui(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Lu(e,r)}}function Fd(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var s=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?s=i=o:i=i.next=o,r=r.next}while(r!==null);i===null?s=i=t:i=i.next=t}else s=i=t;r={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function go(e,t,r,n){var s=e.updateQueue;sr=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?i=c:o.next=c,o=l;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=c:a.next=c,d.lastBaseUpdate=l))}if(i!==null){var f=s.baseState;o=0,d=c=l=null,a=i;do{var u=a.lane,p=a.eventTime;if((n&u)===u){d!==null&&(d=d.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=e,g=a;switch(u=t,p=r,g.tag){case 1:if(m=g.payload,typeof m=="function"){f=m.call(p,f,u);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,u=typeof m=="function"?m.call(p,f,u):m,u==null)break e;f=pe({},f,u);break e;case 2:sr=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,u=s.effects,u===null?s.effects=[a]:u.push(a))}else p={eventTime:p,lane:u,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(c=d=p,l=f):d=d.next=p,o|=u;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;u=a,a=u.next,u.next=null,s.lastBaseUpdate=u,s.shared.pending=null}}while(!0);if(d===null&&(l=f),s.baseState=l,s.firstBaseUpdate=c,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Zr|=o,e.lanes=o,e.memoizedState=f}}function Id(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var n=Aa.transition;Aa.transition={};try{e(!1),t()}finally{J=r,Aa.transition=n}}function Am(){return ht().memoizedState}function mv(e,t,r){var n=vr(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},_m(e))Lm(t,r);else if(r=hm(e,t,r,n),r!==null){var s=$e();wt(r,e,n,s),Dm(r,t,n)}}function gv(e,t,r){var n=vr(e),s={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(_m(e))Lm(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,r);if(s.hasEagerState=!0,s.eagerState=a,bt(a,o)){var l=t.interleaved;l===null?(s.next=s,Gu(t)):(s.next=l.next,l.next=s),t.interleaved=s;return}}catch{}finally{}r=hm(e,t,s,n),r!==null&&(s=$e(),wt(r,e,n,s),Dm(r,t,n))}}function _m(e){var t=e.alternate;return e===he||t!==null&&t===he}function Lm(e,t){Ss=vo=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Dm(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Lu(e,r)}}var xo={readContext:ft,useCallback:_e,useContext:_e,useEffect:_e,useImperativeHandle:_e,useInsertionEffect:_e,useLayoutEffect:_e,useMemo:_e,useReducer:_e,useRef:_e,useState:_e,useDebugValue:_e,useDeferredValue:_e,useTransition:_e,useMutableSource:_e,useSyncExternalStore:_e,useId:_e,unstable_isNewReconciler:!1},yv={readContext:ft,useCallback:function(e,t){return Ct().memoizedState=[e,t===void 0?null:t],e},useContext:ft,useEffect:Od,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,Hi(4194308,4,Nm.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Hi(4194308,4,e,t)},useInsertionEffect:function(e,t){return Hi(4,2,e,t)},useMemo:function(e,t){var r=Ct();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=Ct();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=mv.bind(null,he,e),[n.memoizedState,e]},useRef:function(e){var t=Ct();return e={current:e},t.memoizedState=e},useState:zd,useDebugValue:rc,useDeferredValue:function(e){return Ct().memoizedState=e},useTransition:function(){var e=zd(!1),t=e[0];return e=pv.bind(null,e[1]),Ct().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=he,s=Ct();if(ue){if(r===void 0)throw Error(L(407));r=r()}else{if(r=t(),Ee===null)throw Error(L(349));Qr&30||vm(n,t,r)}s.memoizedState=r;var i={value:r,getSnapshot:t};return s.queue=i,Od(wm.bind(null,n,i,e),[e]),n.flags|=2048,Xs(9,xm.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=Ct(),t=Ee.identifierPrefix;if(ue){var r=zt,n=It;r=(n&~(1<<32-xt(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=Ys++,0<\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[Nt]=t,e[Hs]=n,Wm(e,t,!1,!1),t.stateNode=e;e:{switch(o=yl(r,n),r){case"dialog":ie("cancel",e),ie("close",e),s=n;break;case"iframe":case"object":case"embed":ie("load",e),s=n;break;case"video":case"audio":for(s=0;szn&&(t.flags|=128,n=!0,os(i,!1),t.lanes=4194304)}else{if(!n)if(e=yo(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),os(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!ue)return Le(t),null}else 2*ve()-i.renderingStartTime>zn&&r!==1073741824&&(t.flags|=128,n=!0,os(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(r=i.last,r!==null?r.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ve(),t.sibling=null,r=de.current,re(de,n?r&1|2:r&1),t):(Le(t),null);case 22:case 23:return lc(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?Ze&1073741824&&(Le(t),t.subtreeFlags&6&&(t.flags|=8192)):Le(t),null;case 24:return null;case 25:return null}throw Error(L(156,t.tag))}function Cv(e,t){switch(Bu(t),t.tag){case 1:return Ge(t.type)&&uo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Fn(),ae(qe),ae(Ve),Qu(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Xu(t),null;case 13:if(ae(de),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(L(340));Rn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ae(de),null;case 4:return Fn(),null;case 10:return qu(t.type._context),null;case 22:case 23:return lc(),null;case 24:return null;default:return null}}var Ti=!1,Re=!1,Nv=typeof WeakSet=="function"?WeakSet:Set,$=null;function xn(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){ge(e,t,n)}else r.current=null}function Wl(e,t,r){try{r()}catch(n){ge(e,t,n)}}var Qd=!1;function Pv(e,t){if(Pl=io,e=Qp(),Ou(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var s=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var o=0,a=-1,l=-1,c=0,d=0,f=e,u=null;t:for(;;){for(var p;f!==r||s!==0&&f.nodeType!==3||(a=o+s),f!==i||n!==0&&f.nodeType!==3||(l=o+n),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)u=f,f=p;for(;;){if(f===e)break t;if(u===r&&++c===s&&(a=o),u===i&&++d===n&&(l=o),(p=f.nextSibling)!==null)break;f=u,u=f.parentNode}f=p}r=a===-1||l===-1?null:{start:a,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(El={focusedElem:e,selectionRange:r},io=!1,$=t;$!==null;)if(t=$,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,$=e;else for(;$!==null;){t=$;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var g=m.memoizedProps,w=m.memoizedState,v=t.stateNode,y=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:mt(t.type,g),w);v.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(L(163))}}catch(b){ge(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,$=e;break}$=t.return}return m=Qd,Qd=!1,m}function ks(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&Wl(t,r,i)}s=s.next}while(s!==n)}}function qo(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function Hl(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function Gm(e){var t=e.alternate;t!==null&&(e.alternate=null,Gm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Nt],delete t[Hs],delete t[Al],delete t[uv],delete t[cv])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ym(e){return e.tag===5||e.tag===3||e.tag===4}function Zd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ym(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ql(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=lo));else if(n!==4&&(e=e.child,e!==null))for(ql(e,t,r),e=e.sibling;e!==null;)ql(e,t,r),e=e.sibling}function Gl(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(Gl(e,t,r),e=e.sibling;e!==null;)Gl(e,t,r),e=e.sibling}var Te=null,gt=!1;function Jt(e,t,r){for(r=r.child;r!==null;)Km(e,t,r),r=r.sibling}function Km(e,t,r){if(Tt&&typeof Tt.onCommitFiberUnmount=="function")try{Tt.onCommitFiberUnmount(Io,r)}catch{}switch(r.tag){case 5:Re||xn(r,t);case 6:var n=Te,s=gt;Te=null,Jt(e,t,r),Te=n,gt=s,Te!==null&&(gt?(e=Te,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Te.removeChild(r.stateNode));break;case 18:Te!==null&&(gt?(e=Te,r=r.stateNode,e.nodeType===8?Ea(e.parentNode,r):e.nodeType===1&&Ea(e,r),Os(e)):Ea(Te,r.stateNode));break;case 4:n=Te,s=gt,Te=r.stateNode.containerInfo,gt=!0,Jt(e,t,r),Te=n,gt=s;break;case 0:case 11:case 14:case 15:if(!Re&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){s=n=n.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Wl(r,t,o),s=s.next}while(s!==n)}Jt(e,t,r);break;case 1:if(!Re&&(xn(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(a){ge(r,t,a)}Jt(e,t,r);break;case 21:Jt(e,t,r);break;case 22:r.mode&1?(Re=(n=Re)||r.memoizedState!==null,Jt(e,t,r),Re=n):Jt(e,t,r);break;default:Jt(e,t,r)}}function Jd(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Nv),t.forEach(function(n){var s=Vv.bind(null,e,n);r.has(n)||(r.add(n),n.then(s,s))})}}function pt(e,t){var r=t.deletions;if(r!==null)for(var n=0;ns&&(s=o),n&=~i}if(n=s,n=ve()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Tv(n/1960))-n,10e?16:e,cr===null)var n=!1;else{if(e=cr,cr=null,So=0,Q&6)throw Error(L(331));var s=Q;for(Q|=4,$=e.current;$!==null;){var i=$,o=i.child;if($.flags&16){var a=i.deletions;if(a!==null){for(var l=0;lve()-oc?qr(e,0):ic|=r),Ye(e,t)}function n0(e,t){t===0&&(e.mode&1?(t=wi,wi<<=1,!(wi&130023424)&&(wi=4194304)):t=1);var r=$e();e=qt(e,t),e!==null&&(oi(e,t,r),Ye(e,r))}function Rv(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),n0(e,r)}function Vv(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,s=e.memoizedState;s!==null&&(r=s.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(L(314))}n!==null&&n.delete(t),n0(e,r)}var s0;s0=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||qe.current)He=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return He=!1,kv(e,t,r);He=!!(e.flags&131072)}else He=!1,ue&&t.flags&1048576&&lm(t,ho,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;qi(e,t),e=t.pendingProps;var s=Dn(t,Ve.current);Tn(t,r),s=Ju(null,t,n,e,s,r);var i=ec();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ge(n)?(i=!0,co(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Yu(t),s.updater=Ho,t.stateNode=s,s._reactInternals=t,Fl(t,n,e,r),t=Ol(null,t,n,!0,i,r)):(t.tag=0,ue&&i&&$u(t),Oe(null,t,s,r),t=t.child),t;case 16:n=t.elementType;e:{switch(qi(e,t),e=t.pendingProps,s=n._init,n=s(n._payload),t.type=n,s=t.tag=Iv(n),e=mt(n,e),s){case 0:t=zl(null,t,n,e,r);break e;case 1:t=Yd(null,t,n,e,r);break e;case 11:t=qd(null,t,n,e,r);break e;case 14:t=Gd(null,t,n,mt(n.type,e),r);break e}throw Error(L(306,n,""))}return t;case 0:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:mt(n,s),zl(e,t,n,s,r);case 1:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:mt(n,s),Yd(e,t,n,s,r);case 3:e:{if($m(t),e===null)throw Error(L(387));n=t.pendingProps,i=t.memoizedState,s=i.element,pm(e,t),go(t,n,null,r);var o=t.memoizedState;if(n=o.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=In(Error(L(423)),t),t=Kd(e,t,n,r,s);break e}else if(n!==s){s=In(Error(L(424)),t),t=Kd(e,t,n,r,s);break e}else for(Je=mr(t.stateNode.containerInfo.firstChild),tt=t,ue=!0,yt=null,r=fm(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Rn(),n===s){t=Gt(e,t,r);break e}Oe(e,t,n,r)}t=t.child}return t;case 5:return mm(t),e===null&&Dl(t),n=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,Tl(n,s)?o=null:i!==null&&Tl(n,i)&&(t.flags|=32),Om(e,t),Oe(e,t,o,r),t.child;case 6:return e===null&&Dl(t),null;case 13:return Bm(e,t,r);case 4:return Ku(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Vn(t,null,n,r):Oe(e,t,n,r),t.child;case 11:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:mt(n,s),qd(e,t,n,s,r);case 7:return Oe(e,t,t.pendingProps,r),t.child;case 8:return Oe(e,t,t.pendingProps.children,r),t.child;case 12:return Oe(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,re(po,n._currentValue),n._currentValue=o,i!==null)if(bt(i.value,o)){if(i.children===s.children&&!qe.current){t=Gt(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var l=a.firstContext;l!==null;){if(l.context===n){if(i.tag===1){l=$t(-1,r&-r),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?l.next=l:(l.next=d.next,d.next=l),c.pending=l}}i.lanes|=r,l=i.alternate,l!==null&&(l.lanes|=r),Rl(i.return,r,t),a.lanes|=r;break}l=l.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(L(341));o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),Rl(o,r,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}Oe(e,t,s.children,r),t=t.child}return t;case 9:return s=t.type,n=t.pendingProps.children,Tn(t,r),s=ft(s),n=n(s),t.flags|=1,Oe(e,t,n,r),t.child;case 14:return n=t.type,s=mt(n,t.pendingProps),s=mt(n.type,s),Gd(e,t,n,s,r);case 15:return Im(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:mt(n,s),qi(e,t),t.tag=1,Ge(n)?(e=!0,co(t)):e=!1,Tn(t,r),Rm(t,n,s),Fl(t,n,s,r),Ol(null,t,n,!0,e,r);case 19:return Um(e,t,r);case 22:return zm(e,t,r)}throw Error(L(156,t.tag))};function i0(e,t){return _p(e,t)}function Fv(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ct(e,t,r,n){return new Fv(e,t,r,n)}function cc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Iv(e){if(typeof e=="function")return cc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Tu)return 11;if(e===Mu)return 14}return 2}function xr(e,t){var r=e.alternate;return r===null?(r=ct(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Ki(e,t,r,n,s,i){var o=2;if(n=e,typeof e=="function")cc(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case cn:return Gr(r.children,s,i,t);case Eu:o=8,s|=8;break;case al:return e=ct(12,r,t,s|2),e.elementType=al,e.lanes=i,e;case ll:return e=ct(13,r,t,s),e.elementType=ll,e.lanes=i,e;case ul:return e=ct(19,r,t,s),e.elementType=ul,e.lanes=i,e;case mp:return Yo(r,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case hp:o=10;break e;case pp:o=9;break e;case Tu:o=11;break e;case Mu:o=14;break e;case nr:o=16,n=null;break e}throw Error(L(130,e==null?e:typeof e,""))}return t=ct(o,r,t,s),t.elementType=e,t.type=n,t.lanes=i,t}function Gr(e,t,r,n){return e=ct(7,e,n,t),e.lanes=r,e}function Yo(e,t,r,n){return e=ct(22,e,n,t),e.elementType=mp,e.lanes=r,e.stateNode={isHidden:!1},e}function Va(e,t,r){return e=ct(6,e,null,t),e.lanes=r,e}function Fa(e,t,r){return t=ct(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function zv(e,t,r,n,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ya(0),this.expirationTimes=ya(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ya(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function dc(e,t,r,n,s,i,o,a,l){return e=new zv(e,t,r,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=ct(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Yu(i),e}function Ov(e,t,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(u0)}catch(e){console.error(e)}}u0(),up.exports=st;var Hv=up.exports,lf=Hv;il.createRoot=lf.createRoot,il.hydrateRoot=lf.hydrateRoot;/** * @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 Zs(){return Zs=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function c0(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Gv(){return Math.random().toString(36).substr(2,8)}function cf(e,t){return{usr:e.state,key:e.key,idx:t}}function Zl(e,t,r,n){return r===void 0&&(r=null),Zs({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Gn(t):t,{state:r,key:t&&t.key||n||Gv()})}function Co(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Gn(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function Yv(e,t,r,n){n===void 0&&(n={});let{window:s=document.defaultView,v5Compat:i=!1}=n,o=s.history,a=dr.Pop,l=null,c=d();c==null&&(c=0,o.replaceState(Zs({},o.state,{idx:c}),""));function d(){return(o.state||{idx:null}).idx}function f(){a=dr.Pop;let w=d(),v=w==null?null:w-c;c=w,l&&l({action:a,location:g.location,delta:v})}function u(w,v){a=dr.Push;let y=Zl(g.location,w,v);c=d()+1;let x=cf(y,c),b=g.createHref(y);try{o.pushState(x,"",b)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;s.location.assign(b)}i&&l&&l({action:a,location:g.location,delta:1})}function p(w,v){a=dr.Replace;let y=Zl(g.location,w,v);c=d();let x=cf(y,c),b=g.createHref(y);o.replaceState(x,"",b),i&&l&&l({action:a,location:g.location,delta:0})}function m(w){let v=s.location.origin!=="null"?s.location.origin:s.location.href,y=typeof w=="string"?w:Co(w);return y=y.replace(/ $/,"%20"),we(v,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,v)}let g={get action(){return a},get location(){return e(s,o)},listen(w){if(l)throw new Error("A history only accepts one active listener");return s.addEventListener(uf,f),l=w,()=>{s.removeEventListener(uf,f),l=null}},createHref(w){return t(s,w)},createURL:m,encodeLocation(w){let v=m(w);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:u,replace:p,go(w){return o.go(w)}};return g}var df;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(df||(df={}));function Kv(e,t,r){return r===void 0&&(r="/"),Xv(e,t,r)}function Xv(e,t,r,n){let s=typeof t=="string"?Gn(t):t,i=mc(s.pathname||"/",r);if(i==null)return null;let o=d0(e);Qv(o);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?i.path||"":a,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};l.relativePath.startsWith("/")&&(we(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let c=wr([n,l.relativePath]),d=r.concat(l);i.children&&i.children.length>0&&(we(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),d0(i.children,t,d,c)),!(i.path==null&&!i.index)&&t.push({path:c,score:sx(c,i.index),routesMeta:d})};return e.forEach((i,o)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))s(i,o);else for(let l of f0(i.path))s(i,o,l)}),t}function f0(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,s=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return s?[i,""]:[i];let o=f0(n.join("/")),a=[];return a.push(...o.map(l=>l===""?i:[i,l].join("/"))),s&&a.push(...o),a.map(l=>e.startsWith("/")&&l===""?"/":l)}function Qv(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:ix(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const Zv=/^:[\w-]+$/,Jv=3,ex=2,tx=1,rx=10,nx=-2,ff=e=>e==="*";function sx(e,t){let r=e.split("/"),n=r.length;return r.some(ff)&&(n+=nx),t&&(n+=ex),r.filter(s=>!ff(s)).reduce((s,i)=>s+(Zv.test(i)?Jv:i===""?tx:rx),n)}function ix(e,t){return e.length===t.length&&e.slice(0,-1).every((n,s)=>n===t[s])?e[e.length-1]-t[t.length-1]:0}function ox(e,t,r){let{routesMeta:n}=e,s={},i="/",o=[];for(let a=0;a{let{paramName:u,isOptional:p}=d;if(u==="*"){let g=a[f]||"";o=i.slice(0,i.length-g.length).replace(/(.)\/+$/,"$1")}const m=a[f];return p&&!m?c[u]=void 0:c[u]=(m||"").replace(/%2F/g,"/"),c},{}),pathname:i,pathnameBase:o,pattern:e}}function lx(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),c0(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(n.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),n]}function ux(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return c0(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function mc(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}function cx(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:s=""}=typeof e=="string"?Gn(e):e;return{pathname:r?r.startsWith("/")?r:dx(r,t):t,search:px(n),hash:mx(s)}}function dx(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function Ia(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function fx(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function gc(e,t){let r=fx(e);return t?r.map((n,s)=>s===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function yc(e,t,r,n){n===void 0&&(n=!1);let s;typeof e=="string"?s=Gn(e):(s=Zs({},e),we(!s.pathname||!s.pathname.includes("?"),Ia("?","pathname","search",s)),we(!s.pathname||!s.pathname.includes("#"),Ia("#","pathname","hash",s)),we(!s.search||!s.search.includes("#"),Ia("#","search","hash",s)));let i=e===""||s.pathname==="",o=i?"/":s.pathname,a;if(o==null)a=r;else{let f=t.length-1;if(!n&&o.startsWith("..")){let u=o.split("/");for(;u[0]==="..";)u.shift(),f-=1;s.pathname=u.join("/")}a=f>=0?t[f]:"/"}let l=cx(s,a),c=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}const wr=e=>e.join("/").replace(/\/\/+/g,"/"),hx=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),px=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,mx=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function gx(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const h0=["post","put","patch","delete"];new Set(h0);const yx=["get",...h0];new Set(yx);/** * 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 Js(){return Js=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),S.useCallback(function(c,d){if(d===void 0&&(d={}),!a.current)return;if(typeof c=="number"){n.go(c);return}let f=yc(c,JSON.parse(o),i,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:wr([t,f.pathname])),(d.replace?n.replace:n.push)(f,d.state,d)},[t,n,o,i,e])}function g0(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=S.useContext(Mr),{matches:s}=S.useContext(Ar),{pathname:i}=_r(),o=JSON.stringify(gc(s,n.v7_relativeSplatPath));return S.useMemo(()=>yc(e,JSON.parse(o),i,r==="path"),[e,o,i,r])}function bx(e,t){return Sx(e,t)}function Sx(e,t,r,n){Yn()||we(!1);let{navigator:s}=S.useContext(Mr),{matches:i}=S.useContext(Ar),o=i[i.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let c=_r(),d;if(t){var f;let w=typeof t=="string"?Gn(t):t;l==="/"||(f=w.pathname)!=null&&f.startsWith(l)||we(!1),d=w}else d=c;let u=d.pathname||"/",p=u;if(l!=="/"){let w=l.replace(/^\//,"").split("/");p="/"+u.replace(/^\//,"").split("/").slice(w.length).join("/")}let m=Kv(e,{pathname:p}),g=Px(m&&m.map(w=>Object.assign({},w,{params:Object.assign({},a,w.params),pathname:wr([l,s.encodeLocation?s.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?l:wr([l,s.encodeLocation?s.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),i,r,n);return t&&g?S.createElement(Jo.Provider,{value:{location:Js({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:dr.Pop}},g):g}function kx(){let e=Ax(),t=gx(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},t),r?S.createElement("pre",{style:s},r):null,null)}const jx=S.createElement(kx,null);class Cx extends S.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?S.createElement(Ar.Provider,{value:this.props.routeContext},S.createElement(p0.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Nx(e){let{routeContext:t,match:r,children:n}=e,s=S.useContext(vc);return s&&s.static&&s.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=r.route.id),S.createElement(Ar.Provider,{value:t},n)}function Px(e,t,r,n){var s;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var i;if(!r)return null;if(r.errors)e=r.matches;else if((i=n)!=null&&i.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,a=(s=r)==null?void 0:s.errors;if(a!=null){let d=o.findIndex(f=>f.route.id&&(a==null?void 0:a[f.route.id])!==void 0);d>=0||we(!1),o=o.slice(0,Math.min(o.length,d+1))}let l=!1,c=-1;if(r&&n&&n.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((d,f,u)=>{let p,m=!1,g=null,w=null;r&&(p=a&&f.route.id?a[f.route.id]:void 0,g=f.route.errorElement||jx,l&&(c<0&&u===0?(Lx("route-fallback"),m=!0,w=null):c===u&&(m=!0,w=f.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,u+1)),y=()=>{let x;return p?x=g:m?x=w:f.route.Component?x=S.createElement(f.route.Component,null):f.route.element?x=f.route.element:x=d,S.createElement(Nx,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:r!=null},children:x})};return r&&(f.route.ErrorBoundary||f.route.errorElement||u===0)?S.createElement(Cx,{location:r.location,revalidation:r.revalidation,component:g,error:p,children:y(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):y()},null)}var y0=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(y0||{}),v0=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(v0||{});function Ex(e){let t=S.useContext(vc);return t||we(!1),t}function Tx(e){let t=S.useContext(vx);return t||we(!1),t}function Mx(e){let t=S.useContext(Ar);return t||we(!1),t}function x0(e){let t=Mx(),r=t.matches[t.matches.length-1];return r.route.id||we(!1),r.route.id}function Ax(){var e;let t=S.useContext(p0),r=Tx(),n=x0();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function _x(){let{router:e}=Ex(y0.UseNavigateStable),t=x0(v0.UseNavigateStable),r=S.useRef(!1);return m0(()=>{r.current=!0}),S.useCallback(function(s,i){i===void 0&&(i={}),r.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,Js({fromRouteId:t},i)))},[e,t])}const hf={};function Lx(e,t,r){hf[e]||(hf[e]=!0)}function Dx(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Rx(e){let{to:t,replace:r,state:n,relative:s}=e;Yn()||we(!1);let{future:i,static:o}=S.useContext(Mr),{matches:a}=S.useContext(Ar),{pathname:l}=_r(),c=ea(),d=yc(t,gc(a,i.v7_relativeSplatPath),l,s==="path"),f=JSON.stringify(d);return S.useEffect(()=>c(JSON.parse(f),{replace:r,state:n,relative:s}),[c,f,s,r,n]),null}function jt(e){we(!1)}function Vx(e){let{basename:t="/",children:r=null,location:n,navigationType:s=dr.Pop,navigator:i,static:o=!1,future:a}=e;Yn()&&we(!1);let l=t.replace(/^\/*/,"/"),c=S.useMemo(()=>({basename:l,navigator:i,static:o,future:Js({v7_relativeSplatPath:!1},a)}),[l,a,i,o]);typeof n=="string"&&(n=Gn(n));let{pathname:d="/",search:f="",hash:u="",state:p=null,key:m="default"}=n,g=S.useMemo(()=>{let w=mc(d,l);return w==null?null:{location:{pathname:w,search:f,hash:u,state:p,key:m},navigationType:s}},[l,d,f,u,p,m,s]);return g==null?null:S.createElement(Mr.Provider,{value:c},S.createElement(Jo.Provider,{children:r,value:g}))}function Fx(e){let{children:t,location:r}=e;return bx(Jl(t),r)}new Promise(()=>{});function Jl(e,t){t===void 0&&(t=[]);let r=[];return S.Children.forEach(e,(n,s)=>{if(!S.isValidElement(n))return;let i=[...t,s];if(n.type===S.Fragment){r.push.apply(r,Jl(n.props.children,i));return}n.type!==jt&&we(!1),!n.props.index||!n.props.children||we(!1);let o={id:n.props.id||i.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=Jl(n.props.children,i)),r.push(o)}),r}/** * 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 */function eu(){return eu=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(r[s]=e[s]);return r}function zx(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ox(e,t){return e.button===0&&(!t||t==="_self")&&!zx(e)}function tu(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(s=>[r,s]):[[r,n]])},[]))}function $x(e,t){let r=tu(e);return t&&t.forEach((n,s)=>{r.has(s)||t.getAll(s).forEach(i=>{r.append(s,i)})}),r}const Bx=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Ux="6";try{window.__reactRouterVersion=Ux}catch{}const Wx="startTransition",pf=Dy[Wx];function Hx(e){let{basename:t,children:r,future:n,window:s}=e,i=S.useRef();i.current==null&&(i.current=qv({window:s,v5Compat:!0}));let o=i.current,[a,l]=S.useState({action:o.action,location:o.location}),{v7_startTransition:c}=n||{},d=S.useCallback(f=>{c&&pf?pf(()=>l(f)):l(f)},[l,c]);return S.useLayoutEffect(()=>o.listen(d),[o,d]),S.useEffect(()=>Dx(n),[n]),S.createElement(Vx,{basename:t,children:r,location:a.location,navigationType:a.action,navigator:o,future:n})}const qx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Gx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Xi=S.forwardRef(function(t,r){let{onClick:n,relative:s,reloadDocument:i,replace:o,state:a,target:l,to:c,preventScrollReset:d,viewTransition:f}=t,u=Ix(t,Bx),{basename:p}=S.useContext(Mr),m,g=!1;if(typeof c=="string"&&Gx.test(c)&&(m=c,qx))try{let x=new URL(window.location.href),b=c.startsWith("//")?new URL(x.protocol+c):new URL(c),k=mc(b.pathname,p);b.origin===x.origin&&k!=null?c=k+b.search+b.hash:g=!0}catch{}let w=xx(c,{relative:s}),v=Yx(c,{replace:o,state:a,target:l,preventScrollReset:d,relative:s,viewTransition:f});function y(x){n&&n(x),x.defaultPrevented||v(x)}return S.createElement("a",eu({},u,{href:m||w,onClick:g||i?n:y,ref:r,target:l}))});var mf;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(mf||(mf={}));var gf;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(gf||(gf={}));function Yx(e,t){let{target:r,replace:n,state:s,preventScrollReset:i,relative:o,viewTransition:a}=t===void 0?{}:t,l=ea(),c=_r(),d=g0(e,{relative:o});return S.useCallback(f=>{if(Ox(f,r)){f.preventDefault();let u=n!==void 0?n:Co(c)===Co(d);l(e,{replace:u,state:s,preventScrollReset:i,relative:o,viewTransition:a})}},[c,l,d,n,s,r,e,i,o,a])}function Kx(e){let t=S.useRef(tu(e)),r=S.useRef(!1),n=_r(),s=S.useMemo(()=>$x(n.search,r.current?null:t.current),[n.search]),i=ea(),o=S.useCallback((a,l)=>{const c=tu(typeof a=="function"?a(s):a);r.current=!0,i("?"+c,l)},[i,s]);return[s,o]}let Xx={data:""},Qx=e=>{if(typeof window=="object"){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||Xx},Zx=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Jx=/\/\*[^]*?\*\/| +/g,yf=/\n+/g,lr=(e,t)=>{let r="",n="",s="";for(let i in e){let o=e[i];i[0]=="@"?i[1]=="i"?r=i+" "+o+";":n+=i[1]=="f"?lr(o,i):i+"{"+lr(o,i[1]=="k"?"":t)+"}":typeof o=="object"?n+=lr(o,t?t.replace(/([^,])+/g,a=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,a):a?a+" "+l:l)):i):o!=null&&(i=/^--/.test(i)?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),s+=lr.p?lr.p(i,o):i+":"+o+";")}return r+(t&&s?t+"{"+s+"}":s)+n},Dt={},w0=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+w0(e[r]);return t}return e},e2=(e,t,r,n,s)=>{let i=w0(e),o=Dt[i]||(Dt[i]=(l=>{let c=0,d=11;for(;c>>0;return"go"+d})(i));if(!Dt[o]){let l=i!==e?e:(c=>{let d,f,u=[{}];for(;d=Zx.exec(c.replace(Jx,""));)d[4]?u.shift():d[3]?(f=d[3].replace(yf," ").trim(),u.unshift(u[0][f]=u[0][f]||{})):u[0][d[1]]=d[2].replace(yf," ").trim();return u[0]})(e);Dt[o]=lr(s?{["@keyframes "+o]:l}:l,r?"":"."+o)}let a=r&&Dt.g?Dt.g:null;return r&&(Dt.g=Dt[o]),((l,c,d,f)=>{f?c.data=c.data.replace(f,l):c.data.indexOf(l)===-1&&(c.data=d?l+c.data:c.data+l)})(Dt[o],t,n,a),o},t2=(e,t,r)=>e.reduce((n,s,i)=>{let o=t[i];if(o&&o.call){let a=o(r),l=a&&a.props&&a.props.className||/^go/.test(a)&&a;o=l?"."+l:a&&typeof a=="object"?a.props?"":lr(a,""):a===!1?"":a}return n+s+(o??"")},"");function ta(e){let t=this||{},r=e.call?e(t.p):e;return e2(r.unshift?r.raw?t2(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,Qx(t.target),t.g,t.o,t.k)}let b0,ru,nu;ta.bind({g:1});let Yt=ta.bind({k:1});function r2(e,t,r,n){lr.p=t,b0=e,ru=r,nu=n}function Lr(e,t){let r=this||{};return function(){let n=arguments;function s(i,o){let a=Object.assign({},i),l=a.className||s.className;r.p=Object.assign({theme:ru&&ru()},a),r.o=/ *go\d+/.test(l),a.className=ta.apply(r,n)+(l?" "+l:"");let c=e;return e[0]&&(c=a.as||e,delete a.as),nu&&c[0]&&nu(a),b0(c,a)}return s}}var n2=e=>typeof e=="function",No=(e,t)=>n2(e)?e(t):e,s2=(()=>{let e=0;return()=>(++e).toString()})(),S0=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),i2=20,xc="default",k0=(e,t)=>{let{toastLimit:r}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,r)};case 1:return{...e,toasts:e.toasts.map(o=>o.id===t.toast.id?{...o,...t.toast}:o)};case 2:let{toast:n}=t;return k0(e,{type:e.toasts.find(o=>o.id===n.id)?1:0,toast:n});case 3:let{toastId:s}=t;return{...e,toasts:e.toasts.map(o=>o.id===s||s===void 0?{...o,dismissed:!0,visible:!1}:o)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(o=>o.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let i=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(o=>({...o,pauseDuration:o.pauseDuration+i}))}}},Qi=[],j0={toasts:[],pausedAt:void 0,settings:{toastLimit:i2}},Pt={},C0=(e,t=xc)=>{Pt[t]=k0(Pt[t]||j0,e),Qi.forEach(([r,n])=>{r===t&&n(Pt[t])})},N0=e=>Object.keys(Pt).forEach(t=>C0(e,t)),o2=e=>Object.keys(Pt).find(t=>Pt[t].toasts.some(r=>r.id===e)),ra=(e=xc)=>t=>{C0(t,e)},a2={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},l2=(e={},t=xc)=>{let[r,n]=S.useState(Pt[t]||j0),s=S.useRef(Pt[t]);S.useEffect(()=>(s.current!==Pt[t]&&n(Pt[t]),Qi.push([t,n]),()=>{let o=Qi.findIndex(([a])=>a===t);o>-1&&Qi.splice(o,1)}),[t]);let i=r.toasts.map(o=>{var a,l,c;return{...e,...e[o.type],...o,removeDelay:o.removeDelay||((a=e[o.type])==null?void 0:a.removeDelay)||(e==null?void 0:e.removeDelay),duration:o.duration||((l=e[o.type])==null?void 0:l.duration)||(e==null?void 0:e.duration)||a2[o.type],style:{...e.style,...(c=e[o.type])==null?void 0:c.style,...o.style}}});return{...r,toasts:i}},u2=(e,t="blank",r)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...r,id:(r==null?void 0:r.id)||s2()}),ci=e=>(t,r)=>{let n=u2(t,e,r);return ra(n.toasterId||o2(n.id))({type:2,toast:n}),n.id},Ce=(e,t)=>ci("blank")(e,t);Ce.error=ci("error");Ce.success=ci("success");Ce.loading=ci("loading");Ce.custom=ci("custom");Ce.dismiss=(e,t)=>{let r={type:3,toastId:e};t?ra(t)(r):N0(r)};Ce.dismissAll=e=>Ce.dismiss(void 0,e);Ce.remove=(e,t)=>{let r={type:4,toastId:e};t?ra(t)(r):N0(r)};Ce.removeAll=e=>Ce.remove(void 0,e);Ce.promise=(e,t,r)=>{let n=Ce.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?No(t.success,s):void 0;return i?Ce.success(i,{id:n,...r,...r==null?void 0:r.success}):Ce.dismiss(n),s}).catch(s=>{let i=t.error?No(t.error,s):void 0;i?Ce.error(i,{id:n,...r,...r==null?void 0:r.error}):Ce.dismiss(n)}),e};var c2=1e3,d2=(e,t="default")=>{let{toasts:r,pausedAt:n}=l2(e,t),s=S.useRef(new Map).current,i=S.useCallback((f,u=c2)=>{if(s.has(f))return;let p=setTimeout(()=>{s.delete(f),o({type:4,toastId:f})},u);s.set(f,p)},[]);S.useEffect(()=>{if(n)return;let f=Date.now(),u=r.map(p=>{if(p.duration===1/0)return;let m=(p.duration||0)+p.pauseDuration-(f-p.createdAt);if(m<0){p.visible&&Ce.dismiss(p.id);return}return setTimeout(()=>Ce.dismiss(p.id,t),m)});return()=>{u.forEach(p=>p&&clearTimeout(p))}},[r,n,t]);let o=S.useCallback(ra(t),[t]),a=S.useCallback(()=>{o({type:5,time:Date.now()})},[o]),l=S.useCallback((f,u)=>{o({type:1,toast:{id:f,height:u}})},[o]),c=S.useCallback(()=>{n&&o({type:6,time:Date.now()})},[n,o]),d=S.useCallback((f,u)=>{let{reverseOrder:p=!1,gutter:m=8,defaultPosition:g}=u||{},w=r.filter(x=>(x.position||g)===(f.position||g)&&x.height),v=w.findIndex(x=>x.id===f.id),y=w.filter((x,b)=>bx.visible).slice(...p?[y+1]:[0,y]).reduce((x,b)=>x+(b.height||0)+m,0)},[r]);return S.useEffect(()=>{r.forEach(f=>{if(f.dismissed)i(f.id,f.removeDelay);else{let u=s.get(f.id);u&&(clearTimeout(u),s.delete(f.id))}})},[r,i]),{toasts:r,handlers:{updateHeight:l,startPause:a,endPause:c,calculateOffset:d}}},f2=Yt` from { transform: scale(0) rotate(45deg); opacity: 0; } to { transform: scale(1) rotate(45deg); opacity: 1; }`,h2=Yt` from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; }`,p2=Yt` from { transform: scale(0) rotate(90deg); opacity: 0; } to { transform: scale(1) rotate(90deg); opacity: 1; }`,m2=Lr("div")` width: 20px; opacity: 0; height: 20px; border-radius: 10px; background: ${e=>e.primary||"#ff4b4b"}; position: relative; transform: rotate(45deg); animation: ${f2} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; animation-delay: 100ms; &:after, &:before { content: ''; animation: ${h2} 0.15s ease-out forwards; animation-delay: 150ms; position: absolute; border-radius: 3px; opacity: 0; background: ${e=>e.secondary||"#fff"}; bottom: 9px; left: 4px; height: 2px; width: 12px; } &:before { animation: ${p2} 0.15s ease-out forwards; animation-delay: 180ms; transform: rotate(90deg); } `,g2=Yt` from { transform: rotate(0deg); } to { transform: rotate(360deg); } `,y2=Lr("div")` width: 12px; height: 12px; box-sizing: border-box; border: 2px solid; border-radius: 100%; border-color: ${e=>e.secondary||"#e0e0e0"}; border-right-color: ${e=>e.primary||"#616161"}; animation: ${g2} 1s linear infinite; `,v2=Yt` from { transform: scale(0) rotate(45deg); opacity: 0; } to { transform: scale(1) rotate(45deg); opacity: 1; }`,x2=Yt` 0% { height: 0; width: 0; opacity: 0; } 40% { height: 0; width: 6px; opacity: 1; } 100% { opacity: 1; height: 10px; }`,w2=Lr("div")` width: 20px; opacity: 0; height: 20px; border-radius: 10px; background: ${e=>e.primary||"#61d345"}; position: relative; transform: rotate(45deg); animation: ${v2} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; animation-delay: 100ms; &:after { content: ''; box-sizing: border-box; animation: ${x2} 0.2s ease-out forwards; opacity: 0; animation-delay: 200ms; position: absolute; border-right: 2px solid; border-bottom: 2px solid; border-color: ${e=>e.secondary||"#fff"}; bottom: 6px; left: 6px; height: 10px; width: 6px; } `,b2=Lr("div")` position: absolute; `,S2=Lr("div")` position: relative; display: flex; justify-content: center; align-items: center; min-width: 20px; min-height: 20px; `,k2=Yt` from { transform: scale(0.6); opacity: 0.4; } to { transform: scale(1); opacity: 1; }`,j2=Lr("div")` position: relative; transform: scale(0.6); opacity: 0.4; min-width: 20px; animation: ${k2} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; `,C2=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?S.createElement(j2,null,t):t:r==="blank"?null:S.createElement(S2,null,S.createElement(y2,{...n}),r!=="loading"&&S.createElement(b2,null,r==="error"?S.createElement(m2,{...n}):S.createElement(w2,{...n})))},N2=e=>` 0% {transform: translate3d(0,${e*-200}%,0) scale(.6); opacity:.5;} 100% {transform: translate3d(0,0,0) scale(1); opacity:1;} `,P2=e=>` 0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;} 100% {transform: translate3d(0,${e*-150}%,-1px) scale(.6); opacity:0;} `,E2="0%{opacity:0;} 100%{opacity:1;}",T2="0%{opacity:1;} 100%{opacity:0;}",M2=Lr("div")` display: flex; align-items: center; background: #fff; color: #363636; line-height: 1.3; will-change: transform; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05); max-width: 350px; pointer-events: auto; padding: 8px 10px; border-radius: 8px; `,A2=Lr("div")` display: flex; justify-content: center; margin: 4px 10px; color: inherit; flex: 1 1 auto; white-space: pre-line; `,_2=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=S0()?[E2,T2]:[N2(r),P2(r)];return{animation:t?`${Yt(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${Yt(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},L2=S.memo(({toast:e,position:t,style:r,children:n})=>{let s=e.height?_2(e.position||t||"top-center",e.visible):{opacity:0},i=S.createElement(C2,{toast:e}),o=S.createElement(A2,{...e.ariaProps},No(e.message,e));return S.createElement(M2,{className:e.className,style:{...s,...r,...e.style}},typeof n=="function"?n({icon:i,message:o}):S.createElement(S.Fragment,null,i,o))});r2(S.createElement);var D2=({id:e,className:t,style:r,onHeightUpdate:n,children:s})=>{let i=S.useCallback(o=>{if(o){let a=()=>{let l=o.getBoundingClientRect().height;n(e,l)};a(),new MutationObserver(a).observe(o,{subtree:!0,childList:!0,characterData:!0})}},[e,n]);return S.createElement("div",{ref:i,className:t,style:r},s)},R2=(e,t)=>{let r=e.includes("top"),n=r?{top:0}:{bottom:0},s=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:S0()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...s}},V2=ta` z-index: 9999; > * { pointer-events: auto; } `,_i=16,F2=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:s,toasterId:i,containerStyle:o,containerClassName:a})=>{let{toasts:l,handlers:c}=d2(r,i);return S.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:_i,left:_i,right:_i,bottom:_i,pointerEvents:"none",...o},className:a,onMouseEnter:c.startPause,onMouseLeave:c.endPause},l.map(d=>{let f=d.position||t,u=c.calculateOffset(d,{reverseOrder:e,gutter:n,defaultPosition:t}),p=R2(f,u);return S.createElement(D2,{id:d.id,key:d.id,onHeightUpdate:c.updateHeight,className:d.visible?V2:"",style:p},d.type==="custom"?No(d.message,d):s?s(d):S.createElement(L2,{toast:d,position:f}))}))},ce=Ce;const P0=S.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),na=S.createContext({}),sa=S.createContext(null),ia=typeof document<"u",wc=ia?S.useLayoutEffect:S.useEffect,E0=S.createContext({strict:!1}),bc=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),I2="framerAppearId",T0="data-"+bc(I2);function z2(e,t,r,n){const{visualElement:s}=S.useContext(na),i=S.useContext(E0),o=S.useContext(sa),a=S.useContext(P0).reducedMotion,l=S.useRef();n=n||i.renderer,!l.current&&n&&(l.current=n(e,{visualState:t,parent:s,props:r,presenceContext:o,blockInitialAnimation:o?o.initial===!1:!1,reducedMotionConfig:a}));const c=l.current;S.useInsertionEffect(()=>{c&&c.update(r,o)});const d=S.useRef(!!(r[T0]&&!window.HandoffComplete));return wc(()=>{c&&(c.render(),d.current&&c.animationState&&c.animationState.animateChanges())}),S.useEffect(()=>{c&&(c.updateFeatures(),!d.current&&c.animationState&&c.animationState.animateChanges(),d.current&&(d.current=!1,window.HandoffComplete=!0))}),c}function bn(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function O2(e,t,r){return S.useCallback(n=>{n&&e.mount&&e.mount(n),t&&(n?t.mount(n):t.unmount()),r&&(typeof r=="function"?r(n):bn(r)&&(r.current=n))},[t])}function ei(e){return typeof e=="string"||Array.isArray(e)}function oa(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const Sc=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],kc=["initial",...Sc];function aa(e){return oa(e.animate)||kc.some(t=>ei(e[t]))}function M0(e){return!!(aa(e)||e.variants)}function $2(e,t){if(aa(e)){const{initial:r,animate:n}=e;return{initial:r===!1||ei(r)?r:void 0,animate:ei(n)?n:void 0}}return e.inherit!==!1?t:{}}function B2(e){const{initial:t,animate:r}=$2(e,S.useContext(na));return S.useMemo(()=>({initial:t,animate:r}),[vf(t),vf(r)])}function vf(e){return Array.isArray(e)?e.join(" "):e}const xf={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"]},ti={};for(const e in xf)ti[e]={isEnabled:t=>xf[e].some(r=>!!t[r])};function U2(e){for(const t in e)ti[t]={...ti[t],...e[t]}}const jc=S.createContext({}),A0=S.createContext({}),W2=Symbol.for("motionComponentSymbol");function H2({preloadedFeatures:e,createVisualElement:t,useRender:r,useVisualState:n,Component:s}){e&&U2(e);function i(a,l){let c;const d={...S.useContext(P0),...a,layoutId:q2(a)},{isStatic:f}=d,u=B2(a),p=n(a,f);if(!f&&ia){u.visualElement=z2(s,p,d,t);const m=S.useContext(A0),g=S.useContext(E0).strict;u.visualElement&&(c=u.visualElement.loadFeatures(d,g,e,m))}return S.createElement(na.Provider,{value:u},c&&u.visualElement?S.createElement(c,{visualElement:u.visualElement,...d}):null,r(s,a,O2(p,u.visualElement,l),p,f,u.visualElement))}const o=S.forwardRef(i);return o[W2]=s,o}function q2({layoutId:e}){const t=S.useContext(jc).id;return t&&e!==void 0?t+"-"+e:e}function G2(e){function t(n,s={}){return H2(e(n,s))}if(typeof Proxy>"u")return t;const r=new Map;return new Proxy(t,{get:(n,s)=>(r.has(s)||r.set(s,t(s)),r.get(s))})}const Y2=["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 Cc(e){return typeof e!="string"||e.includes("-")?!1:!!(Y2.indexOf(e)>-1||/[A-Z]/.test(e))}const Po={};function K2(e){Object.assign(Po,e)}const di=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],nn=new Set(di);function _0(e,{layout:t,layoutId:r}){return nn.has(e)||e.startsWith("origin")||(t||r!==void 0)&&(!!Po[e]||e==="opacity")}const Xe=e=>!!(e&&e.getVelocity),X2={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Q2=di.length;function Z2(e,{enableHardwareAcceleration:t=!0,allowTransformNone:r=!0},n,s){let i="";for(let o=0;ot=>typeof t=="string"&&t.startsWith(e),D0=L0("--"),su=L0("var(--"),J2=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,ew=(e,t)=>t&&typeof e=="number"?t.transform(e):e,jr=(e,t,r)=>Math.min(Math.max(r,e),t),sn={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Ns={...sn,transform:e=>jr(0,1,e)},Li={...sn,default:1},Ps=e=>Math.round(e*1e5)/1e5,la=/(-)?([\d]*\.?[\d])+/g,R0=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,tw=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function fi(e){return typeof e=="string"}const hi=e=>({test:t=>fi(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),rr=hi("deg"),At=hi("%"),U=hi("px"),rw=hi("vh"),nw=hi("vw"),wf={...At,parse:e=>At.parse(e)/100,transform:e=>At.transform(e*100)},bf={...sn,transform:Math.round},V0={borderWidth:U,borderTopWidth:U,borderRightWidth:U,borderBottomWidth:U,borderLeftWidth:U,borderRadius:U,radius:U,borderTopLeftRadius:U,borderTopRightRadius:U,borderBottomRightRadius:U,borderBottomLeftRadius:U,width:U,maxWidth:U,height:U,maxHeight:U,size:U,top:U,right:U,bottom:U,left:U,padding:U,paddingTop:U,paddingRight:U,paddingBottom:U,paddingLeft:U,margin:U,marginTop:U,marginRight:U,marginBottom:U,marginLeft:U,rotate:rr,rotateX:rr,rotateY:rr,rotateZ:rr,scale:Li,scaleX:Li,scaleY:Li,scaleZ:Li,skew:rr,skewX:rr,skewY:rr,distance:U,translateX:U,translateY:U,translateZ:U,x:U,y:U,z:U,perspective:U,transformPerspective:U,opacity:Ns,originX:wf,originY:wf,originZ:U,zIndex:bf,fillOpacity:Ns,strokeOpacity:Ns,numOctaves:bf};function Nc(e,t,r,n){const{style:s,vars:i,transform:o,transformOrigin:a}=e;let l=!1,c=!1,d=!0;for(const f in t){const u=t[f];if(D0(f)){i[f]=u;continue}const p=V0[f],m=ew(u,p);if(nn.has(f)){if(l=!0,o[f]=m,!d)continue;u!==(p.default||0)&&(d=!1)}else f.startsWith("origin")?(c=!0,a[f]=m):s[f]=m}if(t.transform||(l||n?s.transform=Z2(e.transform,r,d,n):s.transform&&(s.transform="none")),c){const{originX:f="50%",originY:u="50%",originZ:p=0}=a;s.transformOrigin=`${f} ${u} ${p}`}}const Pc=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function F0(e,t,r){for(const n in t)!Xe(t[n])&&!_0(n,r)&&(e[n]=t[n])}function sw({transformTemplate:e},t,r){return S.useMemo(()=>{const n=Pc();return Nc(n,t,{enableHardwareAcceleration:!r},e),Object.assign({},n.vars,n.style)},[t])}function iw(e,t,r){const n=e.style||{},s={};return F0(s,n,e),Object.assign(s,sw(e,t,r)),e.transformValues?e.transformValues(s):s}function ow(e,t,r){const n={},s=iw(e,t,r);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=s,n}const aw=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Eo(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||aw.has(e)}let I0=e=>!Eo(e);function lw(e){e&&(I0=t=>t.startsWith("on")?!Eo(t):e(t))}try{lw(require("@emotion/is-prop-valid").default)}catch{}function uw(e,t,r){const n={};for(const s in e)s==="values"&&typeof e.values=="object"||(I0(s)||r===!0&&Eo(s)||!t&&!Eo(s)||e.draggable&&s.startsWith("onDrag"))&&(n[s]=e[s]);return n}function Sf(e,t,r){return typeof e=="string"?e:U.transform(t+r*e)}function cw(e,t,r){const n=Sf(t,e.x,e.width),s=Sf(r,e.y,e.height);return`${n} ${s}`}const dw={offset:"stroke-dashoffset",array:"stroke-dasharray"},fw={offset:"strokeDashoffset",array:"strokeDasharray"};function hw(e,t,r=1,n=0,s=!0){e.pathLength=1;const i=s?dw:fw;e[i.offset]=U.transform(-n);const o=U.transform(t),a=U.transform(r);e[i.array]=`${o} ${a}`}function Ec(e,{attrX:t,attrY:r,attrScale:n,originX:s,originY:i,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...c},d,f,u){if(Nc(e,c,d,u),f){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:p,style:m,dimensions:g}=e;p.transform&&(g&&(m.transform=p.transform),delete p.transform),g&&(s!==void 0||i!==void 0||m.transform)&&(m.transformOrigin=cw(g,s!==void 0?s:.5,i!==void 0?i:.5)),t!==void 0&&(p.x=t),r!==void 0&&(p.y=r),n!==void 0&&(p.scale=n),o!==void 0&&hw(p,o,a,l,!1)}const z0=()=>({...Pc(),attrs:{}}),Tc=e=>typeof e=="string"&&e.toLowerCase()==="svg";function pw(e,t,r,n){const s=S.useMemo(()=>{const i=z0();return Ec(i,t,{enableHardwareAcceleration:!1},Tc(n),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};F0(i,e.style,e),s.style={...i,...s.style}}return s}function mw(e=!1){return(r,n,s,{latestValues:i},o)=>{const l=(Cc(r)?pw:ow)(n,i,o,r),d={...uw(n,typeof r=="string",e),...l,ref:s},{children:f}=n,u=S.useMemo(()=>Xe(f)?f.get():f,[f]);return S.createElement(r,{...d,children:u})}}function O0(e,{style:t,vars:r},n,s){Object.assign(e.style,t,s&&s.getProjectionStyles(n));for(const i in r)e.style.setProperty(i,r[i])}const $0=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"]);function B0(e,t,r,n){O0(e,t,void 0,n);for(const s in t.attrs)e.setAttribute($0.has(s)?s:bc(s),t.attrs[s])}function Mc(e,t){const{style:r}=e,n={};for(const s in r)(Xe(r[s])||t.style&&Xe(t.style[s])||_0(s,e))&&(n[s]=r[s]);return n}function U0(e,t){const r=Mc(e,t);for(const n in e)if(Xe(e[n])||Xe(t[n])){const s=di.indexOf(n)!==-1?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n;r[s]=e[n]}return r}function Ac(e,t,r,n={},s={}){return typeof t=="function"&&(t=t(r!==void 0?r:e.custom,n,s)),typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"&&(t=t(r!==void 0?r:e.custom,n,s)),t}function W0(e){const t=S.useRef(null);return t.current===null&&(t.current=e()),t.current}const To=e=>Array.isArray(e),gw=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),yw=e=>To(e)?e[e.length-1]||0:e;function Zi(e){const t=Xe(e)?e.get():e;return gw(t)?t.toValue():t}function vw({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:r},n,s,i){const o={latestValues:xw(n,s,i,e),renderState:t()};return r&&(o.mount=a=>r(n,a,o)),o}const H0=e=>(t,r)=>{const n=S.useContext(na),s=S.useContext(sa),i=()=>vw(e,t,n,s);return r?i():W0(i)};function xw(e,t,r,n){const s={},i=n(e,{});for(const u in i)s[u]=Zi(i[u]);let{initial:o,animate:a}=e;const l=aa(e),c=M0(e);t&&c&&!l&&e.inherit!==!1&&(o===void 0&&(o=t.initial),a===void 0&&(a=t.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const f=d?a:o;return f&&typeof f!="boolean"&&!oa(f)&&(Array.isArray(f)?f:[f]).forEach(p=>{const m=Ac(e,p);if(!m)return;const{transitionEnd:g,transition:w,...v}=m;for(const y in v){let x=v[y];if(Array.isArray(x)){const b=d?x.length-1:0;x=x[b]}x!==null&&(s[y]=x)}for(const y in g)s[y]=g[y]}),s}const xe=e=>e;class kf{constructor(){this.order=[],this.scheduled=new Set}add(t){if(!this.scheduled.has(t))return this.scheduled.add(t),this.order.push(t),!0}remove(t){const r=this.order.indexOf(t);r!==-1&&(this.order.splice(r,1),this.scheduled.delete(t))}clear(){this.order.length=0,this.scheduled.clear()}}function ww(e){let t=new kf,r=new kf,n=0,s=!1,i=!1;const o=new WeakSet,a={schedule:(l,c=!1,d=!1)=>{const f=d&&s,u=f?t:r;return c&&o.add(l),u.add(l)&&f&&s&&(n=t.order.length),l},cancel:l=>{r.remove(l),o.delete(l)},process:l=>{if(s){i=!0;return}if(s=!0,[t,r]=[r,t],r.clear(),n=t.order.length,n)for(let c=0;c(f[u]=ww(()=>r=!0),f),{}),o=f=>i[f].process(s),a=()=>{const f=performance.now();r=!1,s.delta=n?1e3/60:Math.max(Math.min(f-s.timestamp,bw),1),s.timestamp=f,s.isProcessing=!0,Di.forEach(o),s.isProcessing=!1,r&&t&&(n=!1,e(a))},l=()=>{r=!0,n=!0,s.isProcessing||e(a)};return{schedule:Di.reduce((f,u)=>{const p=i[u];return f[u]=(m,g=!1,w=!1)=>(r||l(),p.schedule(m,g,w)),f},{}),cancel:f=>Di.forEach(u=>i[u].cancel(f)),state:s,steps:i}}const{schedule:ne,cancel:Kt,state:De,steps:za}=Sw(typeof requestAnimationFrame<"u"?requestAnimationFrame:xe,!0),kw={useVisualState:H0({scrapeMotionValuesFromProps:U0,createRenderState:z0,onMount:(e,t,{renderState:r,latestValues:n})=>{ne.read(()=>{try{r.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),ne.render(()=>{Ec(r,n,{enableHardwareAcceleration:!1},Tc(t.tagName),e.transformTemplate),B0(t,r)})}})},jw={useVisualState:H0({scrapeMotionValuesFromProps:Mc,createRenderState:Pc})};function Cw(e,{forwardMotionProps:t=!1},r,n){return{...Cc(e)?kw:jw,preloadedFeatures:r,useRender:mw(t),createVisualElement:n,Component:e}}function Ot(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r)}const q0=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function ua(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}const Nw=e=>t=>q0(t)&&e(t,ua(t));function Bt(e,t,r,n){return Ot(e,t,Nw(r),n)}const Pw=(e,t)=>r=>t(e(r)),br=(...e)=>e.reduce(Pw);function G0(e){let t=null;return()=>{const r=()=>{t=null};return t===null?(t=e,r):!1}}const jf=G0("dragHorizontal"),Cf=G0("dragVertical");function Y0(e){let t=!1;if(e==="y")t=Cf();else if(e==="x")t=jf();else{const r=jf(),n=Cf();r&&n?t=()=>{r(),n()}:(r&&r(),n&&n())}return t}function K0(){const e=Y0(!0);return e?(e(),!1):!0}class Dr{constructor(t){this.isMounted=!1,this.node=t}update(){}}function Nf(e,t){const r="pointer"+(t?"enter":"leave"),n="onHover"+(t?"Start":"End"),s=(i,o)=>{if(i.pointerType==="touch"||K0())return;const a=e.getProps();e.animationState&&a.whileHover&&e.animationState.setActive("whileHover",t),a[n]&&ne.update(()=>a[n](i,o))};return Bt(e.current,r,s,{passive:!e.getProps()[n]})}class Ew extends Dr{mount(){this.unmount=br(Nf(this.node,!0),Nf(this.node,!1))}unmount(){}}class Tw extends Dr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!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=br(Ot(this.node.current,"focus",()=>this.onFocus()),Ot(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const X0=(e,t)=>t?e===t?!0:X0(e,t.parentElement):!1;function Oa(e,t){if(!t)return;const r=new PointerEvent("pointer"+e);t(r,ua(r))}class Mw extends Dr{constructor(){super(...arguments),this.removeStartListeners=xe,this.removeEndListeners=xe,this.removeAccessibleListeners=xe,this.startPointerPress=(t,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),i=Bt(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:c,onTapCancel:d,globalTapTarget:f}=this.node.getProps();ne.update(()=>{!f&&!X0(this.node.current,a.target)?d&&d(a,l):c&&c(a,l)})},{passive:!(n.onTap||n.onPointerUp)}),o=Bt(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=br(i,o),this.startPress(t,r)},this.startAccessiblePress=()=>{const t=i=>{if(i.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||Oa("up",(l,c)=>{const{onTap:d}=this.node.getProps();d&&ne.update(()=>d(l,c))})};this.removeEndListeners(),this.removeEndListeners=Ot(this.node.current,"keyup",o),Oa("down",(a,l)=>{this.startPress(a,l)})},r=Ot(this.node.current,"keydown",t),n=()=>{this.isPressing&&Oa("cancel",(i,o)=>this.cancelPress(i,o))},s=Ot(this.node.current,"blur",n);this.removeAccessibleListeners=br(r,s)}}startPress(t,r){this.isPressing=!0;const{onTapStart:n,whileTap:s}=this.node.getProps();s&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&ne.update(()=>n(t,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!K0()}cancelPress(t,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&ne.update(()=>n(t,r))}mount(){const t=this.node.getProps(),r=Bt(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=Ot(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=br(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const iu=new WeakMap,$a=new WeakMap,Aw=e=>{const t=iu.get(e.target);t&&t(e)},_w=e=>{e.forEach(Aw)};function Lw({root:e,...t}){const r=e||document;$a.has(r)||$a.set(r,{});const n=$a.get(r),s=JSON.stringify(t);return n[s]||(n[s]=new IntersectionObserver(_w,{root:e,...t})),n[s]}function Dw(e,t,r){const n=Lw(t);return iu.set(e,r),n.observe(e),()=>{iu.delete(e),n.unobserve(e)}}const Rw={some:0,all:1};class Vw extends Dr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:r,margin:n,amount:s="some",once:i}=t,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof s=="number"?s:Rw[s]},a=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,i&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),u=c?d:f;u&&u(l)};return Dw(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:r}=this.node;["amount","margin","root"].some(Fw(t,r))&&this.startObserver()}unmount(){}}function Fw({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}const Iw={inView:{Feature:Vw},tap:{Feature:Mw},focus:{Feature:Tw},hover:{Feature:Ew}};function Q0(e,t){if(!Array.isArray(t))return!1;const r=t.length;if(r!==e.length)return!1;for(let n=0;nt[n]=r.get()),t}function Ow(e){const t={};return e.values.forEach((r,n)=>t[n]=r.getVelocity()),t}function ca(e,t,r){const n=e.getProps();return Ac(n,t,r!==void 0?r:n.custom,zw(e),Ow(e))}let _c=xe;const Yr=e=>e*1e3,Ut=e=>e/1e3,$w={current:!1},Z0=e=>Array.isArray(e)&&typeof e[0]=="number";function J0(e){return!!(!e||typeof e=="string"&&eg[e]||Z0(e)||Array.isArray(e)&&e.every(J0))}const gs=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`,eg={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:gs([0,.65,.55,1]),circOut:gs([.55,0,1,.45]),backIn:gs([.31,.01,.66,-.59]),backOut:gs([.33,1.53,.69,.99])};function tg(e){if(e)return Z0(e)?gs(e):Array.isArray(e)?e.map(tg):eg[e]}function Bw(e,t,r,{delay:n=0,duration:s,repeat:i=0,repeatType:o="loop",ease:a,times:l}={}){const c={[t]:r};l&&(c.offset=l);const d=tg(a);return Array.isArray(d)&&(c.easing=d),e.animate(c,{delay:n,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}function Uw(e,{repeat:t,repeatType:r="loop"}){const n=t&&r!=="loop"&&t%2===1?0:e.length-1;return e[n]}const rg=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,Ww=1e-7,Hw=12;function qw(e,t,r,n,s){let i,o,a=0;do o=t+(r-t)/2,i=rg(o,n,s)-e,i>0?r=o:t=o;while(Math.abs(i)>Ww&&++aqw(i,0,1,e,r);return i=>i===0||i===1?i:rg(s(i),t,n)}const Gw=pi(.42,0,1,1),Yw=pi(0,0,.58,1),ng=pi(.42,0,.58,1),Kw=e=>Array.isArray(e)&&typeof e[0]!="number",sg=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,ig=e=>t=>1-e(1-t),Lc=e=>1-Math.sin(Math.acos(e)),og=ig(Lc),Xw=sg(Lc),ag=pi(.33,1.53,.69,.99),Dc=ig(ag),Qw=sg(Dc),Zw=e=>(e*=2)<1?.5*Dc(e):.5*(2-Math.pow(2,-10*(e-1))),Jw={linear:xe,easeIn:Gw,easeInOut:ng,easeOut:Yw,circIn:Lc,circInOut:Xw,circOut:og,backIn:Dc,backInOut:Qw,backOut:ag,anticipate:Zw},Pf=e=>{if(Array.isArray(e)){_c(e.length===4);const[t,r,n,s]=e;return pi(t,r,n,s)}else if(typeof e=="string")return Jw[e];return e},Rc=(e,t)=>r=>!!(fi(r)&&tw.test(r)&&r.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(r,t)),lg=(e,t,r)=>n=>{if(!fi(n))return n;const[s,i,o,a]=n.match(la);return{[e]:parseFloat(s),[t]:parseFloat(i),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},e5=e=>jr(0,255,e),Ba={...sn,transform:e=>Math.round(e5(e))},Hr={test:Rc("rgb","red"),parse:lg("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+Ba.transform(e)+", "+Ba.transform(t)+", "+Ba.transform(r)+", "+Ps(Ns.transform(n))+")"};function t5(e){let t="",r="",n="",s="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),n=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),n=e.substring(3,4),s=e.substring(4,5),t+=t,r+=r,n+=n,s+=s),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:s?parseInt(s,16)/255:1}}const ou={test:Rc("#"),parse:t5,transform:Hr.transform},Sn={test:Rc("hsl","hue"),parse:lg("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+At.transform(Ps(t))+", "+At.transform(Ps(r))+", "+Ps(Ns.transform(n))+")"},ze={test:e=>Hr.test(e)||ou.test(e)||Sn.test(e),parse:e=>Hr.test(e)?Hr.parse(e):Sn.test(e)?Sn.parse(e):ou.parse(e),transform:e=>fi(e)?e:e.hasOwnProperty("red")?Hr.transform(e):Sn.transform(e)},fe=(e,t,r)=>-r*e+r*t+e;function Ua(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function r5({hue:e,saturation:t,lightness:r,alpha:n}){e/=360,t/=100,r/=100;let s=0,i=0,o=0;if(!t)s=i=o=r;else{const a=r<.5?r*(1+t):r+t-r*t,l=2*r-a;s=Ua(l,a,e+1/3),i=Ua(l,a,e),o=Ua(l,a,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:n}}const Wa=(e,t,r)=>{const n=e*e;return Math.sqrt(Math.max(0,r*(t*t-n)+n))},n5=[ou,Hr,Sn],s5=e=>n5.find(t=>t.test(e));function Ef(e){const t=s5(e);let r=t.parse(e);return t===Sn&&(r=r5(r)),r}const ug=(e,t)=>{const r=Ef(e),n=Ef(t),s={...r};return i=>(s.red=Wa(r.red,n.red,i),s.green=Wa(r.green,n.green,i),s.blue=Wa(r.blue,n.blue,i),s.alpha=fe(r.alpha,n.alpha,i),Hr.transform(s))};function i5(e){var t,r;return isNaN(e)&&fi(e)&&(((t=e.match(la))===null||t===void 0?void 0:t.length)||0)+(((r=e.match(R0))===null||r===void 0?void 0:r.length)||0)>0}const cg={regex:J2,countKey:"Vars",token:"${v}",parse:xe},dg={regex:R0,countKey:"Colors",token:"${c}",parse:ze.parse},fg={regex:la,countKey:"Numbers",token:"${n}",parse:sn.parse};function Ha(e,{regex:t,countKey:r,token:n,parse:s}){const i=e.tokenised.match(t);i&&(e["num"+r]=i.length,e.tokenised=e.tokenised.replace(t,n),e.values.push(...i.map(s)))}function Mo(e){const t=e.toString(),r={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return r.value.includes("var(--")&&Ha(r,cg),Ha(r,dg),Ha(r,fg),r}function hg(e){return Mo(e).values}function pg(e){const{values:t,numColors:r,numVars:n,tokenised:s}=Mo(e),i=t.length;return o=>{let a=s;for(let l=0;ltypeof e=="number"?0:e;function a5(e){const t=hg(e);return pg(e)(t.map(o5))}const Cr={test:i5,parse:hg,createTransformer:pg,getAnimatableNone:a5},mg=(e,t)=>r=>`${r>0?t:e}`;function gg(e,t){return typeof e=="number"?r=>fe(e,t,r):ze.test(e)?ug(e,t):e.startsWith("var(")?mg(e,t):vg(e,t)}const yg=(e,t)=>{const r=[...e],n=r.length,s=e.map((i,o)=>gg(i,t[o]));return i=>{for(let o=0;o{const r={...e,...t},n={};for(const s in r)e[s]!==void 0&&t[s]!==void 0&&(n[s]=gg(e[s],t[s]));return s=>{for(const i in n)r[i]=n[i](s);return r}},vg=(e,t)=>{const r=Cr.createTransformer(t),n=Mo(e),s=Mo(t);return n.numVars===s.numVars&&n.numColors===s.numColors&&n.numNumbers>=s.numNumbers?br(yg(n.values,s.values),r):mg(e,t)},ri=(e,t,r)=>{const n=t-e;return n===0?1:(r-e)/n},Tf=(e,t)=>r=>fe(e,t,r);function u5(e){return typeof e=="number"?Tf:typeof e=="string"?ze.test(e)?ug:vg:Array.isArray(e)?yg:typeof e=="object"?l5:Tf}function c5(e,t,r){const n=[],s=r||u5(e[0]),i=e.length-1;for(let o=0;ot[0];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const o=c5(t,n,s),a=o.length,l=c=>{let d=0;if(a>1)for(;dl(jr(e[0],e[i-1],c)):l}function d5(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const s=ri(0,t,n);e.push(fe(r,1,s))}}function f5(e){const t=[0];return d5(t,e.length-1),t}function h5(e,t){return e.map(r=>r*t)}function p5(e,t){return e.map(()=>t||ng).splice(0,e.length-1)}function Ao({duration:e=300,keyframes:t,times:r,ease:n="easeInOut"}){const s=Kw(n)?n.map(Pf):Pf(n),i={done:!1,value:t[0]},o=h5(r&&r.length===t.length?r:f5(t),e),a=xg(o,t,{ease:Array.isArray(s)?s:p5(t,s)});return{calculatedDuration:e,next:l=>(i.value=a(l),i.done=l>=e,i)}}function wg(e,t){return t?e*(1e3/t):0}const m5=5;function bg(e,t,r){const n=Math.max(t-m5,0);return wg(r-e(n),t-n)}const qa=.001,g5=.01,y5=10,v5=.05,x5=1;function w5({duration:e=800,bounce:t=.25,velocity:r=0,mass:n=1}){let s,i,o=1-t;o=jr(v5,x5,o),e=jr(g5,y5,Ut(e)),o<1?(s=c=>{const d=c*o,f=d*e,u=d-r,p=au(c,o),m=Math.exp(-f);return qa-u/p*m},i=c=>{const f=c*o*e,u=f*r+r,p=Math.pow(o,2)*Math.pow(c,2)*e,m=Math.exp(-f),g=au(Math.pow(c,2),o);return(-s(c)+qa>0?-1:1)*((u-p)*m)/g}):(s=c=>{const d=Math.exp(-c*e),f=(c-r)*e+1;return-qa+d*f},i=c=>{const d=Math.exp(-c*e),f=(r-c)*(e*e);return d*f});const a=5/e,l=S5(s,i,a);if(e=Yr(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{const c=Math.pow(l,2)*n;return{stiffness:c,damping:o*2*Math.sqrt(n*c),duration:e}}}const b5=12;function S5(e,t,r){let n=r;for(let s=1;se[r]!==void 0)}function C5(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!Mf(e,j5)&&Mf(e,k5)){const r=w5(e);t={...t,...r,mass:1},t.isResolvedFromDuration=!0}return t}function Sg({keyframes:e,restDelta:t,restSpeed:r,...n}){const s=e[0],i=e[e.length-1],o={done:!1,value:s},{stiffness:a,damping:l,mass:c,duration:d,velocity:f,isResolvedFromDuration:u}=C5({...n,velocity:-Ut(n.velocity||0)}),p=f||0,m=l/(2*Math.sqrt(a*c)),g=i-s,w=Ut(Math.sqrt(a/c)),v=Math.abs(g)<5;r||(r=v?.01:2),t||(t=v?.005:.5);let y;if(m<1){const x=au(w,m);y=b=>{const k=Math.exp(-m*w*b);return i-k*((p+m*w*g)/x*Math.sin(x*b)+g*Math.cos(x*b))}}else if(m===1)y=x=>i-Math.exp(-w*x)*(g+(p+w*g)*x);else{const x=w*Math.sqrt(m*m-1);y=b=>{const k=Math.exp(-m*w*b),C=Math.min(x*b,300);return i-k*((p+m*w*g)*Math.sinh(C)+x*g*Math.cosh(C))/x}}return{calculatedDuration:u&&d||null,next:x=>{const b=y(x);if(u)o.done=x>=d;else{let k=p;x!==0&&(m<1?k=bg(y,x,b):k=0);const C=Math.abs(k)<=r,N=Math.abs(i-b)<=t;o.done=C&&N}return o.value=o.done?i:b,o}}}function Af({keyframes:e,velocity:t=0,power:r=.8,timeConstant:n=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:d}){const f=e[0],u={done:!1,value:f},p=P=>a!==void 0&&Pl,m=P=>a===void 0?l:l===void 0||Math.abs(a-P)-g*Math.exp(-P/n),x=P=>v+y(P),b=P=>{const V=y(P),T=x(P);u.done=Math.abs(V)<=c,u.value=u.done?v:T};let k,C;const N=P=>{p(u.value)&&(k=P,C=Sg({keyframes:[u.value,m(u.value)],velocity:bg(x,P,u.value),damping:s,stiffness:i,restDelta:c,restSpeed:d}))};return N(0),{calculatedDuration:null,next:P=>{let V=!1;return!C&&k===void 0&&(V=!0,b(P),N(P)),k!==void 0&&P>k?C.next(P-k):(!V&&b(P),u)}}}const N5=e=>{const t=({timestamp:r})=>e(r);return{start:()=>ne.update(t,!0),stop:()=>Kt(t),now:()=>De.isProcessing?De.timestamp:performance.now()}},_f=2e4;function Lf(e){let t=0;const r=50;let n=e.next(t);for(;!n.done&&t<_f;)t+=r,n=e.next(t);return t>=_f?1/0:t}const P5={decay:Af,inertia:Af,tween:Ao,keyframes:Ao,spring:Sg};function _o({autoplay:e=!0,delay:t=0,driver:r=N5,keyframes:n,type:s="keyframes",repeat:i=0,repeatDelay:o=0,repeatType:a="loop",onPlay:l,onStop:c,onComplete:d,onUpdate:f,...u}){let p=1,m=!1,g,w;const v=()=>{w=new Promise(R=>{g=R})};v();let y;const x=P5[s]||Ao;let b;x!==Ao&&typeof n[0]!="number"&&(b=xg([0,100],n,{clamp:!1}),n=[0,100]);const k=x({...u,keyframes:n});let C;a==="mirror"&&(C=x({...u,keyframes:[...n].reverse(),velocity:-(u.velocity||0)}));let N="idle",P=null,V=null,T=null;k.calculatedDuration===null&&i&&(k.calculatedDuration=Lf(k));const{calculatedDuration:O}=k;let j=1/0,F=1/0;O!==null&&(j=O+o,F=j*(i+1)-o);let D=0;const G=R=>{if(V===null)return;p>0&&(V=Math.min(V,R)),p<0&&(V=Math.min(R-F/p,V)),P!==null?D=P:D=Math.round(R-V)*p;const E=D-t*(p>=0?1:-1),H=p>=0?E<0:E>F;D=Math.max(E,0),N==="finished"&&P===null&&(D=F);let X=D,ee=k;if(i){const _t=Math.min(D,F)/j;let St=Math.floor(_t),Qe=_t%1;!Qe&&_t>=1&&(Qe=1),Qe===1&&St--,St=Math.min(St,i+1),!!(St%2)&&(a==="reverse"?(Qe=1-Qe,o&&(Qe-=o/j)):a==="mirror"&&(ee=C)),X=jr(0,1,Qe)*j}const q=H?{done:!1,value:n[0]}:ee.next(X);b&&(q.value=b(q.value));let{done:me}=q;!H&&O!==null&&(me=p>=0?D>=F:D<=0);const Rr=P===null&&(N==="finished"||N==="running"&&me);return f&&f(q.value),Rr&&_(),q},M=()=>{y&&y.stop(),y=void 0},W=()=>{N="idle",M(),g(),v(),V=T=null},_=()=>{N="finished",d&&d(),M(),g()},A=()=>{if(m)return;y||(y=r(G));const R=y.now();l&&l(),P!==null?V=R-P:(!V||N==="finished")&&(V=R),N==="finished"&&v(),T=V,P=null,N="running",y.start()};e&&A();const I={then(R,E){return w.then(R,E)},get time(){return Ut(D)},set time(R){R=Yr(R),D=R,P!==null||!y||p===0?P=R:V=y.now()-R/p},get duration(){const R=k.calculatedDuration===null?Lf(k):k.calculatedDuration;return Ut(R)},get speed(){return p},set speed(R){R===p||!y||(p=R,I.time=Ut(D))},get state(){return N},play:A,pause:()=>{N="paused",P=D},stop:()=>{m=!0,N!=="idle"&&(N="idle",c&&c(),W())},cancel:()=>{T!==null&&G(T),W()},complete:()=>{N="finished"},sample:R=>(V=0,G(R))};return I}function E5(e){let t;return()=>(t===void 0&&(t=e()),t)}const T5=E5(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),M5=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),Ri=10,A5=2e4,_5=(e,t)=>t.type==="spring"||e==="backgroundColor"||!J0(t.ease);function L5(e,t,{onUpdate:r,onComplete:n,...s}){if(!(T5()&&M5.has(t)&&!s.repeatDelay&&s.repeatType!=="mirror"&&s.damping!==0&&s.type!=="inertia"))return!1;let o=!1,a,l,c=!1;const d=()=>{l=new Promise(x=>{a=x})};d();let{keyframes:f,duration:u=300,ease:p,times:m}=s;if(_5(t,s)){const x=_o({...s,repeat:0,delay:0});let b={done:!1,value:f[0]};const k=[];let C=0;for(;!b.done&&C{c=!1,g.cancel()},v=()=>{c=!0,ne.update(w),a(),d()};return g.onfinish=()=>{c||(e.set(Uw(f,s)),n&&n(),v())},{then(x,b){return l.then(x,b)},attachTimeline(x){return g.timeline=x,g.onfinish=null,xe},get time(){return Ut(g.currentTime||0)},set time(x){g.currentTime=Yr(x)},get speed(){return g.playbackRate},set speed(x){g.playbackRate=x},get duration(){return Ut(u)},play:()=>{o||(g.play(),Kt(w))},pause:()=>g.pause(),stop:()=>{if(o=!0,g.playState==="idle")return;const{currentTime:x}=g;if(x){const b=_o({...s,autoplay:!1});e.setWithVelocity(b.sample(x-Ri).value,b.sample(x).value,Ri)}v()},complete:()=>{c||g.finish()},cancel:v}}function D5({keyframes:e,delay:t,onUpdate:r,onComplete:n}){const s=()=>(r&&r(e[e.length-1]),n&&n(),{time:0,speed:1,duration:0,play:xe,pause:xe,stop:xe,then:i=>(i(),Promise.resolve()),cancel:xe,complete:xe});return t?_o({keyframes:[0,1],duration:0,delay:t,onComplete:s}):s()}const R5={type:"spring",stiffness:500,damping:25,restSpeed:10},V5=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),F5={type:"keyframes",duration:.8},I5={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},z5=(e,{keyframes:t})=>t.length>2?F5:nn.has(e)?e.startsWith("scale")?V5(t[1]):R5:I5,lu=(e,t)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Cr.test(t)||t==="0")&&!t.startsWith("url(")),O5=new Set(["brightness","contrast","saturate","opacity"]);function $5(e){const[t,r]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[n]=r.match(la)||[];if(!n)return e;const s=r.replace(n,"");let i=O5.has(t)?1:0;return n!==r&&(i*=100),t+"("+i+s+")"}const B5=/([a-z-]*)\(.*?\)/g,uu={...Cr,getAnimatableNone:e=>{const t=e.match(B5);return t?t.map($5).join(" "):e}},U5={...V0,color:ze,backgroundColor:ze,outlineColor:ze,fill:ze,stroke:ze,borderColor:ze,borderTopColor:ze,borderRightColor:ze,borderBottomColor:ze,borderLeftColor:ze,filter:uu,WebkitFilter:uu},Vc=e=>U5[e];function kg(e,t){let r=Vc(e);return r!==uu&&(r=Cr),r.getAnimatableNone?r.getAnimatableNone(t):void 0}const jg=e=>/^0[^.\s]+$/.test(e);function W5(e){if(typeof e=="number")return e===0;if(e!==null)return e==="none"||e==="0"||jg(e)}function H5(e,t,r,n){const s=lu(t,r);let i;Array.isArray(r)?i=[...r]:i=[null,r];const o=n.from!==void 0?n.from:e.get();let a;const l=[];for(let c=0;cs=>{const i=Fc(n,e)||{},o=i.delay||n.delay||0;let{elapsed:a=0}=n;a=a-Yr(o);const l=H5(t,e,r,i),c=l[0],d=l[l.length-1],f=lu(e,c),u=lu(e,d);let p={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...i,delay:-a,onUpdate:m=>{t.set(m),i.onUpdate&&i.onUpdate(m)},onComplete:()=>{s(),i.onComplete&&i.onComplete()}};if(q5(i)||(p={...p,...z5(e,p)}),p.duration&&(p.duration=Yr(p.duration)),p.repeatDelay&&(p.repeatDelay=Yr(p.repeatDelay)),!f||!u||$w.current||i.type===!1||G5.skipAnimations)return D5(p);if(!n.isHandoff&&t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const m=L5(t,e,p);if(m)return m}return _o(p)};function Lo(e){return!!(Xe(e)&&e.add)}const Cg=e=>/^\-?\d*\.?\d+$/.test(e);function zc(e,t){e.indexOf(t)===-1&&e.push(t)}function Oc(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}class $c{constructor(){this.subscriptions=[]}add(t){return zc(this.subscriptions,t),()=>Oc(this.subscriptions,t)}notify(t,r,n){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,r,n);else for(let i=0;i!isNaN(parseFloat(e));class K5{constructor(t,r={}){this.version="10.18.0",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(n,s=!0)=>{this.prev=this.current,this.current=n;const{delta:i,timestamp:o}=De;this.lastUpdated!==o&&(this.timeDelta=i,this.lastUpdated=o,ne.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>ne.postRender(this.velocityCheck),this.velocityCheck=({timestamp:n})=>{n!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=Y5(this.current),this.owner=r.owner}onChange(t){return this.on("change",t)}on(t,r){this.events[t]||(this.events[t]=new $c);const n=this.events[t].add(r);return t==="change"?()=>{n(),ne.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,r){this.passiveEffect=t,this.stopPassiveEffect=r}set(t,r=!0){!r||!this.passiveEffect?this.updateAndNotify(t,r):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,r,n){this.set(r),this.prev=t,this.timeDelta=n}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?wg(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=t(r),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(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function On(e,t){return new K5(e,t)}const Ng=e=>t=>t.test(e),X5={test:e=>e==="auto",parse:e=>e},Pg=[sn,U,At,rr,nw,rw,X5],ls=e=>Pg.find(Ng(e)),Q5=[...Pg,ze,Cr],Z5=e=>Q5.find(Ng(e));function J5(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,On(r))}function eb(e,t){const r=ca(e,t);let{transitionEnd:n={},transition:s={},...i}=r?e.makeTargetAnimatable(r,!1):{};i={...i,...n};for(const o in i){const a=yw(i[o]);J5(e,o,a)}}function tb(e,t,r){var n,s;const i=Object.keys(t).filter(a=>!e.hasValue(a)),o=i.length;if(o)for(let a=0;al.remove(f))),c.push(w)}return o&&Promise.all(c).then(()=>{o&&eb(e,o)}),c}function cu(e,t,r={}){const n=ca(e,t,r.custom);let{transition:s=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(s=r.transitionOverride);const i=n?()=>Promise.all(Eg(e,n,r)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:c=0,staggerChildren:d,staggerDirection:f}=s;return ob(e,t,c+l,d,f,r)}:()=>Promise.resolve(),{when:a}=s;if(a){const[l,c]=a==="beforeChildren"?[i,o]:[o,i];return l().then(()=>c())}else return Promise.all([i(),o(r.delay)])}function ob(e,t,r=0,n=0,s=1,i){const o=[],a=(e.variantChildren.size-1)*n,l=s===1?(c=0)=>c*n:(c=0)=>a-c*n;return Array.from(e.variantChildren).sort(ab).forEach((c,d)=>{c.notify("AnimationStart",t),o.push(cu(c,t,{...i,delay:r+l(d)}).then(()=>c.notify("AnimationComplete",t)))}),Promise.all(o)}function ab(e,t){return e.sortNodePosition(t)}function lb(e,t,r={}){e.notify("AnimationStart",t);let n;if(Array.isArray(t)){const s=t.map(i=>cu(e,i,r));n=Promise.all(s)}else if(typeof t=="string")n=cu(e,t,r);else{const s=typeof t=="function"?ca(e,t,r.custom):t;n=Promise.all(Eg(e,s,r))}return n.then(()=>e.notify("AnimationComplete",t))}const ub=[...Sc].reverse(),cb=Sc.length;function db(e){return t=>Promise.all(t.map(({animation:r,options:n})=>lb(e,r,n)))}function fb(e){let t=db(e);const r=pb();let n=!0;const s=(l,c)=>{const d=ca(e,c);if(d){const{transition:f,transitionEnd:u,...p}=d;l={...l,...p,...u}}return l};function i(l){t=l(e)}function o(l,c){const d=e.getProps(),f=e.getVariantContext(!0)||{},u=[],p=new Set;let m={},g=1/0;for(let v=0;vg&&k,T=!1;const O=Array.isArray(b)?b:[b];let j=O.reduce(s,{});C===!1&&(j={});const{prevResolvedValues:F={}}=x,D={...F,...j},G=M=>{V=!0,p.has(M)&&(T=!0,p.delete(M)),x.needsAnimating[M]=!0};for(const M in D){const W=j[M],_=F[M];if(m.hasOwnProperty(M))continue;let A=!1;To(W)&&To(_)?A=!Q0(W,_):A=W!==_,A?W!==void 0?G(M):p.add(M):W!==void 0&&p.has(M)?G(M):x.protectedKeys[M]=!0}x.prevProp=b,x.prevResolvedValues=j,x.isActive&&(m={...m,...j}),n&&e.blockInitialAnimation&&(V=!1),V&&(!N||T)&&u.push(...O.map(M=>({animation:M,options:{type:y,...l}})))}if(p.size){const v={};p.forEach(y=>{const x=e.getBaseTarget(y);x!==void 0&&(v[y]=x)}),u.push({animation:v})}let w=!!u.length;return n&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(w=!1),n=!1,w?t(u):Promise.resolve()}function a(l,c,d){var f;if(r[l].isActive===c)return Promise.resolve();(f=e.variantChildren)===null||f===void 0||f.forEach(p=>{var m;return(m=p.animationState)===null||m===void 0?void 0:m.setActive(l,c)}),r[l].isActive=c;const u=o(d,l);for(const p in r)r[p].protectedKeys={};return u}return{animateChanges:o,setActive:a,setAnimateFunction:i,getState:()=>r}}function hb(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Q0(t,e):!1}function Vr(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function pb(){return{animate:Vr(!0),whileInView:Vr(),whileHover:Vr(),whileTap:Vr(),whileDrag:Vr(),whileFocus:Vr(),exit:Vr()}}class mb extends Dr{constructor(t){super(t),t.animationState||(t.animationState=fb(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),oa(t)&&(this.unmount=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:r}=this.node.prevProps||{};t!==r&&this.updateAnimationControlsSubscription()}unmount(){}}let gb=0;class yb extends Dr{constructor(){super(...arguments),this.id=gb++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:r,custom:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;const i=this.node.animationState.setActive("exit",!t,{custom:n??this.node.getProps().custom});r&&!t&&i.then(()=>r(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const vb={animation:{Feature:mb},exit:{Feature:yb}},Df=(e,t)=>Math.abs(e-t);function xb(e,t){const r=Df(e.x,t.x),n=Df(e.y,t.y);return Math.sqrt(r**2+n**2)}class Tg{constructor(t,r,{transformPagePoint:n,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=Ya(this.lastMoveEventInfo,this.history),u=this.startEvent!==null,p=xb(f.offset,{x:0,y:0})>=3;if(!u&&!p)return;const{point:m}=f,{timestamp:g}=De;this.history.push({...m,timestamp:g});const{onStart:w,onMove:v}=this.handlers;u||(w&&w(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,f)},this.handlePointerMove=(f,u)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=Ga(u,this.transformPagePoint),ne.update(this.updatePoint,!0)},this.handlePointerUp=(f,u)=>{this.end();const{onEnd:p,onSessionEnd:m,resumeAnimation:g}=this.handlers;if(this.dragSnapToOrigin&&g&&g(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=Ya(f.type==="pointercancel"?this.lastMoveEventInfo:Ga(u,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,w),m&&m(f,w)},!q0(t))return;this.dragSnapToOrigin=i,this.handlers=r,this.transformPagePoint=n,this.contextWindow=s||window;const o=ua(t),a=Ga(o,this.transformPagePoint),{point:l}=a,{timestamp:c}=De;this.history=[{...l,timestamp:c}];const{onSessionStart:d}=r;d&&d(t,Ya(a,this.history)),this.removeListeners=br(Bt(this.contextWindow,"pointermove",this.handlePointerMove),Bt(this.contextWindow,"pointerup",this.handlePointerUp),Bt(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Kt(this.updatePoint)}}function Ga(e,t){return t?{point:t(e.point)}:e}function Rf(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ya({point:e},t){return{point:e,delta:Rf(e,Mg(t)),offset:Rf(e,wb(t)),velocity:bb(t,.1)}}function wb(e){return e[0]}function Mg(e){return e[e.length-1]}function bb(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,n=null;const s=Mg(e);for(;r>=0&&(n=e[r],!(s.timestamp-n.timestamp>Yr(t)));)r--;if(!n)return{x:0,y:0};const i=Ut(s.timestamp-n.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-n.x)/i,y:(s.y-n.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function nt(e){return e.max-e.min}function du(e,t=0,r=.01){return Math.abs(e-t)<=r}function Vf(e,t,r,n=.5){e.origin=n,e.originPoint=fe(t.min,t.max,e.origin),e.scale=nt(r)/nt(t),(du(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=fe(r.min,r.max,e.origin)-e.originPoint,(du(e.translate)||isNaN(e.translate))&&(e.translate=0)}function Es(e,t,r,n){Vf(e.x,t.x,r.x,n?n.originX:void 0),Vf(e.y,t.y,r.y,n?n.originY:void 0)}function Ff(e,t,r){e.min=r.min+t.min,e.max=e.min+nt(t)}function Sb(e,t,r){Ff(e.x,t.x,r.x),Ff(e.y,t.y,r.y)}function If(e,t,r){e.min=t.min-r.min,e.max=e.min+nt(t)}function Ts(e,t,r){If(e.x,t.x,r.x),If(e.y,t.y,r.y)}function kb(e,{min:t,max:r},n){return t!==void 0&&er&&(e=n?fe(r,e,n.max):Math.min(e,r)),e}function zf(e,t,r){return{min:t!==void 0?e.min+t:void 0,max:r!==void 0?e.max+r-(e.max-e.min):void 0}}function jb(e,{top:t,left:r,bottom:n,right:s}){return{x:zf(e.x,r,s),y:zf(e.y,t,n)}}function Of(e,t){let r=t.min-e.min,n=t.max-e.max;return t.max-t.minn?r=ri(t.min,t.max-n,e.min):n>s&&(r=ri(e.min,e.max-s,t.min)),jr(0,1,r)}function Pb(e,t){const r={};return t.min!==void 0&&(r.min=t.min-e.min),t.max!==void 0&&(r.max=t.max-e.min),r}const fu=.35;function Eb(e=fu){return e===!1?e=0:e===!0&&(e=fu),{x:$f(e,"left","right"),y:$f(e,"top","bottom")}}function $f(e,t,r){return{min:Bf(e,t),max:Bf(e,r)}}function Bf(e,t){return typeof e=="number"?e:e[t]||0}const Uf=()=>({translate:0,scale:1,origin:0,originPoint:0}),kn=()=>({x:Uf(),y:Uf()}),Wf=()=>({min:0,max:0}),Se=()=>({x:Wf(),y:Wf()});function at(e){return[e("x"),e("y")]}function Ag({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}function Tb({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Mb(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function Ka(e){return e===void 0||e===1}function hu({scale:e,scaleX:t,scaleY:r}){return!Ka(e)||!Ka(t)||!Ka(r)}function zr(e){return hu(e)||_g(e)||e.z||e.rotate||e.rotateX||e.rotateY}function _g(e){return Hf(e.x)||Hf(e.y)}function Hf(e){return e&&e!=="0%"}function Do(e,t,r){const n=e-r,s=t*n;return r+s}function qf(e,t,r,n,s){return s!==void 0&&(e=Do(e,s,n)),Do(e,r,n)+t}function pu(e,t=0,r=1,n,s){e.min=qf(e.min,t,r,n,s),e.max=qf(e.max,t,r,n,s)}function Lg(e,{x:t,y:r}){pu(e.x,t.translate,t.scale,t.originPoint),pu(e.y,r.translate,r.scale,r.originPoint)}function Ab(e,t,r,n=!1){const s=r.length;if(!s)return;t.x=t.y=1;let i,o;for(let a=0;a1.0000000000001||e<.999999999999?e:1}function ir(e,t){e.min=e.min+t,e.max=e.max+t}function Yf(e,t,[r,n,s]){const i=t[s]!==void 0?t[s]:.5,o=fe(e.min,e.max,i);pu(e,t[r],t[n],o,t.scale)}const _b=["x","scaleX","originX"],Lb=["y","scaleY","originY"];function jn(e,t){Yf(e.x,t,_b),Yf(e.y,t,Lb)}function Dg(e,t){return Ag(Mb(e.getBoundingClientRect(),t))}function Db(e,t,r){const n=Dg(e,r),{scroll:s}=t;return s&&(ir(n.x,s.offset.x),ir(n.y,s.offset.y)),n}const Rg=({current:e})=>e?e.ownerDocument.defaultView:null,Rb=new WeakMap;class Vb{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Se(),this.visualElement=t}start(t,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const s=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(ua(d,"page").point)},i=(d,f)=>{const{drag:u,dragPropagation:p,onDragStart:m}=this.getProps();if(u&&!p&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=Y0(u),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),at(w=>{let v=this.getAxisMotionValue(w).get()||0;if(At.test(v)){const{projection:y}=this.visualElement;if(y&&y.layout){const x=y.layout.layoutBox[w];x&&(v=nt(x)*(parseFloat(v)/100))}}this.originPoint[w]=v}),m&&ne.update(()=>m(d,f),!1,!0);const{animationState:g}=this.visualElement;g&&g.setActive("whileDrag",!0)},o=(d,f)=>{const{dragPropagation:u,dragDirectionLock:p,onDirectionLock:m,onDrag:g}=this.getProps();if(!u&&!this.openGlobalLock)return;const{offset:w}=f;if(p&&this.currentDirection===null){this.currentDirection=Fb(w),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",f.point,w),this.updateAxis("y",f.point,w),this.visualElement.render(),g&&g(d,f)},a=(d,f)=>this.stop(d,f),l=()=>at(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:c}=this.getProps();this.panSession=new Tg(t,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,contextWindow:Rg(this.visualElement)})}stop(t,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:s}=r;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&ne.update(()=>i(t,r))}cancel(){this.isDragging=!1;const{projection:t,animationState:r}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(t,r,n){const{drag:s}=this.getProps();if(!n||!Vi(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(o=kb(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){var t;const{dragConstraints:r,dragElastic:n}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,i=this.constraints;r&&bn(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&s?this.constraints=jb(s.layoutBox,r):this.constraints=!1,this.elastic=Eb(n),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&at(o=>{this.getAxisMotionValue(o)&&(this.constraints[o]=Pb(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!bn(t))return!1;const n=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=Db(n,s.root,this.visualElement.getTransformPagePoint());let o=Cb(s.layout.layoutBox,i);if(r){const a=r(Tb(o));this.hasMutatedConstraints=!!a,a&&(o=Ag(a))}return o}startAnimation(t){const{drag:r,dragMomentum:n,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=at(d=>{if(!Vi(d,r,this.currentDirection))return;let f=l&&l[d]||{};o&&(f={min:0,max:0});const u=s?200:1e6,p=s?40:1e7,m={type:"inertia",velocity:n?t[d]:0,bounceStiffness:u,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(d,m)});return Promise.all(c).then(a)}startAxisValueAnimation(t,r){const n=this.getAxisMotionValue(t);return n.start(Ic(t,n,0,r))}stopAnimation(){at(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){at(t=>{var r;return(r=this.getAxisMotionValue(t).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(t){var r;return(r=this.getAxisMotionValue(t).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(t){const r="_drag"+t.toUpperCase(),n=this.visualElement.getProps(),s=n[r];return s||this.visualElement.getValue(t,(n.initial?n.initial[t]:void 0)||0)}snapToCursor(t){at(r=>{const{drag:n}=this.getProps();if(!Vi(r,n,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(r);if(s&&s.layout){const{min:o,max:a}=s.layout.layoutBox[r];i.set(t[r]-fe(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!bn(r)||!n||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};at(o=>{const a=this.getAxisMotionValue(o);if(a){const l=a.get();s[o]=Nb({min:l,max:l},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),at(o=>{if(!Vi(o,t,null))return;const a=this.getAxisMotionValue(o),{min:l,max:c}=this.constraints[o];a.set(fe(l,c,s[o]))})}addListeners(){if(!this.visualElement.current)return;Rb.set(this.visualElement,this);const t=this.visualElement.current,r=Bt(t,"pointerdown",l=>{const{drag:c,dragListener:d=!0}=this.getProps();c&&d&&this.start(l)}),n=()=>{const{dragConstraints:l}=this.getProps();bn(l)&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",n);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),n();const o=Ot(window,"resize",()=>this.scalePositionWithinConstraints()),a=s.addEventListener("didUpdate",({delta:l,hasLayoutChanged:c})=>{this.isDragging&&c&&(at(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=l[d].translate,f.set(f.get()+l[d].translate))}),this.visualElement.render())});return()=>{o(),r(),i(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=fu,dragMomentum:a=!0}=t;return{...t,drag:r,dragDirectionLock:n,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:a}}}function Vi(e,t,r){return(t===!0||t===e)&&(r===null||r===e)}function Fb(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}class Ib extends Dr{constructor(t){super(t),this.removeGroupControls=xe,this.removeListeners=xe,this.controls=new Vb(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||xe}unmount(){this.removeGroupControls(),this.removeListeners()}}const Kf=e=>(t,r)=>{e&&ne.update(()=>e(t,r))};class zb extends Dr{constructor(){super(...arguments),this.removePointerDownListener=xe}onPointerDown(t){this.session=new Tg(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Rg(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:r,onPan:n,onPanEnd:s}=this.node.getProps();return{onSessionStart:Kf(t),onStart:Kf(r),onMove:n,onEnd:(i,o)=>{delete this.session,s&&ne.update(()=>s(i,o))}}}mount(){this.removePointerDownListener=Bt(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function Ob(){const e=S.useContext(sa);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:r,register:n}=e,s=S.useId();return S.useEffect(()=>n(s),[]),!t&&r?[!1,()=>r&&r(s)]:[!0]}const Ji={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Xf(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const us={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(U.test(e))e=parseFloat(e);else return e;const r=Xf(e,t.target.x),n=Xf(e,t.target.y);return`${r}% ${n}%`}},$b={correct:(e,{treeScale:t,projectionDelta:r})=>{const n=e,s=Cr.parse(e);if(s.length>5)return n;const i=Cr.createTransformer(e),o=typeof s[0]!="number"?1:0,a=r.x.scale*t.x,l=r.y.scale*t.y;s[0+o]/=a,s[1+o]/=l;const c=fe(a,l,.5);return typeof s[2+o]=="number"&&(s[2+o]/=c),typeof s[3+o]=="number"&&(s[3+o]/=c),i(s)}};class Bb extends ii.Component{componentDidMount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:n,layoutId:s}=this.props,{projection:i}=t;K2(Ub),i&&(r.group&&r.group.add(i),n&&n.register&&s&&n.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),Ji.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:r,visualElement:n,drag:s,isPresent:i}=this.props,o=n.projection;return o&&(o.isPresent=i,s||t.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||ne.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),queueMicrotask(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(s),n&&n.deregister&&n.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function Vg(e){const[t,r]=Ob(),n=S.useContext(jc);return ii.createElement(Bb,{...e,layoutGroup:n,switchLayoutGroup:S.useContext(A0),isPresent:t,safeToRemove:r})}const Ub={borderRadius:{...us,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:us,borderTopRightRadius:us,borderBottomLeftRadius:us,borderBottomRightRadius:us,boxShadow:$b},Fg=["TopLeft","TopRight","BottomLeft","BottomRight"],Wb=Fg.length,Qf=e=>typeof e=="string"?parseFloat(e):e,Zf=e=>typeof e=="number"||U.test(e);function Hb(e,t,r,n,s,i){s?(e.opacity=fe(0,r.opacity!==void 0?r.opacity:1,qb(n)),e.opacityExit=fe(t.opacity!==void 0?t.opacity:1,0,Gb(n))):i&&(e.opacity=fe(t.opacity!==void 0?t.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;ont?1:r(ri(e,t,n))}function eh(e,t){e.min=t.min,e.max=t.max}function ot(e,t){eh(e.x,t.x),eh(e.y,t.y)}function th(e,t,r,n,s){return e-=t,e=Do(e,1/r,n),s!==void 0&&(e=Do(e,1/s,n)),e}function Yb(e,t=0,r=1,n=.5,s,i=e,o=e){if(At.test(t)&&(t=parseFloat(t),t=fe(o.min,o.max,t/100)-o.min),typeof t!="number")return;let a=fe(i.min,i.max,n);e===i&&(a-=t),e.min=th(e.min,t,r,a,s),e.max=th(e.max,t,r,a,s)}function rh(e,t,[r,n,s],i,o){Yb(e,t[r],t[n],t[s],t.scale,i,o)}const Kb=["x","scaleX","originX"],Xb=["y","scaleY","originY"];function nh(e,t,r,n){rh(e.x,t,Kb,r?r.x:void 0,n?n.x:void 0),rh(e.y,t,Xb,r?r.y:void 0,n?n.y:void 0)}function sh(e){return e.translate===0&&e.scale===1}function zg(e){return sh(e.x)&&sh(e.y)}function Qb(e,t){return e.x.min===t.x.min&&e.x.max===t.x.max&&e.y.min===t.y.min&&e.y.max===t.y.max}function Og(e,t){return Math.round(e.x.min)===Math.round(t.x.min)&&Math.round(e.x.max)===Math.round(t.x.max)&&Math.round(e.y.min)===Math.round(t.y.min)&&Math.round(e.y.max)===Math.round(t.y.max)}function ih(e){return nt(e.x)/nt(e.y)}class Zb{constructor(){this.members=[]}add(t){zc(this.members,t),t.scheduleRender()}remove(t){if(Oc(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(t){const r=this.members.findIndex(s=>t===s);if(r===0)return!1;let n;for(let s=r;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){n=i;break}}return n?(this.promote(n),!0):!1}promote(t,r){const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.instance&&n.scheduleRender(),t.scheduleRender(),t.resumeFrom=n,r&&(t.resumeFrom.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:r,resumingFrom:n}=t;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function oh(e,t,r){let n="";const s=e.x.translate/t.x,i=e.y.translate/t.y;if((s||i)&&(n=`translate3d(${s}px, ${i}px, 0) `),(t.x!==1||t.y!==1)&&(n+=`scale(${1/t.x}, ${1/t.y}) `),r){const{rotate:l,rotateX:c,rotateY:d}=r;l&&(n+=`rotate(${l}deg) `),c&&(n+=`rotateX(${c}deg) `),d&&(n+=`rotateY(${d}deg) `)}const o=e.x.scale*t.x,a=e.y.scale*t.y;return(o!==1||a!==1)&&(n+=`scale(${o}, ${a})`),n||"none"}const Jb=(e,t)=>e.depth-t.depth;class e4{constructor(){this.children=[],this.isDirty=!1}add(t){zc(this.children,t),this.isDirty=!0}remove(t){Oc(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Jb),this.isDirty=!1,this.children.forEach(t)}}function t4(e,t){const r=performance.now(),n=({timestamp:s})=>{const i=s-r;i>=t&&(Kt(n),e(i-t))};return ne.read(n,!0),()=>Kt(n)}function r4(e){window.MotionDebug&&window.MotionDebug.record(e)}function n4(e){return e instanceof SVGElement&&e.tagName!=="svg"}function s4(e,t,r){const n=Xe(e)?e:On(e);return n.start(Ic("",n,t,r)),n.animation}const ah=["","X","Y","Z"],i4={visibility:"hidden"},lh=1e3;let o4=0;const Or={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function $g({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:n,resetTransform:s}){return class{constructor(o={},a=t==null?void 0:t()){this.id=o4++,this.animationId=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.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Or.totalNodes=Or.resolvedTargetDeltas=Or.recalculatedProjection=0,this.nodes.forEach(u4),this.nodes.forEach(p4),this.nodes.forEach(m4),this.nodes.forEach(c4),r4(Or)},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;lthis.root.updateBlockedByResize=!1;e(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=t4(u,250),Ji.hasAnimatedSinceResize&&(Ji.hasAnimatedSinceResize=!1,this.nodes.forEach(ch))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&d&&(l||c)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:u,hasRelativeTargetChanged:p,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||d.getDefaultTransition()||w4,{onLayoutAnimationStart:w,onLayoutAnimationComplete:v}=d.getProps(),y=!this.targetLayout||!Og(this.targetLayout,m)||p,x=!u&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||x||u&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,x);const b={...Fc(g,"layout"),onPlay:w,onComplete:v};(d.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b)}else u||ch(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,Kt(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(g4),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(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;dthis.update()))}clearAllSnapshots(){this.nodes.forEach(d4),this.sharedNodes.forEach(y4)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ne.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ne.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}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{const k=b/1e3;dh(f.x,o.x,k),dh(f.y,o.y,k),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ts(u,this.layout.layoutBox,this.relativeParent.layout.layoutBox),v4(this.relativeTarget,this.relativeTargetOrigin,u,k),x&&Qb(this.relativeTarget,x)&&(this.isProjectionDirty=!1),x||(x=Se()),ot(x,this.relativeTarget)),g&&(this.animationValues=d,Hb(d,c,this.latestValues,k,y,v)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=k},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Kt(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ne.update(()=>{Ji.hasAnimatedSinceResize=!0,this.currentAnimation=s4(0,lh,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},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(lh),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:d}=o;if(!(!a||!l||!c)){if(this!==o&&this.layout&&c&&Bg(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||Se();const f=nt(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+f;const u=nt(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+u}ot(a,l),jn(a,d),Es(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Zb),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 o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.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}resetRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(a=!0),!a)return;const c={};for(let d=0;d{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(uh),this.root.sharedNodes.clear()}}}function a4(e){e.updateLayout()}function l4(e){var t;const r=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&r&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:s}=e.layout,{animationType:i}=e.options,o=r.source!==e.layout.source;i==="size"?at(f=>{const u=o?r.measuredBox[f]:r.layoutBox[f],p=nt(u);u.min=n[f].min,u.max=u.min+p}):Bg(i,r.layoutBox,n)&&at(f=>{const u=o?r.measuredBox[f]:r.layoutBox[f],p=nt(n[f]);u.max=u.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const a=kn();Es(a,n,r.layoutBox);const l=kn();o?Es(l,e.applyTransform(s,!0),r.measuredBox):Es(l,n,r.layoutBox);const c=!zg(a);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:u,layout:p}=f;if(u&&p){const m=Se();Ts(m,r.layoutBox,u.layoutBox);const g=Se();Ts(g,n,p.layoutBox),Og(m,g)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=g,e.relativeTargetOrigin=m,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:l,layoutDelta:a,hasLayoutChanged:c,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function u4(e){Or.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function c4(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function d4(e){e.clearSnapshot()}function uh(e){e.clearMeasurements()}function f4(e){e.isLayoutDirty=!1}function h4(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function ch(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function p4(e){e.resolveTargetDelta()}function m4(e){e.calcProjection()}function g4(e){e.resetRotation()}function y4(e){e.removeLeadSnapshot()}function dh(e,t,r){e.translate=fe(t.translate,0,r),e.scale=fe(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function fh(e,t,r,n){e.min=fe(t.min,r.min,n),e.max=fe(t.max,r.max,n)}function v4(e,t,r,n){fh(e.x,t.x,r.x,n),fh(e.y,t.y,r.y,n)}function x4(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const w4={duration:.45,ease:[.4,0,.1,1]},hh=e=>typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes(e),ph=hh("applewebkit/")&&!hh("chrome/")?Math.round:xe;function mh(e){e.min=ph(e.min),e.max=ph(e.max)}function b4(e){mh(e.x),mh(e.y)}function Bg(e,t,r){return e==="position"||e==="preserve-aspect"&&!du(ih(t),ih(r),.2)}const S4=$g({attachResizeListener:(e,t)=>Ot(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Xa={current:void 0},Ug=$g({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Xa.current){const e=new S4({});e.mount(window),e.setOptions({layoutScroll:!0}),Xa.current=e}return Xa.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),k4={pan:{Feature:zb},drag:{Feature:Ib,ProjectionNode:Ug,MeasureLayout:Vg}},j4=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function C4(e){const t=j4.exec(e);if(!t)return[,];const[,r,n]=t;return[r,n]}function mu(e,t,r=1){const[n,s]=C4(e);if(!n)return;const i=window.getComputedStyle(t).getPropertyValue(n);if(i){const o=i.trim();return Cg(o)?parseFloat(o):o}else return su(s)?mu(s,t,r+1):s}function N4(e,{...t},r){const n=e.current;if(!(n instanceof Element))return{target:t,transitionEnd:r};r&&(r={...r}),e.values.forEach(s=>{const i=s.get();if(!su(i))return;const o=mu(i,n);o&&s.set(o)});for(const s in t){const i=t[s];if(!su(i))continue;const o=mu(i,n);o&&(t[s]=o,r||(r={}),r[s]===void 0&&(r[s]=i))}return{target:t,transitionEnd:r}}const P4=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),Wg=e=>P4.has(e),E4=e=>Object.keys(e).some(Wg),gh=e=>e===sn||e===U,yh=(e,t)=>parseFloat(e.split(", ")[t]),vh=(e,t)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const s=n.match(/^matrix3d\((.+)\)$/);if(s)return yh(s[1],t);{const i=n.match(/^matrix\((.+)\)$/);return i?yh(i[1],e):0}},T4=new Set(["x","y","z"]),M4=di.filter(e=>!T4.has(e));function A4(e){const t=[];return M4.forEach(r=>{const n=e.getValue(r);n!==void 0&&(t.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),t.length&&e.render(),t}const $n={width:({x:e},{paddingLeft:t="0",paddingRight:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),height:({y:e},{paddingTop:t="0",paddingBottom:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:vh(4,13),y:vh(5,14)};$n.translateX=$n.x;$n.translateY=$n.y;const _4=(e,t,r)=>{const n=t.measureViewportBox(),s=t.current,i=getComputedStyle(s),{display:o}=i,a={};o==="none"&&t.setStaticValue("display",e.display||"block"),r.forEach(c=>{a[c]=$n[c](n,i)}),t.render();const l=t.measureViewportBox();return r.forEach(c=>{const d=t.getValue(c);d&&d.jump(a[c]),e[c]=$n[c](l,i)}),e},L4=(e,t,r={},n={})=>{t={...t},n={...n};const s=Object.keys(t).filter(Wg);let i=[],o=!1;const a=[];if(s.forEach(l=>{const c=e.getValue(l);if(!e.hasValue(l))return;let d=r[l],f=ls(d);const u=t[l];let p;if(To(u)){const m=u.length,g=u[0]===null?1:0;d=u[g],f=ls(d);for(let w=g;w=0?window.pageYOffset:null,c=_4(t,e,a);return i.length&&i.forEach(([d,f])=>{e.getValue(d).set(f)}),e.render(),ia&&l!==null&&window.scrollTo({top:l}),{target:c,transitionEnd:n}}else return{target:t,transitionEnd:n}};function D4(e,t,r,n){return E4(t)?L4(e,t,r,n):{target:t,transitionEnd:n}}const R4=(e,t,r,n)=>{const s=N4(e,t,n);return t=s.target,n=s.transitionEnd,D4(e,t,r,n)},gu={current:null},Hg={current:!1};function V4(){if(Hg.current=!0,!!ia)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>gu.current=e.matches;e.addListener(t),t()}else gu.current=!1}function F4(e,t,r){const{willChange:n}=t;for(const s in t){const i=t[s],o=r[s];if(Xe(i))e.addValue(s,i),Lo(n)&&n.add(s);else if(Xe(o))e.addValue(s,On(i,{owner:e})),Lo(n)&&n.remove(s);else if(o!==i)if(e.hasValue(s)){const a=e.getValue(s);!a.hasAnimated&&a.set(i)}else{const a=e.getStaticValue(s);e.addValue(s,On(a!==void 0?a:i,{owner:e}))}}for(const s in r)t[s]===void 0&&e.removeValue(s);return t}const xh=new WeakMap,qg=Object.keys(ti),I4=qg.length,wh=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],z4=kc.length;class O4{constructor({parent:t,props:r,presenceContext:n,reducedMotionConfig:s,visualState:i},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},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.scheduleRender=()=>ne.render(this.render,!1,!0);const{latestValues:a,renderState:l}=i;this.latestValues=a,this.baseTarget={...a},this.initialValues=r.initial?{...a}:{},this.renderState=l,this.parent=t,this.props=r,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=o,this.isControllingVariants=aa(r),this.isVariantNode=M0(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:c,...d}=this.scrapeMotionValuesFromProps(r,{});for(const f in d){const u=d[f];a[f]!==void 0&&Xe(u)&&(u.set(a[f],!1),Lo(c)&&c.add(f))}}scrapeMotionValuesFromProps(t,r){return{}}mount(t){this.current=t,xh.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,n)=>this.bindToMotionValue(n,r)),Hg.current||V4(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:gu.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){xh.delete(this.current),this.projection&&this.projection.unmount(),Kt(this.notifyUpdate),Kt(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(t,r){const n=nn.has(t),s=r.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&ne.update(this.notifyUpdate,!1,!0),n&&this.projection&&(this.projection.isTransformDirty=!0)}),i=r.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{s(),i()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}loadFeatures({children:t,...r},n,s,i){let o,a;for(let l=0;lthis.scheduleRender(),animationType:typeof c=="string"?c:"both",initialPromotionConfig:i,layoutScroll:u,layoutRoot:p})}return a}updateFeatures(){for(const t in this.features){const r=this.features[t];r.isMounted?r.update():(r.mount(),r.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Se()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,r){this.latestValues[t]=r}makeTargetAnimatable(t,r=!0){return this.makeTargetAnimatableFromInstance(t,this.props,r)}update(t,r){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(t)}addValue(t,r){r!==this.values.get(t)&&(this.removeValue(t),this.bindToMotionValue(t,r)),this.values.set(t,r),this.latestValues[t]=r.get()}removeValue(t){this.values.delete(t);const r=this.valueSubscriptions.get(t);r&&(r(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,r){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return n===void 0&&r!==void 0&&(n=On(r,{owner:this}),this.addValue(t,n)),n}readValue(t){var r;return this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options)}setBaseTarget(t,r){this.baseTarget[t]=r}getBaseTarget(t){var r;const{initial:n}=this.props,s=typeof n=="string"||typeof n=="object"?(r=Ac(this.props,n))===null||r===void 0?void 0:r[t]:void 0;if(n&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!Xe(i)?i:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,r){return this.events[t]||(this.events[t]=new $c),this.events[t].add(r)}notify(t,...r){this.events[t]&&this.events[t].notify(...r)}}class Gg extends O4{sortInstanceNodePosition(t,r){return t.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(t,r){return t.style?t.style[r]:void 0}removeValueFromRenderState(t,{vars:r,style:n}){delete r[t],delete n[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:r,...n},{transformValues:s},i){let o=nb(n,t||{},this);if(s&&(r&&(r=s(r)),n&&(n=s(n)),o&&(o=s(o))),i){tb(this,n,o);const a=R4(this,n,o,r);r=a.transitionEnd,n=a.target}return{transition:t,transitionEnd:r,...n}}}function $4(e){return window.getComputedStyle(e)}class B4 extends Gg{constructor(){super(...arguments),this.type="html"}readValueFromInstance(t,r){if(nn.has(r)){const n=Vc(r);return n&&n.default||0}else{const n=$4(t),s=(D0(r)?n.getPropertyValue(r):n[r])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:r}){return Dg(t,r)}build(t,r,n,s){Nc(t,r,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,r){return Mc(t,r)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Xe(t)&&(this.childSubscription=t.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}renderInstance(t,r,n,s){O0(t,r,n,s)}}class U4 extends Gg{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(t,r){return t[r]}readValueFromInstance(t,r){if(nn.has(r)){const n=Vc(r);return n&&n.default||0}return r=$0.has(r)?r:bc(r),t.getAttribute(r)}measureInstanceViewportBox(){return Se()}scrapeMotionValuesFromProps(t,r){return U0(t,r)}build(t,r,n,s){Ec(t,r,n,this.isSVGTag,s.transformTemplate)}renderInstance(t,r,n,s){B0(t,r,n,s)}mount(t){this.isSVGTag=Tc(t.tagName),super.mount(t)}}const W4=(e,t)=>Cc(e)?new U4(t,{enableHardwareAcceleration:!1}):new B4(t,{enableHardwareAcceleration:!0}),H4={layout:{ProjectionNode:Ug,MeasureLayout:Vg}},q4={...vb,...Iw,...k4,...H4},z=G2((e,t)=>Cw(e,t,q4,W4));function Yg(){const e=S.useRef(!1);return wc(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function G4(){const e=Yg(),[t,r]=S.useState(0),n=S.useCallback(()=>{e.current&&r(t+1)},[t]);return[S.useCallback(()=>ne.postRender(n),[n]),t]}class Y4 extends S.Component{getSnapshotBeforeUpdate(t){const r=this.props.childRef.current;if(r&&t.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function K4({children:e,isPresent:t}){const r=S.useId(),n=S.useRef(null),s=S.useRef({width:0,height:0,top:0,left:0});return S.useInsertionEffect(()=>{const{width:i,height:o,top:a,left:l}=s.current;if(t||!n.current||!i||!o)return;n.current.dataset.motionPopId=r;const c=document.createElement("style");return document.head.appendChild(c),c.sheet&&c.sheet.insertRule(` [data-motion-pop-id="${r}"] { position: absolute !important; width: ${i}px !important; height: ${o}px !important; top: ${a}px !important; left: ${l}px !important; } `),()=>{document.head.removeChild(c)}},[t]),S.createElement(Y4,{isPresent:t,childRef:n,sizeRef:s},S.cloneElement(e,{ref:n}))}const Qa=({children:e,initial:t,isPresent:r,onExitComplete:n,custom:s,presenceAffectsLayout:i,mode:o})=>{const a=W0(X4),l=S.useId(),c=S.useMemo(()=>({id:l,initial:t,isPresent:r,custom:s,onExitComplete:d=>{a.set(d,!0);for(const f of a.values())if(!f)return;n&&n()},register:d=>(a.set(d,!1),()=>a.delete(d))}),i?void 0:[r]);return S.useMemo(()=>{a.forEach((d,f)=>a.set(f,!1))},[r]),S.useEffect(()=>{!r&&!a.size&&n&&n()},[r]),o==="popLayout"&&(e=S.createElement(K4,{isPresent:r},e)),S.createElement(sa.Provider,{value:c},e)};function X4(){return new Map}function Q4(e){return S.useEffect(()=>()=>e(),[])}const $r=e=>e.key||"";function Z4(e,t){e.forEach(r=>{const n=$r(r);t.set(n,r)})}function J4(e){const t=[];return S.Children.forEach(e,r=>{S.isValidElement(r)&&t.push(r)}),t}const e3=({children:e,custom:t,initial:r=!0,onExitComplete:n,exitBeforeEnter:s,presenceAffectsLayout:i=!0,mode:o="sync"})=>{const a=S.useContext(jc).forceRender||G4()[0],l=Yg(),c=J4(e);let d=c;const f=S.useRef(new Map).current,u=S.useRef(d),p=S.useRef(new Map).current,m=S.useRef(!0);if(wc(()=>{m.current=!1,Z4(c,p),u.current=d}),Q4(()=>{m.current=!0,p.clear(),f.clear()}),m.current)return S.createElement(S.Fragment,null,d.map(y=>S.createElement(Qa,{key:$r(y),isPresent:!0,initial:r?void 0:!1,presenceAffectsLayout:i,mode:o},y)));d=[...d];const g=u.current.map($r),w=c.map($r),v=g.length;for(let y=0;y{if(w.indexOf(x)!==-1)return;const b=p.get(x);if(!b)return;const k=g.indexOf(x);let C=y;if(!C){const N=()=>{f.delete(x);const P=Array.from(p.keys()).filter(V=>!w.includes(V));if(P.forEach(V=>p.delete(V)),u.current=c.filter(V=>{const T=$r(V);return T===x||P.includes(T)}),!f.size){if(l.current===!1)return;a(),n&&n()}};C=S.createElement(Qa,{key:$r(b),isPresent:!1,onExitComplete:N,custom:t,presenceAffectsLayout:i,mode:o},b),f.set(x,C)}d.splice(k,0,C)}),d=d.map(y=>{const x=y.key;return f.has(x)?y:S.createElement(Qa,{key:$r(y),isPresent:!0,presenceAffectsLayout:i,mode:o},y)}),S.createElement(S.Fragment,null,f.size?d:d.map(y=>S.cloneElement(y)))},t3={},bh=e=>{let t;const r=new Set,n=(d,f)=>{const u=typeof d=="function"?d(t):d;if(!Object.is(u,t)){const p=t;t=f??(typeof u!="object"||u===null)?u:Object.assign({},t,u),r.forEach(m=>m(t,p))}},s=()=>t,l={setState:n,getState:s,getInitialState:()=>c,subscribe:d=>(r.add(d),()=>r.delete(d)),destroy:()=>{(t3?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},c=t=e(n,s,l);return l},r3=e=>e?bh(e):bh;var Kg={exports:{}},Xg={},Qg={exports:{}},Zg={};/** * @license React * use-sync-external-store-shim.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Bn=S;function n3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var s3=typeof Object.is=="function"?Object.is:n3,i3=Bn.useState,o3=Bn.useEffect,a3=Bn.useLayoutEffect,l3=Bn.useDebugValue;function u3(e,t){var r=t(),n=i3({inst:{value:r,getSnapshot:t}}),s=n[0].inst,i=n[1];return a3(function(){s.value=r,s.getSnapshot=t,Za(s)&&i({inst:s})},[e,r,t]),o3(function(){return Za(s)&&i({inst:s}),e(function(){Za(s)&&i({inst:s})})},[e]),l3(r),r}function Za(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!s3(e,r)}catch{return!0}}function c3(e,t){return t()}var d3=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c3:u3;Zg.useSyncExternalStore=Bn.useSyncExternalStore!==void 0?Bn.useSyncExternalStore:d3;Qg.exports=Zg;var f3=Qg.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var da=S,h3=f3;function p3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var m3=typeof Object.is=="function"?Object.is:p3,g3=h3.useSyncExternalStore,y3=da.useRef,v3=da.useEffect,x3=da.useMemo,w3=da.useDebugValue;Xg.useSyncExternalStoreWithSelector=function(e,t,r,n,s){var i=y3(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=x3(function(){function l(p){if(!c){if(c=!0,d=p,p=n(p),s!==void 0&&o.hasValue){var m=o.value;if(s(m,p))return f=m}return f=p}if(m=f,m3(d,p))return m;var g=n(p);return s!==void 0&&s(m,g)?(d=p,m):(d=p,f=g)}var c=!1,d,f,u=r===void 0?null:r;return[function(){return l(t())},u===null?void 0:function(){return l(u())}]},[t,r,n,s]);var a=g3(e,i[0],i[1]);return v3(function(){o.hasValue=!0,o.value=a},[a]),w3(a),a};Kg.exports=Xg;var b3=Kg.exports;const S3=wu(b3),Jg={},{useDebugValue:k3}=ii,{useSyncExternalStoreWithSelector:j3}=S3;let Sh=!1;const C3=e=>e;function N3(e,t=C3,r){(Jg?"production":void 0)!=="production"&&r&&!Sh&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Sh=!0);const n=j3(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return k3(n),n}const P3=e=>{(Jg?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?r3(e):e,r=(n,s)=>N3(t,n,s);return Object.assign(r,t),r},E3=e=>P3,T3={};function M3(e,t){let r;try{r=e()}catch{return}return{getItem:s=>{var i;const o=l=>l===null?null:JSON.parse(l,void 0),a=(i=r.getItem(s))!=null?i:null;return a instanceof Promise?a.then(o):o(a)},setItem:(s,i)=>r.setItem(s,JSON.stringify(i,void 0)),removeItem:s=>r.removeItem(s)}}const ni=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return ni(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return ni(n)(r)}}}},A3=(e,t)=>(r,n,s)=>{let i={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:w=>w,version:0,merge:(w,v)=>({...v,...w}),...t},o=!1;const a=new Set,l=new Set;let c;try{c=i.getStorage()}catch{}if(!c)return e((...w)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),r(...w)},n,s);const d=ni(i.serialize),f=()=>{const w=i.partialize({...n()});let v;const y=d({state:w,version:i.version}).then(x=>c.setItem(i.name,x)).catch(x=>{v=x});if(v)throw v;return y},u=s.setState;s.setState=(w,v)=>{u(w,v),f()};const p=e((...w)=>{r(...w),f()},n,s);let m;const g=()=>{var w;if(!c)return;o=!1,a.forEach(y=>y(n()));const v=((w=i.onRehydrateStorage)==null?void 0:w.call(i,n()))||void 0;return ni(c.getItem.bind(c))(i.name).then(y=>{if(y)return i.deserialize(y)}).then(y=>{if(y)if(typeof y.version=="number"&&y.version!==i.version){if(i.migrate)return i.migrate(y.state,y.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return y.state}).then(y=>{var x;return m=i.merge(y,(x=n())!=null?x:p),r(m,!0),f()}).then(()=>{v==null||v(m,void 0),o=!0,l.forEach(y=>y(m))}).catch(y=>{v==null||v(void 0,y)})};return s.persist={setOptions:w=>{i={...i,...w},w.getStorage&&(c=w.getStorage())},clearStorage:()=>{c==null||c.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>g(),hasHydrated:()=>o,onHydrate:w=>(a.add(w),()=>{a.delete(w)}),onFinishHydration:w=>(l.add(w),()=>{l.delete(w)})},g(),m||p},_3=(e,t)=>(r,n,s)=>{let i={storage:M3(()=>localStorage),partialize:g=>g,version:0,merge:(g,w)=>({...w,...g}),...t},o=!1;const a=new Set,l=new Set;let c=i.storage;if(!c)return e((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),r(...g)},n,s);const d=()=>{const g=i.partialize({...n()});return c.setItem(i.name,{state:g,version:i.version})},f=s.setState;s.setState=(g,w)=>{f(g,w),d()};const u=e((...g)=>{r(...g),d()},n,s);s.getInitialState=()=>u;let p;const m=()=>{var g,w;if(!c)return;o=!1,a.forEach(y=>{var x;return y((x=n())!=null?x:u)});const v=((w=i.onRehydrateStorage)==null?void 0:w.call(i,(g=n())!=null?g:u))||void 0;return ni(c.getItem.bind(c))(i.name).then(y=>{if(y)if(typeof y.version=="number"&&y.version!==i.version){if(i.migrate)return[!0,i.migrate(y.state,y.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,y.state];return[!1,void 0]}).then(y=>{var x;const[b,k]=y;if(p=i.merge(k,(x=n())!=null?x:u),r(p,!0),b)return d()}).then(()=>{v==null||v(p,void 0),p=n(),o=!0,l.forEach(y=>y(p))}).catch(y=>{v==null||v(void 0,y)})};return s.persist={setOptions:g=>{i={...i,...g},g.storage&&(c=g.storage)},clearStorage:()=>{c==null||c.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>m(),hasHydrated:()=>o,onHydrate:g=>(a.add(g),()=>{a.delete(g)}),onFinishHydration:g=>(l.add(g),()=>{l.delete(g)})},i.skipHydration||m(),p||u},L3=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((T3?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),A3(e,t)):_3(e,t),D3=L3,kh={currentUser:null,partnerUser:null,isLoading:!1,error:null,currentTrack:null,isPlaying:!1},oe=E3()(D3(e=>({...kh,mixedPlaylists:[],memoryLane:[],theme:"green",setCurrentUser:t=>e({currentUser:t}),setPartnerUser:t=>e({partnerUser:t}),logout:()=>e({currentUser:null,partnerUser:null,currentTrack:null,isPlaying:!1,mixedPlaylists:[],memoryLane:[],error:null}),setLoading:t=>e({isLoading:t}),setError:t=>e({error:t}),setCurrentTrack:t=>e({currentTrack:t}),setIsPlaying:t=>e({isPlaying:t}),addMixedPlaylist:t=>e(r=>({mixedPlaylists:[...r.mixedPlaylists,t]})),removeMixedPlaylist:t=>e(r=>({mixedPlaylists:r.mixedPlaylists.filter(n=>n.id!==t)})),setMixedPlaylists:t=>e({mixedPlaylists:t}),addMemoryLaneItem:t=>e(r=>({memoryLane:[...r.memoryLane,t].sort((n,s)=>new Date(s.date).getTime()-new Date(n.date).getTime())})),removeMemoryLaneItem:t=>e(r=>({memoryLane:r.memoryLane.filter(n=>n.id!==t)})),setTheme:t=>e({theme:t}),clearAllData:()=>e({...kh,mixedPlaylists:[],memoryLane:[]})}),{name:"spotify-app-settings",partialize:e=>({theme:e.theme})}));function R3(){{const e="/api";try{const t=typeof window<"u"&&window.location.protocol==="https:",r=new URL(e,window.location.origin);if(t&&r.protocol==="http:"&&r.hostname==="159.195.9.107"&&(r.port==="8081"||r.port===""))return"https://159.195.9.107:3443"}catch{}return e}}const Kn=R3();function Xt(){try{const e=localStorage.getItem("spotify-user");if(!e)return null;const t=JSON.parse(e);return(t==null?void 0:t.jwt)||(t==null?void 0:t.token)||null}catch{return null}}async function Et(e,t,r){const n=await fetch(`${Kn}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...r?{Authorization:`Bearer ${r}`}:Xt()?{Authorization:`Bearer ${Xt()}`}:{}},body:t?JSON.stringify(t):void 0});if(!n.ok){const s=await n.text();throw new Error(s||`Request failed: ${n.status}`)}return n.json()}async function te(e,t){const r=await fetch(`${Kn}${e}`,{headers:{...t?{Authorization:`Bearer ${t}`}:Xt()?{Authorization:`Bearer ${Xt()}`}:{}}});if(!r.ok){const n=await r.text();throw new Error(n||`Request failed: ${r.status}`)}return r.json()}function V3(e){const t=Xt(),r=new URL(`${Kn}${e}`,window.location.origin);return t&&r.searchParams.set("token",t),new EventSource(r.toString())}async function F3(e,t,r){const n=await fetch(`${Kn}${e}`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",...Xt()?{Authorization:`Bearer ${Xt()}`}:{}},body:new URLSearchParams(t).toString()});if(!n.ok){const s=await n.text();throw new Error(s||`Request failed: ${n.status}`)}return n.json()}async function I3(e,t){const r=await fetch(`${Kn}${e}`,{method:"DELETE",headers:{...t?{Authorization:`Bearer ${t}`}:Xt()?{Authorization:`Bearer ${Xt()}`}:{}}});if(!r.ok){const n=await r.text();throw new Error(n||`Request failed: ${r.status}`)}return r.json()}const en=e=>{const t={green:{primary:"bg-theme-green-primary text-white",secondary:"bg-theme-green-secondary text-white",accent:"bg-theme-green-accent text-white",border:"border-theme-green-primary",text:"text-theme-green-primary",gradient:"from-theme-green-primary to-theme-green-secondary",glass:"bg-theme-green-primary/10 border-theme-green-primary/30",hover:"hover:bg-theme-green-primary/20",cssVars:{primary:"#1db954",secondary:"#1ed760",accent:"#00e676"}},pink:{primary:"bg-theme-pink-primary text-white",secondary:"bg-theme-pink-secondary text-white",accent:"bg-theme-pink-accent text-white",border:"border-theme-pink-primary",text:"text-theme-pink-primary",gradient:"from-theme-pink-primary to-theme-pink-secondary",glass:"bg-theme-pink-primary/10 border-theme-pink-primary/30",hover:"hover:bg-theme-pink-primary/20",cssVars:{primary:"#ec4899",secondary:"#f472b6",accent:"#fb7185"}},blue:{primary:"bg-theme-blue-primary text-white",secondary:"bg-theme-blue-secondary text-white",accent:"bg-theme-blue-accent text-white",border:"border-theme-blue-primary",text:"text-theme-blue-primary",gradient:"from-theme-blue-primary to-theme-blue-secondary",glass:"bg-theme-blue-primary/10 border-theme-blue-primary/30",hover:"hover:bg-theme-blue-primary/20",cssVars:{primary:"#3b82f6",secondary:"#60a5fa",accent:"#93c5fd"}},red:{primary:"bg-theme-red-primary text-white",secondary:"bg-theme-red-secondary text-white",accent:"bg-theme-red-accent text-white",border:"border-theme-red-primary",text:"text-theme-red-primary",gradient:"from-theme-red-primary to-theme-red-secondary",glass:"bg-theme-red-primary/10 border-theme-red-primary/30",hover:"hover:bg-theme-red-primary/20",cssVars:{primary:"#dc2626",secondary:"#ef4444",accent:"#f87171"}},purple:{primary:"bg-theme-purple-primary text-white",secondary:"bg-theme-purple-secondary text-white",accent:"bg-theme-purple-accent text-white",border:"border-theme-purple-primary",text:"text-theme-purple-primary",gradient:"from-theme-purple-primary to-theme-purple-secondary",glass:"bg-theme-purple-primary/10 border-theme-purple-primary/30",hover:"hover:bg-theme-purple-primary/20",cssVars:{primary:"#8b5cf6",secondary:"#a78bfa",accent:"#c4b5fd"}},yellow:{primary:"bg-theme-yellow-primary text-black",secondary:"bg-theme-yellow-secondary text-black",accent:"bg-theme-yellow-accent text-black",border:"border-theme-yellow-primary",text:"text-theme-yellow-primary",gradient:"from-theme-yellow-primary to-theme-yellow-secondary",glass:"bg-theme-yellow-primary/10 border-theme-yellow-primary/30",hover:"hover:bg-theme-yellow-primary/20",cssVars:{primary:"#eab308",secondary:"#f59e0b",accent:"#fbbf24"}},turquoise:{primary:"bg-theme-turquoise-primary text-white",secondary:"bg-theme-turquoise-secondary text-white",accent:"bg-theme-turquoise-accent text-white",border:"border-theme-turquoise-primary",text:"text-theme-turquoise-primary",gradient:"from-theme-turquoise-primary to-theme-turquoise-secondary",glass:"bg-theme-turquoise-primary/10 border-theme-turquoise-primary/30",hover:"hover:bg-theme-turquoise-primary/20",cssVars:{primary:"#06b6d4",secondary:"#22d3ee",accent:"#67e8f9"}}},r=t[e]||t.green;if(typeof document<"u"){const n=document.documentElement;n.style.setProperty("--theme-primary",r.cssVars.primary),n.style.setProperty("--theme-secondary",r.cssVars.secondary),n.style.setProperty("--theme-accent",r.cssVars.accent)}return r},Ms=e=>({green:120,pink:300,blue:360,red:245,purple:280,yellow:200,turquoise:40})[e]||120;function As(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function yu(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function z3(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function jh(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function Ch(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function O3(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function $3(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function Ja(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function B3(e,t){let r=t[0]-e[0],n=t[1]-e[1],s=t[2]-e[2];return Math.sqrt(r*r+n*n+s*s)}function U3(e,t){let r=t[0]-e[0],n=t[1]-e[1],s=t[2]-e[2];return r*r+n*n+s*s}function Nh(e){let t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}function W3(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function H3(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function vu(e,t){let r=t[0],n=t[1],s=t[2],i=r*r+n*n+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function ey(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Ph(e,t,r){let n=t[0],s=t[1],i=t[2],o=r[0],a=r[1],l=r[2];return e[0]=s*l-i*a,e[1]=i*o-n*l,e[2]=n*a-s*o,e}function q3(e,t,r,n){let s=t[0],i=t[1],o=t[2];return e[0]=s+n*(r[0]-s),e[1]=i+n*(r[1]-i),e[2]=o+n*(r[2]-o),e}function G3(e,t,r,n,s){const i=Math.exp(-n*s);let o=t[0],a=t[1],l=t[2];return e[0]=r[0]+(o-r[0])*i,e[1]=r[1]+(a-r[1])*i,e[2]=r[2]+(l-r[2])*i,e}function Y3(e,t,r){let n=t[0],s=t[1],i=t[2],o=r[3]*n+r[7]*s+r[11]*i+r[15];return o=o||1,e[0]=(r[0]*n+r[4]*s+r[8]*i+r[12])/o,e[1]=(r[1]*n+r[5]*s+r[9]*i+r[13])/o,e[2]=(r[2]*n+r[6]*s+r[10]*i+r[14])/o,e}function K3(e,t,r){let n=t[0],s=t[1],i=t[2],o=r[3]*n+r[7]*s+r[11]*i+r[15];return o=o||1,e[0]=(r[0]*n+r[4]*s+r[8]*i)/o,e[1]=(r[1]*n+r[5]*s+r[9]*i)/o,e[2]=(r[2]*n+r[6]*s+r[10]*i)/o,e}function X3(e,t,r){let n=t[0],s=t[1],i=t[2];return e[0]=n*r[0]+s*r[3]+i*r[6],e[1]=n*r[1]+s*r[4]+i*r[7],e[2]=n*r[2]+s*r[5]+i*r[8],e}function Q3(e,t,r){let n=t[0],s=t[1],i=t[2],o=r[0],a=r[1],l=r[2],c=r[3],d=a*i-l*s,f=l*n-o*i,u=o*s-a*n,p=a*u-l*f,m=l*d-o*u,g=o*f-a*d,w=c*2;return d*=w,f*=w,u*=w,p*=2,m*=2,g*=2,e[0]=n+d+p,e[1]=s+f+m,e[2]=i+u+g,e}const Z3=function(){const e=[0,0,0],t=[0,0,0];return function(r,n){yu(e,r),yu(t,n),vu(e,e),vu(t,t);let s=ey(e,t);return s>1?0:s<-1?Math.PI:Math.acos(s)}}();function J3(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}class vt extends Array{constructor(t=0,r=t,n=t){return super(t,r,n),this}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(t){this[0]=t}set y(t){this[1]=t}set z(t){this[2]=t}set(t,r=t,n=t){return t.length?this.copy(t):(z3(this,t,r,n),this)}copy(t){return yu(this,t),this}add(t,r){return r?jh(this,t,r):jh(this,this,t),this}sub(t,r){return r?Ch(this,t,r):Ch(this,this,t),this}multiply(t){return t.length?O3(this,this,t):Ja(this,this,t),this}divide(t){return t.length?$3(this,this,t):Ja(this,this,1/t),this}inverse(t=this){return H3(this,t),this}len(){return As(this)}distance(t){return t?B3(this,t):As(this)}squaredLen(){return Nh(this)}squaredDistance(t){return t?U3(this,t):Nh(this)}negate(t=this){return W3(this,t),this}cross(t,r){return r?Ph(this,t,r):Ph(this,this,t),this}scale(t){return Ja(this,this,t),this}normalize(){return vu(this,this),this}dot(t){return ey(this,t)}equals(t){return J3(this,t)}applyMatrix3(t){return X3(this,this,t),this}applyMatrix4(t){return Y3(this,this,t),this}scaleRotateMatrix4(t){return K3(this,this,t),this}applyQuaternion(t){return Q3(this,this,t),this}angle(t){return Z3(this,t)}lerp(t,r){return q3(this,this,t,r),this}smoothLerp(t,r,n){return G3(this,this,t,r,n),this}clone(){return new vt(this[0],this[1],this[2])}fromArray(t,r=0){return this[0]=t[r],this[1]=t[r+1],this[2]=t[r+2],this}toArray(t=[],r=0){return t[r]=this[0],t[r+1]=this[1],t[r+2]=this[2],t}transformDirection(t){const r=this[0],n=this[1],s=this[2];return this[0]=t[0]*r+t[4]*n+t[8]*s,this[1]=t[1]*r+t[5]*n+t[9]*s,this[2]=t[2]*r+t[6]*n+t[10]*s,this.normalize()}}const Eh=new vt;let eS=1,tS=1,Th=!1;class rS{constructor(t,r={}){t.canvas||console.error("gl not passed as first argument to Geometry"),this.gl=t,this.attributes=r,this.id=eS++,this.VAOs={},this.drawRange={start:0,count:0},this.instancedCount=0,this.gl.renderer.bindVertexArray(null),this.gl.renderer.currentGeometry=null,this.glState=this.gl.renderer.state;for(let n in r)this.addAttribute(n,r[n])}addAttribute(t,r){if(this.attributes[t]=r,r.id=tS++,r.size=r.size||1,r.type=r.type||(r.data.constructor===Float32Array?this.gl.FLOAT:r.data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT),r.target=t==="index"?this.gl.ELEMENT_ARRAY_BUFFER:this.gl.ARRAY_BUFFER,r.normalized=r.normalized||!1,r.stride=r.stride||0,r.offset=r.offset||0,r.count=r.count||(r.stride?r.data.byteLength/r.stride:r.data.length/r.size),r.divisor=r.instanced||0,r.needsUpdate=!1,r.usage=r.usage||this.gl.STATIC_DRAW,r.buffer||this.updateAttribute(r),r.divisor){if(this.isInstanced=!0,this.instancedCount&&this.instancedCount!==r.count*r.divisor)return console.warn("geometry has multiple instanced buffers of different length"),this.instancedCount=Math.min(this.instancedCount,r.count*r.divisor);this.instancedCount=r.count*r.divisor}else t==="index"?this.drawRange.count=r.count:this.attributes.index||(this.drawRange.count=Math.max(this.drawRange.count,r.count))}updateAttribute(t){const r=!t.buffer;r&&(t.buffer=this.gl.createBuffer()),this.glState.boundBuffer!==t.buffer&&(this.gl.bindBuffer(t.target,t.buffer),this.glState.boundBuffer=t.buffer),r?this.gl.bufferData(t.target,t.data,t.usage):this.gl.bufferSubData(t.target,0,t.data),t.needsUpdate=!1}setIndex(t){this.addAttribute("index",t)}setDrawRange(t,r){this.drawRange.start=t,this.drawRange.count=r}setInstancedCount(t){this.instancedCount=t}createVAO(t){this.VAOs[t.attributeOrder]=this.gl.renderer.createVertexArray(),this.gl.renderer.bindVertexArray(this.VAOs[t.attributeOrder]),this.bindAttributes(t)}bindAttributes(t){t.attributeLocations.forEach((r,{name:n,type:s})=>{if(!this.attributes[n]){console.warn(`active attribute ${n} not being supplied`);return}const i=this.attributes[n];this.gl.bindBuffer(i.target,i.buffer),this.glState.boundBuffer=i.buffer;let o=1;s===35674&&(o=2),s===35675&&(o=3),s===35676&&(o=4);const a=i.size/o,l=o===1?0:o*o*4,c=o===1?0:o*4;for(let d=0;d{const a=this.attributes[o];a.needsUpdate&&this.updateAttribute(a)});let n=2;((s=this.attributes.index)==null?void 0:s.type)===this.gl.UNSIGNED_INT&&(n=4),this.isInstanced?this.attributes.index?this.gl.renderer.drawElementsInstanced(r,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*n,this.instancedCount):this.gl.renderer.drawArraysInstanced(r,this.drawRange.start,this.drawRange.count,this.instancedCount):this.attributes.index?this.gl.drawElements(r,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*n):this.gl.drawArrays(r,this.drawRange.start,this.drawRange.count)}getPosition(){const t=this.attributes.position;if(t.data)return t;if(!Th)return console.warn("No position buffer data found to compute bounds"),Th=!0}computeBoundingBox(t){t||(t=this.getPosition());const r=t.data,n=t.size;this.bounds||(this.bounds={min:new vt,max:new vt,center:new vt,scale:new vt,radius:1/0});const s=this.bounds.min,i=this.bounds.max,o=this.bounds.center,a=this.bounds.scale;s.set(1/0),i.set(-1/0);for(let l=0,c=r.length;l{let o=this.uniforms[i.uniformName];for(const a of i.nameComponents){if(!o)break;if(a in o)o=o[a];else{if(Array.isArray(o.value))break;o=void 0;break}}if(!o)return _h(`Active uniform ${i.name} has not been supplied`);if(o&&o.value===void 0)return _h(`${i.name} uniform is missing a value parameter`);if(o.value.texture)return r=r+1,o.value.update(r),el(this.gl,i.type,s,r);if(o.value.length&&o.value[0].texture){const a=[];return o.value.forEach(l=>{r=r+1,l.update(r),a.push(r)}),el(this.gl,i.type,s,a)}el(this.gl,i.type,s,o.value)}),this.applyState(),t&&this.gl.renderer.setFrontFace(this.frontFace===this.gl.CCW?this.gl.CW:this.gl.CCW)}remove(){this.gl.deleteProgram(this.program)}}function el(e,t,r,n){n=n.length?iS(n):n;const s=e.renderer.state.uniformLocations.get(r);if(n.length)if(s===void 0||s.length!==n.length)e.renderer.state.uniformLocations.set(r,n.slice(0));else{if(oS(s,n))return;s.set?s.set(n):aS(s,n),e.renderer.state.uniformLocations.set(r,s)}else{if(s===n)return;e.renderer.state.uniformLocations.set(r,n)}switch(t){case 5126:return n.length?e.uniform1fv(r,n):e.uniform1f(r,n);case 35664:return e.uniform2fv(r,n);case 35665:return e.uniform3fv(r,n);case 35666:return e.uniform4fv(r,n);case 35670:case 5124:case 35678:case 36306:case 35680:case 36289:return n.length?e.uniform1iv(r,n):e.uniform1i(r,n);case 35671:case 35667:return e.uniform2iv(r,n);case 35672:case 35668:return e.uniform3iv(r,n);case 35673:case 35669:return e.uniform4iv(r,n);case 35674:return e.uniformMatrix2fv(r,!1,n);case 35675:return e.uniformMatrix3fv(r,!1,n);case 35676:return e.uniformMatrix4fv(r,!1,n)}}function Ah(e){let t=e.split(` `);for(let r=0;r100||(console.warn(e),tl++,tl>100&&console.warn("More than 100 program warnings - stopping logs."))}const rl=new vt;let lS=1;class uS{constructor({canvas:t=document.createElement("canvas"),width:r=300,height:n=150,dpr:s=1,alpha:i=!1,depth:o=!0,stencil:a=!1,antialias:l=!1,premultipliedAlpha:c=!1,preserveDrawingBuffer:d=!1,powerPreference:f="default",autoClear:u=!0,webgl:p=2}={}){const m={alpha:i,depth:o,stencil:a,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:d,powerPreference:f};this.dpr=s,this.alpha=i,this.color=!0,this.depth=o,this.stencil=a,this.premultipliedAlpha=c,this.autoClear=u,this.id=lS++,p===2&&(this.gl=t.getContext("webgl2",m)),this.isWebgl2=!!this.gl,this.gl||(this.gl=t.getContext("webgl",m)),this.gl||console.error("unable to create webgl context"),this.gl.renderer=this,this.setSize(r,n),this.state={},this.state.blendFunc={src:this.gl.ONE,dst:this.gl.ZERO},this.state.blendEquation={modeRGB:this.gl.FUNC_ADD},this.state.cullFace=!1,this.state.frontFace=this.gl.CCW,this.state.depthMask=!0,this.state.depthFunc=this.gl.LEQUAL,this.state.premultiplyAlpha=!1,this.state.flipY=!1,this.state.unpackAlignment=4,this.state.framebuffer=null,this.state.viewport={x:0,y:0,width:null,height:null},this.state.textureUnits=[],this.state.activeTextureUnit=0,this.state.boundBuffer=null,this.state.uniformLocations=new Map,this.state.currentProgram=null,this.extensions={},this.isWebgl2?(this.getExtension("EXT_color_buffer_float"),this.getExtension("OES_texture_float_linear")):(this.getExtension("OES_texture_float"),this.getExtension("OES_texture_float_linear"),this.getExtension("OES_texture_half_float"),this.getExtension("OES_texture_half_float_linear"),this.getExtension("OES_element_index_uint"),this.getExtension("OES_standard_derivatives"),this.getExtension("EXT_sRGB"),this.getExtension("WEBGL_depth_texture"),this.getExtension("WEBGL_draw_buffers")),this.getExtension("WEBGL_compressed_texture_astc"),this.getExtension("EXT_texture_compression_bptc"),this.getExtension("WEBGL_compressed_texture_s3tc"),this.getExtension("WEBGL_compressed_texture_etc1"),this.getExtension("WEBGL_compressed_texture_pvrtc"),this.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),this.vertexAttribDivisor=this.getExtension("ANGLE_instanced_arrays","vertexAttribDivisor","vertexAttribDivisorANGLE"),this.drawArraysInstanced=this.getExtension("ANGLE_instanced_arrays","drawArraysInstanced","drawArraysInstancedANGLE"),this.drawElementsInstanced=this.getExtension("ANGLE_instanced_arrays","drawElementsInstanced","drawElementsInstancedANGLE"),this.createVertexArray=this.getExtension("OES_vertex_array_object","createVertexArray","createVertexArrayOES"),this.bindVertexArray=this.getExtension("OES_vertex_array_object","bindVertexArray","bindVertexArrayOES"),this.deleteVertexArray=this.getExtension("OES_vertex_array_object","deleteVertexArray","deleteVertexArrayOES"),this.drawBuffers=this.getExtension("WEBGL_draw_buffers","drawBuffers","drawBuffersWEBGL"),this.parameters={},this.parameters.maxTextureUnits=this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),this.parameters.maxAnisotropy=this.getExtension("EXT_texture_filter_anisotropic")?this.gl.getParameter(this.getExtension("EXT_texture_filter_anisotropic").MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}setSize(t,r){this.width=t,this.height=r,this.gl.canvas.width=t*this.dpr,this.gl.canvas.height=r*this.dpr,this.gl.canvas.style&&Object.assign(this.gl.canvas.style,{width:t+"px",height:r+"px"})}setViewport(t,r,n=0,s=0){this.state.viewport.width===t&&this.state.viewport.height===r||(this.state.viewport.width=t,this.state.viewport.height=r,this.state.viewport.x=n,this.state.viewport.y=s,this.gl.viewport(n,s,t,r))}setScissor(t,r,n=0,s=0){this.gl.scissor(n,s,t,r)}enable(t){this.state[t]!==!0&&(this.gl.enable(t),this.state[t]=!0)}disable(t){this.state[t]!==!1&&(this.gl.disable(t),this.state[t]=!1)}setBlendFunc(t,r,n,s){this.state.blendFunc.src===t&&this.state.blendFunc.dst===r&&this.state.blendFunc.srcAlpha===n&&this.state.blendFunc.dstAlpha===s||(this.state.blendFunc.src=t,this.state.blendFunc.dst=r,this.state.blendFunc.srcAlpha=n,this.state.blendFunc.dstAlpha=s,n!==void 0?this.gl.blendFuncSeparate(t,r,n,s):this.gl.blendFunc(t,r))}setBlendEquation(t,r){t=t||this.gl.FUNC_ADD,!(this.state.blendEquation.modeRGB===t&&this.state.blendEquation.modeAlpha===r)&&(this.state.blendEquation.modeRGB=t,this.state.blendEquation.modeAlpha=r,r!==void 0?this.gl.blendEquationSeparate(t,r):this.gl.blendEquation(t))}setCullFace(t){this.state.cullFace!==t&&(this.state.cullFace=t,this.gl.cullFace(t))}setFrontFace(t){this.state.frontFace!==t&&(this.state.frontFace=t,this.gl.frontFace(t))}setDepthMask(t){this.state.depthMask!==t&&(this.state.depthMask=t,this.gl.depthMask(t))}setDepthFunc(t){this.state.depthFunc!==t&&(this.state.depthFunc=t,this.gl.depthFunc(t))}setStencilMask(t){this.state.stencilMask!==t&&(this.state.stencilMask=t,this.gl.stencilMask(t))}setStencilFunc(t,r,n){this.state.stencilFunc===t&&this.state.stencilRef===r&&this.state.stencilFuncMask===n||(this.state.stencilFunc=t||this.gl.ALWAYS,this.state.stencilRef=r||0,this.state.stencilFuncMask=n||0,this.gl.stencilFunc(t||this.gl.ALWAYS,r||0,n||0))}setStencilOp(t,r,n){this.state.stencilFail===t&&this.state.stencilDepthFail===r&&this.state.stencilDepthPass===n||(this.state.stencilFail=t,this.state.stencilDepthFail=r,this.state.stencilDepthPass=n,this.gl.stencilOp(t,r,n))}activeTexture(t){this.state.activeTextureUnit!==t&&(this.state.activeTextureUnit=t,this.gl.activeTexture(this.gl.TEXTURE0+t))}bindFramebuffer({target:t=this.gl.FRAMEBUFFER,buffer:r=null}={}){this.state.framebuffer!==r&&(this.state.framebuffer=r,this.gl.bindFramebuffer(t,r))}getExtension(t,r,n){return r&&this.gl[r]?this.gl[r].bind(this.gl):(this.extensions[t]||(this.extensions[t]=this.gl.getExtension(t)),r?this.extensions[t]?this.extensions[t][n].bind(this.extensions[t]):null:this.extensions[t])}sortOpaque(t,r){return t.renderOrder!==r.renderOrder?t.renderOrder-r.renderOrder:t.program.id!==r.program.id?t.program.id-r.program.id:t.zDepth!==r.zDepth?t.zDepth-r.zDepth:r.id-t.id}sortTransparent(t,r){return t.renderOrder!==r.renderOrder?t.renderOrder-r.renderOrder:t.zDepth!==r.zDepth?r.zDepth-t.zDepth:r.id-t.id}sortUI(t,r){return t.renderOrder!==r.renderOrder?t.renderOrder-r.renderOrder:t.program.id!==r.program.id?t.program.id-r.program.id:r.id-t.id}getRenderList({scene:t,camera:r,frustumCull:n,sort:s}){let i=[];if(r&&n&&r.updateFrustum(),t.traverse(o=>{if(!o.visible)return!0;o.draw&&(n&&o.frustumCulled&&r&&!r.frustumIntersectsMesh(o)||i.push(o))}),s){const o=[],a=[],l=[];i.forEach(c=>{c.program.transparent?c.program.depthTest?a.push(c):l.push(c):o.push(c),c.zDepth=0,!(c.renderOrder!==0||!c.program.depthTest||!r)&&(c.worldMatrix.getTranslation(rl),rl.applyMatrix4(r.projectionViewMatrix),c.zDepth=rl.z)}),o.sort(this.sortOpaque),a.sort(this.sortTransparent),l.sort(this.sortUI),i=o.concat(a,l)}return i}render({scene:t,camera:r,target:n=null,update:s=!0,sort:i=!0,frustumCull:o=!0,clear:a}){n===null?(this.bindFramebuffer(),this.setViewport(this.width*this.dpr,this.height*this.dpr)):(this.bindFramebuffer(n),this.setViewport(n.width,n.height)),(a||this.autoClear&&a!==!1)&&(this.depth&&(!n||n.depth)&&(this.enable(this.gl.DEPTH_TEST),this.setDepthMask(!0)),(this.stencil||!n||n.stencil)&&(this.enable(this.gl.STENCIL_TEST),this.setStencilMask(255)),this.gl.clear((this.color?this.gl.COLOR_BUFFER_BIT:0)|(this.depth?this.gl.DEPTH_BUFFER_BIT:0)|(this.stencil?this.gl.STENCIL_BUFFER_BIT:0))),s&&t.updateMatrixWorld(),r&&r.updateMatrixWorld(),this.getRenderList({scene:t,camera:r,frustumCull:o,sort:i}).forEach(c=>{c.draw({camera:r})})}}function cS(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function dS(e,t,r,n,s){return e[0]=t,e[1]=r,e[2]=n,e[3]=s,e}function fS(e,t){let r=t[0],n=t[1],s=t[2],i=t[3],o=r*r+n*n+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=n*o,e[2]=s*o,e[3]=i*o,e}function hS(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function pS(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function mS(e,t,r){r=r*.5;let n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function Lh(e,t,r){let n=t[0],s=t[1],i=t[2],o=t[3],a=r[0],l=r[1],c=r[2],d=r[3];return e[0]=n*d+o*a+s*c-i*l,e[1]=s*d+o*l+i*a-n*c,e[2]=i*d+o*c+n*l-s*a,e[3]=o*d-n*a-s*l-i*c,e}function gS(e,t,r){r*=.5;let n=t[0],s=t[1],i=t[2],o=t[3],a=Math.sin(r),l=Math.cos(r);return e[0]=n*l+o*a,e[1]=s*l+i*a,e[2]=i*l-s*a,e[3]=o*l-n*a,e}function yS(e,t,r){r*=.5;let n=t[0],s=t[1],i=t[2],o=t[3],a=Math.sin(r),l=Math.cos(r);return e[0]=n*l-i*a,e[1]=s*l+o*a,e[2]=i*l+n*a,e[3]=o*l-s*a,e}function vS(e,t,r){r*=.5;let n=t[0],s=t[1],i=t[2],o=t[3],a=Math.sin(r),l=Math.cos(r);return e[0]=n*l+s*a,e[1]=s*l-n*a,e[2]=i*l+o*a,e[3]=o*l-i*a,e}function xS(e,t,r,n){let s=t[0],i=t[1],o=t[2],a=t[3],l=r[0],c=r[1],d=r[2],f=r[3],u,p,m,g,w;return p=s*l+i*c+o*d+a*f,p<0&&(p=-p,l=-l,c=-c,d=-d,f=-f),1-p>1e-6?(u=Math.acos(p),m=Math.sin(u),g=Math.sin((1-n)*u)/m,w=Math.sin(n*u)/m):(g=1-n,w=n),e[0]=g*s+w*l,e[1]=g*i+w*c,e[2]=g*o+w*d,e[3]=g*a+w*f,e}function wS(e,t){let r=t[0],n=t[1],s=t[2],i=t[3],o=r*r+n*n+s*s+i*i,a=o?1/o:0;return e[0]=-r*a,e[1]=-n*a,e[2]=-s*a,e[3]=i*a,e}function bS(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function SS(e,t){let r=t[0]+t[4]+t[8],n;if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;n=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*n,n=.5/n,e[3]=(t[i*3+o]-t[o*3+i])*n,e[i]=(t[i*3+s]+t[s*3+i])*n,e[o]=(t[o*3+s]+t[s*3+o])*n}return e}function kS(e,t,r="YXZ"){let n=Math.sin(t[0]*.5),s=Math.cos(t[0]*.5),i=Math.sin(t[1]*.5),o=Math.cos(t[1]*.5),a=Math.sin(t[2]*.5),l=Math.cos(t[2]*.5);return r==="XYZ"?(e[0]=n*o*l+s*i*a,e[1]=s*i*l-n*o*a,e[2]=s*o*a+n*i*l,e[3]=s*o*l-n*i*a):r==="YXZ"?(e[0]=n*o*l+s*i*a,e[1]=s*i*l-n*o*a,e[2]=s*o*a-n*i*l,e[3]=s*o*l+n*i*a):r==="ZXY"?(e[0]=n*o*l-s*i*a,e[1]=s*i*l+n*o*a,e[2]=s*o*a+n*i*l,e[3]=s*o*l-n*i*a):r==="ZYX"?(e[0]=n*o*l-s*i*a,e[1]=s*i*l+n*o*a,e[2]=s*o*a-n*i*l,e[3]=s*o*l+n*i*a):r==="YZX"?(e[0]=n*o*l+s*i*a,e[1]=s*i*l+n*o*a,e[2]=s*o*a-n*i*l,e[3]=s*o*l-n*i*a):r==="XZY"&&(e[0]=n*o*l-s*i*a,e[1]=s*i*l-n*o*a,e[2]=s*o*a+n*i*l,e[3]=s*o*l+n*i*a),e}const jS=cS,CS=dS,NS=hS,PS=fS;class ES extends Array{constructor(t=0,r=0,n=0,s=1){super(t,r,n,s),this.onChange=()=>{},this._target=this;const i=["0","1","2","3"];return new Proxy(this,{set(o,a){const l=Reflect.set(...arguments);return l&&i.includes(a)&&o.onChange(),l}})}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}get w(){return this[3]}set x(t){this._target[0]=t,this.onChange()}set y(t){this._target[1]=t,this.onChange()}set z(t){this._target[2]=t,this.onChange()}set w(t){this._target[3]=t,this.onChange()}identity(){return pS(this._target),this.onChange(),this}set(t,r,n,s){return t.length?this.copy(t):(CS(this._target,t,r,n,s),this.onChange(),this)}rotateX(t){return gS(this._target,this._target,t),this.onChange(),this}rotateY(t){return yS(this._target,this._target,t),this.onChange(),this}rotateZ(t){return vS(this._target,this._target,t),this.onChange(),this}inverse(t=this._target){return wS(this._target,t),this.onChange(),this}conjugate(t=this._target){return bS(this._target,t),this.onChange(),this}copy(t){return jS(this._target,t),this.onChange(),this}normalize(t=this._target){return PS(this._target,t),this.onChange(),this}multiply(t,r){return r?Lh(this._target,t,r):Lh(this._target,this._target,t),this.onChange(),this}dot(t){return NS(this._target,t)}fromMatrix3(t){return SS(this._target,t),this.onChange(),this}fromEuler(t,r){return kS(this._target,t,t.order),r||this.onChange(),this}fromAxisAngle(t,r){return mS(this._target,t,r),this.onChange(),this}slerp(t,r){return xS(this._target,this._target,t,r),this.onChange(),this}fromArray(t,r=0){return this._target[0]=t[r],this._target[1]=t[r+1],this._target[2]=t[r+2],this._target[3]=t[r+3],this.onChange(),this}toArray(t=[],r=0){return t[r]=this[0],t[r+1]=this[1],t[r+2]=this[2],t[r+3]=this[3],t}}const TS=1e-6;function MS(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function AS(e,t,r,n,s,i,o,a,l,c,d,f,u,p,m,g,w){return e[0]=t,e[1]=r,e[2]=n,e[3]=s,e[4]=i,e[5]=o,e[6]=a,e[7]=l,e[8]=c,e[9]=d,e[10]=f,e[11]=u,e[12]=p,e[13]=m,e[14]=g,e[15]=w,e}function _S(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function LS(e,t){let r=t[0],n=t[1],s=t[2],i=t[3],o=t[4],a=t[5],l=t[6],c=t[7],d=t[8],f=t[9],u=t[10],p=t[11],m=t[12],g=t[13],w=t[14],v=t[15],y=r*a-n*o,x=r*l-s*o,b=r*c-i*o,k=n*l-s*a,C=n*c-i*a,N=s*c-i*l,P=d*g-f*m,V=d*w-u*m,T=d*v-p*m,O=f*w-u*g,j=f*v-p*g,F=u*v-p*w,D=y*F-x*j+b*O+k*T-C*V+N*P;return D?(D=1/D,e[0]=(a*F-l*j+c*O)*D,e[1]=(s*j-n*F-i*O)*D,e[2]=(g*N-w*C+v*k)*D,e[3]=(u*C-f*N-p*k)*D,e[4]=(l*T-o*F-c*V)*D,e[5]=(r*F-s*T+i*V)*D,e[6]=(w*b-m*N-v*x)*D,e[7]=(d*N-u*b+p*x)*D,e[8]=(o*j-a*T+c*P)*D,e[9]=(n*T-r*j-i*P)*D,e[10]=(m*C-g*b+v*y)*D,e[11]=(f*b-d*C-p*y)*D,e[12]=(a*V-o*O-l*P)*D,e[13]=(r*O-n*V+s*P)*D,e[14]=(g*x-m*k-w*y)*D,e[15]=(d*k-f*x+u*y)*D,e):null}function ty(e){let t=e[0],r=e[1],n=e[2],s=e[3],i=e[4],o=e[5],a=e[6],l=e[7],c=e[8],d=e[9],f=e[10],u=e[11],p=e[12],m=e[13],g=e[14],w=e[15],v=t*o-r*i,y=t*a-n*i,x=t*l-s*i,b=r*a-n*o,k=r*l-s*o,C=n*l-s*a,N=c*m-d*p,P=c*g-f*p,V=c*w-u*p,T=d*g-f*m,O=d*w-u*m,j=f*w-u*g;return v*j-y*O+x*T+b*V-k*P+C*N}function Dh(e,t,r){let n=t[0],s=t[1],i=t[2],o=t[3],a=t[4],l=t[5],c=t[6],d=t[7],f=t[8],u=t[9],p=t[10],m=t[11],g=t[12],w=t[13],v=t[14],y=t[15],x=r[0],b=r[1],k=r[2],C=r[3];return e[0]=x*n+b*a+k*f+C*g,e[1]=x*s+b*l+k*u+C*w,e[2]=x*i+b*c+k*p+C*v,e[3]=x*o+b*d+k*m+C*y,x=r[4],b=r[5],k=r[6],C=r[7],e[4]=x*n+b*a+k*f+C*g,e[5]=x*s+b*l+k*u+C*w,e[6]=x*i+b*c+k*p+C*v,e[7]=x*o+b*d+k*m+C*y,x=r[8],b=r[9],k=r[10],C=r[11],e[8]=x*n+b*a+k*f+C*g,e[9]=x*s+b*l+k*u+C*w,e[10]=x*i+b*c+k*p+C*v,e[11]=x*o+b*d+k*m+C*y,x=r[12],b=r[13],k=r[14],C=r[15],e[12]=x*n+b*a+k*f+C*g,e[13]=x*s+b*l+k*u+C*w,e[14]=x*i+b*c+k*p+C*v,e[15]=x*o+b*d+k*m+C*y,e}function DS(e,t,r){let n=r[0],s=r[1],i=r[2],o,a,l,c,d,f,u,p,m,g,w,v;return t===e?(e[12]=t[0]*n+t[4]*s+t[8]*i+t[12],e[13]=t[1]*n+t[5]*s+t[9]*i+t[13],e[14]=t[2]*n+t[6]*s+t[10]*i+t[14],e[15]=t[3]*n+t[7]*s+t[11]*i+t[15]):(o=t[0],a=t[1],l=t[2],c=t[3],d=t[4],f=t[5],u=t[6],p=t[7],m=t[8],g=t[9],w=t[10],v=t[11],e[0]=o,e[1]=a,e[2]=l,e[3]=c,e[4]=d,e[5]=f,e[6]=u,e[7]=p,e[8]=m,e[9]=g,e[10]=w,e[11]=v,e[12]=o*n+d*s+m*i+t[12],e[13]=a*n+f*s+g*i+t[13],e[14]=l*n+u*s+w*i+t[14],e[15]=c*n+p*s+v*i+t[15]),e}function RS(e,t,r){let n=r[0],s=r[1],i=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function VS(e,t,r,n){let s=n[0],i=n[1],o=n[2],a=Math.hypot(s,i,o),l,c,d,f,u,p,m,g,w,v,y,x,b,k,C,N,P,V,T,O,j,F,D,G;return Math.abs(a)0?(v=Math.sqrt(w+1)*2,t[3]=.25*v,t[0]=(u-m)/v,t[1]=(p-c)/v,t[2]=(l-d)/v):a>f&&a>g?(v=Math.sqrt(1+a-f-g)*2,t[3]=(u-m)/v,t[0]=.25*v,t[1]=(l+d)/v,t[2]=(p+c)/v):f>g?(v=Math.sqrt(1+f-a-g)*2,t[3]=(p-c)/v,t[0]=(l+d)/v,t[1]=.25*v,t[2]=(u+m)/v):(v=Math.sqrt(1+g-a-f)*2,t[3]=(l-d)/v,t[0]=(p+c)/v,t[1]=(u+m)/v,t[2]=.25*v),t}}();function zS(e,t,r,n){let s=As([e[0],e[1],e[2]]);const i=As([e[4],e[5],e[6]]),o=As([e[8],e[9],e[10]]);ty(e)<0&&(s=-s),r[0]=e[12],r[1]=e[13],r[2]=e[14];const l=e.slice(),c=1/s,d=1/i,f=1/o;l[0]*=c,l[1]*=c,l[2]*=c,l[4]*=d,l[5]*=d,l[6]*=d,l[8]*=f,l[9]*=f,l[10]*=f,ny(t,l),n[0]=s,n[1]=i,n[2]=o}function OS(e,t,r,n){const s=e,i=t[0],o=t[1],a=t[2],l=t[3],c=i+i,d=o+o,f=a+a,u=i*c,p=i*d,m=i*f,g=o*d,w=o*f,v=a*f,y=l*c,x=l*d,b=l*f,k=n[0],C=n[1],N=n[2];return s[0]=(1-(g+v))*k,s[1]=(p+b)*k,s[2]=(m-x)*k,s[3]=0,s[4]=(p-b)*C,s[5]=(1-(u+v))*C,s[6]=(w+y)*C,s[7]=0,s[8]=(m+x)*N,s[9]=(w-y)*N,s[10]=(1-(u+g))*N,s[11]=0,s[12]=r[0],s[13]=r[1],s[14]=r[2],s[15]=1,s}function $S(e,t){let r=t[0],n=t[1],s=t[2],i=t[3],o=r+r,a=n+n,l=s+s,c=r*o,d=n*o,f=n*a,u=s*o,p=s*a,m=s*l,g=i*o,w=i*a,v=i*l;return e[0]=1-f-m,e[1]=d+v,e[2]=u-w,e[3]=0,e[4]=d-v,e[5]=1-c-m,e[6]=p+g,e[7]=0,e[8]=u+w,e[9]=p-g,e[10]=1-c-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function BS(e,t,r,n,s){let i=1/Math.tan(t/2),o=1/(n-s);return e[0]=i/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=(s+n)*o,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*s*n*o,e[15]=0,e}function US(e,t,r,n,s,i,o){let a=1/(t-r),l=1/(n-s),c=1/(i-o);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+r)*a,e[13]=(s+n)*l,e[14]=(o+i)*c,e[15]=1,e}function WS(e,t,r,n){let s=t[0],i=t[1],o=t[2],a=n[0],l=n[1],c=n[2],d=s-r[0],f=i-r[1],u=o-r[2],p=d*d+f*f+u*u;p===0?u=1:(p=1/Math.sqrt(p),d*=p,f*=p,u*=p);let m=l*u-c*f,g=c*d-a*u,w=a*f-l*d;return p=m*m+g*g+w*w,p===0&&(c?a+=1e-6:l?c+=1e-6:l+=1e-6,m=l*u-c*f,g=c*d-a*u,w=a*f-l*d,p=m*m+g*g+w*w),p=1/Math.sqrt(p),m*=p,g*=p,w*=p,e[0]=m,e[1]=g,e[2]=w,e[3]=0,e[4]=f*w-u*g,e[5]=u*m-d*w,e[6]=d*g-f*m,e[7]=0,e[8]=d,e[9]=f,e[10]=u,e[11]=0,e[12]=s,e[13]=i,e[14]=o,e[15]=1,e}function Rh(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e}function Vh(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e}function HS(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e}class Ro extends Array{constructor(t=1,r=0,n=0,s=0,i=0,o=1,a=0,l=0,c=0,d=0,f=1,u=0,p=0,m=0,g=0,w=1){return super(t,r,n,s,i,o,a,l,c,d,f,u,p,m,g,w),this}get x(){return this[12]}get y(){return this[13]}get z(){return this[14]}get w(){return this[15]}set x(t){this[12]=t}set y(t){this[13]=t}set z(t){this[14]=t}set w(t){this[15]=t}set(t,r,n,s,i,o,a,l,c,d,f,u,p,m,g,w){return t.length?this.copy(t):(AS(this,t,r,n,s,i,o,a,l,c,d,f,u,p,m,g,w),this)}translate(t,r=this){return DS(this,r,t),this}rotate(t,r,n=this){return VS(this,n,t,r),this}scale(t,r=this){return RS(this,r,typeof t=="number"?[t,t,t]:t),this}add(t,r){return r?Rh(this,t,r):Rh(this,this,t),this}sub(t,r){return r?Vh(this,t,r):Vh(this,this,t),this}multiply(t,r){return t.length?r?Dh(this,t,r):Dh(this,this,t):HS(this,this,t),this}identity(){return _S(this),this}copy(t){return MS(this,t),this}fromPerspective({fov:t,aspect:r,near:n,far:s}={}){return BS(this,t,r,n,s),this}fromOrthogonal({left:t,right:r,bottom:n,top:s,near:i,far:o}){return US(this,t,r,n,s,i,o),this}fromQuaternion(t){return $S(this,t),this}setPosition(t){return this.x=t[0],this.y=t[1],this.z=t[2],this}inverse(t=this){return LS(this,t),this}compose(t,r,n){return OS(this,t,r,n),this}decompose(t,r,n){return zS(this,t,r,n),this}getRotation(t){return ny(t,this),this}getTranslation(t){return FS(t,this),this}getScaling(t){return ry(t,this),this}getMaxScaleOnAxis(){return IS(this)}lookAt(t,r,n){return WS(this,t,r,n),this}determinant(){return ty(this)}fromArray(t,r=0){return this[0]=t[r],this[1]=t[r+1],this[2]=t[r+2],this[3]=t[r+3],this[4]=t[r+4],this[5]=t[r+5],this[6]=t[r+6],this[7]=t[r+7],this[8]=t[r+8],this[9]=t[r+9],this[10]=t[r+10],this[11]=t[r+11],this[12]=t[r+12],this[13]=t[r+13],this[14]=t[r+14],this[15]=t[r+15],this}toArray(t=[],r=0){return t[r]=this[0],t[r+1]=this[1],t[r+2]=this[2],t[r+3]=this[3],t[r+4]=this[4],t[r+5]=this[5],t[r+6]=this[6],t[r+7]=this[7],t[r+8]=this[8],t[r+9]=this[9],t[r+10]=this[10],t[r+11]=this[11],t[r+12]=this[12],t[r+13]=this[13],t[r+14]=this[14],t[r+15]=this[15],t}}function qS(e,t,r="YXZ"){return r==="XYZ"?(e[1]=Math.asin(Math.min(Math.max(t[8],-1),1)),Math.abs(t[8])<.99999?(e[0]=Math.atan2(-t[9],t[10]),e[2]=Math.atan2(-t[4],t[0])):(e[0]=Math.atan2(t[6],t[5]),e[2]=0)):r==="YXZ"?(e[0]=Math.asin(-Math.min(Math.max(t[9],-1),1)),Math.abs(t[9])<.99999?(e[1]=Math.atan2(t[8],t[10]),e[2]=Math.atan2(t[1],t[5])):(e[1]=Math.atan2(-t[2],t[0]),e[2]=0)):r==="ZXY"?(e[0]=Math.asin(Math.min(Math.max(t[6],-1),1)),Math.abs(t[6])<.99999?(e[1]=Math.atan2(-t[2],t[10]),e[2]=Math.atan2(-t[4],t[5])):(e[1]=0,e[2]=Math.atan2(t[1],t[0]))):r==="ZYX"?(e[1]=Math.asin(-Math.min(Math.max(t[2],-1),1)),Math.abs(t[2])<.99999?(e[0]=Math.atan2(t[6],t[10]),e[2]=Math.atan2(t[1],t[0])):(e[0]=0,e[2]=Math.atan2(-t[4],t[5]))):r==="YZX"?(e[2]=Math.asin(Math.min(Math.max(t[1],-1),1)),Math.abs(t[1])<.99999?(e[0]=Math.atan2(-t[9],t[5]),e[1]=Math.atan2(-t[2],t[0])):(e[0]=0,e[1]=Math.atan2(t[8],t[10]))):r==="XZY"&&(e[2]=Math.asin(-Math.min(Math.max(t[4],-1),1)),Math.abs(t[4])<.99999?(e[0]=Math.atan2(t[6],t[5]),e[1]=Math.atan2(t[8],t[0])):(e[0]=Math.atan2(-t[9],t[10]),e[1]=0)),e}const Fh=new Ro;class GS extends Array{constructor(t=0,r=t,n=t,s="YXZ"){super(t,r,n),this.order=s,this.onChange=()=>{},this._target=this;const i=["0","1","2"];return new Proxy(this,{set(o,a){const l=Reflect.set(...arguments);return l&&i.includes(a)&&o.onChange(),l}})}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(t){this._target[0]=t,this.onChange()}set y(t){this._target[1]=t,this.onChange()}set z(t){this._target[2]=t,this.onChange()}set(t,r=t,n=t){return t.length?this.copy(t):(this._target[0]=t,this._target[1]=r,this._target[2]=n,this.onChange(),this)}copy(t){return this._target[0]=t[0],this._target[1]=t[1],this._target[2]=t[2],this.onChange(),this}reorder(t){return this._target.order=t,this.onChange(),this}fromRotationMatrix(t,r=this.order){return qS(this._target,t,r),this.onChange(),this}fromQuaternion(t,r=this.order,n){return Fh.fromQuaternion(t),this._target.fromRotationMatrix(Fh,r),n||this.onChange(),this}fromArray(t,r=0){return this._target[0]=t[r],this._target[1]=t[r+1],this._target[2]=t[r+2],this}toArray(t=[],r=0){return t[r]=this[0],t[r+1]=this[1],t[r+2]=this[2],t}}class YS{constructor(){this.parent=null,this.children=[],this.visible=!0,this.matrix=new Ro,this.worldMatrix=new Ro,this.matrixAutoUpdate=!0,this.worldMatrixNeedsUpdate=!1,this.position=new vt,this.quaternion=new ES,this.scale=new vt(1),this.rotation=new GS,this.up=new vt(0,1,0),this.rotation._target.onChange=()=>this.quaternion.fromEuler(this.rotation,!0),this.quaternion._target.onChange=()=>this.rotation.fromQuaternion(this.quaternion,void 0,!0)}setParent(t,r=!0){this.parent&&t!==this.parent&&this.parent.removeChild(this,!1),this.parent=t,r&&t&&t.addChild(this,!1)}addChild(t,r=!0){~this.children.indexOf(t)||this.children.push(t),r&&t.setParent(this,!1)}removeChild(t,r=!0){~this.children.indexOf(t)&&this.children.splice(this.children.indexOf(t),1),r&&t.setParent(null,!1)}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.worldMatrixNeedsUpdate||t)&&(this.parent===null?this.worldMatrix.copy(this.matrix):this.worldMatrix.multiply(this.parent.worldMatrix,this.matrix),this.worldMatrixNeedsUpdate=!1,t=!0);for(let r=0,n=this.children.length;rn&&n({mesh:this,camera:t}));let r=this.program.cullFace&&this.worldMatrix.determinant()<0;this.program.use({flipFaces:r}),this.geometry.draw({mode:this.mode,program:this.program}),this.afterRenderCallbacks.forEach(n=>n&&n({mesh:this,camera:t}))}}function lk(e,t){return e[0]=t[0],e[1]=t[1],e}function uk(e,t,r){return e[0]=t,e[1]=r,e}function zh(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e}function Oh(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e}function ck(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e}function dk(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e}function nl(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e}function fk(e,t){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}function hk(e,t){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n}function $h(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)}function pk(e){var t=e[0],r=e[1];return t*t+r*r}function mk(e,t){return e[0]=-t[0],e[1]=-t[1],e}function gk(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}function yk(e,t){var r=t[0],n=t[1],s=r*r+n*n;return s>0&&(s=1/Math.sqrt(s)),e[0]=t[0]*s,e[1]=t[1]*s,e}function vk(e,t){return e[0]*t[0]+e[1]*t[1]}function Bh(e,t){return e[0]*t[1]-e[1]*t[0]}function xk(e,t,r,n){var s=t[0],i=t[1];return e[0]=s+n*(r[0]-s),e[1]=i+n*(r[1]-i),e}function wk(e,t,r,n,s){const i=Math.exp(-n*s);let o=t[0],a=t[1];return e[0]=r[0]+(o-r[0])*i,e[1]=r[1]+(a-r[1])*i,e}function bk(e,t,r){var n=t[0],s=t[1];return e[0]=r[0]*n+r[3]*s+r[6],e[1]=r[1]*n+r[4]*s+r[7],e}function Sk(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[4]*s+r[12],e[1]=r[1]*n+r[5]*s+r[13],e}function kk(e,t){return e[0]===t[0]&&e[1]===t[1]}class Bc extends Array{constructor(t=0,r=t){return super(t,r),this}get x(){return this[0]}get y(){return this[1]}set x(t){this[0]=t}set y(t){this[1]=t}set(t,r=t){return t.length?this.copy(t):(uk(this,t,r),this)}copy(t){return lk(this,t),this}add(t,r){return r?zh(this,t,r):zh(this,this,t),this}sub(t,r){return r?Oh(this,t,r):Oh(this,this,t),this}multiply(t){return t.length?ck(this,this,t):nl(this,this,t),this}divide(t){return t.length?dk(this,this,t):nl(this,this,1/t),this}inverse(t=this){return gk(this,t),this}len(){return $h(this)}distance(t){return t?fk(this,t):$h(this)}squaredLen(){return this.squaredDistance()}squaredDistance(t){return t?hk(this,t):pk(this)}negate(t=this){return mk(this,t),this}cross(t,r){return r?Bh(t,r):Bh(this,t)}scale(t){return nl(this,this,t),this}normalize(){return yk(this,this),this}dot(t){return vk(this,t)}equals(t){return kk(this,t)}applyMatrix3(t){return bk(this,this,t),this}applyMatrix4(t){return Sk(this,this,t),this}lerp(t,r){return xk(this,this,t,r),this}smoothLerp(t,r,n){return wk(this,this,t,r,n),this}clone(){return new Bc(this[0],this[1])}fromArray(t,r=0){return this[0]=t[r],this[1]=t[r+1],this}toArray(t=[],r=0){return t[r]=this[0],t[r+1]=this[1],t}}class jk extends rS{constructor(t,{attributes:r={}}={}){Object.assign(r,{position:{size:2,data:new Float32Array([-1,-1,3,-1,-1,3])},uv:{size:2,data:new Float32Array([0,0,2,0,0,2])}}),super(t,r)}}const Ck=` attribute vec2 position; void main(){gl_Position=vec4(position,0.0,1.0);} `,Nk=` #ifdef GL_ES precision lowp float; #endif uniform vec2 uResolution; uniform float uTime; uniform float uHueShift; uniform float uNoise; uniform float uScan; uniform float uScanFreq; uniform float uWarp; #define iTime uTime #define iResolution uResolution vec4 buf[8]; float rand(vec2 c){return fract(sin(dot(c,vec2(12.9898,78.233)))*43758.5453);} mat3 rgb2yiq=mat3(0.299,0.587,0.114,0.596,-0.274,-0.322,0.211,-0.523,0.312); mat3 yiq2rgb=mat3(1.0,0.956,0.621,1.0,-0.272,-0.647,1.0,-1.106,1.703); vec3 hueShiftRGB(vec3 col,float deg){ vec3 yiq=rgb2yiq*col; float rad=radians(deg); float cosh=cos(rad),sinh=sin(rad); vec3 yiqShift=vec3(yiq.x,yiq.y*cosh-yiq.z*sinh,yiq.y*sinh+yiq.z*cosh); return clamp(yiq2rgb*yiqShift,0.0,1.0); } vec4 sigmoid(vec4 x){return 1./(1.+exp(-x));} vec4 cppn_fn(vec2 coordinate,float in0,float in1,float in2){ buf[6]=vec4(coordinate.x,coordinate.y,0.3948333106474662+in0,0.36+in1); buf[7]=vec4(0.14+in2,sqrt(coordinate.x*coordinate.x+coordinate.y*coordinate.y),0.,0.); buf[0]=mat4(vec4(6.5404263,-3.6126034,0.7590882,-1.13613),vec4(2.4582713,3.1660357,1.2219609,0.06276096),vec4(-5.478085,-6.159632,1.8701609,-4.7742867),vec4(6.039214,-5.542865,-0.90925294,3.251348))*buf[6]+mat4(vec4(0.8473259,-5.722911,3.975766,1.6522468),vec4(-0.24321538,0.5839259,-1.7661959,-5.350116),vec4(0.,0.,0.,0.),vec4(0.,0.,0.,0.))*buf[7]+vec4(0.21808943,1.1243913,-1.7969975,5.0294676); buf[1]=mat4(vec4(-3.3522482,-6.0612736,0.55641043,-4.4719114),vec4(0.8631464,1.7432913,5.643898,1.6106541),vec4(2.4941394,-3.5012043,1.7184316,6.357333),vec4(3.310376,8.209261,1.1355612,-1.165539))*buf[6]+mat4(vec4(5.24046,-13.034365,0.009859298,15.870829),vec4(2.987511,3.129433,-0.89023495,-1.6822904),vec4(0.,0.,0.,0.),vec4(0.,0.,0.,0.))*buf[7]+vec4(-5.9457836,-6.573602,-0.8812491,1.5436668); buf[0]=sigmoid(buf[0]);buf[1]=sigmoid(buf[1]); buf[2]=mat4(vec4(-15.219568,8.095543,-2.429353,-1.9381982),vec4(-5.951362,4.3115187,2.6393783,1.274315),vec4(-7.3145227,6.7297835,5.2473326,5.9411426),vec4(5.0796127,8.979051,-1.7278991,-1.158976))*buf[6]+mat4(vec4(-11.967154,-11.608155,6.1486754,11.237008),vec4(2.124141,-6.263192,-1.7050359,-0.7021966),vec4(0.,0.,0.,0.),vec4(0.,0.,0.,0.))*buf[7]+vec4(-4.17164,-3.2281182,-4.576417,-3.6401186); buf[3]=mat4(vec4(3.1832156,-13.738922,1.879223,3.233465),vec4(0.64300746,12.768129,1.9141049,0.50990224),vec4(-0.049295485,4.4807224,1.4733979,1.801449),vec4(5.0039253,13.000481,3.3991797,-4.5561905))*buf[6]+mat4(vec4(-0.1285731,7.720628,-3.1425676,4.742367),vec4(0.6393625,3.714393,-0.8108378,-0.39174938),vec4(0.,0.,0.,0.),vec4(0.,0.,0.,0.))*buf[7]+vec4(-1.1811101,-21.621881,0.7851888,1.2329718); buf[2]=sigmoid(buf[2]);buf[3]=sigmoid(buf[3]); buf[4]=mat4(vec4(5.214916,-7.183024,2.7228765,2.6592617),vec4(-5.601878,-25.3591,4.067988,0.4602802),vec4(-10.57759,24.286327,21.102104,37.546658),vec4(4.3024497,-1.9625226,2.3458803,-1.372816))*buf[0]+mat4(vec4(-17.6526,-10.507558,2.2587414,12.462782),vec4(6.265566,-502.75443,-12.642513,0.9112289),vec4(-10.983244,20.741234,-9.701768,-0.7635988),vec4(5.383626,1.4819539,-4.1911616,-4.8444734))*buf[1]+mat4(vec4(12.785233,-16.345072,-0.39901125,1.7955981),vec4(-30.48365,-1.8345358,1.4542528,-1.1118771),vec4(19.872723,-7.337935,-42.941723,-98.52709),vec4(8.337645,-2.7312303,-2.2927687,-36.142323))*buf[2]+mat4(vec4(-16.298317,3.5471997,-0.44300047,-9.444417),vec4(57.5077,-35.609753,16.163465,-4.1534753),vec4(-0.07470326,-3.8656476,-7.0901804,3.1523974),vec4(-12.559385,-7.077619,1.490437,-0.8211543))*buf[3]+vec4(-7.67914,15.927437,1.3207729,-1.6686112); buf[5]=mat4(vec4(-1.4109162,-0.372762,-3.770383,-21.367174),vec4(-6.2103205,-9.35908,0.92529047,8.82561),vec4(11.460242,-22.348068,13.625772,-18.693201),vec4(-0.3429052,-3.9905605,-2.4626114,-0.45033523))*buf[0]+mat4(vec4(7.3481627,-4.3661838,-6.3037653,-3.868115),vec4(1.5462853,6.5488915,1.9701879,-0.58291394),vec4(6.5858274,-2.2180402,3.7127688,-1.3730392),vec4(-5.7973905,10.134961,-2.3395722,-5.965605))*buf[1]+mat4(vec4(-2.5132585,-6.6685553,-1.4029363,-0.16285264),vec4(-0.37908727,0.53738135,4.389061,-1.3024765),vec4(-0.70647055,2.0111287,-5.1659346,-3.728635),vec4(-13.562562,10.487719,-0.9173751,-2.6487076))*buf[2]+mat4(vec4(-8.645013,6.5546675,-6.3944063,-5.5933375),vec4(-0.57783127,-1.077275,36.91025,5.736769),vec4(14.283112,3.7146652,7.1452246,-4.5958776),vec4(2.7192075,3.6021907,-4.366337,-2.3653464))*buf[3]+vec4(-5.9000807,-4.329569,1.2427121,8.59503); buf[4]=sigmoid(buf[4]);buf[5]=sigmoid(buf[5]); buf[6]=mat4(vec4(-1.61102,0.7970257,1.4675229,0.20917463),vec4(-28.793737,-7.1390953,1.5025433,4.656581),vec4(-10.94861,39.66238,0.74318546,-10.095605),vec4(-0.7229728,-1.5483948,0.7301322,2.1687684))*buf[0]+mat4(vec4(3.2547753,21.489103,-1.0194173,-3.3100595),vec4(-3.7316632,-3.3792162,-7.223193,-0.23685838),vec4(13.1804495,0.7916005,5.338587,5.687114),vec4(-4.167605,-17.798311,-6.815736,-1.6451967))*buf[1]+mat4(vec4(0.604885,-7.800309,-7.213122,-2.741014),vec4(-3.522382,-0.12359311,-0.5258442,0.43852118),vec4(9.6752825,-22.853785,2.062431,0.099892326),vec4(-4.3196306,-17.730087,2.5184598,5.30267))*buf[2]+mat4(vec4(-6.545563,-15.790176,-6.0438633,-5.415399),vec4(-43.591583,28.551912,-16.00161,18.84728),vec4(4.212382,8.394307,3.0958717,8.657522),vec4(-5.0237565,-4.450633,-4.4768,-5.5010443))*buf[3]+mat4(vec4(1.6985557,-67.05806,6.897715,1.9004834),vec4(1.8680354,2.3915145,2.5231109,4.081538),vec4(11.158006,1.7294737,2.0738268,7.386411),vec4(-4.256034,-306.24686,8.258898,-17.132736))*buf[4]+mat4(vec4(1.6889864,-4.5852966,3.8534803,-6.3482175),vec4(1.3543309,-1.2640043,9.932754,2.9079645),vec4(-5.2770967,0.07150358,-0.13962056,3.3269649),vec4(28.34703,-4.918278,6.1044083,4.085355))*buf[5]+vec4(6.6818056,12.522166,-3.7075126,-4.104386); buf[7]=mat4(vec4(-8.265602,-4.7027016,5.098234,0.7509808),vec4(8.6507845,-17.15949,16.51939,-8.884479),vec4(-4.036479,-2.3946867,-2.6055532,-1.9866527),vec4(-2.2167742,-1.8135649,-5.9759874,4.8846445))*buf[0]+mat4(vec4(6.7790847,3.5076547,-2.8191125,-2.7028968),vec4(-5.743024,-0.27844876,1.4958696,-5.0517144),vec4(13.122226,15.735168,-2.9397483,-4.101023),vec4(-14.375265,-5.030483,-6.2599335,2.9848232))*buf[1]+mat4(vec4(4.0950394,-0.94011575,-5.674733,4.755022),vec4(4.3809423,4.8310084,1.7425908,-3.437416),vec4(2.117492,0.16342592,-104.56341,16.949184),vec4(-5.22543,-2.994248,3.8350096,-1.9364246))*buf[2]+mat4(vec4(-5.900337,1.7946124,-13.604192,-3.8060522),vec4(6.6583457,31.911177,25.164474,91.81147),vec4(11.840538,4.1503043,-0.7314397,6.768467),vec4(-6.3967767,4.034772,6.1714606,-0.32874924))*buf[3]+mat4(vec4(3.4992442,-196.91893,-8.923708,2.8142626),vec4(3.4806502,-3.1846354,5.1725626,5.1804223),vec4(-2.4009497,15.585794,1.2863957,2.0252278),vec4(-71.25271,-62.441242,-8.138444,0.50670296))*buf[4]+mat4(vec4(-12.291733,-11.176166,-7.3474145,4.390294),vec4(10.805477,5.6337385,-0.9385842,-4.7348723),vec4(-12.869276,-7.039391,5.3029537,7.5436664),vec4(1.4593618,8.91898,3.5101583,5.840625))*buf[5]+vec4(2.2415268,-6.705987,-0.98861027,-2.117676); buf[6]=sigmoid(buf[6]);buf[7]=sigmoid(buf[7]); buf[0]=mat4(vec4(1.6794263,1.3817469,2.9625452,0.),vec4(-1.8834411,-1.4806935,-3.5924516,0.),vec4(-1.3279216,-1.0918057,-2.3124623,0.),vec4(0.2662234,0.23235129,0.44178495,0.))*buf[0]+mat4(vec4(-0.6299101,-0.5945583,-0.9125601,0.),vec4(0.17828953,0.18300213,0.18182953,0.),vec4(-2.96544,-2.5819945,-4.9001055,0.),vec4(1.4195864,1.1868085,2.5176322,0.))*buf[1]+mat4(vec4(-1.2584374,-1.0552157,-2.1688404,0.),vec4(-0.7200217,-0.52666044,-1.438251,0.),vec4(0.15345335,0.15196142,0.272854,0.),vec4(0.945728,0.8861938,1.2766753,0.))*buf[2]+mat4(vec4(-2.4218085,-1.968602,-4.35166,0.),vec4(-22.683098,-18.0544,-41.954372,0.),vec4(0.63792,0.5470648,1.1078634,0.),vec4(-1.5489894,-1.3075932,-2.6444845,0.))*buf[3]+mat4(vec4(-0.49252132,-0.39877754,-0.91366625,0.),vec4(0.95609266,0.7923952,1.640221,0.),vec4(0.30616966,0.15693925,0.8639857,0.),vec4(1.1825981,0.94504964,2.176963,0.))*buf[4]+mat4(vec4(0.35446745,0.3293795,0.59547555,0.),vec4(-0.58784515,-0.48177817,-1.0614829,0.),vec4(2.5271258,1.9991658,4.6846647,0.),vec4(0.13042648,0.08864098,0.30187556,0.))*buf[5]+mat4(vec4(-1.7718065,-1.4033192,-3.3355875,0.),vec4(3.1664357,2.638297,5.378702,0.),vec4(-3.1724713,-2.6107926,-5.549295,0.),vec4(-2.851368,-2.249092,-5.3013067,0.))*buf[6]+mat4(vec4(1.5203838,1.2212278,2.8404984,0.),vec4(1.5210563,1.2651345,2.683903,0.),vec4(2.9789467,2.4364579,5.2347264,0.),vec4(2.2270417,1.8825914,3.8028636,0.))*buf[7]+vec4(-1.5468478,-3.6171484,0.24762098,0.); buf[0]=sigmoid(buf[0]); return vec4(buf[0].x,buf[0].y,buf[0].z,1.); } void mainImage(out vec4 fragColor,in vec2 fragCoord){ vec2 uv=fragCoord/uResolution.xy*2.-1.; uv.y*=-1.; uv+=uWarp*vec2(sin(uv.y*6.283+uTime*0.5),cos(uv.x*6.283+uTime*0.5))*0.05; fragColor=cppn_fn(uv,0.1*sin(0.3*uTime),0.1*sin(0.69*uTime),0.1*sin(0.44*uTime)); } void main(){ vec4 col;mainImage(col,gl_FragCoord.xy); col.rgb=hueShiftRGB(col.rgb,uHueShift); float scanline_val=sin(gl_FragCoord.y*uScanFreq)*0.5+0.5; col.rgb*=1.-(scanline_val*scanline_val)*uScan; col.rgb+=(rand(gl_FragCoord.xy+uTime)-0.5)*uNoise; gl_FragColor=vec4(clamp(col.rgb,0.0,1.0),1.0); } `;class Pk extends S.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,r){console.error("ErrorBoundary caught an error:",t,r)}render(){return this.state.hasError?this.props.fallback||h.jsx("div",{style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",background:"radial-gradient(circle at center, rgba(0,0,0,0.8) 0%, rgba(0,0,0,1) 100%)",zIndex:-1,pointerEvents:"none"}}):this.props.children}}function Ek({hueShift:e=60,noiseIntensity:t=.03,scanlineIntensity:r=.08,speed:n=.4,scanlineFrequency:s=.6,warpAmount:i=.15,resolutionScale:o=1}){const a=S.useRef(null);return S.useEffect(()=>{const l=a.current;if(!l){console.error("DarkVeil: Canvas not found");return}let c,d,f;try{c=new uS({dpr:Math.min(window.devicePixelRatio,2),canvas:l});const w=c.gl;if(!w){console.error("DarkVeil: WebGL context not available");return}const v=new jk(w);d=new sS(w,{vertex:Ck,fragment:Nk,uniforms:{uTime:{value:0},uResolution:{value:new Bc},uHueShift:{value:e},uNoise:{value:t},uScan:{value:r},uScanFreq:{value:s},uWarp:{value:i}}}),f=new ak(w,{geometry:v,program:d}),console.log("DarkVeil: Successfully initialized")}catch(w){console.error("DarkVeil: Initialization error:",w);return}const u=()=>{const w=window.innerWidth,v=window.innerHeight;c.setSize(w*o,v*o),d.uniforms.uResolution.value.set(w,v)};window.addEventListener("resize",u),u();const p=performance.now();let m=0;const g=()=>{d.uniforms.uTime.value=(performance.now()-p)/1e3*n,d.uniforms.uHueShift.value=e,d.uniforms.uNoise.value=t,d.uniforms.uScan.value=r,d.uniforms.uScanFreq.value=s,d.uniforms.uWarp.value=i,c.render({scene:f}),m=requestAnimationFrame(g)};return g(),()=>{cancelAnimationFrame(m),window.removeEventListener("resize",u)}},[e,t,r,n,s,i,o]),h.jsxs(h.Fragment,{children:[h.jsx("div",{style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",background:"radial-gradient(circle at center, rgba(50,20,80,0.8) 0%, rgba(20,10,40,0.9) 50%, rgba(0,0,0,1) 100%)",zIndex:-10,pointerEvents:"none"}}),h.jsx("canvas",{ref:a,style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",zIndex:-5,pointerEvents:"none",display:"block"}})]})}function _s(e){return h.jsx(Pk,{children:h.jsx(Ek,{...e})})}/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var Tk={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.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mk=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Z=(e,t)=>{const r=S.forwardRef(({color:n="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:a="",children:l,...c},d)=>S.createElement("svg",{ref:d,...Tk,width:s,height:s,stroke:n,strokeWidth:o?Number(i)*24/Number(s):i,className:["lucide",`lucide-${Mk(e)}`,a].join(" "),...c},[...t.map(([f,u])=>S.createElement(f,u)),...Array.isArray(l)?l:[l]]));return r.displayName=`${e}`,r};/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ak=Z("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _k=Z("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lk=Z("Award",[["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}],["path",{d:"M15.477 12.89 17 22l-5-3-5 3 1.523-9.11",key:"em7aur"}]]);/** * @license lucide-react v0.294.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=Z("Calendar",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",ry:"2",key:"eu3xkr"}],["line",{x1:"16",x2:"16",y1:"2",y2:"6",key:"m3sa8f"}],["line",{x1:"8",x2:"8",y1:"2",y2:"6",key:"18kwsl"}],["line",{x1:"3",x2:"21",y1:"10",y2:"10",key:"xt86sb"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dk=Z("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.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rk=Z("CheckCircle",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vk=Z("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fk=Z("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Un=Z("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iy=Z("ExternalLink",[["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}],["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["line",{x1:"10",x2:"21",y1:"14",y2:"3",key:"18c3s4"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const et=Z("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.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ik=Z("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uh=Z("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.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zk=Z("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ok=Z("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ke=Z("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $k=Z("Pause",[["rect",{width:"4",height:"16",x:"6",y:"4",key:"iffhe4"}],["rect",{width:"4",height:"16",x:"14",y:"4",key:"sjin7j"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oy=Z("PlayCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wh=Z("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uc=Z("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hh=Z("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.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nr=Z("Sparkles",[["path",{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z",key:"17u4zn"}],["path",{d:"M5 3v4",key:"bklmnn"}],["path",{d:"M19 17v4",key:"iiml17"}],["path",{d:"M3 5h4",key:"nem4j1"}],["path",{d:"M17 19h4",key:"lbex7p"}]]);/** * @license lucide-react v0.294.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=Z("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bk=Z("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ly=Z("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uy=Z("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.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ls=Z("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.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wc=Z("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.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uk=Z("Volume2",[["polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5",key:"16drj5"}],["path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",key:"ltjumu"}],["path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",key:"1kegas"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wk=Z("Wand2",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72Z",key:"1bcowg"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hk=Z("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.294.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=Z("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** * @license lucide-react v0.294.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qk=Z("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]);function cy(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t{const t=Xk(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const a=o.split(Hc);return a[0]===""&&a.length!==1&&a.shift(),dy(a,t)||Kk(o)},getConflictingClassGroupIds:(o,a)=>{const l=r[o]||[];return a&&n[o]?[...l,...n[o]]:l}}},dy=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),s=n?dy(e.slice(1),n):void 0;if(s)return s;if(t.validators.length===0)return;const i=e.join(Hc);return(o=t.validators.find(({validator:a})=>a(i)))==null?void 0:o.classGroupId},Gh=/^\[(.+)\]$/,Kk=e=>{if(Gh.test(e)){const t=Gh.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},Xk=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return Zk(Object.entries(e.classGroups),r).forEach(([i,o])=>{xu(o,n,i,t)}),n},xu=(e,t,r,n)=>{e.forEach(s=>{if(typeof s=="string"){const i=s===""?t:Yh(t,s);i.classGroupId=r;return}if(typeof s=="function"){if(Qk(s)){xu(s(n),t,r,n);return}t.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([i,o])=>{xu(o,Yh(t,i),r,n)})})},Yh=(e,t)=>{let r=e;return t.split(Hc).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},Qk=e=>e.isThemeGetter,Zk=(e,t)=>t?e.map(([r,n])=>{const s=n.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,a])=>[t+o,a])):i);return[r,s]}):e,Jk=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const s=(i,o)=>{r.set(i,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=n.get(i))!==void 0)return s(i,o),o},set(i,o){r.has(i)?r.set(i,o):s(i,o)}}},fy="!",ej=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,s=t[0],i=t.length,o=a=>{const l=[];let c=0,d=0,f;for(let w=0;wd?f-d:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}};return r?a=>r({className:a,parseClassName:o}):o},tj=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},rj=e=>({cache:Jk(e.cacheSize),parseClassName:ej(e),...Yk(e)}),nj=/\s+/,sj=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s}=t,i=[],o=e.trim().split(nj);let a="";for(let l=o.length-1;l>=0;l-=1){const c=o[l],{modifiers:d,hasImportantModifier:f,baseClassName:u,maybePostfixModifierPosition:p}=r(c);let m=!!p,g=n(m?u.substring(0,p):u);if(!g){if(!m){a=c+(a.length>0?" "+a:a);continue}if(g=n(u),!g){a=c+(a.length>0?" "+a:a);continue}m=!1}const w=tj(d).join(":"),v=f?w+fy:w,y=v+g;if(i.includes(y))continue;i.push(y);const x=s(g,m);for(let b=0;b0?" "+a:a)}return a};function ij(){let e=0,t,r,n="";for(;e{if(typeof e=="string")return e;let t,r="";for(let n=0;nf(d),e());return r=rj(c),n=r.cache.get,s=r.cache.set,i=a,a(l)}function a(l){const c=n(l);if(c)return c;const d=sj(l,r);return s(l,d),d}return function(){return i(ij.apply(null,arguments))}}const se=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},py=/^\[(?:([a-z-]+):)?(.+)\]$/i,aj=/^\d+\/\d+$/,lj=new Set(["px","full","screen"]),uj=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,cj=/\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$/,dj=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,fj=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hj=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Rt=e=>An(e)||lj.has(e)||aj.test(e),er=e=>Xn(e,"length",bj),An=e=>!!e&&!Number.isNaN(Number(e)),sl=e=>Xn(e,"number",An),cs=e=>!!e&&Number.isInteger(Number(e)),pj=e=>e.endsWith("%")&&An(e.slice(0,-1)),Y=e=>py.test(e),tr=e=>uj.test(e),mj=new Set(["length","size","percentage"]),gj=e=>Xn(e,mj,my),yj=e=>Xn(e,"position",my),vj=new Set(["image","url"]),xj=e=>Xn(e,vj,kj),wj=e=>Xn(e,"",Sj),ds=()=>!0,Xn=(e,t,r)=>{const n=py.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},bj=e=>cj.test(e)&&!dj.test(e),my=()=>!1,Sj=e=>fj.test(e),kj=e=>hj.test(e),jj=()=>{const e=se("colors"),t=se("spacing"),r=se("blur"),n=se("brightness"),s=se("borderColor"),i=se("borderRadius"),o=se("borderSpacing"),a=se("borderWidth"),l=se("contrast"),c=se("grayscale"),d=se("hueRotate"),f=se("invert"),u=se("gap"),p=se("gradientColorStops"),m=se("gradientColorStopPositions"),g=se("inset"),w=se("margin"),v=se("opacity"),y=se("padding"),x=se("saturate"),b=se("scale"),k=se("sepia"),C=se("skew"),N=se("space"),P=se("translate"),V=()=>["auto","contain","none"],T=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto",Y,t],j=()=>[Y,t],F=()=>["",Rt,er],D=()=>["auto",An,Y],G=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],M=()=>["solid","dashed","dotted","double","none"],W=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],A=()=>["","0",Y],I=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>[An,Y];return{cacheSize:500,separator:":",theme:{colors:[ds],spacing:[Rt,er],blur:["none","",tr,Y],brightness:R(),borderColor:[e],borderRadius:["none","","full",tr,Y],borderSpacing:j(),borderWidth:F(),contrast:R(),grayscale:A(),hueRotate:R(),invert:A(),gap:j(),gradientColorStops:[e],gradientColorStopPositions:[pj,er],inset:O(),margin:O(),opacity:R(),padding:j(),saturate:R(),scale:R(),sepia:A(),skew:R(),space:j(),translate:j()},classGroups:{aspect:[{aspect:["auto","square","video",Y]}],container:["container"],columns:[{columns:[tr]}],"break-after":[{"break-after":I()}],"break-before":[{"break-before":I()}],"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:[...G(),Y]}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:V()}],"overscroll-x":[{"overscroll-x":V()}],"overscroll-y":[{"overscroll-y":V()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",cs,Y]}],basis:[{basis:O()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Y]}],grow:[{grow:A()}],shrink:[{shrink:A()}],order:[{order:["first","last","none",cs,Y]}],"grid-cols":[{"grid-cols":[ds]}],"col-start-end":[{col:["auto",{span:["full",cs,Y]},Y]}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":[ds]}],"row-start-end":[{row:["auto",{span:[cs,Y]},Y]}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Y]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Y]}],gap:[{gap:[u]}],"gap-x":[{"gap-x":[u]}],"gap-y":[{"gap-y":[u]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[N]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[N]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Y,t]}],"min-w":[{"min-w":[Y,t,"min","max","fit"]}],"max-w":[{"max-w":[Y,t,"none","full","min","max","fit","prose",{screen:[tr]},tr]}],h:[{h:[Y,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Y,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Y,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Y,t,"auto","min","max","fit"]}],"font-size":[{text:["base",tr,er]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",sl]}],"font-family":[{font:[ds]}],"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",Y]}],"line-clamp":[{"line-clamp":["none",An,sl]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Rt,Y]}],"list-image":[{"list-image":["none",Y]}],"list-style-type":[{list:["none","disc","decimal",Y]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...M(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Rt,er]}],"underline-offset":[{"underline-offset":["auto",Rt,Y]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Y]}],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",Y]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...G(),yj]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",gj]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},xj]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"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":[v]}],"border-style":[{border:[...M(),"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":[v]}],"divide-style":[{divide:M()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...M()]}],"outline-offset":[{"outline-offset":[Rt,Y]}],"outline-w":[{outline:[Rt,er]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[Rt,er]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",tr,wj]}],"shadow-color":[{shadow:[ds]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":[...W(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":W()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",tr,Y]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[x]}],sepia:[{sepia:[k]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[k]}],"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",Y]}],duration:[{duration:R()}],ease:[{ease:["linear","in","out","in-out",Y]}],delay:[{delay:R()}],animate:[{animate:["none","spin","ping","pulse","bounce",Y]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[cs,Y]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Y]}],accent:[{accent:["auto",e]}],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",Y]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"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",Y]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Rt,er,sl]}],stroke:[{stroke:[e,"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"]}}},Cj=oj(jj);function Kh(...e){return Cj(Gk(e))}function Ds(e){const t=Math.floor(e/6e4),r=Math.floor(e%6e4/1e3);return`${t}:${r.toString().padStart(2,"0")}`}function _n(e){const t=new Date(e),n=(new Date().getTime()-t.getTime())/(1e3*60*60);return n<1?`${Math.floor(n*60)}m ago`:n<24?`${Math.floor(n)}h ago`:`${Math.floor(n/24)}d ago`}const Nj=()=>{var j,F,D,G,M,W,_,A,I,R;const[e,t]=S.useState(!1),[r,n]=S.useState(!1),[s,i]=S.useState({x:0,y:0}),[o,a]=S.useState(!1),[l,c]=S.useState({x:0,y:0}),{currentUser:d,partnerUser:f,logout:u,theme:p,setTheme:m,setPartnerUser:g}=oe(),[w,v]=S.useState(""),[y,x]=S.useState(!1),[b,k]=S.useState(!1),C=_r(),N=[{name:"Dashboard",href:"/",icon:et},{name:"Last Listened",href:"/last-listened",icon:Ke},{name:"Mixed Playlist",href:"/mixed-playlist",icon:oy},{name:"Memory Lane",href:"/memory-lane",icon:Nr},{name:"Wrapped",href:"/wrapped",icon:Lk}],P=()=>{u(),localStorage.removeItem("spotify-user"),localStorage.removeItem("spotify-partner")},V=async()=>{var E,H;if(!(!((E=d==null?void 0:d.user)!=null&&E.id)||!((H=f==null?void 0:f.user)!=null&&H.id))&&confirm(`Are you sure you want to remove ${f.user.display_name} as your partner?`)){k(!0);try{await Et("/partners/remove",{partnerId:f.user.id})}catch(X){try{await Et("/partners/clear",{userId:d.user.id})}catch(ee){console.error("Failed to remove partner:",X,ee)}}finally{g(null),localStorage.removeItem("spotify-partner"),k(!1)}}},T=en(p);S.useEffect(()=>{en(p)},[p]),S.useEffect(()=>{if(r){const E=Math.min(600,window.innerWidth-40),H=Math.min(window.innerHeight*.9,800),X=(window.innerWidth-E)/2,ee=(window.innerHeight-H)/2;i({x:X,y:ee})}},[r]),S.useEffect(()=>{const E=X=>{o&&i({x:X.clientX-l.x,y:X.clientY-l.y})},H=()=>{a(!1)};return o&&(document.addEventListener("mousemove",E),document.addEventListener("mouseup",H)),()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",H)}},[o,l]);const O=E=>{a(!0),c({x:E.clientX-s.x,y:E.clientY-s.y})};return h.jsxs(z.nav,{initial:{y:-100,opacity:0},animate:{y:0,opacity:1},className:"sticky top-0 z-50",style:{background:"rgba(0, 0, 0, 0.8)",backdropFilter:"blur(20px)",borderBottom:"1px solid rgba(255, 255, 255, 0.05)"},children:[h.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[h.jsxs("div",{className:"flex justify-between items-center h-16",children:[h.jsxs(Xi,{to:"/",className:"flex items-center space-x-2",children:[h.jsx(z.div,{whileHover:{scale:1.1,rotate:5},className:"w-8 h-8 rounded-full flex items-center justify-center",style:{background:`linear-gradient(135deg, ${((j=T.cssVars)==null?void 0:j.primary)||"#1db954"} 0%, ${((F=T.cssVars)==null?void 0:F.secondary)||"#1ed760"} 100%)`},children:h.jsx(et,{className:"w-5 h-5 text-white"})}),h.jsx("span",{className:"text-xl font-bold gradient-text",children:"Our Musical Journey"})]}),h.jsx("div",{className:"hidden md:flex items-center space-x-1",children:N.map(E=>{var X,ee,q,me;const H=C.pathname===E.href;return h.jsxs(Xi,{to:E.href,className:Kh("flex items-center space-x-2 px-4 py-2 rounded-xl transition-all duration-300",H?"text-white":"text-white/60 hover:text-white hover:bg-white/5"),style:H?{background:`linear-gradient(135deg, ${((X=T.cssVars)==null?void 0:X.primary)||"#1db954"}15 0%, ${((ee=T.cssVars)==null?void 0:ee.secondary)||"#1ed760"}10 100%)`,border:`1px solid ${((q=T.cssVars)==null?void 0:q.primary)||"#1db954"}30`}:{},children:[h.jsx(E.icon,{className:"w-4 h-4",style:{color:H?(me=T.cssVars)==null?void 0:me.primary:void 0}}),h.jsx("span",{className:"font-medium",children:E.name})]},E.name)})}),h.jsxs("div",{className:"hidden md:flex items-center space-x-4",children:[!f&&h.jsxs("div",{className:"flex items-center space-x-2",children:[h.jsx("input",{value:w,onChange:E=>v(E.target.value),placeholder:"Partner Spotify ID",className:"bg-white/10 text-white text-sm px-2 py-1 rounded"}),h.jsx("button",{disabled:y||!w,onClick:async()=>{var E;if(!(!((E=d==null?void 0:d.user)!=null&&E.id)||!w)){x(!0);try{await Et("/partners/request",{toUid:w})}finally{x(!1)}}},className:`${T.primary} ${T.hover} text-white px-3 py-1 rounded text-sm disabled:opacity-50`,children:y?"Sending...":"Send Request"})]}),f&&h.jsxs(z.div,{initial:{scale:0},animate:{scale:1},className:"flex items-center space-x-2 text-sm text-white/70",children:[h.jsx(Ls,{className:"w-4 h-4"}),h.jsxs("span",{children:["+ ",(D=f.user)==null?void 0:D.display_name]})]}),h.jsxs(z.button,{whileHover:{scale:1.05},whileTap:{scale:.95},onClick:()=>n(!0),className:"flex items-center space-x-2 px-3 py-2 rounded-xl text-white/60 hover:text-white transition-all duration-300",style:{color:(G=T.cssVars)==null?void 0:G.primary},onMouseEnter:E=>{E.currentTarget.style.background="rgba(255, 255, 255, 0.05)"},onMouseLeave:E=>{E.currentTarget.style.background="transparent"},children:[h.jsx(Hh,{className:"w-4 h-4"}),h.jsx("span",{className:"hidden lg:block",children:"Settings"})]}),h.jsxs(z.button,{whileHover:{scale:1.05},whileTap:{scale:.95},onClick:P,className:"flex items-center space-x-2 px-3 py-2 rounded-xl text-white/60 hover:text-white transition-all duration-300",onMouseEnter:E=>{E.currentTarget.style.background="rgba(239, 68, 68, 0.1)"},onMouseLeave:E=>{E.currentTarget.style.background="transparent"},children:[h.jsx(Uh,{className:"w-4 h-4"}),h.jsx("span",{className:"hidden lg:block",children:"Logout"})]})]}),h.jsx("button",{onClick:()=>t(!e),className:"md:hidden p-2 rounded-lg text-white/70 hover:text-white hover:bg-white/10 transition-all duration-300",children:e?h.jsx(qh,{className:"w-6 h-6"}):h.jsx(zk,{className:"w-6 h-6"})})]}),e&&h.jsx(z.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"md:hidden py-4 border-t border-white/10",children:h.jsxs("div",{className:"space-y-2",children:[N.map(E=>{var X,ee,q,me;const H=C.pathname===E.href;return h.jsxs(Xi,{to:E.href,onClick:()=>t(!1),className:Kh("flex items-center space-x-3 px-4 py-3 rounded-xl transition-all duration-300",H?"text-white":"text-white/60 hover:text-white hover:bg-white/5"),style:H?{background:`linear-gradient(135deg, ${((X=T.cssVars)==null?void 0:X.primary)||"#1db954"}15 0%, ${((ee=T.cssVars)==null?void 0:ee.secondary)||"#1ed760"}10 100%)`,border:`1px solid ${((q=T.cssVars)==null?void 0:q.primary)||"#1db954"}30`}:{},children:[h.jsx(E.icon,{className:"w-5 h-5",style:{color:H?(me=T.cssVars)==null?void 0:me.primary:void 0}}),h.jsx("span",{className:"font-medium",children:E.name})]},E.name)}),h.jsxs("div",{className:"pt-4 border-t border-white/10",children:[f&&h.jsxs("div",{className:"flex items-center space-x-3 px-4 py-2 text-sm text-white/70",children:[h.jsx(Ls,{className:"w-4 h-4"}),h.jsxs("span",{children:["Connected with ",(M=f.user)==null?void 0:M.display_name]})]}),h.jsxs("button",{onClick:()=>{n(!0),t(!1)},className:"w-full flex items-center space-x-3 px-4 py-3 rounded-xl text-white/60 hover:text-white transition-all duration-300",style:{color:(W=T.cssVars)==null?void 0:W.primary},onMouseEnter:E=>{E.currentTarget.style.background="rgba(255, 255, 255, 0.05)"},onMouseLeave:E=>{E.currentTarget.style.background="transparent"},children:[h.jsx(Hh,{className:"w-5 h-5"}),h.jsx("span",{className:"font-medium",children:"Settings"})]}),h.jsxs("button",{onClick:P,className:"w-full flex items-center space-x-3 px-4 py-3 rounded-xl text-white/60 hover:text-white transition-all duration-300",onMouseEnter:E=>{E.currentTarget.style.background="rgba(239, 68, 68, 0.1)"},onMouseLeave:E=>{E.currentTarget.style.background="transparent"},children:[h.jsx(Uh,{className:"w-5 h-5"}),h.jsx("span",{className:"font-medium",children:"Logout"})]})]})]})})]}),r&&h.jsxs(h.Fragment,{children:[h.jsx(z.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/50 backdrop-blur-md z-40",onClick:()=>n(!1)}),h.jsxs(z.div,{initial:{opacity:0,scale:.8,y:30},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.8,y:30},className:"fixed z-50 overflow-hidden",style:{left:s.x,top:s.y,width:Math.min(600,window.innerWidth-40),height:Math.min(window.innerHeight*.9,800),background:"linear-gradient(135deg, rgba(0,0,0,0.9) 0%, rgba(20,20,20,0.95) 50%, rgba(0,0,0,0.9) 100%)",backdropFilter:"blur(24px) saturate(180%)",WebkitBackdropFilter:"blur(24px) saturate(180%)",border:"1px solid rgba(255,255,255,0.2)",borderRadius:"16px",boxShadow:"0 25px 50px rgba(0,0,0,0.5)",cursor:o?"grabbing":"default"},children:[h.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-white/20 cursor-grab active:cursor-grabbing select-none",onMouseDown:O,style:{background:"linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%)"},children:[h.jsxs("div",{className:"flex items-center space-x-3",children:[h.jsxs("div",{className:"flex space-x-2",children:[h.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),h.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),h.jsx("div",{className:"w-3 h-3 rounded-full bg-green-500"})]}),h.jsx("h2",{className:"text-lg font-semibold text-white",children:"Settings"})]}),h.jsx("button",{onClick:()=>n(!1),className:"text-white/70 hover:text-white hover:bg-white/10 p-2 rounded-lg transition-all duration-200",children:h.jsx(qh,{className:"w-5 h-5"})})]}),h.jsx("div",{className:"overflow-y-auto p-4 sm:p-6",style:{height:"calc(100% - 60px)"},children:h.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[(d==null?void 0:d.user)&&h.jsxs("div",{children:[h.jsx("h3",{className:"text-lg font-semibold text-white mb-4 drop-shadow-md",children:"Your Account"}),h.jsxs("div",{className:"rounded-xl p-4 border border-white/20 transition-all duration-300 hover:border-white/30 hover:shadow-lg hover:shadow-white/5",style:{background:"linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},onMouseEnter:E=>{E.currentTarget.style.background="linear-gradient(135deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.04) 100%)"},onMouseLeave:E=>{E.currentTarget.style.background="linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%)"},children:[h.jsx("div",{className:"text-sm text-white/70 mb-2 font-medium",children:"Spotify ID"}),h.jsx("div",{className:"text-white font-mono text-sm break-all rounded-lg p-3 mb-3",style:{background:"rgba(0,0,0,0.4)",border:"1px solid rgba(255,255,255,0.1)"},children:d.user.id}),h.jsxs("div",{className:"text-sm text-white/80",children:["Display Name: ",h.jsx("span",{className:"text-white font-medium",children:d.user.display_name})]})]})]}),h.jsxs("div",{children:[h.jsx("h3",{className:"text-lg font-semibold text-white mb-4 drop-shadow-md",children:"Partner"}),f?h.jsx("div",{className:"rounded-xl p-4 border border-white/20 transition-all duration-300 hover:border-white/30 hover:shadow-lg hover:shadow-white/5",style:{background:"linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},onMouseEnter:E=>{E.currentTarget.style.background="linear-gradient(135deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.04) 100%)"},onMouseLeave:E=>{E.currentTarget.style.background="linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%)"},children:h.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between space-y-3 sm:space-y-0",children:[h.jsxs("div",{className:"flex items-center space-x-3 sm:space-x-4",children:[h.jsx("div",{className:"w-10 h-10 sm:w-12 sm:h-12 bg-gradient-to-br from-purple-500 to-pink-500 rounded-full flex items-center justify-center shadow-lg",children:h.jsx(Ls,{className:"w-5 h-5 sm:w-6 sm:h-6 text-white"})}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("div",{className:"text-white font-semibold text-base sm:text-lg truncate",children:(_=f.user)==null?void 0:_.display_name}),h.jsx("div",{className:"text-xs text-white/70 break-all rounded px-2 py-1 mt-1 inline-block",style:{background:"rgba(0,0,0,0.3)",border:"1px solid rgba(255,255,255,0.1)"},children:(A=f.user)==null?void 0:A.id}),h.jsx("div",{className:"text-sm text-green-400 font-medium mt-2",children:"✓ Connected"})]})]}),h.jsxs("button",{onClick:V,disabled:b,className:"flex items-center space-x-2 p-2 sm:p-3 text-red-400 hover:text-red-300 rounded-xl transition-all duration-200 disabled:opacity-50 self-start sm:self-auto",style:{background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:E=>{E.currentTarget.style.background="rgba(239, 68, 68, 0.2)"},onMouseLeave:E=>{E.currentTarget.style.background="rgba(239, 68, 68, 0.1)"},children:[h.jsx(ly,{className:"w-4 h-4 sm:w-5 sm:h-5"}),h.jsx("span",{className:"text-sm sm:hidden",children:"Remove"})]})]})}):h.jsxs("div",{className:"rounded-xl p-4 border border-white/20 space-y-4 transition-all duration-300 hover:border-white/30 hover:shadow-lg hover:shadow-white/5",style:{background:"linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},onMouseEnter:E=>{E.currentTarget.style.background="linear-gradient(135deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.04) 100%)"},onMouseLeave:E=>{E.currentTarget.style.background="linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%)"},children:[h.jsxs("div",{children:[h.jsx("label",{className:"text-sm text-white/70 mb-2 block font-medium",children:"Partner Spotify ID"}),h.jsx("input",{value:w,onChange:E=>v(E.target.value),placeholder:"Enter partner's Spotify ID...",className:"w-full text-white text-sm px-4 py-3 rounded-xl placeholder-white/50 border focus:outline-none transition-all",style:{background:"rgba(0,0,0,0.4)",border:"1px solid rgba(255,255,255,0.2)"},onFocus:E=>{E.target.style.border="1px solid rgba(255,255,255,0.4)"},onBlur:E=>{E.target.style.border="1px solid rgba(255,255,255,0.2)"}})]}),h.jsx("button",{disabled:y||!w,onClick:async()=>{var E;if(!(!((E=d==null?void 0:d.user)!=null&&E.id)||!w)){x(!0);try{await Et("/partners/request",{toUid:w}),v("")}finally{x(!1)}}},className:"w-full text-white px-4 py-3 rounded-xl text-sm disabled:opacity-50 transition-all duration-200 font-medium",style:{background:`linear-gradient(135deg, ${((I=T.cssVars)==null?void 0:I.primary)||"#1db954"} 0%, ${((R=T.cssVars)==null?void 0:R.secondary)||"#1ed760"} 100%)`},onMouseEnter:E=>{var H;E.currentTarget.style.transform="translateY(-1px)",E.currentTarget.style.boxShadow=`0 8px 25px ${((H=T.cssVars)==null?void 0:H.primary)||"#1db954"}40`},onMouseLeave:E=>{E.currentTarget.style.transform="translateY(0)",E.currentTarget.style.boxShadow="none"},children:y?"Sending...":"Send Partner Request"})]})]}),h.jsxs("div",{children:[h.jsx("h3",{className:"text-lg font-semibold text-white mb-4 drop-shadow-md",children:"Color Theme"}),h.jsx("div",{className:"rounded-xl p-4 border border-white/20 transition-all duration-300 hover:border-white/30 hover:shadow-lg hover:shadow-white/5",style:{background:"linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},onMouseEnter:E=>{E.currentTarget.style.background="linear-gradient(135deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.04) 100%)"},onMouseLeave:E=>{E.currentTarget.style.background="linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%)"},children:h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 sm:gap-3",children:[{name:"Green",value:"green",color:"from-green-500 to-emerald-500"},{name:"Pink",value:"pink",color:"from-pink-500 to-rose-500"},{name:"Blue",value:"blue",color:"from-blue-400 to-cyan-400"},{name:"Red",value:"red",color:"from-red-600 to-red-800"},{name:"Purple",value:"purple",color:"from-purple-500 to-violet-600"},{name:"Yellow",value:"yellow",color:"from-yellow-400 to-orange-500"},{name:"Turquoise",value:"turquoise",color:"from-cyan-400 to-blue-500"}].map(E=>{var H,X,ee;return h.jsxs("button",{onClick:()=>m(E.value),className:"flex items-center space-x-3 p-3 rounded-xl border transition-all duration-200",style:{border:p===E.value?`2px solid ${((H=T.cssVars)==null?void 0:H.primary)||"#1db954"}`:"1px solid rgba(255,255,255,0.2)",background:p===E.value?`linear-gradient(135deg, ${((X=T.cssVars)==null?void 0:X.primary)||"#1db954"}15 0%, ${((ee=T.cssVars)==null?void 0:ee.secondary)||"#1ed760"}10 100%)`:"rgba(255,255,255,0.02)"},onMouseEnter:q=>{var me;p!==E.value?(q.currentTarget.style.background="rgba(255,255,255,0.08)",q.currentTarget.style.border="1px solid rgba(255,255,255,0.4)",q.currentTarget.style.transform="translateY(-2px)",q.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.3)"):(q.currentTarget.style.transform="translateY(-1px)",q.currentTarget.style.boxShadow=`0 6px 20px ${((me=T.cssVars)==null?void 0:me.primary)||"#1db954"}30`)},onMouseLeave:q=>{p!==E.value?(q.currentTarget.style.background="rgba(255,255,255,0.02)",q.currentTarget.style.border="1px solid rgba(255,255,255,0.2)",q.currentTarget.style.transform="translateY(0)",q.currentTarget.style.boxShadow="none"):(q.currentTarget.style.transform="translateY(0)",q.currentTarget.style.boxShadow="none")},children:[h.jsx("div",{className:`w-5 h-5 rounded-full bg-gradient-to-r ${E.color} shadow-sm`}),h.jsx("span",{className:"text-white text-sm font-medium",children:E.name})]},E.value)})})})]})]})})]})]})]})};var gy={exports:{}};(function(e){var t=function(){var r="https://api.spotify.com/v1",n=null,s=null,i=function(u,p){return u.abort=p,u},o=function(u,p){var m;if(s!==null){var g=s.defer();u(function(w){g.resolve(w)},function(w){g.reject(w)}),m=g.promise}else window.Promise&&(m=new window.Promise(u));return m?new i(m,p):null},a=function(){var u=Array.prototype.slice.call(arguments),p=u[0],m=u.slice(1);return p=p||{},m.forEach(function(g){for(var w in g)g.hasOwnProperty(w)&&(p[w]=g[w])}),p},l=function(u,p){var m="";for(var g in p)if(p.hasOwnProperty(g)){var w=p[g];m+=encodeURIComponent(g)+"="+encodeURIComponent(w)+"&"}return m.length>0&&(m=m.substring(0,m.length-1),u=u+"?"+m),u},c=function(u,p){var m=new XMLHttpRequest,g=function(w,v){function y(C){w&&w(C),p&&p(null,C)}function x(){v&&v(m),p&&p(m,null)}var b=u.type||"GET";if(m.open(b,l(u.url,u.params)),n&&m.setRequestHeader("Authorization","Bearer "+n),m.onreadystatechange=function(){if(m.readyState===4){var C=null;try{C=m.responseText?JSON.parse(m.responseText):""}catch(N){console.error(N)}m.status>=200&&m.status<300?y(C):x()}},b==="GET")m.send(null);else{var k=null;u.postData&&(u.contentType==="image/jpeg"?(k=u.postData,m.setRequestHeader("Content-Type",u.contentType)):(k=JSON.stringify(u.postData),m.setRequestHeader("Content-Type","application/json"))),m.send(k)}};return p?(g(),null):o(g,function(){m.abort()})},d=function(u,p,m,g){var w={},v=null;typeof p=="object"?(w=p,v=m):typeof p=="function"&&(v=p);var y=u.type||"GET";return y!=="GET"&&u.postData&&!g?u.postData=a(u.postData,w):u.params=a(u.params,w),c(u,v)},f=function(){};return f.prototype={constructor:t},f.prototype.getGeneric=function(u,p){var m={url:u};return d(m,p)},f.prototype.getMe=function(u,p){var m={url:r+"/me"};return d(m,u,p)},f.prototype.getMySavedTracks=function(u,p){var m={url:r+"/me/tracks"};return d(m,u,p)},f.prototype.addToMySavedTracks=function(u,p,m){var g={url:r+"/me/tracks",type:"PUT",postData:u};return d(g,p,m)},f.prototype.removeFromMySavedTracks=function(u,p,m){var g={url:r+"/me/tracks",type:"DELETE",postData:u};return d(g,p,m)},f.prototype.containsMySavedTracks=function(u,p,m){var g={url:r+"/me/tracks/contains",params:{ids:u.join(",")}};return d(g,p,m)},f.prototype.getMySavedAlbums=function(u,p){var m={url:r+"/me/albums"};return d(m,u,p)},f.prototype.addToMySavedAlbums=function(u,p,m){var g={url:r+"/me/albums",type:"PUT",postData:u};return d(g,p,m)},f.prototype.removeFromMySavedAlbums=function(u,p,m){var g={url:r+"/me/albums",type:"DELETE",postData:u};return d(g,p,m)},f.prototype.containsMySavedAlbums=function(u,p,m){var g={url:r+"/me/albums/contains",params:{ids:u.join(",")}};return d(g,p,m)},f.prototype.getMyTopArtists=function(u,p){var m={url:r+"/me/top/artists"};return d(m,u,p)},f.prototype.getMyTopTracks=function(u,p){var m={url:r+"/me/top/tracks"};return d(m,u,p)},f.prototype.getMyRecentlyPlayedTracks=function(u,p){var m={url:r+"/me/player/recently-played"};return d(m,u,p)},f.prototype.followUsers=function(u,p){var m={url:r+"/me/following/",type:"PUT",params:{ids:u.join(","),type:"user"}};return d(m,p)},f.prototype.followArtists=function(u,p){var m={url:r+"/me/following/",type:"PUT",params:{ids:u.join(","),type:"artist"}};return d(m,p)},f.prototype.followPlaylist=function(u,p,m){var g={url:r+"/playlists/"+u+"/followers",type:"PUT",postData:{}};return d(g,p,m)},f.prototype.unfollowUsers=function(u,p){var m={url:r+"/me/following/",type:"DELETE",params:{ids:u.join(","),type:"user"}};return d(m,p)},f.prototype.unfollowArtists=function(u,p){var m={url:r+"/me/following/",type:"DELETE",params:{ids:u.join(","),type:"artist"}};return d(m,p)},f.prototype.unfollowPlaylist=function(u,p){var m={url:r+"/playlists/"+u+"/followers",type:"DELETE"};return d(m,p)},f.prototype.isFollowingUsers=function(u,p){var m={url:r+"/me/following/contains",type:"GET",params:{ids:u.join(","),type:"user"}};return d(m,p)},f.prototype.isFollowingArtists=function(u,p){var m={url:r+"/me/following/contains",type:"GET",params:{ids:u.join(","),type:"artist"}};return d(m,p)},f.prototype.areFollowingPlaylist=function(u,p,m){var g={url:r+"/playlists/"+u+"/followers/contains",type:"GET",params:{ids:p.join(",")}};return d(g,m)},f.prototype.getFollowedArtists=function(u,p){var m={url:r+"/me/following",type:"GET",params:{type:"artist"}};return d(m,u,p)},f.prototype.getUser=function(u,p,m){var g={url:r+"/users/"+encodeURIComponent(u)};return d(g,p,m)},f.prototype.getUserPlaylists=function(u,p,m){var g;return typeof u=="string"?g={url:r+"/users/"+encodeURIComponent(u)+"/playlists"}:(g={url:r+"/me/playlists"},m=p,p=u),d(g,p,m)},f.prototype.getPlaylist=function(u,p,m){var g={url:r+"/playlists/"+u};return d(g,p,m)},f.prototype.getPlaylistTracks=function(u,p,m){var g={url:r+"/playlists/"+u+"/tracks"};return d(g,p,m)},f.prototype.getPlaylistCoverImage=function(u,p){var m={url:r+"/playlists/"+u+"/images"};return d(m,p)},f.prototype.createPlaylist=function(u,p,m){var g={url:r+"/users/"+encodeURIComponent(u)+"/playlists",type:"POST",postData:p};return d(g,p,m)},f.prototype.changePlaylistDetails=function(u,p,m){var g={url:r+"/playlists/"+u,type:"PUT",postData:p};return d(g,p,m)},f.prototype.addTracksToPlaylist=function(u,p,m,g){var w={url:r+"/playlists/"+u+"/tracks",type:"POST",postData:{uris:p}};return d(w,m,g,!0)},f.prototype.replaceTracksInPlaylist=function(u,p,m){var g={url:r+"/playlists/"+u+"/tracks",type:"PUT",postData:{uris:p}};return d(g,{},m)},f.prototype.reorderTracksInPlaylist=function(u,p,m,g,w){var v={url:r+"/playlists/"+u+"/tracks",type:"PUT",postData:{range_start:p,insert_before:m}};return d(v,g,w)},f.prototype.removeTracksFromPlaylist=function(u,p,m){var g=p.map(function(v){return typeof v=="string"?{uri:v}:v}),w={url:r+"/playlists/"+u+"/tracks",type:"DELETE",postData:{tracks:g}};return d(w,{},m)},f.prototype.removeTracksFromPlaylistWithSnapshotId=function(u,p,m,g){var w=p.map(function(y){return typeof y=="string"?{uri:y}:y}),v={url:r+"/playlists/"+u+"/tracks",type:"DELETE",postData:{tracks:w,snapshot_id:m}};return d(v,{},g)},f.prototype.removeTracksFromPlaylistInPositions=function(u,p,m,g){var w={url:r+"/playlists/"+u+"/tracks",type:"DELETE",postData:{positions:p,snapshot_id:m}};return d(w,{},g)},f.prototype.uploadCustomPlaylistCoverImage=function(u,p,m){var g={url:r+"/playlists/"+u+"/images",type:"PUT",postData:p.replace(/^data:image\/jpeg;base64,/,""),contentType:"image/jpeg"};return d(g,{},m)},f.prototype.getAlbum=function(u,p,m){var g={url:r+"/albums/"+u};return d(g,p,m)},f.prototype.getAlbumTracks=function(u,p,m){var g={url:r+"/albums/"+u+"/tracks"};return d(g,p,m)},f.prototype.getAlbums=function(u,p,m){var g={url:r+"/albums/",params:{ids:u.join(",")}};return d(g,p,m)},f.prototype.getTrack=function(u,p,m){var g={};return g.url=r+"/tracks/"+u,d(g,p,m)},f.prototype.getTracks=function(u,p,m){var g={url:r+"/tracks/",params:{ids:u.join(",")}};return d(g,p,m)},f.prototype.getArtist=function(u,p,m){var g={url:r+"/artists/"+u};return d(g,p,m)},f.prototype.getArtists=function(u,p,m){var g={url:r+"/artists/",params:{ids:u.join(",")}};return d(g,p,m)},f.prototype.getArtistAlbums=function(u,p,m){var g={url:r+"/artists/"+u+"/albums"};return d(g,p,m)},f.prototype.getArtistTopTracks=function(u,p,m,g){var w={url:r+"/artists/"+u+"/top-tracks",params:{country:p}};return d(w,m,g)},f.prototype.getArtistRelatedArtists=function(u,p,m){var g={url:r+"/artists/"+u+"/related-artists"};return d(g,p,m)},f.prototype.getFeaturedPlaylists=function(u,p){var m={url:r+"/browse/featured-playlists"};return d(m,u,p)},f.prototype.getNewReleases=function(u,p){var m={url:r+"/browse/new-releases"};return d(m,u,p)},f.prototype.getCategories=function(u,p){var m={url:r+"/browse/categories"};return d(m,u,p)},f.prototype.getCategory=function(u,p,m){var g={url:r+"/browse/categories/"+u};return d(g,p,m)},f.prototype.getCategoryPlaylists=function(u,p,m){var g={url:r+"/browse/categories/"+u+"/playlists"};return d(g,p,m)},f.prototype.search=function(u,p,m,g){var w={url:r+"/search/",params:{q:u,type:p.join(",")}};return d(w,m,g)},f.prototype.searchAlbums=function(u,p,m){return this.search(u,["album"],p,m)},f.prototype.searchArtists=function(u,p,m){return this.search(u,["artist"],p,m)},f.prototype.searchTracks=function(u,p,m){return this.search(u,["track"],p,m)},f.prototype.searchPlaylists=function(u,p,m){return this.search(u,["playlist"],p,m)},f.prototype.searchShows=function(u,p,m){return this.search(u,["show"],p,m)},f.prototype.searchEpisodes=function(u,p,m){return this.search(u,["episode"],p,m)},f.prototype.getAudioFeaturesForTrack=function(u,p){var m={};return m.url=r+"/audio-features/"+u,d(m,{},p)},f.prototype.getAudioFeaturesForTracks=function(u,p){var m={url:r+"/audio-features",params:{ids:u}};return d(m,{},p)},f.prototype.getAudioAnalysisForTrack=function(u,p){var m={};return m.url=r+"/audio-analysis/"+u,d(m,{},p)},f.prototype.getRecommendations=function(u,p){var m={url:r+"/recommendations"};return d(m,u,p)},f.prototype.getAvailableGenreSeeds=function(u){var p={url:r+"/recommendations/available-genre-seeds"};return d(p,{},u)},f.prototype.getMyDevices=function(u){var p={url:r+"/me/player/devices"};return d(p,{},u)},f.prototype.getMyCurrentPlaybackState=function(u,p){var m={url:r+"/me/player"};return d(m,u,p)},f.prototype.getMyCurrentPlayingTrack=function(u,p){var m={url:r+"/me/player/currently-playing"};return d(m,u,p)},f.prototype.transferMyPlayback=function(u,p,m){var g=p||{};g.device_ids=u;var w={type:"PUT",url:r+"/me/player",postData:g};return d(w,p,m)},f.prototype.play=function(u,p){u=u||{};var m="device_id"in u?{device_id:u.device_id}:null,g={};["context_uri","uris","offset","position_ms"].forEach(function(y){y in u&&(g[y]=u[y])});var w={type:"PUT",url:r+"/me/player/play",params:m,postData:g},v=typeof u=="function"?u:{};return d(w,v,p)},f.prototype.queue=function(u,p,m){p=p||{};var g="device_id"in p?{uri:u,device_id:p.device_id}:{uri:u},w={type:"POST",url:r+"/me/player/queue",params:g};return d(w,p,m)},f.prototype.pause=function(u,p){u=u||{};var m="device_id"in u?{device_id:u.device_id}:null,g={type:"PUT",url:r+"/me/player/pause",params:m};return d(g,u,p)},f.prototype.skipToNext=function(u,p){u=u||{};var m="device_id"in u?{device_id:u.device_id}:null,g={type:"POST",url:r+"/me/player/next",params:m};return d(g,u,p)},f.prototype.skipToPrevious=function(u,p){u=u||{};var m="device_id"in u?{device_id:u.device_id}:null,g={type:"POST",url:r+"/me/player/previous",params:m};return d(g,u,p)},f.prototype.seek=function(u,p,m){p=p||{};var g={position_ms:u};"device_id"in p&&(g.device_id=p.device_id);var w={type:"PUT",url:r+"/me/player/seek",params:g};return d(w,p,m)},f.prototype.setRepeat=function(u,p,m){p=p||{};var g={state:u};"device_id"in p&&(g.device_id=p.device_id);var w={type:"PUT",url:r+"/me/player/repeat",params:g};return d(w,p,m)},f.prototype.setVolume=function(u,p,m){p=p||{};var g={volume_percent:u};"device_id"in p&&(g.device_id=p.device_id);var w={type:"PUT",url:r+"/me/player/volume",params:g};return d(w,p,m)},f.prototype.setShuffle=function(u,p,m){p=p||{};var g={state:u};"device_id"in p&&(g.device_id=p.device_id);var w={type:"PUT",url:r+"/me/player/shuffle",params:g};return d(w,p,m)},f.prototype.getShow=function(u,p,m){var g={};return g.url=r+"/shows/"+u,d(g,p,m)},f.prototype.getShows=function(u,p,m){var g={url:r+"/shows/",params:{ids:u.join(",")}};return d(g,p,m)},f.prototype.getMySavedShows=function(u,p){var m={url:r+"/me/shows"};return d(m,u,p)},f.prototype.addToMySavedShows=function(u,p,m){var g={url:r+"/me/shows",type:"PUT",postData:u};return d(g,p,m)},f.prototype.removeFromMySavedShows=function(u,p,m){var g={url:r+"/me/shows",type:"DELETE",postData:u};return d(g,p,m)},f.prototype.containsMySavedShows=function(u,p,m){var g={url:r+"/me/shows/contains",params:{ids:u.join(",")}};return d(g,p,m)},f.prototype.getShowEpisodes=function(u,p,m){var g={url:r+"/shows/"+u+"/episodes"};return d(g,p,m)},f.prototype.getEpisode=function(u,p,m){var g={};return g.url=r+"/episodes/"+u,d(g,p,m)},f.prototype.getEpisodes=function(u,p,m){var g={url:r+"/episodes/",params:{ids:u.join(",")}};return d(g,p,m)},f.prototype.getAccessToken=function(){return n},f.prototype.setAccessToken=function(u){n=u},f.prototype.setPromiseImplementation=function(u){var p=!1;try{var m=new u(function(g){g()});typeof m.then=="function"&&typeof m.catch=="function"&&(p=!0)}catch(g){console.error(g)}if(p)s=u;else throw new Error("Unsupported implementation of Promises/A+")},f}();e.exports=t})(gy);var Pj=gy.exports;const Ej=wu(Pj),Tj="7cab80d02df44a5bb96725be60a45875",yy="https://159.195.9.107:3443/callback.html";console.log("🔍 Debug - Current redirect URI:",yy);console.log("🔍 Debug - Environment VITE_REDIRECT_URI:","https://159.195.9.107:3443/callback.html");const Vo=new Ej,Mj=e=>{const t=(e==null?void 0:e.forceDialog)??!0,r=["user-read-private","user-read-email","user-read-recently-played","user-top-read","playlist-read-private","playlist-read-collaborative","playlist-modify-public","playlist-modify-private","user-read-playback-state","user-modify-playback-state","user-read-currently-playing","ugc-image-upload"].join(" "),s=`https://accounts.spotify.com/authorize?${new URLSearchParams({client_id:Tj,response_type:"code",redirect_uri:yy,scope:r,show_dialog:t?"true":"false"}).toString()}`;return console.log("🔍 Debug - Generated Spotify Auth URL:",s),s},Aj=async(e,t)=>{Vo.setAccessToken(e),await Vo.play({uris:[t]})},_j=async e=>{Vo.setAccessToken(e),await Vo.pause()},Lj=()=>{const[e,t]=S.useState(!1),[r,n]=S.useState(!1),[s,i]=S.useState(null),o=()=>{t(!0);const l=navigator.userAgent||navigator.vendor||window.opera,c=/iPad|iPhone|iPod/.test(l)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,d=/Android/.test(l),u=Mj({forceDialog:!(c||d)});window.location.href=u},a=[{icon:Ke,title:"Last Listened",description:"Discover what your partner is listening to right now and play it instantly"},{icon:Nr,title:"Mixed Playlist",description:"AI-powered playlists that blend your musical tastes perfectly"},{icon:et,title:"Memory Lane",description:"Create beautiful musical memories and shared experiences together"}];return h.jsxs("div",{className:"min-h-screen flex items-center justify-center px-4 bg-black",children:[h.jsxs("div",{className:"max-w-4xl w-full relative",children:[h.jsxs(z.div,{initial:{opacity:0,y:50},animate:{opacity:1,y:0},transition:{duration:.8},className:"text-center mb-12",children:[h.jsx(z.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.2,type:"spring",stiffness:200},className:"w-20 h-20 mx-auto mb-6 bg-gradient-to-br from-pink-500 to-red-500 rounded-full flex items-center justify-center",children:h.jsx(et,{className:"w-10 h-10 text-white"})}),h.jsxs("h1",{className:"text-5xl md:text-6xl font-bold mb-4",children:[h.jsx("span",{className:"gradient-text",children:"Our Musical"}),h.jsx("br",{}),h.jsx("span",{className:"text-white",children:"Journey"})]}),h.jsx("p",{className:"text-xl text-white/70 max-w-2xl mx-auto leading-relaxed",children:"A private space where two hearts connect through music. Discover, share, and create beautiful musical memories together."})]}),h.jsx(z.div,{initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{delay:.4,duration:.8},className:"grid md:grid-cols-3 gap-6 mb-12",children:a.map((l,c)=>h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.5+c*.1},whileHover:{y:-8,scale:1.03},className:"glass-bubble rounded-3xl p-8 text-center group cursor-pointer",children:[h.jsx(z.div,{whileHover:{rotate:15,scale:1.15},className:"w-16 h-16 mx-auto mb-6 bg-gradient-to-br from-purple-500/30 via-blue-500/30 to-pink-500/30 rounded-2xl flex items-center justify-center backdrop-blur-sm",children:h.jsx(l.icon,{className:"w-8 h-8 text-white"})}),h.jsx("h3",{className:"text-2xl font-bold text-white mb-3",children:l.title}),h.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:l.description})]},l.title))}),h.jsxs(z.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{delay:.8,duration:.6},className:"glass-fluid rounded-3xl p-10 max-w-lg mx-auto",children:[h.jsxs("div",{className:"text-center mb-8",children:[h.jsx(z.div,{initial:{scale:0},animate:{scale:1},transition:{delay:1,type:"spring",stiffness:200},className:"w-20 h-20 mx-auto mb-6 bg-gradient-to-br from-purple-500/30 via-blue-500/30 to-pink-500/30 rounded-2xl flex items-center justify-center backdrop-blur-sm",children:h.jsx(Wc,{className:"w-10 h-10 text-white"})}),h.jsx("h2",{className:"text-3xl font-bold text-white mb-3",children:"Begin Your Journey"}),h.jsx("p",{className:"text-white/70 text-lg",children:"Connect your Spotify account to start your musical love story"})]}),h.jsx(z.button,{whileHover:{scale:1.05,boxShadow:"0 15px 40px rgba(147, 51, 234, 0.4)"},whileTap:{scale:.95},onClick:o,disabled:e,className:"w-full bg-gradient-to-r from-purple-600 via-blue-600 to-pink-600 hover:from-purple-700 hover:via-blue-700 hover:to-pink-700 text-white font-bold py-5 px-8 rounded-2xl transition-all duration-300 flex items-center justify-center space-x-3 disabled:opacity-50 shadow-2xl",children:e?h.jsx("div",{className:"w-6 h-6 border-2 border-white border-t-transparent rounded-full animate-spin"}):h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-lg",children:"Connect with Spotify"}),h.jsx(_k,{className:"w-6 h-6"})]})}),h.jsx("p",{className:"text-sm text-white/60 text-center mt-6 leading-relaxed",children:"We'll only access your listening history and playlist data to create your personalized musical journey"})]}),h.jsx(z.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:1,duration:.6},className:"text-center mt-12",children:h.jsx("p",{className:"text-white/40 text-sm",children:"Made with 💕 for a special someone"})})]}),h.jsx(Dj,{open:r,onClose:()=>n(!1),authUrl:s})]})};function Dj({open:e,onClose:t,authUrl:r}){if(!e||!r)return null;const n=()=>{window.open(r,"_blank","noopener,noreferrer")||(window.location.href=r)},s=async()=>{try{await navigator.clipboard.writeText(r),alert("Link copied. Paste in Safari/Chrome to continue.")}catch{}};return h.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center px-4",children:[h.jsx("div",{className:"absolute inset-0 bg-black/70",onClick:t}),h.jsxs("div",{className:"relative z-10 w-full max-w-md glass-fluid rounded-2xl p-6 text-white",children:[h.jsx("h3",{className:"text-xl font-bold mb-2",children:"Open Spotify Login"}),h.jsx("p",{className:"text-white/80 text-sm mb-4",children:"If this opened inside another app (Instagram, Facebook, Twitter), use your system browser to avoid password overlays."}),h.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[h.jsx("button",{onClick:n,className:"w-full bg-white/10 hover:bg-white/20 border border-white/20 rounded-xl py-3 font-medium",children:"Open in new tab"}),h.jsx("button",{onClick:s,className:"w-full bg-white/10 hover:bg-white/20 border border-white/20 rounded-xl py-3 font-medium",children:"Copy link"}),h.jsx("button",{onClick:t,className:"w-full bg-transparent text-white/70 underline py-2",children:"Cancel"})]})]})]})}const Rj=()=>{var N,P,V,T,O,j,F,D,G,M,W,_,A,I,R,E,H,X,ee,q,me,Rr,_t,St,Qe,on,Qn;const{currentUser:e,partnerUser:t,theme:r}=oe(),n=en(r),[s,i]=S.useState([]),[o,a]=S.useState(!1),[l,c]=S.useState(null),[d,f]=S.useState(""),[u,p]=S.useState(!1),[m,g]=S.useState(null),[w,v]=S.useState(null);S.useEffect(()=>{let B;const le=async()=>{var ye,be,Fe;try{const Lt=(ye=e==null?void 0:e.user)==null?void 0:ye.id;if(Lt){const an=await te(`/users/${Lt}/recently-played`),Zt=oe.getState().currentUser;Zt&&oe.getState().setCurrentUser({...Zt,recentlyPlayed:an})}const Zn=(Fe=(be=oe.getState().partnerUser)==null?void 0:be.user)==null?void 0:Fe.id;if(Zn){const an=await te(`/users/${Zn}/recently-played`),Zt=oe.getState().partnerUser;Zt&&oe.getState().setPartnerUser({...Zt,recentlyPlayed:an})}}catch{}B=setTimeout(le,3e4)};return le(),()=>clearTimeout(B)},[(N=e==null?void 0:e.user)==null?void 0:N.id,(P=t==null?void 0:t.user)==null?void 0:P.id]),S.useEffect(()=>{(async()=>{var le;if((le=e==null?void 0:e.user)!=null&&le.id){a(!0);try{const ye=await te(`/partners/requests/${e.user.id}`);i(ye)}catch{i([])}finally{a(!1)}}})()},[(V=e==null?void 0:e.user)==null?void 0:V.id]),S.useEffect(()=>{let B;const le=async()=>{var be;if((be=e==null?void 0:e.user)!=null&&be.id)try{const Fe=await te(`/users/${e.user.id}/status`);c(Fe)}catch{}},ye=()=>{if(!(l!=null&&l.nextSyncAt)){f("");return}const be=l.nextSyncAt-Date.now();if(be<=0){f("now");return}const Fe=Math.floor(be/6e4),Lt=Math.floor(be%6e4/1e3);f(`${Fe}m ${Lt}s`)};return le(),B=setInterval(()=>{ye()},1e3),()=>clearInterval(B)},[(T=e==null?void 0:e.user)==null?void 0:T.id,l==null?void 0:l.nextSyncAt]),S.useEffect(()=>{let B;const le=async()=>{var ye,be;try{const Fe=(ye=e==null?void 0:e.user)==null?void 0:ye.id;Fe&&(g(await te(`/users/${Fe}/now-playing`)),(be=t==null?void 0:t.user)!=null&&be.id?v(await te(`/users/${t.user.id}/now-playing`)):v(null))}catch{}B=setTimeout(le,8e3)};return le(),()=>clearTimeout(B)},[(O=e==null?void 0:e.user)==null?void 0:O.id,(j=t==null?void 0:t.user)==null?void 0:j.id]);const y=async()=>{var B;if((B=e==null?void 0:e.user)!=null&&B.id){p(!0);try{await Et(`/users/${e.user.id}/sync`);const le=await te(`/users/${e.user.id}/status`);c(le);const[ye,be]=await Promise.all([te(`/users/${e.user.id}/recently-played`),te(`/users/${e.user.id}/top-tracks?time_range=short_term`)]),Fe=oe.getState().currentUser;Fe&&oe.getState().setCurrentUser({...Fe,recentlyPlayed:ye,topTracks:be.map(Lt=>Lt.track)}),ce.success("Synced latest data")}catch{ce.error("Failed to sync")}finally{p(!1)}}},x=async B=>{await Et(`/partners/requests/${B}/accept`),i(le=>le.filter(ye=>ye.id!==B))},b=async B=>{await Et(`/partners/requests/${B}/decline`),i(le=>le.filter(ye=>ye.id!==B))},k=[{title:"Last Listened",description:"See what your partner is listening to right now",icon:Ke,href:"/last-listened",primaryColor:((F=n.cssVars)==null?void 0:F.primary)||"#1db954",secondaryColor:((D=n.cssVars)==null?void 0:D.secondary)||"#1ed760",accentColor:((G=n.cssVars)==null?void 0:G.accent)||"#00e676"},{title:"Mixed Playlist",description:"Create AI-powered playlists blending both your tastes",icon:oy,href:"/mixed-playlist",primaryColor:((M=n.cssVars)==null?void 0:M.secondary)||"#1ed760",secondaryColor:((W=n.cssVars)==null?void 0:W.accent)||"#00e676",accentColor:((_=n.cssVars)==null?void 0:_.primary)||"#1db954"},{title:"Memory Lane",description:"Your shared musical journey and memories",icon:Nr,href:"/memory-lane",primaryColor:((A=n.cssVars)==null?void 0:A.accent)||"#00e676",secondaryColor:((I=n.cssVars)==null?void 0:I.primary)||"#1db954",accentColor:((R=n.cssVars)==null?void 0:R.secondary)||"#1ed760"}],C=()=>{var B;return(B=e==null?void 0:e.recentlyPlayed)!=null&&B[0]?_n(e.recentlyPlayed[0].played_at):null};return h.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"mb-8",children:[h.jsxs("h1",{className:"text-4xl font-bold text-white mb-2",children:["Welcome back, ",h.jsx("span",{className:"gradient-text",children:(E=e==null?void 0:e.user)==null?void 0:E.display_name})]}),h.jsx("p",{className:"text-white/70 text-lg",children:"Ready to explore your musical connection together?"})]}),h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"grid md:grid-cols-2 gap-6 mb-8",children:[h.jsxs("div",{className:"glass rounded-2xl p-6",children:[h.jsx("div",{className:"text-white/70 mb-2",children:"You"}),m!=null&&m.is_playing&&(m!=null&&m.item)?h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("img",{src:((ee=(X=(H=m.item.album)==null?void 0:H.images)==null?void 0:X[0])==null?void 0:ee.url)||"/placeholder-album.png",className:"w-14 h-14 rounded"}),h.jsxs("div",{className:"min-w-0",children:[h.jsx("div",{className:"text-white font-semibold truncate",children:m.item.name}),h.jsx("div",{className:"text-white/70 text-sm truncate",children:(q=m.item.artists)==null?void 0:q.map(B=>B.name).join(", ")})]})]}):h.jsx("div",{className:"text-white/50",children:"Not playing"})]}),h.jsxs("div",{className:"glass rounded-2xl p-6",children:[h.jsx("div",{className:"text-white/70 mb-2",children:"Partner"}),w!=null&&w.is_playing&&(w!=null&&w.item)?h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("img",{src:((_t=(Rr=(me=w.item.album)==null?void 0:me.images)==null?void 0:Rr[0])==null?void 0:_t.url)||"/placeholder-album.png",className:"w-14 h-14 rounded"}),h.jsxs("div",{className:"min-w-0",children:[h.jsx("div",{className:"text-white font-semibold truncate",children:w.item.name}),h.jsx("div",{className:"text-white/70 text-sm truncate",children:(St=w.item.artists)==null?void 0:St.map(B=>B.name).join(", ")})]})]}):h.jsx("div",{className:"text-white/50",children:"Not playing"})]})]}),h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"mb-8",children:[h.jsxs("div",{className:"flex items-center justify-between mb-4",children:[h.jsx("div",{className:"text-white/70 text-sm",children:(l==null?void 0:l.lastSyncedAt)&&h.jsxs("span",{children:["Last sync: ",new Date(l.lastSyncedAt).toLocaleTimeString()," • Next in: ",d||"—"]})}),h.jsx("button",{onClick:y,disabled:u,className:"bg-white/10 hover:bg-white/20 text-white px-4 py-2 rounded-lg text-sm disabled:opacity-50",children:u?"Refreshing…":"Hard Refresh"})]}),t?h.jsx("div",{className:"glass-bubble rounded-3xl p-8 border border-spotify-green/30 glow",children:h.jsxs("div",{className:"flex items-center space-x-6",children:[h.jsx("div",{className:"w-16 h-16 bg-gradient-to-br from-spotify-green to-green-600 rounded-2xl flex items-center justify-center",children:h.jsx(et,{className:"w-8 h-8 text-white"})}),h.jsxs("div",{children:[h.jsxs("h3",{className:"text-xl font-semibold text-white",children:["Connected with ",(Qe=t.user)==null?void 0:Qe.display_name]}),h.jsx("p",{className:"text-white/70",children:"Your musical journey is ready to begin! 💕"})]})]})}):h.jsx("div",{className:"glass-bubble rounded-3xl p-8 border border-orange-500/30",children:h.jsxs("div",{className:"flex items-center space-x-6",children:[h.jsx("div",{className:"w-16 h-16 bg-gradient-to-br from-orange-500 to-red-500 rounded-2xl flex items-center justify-center",children:h.jsx(Uc,{className:"w-8 h-8 text-white"})}),h.jsxs("div",{children:[h.jsx("h3",{className:"text-xl font-semibold text-white",children:"Invite your partner"}),h.jsx("p",{className:"text-white/70 mb-2",children:"Ask your partner to search you in the app and send a request."}),o?h.jsx("div",{className:"text-white/60",children:"Loading requests..."}):s.length>0?h.jsx("div",{className:"space-y-3",children:s.map(B=>h.jsxs("div",{className:"flex items-center justify-between bg-white/5 rounded-lg p-3",children:[h.jsxs("div",{className:"text-white/80 text-sm",children:["Request from ",B.from_user_id]}),h.jsxs("div",{className:"space-x-2",children:[h.jsx("button",{onClick:()=>x(B.id),className:"bg-spotify-green hover:bg-spotify-green/90 text-white px-3 py-1 rounded-md text-sm",children:"Accept"}),h.jsx("button",{onClick:()=>b(B.id),className:"bg-white/10 hover:bg-white/20 text-white px-3 py-1 rounded-md text-sm",children:"Decline"})]})]},B.id))}):h.jsx("div",{className:"text-white/60 text-sm",children:"No incoming requests yet"})]})]})})]}),h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-8",children:[h.jsx("div",{className:"glass-bubble rounded-2xl p-6",children:h.jsxs("div",{className:"flex items-center space-x-4",children:[h.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-blue-500/30 to-cyan-500/30 rounded-xl flex items-center justify-center",children:h.jsx(Un,{className:"w-6 h-6 text-blue-400"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-white/70 text-sm",children:"Your last played"}),h.jsx("p",{className:"text-white font-semibold",children:C()||"No recent plays"})]})]})}),h.jsx("div",{className:"glass-bubble rounded-2xl p-6",children:h.jsxs("div",{className:"flex items-center space-x-4",children:[h.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-green-500/30 to-emerald-500/30 rounded-xl flex items-center justify-center",children:h.jsx(uy,{className:"w-6 h-6 text-green-400"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-white/70 text-sm",children:"Top tracks analyzed"}),h.jsxs("p",{className:"text-white font-semibold",children:[((on=e==null?void 0:e.topTracks)==null?void 0:on.length)||0," songs"]})]})]})}),h.jsx("div",{className:"glass-bubble rounded-2xl p-6",children:h.jsxs("div",{className:"flex items-center space-x-4",children:[h.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-purple-500/30 to-pink-500/30 rounded-xl flex items-center justify-center",children:h.jsx(Ls,{className:"w-6 h-6 text-purple-400"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-white/70 text-sm",children:"Recently played"}),h.jsxs("p",{className:"text-white font-semibold",children:[((Qn=e==null?void 0:e.recentlyPlayed)==null?void 0:Qn.length)||0," tracks"]})]})]})})]}),h.jsx(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3},className:"grid md:grid-cols-3 gap-6",children:k.map((B,le)=>h.jsx(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.4+le*.1},whileHover:{y:-5,scale:1.02},children:h.jsx(Xi,{to:B.href,children:h.jsxs("div",{className:`glass rounded-2xl p-6 h-full border ${B.borderColor} group cursor-pointer transition-all duration-300 hover:shadow-xl`,children:[h.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mb-4 group-hover:scale-110 transition-transform duration-300",style:{background:`linear-gradient(135deg, ${B.primaryColor}20 0%, ${B.secondaryColor}10 100%)`,border:`1px solid ${B.primaryColor}30`},children:h.jsx(B.icon,{className:"w-6 h-6",style:{color:B.primaryColor}})}),h.jsx("h3",{className:"text-xl font-semibold text-white mb-2",children:B.title}),h.jsx("p",{className:"text-white/70 text-sm leading-relaxed mb-4",children:B.description}),h.jsx("div",{className:"w-full h-1 rounded-full opacity-0 group-hover:opacity-100 transition-opacity duration-300",style:{background:`linear-gradient(90deg, ${B.primaryColor} 0%, ${B.secondaryColor} 100%)`}})]})})},B.title))}),(e==null?void 0:e.recentlyPlayed)&&e.recentlyPlayed.length>0&&h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.6},className:"mt-8",children:[h.jsx("h2",{className:"text-2xl font-bold text-white mb-4",children:"Your Recent Activity"}),h.jsx("div",{className:"glass rounded-2xl p-6",children:h.jsx("div",{className:"space-y-4",children:e.recentlyPlayed.slice(0,3).map((B,le)=>{var ye,be;return h.jsxs(z.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.7+le*.1},className:"flex items-center space-x-4 p-3 rounded-lg hover:bg-white/5 transition-colors",children:[h.jsx("img",{src:((ye=B.track.album.images[0])==null?void 0:ye.url)||"/placeholder-album.png",alt:B.track.album.name,className:"w-12 h-12 rounded-lg object-cover"}),h.jsxs("div",{className:"flex-1",children:[h.jsx("h4",{className:"text-white font-medium",children:B.track.name}),h.jsx("p",{className:"text-white/70 text-sm",children:(be=B.track.artists[0])==null?void 0:be.name})]}),h.jsx("div",{className:"text-white/50 text-sm",children:_n(B.played_at)})]},B.track.id)})})})]})]})};let Fi=!1;const Xh=()=>{const[e]=Kx(),t=ea(),{setCurrentUser:r,setPartnerUser:n,currentUser:s}=oe(),[i,o]=S.useState("loading"),[a,l]=S.useState("");S.useEffect(()=>{(async()=>{if(Fi){console.log("🔍 CallbackPage - Already processing globally, skipping...");return}Fi=!0,console.log("🔍 CallbackPage - Global processing flag set to TRUE");try{const u=e.get("code"),p=e.get("error");if(console.log("🔍 CallbackPage - Code:",u),console.log("🔍 CallbackPage - Error:",p),p)throw new Error("Spotify authorization was denied");if(!u)throw new Error("No authorization code received");l("Exchanging authorization code..."),console.log("🔍 CallbackPage - Exchanging code with backend...");const m=await F3("/auth/exchange",{code:u});l("Syncing your music data..."),await Et(`/users/${m.uid}/sync`,void 0,m.token),l("Loading your profile...");const[g,w,v]=await Promise.all([te(`/users/${m.uid}`),te(`/users/${m.uid}/recently-played`),te(`/users/${m.uid}/top-tracks?time_range=short_term`)]),y={user:g,accessToken:m.access_token,refreshToken:m.refresh_token,isAuthenticated:!0,recentlyPlayed:w,topTracks:v.map(x=>x.track),topArtists:[],jwt:m.token};localStorage.setItem("spotify-user",JSON.stringify(y)),s?(n(y),localStorage.setItem("spotify-partner",JSON.stringify(y)),l("Partner connected! Your musical journey begins...")):(r(y),l("Welcome! Setting up your musical journey...")),o("success"),ce.success(s?"Partner connected successfully!":"Successfully connected to Spotify!",{duration:3e3}),setTimeout(()=>{t("/"),setTimeout(()=>{Fi=!1,console.log("🔍 CallbackPage - Global processing flag set to FALSE (after success)")},1e3)},2e3)}catch(u){console.error("🔍 CallbackPage - ERROR:",u),console.error("🔍 CallbackPage - Error details:",{message:u instanceof Error?u.message:"Unknown error",stack:u instanceof Error?u.stack:void 0}),o("error"),l(u instanceof Error?u.message:"An unexpected error occurred"),ce.error("Failed to connect to Spotify. Please try again."),setTimeout(()=>{t("/"),setTimeout(()=>{Fi=!1,console.log("🔍 CallbackPage - Global processing flag set to FALSE (after error)")},1e3)},3e3)}})()},[e,t,r,n,s]);const c=()=>{switch(i){case"loading":return h.jsx(Ik,{className:"w-12 h-12 text-spotify-green animate-spin"});case"success":return h.jsx(Rk,{className:"w-12 h-12 text-green-400"});case"error":return h.jsx(Hk,{className:"w-12 h-12 text-red-400"})}},d=()=>{switch(i){case"loading":return"border-spotify-green/30";case"success":return"border-green-400/30";case"error":return"border-red-400/30"}};return h.jsx("div",{className:"min-h-screen flex items-center justify-center px-4 bg-black",children:h.jsxs(z.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"glass-fluid rounded-3xl p-10 max-w-md w-full text-center",children:[h.jsx(z.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.2,type:"spring",stiffness:200},className:`w-20 h-20 mx-auto mb-6 rounded-full border-2 flex items-center justify-center ${d()}`,children:c()}),h.jsxs(z.h2,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3},className:"text-2xl font-bold text-white mb-4",children:[i==="loading"&&"Connecting...",i==="success"&&"Success!",i==="error"&&"Connection Failed"]}),h.jsx(z.p,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.4},className:"text-white/70 mb-6",children:a}),i==="loading"&&h.jsx(z.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.5},className:"w-full bg-white/10 rounded-full h-2 mb-4",children:h.jsx(z.div,{className:"bg-spotify-green h-2 rounded-full",initial:{width:0},animate:{width:"100%"},transition:{duration:3,ease:"easeInOut"}})}),i==="error"&&h.jsx(z.button,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.5},whileHover:{scale:1.05},whileTap:{scale:.95},onClick:()=>t("/"),className:"bg-spotify-green hover:bg-spotify-green/90 text-white font-semibold py-3 px-6 rounded-lg transition-all duration-300",children:"Try Again"}),i==="success"&&h.jsx(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.5},className:"text-spotify-green text-sm",children:"Redirecting you to your musical journey..."})]})})},Vj=()=>{var g,w,v;const{currentUser:e,partnerUser:t,currentTrack:r,isPlaying:n,setCurrentTrack:s,setIsPlaying:i,theme:o}=oe(),a=en(o),[l,c]=S.useState(!1),[d,f]=S.useState(null),u=S.useMemo(()=>{const y=((e==null?void 0:e.recentlyPlayed)||[]).map(N=>({who:"you",played_at:new Date(N.played_at).getTime(),track:N.track,key:`you-${N.track.id}-${N.played_at}`})),x=((t==null?void 0:t.recentlyPlayed)||[]).map(N=>({who:"partner",played_at:new Date(N.played_at).getTime(),track:N.track,key:`partner-${N.track.id}-${N.played_at}`})),b=[...y,...x].sort((N,P)=>P.played_at-N.played_at).slice(0,30),k=new Set,C=new Set;return b.forEach(N=>{const P=N.track.id;k.has(P)?C.add(P):k.add(P)}),{items:b,overlaps:C}},[e==null?void 0:e.recentlyPlayed,t==null?void 0:t.recentlyPlayed]),p=async(y,x)=>{var b,k;if(!(e!=null&&e.accessToken)){ce.error("Not authenticated with Spotify");return}try{c(!0),f(x),n&&d===x?(await _j(e.accessToken),i(!1),s(null),f(null)):(await Aj(e.accessToken,y),i(!0),s(((k=(b=e.recentlyPlayed)==null?void 0:b.find(C=>C.track.id===x))==null?void 0:k.track)||null)),ce.success(n&&d===x?"Paused":"Now playing")}catch(C){console.error("Playback error:",C),ce.error("Failed to play track. Make sure Spotify is open on your device.")}finally{c(!1)}},m=({user:y,title:x,isPartner:b=!1})=>{var C,N,P,V,T;if(!((C=y==null?void 0:y.recentlyPlayed)!=null&&C.length))return h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"glass rounded-2xl p-8 text-center",children:[h.jsx(Ke,{className:"w-16 h-16 mx-auto mb-4 text-white/30"}),h.jsx("h3",{className:"text-xl font-semibold text-white mb-2",children:"No recent activity"}),h.jsxs("p",{className:"text-white/70",children:[b?"Your partner":"You"," haven't played any music recently"]})]});const k=y.recentlyPlayed[0];return h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"glass rounded-2xl p-6",children:[h.jsxs("div",{className:"flex items-center space-x-4 mb-6",children:[h.jsx("div",{className:`w-12 h-12 rounded-full flex items-center justify-center ${b?"bg-gradient-to-br from-pink-500 to-purple-600":"bg-gradient-to-br from-blue-500 to-cyan-600"}`,children:h.jsx(Ls,{className:"w-6 h-6 text-white"})}),h.jsxs("div",{children:[h.jsx("h2",{className:"text-2xl font-bold text-white",children:x}),h.jsxs("p",{className:"text-white/70",children:["Last played: ",_n(k.played_at)]})]})]}),h.jsx(z.div,{whileHover:{scale:1.02},className:"bg-white/5 rounded-xl p-6 mb-6 border border-white/10",children:h.jsxs("div",{className:"flex items-center space-x-4 sm:space-x-6",children:[h.jsxs("div",{className:"relative flex-shrink-0",children:[h.jsx("img",{src:((N=k.track.album.images[0])==null?void 0:N.url)||"/placeholder-album.png",alt:k.track.album.name,className:"w-16 h-16 sm:w-20 sm:h-20 rounded-lg object-cover"}),n&&d===k.track.id&&h.jsx("div",{className:"absolute inset-0 rounded-lg flex items-center justify-center",style:{backgroundColor:`${((P=a.cssVars)==null?void 0:P.primary)||"#1db954"}20`},children:h.jsx(Uk,{className:"w-6 h-6",style:{color:((V=a.cssVars)==null?void 0:V.primary)||"#1db954"}})})]}),h.jsxs("div",{className:"flex-1",children:[h.jsx("h3",{className:"text-xl font-semibold text-white mb-1",children:k.track.name}),h.jsx("p",{className:"text-white/70 mb-2",children:k.track.artists.map(O=>O.name).join(", ")}),h.jsxs("p",{className:"text-white/50 text-sm",children:[k.track.album.name," • ",Ds(k.track.duration_ms)]})]}),h.jsxs("div",{className:"flex items-center space-x-3",children:[h.jsx("button",{onClick:()=>p(k.track.external_urls.spotify,k.track.id),disabled:l,className:"w-12 h-12 rounded-full flex items-center justify-center transition-all duration-300 text-white disabled:opacity-50",style:{backgroundColor:n&&d===k.track.id?"#ef4444":((T=a.cssVars)==null?void 0:T.primary)||"#1db954"},onMouseEnter:O=>{l||(O.currentTarget.style.opacity="0.9")},onMouseLeave:O=>{l||(O.currentTarget.style.opacity="1")},children:l&&d===k.track.id?h.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):n&&d===k.track.id?h.jsx($k,{className:"w-5 h-5"}):h.jsx(Wh,{className:"w-5 h-5 ml-0.5"})}),h.jsx("a",{href:k.track.external_urls.spotify,target:"_blank",rel:"noopener noreferrer",className:"w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center transition-colors",children:h.jsx(iy,{className:"w-4 h-4 text-white"})})]})]})}),h.jsxs("div",{children:[h.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center space-x-2",children:[h.jsx(Un,{className:"w-5 h-5"}),h.jsx("span",{children:"Recent History"})]}),h.jsx("div",{className:"space-y-3",children:y.recentlyPlayed.slice(0,5).map((O,j)=>{var F,D,G;return h.jsxs(z.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:j*.1},className:"flex items-center space-x-4 p-3 rounded-lg hover:bg-white/5 transition-colors group",children:[h.jsx("img",{src:((F=O.track.album.images[0])==null?void 0:F.url)||"/placeholder-album.png",alt:O.track.album.name,className:"w-12 h-12 rounded-lg object-cover"}),h.jsxs("div",{className:"flex-1",children:[h.jsx("h4",{className:"text-white font-medium group-hover:text-spotify-green transition-colors",children:O.track.name}),h.jsx("p",{className:"text-white/70 text-sm",children:(D=O.track.artists[0])==null?void 0:D.name})]}),h.jsx("div",{className:"text-white/50 text-sm",children:_n(O.played_at)}),h.jsx("button",{onClick:()=>p(O.track.external_urls.spotify,O.track.id),disabled:l,className:"opacity-0 group-hover:opacity-100 w-8 h-8 rounded-full flex items-center justify-center transition-all disabled:opacity-50",style:{backgroundColor:((G=a.cssVars)==null?void 0:G.primary)||"#1db954"},onMouseEnter:M=>{l||(M.currentTarget.style.opacity="0.9")},onMouseLeave:M=>{l||(M.currentTarget.style.opacity="1")},children:h.jsx(Wh,{className:"w-4 h-4 text-white ml-0.5"})})]},O.track.id)})})]})]})};return h.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"mb-8",children:[h.jsxs("h1",{className:"text-4xl font-bold text-white mb-2 flex items-center space-x-3",children:[h.jsx(et,{className:"w-10 h-10",style:{color:((g=a.cssVars)==null?void 0:g.primary)||"#1db954"}}),h.jsx("span",{children:"What's Playing"})]}),h.jsx("p",{className:"text-white/70 text-lg",children:"Discover what you and your partner are listening to right now"})]}),h.jsxs("div",{className:"grid lg:grid-cols-2 gap-8",children:[e&&h.jsx(m,{user:e,title:`${(w=e.user)==null?void 0:w.display_name}'s Music`,isPartner:!1}),t&&h.jsx(m,{user:t,title:`${(v=t.user)==null?void 0:v.display_name}'s Music`,isPartner:!0}),!t&&h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"glass rounded-2xl p-8 text-center",children:[h.jsx(et,{className:"w-16 h-16 mx-auto mb-4 text-pink-400"}),h.jsx("h3",{className:"text-xl font-semibold text-white mb-2",children:"Waiting for your partner"}),h.jsx("p",{className:"text-white/70 mb-4",children:"Invite your partner to connect their Spotify account to see their music"}),h.jsx("button",{className:"bg-pink-500 hover:bg-pink-600 text-white px-6 py-3 rounded-lg transition-colors",children:"Send Invitation"})]})]}),e&&t&&h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"glass rounded-2xl p-8 mt-8",children:[h.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center space-x-2",children:[h.jsx(Un,{className:"w-5 h-5"}),h.jsx("span",{children:"Shared Timeline"})]}),h.jsx("div",{className:"space-y-3",children:u.items.map(y=>{var x,b,k,C,N;return h.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-white/5",children:[h.jsx("img",{src:((k=(b=(x=y.track.album)==null?void 0:x.images)==null?void 0:b[0])==null?void 0:k.url)||"/placeholder-album.png",alt:((C=y.track.album)==null?void 0:C.name)||"Album",className:"w-10 h-10 rounded"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-white font-medium text-sm sm:text-base truncate",children:y.track.name}),u.overlaps.has(y.track.id)&&h.jsx("span",{className:"text-pink-400 text-sm flex-shrink-0",children:"💕"})]}),h.jsx("div",{className:"text-white/70 text-xs sm:text-sm truncate",children:(N=y.track.artists)==null?void 0:N.map(P=>P.name).join(", ")})]}),h.jsxs("div",{className:"text-white/50 text-xs w-32 text-right",children:[_n(new Date(y.played_at).toISOString()),h.jsx("div",{className:"text-white/60",children:y.who==="you"?"You":"Partner"})]})]},y.key)})})]})]})},Fj=({imageUrl:e,alt:t,fallbackGradient:r})=>{const[n,s]=S.useState(null),[i,o]=S.useState(!0),[a,l]=S.useState(!1);return S.useEffect(()=>{e.startsWith("http")?(s(e),o(!1)):(async()=>{try{const d=await fetch(`${Kn}${e}`);if(d.ok){const f=await d.json();s(f.dataUrl)}else l(!0)}catch{l(!0)}finally{o(!1)}})()},[e]),i?h.jsx("div",{className:"w-full h-full bg-gradient-to-br from-gray-500 to-gray-600 flex items-center justify-center",children:h.jsx(Ke,{className:"w-8 h-8 text-white animate-pulse"})}):a||!n?h.jsx("div",{className:`w-full h-full flex items-center justify-center ${r}`,children:h.jsx(Ke,{className:"w-8 h-8 text-white"})}):h.jsx("img",{src:n,alt:t,className:"w-full h-full object-cover",onError:()=>l(!0)})};function Qh(e){var n;const t=(n=e.vibe)==null?void 0:n.toLowerCase(),r=e.genres||[];if(t)switch(t){case"energetic":return"bg-gradient-to-br from-red-500 to-orange-500";case"chill":return"bg-gradient-to-br from-blue-500 to-teal-500";case"romantic":return"bg-gradient-to-br from-pink-500 to-rose-500";case"party":return"bg-gradient-to-br from-purple-500 to-pink-500";case"workout":return"bg-gradient-to-br from-green-500 to-lime-500";case"study":return"bg-gradient-to-br from-indigo-500 to-blue-500";case"sad":return"bg-gradient-to-br from-gray-500 to-slate-500";case"happy":return"bg-gradient-to-br from-yellow-500 to-orange-500"}if(r.length>0)switch(r[0].toLowerCase()){case"pop":return"bg-gradient-to-br from-pink-500 to-purple-500";case"rock":return"bg-gradient-to-br from-red-500 to-black";case"hip-hop":case"rap":return"bg-gradient-to-br from-yellow-500 to-red-500";case"electronic":case"edm":return"bg-gradient-to-br from-cyan-500 to-blue-500";case"jazz":return"bg-gradient-to-br from-amber-500 to-orange-500";case"classical":return"bg-gradient-to-br from-slate-500 to-gray-600";case"country":return"bg-gradient-to-br from-green-600 to-yellow-600";case"r&b":return"bg-gradient-to-br from-purple-600 to-pink-600";case"indie":return"bg-gradient-to-br from-teal-500 to-green-500";case"alternative":return"bg-gradient-to-br from-gray-600 to-purple-600"}return"bg-gradient-to-br from-purple-500 to-pink-500"}const Ij=()=>{var j,F,D,G;const{currentUser:e,partnerUser:t,mixedPlaylists:r,addMixedPlaylist:n,removeMixedPlaylist:s,setMixedPlaylists:i,theme:o}=oe(),a=en(o),[l,c]=S.useState(!1),[d,f]=S.useState(!1),[u,p]=S.useState(null),[m,g]=S.useState(""),[w,v]=S.useState(""),[y,x]=S.useState(!0),[b,k]=S.useState(!1),C=w.split(",").map(M=>M.trim()).filter(M=>M.length>0);S.useEffect(()=>{(async()=>{if(e!=null&&e.jwt)try{console.log("Loading playlists from database...");const W=await te("/playlists/mixed",e.jwt);console.log("Loaded playlists:",W.playlists);const _=W.playlists.map(A=>{var R;const I=A.track_uris?JSON.parse(A.track_uris):[];return console.log("Processing playlist:",A.name,"track_uris count:",I.length,"raw track_uris:",((R=A.track_uris)==null?void 0:R.substring(0,100))+"..."),{id:A.id,name:A.name,description:A.description,tracks:[],createdAt:new Date(A.created_at),createdBy:"AI Magic ✨",spotifyId:A.creator_spotify_id,spotifyUrl:A.creator_spotify_url,partnerSpotifyId:A.partner_spotify_id,partnerSpotifyUrl:A.partner_spotify_url,vibe:A.vibe,genres:A.genres?JSON.parse(A.genres):[],trackUris:I,spotifyImageUrl:A.creator_spotify_image_url}});i(_)}catch(W){console.error("Failed to load playlists:",W)}})()},[e==null?void 0:e.jwt]);const N=async()=>{var M,W,_,A,I,R;if(!u||!((M=e==null?void 0:e.user)!=null&&M.id)){ce.error("Unable to create playlist");return}if(!(e!=null&&e.jwt)){ce.error("Please login again");return}f(!0);try{const E={partnerId:((W=t==null?void 0:t.user)==null?void 0:W.id)||e.user.id,createForBoth:!1,includeKnown:!0,name:u.name,description:u.description},H=await Et("/playlists/mixed",E,e.jwt);n({...u,spotifyId:(A=(_=H==null?void 0:H.createdFor)==null?void 0:_.creator)==null?void 0:A.playlistId,spotifyUrl:(R=(I=H==null?void 0:H.createdFor)==null?void 0:I.creator)==null?void 0:R.url}),ce.success("Playlist created on Spotify!"),p(null)}catch(E){console.error("Spotify playlist creation error:",E),ce.error("Failed to create playlist on Spotify")}finally{f(!1)}},P=async()=>{var M,W,_,A;if(!((M=e==null?void 0:e.user)!=null&&M.id)||!((W=t==null?void 0:t.user)!=null&&W.id)){ce.error("Missing users");return}if(!(e!=null&&e.jwt)){ce.error("Please login again");return}f(!0);try{const I={partnerId:t.user.id,createForBoth:b,includeKnown:y,vibe:m||void 0,genres:C.length?C:void 0,description:(u==null?void 0:u.description)||"An AI-blended mix with fresh recommendations"},R=await Et("/playlists/mixed",I,e.jwt);b&&R.createdFor.partnerError?ce.success("Your playlist created! Partner sync failed: "+R.createdFor.partnerError):b&&R.createdFor.partner?ce.success("Enhanced playlist created on both accounts!"):ce.success("Enhanced playlist created!");const E={id:R.id,name:R.name,description:I.description,tracks:[],createdAt:new Date,createdBy:"AI Magic ✨",spotifyId:R.createdFor.creator.playlistId,spotifyUrl:R.createdFor.creator.url,partnerSpotifyId:(_=R.createdFor.partner)==null?void 0:_.playlistId,partnerSpotifyUrl:(A=R.createdFor.partner)==null?void 0:A.url,vibe:I.vibe,genres:I.genres||[],trackUris:R.trackUris||[],spotifyImageUrl:R.spotifyImageUrl};n(E),p(null)}catch(I){console.error(I),ce.error("Failed to create enhanced playlist")}finally{f(!1)}},V=()=>{u&&(n(u),p(null),ce.success("Playlist saved locally!"))},T=({playlist:M,isNew:W=!1})=>{var _;return h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},whileHover:{scale:1.02},className:`glass rounded-2xl p-6 ${W?"border-spotify-green/50":"border-white/10"}`,children:[h.jsxs("div",{className:"flex items-start justify-between mb-4",children:[h.jsxs("div",{className:"flex items-center space-x-4",children:[h.jsxs("div",{className:`w-16 h-16 rounded-xl flex items-center justify-center overflow-hidden flex-shrink-0 ${W?"bg-gradient-to-br from-spotify-green to-green-600":"bg-gradient-to-br from-purple-500 to-pink-500"}`,children:[W?h.jsx(Nr,{className:"w-8 h-8 text-white"}):M.spotifyImageUrl?h.jsx(Fj,{imageUrl:M.spotifyImageUrl,alt:M.name,fallbackGradient:Qh(M)}):null,!W&&h.jsx("div",{className:`w-full h-full flex items-center justify-center ${M.spotifyImageUrl?"bg-gradient-to-br from-purple-500 to-pink-500":Qh(M)}`,style:{display:M.spotifyImageUrl?"none":"flex"},children:h.jsx(Ke,{className:"w-8 h-8 text-white"})})]}),h.jsxs("div",{children:[h.jsx("h3",{className:"text-xl font-semibold text-white",children:M.name}),h.jsx("p",{className:"text-white/70 text-sm",children:M.description}),h.jsxs("div",{className:"flex flex-wrap gap-1 mt-1 mb-1",children:[M.vibe&&h.jsx("span",{className:"px-2 py-0.5 bg-blue-500/20 text-blue-300 text-xs rounded-full",children:M.vibe}),M.genres&&M.genres.length>0&&M.genres.slice(0,2).map((A,I)=>h.jsx("span",{className:"px-2 py-0.5 bg-green-500/20 text-green-300 text-xs rounded-full",children:A},I))]}),h.jsxs("p",{className:"text-white/50 text-xs",children:["Created ",W?"just now":new Date(M.createdAt).toLocaleDateString()," • ",M.tracks.length||((_=M.trackUris)==null?void 0:_.length)||0," tracks"]})]})]}),h.jsxs("div",{className:"flex items-center space-x-2",children:[M.spotifyUrl&&h.jsx("a",{href:M.spotifyUrl,target:"_blank",rel:"noopener noreferrer",className:"w-8 h-8 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center transition-colors",title:"Open in Spotify",children:h.jsx(iy,{className:"w-4 h-4 text-white"})}),M.partnerSpotifyUrl&&h.jsx("a",{href:M.partnerSpotifyUrl,target:"_blank",rel:"noopener noreferrer",className:"w-8 h-8 rounded-full bg-pink-500/20 hover:bg-pink-500/30 flex items-center justify-center transition-colors",title:"Partner's playlist in Spotify",children:h.jsx(et,{className:"w-4 h-4 text-pink-400"})}),!W&&h.jsx("button",{onClick:async()=>{try{e!=null&&e.jwt&&await I3(`/playlists/mixed/${M.id}`,e.jwt),s(M.id),ce.success("Playlist deleted successfully")}catch(A){console.error("Failed to delete playlist:",A),ce.error("Failed to delete playlist")}},className:"w-8 h-8 rounded-full bg-red-500/20 hover:bg-red-500/30 flex items-center justify-center transition-colors",children:h.jsx(ly,{className:"w-4 h-4 text-red-400"})})]})]}),h.jsx("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:M.tracks.length>0?h.jsxs(h.Fragment,{children:[M.tracks.slice(0,5).map((A,I)=>{var R,E,H,X,ee,q;return h.jsxs(z.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:I*.1},className:"flex items-center space-x-3 p-2 rounded-lg hover:bg-white/5 transition-colors",children:[h.jsx("img",{src:((H=(E=(R=A.album)==null?void 0:R.images)==null?void 0:E[0])==null?void 0:H.url)||"/placeholder-album.png",alt:((X=A.album)==null?void 0:X.name)||"Unknown Album",className:"w-10 h-10 rounded-lg object-cover"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("h4",{className:"text-white font-medium truncate",children:A.name}),h.jsx("p",{className:"text-white/70 text-sm truncate",children:((q=(ee=A.artists)==null?void 0:ee[0])==null?void 0:q.name)||"Unknown Artist"})]}),h.jsx("div",{className:"text-white/50 text-sm",children:Ds(A.duration_ms)})]},A.id)}),M.tracks.length>5&&h.jsxs("div",{className:"text-center text-white/50 text-sm py-2",children:["+",M.tracks.length-5," more tracks"]})]}):M.trackUris&&M.trackUris.length>0?h.jsx("div",{className:"text-center py-4"}):h.jsx("div",{className:"text-center text-white/50 text-sm py-4",children:"No tracks available"})}),W&&h.jsxs("div",{className:"flex items-center space-x-3 mt-6 pt-4 border-t border-white/10",children:[h.jsx("button",{onClick:N,disabled:d||b,className:"flex-1 bg-spotify-green hover:bg-spotify-green/90 text-white font-semibold py-3 px-4 rounded-lg transition-colors flex items-center justify-center space-x-2 disabled:opacity-50",children:d?h.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):h.jsxs(h.Fragment,{children:[h.jsx(Uc,{className:"w-4 h-4"}),h.jsx("span",{children:b?"Disabled (using Create for both)":"Create on Spotify"})]})}),h.jsx("button",{onClick:V,className:"px-4 py-3 bg-white/10 hover:bg-white/20 text-white rounded-lg transition-colors",children:"Save Locally"})]})]})},O=(e==null?void 0:e.topTracks)&&(t==null?void 0:t.topTracks);return h.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"mb-8",children:[h.jsxs("h1",{className:"text-4xl font-bold text-white mb-2 flex items-center space-x-3",children:[h.jsx(Nr,{className:"w-10 h-10",style:{color:((j=a.cssVars)==null?void 0:j.primary)||"#1db954"}}),h.jsx("span",{children:"Mixed Playlists"})]}),h.jsx("p",{className:"text-white/70 text-lg",children:"AI-powered playlists that perfectly blend your musical tastes together"})]}),O&&h.jsx(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"mb-8",children:h.jsxs("div",{className:"glass rounded-2xl p-8 text-center",style:{borderColor:`${((F=a.cssVars)==null?void 0:F.primary)||"#1db954"}30`},children:[h.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full flex items-center justify-center",style:{background:`linear-gradient(135deg, ${((D=a.cssVars)==null?void 0:D.primary)||"#1db954"} 0%, ${((G=a.cssVars)==null?void 0:G.secondary)||"#1ed760"} 100%)`},children:h.jsx(Wk,{className:"w-8 h-8 text-white"})}),h.jsx("h2",{className:"text-2xl font-bold text-white mb-2",children:"Create Your Perfect Mix"}),h.jsx("p",{className:"text-white/70 mb-6 max-w-2xl mx-auto",children:"Our AI analyzes both your music tastes and creates a playlist that represents your unique musical connection"}),h.jsxs("div",{className:"mt-4 text-white/50 text-sm",children:["Analyzing ",e.topTracks.length+t.topTracks.length," tracks from both users"]}),h.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 text-left mt-8",children:[h.jsxs("div",{children:[h.jsx("label",{className:"block text-white/80 text-sm mb-1",children:"Vibe"}),h.jsxs("select",{className:"w-full bg-white/10 text-white rounded-lg p-2 appearance-none focus:outline-none focus:ring-2 focus:ring-spotify-green",value:m,onChange:M=>g(M.target.value),style:{backgroundColor:"rgba(255, 255, 255, 0.1)",color:"rgba(255, 255, 255, 0.9)"},children:[h.jsx("option",{value:"",style:{backgroundColor:"rgba(30, 30, 30, 0.95)",color:"rgba(255, 255, 255, 0.9)"},children:"Auto"}),h.jsx("option",{value:"energetic",style:{backgroundColor:"rgba(30, 30, 30, 0.95)",color:"rgba(255, 255, 255, 0.9)"},children:"Energetic"}),h.jsx("option",{value:"chill",style:{backgroundColor:"rgba(30, 30, 30, 0.95)",color:"rgba(255, 255, 255, 0.9)"},children:"Chill"}),h.jsx("option",{value:"happy",style:{backgroundColor:"rgba(30, 30, 30, 0.95)",color:"rgba(255, 255, 255, 0.9)"},children:"Happy"}),h.jsx("option",{value:"sad",style:{backgroundColor:"rgba(30, 30, 30, 0.95)",color:"rgba(255, 255, 255, 0.9)"},children:"Sad"}),h.jsx("option",{value:"party",style:{backgroundColor:"rgba(30, 30, 30, 0.95)",color:"rgba(255, 255, 255, 0.9)"},children:"Party"}),h.jsx("option",{value:"focus",style:{backgroundColor:"rgba(30, 30, 30, 0.95)",color:"rgba(255, 255, 255, 0.9)"},children:"Focus"})]})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-white/80 text-sm mb-1",children:"Genres (comma-separated)"}),h.jsx("input",{className:"w-full bg-white/10 text-white rounded-lg p-2 placeholder-white/60 focus:outline-none focus:ring-2 focus:ring-spotify-green",placeholder:"pop, rock, edm",value:w,onChange:M=>v(M.target.value)})]}),h.jsxs("label",{className:"flex items-center space-x-2 text-white/80",children:[h.jsx("input",{type:"checkbox",checked:y,onChange:M=>x(M.target.checked)}),h.jsx("span",{children:"Include songs we already know"})]}),h.jsxs("label",{className:"flex items-center space-x-2 text-white/80",children:[h.jsx("input",{type:"checkbox",checked:b,onChange:M=>k(M.target.checked)}),h.jsx("span",{children:"Create playlist on both accounts"}),b&&h.jsx("span",{className:"text-xs text-pink-400 ml-2",children:"✨ Synced"})]})]}),h.jsx("div",{className:"flex items-center justify-center gap-3 mt-6",children:h.jsx("button",{onClick:P,disabled:d,className:"bg-white/10 hover:bg-white/20 text-white font-semibold py-3 px-4 rounded-lg transition-colors disabled:opacity-50",children:"Create Enhanced Playlist"})})]})}),u&&h.jsxs(z.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"mb-8",children:[h.jsx("h2",{className:"text-2xl font-bold text-white mb-4",children:"✨ Your New Playlist"}),h.jsx(T,{playlist:u,isNew:!0})]}),r.length>0&&h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3},children:[h.jsx("h2",{className:"text-2xl font-bold text-white mb-4",children:"Your Mixed Playlists"}),h.jsx("div",{className:"grid gap-6",children:r.map(M=>h.jsx(T,{playlist:M},M.id))})]}),!O&&h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"glass rounded-2xl p-12 text-center",children:[h.jsx(et,{className:"w-16 h-16 mx-auto mb-4 text-pink-400"}),h.jsx("h3",{className:"text-xl font-semibold text-white mb-2",children:t?"Loading music data":"Waiting for your partner"}),h.jsx("p",{className:"text-white/70",children:t?"We need to analyze both your music tastes to create the perfect mixed playlist":"Invite your partner to connect their Spotify account to start creating mixed playlists"})]}),r.length===0&&O&&!u&&h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"glass rounded-2xl p-12 text-center",children:[h.jsx(Ke,{className:"w-16 h-16 mx-auto mb-4 text-white/30"}),h.jsx("h3",{className:"text-xl font-semibold text-white mb-2",children:"No playlists yet"}),h.jsx("p",{className:"text-white/70",children:"Create your first mixed playlist to start your musical journey together"})]})]})},zj=()=>{const{currentUser:e,partnerUser:t,memoryLane:r,addMemoryLaneItem:n}=oe(),[s,i]=S.useState(!1),[o,a]=S.useState({title:"",description:"",type:"milestone"});S.useEffect(()=>{var u,p,m,g,w,v,y,x,b,k,C,N;e&&t&&r.length===0&&[{id:"1",type:"milestone",title:"First Musical Connection",description:`${(u=e.user)==null?void 0:u.display_name} and ${(p=t.user)==null?void 0:p.display_name} discovered their shared love for music`,date:new Date(Date.now()-6048e5),users:[((m=e.user)==null?void 0:m.id)||"",((g=t.user)==null?void 0:g.id)||""]},{id:"2",type:"shared_track",title:"Shared Love for This Song",description:`Both of you have been listening to "${((v=(w=e.recentlyPlayed)==null?void 0:w[0])==null?void 0:v.track.name)||"Your favorite track"}" recently`,track:(x=(y=e.recentlyPlayed)==null?void 0:y[0])==null?void 0:x.track,date:new Date(Date.now()-2592e5),users:[((b=e.user)==null?void 0:b.id)||"",((k=t.user)==null?void 0:k.id)||""]},{id:"3",type:"playlist_created",title:"Our First Mixed Playlist",description:"Created a beautiful blend of your musical tastes",date:new Date(Date.now()-864e5),users:[((C=e.user)==null?void 0:C.id)||"",((N=t.user)==null?void 0:N.id)||""]}].forEach(V=>{n(V)})},[e,t,r.length,n]);const l=()=>{var p,m;if(!o.title.trim()||!o.description.trim()){ce.error("Please fill in both title and description");return}const u={id:Date.now().toString(),...o,date:new Date,users:[((p=e==null?void 0:e.user)==null?void 0:p.id)||"",((m=t==null?void 0:t.user)==null?void 0:m.id)||""]};n(u),a({title:"",description:"",type:"milestone"}),i(!1),ce.success("Memory added to your journey!")},c=u=>{switch(u){case"shared_track":return h.jsx(Ke,{className:"w-5 h-5"});case"playlist_created":return h.jsx(Nr,{className:"w-5 h-5"});case"milestone":return h.jsx(ay,{className:"w-5 h-5"});default:return h.jsx(et,{className:"w-5 h-5"})}},d=u=>{switch(u){case"shared_track":return"from-blue-500 to-cyan-500";case"playlist_created":return"from-purple-500 to-pink-500";case"milestone":return"from-yellow-500 to-orange-500";default:return"from-pink-500 to-red-500"}},f=({memory:u,index:p})=>{var m,g;return h.jsxs(z.div,{initial:{opacity:0,x:-50},animate:{opacity:1,x:0},transition:{delay:p*.1},className:"relative",children:[pi(!0),className:"bg-gradient-to-r from-pink-500 to-red-500 hover:from-pink-600 hover:to-red-600 text-white font-semibold py-3 px-6 rounded-xl transition-all duration-300 flex items-center space-x-2",children:[h.jsx(Uc,{className:"w-5 h-5"}),h.jsx("span",{children:"Add Memory"})]})]})}),s&&h.jsx(z.div,{initial:{opacity:0},animate:{opacity:1},className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",onClick:()=>i(!1),children:h.jsxs(z.div,{initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},onClick:u=>u.stopPropagation(),className:"glass rounded-2xl p-8 max-w-md w-full",children:[h.jsx("h3",{className:"text-2xl font-bold text-white mb-6",children:"Add a New Memory"}),h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"block text-white/70 text-sm font-medium mb-2",children:"Title"}),h.jsx("input",{type:"text",value:o.title,onChange:u=>a({...o,title:u.target.value}),className:"w-full px-4 py-3 bg-white/10 border border-white/20 rounded-lg text-white placeholder-white/50 focus:outline-none focus:border-spotify-green",placeholder:"What's this memory about?"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-white/70 text-sm font-medium mb-2",children:"Description"}),h.jsx("textarea",{value:o.description,onChange:u=>a({...o,description:u.target.value}),className:"w-full px-4 py-3 bg-white/10 border border-white/20 rounded-lg text-white placeholder-white/50 focus:outline-none focus:border-spotify-green h-24 resize-none",placeholder:"Tell the story of this memory..."})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-white/70 text-sm font-medium mb-2",children:"Type"}),h.jsxs("select",{value:o.type,onChange:u=>a({...o,type:u.target.value}),className:"w-full px-4 py-3 bg-white/10 border border-white/20 rounded-lg text-white focus:outline-none focus:border-spotify-green",style:{backgroundColor:"rgba(255, 255, 255, 0.1)",color:"rgba(255, 255, 255, 0.9)"},children:[h.jsx("option",{value:"milestone",style:{backgroundColor:"rgba(30, 30, 30, 0.95)",color:"rgba(255, 255, 255, 0.9)"},children:"Milestone"}),h.jsx("option",{value:"shared_track",style:{backgroundColor:"rgba(30, 30, 30, 0.95)",color:"rgba(255, 255, 255, 0.9)"},children:"Shared Track"}),h.jsx("option",{value:"playlist_created",style:{backgroundColor:"rgba(30, 30, 30, 0.95)",color:"rgba(255, 255, 255, 0.9)"},children:"Playlist Created"})]})]})]}),h.jsxs("div",{className:"flex items-center space-x-3 mt-6",children:[h.jsx("button",{onClick:l,className:"flex-1 bg-spotify-green hover:bg-spotify-green/90 text-white font-semibold py-3 px-4 rounded-lg transition-colors",children:"Add Memory"}),h.jsx("button",{onClick:()=>i(!1),className:"px-4 py-3 bg-white/10 hover:bg-white/20 text-white rounded-lg transition-colors",children:"Cancel"})]})]})}),h.jsx("div",{className:"space-y-8",children:r.length>0?r.map((u,p)=>h.jsx(f,{memory:u,index:p},u.id)):h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"glass rounded-2xl p-12 text-center",children:[h.jsx(Dk,{className:"w-16 h-16 mx-auto mb-4 text-white/30"}),h.jsx("h3",{className:"text-xl font-semibold text-white mb-2",children:"No memories yet"}),h.jsx("p",{className:"text-white/70 mb-6",children:"Start creating beautiful musical memories together"}),h.jsx("button",{onClick:()=>i(!0),className:"bg-gradient-to-r from-pink-500 to-red-500 hover:from-pink-600 hover:to-red-600 text-white font-semibold py-3 px-6 rounded-xl transition-all duration-300",children:"Create First Memory"})]})}),r.length>0&&h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.5},className:"mt-12 grid grid-cols-1 md:grid-cols-3 gap-6",children:[h.jsxs("div",{className:"glass rounded-2xl p-6 text-center",children:[h.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-gradient-to-br from-pink-500 to-red-500 rounded-full flex items-center justify-center",children:h.jsx(et,{className:"w-6 h-6 text-white"})}),h.jsx("h4",{className:"text-2xl font-bold text-white mb-1",children:r.length}),h.jsx("p",{className:"text-white/70 text-sm",children:"Memories Created"})]}),h.jsxs("div",{className:"glass rounded-2xl p-6 text-center",children:[h.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-gradient-to-br from-blue-500 to-cyan-500 rounded-full flex items-center justify-center",children:h.jsx(Ke,{className:"w-6 h-6 text-white"})}),h.jsx("h4",{className:"text-2xl font-bold text-white mb-1",children:r.filter(u=>u.type==="shared_track").length}),h.jsx("p",{className:"text-white/70 text-sm",children:"Shared Tracks"})]}),h.jsxs("div",{className:"glass rounded-2xl p-6 text-center",children:[h.jsx("div",{className:"w-12 h-12 mx-auto mb-3 bg-gradient-to-br from-purple-500 to-pink-500 rounded-full flex items-center justify-center",children:h.jsx(Nr,{className:"w-6 h-6 text-white"})}),h.jsx("h4",{className:"text-2xl font-bold text-white mb-1",children:r.filter(u=>u.type==="playlist_created").length}),h.jsx("p",{className:"text-white/70 text-sm",children:"Playlists Created"})]})]})]})};function Oj(e,t){if(!e||!t)return 0;const r=["energy","valence"];let n=0,s=0;for(const i of r)typeof e[i]=="number"&&typeof t[i]=="number"&&(n+=1-Math.min(1,Math.abs(e[i]-t[i])),s++);return s?Math.round(n/s*100):0}const $j=()=>{var u,p;const{currentUser:e,partnerUser:t}=oe(),[r,n]=S.useState(null),[s,i]=S.useState(null),[o,a]=S.useState(null),[l,c]=S.useState(null);S.useEffect(()=>{let m;const g=async()=>{var w,v,y,x;try{const b=(w=e==null?void 0:e.user)==null?void 0:w.id;if(b){const C=await te(`/users/${b}/now-playing`);n(C);const N=(v=C==null?void 0:C.item)==null?void 0:v.id;if(N){const P=await te(`/users/${b}/audio-features?ids=${N}`);a(((P==null?void 0:P.audio_features)||[])[0]||null)}}const k=(y=t==null?void 0:t.user)==null?void 0:y.id;if(k){const C=await te(`/users/${k}/now-playing`);i(C);const N=(x=C==null?void 0:C.item)==null?void 0:x.id;if(N){const P=await te(`/users/${k}/audio-features?ids=${N}`);c(((P==null?void 0:P.audio_features)||[])[0]||null)}}}catch{}m=setTimeout(g,8e3)};return g(),()=>clearTimeout(m)},[(u=e==null?void 0:e.user)==null?void 0:u.id,(p=t==null?void 0:t.user)==null?void 0:p.id]);const d=S.useMemo(()=>Oj(o,l),[o,l]),f=({data:m,who:g})=>{var v,y,x;if(!(m!=null&&m.is_playing)||!(m!=null&&m.item))return h.jsxs("div",{className:"glass rounded-2xl p-6 text-white/70",children:[g," is not playing"]});const w=m.item;return h.jsxs("div",{className:"glass rounded-2xl p-6 flex items-center gap-4",children:[h.jsx("img",{src:((x=(y=(v=w==null?void 0:w.album)==null?void 0:v.images)==null?void 0:y[0])==null?void 0:x.url)||"/placeholder-album.png",alt:w==null?void 0:w.name,className:"w-16 h-16 rounded"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("div",{className:"text-white font-semibold truncate",children:w==null?void 0:w.name}),h.jsx("div",{className:"text-white/70 text-sm truncate",children:((w==null?void 0:w.artists)||[]).map(b=>b.name).join(", ")})]}),h.jsx("div",{className:"flex gap-1",children:[...Array(12)].map((b,k)=>h.jsx("div",{className:"w-1 bg-spotify-green/60 animate-pulse",style:{height:`${(Math.sin(k)*.5+.5)*32+8}px`,animationDelay:`${k*50}ms`}},k))})]})};return h.jsxs("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"mb-6",children:[h.jsx("h1",{className:"text-3xl font-bold text-white",children:"Live Dashboard"}),h.jsx("p",{className:"text-white/70",children:"See what you are both playing right now"})]}),h.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[h.jsx(f,{data:r,who:"You"}),h.jsx(f,{data:s,who:"Partner"})]}),(r==null?void 0:r.is_playing)&&(s==null?void 0:s.is_playing)&&h.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"glass rounded-2xl p-6 mt-6 text-center",children:[h.jsx("div",{className:"text-white/80",children:"Harmony Match"}),h.jsxs("div",{className:"text-4xl font-extrabold text-white mt-1",children:[d,"%"]})]})]})},Bj=()=>{var N,P,V,T,O;const{currentUser:e,partnerUser:t,theme:r}=oe(),n=en(r),[s,i]=S.useState(null),[o,a]=S.useState(!1),[l,c]=S.useState(0),[d,f]=S.useState("all"),[u,p]=S.useState({}),g=s?(j=>{var W,_;const F=[],D=new Date(j.dataCollectionStart),G=Math.floor((Date.now()-j.dataCollectionStart)/(1e3*60*60*24)),M=Math.floor(j.totalListeningTime/(1e3*60*60));if(F.push({id:"intro",type:"intro",title:"Your Music Wrapped",subtitle:`${j.timeRange==="all"?"All Time":j.timeRange.charAt(0).toUpperCase()+j.timeRange.slice(1)} Edition`,gradient:"from-purple-500 via-pink-500 to-red-500",data:{totalTracks:j.totalTracks,hoursListened:M,daysSinceStart:G,startDate:D.toLocaleDateString()}}),F.push({id:"dataStart",type:"intro",title:"Your Musical Journey",subtitle:`Started ${D.toLocaleDateString()}`,gradient:"from-blue-500 via-purple-500 to-pink-500",data:{hoursListened:M,daysSinceStart:G,averagePerDay:G>0?Math.round(j.totalTracks/G):0}}),j.topSongs.length>0&&F.push({id:"topSongs",type:"topSongs",title:"Your Top Songs",subtitle:`You played ${((W=j.topSongs[0])==null?void 0:W.playCount)||0} times`,gradient:"from-green-400 via-blue-500 to-purple-600",data:j.topSongs.slice(0,5)}),j.topArtists.length>0&&F.push({id:"topArtists",type:"topArtists",title:"Your Top Artists",subtitle:`${((_=j.topArtists[0])==null?void 0:_.name)||"Unknown"} was your #1`,gradient:"from-yellow-400 via-red-500 to-pink-500",data:j.topArtists.slice(0,5)}),F.push({id:"listeningHabits",type:"listeningPatterns",title:"Your Listening Habits",subtitle:"When you vibe the most",gradient:"from-teal-400 via-green-500 to-blue-500",data:{mostActiveHour:j.listeningPatterns.mostActiveHour,mostActiveDay:j.listeningPatterns.mostActiveDay,listeningStreak:j.listeningPatterns.listeningStreak,lateNight:j.uniqueCategories.lateNightListener,earlyBird:j.uniqueCategories.earlyBird,weekendWarrior:j.uniqueCategories.weekendWarrior}}),F.push({id:"discovery",type:"listeningPatterns",title:"Music Explorer",subtitle:"Your discovery journey",gradient:"from-indigo-500 via-purple-500 to-pink-500",data:{discoveryRate:j.uniqueCategories.discoveryRate,averageSongLength:j.uniqueCategories.averageSongLength,listeningVelocity:j.uniqueCategories.listeningVelocity}}),j.uniqueCategories.longestSession.duration>0&&F.push({id:"longestSession",type:"listeningTime",title:"Your Longest Session",subtitle:"When you couldn't stop listening",gradient:"from-orange-400 via-red-500 to-pink-500",data:{totalTime:j.uniqueCategories.longestSession.duration,totalTracks:Math.floor(j.uniqueCategories.longestSession.duration/(j.uniqueCategories.averageSongLength||18e4)),averagePerTrack:j.uniqueCategories.averageSongLength||18e4}}),j.uniqueCategories.mostDiverseDay.artistCount>0&&F.push({id:"mostDiverseDay",type:"listeningPatterns",title:"Your Most Diverse Day",subtitle:"When you explored the most",gradient:"from-cyan-400 via-blue-500 to-indigo-600",data:{date:j.uniqueCategories.mostDiverseDay.date,artistCount:j.uniqueCategories.mostDiverseDay.artistCount}}),j.partnerData){F.push({id:"partnerComparison",type:"listeningTime",title:"You vs Your Partner",subtitle:"Musical journey together",gradient:"from-pink-400 via-purple-500 to-indigo-500",data:{yourTracks:j.totalTracks,partnerTracks:j.partnerData.totalTracks,yourTime:j.totalListeningTime,partnerTime:j.partnerData.totalListeningTime}});const A=new Set(j.topArtists.slice(0,10).map(E=>E.id)),I=new Set(j.partnerData.topArtists.map(E=>E.id)),R=Array.from(A).filter(E=>I.has(E));R.length>0&&F.push({id:"sharedTaste",type:"topArtists",title:"Your Shared Taste",subtitle:`${R.length} artists you both love`,gradient:"from-green-400 via-teal-500 to-blue-500",data:{sharedArtists:R.length}})}return F.push({id:"listeningTime",type:"listeningTime",title:"Total Listening Time",subtitle:"You've been on a musical journey",gradient:"from-orange-400 via-red-500 to-pink-500",data:{totalTime:j.totalListeningTime,totalTracks:j.totalTracks,averagePerTrack:j.totalTracks>0?j.totalListeningTime/j.totalTracks:0}}),F.push({id:"outro",type:"outro",title:"Thanks for Listening!",subtitle:"Keep discovering amazing music",gradient:"from-purple-500 via-pink-500 to-red-500",data:{generatedAt:j.generatedAt}}),F})(s):[],w=async j=>{var D;if(!((D=e==null?void 0:e.user)!=null&&D.id)||!(e!=null&&e.jwt))return;const F=j.map(async G=>{try{const M=await te(`/users/${e.user.id}/artist/${G.id}`,e.jwt);M.images&&M.images.length>0&&p(W=>({...W,[G.id]:M.images[0].url}))}catch(M){console.error(`Failed to fetch image for artist ${G.name}:`,M)}});await Promise.all(F)},v=async(j="all")=>{var F;if(!(!((F=e==null?void 0:e.user)!=null&&F.id)||!(e!=null&&e.jwt))){a(!0);try{const D=await te(`/users/${e.user.id}/wrapped?range=${j}`,e.jwt);i(D),c(0),D.topArtists&&D.topArtists.length>0&&w(D.topArtists)}catch(D){console.error("Failed to fetch wrapped data:",D),ce.error("Failed to load your music wrapped")}finally{a(!1)}}};S.useEffect(()=>{v(d)},[d,(N=e==null?void 0:e.user)==null?void 0:N.id,e==null?void 0:e.jwt]);const y=()=>{c(j=>(j+1)%g.length)},x=()=>{c(j=>(j-1+g.length)%g.length)},b=j=>{const F=Math.floor(j/36e5),D=Math.floor(j%(1e3*60*60)/(1e3*60));return`${F}h ${D}m`},k=j=>j===0?"12 AM":j<12?`${j} AM`:j===12?"12 PM":`${j-12} PM`,C=j=>{var D,G,M,W,_,A,I,R,E,H,X,ee,q,me,Rr,_t,St,Qe,on,Qn,B,le,ye,be,Fe,Lt,Zn,an,Zt,qc;const F="w-full h-full flex flex-col items-center justify-center text-center p-3 sm:p-6 overflow-y-auto";switch(j.type){case"intro":return h.jsx("div",{className:`${F} relative`,children:h.jsxs(z.div,{initial:{scale:.5,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.8,ease:"easeOut"},className:"relative z-10 space-y-6",children:[h.jsx(Ke,{className:"w-16 h-16 sm:w-20 sm:h-20 lg:w-24 lg:h-24 mx-auto text-white/90"}),h.jsx("h1",{className:"text-3xl sm:text-5xl lg:text-6xl font-bold text-white mb-4",children:j.title}),h.jsx("p",{className:"text-lg sm:text-xl lg:text-2xl text-white/80 mb-8",children:j.subtitle}),((D=j.data)==null?void 0:D.hoursListened)&&h.jsxs("div",{className:"text-2xl sm:text-4xl lg:text-5xl font-bold text-white mb-4",children:[j.data.hoursListened," hours listened"]}),((G=j.data)==null?void 0:G.daysSinceStart)&&h.jsxs("div",{className:"text-lg text-white/70",children:["Since ",j.data.startDate," (",j.data.daysSinceStart," days ago)"]}),((M=j.data)==null?void 0:M.totalTracks)&&h.jsxs("div",{className:"text-2xl text-white/90",children:[j.data.totalTracks," songs played"]})]})});case"topSongs":return h.jsx("div",{className:`${F} relative`,children:h.jsxs(z.div,{initial:{y:50,opacity:0},animate:{y:0,opacity:1},transition:{duration:.6},className:"w-full max-w-3xl relative z-10",children:[h.jsx("h2",{className:"text-3xl sm:text-4xl lg:text-5xl font-bold text-white mb-2",children:j.title}),h.jsx("p",{className:"text-lg sm:text-lg lg:text-xl text-white/80 mb-8",children:j.subtitle}),h.jsx("div",{className:"space-y-3",children:(W=j.data)==null?void 0:W.map((Ie,Jn)=>{var Gc,Yc,Kc,Xc,Qc,Zc;return h.jsxs(z.div,{initial:{x:-100,opacity:0},animate:{x:0,opacity:1},transition:{delay:Jn*.2,duration:.5},className:"flex items-center justify-between bg-white/10 backdrop-blur-md rounded-2xl p-4 border border-white/20",children:[h.jsxs("div",{className:"flex items-center space-x-4",children:[h.jsx("div",{className:"w-10 h-10 bg-white/20 rounded-full flex items-center justify-center text-white font-bold text-lg",children:Jn+1}),h.jsx("img",{src:((Kc=(Yc=(Gc=Ie.album)==null?void 0:Gc.images)==null?void 0:Yc[0])==null?void 0:Kc.url)||"/placeholder-album.png",alt:(Xc=Ie.album)==null?void 0:Xc.name,className:"w-12 h-12 rounded-lg object-cover"}),h.jsxs("div",{className:"text-left",children:[h.jsx("h3",{className:"text-lg font-semibold text-white",children:Ie.name}),h.jsx("p",{className:"text-white/70 text-sm",children:(Zc=(Qc=Ie.artists)==null?void 0:Qc[0])==null?void 0:Zc.name})]})]}),h.jsxs("div",{className:"text-right",children:[h.jsxs("div",{className:"text-white font-bold",children:[Ie.playCount," plays"]}),h.jsx("div",{className:"text-white/70 text-sm",children:Ds(Ie.duration_ms)})]})]},Ie.id)})})]})});case"topArtists":return h.jsx("div",{className:`${F} relative`,children:h.jsxs(z.div,{initial:{y:50,opacity:0},animate:{y:0,opacity:1},transition:{duration:.6},className:"w-full max-w-4xl relative z-10",children:[h.jsx("h2",{className:"text-3xl sm:text-4xl lg:text-5xl font-bold text-white mb-2",children:j.title}),h.jsx("p",{className:"text-lg sm:text-lg lg:text-xl text-white/80 mb-8",children:j.subtitle}),h.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:(_=j.data)==null?void 0:_.map((Ie,Jn)=>h.jsxs(z.div,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},transition:{delay:Jn*.1,duration:.5},className:"bg-white/10 backdrop-blur-md rounded-2xl p-6 text-center border border-white/20",children:[h.jsx("div",{className:"w-20 h-20 mx-auto mb-4 rounded-full overflow-hidden border-2 border-white/20",children:u[Ie.id]?h.jsx("img",{src:u[Ie.id],alt:Ie.name,className:"w-full h-full object-cover"}):h.jsx("div",{className:"w-full h-full bg-white/20 flex items-center justify-center text-white font-bold text-xl",children:Jn+1})}),h.jsx("h3",{className:"text-xl font-bold text-white mb-2",children:Ie.name}),h.jsxs("p",{className:"text-white/70",children:[Ie.playCount," plays"]}),h.jsx("p",{className:"text-white/60 text-sm",children:b(Ie.totalDuration)})]},Ie.id))})]})});case"listeningTime":return h.jsx("div",{className:`${F} relative`,children:h.jsxs(z.div,{initial:{scale:.5,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.8,ease:"easeOut"},className:"space-y-6 relative z-10",children:[h.jsx(Un,{className:"w-16 h-16 sm:w-20 sm:h-20 lg:w-24 lg:h-24 mx-auto text-white/90"}),h.jsx("h2",{className:"text-3xl sm:text-5xl lg:text-6xl font-bold text-white mb-4",children:j.title}),h.jsx("p",{className:"text-lg sm:text-xl lg:text-2xl text-white/80 mb-8",children:j.subtitle}),h.jsx("div",{className:"text-4xl sm:text-6xl lg:text-7xl font-bold text-white mb-8",children:b(((A=j.data)==null?void 0:A.totalTime)||((I=j.data)==null?void 0:I.duration)||0)}),h.jsxs("div",{className:"grid grid-cols-2 gap-6 text-center",children:[h.jsxs("div",{className:"bg-white/10 backdrop-blur-md rounded-2xl p-6 border border-white/20",children:[h.jsx("div",{className:"text-3xl font-bold text-white",children:((R=j.data)==null?void 0:R.totalTracks)||0}),h.jsx("div",{className:"text-white/70",children:"Total Songs"})]}),h.jsxs("div",{className:"bg-white/10 backdrop-blur-md rounded-2xl p-6 border border-white/20",children:[h.jsx("div",{className:"text-3xl font-bold text-white",children:Ds(((E=j.data)==null?void 0:E.averagePerTrack)||0)}),h.jsx("div",{className:"text-white/70",children:"Avg per Song"})]})]})]})});case"listeningPatterns":return h.jsx("div",{className:`${F} relative`,children:h.jsxs(z.div,{initial:{y:50,opacity:0},animate:{y:0,opacity:1},transition:{duration:.6},className:"w-full max-w-4xl relative z-10",children:[h.jsx("h2",{className:"text-3xl sm:text-4xl lg:text-5xl font-bold text-white mb-2",children:j.title}),h.jsx("p",{className:"text-lg sm:text-lg lg:text-xl text-white/80 mb-8",children:j.subtitle}),h.jsxs("div",{className:`grid gap-6 justify-items-center ${((H=j.data)==null?void 0:H.artistCount)!==void 0&&!((X=j.data)!=null&&X.mostActiveHour)&&!((ee=j.data)!=null&&ee.mostActiveDay)&&!((q=j.data)!=null&&q.listeningStreak)&&!((me=j.data)!=null&&me.lateNight)&&!((Rr=j.data)!=null&&Rr.earlyBird)&&!((_t=j.data)!=null&&_t.weekendWarrior)&&!((St=j.data)!=null&&St.discoveryRate)&&!((Qe=j.data)!=null&&Qe.listeningVelocity)&&!((on=j.data)!=null&&on.averageSongLength)?"grid-cols-1 justify-center":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:[((Qn=j.data)==null?void 0:Qn.mostActiveHour)!==void 0&&h.jsxs("div",{className:"bg-white/10 backdrop-blur-md rounded-2xl p-6 text-center border border-white/20 w-full max-w-xs h-40 flex flex-col justify-center",children:[h.jsx(Un,{className:"w-12 h-12 mx-auto text-white/90 mb-4"}),h.jsx("div",{className:"text-2xl font-bold text-white mb-2",children:k(j.data.mostActiveHour)}),h.jsx("div",{className:"text-white/70",children:"Most Active Hour"})]}),((B=j.data)==null?void 0:B.mostActiveDay)&&h.jsxs("div",{className:"bg-white/10 backdrop-blur-md rounded-2xl p-6 text-center border border-white/20 w-full max-w-xs h-40 flex flex-col justify-center",children:[h.jsx(sy,{className:"w-12 h-12 mx-auto text-white/90 mb-4"}),h.jsx("div",{className:"text-2xl font-bold text-white mb-2",children:j.data.mostActiveDay}),h.jsx("div",{className:"text-white/70",children:"Most Active Day"})]}),((le=j.data)==null?void 0:le.listeningStreak)!==void 0&&h.jsxs("div",{className:"bg-white/10 backdrop-blur-md rounded-2xl p-6 text-center border border-white/20 w-full max-w-xs h-40 flex flex-col justify-center",children:[h.jsx(uy,{className:"w-12 h-12 mx-auto text-white/90 mb-4"}),h.jsx("div",{className:"text-2xl font-bold text-white mb-2",children:j.data.listeningStreak}),h.jsx("div",{className:"text-white/70",children:"Day Streak"})]}),((ye=j.data)==null?void 0:ye.lateNight)!==void 0&&h.jsxs("div",{className:"bg-white/10 backdrop-blur-md rounded-2xl p-6 text-center border border-white/20 w-full max-w-xs h-40 flex flex-col justify-center",children:[h.jsx(Ok,{className:"w-12 h-12 mx-auto text-white/90 mb-4"}),h.jsx("div",{className:"text-2xl font-bold text-white mb-2",children:j.data.lateNight}),h.jsx("div",{className:"text-white/70",children:"Late Night Plays"})]}),((be=j.data)==null?void 0:be.earlyBird)!==void 0&&h.jsxs("div",{className:"bg-white/10 backdrop-blur-md rounded-2xl p-6 text-center border border-white/20 w-full max-w-xs h-40 flex flex-col justify-center",children:[h.jsx(Bk,{className:"w-12 h-12 mx-auto text-white/90 mb-4"}),h.jsx("div",{className:"text-2xl font-bold text-white mb-2",children:j.data.earlyBird}),h.jsx("div",{className:"text-white/70",children:"Early Bird Plays"})]}),((Fe=j.data)==null?void 0:Fe.weekendWarrior)!==void 0&&h.jsxs("div",{className:"bg-white/10 backdrop-blur-md rounded-2xl p-6 text-center border border-white/20 w-full max-w-xs h-40 flex flex-col justify-center",children:[h.jsx(Ak,{className:"w-12 h-12 mx-auto text-white/90 mb-4"}),h.jsx("div",{className:"text-2xl font-bold text-white mb-2",children:j.data.weekendWarrior}),h.jsx("div",{className:"text-white/70",children:"Weekend Plays"})]}),((Lt=j.data)==null?void 0:Lt.discoveryRate)!==void 0&&h.jsxs("div",{className:"bg-white/10 backdrop-blur-md rounded-2xl p-6 text-center border border-white/20 w-full max-w-xs h-40 flex flex-col justify-center",children:[h.jsx(ay,{className:"w-12 h-12 mx-auto text-white/90 mb-4"}),h.jsx("div",{className:"text-2xl font-bold text-white mb-2",children:j.data.discoveryRate}),h.jsx("div",{className:"text-white/70",children:"Artists Discovered"})]}),((Zn=j.data)==null?void 0:Zn.listeningVelocity)!==void 0&&h.jsxs("div",{className:"bg-white/10 backdrop-blur-md rounded-2xl p-6 text-center border border-white/20 w-full max-w-xs h-40 flex flex-col justify-center",children:[h.jsx(qk,{className:"w-12 h-12 mx-auto text-white/90 mb-4"}),h.jsx("div",{className:"text-2xl font-bold text-white mb-2",children:j.data.listeningVelocity.toFixed(1)}),h.jsx("div",{className:"text-white/70",children:"Songs per Day"})]}),((an=j.data)==null?void 0:an.averageSongLength)!==void 0&&h.jsxs("div",{className:"bg-white/10 backdrop-blur-md rounded-2xl p-6 text-center border border-white/20 w-full max-w-xs h-40 flex flex-col justify-center",children:[h.jsx(Ke,{className:"w-12 h-12 mx-auto text-white/90 mb-4"}),h.jsx("div",{className:"text-2xl font-bold text-white mb-2",children:Ds(j.data.averageSongLength)}),h.jsx("div",{className:"text-white/70",children:"Avg Song Length"})]}),((Zt=j.data)==null?void 0:Zt.artistCount)!==void 0&&h.jsxs("div",{className:"bg-white/10 backdrop-blur-md rounded-2xl p-6 text-center border border-white/20 w-full max-w-xs h-40 flex flex-col justify-center",children:[h.jsx(Wc,{className:"w-12 h-12 mx-auto text-white/90 mb-4"}),h.jsx("div",{className:"text-2xl font-bold text-white mb-2",children:j.data.artistCount}),h.jsxs("div",{className:"text-white/70",children:["Artists on ",j.data.date]})]})]})]})});case"outro":return h.jsx("div",{className:`${F} relative`,children:h.jsxs(z.div,{initial:{scale:.5,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.8,ease:"easeOut"},className:"space-y-6 relative z-10",children:[h.jsx(Nr,{className:"w-16 h-16 sm:w-20 sm:h-20 lg:w-24 lg:h-24 mx-auto text-white/90"}),h.jsx("h1",{className:"text-3xl sm:text-5xl lg:text-6xl font-bold text-white mb-4",children:j.title}),h.jsx("p",{className:"text-lg sm:text-xl lg:text-2xl text-white/80 mb-8",children:j.subtitle}),h.jsxs("div",{className:"text-lg text-white/60",children:["Generated on ",new Date(((qc=j.data)==null?void 0:qc.generatedAt)||Date.now()).toLocaleDateString()]})]})});default:return null}};return o?h.jsxs("div",{className:"min-h-screen flex items-center justify-center relative",children:[h.jsx(_s,{hueShift:Ms(r)}),h.jsxs(z.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},className:"glass-fluid rounded-3xl p-10 flex flex-col items-center space-y-6 relative z-20",children:[h.jsx("div",{className:"w-16 h-16 border-4 border-t-transparent rounded-full animate-spin",style:{borderColor:"var(--theme-primary) var(--theme-primary) var(--theme-primary) transparent"}}),h.jsx("p",{className:"text-white font-medium text-lg",children:"Generating your music wrapped..."})]})]}):s?h.jsxs("div",{className:"min-h-screen relative",children:[h.jsx(_s,{hueShift:Ms(r)}),h.jsxs("div",{className:"relative z-20",children:[h.jsx("div",{className:"fixed top-0 left-0 right-0 z-50 p-4 sm:p-6 bg-black/30 backdrop-blur-md border-b border-white/10",children:h.jsx("div",{className:"flex items-center justify-between",children:h.jsxs("div",{className:"flex items-center space-x-4",children:[h.jsx("h1",{className:"text-2xl font-bold text-white",children:"Music Wrapped"}),h.jsxs("select",{value:d,onChange:j=>f(j.target.value),className:"bg-white/10 backdrop-blur-md text-white rounded-lg px-3 py-1 border border-white/20",children:[h.jsx("option",{value:"all",className:"bg-gray-800",children:"All Time"}),h.jsx("option",{value:"year",className:"bg-gray-800",children:"This Year"}),h.jsx("option",{value:"month",className:"bg-gray-800",children:"This Month"}),h.jsx("option",{value:"week",className:"bg-gray-800",children:"This Week"})]})]})})}),h.jsx("div",{className:"relative w-full min-h-screen flex items-center justify-center p-2 sm:p-4 pt-20 sm:pt-24",children:h.jsxs("div",{className:"w-full max-w-2xl sm:max-w-4xl h-[60vh] sm:h-[80vh] relative",children:[h.jsx(e3,{mode:"wait",children:h.jsx(z.div,{initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:-20},transition:{duration:.5,ease:"easeInOut"},className:"absolute inset-0 rounded-3xl overflow-hidden shadow-2xl overflow-y-auto",style:{background:`linear-gradient(135deg, ${((P=n.cssVars)==null?void 0:P.primary)||"#1db954"}20 0%, ${((V=n.cssVars)==null?void 0:V.secondary)||"#1ed760"}15 100%)`,backdropFilter:"blur(25px) saturate(180%)",WebkitBackdropFilter:"blur(25px) saturate(180%)",border:`1px solid ${((T=n.cssVars)==null?void 0:T.primary)||"#1db954"}40`,boxShadow:`0 25px 50px rgba(0,0,0,0.4), 0 0 0 1px ${((O=n.cssVars)==null?void 0:O.primary)||"#1db954"}30, inset 0 1px 0 rgba(255,255,255,0.1)`},children:C(g[l])},l)}),g.length>1&&h.jsxs(h.Fragment,{children:[h.jsx("button",{onClick:x,className:"absolute left-4 top-1/2 transform -translate-y-1/2 bg-white/10 backdrop-blur-md hover:bg-white/20 text-white p-3 rounded-full transition-colors border border-white/20",children:h.jsx(Vk,{className:"w-6 h-6"})}),h.jsx("button",{onClick:y,className:"absolute right-4 top-1/2 transform -translate-y-1/2 bg-white/10 backdrop-blur-md hover:bg-white/20 text-white p-3 rounded-full transition-colors border border-white/20",children:h.jsx(Fk,{className:"w-6 h-6"})})]}),h.jsx("div",{className:"absolute bottom-6 left-1/2 transform -translate-x-1/2 flex space-x-2",children:g.map((j,F)=>h.jsx("button",{onClick:()=>c(F),className:`w-3 h-3 rounded-full transition-colors ${F===l?"bg-white":"bg-white/30"}`},F))}),h.jsxs("div",{className:"absolute top-6 right-6 text-white/70 text-sm bg-white/10 backdrop-blur-md px-3 py-1 rounded-full border border-white/20",children:[l+1," / ",g.length]})]})})]})]}):h.jsxs("div",{className:"min-h-screen flex items-center justify-center relative",children:[h.jsx(_s,{hueShift:Ms(r)}),h.jsxs("div",{className:"text-center relative z-20",children:[h.jsx(Ke,{className:"w-24 h-24 text-white/50 mx-auto mb-4"}),h.jsx("h2",{className:"text-2xl font-bold text-white mb-2",children:"No Music Data"}),h.jsx("p",{className:"text-white/70 mb-6",children:"Start listening to music to generate your wrapped!"})]})]})};function Uj(){var o,a;const{currentUser:e,partnerUser:t,isLoading:r,theme:n}=oe(),s=_r();console.log("🔍 App - Current location:",s.pathname),S.useEffect(()=>{en(n)},[n]),S.useEffect(()=>{const l=localStorage.getItem("spotify-user"),c=localStorage.getItem("spotify-partner");if(l)try{const d=JSON.parse(l);oe.getState().setCurrentUser(d)}catch(d){console.error("Failed to parse stored user data:",d),localStorage.removeItem("spotify-user")}if(c)try{const d=JSON.parse(c);oe.getState().setPartnerUser(d)}catch(d){console.error("Failed to parse stored partner data:",d),localStorage.removeItem("spotify-partner")}},[]),S.useEffect(()=>{(async()=>{var d,f;const c=(f=(d=oe.getState().currentUser)==null?void 0:d.user)==null?void 0:f.id;if(c&&!oe.getState().partnerUser)try{const u=await te(`/partners/partner/${c}`);if(u.partnerId){const[p,m,g]=await Promise.all([te(`/users/${u.partnerId}`),te(`/users/${u.partnerId}/recently-played`),te(`/users/${u.partnerId}/top-tracks?time_range=short_term`)]);oe.getState().setPartnerUser({user:p,accessToken:null,refreshToken:null,isAuthenticated:!0,recentlyPlayed:m,topTracks:g.map(w=>w.track),topArtists:[]})}}catch{}})()},[(o=e==null?void 0:e.user)==null?void 0:o.id]),S.useEffect(()=>{var d,f;const l=(f=(d=oe.getState().currentUser)==null?void 0:d.user)==null?void 0:f.id;if(!l)return;const c=V3(`/partners/events/${l}`);return c.onmessage=async u=>{var p,m;if(u.data)try{const g=JSON.parse(u.data);if((g==null?void 0:g.type)==="partner:connected"||(g==null?void 0:g.type)==="partner:disconnected"){const w=await te(`/partners/partner/${l}`),v=((m=(p=oe.getState().partnerUser)==null?void 0:p.user)==null?void 0:m.id)||null;if(!(w!=null&&w.partnerId)&&v){oe.getState().setPartnerUser(null),localStorage.removeItem("spotify-partner");return}if(w!=null&&w.partnerId&&w.partnerId!==v)try{const[y,x,b]=await Promise.all([te(`/users/${w.partnerId}`),te(`/users/${w.partnerId}/recently-played`),te(`/users/${w.partnerId}/top-tracks?time_range=short_term`)]);oe.getState().setPartnerUser({user:y,accessToken:null,refreshToken:null,isAuthenticated:!0,recentlyPlayed:x,topTracks:b.map(k=>k.track),topArtists:[]})}catch{}}(g==null?void 0:g.type)==="partner:request"||(g==null||g.type)}catch{}},c.onerror=()=>{try{c.close()}catch{}},()=>{try{c.close()}catch{}}},[(a=e==null?void 0:e.user)==null?void 0:a.id]);const i=(e==null?void 0:e.isAuthenticated)||!1;return r?h.jsxs("div",{className:"min-h-screen flex items-center justify-center relative",children:[h.jsx(_s,{hueShift:Ms(n)}),h.jsxs(z.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},className:"glass-fluid rounded-3xl p-10 flex flex-col items-center space-y-6 relative z-20",children:[h.jsx("div",{className:"w-16 h-16 border-4 border-t-transparent rounded-full animate-spin",style:{borderColor:"var(--theme-primary) var(--theme-primary) var(--theme-primary) transparent"}}),h.jsx("p",{className:"text-white font-medium text-lg",children:"Loading your musical journey..."})]})]}):h.jsxs("div",{className:"min-h-screen relative overflow-hidden",children:[h.jsx(_s,{hueShift:Ms(n)}),h.jsxs("div",{className:"relative z-20",children:[i&&h.jsx(Nj,{}),h.jsxs(Fx,{children:[h.jsx(jt,{path:"/",element:i?h.jsx(Rj,{}):h.jsx(Lj,{})}),h.jsx(jt,{path:"/callback",element:h.jsx(Xh,{})}),h.jsx(jt,{path:"/callback.html",element:h.jsx(Xh,{})}),i&&h.jsxs(h.Fragment,{children:[h.jsx(jt,{path:"/last-listened",element:h.jsx(Vj,{})}),h.jsx(jt,{path:"/mixed-playlist",element:h.jsx(Ij,{})}),h.jsx(jt,{path:"/memory-lane",element:h.jsx(zj,{})}),h.jsx(jt,{path:"/live",element:h.jsx($j,{})}),h.jsx(jt,{path:"/wrapped",element:h.jsx(Bj,{})})]}),h.jsx(jt,{path:"*",element:h.jsx(Rx,{to:"/",replace:!0})})]})]})]})}il.createRoot(document.getElementById("root")).render(h.jsx(ii.StrictMode,{children:h.jsxs(Hx,{children:[h.jsx(Uj,{}),h.jsx(F2,{position:"top-right",toastOptions:{duration:4e3,style:{background:"rgba(255, 255, 255, 0.1)",backdropFilter:"blur(20px)",border:"1px solid rgba(255, 255, 255, 0.2)",color:"#fff"}}})]})}));