@realtimex/realtimex-alchemy 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}})();function uy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Bu={exports:{}},li={},zu={exports:{}},we={};var Hp;function Px(){if(Hp)return we;Hp=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.iterator;function w(j){return j===null||typeof j!="object"?null:(j=v&&j[v]||j["@@iterator"],typeof j=="function"?j:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,k={};function S(j,D,re){this.props=j,this.context=D,this.refs=k,this.updater=re||_}S.prototype.isReactComponent={},S.prototype.setState=function(j,D){if(typeof j!="object"&&typeof j!="function"&&j!=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,j,D,"setState")},S.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function E(){}E.prototype=S.prototype;function A(j,D,re){this.props=j,this.context=D,this.refs=k,this.updater=re||_}var P=A.prototype=new E;P.constructor=A,b(P,S.prototype),P.isPureReactComponent=!0;var U=Array.isArray,V=Object.prototype.hasOwnProperty,z={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function B(j,D,re){var ue,fe={},ie=null,Ee=null;if(D!=null)for(ue in D.ref!==void 0&&(Ee=D.ref),D.key!==void 0&&(ie=""+D.key),D)V.call(D,ue)&&!$.hasOwnProperty(ue)&&(fe[ue]=D[ue]);var ke=arguments.length-2;if(ke===1)fe.children=re;else if(1<ke){for(var Me=Array(ke),Et=0;Et<ke;Et++)Me[Et]=arguments[Et+2];fe.children=Me}if(j&&j.defaultProps)for(ue in ke=j.defaultProps,ke)fe[ue]===void 0&&(fe[ue]=ke[ue]);return{$$typeof:t,type:j,key:ie,ref:Ee,props:fe,_owner:z.current}}function Y(j,D){return{$$typeof:t,type:j.type,key:D,ref:j.ref,props:j.props,_owner:j._owner}}function oe(j){return typeof j=="object"&&j!==null&&j.$$typeof===t}function Te(j){var D={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(re){return D[re]})}var ve=/\/+/g;function je(j,D){return typeof j=="object"&&j!==null&&j.key!=null?Te(""+j.key):D.toString(36)}function xe(j,D,re,ue,fe){var ie=typeof j;(ie==="undefined"||ie==="boolean")&&(j=null);var Ee=!1;if(j===null)Ee=!0;else switch(ie){case"string":case"number":Ee=!0;break;case"object":switch(j.$$typeof){case t:case e:Ee=!0}}if(Ee)return Ee=j,fe=fe(Ee),j=ue===""?"."+je(Ee,0):ue,U(fe)?(re="",j!=null&&(re=j.replace(ve,"$&/")+"/"),xe(fe,D,re,"",function(Et){return Et})):fe!=null&&(oe(fe)&&(fe=Y(fe,re+(!fe.key||Ee&&Ee.key===fe.key?"":(""+fe.key).replace(ve,"$&/")+"/")+j)),D.push(fe)),1;if(Ee=0,ue=ue===""?".":ue+":",U(j))for(var ke=0;ke<j.length;ke++){ie=j[ke];var Me=ue+je(ie,ke);Ee+=xe(ie,D,re,Me,fe)}else if(Me=w(j),typeof Me=="function")for(j=Me.call(j),ke=0;!(ie=j.next()).done;)ie=ie.value,Me=ue+je(ie,ke++),Ee+=xe(ie,D,re,Me,fe);else if(ie==="object")throw D=String(j),Error("Objects are not valid as a React child (found: "+(D==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":D)+"). If you meant to render a collection of children, use an array instead.");return Ee}function Oe(j,D,re){if(j==null)return j;var ue=[],fe=0;return xe(j,ue,"","",function(ie){return D.call(re,ie,fe++)}),ue}function be(j){if(j._status===-1){var D=j._result;D=D(),D.then(function(re){(j._status===0||j._status===-1)&&(j._status=1,j._result=re)},function(re){(j._status===0||j._status===-1)&&(j._status=2,j._result=re)}),j._status===-1&&(j._status=0,j._result=D)}if(j._status===1)return j._result.default;throw j._result}var pe={current:null},F={transition:null},J={ReactCurrentDispatcher:pe,ReactCurrentBatchConfig:F,ReactCurrentOwner:z};function K(){throw Error("act(...) is not supported in production builds of React.")}return we.Children={map:Oe,forEach:function(j,D,re){Oe(j,function(){D.apply(this,arguments)},re)},count:function(j){var D=0;return Oe(j,function(){D++}),D},toArray:function(j){return Oe(j,function(D){return D})||[]},only:function(j){if(!oe(j))throw Error("React.Children.only expected to receive a single React element child.");return j}},we.Component=S,we.Fragment=n,we.Profiler=o,we.PureComponent=A,we.StrictMode=i,we.Suspense=h,we.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=J,we.act=K,we.cloneElement=function(j,D,re){if(j==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+j+".");var ue=b({},j.props),fe=j.key,ie=j.ref,Ee=j._owner;if(D!=null){if(D.ref!==void 0&&(ie=D.ref,Ee=z.current),D.key!==void 0&&(fe=""+D.key),j.type&&j.type.defaultProps)var ke=j.type.defaultProps;for(Me in D)V.call(D,Me)&&!$.hasOwnProperty(Me)&&(ue[Me]=D[Me]===void 0&&ke!==void 0?ke[Me]:D[Me])}var Me=arguments.length-2;if(Me===1)ue.children=re;else if(1<Me){ke=Array(Me);for(var Et=0;Et<Me;Et++)ke[Et]=arguments[Et+2];ue.children=ke}return{$$typeof:t,type:j.type,key:fe,ref:ie,props:ue,_owner:Ee}},we.createContext=function(j){return j={$$typeof:u,_currentValue:j,_currentValue2:j,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},j.Provider={$$typeof:l,_context:j},j.Consumer=j},we.createElement=B,we.createFactory=function(j){var D=B.bind(null,j);return D.type=j,D},we.createRef=function(){return{current:null}},we.forwardRef=function(j){return{$$typeof:d,render:j}},we.isValidElement=oe,we.lazy=function(j){return{$$typeof:y,_payload:{_status:-1,_result:j},_init:be}},we.memo=function(j,D){return{$$typeof:m,type:j,compare:D===void 0?null:D}},we.startTransition=function(j){var D=F.transition;F.transition={};try{j()}finally{F.transition=D}},we.unstable_act=K,we.useCallback=function(j,D){return pe.current.useCallback(j,D)},we.useContext=function(j){return pe.current.useContext(j)},we.useDebugValue=function(){},we.useDeferredValue=function(j){return pe.current.useDeferredValue(j)},we.useEffect=function(j,D){return pe.current.useEffect(j,D)},we.useId=function(){return pe.current.useId()},we.useImperativeHandle=function(j,D,re){return pe.current.useImperativeHandle(j,D,re)},we.useInsertionEffect=function(j,D){return pe.current.useInsertionEffect(j,D)},we.useLayoutEffect=function(j,D){return pe.current.useLayoutEffect(j,D)},we.useMemo=function(j,D){return pe.current.useMemo(j,D)},we.useReducer=function(j,D,re){return pe.current.useReducer(j,D,re)},we.useRef=function(j){return pe.current.useRef(j)},we.useState=function(j){return pe.current.useState(j)},we.useSyncExternalStore=function(j,D,re){return pe.current.useSyncExternalStore(j,D,re)},we.useTransition=function(){return pe.current.useTransition()},we.version="18.3.1",we}var Kp;function td(){return Kp||(Kp=1,zu.exports=Px()),zu.exports}var Gp;function Rx(){if(Gp)return li;Gp=1;var t=td(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function u(d,h,m){var y,v={},w=null,_=null;m!==void 0&&(w=""+m),h.key!==void 0&&(w=""+h.key),h.ref!==void 0&&(_=h.ref);for(y in h)i.call(h,y)&&!l.hasOwnProperty(y)&&(v[y]=h[y]);if(d&&d.defaultProps)for(y in h=d.defaultProps,h)v[y]===void 0&&(v[y]=h[y]);return{$$typeof:e,type:d,key:w,ref:_,props:v,_owner:o.current}}return li.Fragment=n,li.jsx=u,li.jsxs=u,li}var Jp;function Ox(){return Jp||(Jp=1,Bu.exports=Rx()),Bu.exports}var p=Ox(),R=td();const _i=uy(R);var sa={},qu={exports:{}},_t={},Wu={exports:{}},Hu={};var Yp;function Ix(){return Yp||(Yp=1,(function(t){function e(F,J){var K=F.length;F.push(J);e:for(;0<K;){var j=K-1>>>1,D=F[j];if(0<o(D,J))F[j]=J,F[K]=D,K=j;else break e}}function n(F){return F.length===0?null:F[0]}function i(F){if(F.length===0)return null;var J=F[0],K=F.pop();if(K!==J){F[0]=K;e:for(var j=0,D=F.length,re=D>>>1;j<re;){var ue=2*(j+1)-1,fe=F[ue],ie=ue+1,Ee=F[ie];if(0>o(fe,K))ie<D&&0>o(Ee,fe)?(F[j]=Ee,F[ie]=K,j=ie):(F[j]=fe,F[ue]=K,j=ue);else if(ie<D&&0>o(Ee,K))F[j]=Ee,F[ie]=K,j=ie;else break e}}return J}function o(F,J){var K=F.sortIndex-J.sortIndex;return K!==0?K:F.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;t.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();t.unstable_now=function(){return u.now()-d}}var h=[],m=[],y=1,v=null,w=3,_=!1,b=!1,k=!1,S=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function P(F){for(var J=n(m);J!==null;){if(J.callback===null)i(m);else if(J.startTime<=F)i(m),J.sortIndex=J.expirationTime,e(h,J);else break;J=n(m)}}function U(F){if(k=!1,P(F),!b)if(n(h)!==null)b=!0,be(V);else{var J=n(m);J!==null&&pe(U,J.startTime-F)}}function V(F,J){b=!1,k&&(k=!1,E(B),B=-1),_=!0;var K=w;try{for(P(J),v=n(h);v!==null&&(!(v.expirationTime>J)||F&&!Te());){var j=v.callback;if(typeof j=="function"){v.callback=null,w=v.priorityLevel;var D=j(v.expirationTime<=J);J=t.unstable_now(),typeof D=="function"?v.callback=D:v===n(h)&&i(h),P(J)}else i(h);v=n(h)}if(v!==null)var re=!0;else{var ue=n(m);ue!==null&&pe(U,ue.startTime-J),re=!1}return re}finally{v=null,w=K,_=!1}}var z=!1,$=null,B=-1,Y=5,oe=-1;function Te(){return!(t.unstable_now()-oe<Y)}function ve(){if($!==null){var F=t.unstable_now();oe=F;var J=!0;try{J=$(!0,F)}finally{J?je():(z=!1,$=null)}}else z=!1}var je;if(typeof A=="function")je=function(){A(ve)};else if(typeof MessageChannel<"u"){var xe=new MessageChannel,Oe=xe.port2;xe.port1.onmessage=ve,je=function(){Oe.postMessage(null)}}else je=function(){S(ve,0)};function be(F){$=F,z||(z=!0,je())}function pe(F,J){B=S(function(){F(t.unstable_now())},J)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(F){F.callback=null},t.unstable_continueExecution=function(){b||_||(b=!0,be(V))},t.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y=0<F?Math.floor(1e3/F):5},t.unstable_getCurrentPriorityLevel=function(){return w},t.unstable_getFirstCallbackNode=function(){return n(h)},t.unstable_next=function(F){switch(w){case 1:case 2:case 3:var J=3;break;default:J=w}var K=w;w=J;try{return F()}finally{w=K}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(F,J){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var K=w;w=F;try{return J()}finally{w=K}},t.unstable_scheduleCallback=function(F,J,K){var j=t.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?j+K:j):K=j,F){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=K+D,F={id:y++,callback:J,priorityLevel:F,startTime:K,expirationTime:D,sortIndex:-1},K>j?(F.sortIndex=K,e(m,F),n(h)===null&&F===n(m)&&(k?(E(B),B=-1):k=!0,pe(U,K-j))):(F.sortIndex=D,e(h,F),b||_||(b=!0,be(V))),F},t.unstable_shouldYield=Te,t.unstable_wrapCallback=function(F){var J=w;return function(){var K=w;w=J;try{return F.apply(this,arguments)}finally{w=K}}}})(Hu)),Hu}var Qp;function Dx(){return Qp||(Qp=1,Wu.exports=Ix()),Wu.exports}var Xp;function Lx(){if(Xp)return _t;Xp=1;var t=td(),e=Dx();function n(r){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+r,a=1;a<arguments.length;a++)s+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+r+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,o={};function l(r,s){u(r,s),u(r+"Capture",s)}function u(r,s){for(o[r]=s,r=0;r<s.length;r++)i.add(s[r])}var d=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,m=/^[: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]*$/,y={},v={};function w(r){return h.call(v,r)?!0:h.call(y,r)?!1:m.test(r)?v[r]=!0:(y[r]=!0,!1)}function _(r,s,a,c){if(a!==null&&a.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return c?!1:a!==null?!a.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function b(r,s,a,c){if(s===null||typeof s>"u"||_(r,s,a,c))return!0;if(c)return!1;if(a!==null)switch(a.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function k(r,s,a,c,f,g,x){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=c,this.attributeNamespace=f,this.mustUseProperty=a,this.propertyName=r,this.type=s,this.sanitizeURL=g,this.removeEmptyString=x}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){S[r]=new k(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var s=r[0];S[s]=new k(s,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){S[r]=new k(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){S[r]=new k(r,2,!1,r,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(r){S[r]=new k(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){S[r]=new k(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){S[r]=new k(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){S[r]=new k(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){S[r]=new k(r,5,!1,r.toLowerCase(),null,!1,!1)});var E=/[\-:]([a-z])/g;function A(r){return r[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(r){var s=r.replace(E,A);S[s]=new k(s,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var s=r.replace(E,A);S[s]=new k(s,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var s=r.replace(E,A);S[s]=new k(s,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){S[r]=new k(r,1,!1,r.toLowerCase(),null,!1,!1)}),S.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){S[r]=new k(r,1,!1,r.toLowerCase(),null,!0,!0)});function P(r,s,a,c){var f=S.hasOwnProperty(s)?S[s]:null;(f!==null?f.type!==0:c||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(b(s,a,f,c)&&(a=null),c||f===null?w(s)&&(a===null?r.removeAttribute(s):r.setAttribute(s,""+a)):f.mustUseProperty?r[f.propertyName]=a===null?f.type===3?!1:"":a:(s=f.attributeName,c=f.attributeNamespace,a===null?r.removeAttribute(s):(f=f.type,a=f===3||f===4&&a===!0?"":""+a,c?r.setAttributeNS(c,s,a):r.setAttribute(s,a))))}var U=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,V=Symbol.for("react.element"),z=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),Y=Symbol.for("react.profiler"),oe=Symbol.for("react.provider"),Te=Symbol.for("react.context"),ve=Symbol.for("react.forward_ref"),je=Symbol.for("react.suspense"),xe=Symbol.for("react.suspense_list"),Oe=Symbol.for("react.memo"),be=Symbol.for("react.lazy"),pe=Symbol.for("react.offscreen"),F=Symbol.iterator;function J(r){return r===null||typeof r!="object"?null:(r=F&&r[F]||r["@@iterator"],typeof r=="function"?r:null)}var K=Object.assign,j;function D(r){if(j===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);j=s&&s[1]||""}return`
1
+ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}})();function uy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var zu={exports:{}},li={},qu={exports:{}},we={};var Hp;function Px(){if(Hp)return we;Hp=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.iterator;function w(j){return j===null||typeof j!="object"?null:(j=v&&j[v]||j["@@iterator"],typeof j=="function"?j:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,S={};function k(j,D,re){this.props=j,this.context=D,this.refs=S,this.updater=re||_}k.prototype.isReactComponent={},k.prototype.setState=function(j,D){if(typeof j!="object"&&typeof j!="function"&&j!=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,j,D,"setState")},k.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function E(){}E.prototype=k.prototype;function P(j,D,re){this.props=j,this.context=D,this.refs=S,this.updater=re||_}var N=P.prototype=new E;N.constructor=P,b(N,k.prototype),N.isPureReactComponent=!0;var U=Array.isArray,V=Object.prototype.hasOwnProperty,z={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function B(j,D,re){var ue,fe={},ie=null,Ee=null;if(D!=null)for(ue in D.ref!==void 0&&(Ee=D.ref),D.key!==void 0&&(ie=""+D.key),D)V.call(D,ue)&&!$.hasOwnProperty(ue)&&(fe[ue]=D[ue]);var ke=arguments.length-2;if(ke===1)fe.children=re;else if(1<ke){for(var Me=Array(ke),Et=0;Et<ke;Et++)Me[Et]=arguments[Et+2];fe.children=Me}if(j&&j.defaultProps)for(ue in ke=j.defaultProps,ke)fe[ue]===void 0&&(fe[ue]=ke[ue]);return{$$typeof:t,type:j,key:ie,ref:Ee,props:fe,_owner:z.current}}function Y(j,D){return{$$typeof:t,type:j.type,key:D,ref:j.ref,props:j.props,_owner:j._owner}}function oe(j){return typeof j=="object"&&j!==null&&j.$$typeof===t}function Te(j){var D={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(re){return D[re]})}var ve=/\/+/g;function je(j,D){return typeof j=="object"&&j!==null&&j.key!=null?Te(""+j.key):D.toString(36)}function xe(j,D,re,ue,fe){var ie=typeof j;(ie==="undefined"||ie==="boolean")&&(j=null);var Ee=!1;if(j===null)Ee=!0;else switch(ie){case"string":case"number":Ee=!0;break;case"object":switch(j.$$typeof){case t:case e:Ee=!0}}if(Ee)return Ee=j,fe=fe(Ee),j=ue===""?"."+je(Ee,0):ue,U(fe)?(re="",j!=null&&(re=j.replace(ve,"$&/")+"/"),xe(fe,D,re,"",function(Et){return Et})):fe!=null&&(oe(fe)&&(fe=Y(fe,re+(!fe.key||Ee&&Ee.key===fe.key?"":(""+fe.key).replace(ve,"$&/")+"/")+j)),D.push(fe)),1;if(Ee=0,ue=ue===""?".":ue+":",U(j))for(var ke=0;ke<j.length;ke++){ie=j[ke];var Me=ue+je(ie,ke);Ee+=xe(ie,D,re,Me,fe)}else if(Me=w(j),typeof Me=="function")for(j=Me.call(j),ke=0;!(ie=j.next()).done;)ie=ie.value,Me=ue+je(ie,ke++),Ee+=xe(ie,D,re,Me,fe);else if(ie==="object")throw D=String(j),Error("Objects are not valid as a React child (found: "+(D==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":D)+"). If you meant to render a collection of children, use an array instead.");return Ee}function Oe(j,D,re){if(j==null)return j;var ue=[],fe=0;return xe(j,ue,"","",function(ie){return D.call(re,ie,fe++)}),ue}function be(j){if(j._status===-1){var D=j._result;D=D(),D.then(function(re){(j._status===0||j._status===-1)&&(j._status=1,j._result=re)},function(re){(j._status===0||j._status===-1)&&(j._status=2,j._result=re)}),j._status===-1&&(j._status=0,j._result=D)}if(j._status===1)return j._result.default;throw j._result}var pe={current:null},F={transition:null},J={ReactCurrentDispatcher:pe,ReactCurrentBatchConfig:F,ReactCurrentOwner:z};function K(){throw Error("act(...) is not supported in production builds of React.")}return we.Children={map:Oe,forEach:function(j,D,re){Oe(j,function(){D.apply(this,arguments)},re)},count:function(j){var D=0;return Oe(j,function(){D++}),D},toArray:function(j){return Oe(j,function(D){return D})||[]},only:function(j){if(!oe(j))throw Error("React.Children.only expected to receive a single React element child.");return j}},we.Component=k,we.Fragment=n,we.Profiler=o,we.PureComponent=P,we.StrictMode=i,we.Suspense=h,we.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=J,we.act=K,we.cloneElement=function(j,D,re){if(j==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+j+".");var ue=b({},j.props),fe=j.key,ie=j.ref,Ee=j._owner;if(D!=null){if(D.ref!==void 0&&(ie=D.ref,Ee=z.current),D.key!==void 0&&(fe=""+D.key),j.type&&j.type.defaultProps)var ke=j.type.defaultProps;for(Me in D)V.call(D,Me)&&!$.hasOwnProperty(Me)&&(ue[Me]=D[Me]===void 0&&ke!==void 0?ke[Me]:D[Me])}var Me=arguments.length-2;if(Me===1)ue.children=re;else if(1<Me){ke=Array(Me);for(var Et=0;Et<Me;Et++)ke[Et]=arguments[Et+2];ue.children=ke}return{$$typeof:t,type:j.type,key:fe,ref:ie,props:ue,_owner:Ee}},we.createContext=function(j){return j={$$typeof:u,_currentValue:j,_currentValue2:j,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},j.Provider={$$typeof:l,_context:j},j.Consumer=j},we.createElement=B,we.createFactory=function(j){var D=B.bind(null,j);return D.type=j,D},we.createRef=function(){return{current:null}},we.forwardRef=function(j){return{$$typeof:d,render:j}},we.isValidElement=oe,we.lazy=function(j){return{$$typeof:y,_payload:{_status:-1,_result:j},_init:be}},we.memo=function(j,D){return{$$typeof:m,type:j,compare:D===void 0?null:D}},we.startTransition=function(j){var D=F.transition;F.transition={};try{j()}finally{F.transition=D}},we.unstable_act=K,we.useCallback=function(j,D){return pe.current.useCallback(j,D)},we.useContext=function(j){return pe.current.useContext(j)},we.useDebugValue=function(){},we.useDeferredValue=function(j){return pe.current.useDeferredValue(j)},we.useEffect=function(j,D){return pe.current.useEffect(j,D)},we.useId=function(){return pe.current.useId()},we.useImperativeHandle=function(j,D,re){return pe.current.useImperativeHandle(j,D,re)},we.useInsertionEffect=function(j,D){return pe.current.useInsertionEffect(j,D)},we.useLayoutEffect=function(j,D){return pe.current.useLayoutEffect(j,D)},we.useMemo=function(j,D){return pe.current.useMemo(j,D)},we.useReducer=function(j,D,re){return pe.current.useReducer(j,D,re)},we.useRef=function(j){return pe.current.useRef(j)},we.useState=function(j){return pe.current.useState(j)},we.useSyncExternalStore=function(j,D,re){return pe.current.useSyncExternalStore(j,D,re)},we.useTransition=function(){return pe.current.useTransition()},we.version="18.3.1",we}var Kp;function nd(){return Kp||(Kp=1,qu.exports=Px()),qu.exports}var Gp;function Rx(){if(Gp)return li;Gp=1;var t=nd(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function u(d,h,m){var y,v={},w=null,_=null;m!==void 0&&(w=""+m),h.key!==void 0&&(w=""+h.key),h.ref!==void 0&&(_=h.ref);for(y in h)i.call(h,y)&&!l.hasOwnProperty(y)&&(v[y]=h[y]);if(d&&d.defaultProps)for(y in h=d.defaultProps,h)v[y]===void 0&&(v[y]=h[y]);return{$$typeof:e,type:d,key:w,ref:_,props:v,_owner:o.current}}return li.Fragment=n,li.jsx=u,li.jsxs=u,li}var Jp;function Ox(){return Jp||(Jp=1,zu.exports=Rx()),zu.exports}var p=Ox(),R=nd();const _i=uy(R);var sa={},Wu={exports:{}},_t={},Hu={exports:{}},Ku={};var Yp;function Ix(){return Yp||(Yp=1,(function(t){function e(F,J){var K=F.length;F.push(J);e:for(;0<K;){var j=K-1>>>1,D=F[j];if(0<o(D,J))F[j]=J,F[K]=D,K=j;else break e}}function n(F){return F.length===0?null:F[0]}function i(F){if(F.length===0)return null;var J=F[0],K=F.pop();if(K!==J){F[0]=K;e:for(var j=0,D=F.length,re=D>>>1;j<re;){var ue=2*(j+1)-1,fe=F[ue],ie=ue+1,Ee=F[ie];if(0>o(fe,K))ie<D&&0>o(Ee,fe)?(F[j]=Ee,F[ie]=K,j=ie):(F[j]=fe,F[ue]=K,j=ue);else if(ie<D&&0>o(Ee,K))F[j]=Ee,F[ie]=K,j=ie;else break e}}return J}function o(F,J){var K=F.sortIndex-J.sortIndex;return K!==0?K:F.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;t.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();t.unstable_now=function(){return u.now()-d}}var h=[],m=[],y=1,v=null,w=3,_=!1,b=!1,S=!1,k=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function N(F){for(var J=n(m);J!==null;){if(J.callback===null)i(m);else if(J.startTime<=F)i(m),J.sortIndex=J.expirationTime,e(h,J);else break;J=n(m)}}function U(F){if(S=!1,N(F),!b)if(n(h)!==null)b=!0,be(V);else{var J=n(m);J!==null&&pe(U,J.startTime-F)}}function V(F,J){b=!1,S&&(S=!1,E(B),B=-1),_=!0;var K=w;try{for(N(J),v=n(h);v!==null&&(!(v.expirationTime>J)||F&&!Te());){var j=v.callback;if(typeof j=="function"){v.callback=null,w=v.priorityLevel;var D=j(v.expirationTime<=J);J=t.unstable_now(),typeof D=="function"?v.callback=D:v===n(h)&&i(h),N(J)}else i(h);v=n(h)}if(v!==null)var re=!0;else{var ue=n(m);ue!==null&&pe(U,ue.startTime-J),re=!1}return re}finally{v=null,w=K,_=!1}}var z=!1,$=null,B=-1,Y=5,oe=-1;function Te(){return!(t.unstable_now()-oe<Y)}function ve(){if($!==null){var F=t.unstable_now();oe=F;var J=!0;try{J=$(!0,F)}finally{J?je():(z=!1,$=null)}}else z=!1}var je;if(typeof P=="function")je=function(){P(ve)};else if(typeof MessageChannel<"u"){var xe=new MessageChannel,Oe=xe.port2;xe.port1.onmessage=ve,je=function(){Oe.postMessage(null)}}else je=function(){k(ve,0)};function be(F){$=F,z||(z=!0,je())}function pe(F,J){B=k(function(){F(t.unstable_now())},J)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(F){F.callback=null},t.unstable_continueExecution=function(){b||_||(b=!0,be(V))},t.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y=0<F?Math.floor(1e3/F):5},t.unstable_getCurrentPriorityLevel=function(){return w},t.unstable_getFirstCallbackNode=function(){return n(h)},t.unstable_next=function(F){switch(w){case 1:case 2:case 3:var J=3;break;default:J=w}var K=w;w=J;try{return F()}finally{w=K}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(F,J){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var K=w;w=F;try{return J()}finally{w=K}},t.unstable_scheduleCallback=function(F,J,K){var j=t.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?j+K:j):K=j,F){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=K+D,F={id:y++,callback:J,priorityLevel:F,startTime:K,expirationTime:D,sortIndex:-1},K>j?(F.sortIndex=K,e(m,F),n(h)===null&&F===n(m)&&(S?(E(B),B=-1):S=!0,pe(U,K-j))):(F.sortIndex=D,e(h,F),b||_||(b=!0,be(V))),F},t.unstable_shouldYield=Te,t.unstable_wrapCallback=function(F){var J=w;return function(){var K=w;w=J;try{return F.apply(this,arguments)}finally{w=K}}}})(Ku)),Ku}var Qp;function Dx(){return Qp||(Qp=1,Hu.exports=Ix()),Hu.exports}var Xp;function Lx(){if(Xp)return _t;Xp=1;var t=nd(),e=Dx();function n(r){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+r,a=1;a<arguments.length;a++)s+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+r+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,o={};function l(r,s){u(r,s),u(r+"Capture",s)}function u(r,s){for(o[r]=s,r=0;r<s.length;r++)i.add(s[r])}var d=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,m=/^[: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]*$/,y={},v={};function w(r){return h.call(v,r)?!0:h.call(y,r)?!1:m.test(r)?v[r]=!0:(y[r]=!0,!1)}function _(r,s,a,c){if(a!==null&&a.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return c?!1:a!==null?!a.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function b(r,s,a,c){if(s===null||typeof s>"u"||_(r,s,a,c))return!0;if(c)return!1;if(a!==null)switch(a.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function S(r,s,a,c,f,g,x){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=c,this.attributeNamespace=f,this.mustUseProperty=a,this.propertyName=r,this.type=s,this.sanitizeURL=g,this.removeEmptyString=x}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){k[r]=new S(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var s=r[0];k[s]=new S(s,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){k[r]=new S(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){k[r]=new S(r,2,!1,r,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(r){k[r]=new S(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){k[r]=new S(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){k[r]=new S(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){k[r]=new S(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){k[r]=new S(r,5,!1,r.toLowerCase(),null,!1,!1)});var E=/[\-:]([a-z])/g;function P(r){return r[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(r){var s=r.replace(E,P);k[s]=new S(s,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var s=r.replace(E,P);k[s]=new S(s,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var s=r.replace(E,P);k[s]=new S(s,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){k[r]=new S(r,1,!1,r.toLowerCase(),null,!1,!1)}),k.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){k[r]=new S(r,1,!1,r.toLowerCase(),null,!0,!0)});function N(r,s,a,c){var f=k.hasOwnProperty(s)?k[s]:null;(f!==null?f.type!==0:c||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(b(s,a,f,c)&&(a=null),c||f===null?w(s)&&(a===null?r.removeAttribute(s):r.setAttribute(s,""+a)):f.mustUseProperty?r[f.propertyName]=a===null?f.type===3?!1:"":a:(s=f.attributeName,c=f.attributeNamespace,a===null?r.removeAttribute(s):(f=f.type,a=f===3||f===4&&a===!0?"":""+a,c?r.setAttributeNS(c,s,a):r.setAttribute(s,a))))}var U=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,V=Symbol.for("react.element"),z=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),Y=Symbol.for("react.profiler"),oe=Symbol.for("react.provider"),Te=Symbol.for("react.context"),ve=Symbol.for("react.forward_ref"),je=Symbol.for("react.suspense"),xe=Symbol.for("react.suspense_list"),Oe=Symbol.for("react.memo"),be=Symbol.for("react.lazy"),pe=Symbol.for("react.offscreen"),F=Symbol.iterator;function J(r){return r===null||typeof r!="object"?null:(r=F&&r[F]||r["@@iterator"],typeof r=="function"?r:null)}var K=Object.assign,j;function D(r){if(j===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);j=s&&s[1]||""}return`
2
2
  `+j+r}var re=!1;function ue(r,s){if(!r||re)return"";re=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(L){var c=L}Reflect.construct(r,[],s)}else{try{s.call()}catch(L){c=L}r.call(s.prototype)}else{try{throw Error()}catch(L){c=L}r()}}catch(L){if(L&&c&&typeof L.stack=="string"){for(var f=L.stack.split(`
3
3
  `),g=c.stack.split(`
4
4
  `),x=f.length-1,T=g.length-1;1<=x&&0<=T&&f[x]!==g[T];)T--;for(;1<=x&&0<=T;x--,T--)if(f[x]!==g[T]){if(x!==1||T!==1)do if(x--,T--,0>T||f[x]!==g[T]){var C=`
5
- `+f[x].replace(" at new "," at ");return r.displayName&&C.includes("<anonymous>")&&(C=C.replace("<anonymous>",r.displayName)),C}while(1<=x&&0<=T);break}}}finally{re=!1,Error.prepareStackTrace=a}return(r=r?r.displayName||r.name:"")?D(r):""}function fe(r){switch(r.tag){case 5:return D(r.type);case 16:return D("Lazy");case 13:return D("Suspense");case 19:return D("SuspenseList");case 0:case 2:case 15:return r=ue(r.type,!1),r;case 11:return r=ue(r.type.render,!1),r;case 1:return r=ue(r.type,!0),r;default:return""}}function ie(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case $:return"Fragment";case z:return"Portal";case Y:return"Profiler";case B:return"StrictMode";case je:return"Suspense";case xe:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case Te:return(r.displayName||"Context")+".Consumer";case oe:return(r._context.displayName||"Context")+".Provider";case ve:var s=r.render;return r=r.displayName,r||(r=s.displayName||s.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case Oe:return s=r.displayName||null,s!==null?s:ie(r.type)||"Memo";case be:s=r._payload,r=r._init;try{return ie(r(s))}catch{}}return null}function Ee(r){var s=r.type;switch(r.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=s.render,r=r.displayName||r.name||"",s.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ie(s);case 8:return s===B?"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 s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function ke(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Me(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Et(r){var s=Me(r)?"checked":"value",a=Object.getOwnPropertyDescriptor(r.constructor.prototype,s),c=""+r[s];if(!r.hasOwnProperty(s)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var f=a.get,g=a.set;return Object.defineProperty(r,s,{configurable:!0,get:function(){return f.call(this)},set:function(x){c=""+x,g.call(this,x)}}),Object.defineProperty(r,s,{enumerable:a.enumerable}),{getValue:function(){return c},setValue:function(x){c=""+x},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function Ki(r){r._valueTracker||(r._valueTracker=Et(r))}function Qd(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var a=s.getValue(),c="";return r&&(c=Me(r)?r.checked?"true":"false":r.value),r=c,r!==a?(s.setValue(r),!0):!1}function Gi(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Ja(r,s){var a=s.checked;return K({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:a??r._wrapperState.initialChecked})}function Xd(r,s){var a=s.defaultValue==null?"":s.defaultValue,c=s.checked!=null?s.checked:s.defaultChecked;a=ke(s.value!=null?s.value:a),r._wrapperState={initialChecked:c,initialValue:a,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Zd(r,s){s=s.checked,s!=null&&P(r,"checked",s,!1)}function Ya(r,s){Zd(r,s);var a=ke(s.value),c=s.type;if(a!=null)c==="number"?(a===0&&r.value===""||r.value!=a)&&(r.value=""+a):r.value!==""+a&&(r.value=""+a);else if(c==="submit"||c==="reset"){r.removeAttribute("value");return}s.hasOwnProperty("value")?Qa(r,s.type,a):s.hasOwnProperty("defaultValue")&&Qa(r,s.type,ke(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(r.defaultChecked=!!s.defaultChecked)}function eh(r,s,a){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var c=s.type;if(!(c!=="submit"&&c!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+r._wrapperState.initialValue,a||s===r.value||(r.value=s),r.defaultValue=s}a=r.name,a!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,a!==""&&(r.name=a)}function Qa(r,s,a){(s!=="number"||Gi(r.ownerDocument)!==r)&&(a==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+a&&(r.defaultValue=""+a))}var Ss=Array.isArray;function Tr(r,s,a,c){if(r=r.options,s){s={};for(var f=0;f<a.length;f++)s["$"+a[f]]=!0;for(a=0;a<r.length;a++)f=s.hasOwnProperty("$"+r[a].value),r[a].selected!==f&&(r[a].selected=f),f&&c&&(r[a].defaultSelected=!0)}else{for(a=""+ke(a),s=null,f=0;f<r.length;f++){if(r[f].value===a){r[f].selected=!0,c&&(r[f].defaultSelected=!0);return}s!==null||r[f].disabled||(s=r[f])}s!==null&&(s.selected=!0)}}function Xa(r,s){if(s.dangerouslySetInnerHTML!=null)throw Error(n(91));return K({},s,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function th(r,s){var a=s.value;if(a==null){if(a=s.children,s=s.defaultValue,a!=null){if(s!=null)throw Error(n(92));if(Ss(a)){if(1<a.length)throw Error(n(93));a=a[0]}s=a}s==null&&(s=""),a=s}r._wrapperState={initialValue:ke(a)}}function nh(r,s){var a=ke(s.value),c=ke(s.defaultValue);a!=null&&(a=""+a,a!==r.value&&(r.value=a),s.defaultValue==null&&r.defaultValue!==a&&(r.defaultValue=a)),c!=null&&(r.defaultValue=""+c)}function rh(r){var s=r.textContent;s===r._wrapperState.initialValue&&s!==""&&s!==null&&(r.value=s)}function sh(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Za(r,s){return r==null||r==="http://www.w3.org/1999/xhtml"?sh(s):r==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var Ji,ih=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,a,c,f){MSApp.execUnsafeLocalFunction(function(){return r(s,a,c,f)})}:r})(function(r,s){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=s;else{for(Ji=Ji||document.createElement("div"),Ji.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=Ji.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;s.firstChild;)r.appendChild(s.firstChild)}});function ks(r,s){if(s){var a=r.firstChild;if(a&&a===r.lastChild&&a.nodeType===3){a.nodeValue=s;return}}r.textContent=s}var Es={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},D0=["Webkit","ms","Moz","O"];Object.keys(Es).forEach(function(r){D0.forEach(function(s){s=s+r.charAt(0).toUpperCase()+r.substring(1),Es[s]=Es[r]})});function oh(r,s,a){return s==null||typeof s=="boolean"||s===""?"":a||typeof s!="number"||s===0||Es.hasOwnProperty(r)&&Es[r]?(""+s).trim():s+"px"}function ah(r,s){r=r.style;for(var a in s)if(s.hasOwnProperty(a)){var c=a.indexOf("--")===0,f=oh(a,s[a],c);a==="float"&&(a="cssFloat"),c?r.setProperty(a,f):r[a]=f}}var L0=K({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 el(r,s){if(s){if(L0[r]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(n(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(n(61))}if(s.style!=null&&typeof s.style!="object")throw Error(n(62))}}function tl(r,s){if(r.indexOf("-")===-1)return typeof s.is=="string";switch(r){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 nl=null;function rl(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var sl=null,jr=null,Cr=null;function lh(r){if(r=Ks(r)){if(typeof sl!="function")throw Error(n(280));var s=r.stateNode;s&&(s=wo(s),sl(r.stateNode,r.type,s))}}function uh(r){jr?Cr?Cr.push(r):Cr=[r]:jr=r}function ch(){if(jr){var r=jr,s=Cr;if(Cr=jr=null,lh(r),s)for(r=0;r<s.length;r++)lh(s[r])}}function dh(r,s){return r(s)}function hh(){}var il=!1;function fh(r,s,a){if(il)return r(s,a);il=!0;try{return dh(r,s,a)}finally{il=!1,(jr!==null||Cr!==null)&&(hh(),ch())}}function Ts(r,s){var a=r.stateNode;if(a===null)return null;var c=wo(a);if(c===null)return null;a=c[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(r=r.type,c=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!c;break e;default:r=!1}if(r)return null;if(a&&typeof a!="function")throw Error(n(231,s,typeof a));return a}var ol=!1;if(d)try{var js={};Object.defineProperty(js,"passive",{get:function(){ol=!0}}),window.addEventListener("test",js,js),window.removeEventListener("test",js,js)}catch{ol=!1}function M0(r,s,a,c,f,g,x,T,C){var L=Array.prototype.slice.call(arguments,3);try{s.apply(a,L)}catch(W){this.onError(W)}}var Cs=!1,Yi=null,Qi=!1,al=null,U0={onError:function(r){Cs=!0,Yi=r}};function $0(r,s,a,c,f,g,x,T,C){Cs=!1,Yi=null,M0.apply(U0,arguments)}function V0(r,s,a,c,f,g,x,T,C){if($0.apply(this,arguments),Cs){if(Cs){var L=Yi;Cs=!1,Yi=null}else throw Error(n(198));Qi||(Qi=!0,al=L)}}function Qn(r){var s=r,a=r;if(r.alternate)for(;s.return;)s=s.return;else{r=s;do s=r,(s.flags&4098)!==0&&(a=s.return),r=s.return;while(r)}return s.tag===3?a:null}function ph(r){if(r.tag===13){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function mh(r){if(Qn(r)!==r)throw Error(n(188))}function F0(r){var s=r.alternate;if(!s){if(s=Qn(r),s===null)throw Error(n(188));return s!==r?null:r}for(var a=r,c=s;;){var f=a.return;if(f===null)break;var g=f.alternate;if(g===null){if(c=f.return,c!==null){a=c;continue}break}if(f.child===g.child){for(g=f.child;g;){if(g===a)return mh(f),r;if(g===c)return mh(f),s;g=g.sibling}throw Error(n(188))}if(a.return!==c.return)a=f,c=g;else{for(var x=!1,T=f.child;T;){if(T===a){x=!0,a=f,c=g;break}if(T===c){x=!0,c=f,a=g;break}T=T.sibling}if(!x){for(T=g.child;T;){if(T===a){x=!0,a=g,c=f;break}if(T===c){x=!0,c=g,a=f;break}T=T.sibling}if(!x)throw Error(n(189))}}if(a.alternate!==c)throw Error(n(190))}if(a.tag!==3)throw Error(n(188));return a.stateNode.current===a?r:s}function gh(r){return r=F0(r),r!==null?yh(r):null}function yh(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var s=yh(r);if(s!==null)return s;r=r.sibling}return null}var vh=e.unstable_scheduleCallback,wh=e.unstable_cancelCallback,B0=e.unstable_shouldYield,z0=e.unstable_requestPaint,He=e.unstable_now,q0=e.unstable_getCurrentPriorityLevel,ll=e.unstable_ImmediatePriority,xh=e.unstable_UserBlockingPriority,Xi=e.unstable_NormalPriority,W0=e.unstable_LowPriority,bh=e.unstable_IdlePriority,Zi=null,tn=null;function H0(r){if(tn&&typeof tn.onCommitFiberRoot=="function")try{tn.onCommitFiberRoot(Zi,r,void 0,(r.current.flags&128)===128)}catch{}}var zt=Math.clz32?Math.clz32:J0,K0=Math.log,G0=Math.LN2;function J0(r){return r>>>=0,r===0?32:31-(K0(r)/G0|0)|0}var eo=64,to=4194304;function Ns(r){switch(r&-r){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 r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function no(r,s){var a=r.pendingLanes;if(a===0)return 0;var c=0,f=r.suspendedLanes,g=r.pingedLanes,x=a&268435455;if(x!==0){var T=x&~f;T!==0?c=Ns(T):(g&=x,g!==0&&(c=Ns(g)))}else x=a&~f,x!==0?c=Ns(x):g!==0&&(c=Ns(g));if(c===0)return 0;if(s!==0&&s!==c&&(s&f)===0&&(f=c&-c,g=s&-s,f>=g||f===16&&(g&4194240)!==0))return s;if((c&4)!==0&&(c|=a&16),s=r.entangledLanes,s!==0)for(r=r.entanglements,s&=c;0<s;)a=31-zt(s),f=1<<a,c|=r[a],s&=~f;return c}function Y0(r,s){switch(r){case 1:case 2:case 4:return s+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Q0(r,s){for(var a=r.suspendedLanes,c=r.pingedLanes,f=r.expirationTimes,g=r.pendingLanes;0<g;){var x=31-zt(g),T=1<<x,C=f[x];C===-1?((T&a)===0||(T&c)!==0)&&(f[x]=Y0(T,s)):C<=s&&(r.expiredLanes|=T),g&=~T}}function ul(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function _h(){var r=eo;return eo<<=1,(eo&4194240)===0&&(eo=64),r}function cl(r){for(var s=[],a=0;31>a;a++)s.push(r);return s}function As(r,s,a){r.pendingLanes|=s,s!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,s=31-zt(s),r[s]=a}function X0(r,s){var a=r.pendingLanes&~s;r.pendingLanes=s,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=s,r.mutableReadLanes&=s,r.entangledLanes&=s,s=r.entanglements;var c=r.eventTimes;for(r=r.expirationTimes;0<a;){var f=31-zt(a),g=1<<f;s[f]=0,c[f]=-1,r[f]=-1,a&=~g}}function dl(r,s){var a=r.entangledLanes|=s;for(r=r.entanglements;a;){var c=31-zt(a),f=1<<c;f&s|r[c]&s&&(r[c]|=s),a&=~f}}var Ce=0;function Sh(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var kh,hl,Eh,Th,jh,fl=!1,ro=[],kn=null,En=null,Tn=null,Ps=new Map,Rs=new Map,jn=[],Z0="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Ch(r,s){switch(r){case"focusin":case"focusout":kn=null;break;case"dragenter":case"dragleave":En=null;break;case"mouseover":case"mouseout":Tn=null;break;case"pointerover":case"pointerout":Ps.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Rs.delete(s.pointerId)}}function Os(r,s,a,c,f,g){return r===null||r.nativeEvent!==g?(r={blockedOn:s,domEventName:a,eventSystemFlags:c,nativeEvent:g,targetContainers:[f]},s!==null&&(s=Ks(s),s!==null&&hl(s)),r):(r.eventSystemFlags|=c,s=r.targetContainers,f!==null&&s.indexOf(f)===-1&&s.push(f),r)}function ew(r,s,a,c,f){switch(s){case"focusin":return kn=Os(kn,r,s,a,c,f),!0;case"dragenter":return En=Os(En,r,s,a,c,f),!0;case"mouseover":return Tn=Os(Tn,r,s,a,c,f),!0;case"pointerover":var g=f.pointerId;return Ps.set(g,Os(Ps.get(g)||null,r,s,a,c,f)),!0;case"gotpointercapture":return g=f.pointerId,Rs.set(g,Os(Rs.get(g)||null,r,s,a,c,f)),!0}return!1}function Nh(r){var s=Xn(r.target);if(s!==null){var a=Qn(s);if(a!==null){if(s=a.tag,s===13){if(s=ph(a),s!==null){r.blockedOn=s,jh(r.priority,function(){Eh(a)});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){r.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}r.blockedOn=null}function so(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var a=ml(r.domEventName,r.eventSystemFlags,s[0],r.nativeEvent);if(a===null){a=r.nativeEvent;var c=new a.constructor(a.type,a);nl=c,a.target.dispatchEvent(c),nl=null}else return s=Ks(a),s!==null&&hl(s),r.blockedOn=a,!1;s.shift()}return!0}function Ah(r,s,a){so(r)&&a.delete(s)}function tw(){fl=!1,kn!==null&&so(kn)&&(kn=null),En!==null&&so(En)&&(En=null),Tn!==null&&so(Tn)&&(Tn=null),Ps.forEach(Ah),Rs.forEach(Ah)}function Is(r,s){r.blockedOn===s&&(r.blockedOn=null,fl||(fl=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,tw)))}function Ds(r){function s(f){return Is(f,r)}if(0<ro.length){Is(ro[0],r);for(var a=1;a<ro.length;a++){var c=ro[a];c.blockedOn===r&&(c.blockedOn=null)}}for(kn!==null&&Is(kn,r),En!==null&&Is(En,r),Tn!==null&&Is(Tn,r),Ps.forEach(s),Rs.forEach(s),a=0;a<jn.length;a++)c=jn[a],c.blockedOn===r&&(c.blockedOn=null);for(;0<jn.length&&(a=jn[0],a.blockedOn===null);)Nh(a),a.blockedOn===null&&jn.shift()}var Nr=U.ReactCurrentBatchConfig,io=!0;function nw(r,s,a,c){var f=Ce,g=Nr.transition;Nr.transition=null;try{Ce=1,pl(r,s,a,c)}finally{Ce=f,Nr.transition=g}}function rw(r,s,a,c){var f=Ce,g=Nr.transition;Nr.transition=null;try{Ce=4,pl(r,s,a,c)}finally{Ce=f,Nr.transition=g}}function pl(r,s,a,c){if(io){var f=ml(r,s,a,c);if(f===null)Rl(r,s,c,oo,a),Ch(r,c);else if(ew(f,r,s,a,c))c.stopPropagation();else if(Ch(r,c),s&4&&-1<Z0.indexOf(r)){for(;f!==null;){var g=Ks(f);if(g!==null&&kh(g),g=ml(r,s,a,c),g===null&&Rl(r,s,c,oo,a),g===f)break;f=g}f!==null&&c.stopPropagation()}else Rl(r,s,c,null,a)}}var oo=null;function ml(r,s,a,c){if(oo=null,r=rl(c),r=Xn(r),r!==null)if(s=Qn(r),s===null)r=null;else if(a=s.tag,a===13){if(r=ph(s),r!==null)return r;r=null}else if(a===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;r=null}else s!==r&&(r=null);return oo=r,null}function Ph(r){switch(r){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(q0()){case ll:return 1;case xh:return 4;case Xi:case W0:return 16;case bh:return 536870912;default:return 16}default:return 16}}var Cn=null,gl=null,ao=null;function Rh(){if(ao)return ao;var r,s=gl,a=s.length,c,f="value"in Cn?Cn.value:Cn.textContent,g=f.length;for(r=0;r<a&&s[r]===f[r];r++);var x=a-r;for(c=1;c<=x&&s[a-c]===f[g-c];c++);return ao=f.slice(r,1<c?1-c:void 0)}function lo(r){var s=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&s===13&&(r=13)):r=s,r===10&&(r=13),32<=r||r===13?r:0}function uo(){return!0}function Oh(){return!1}function Tt(r){function s(a,c,f,g,x){this._reactName=a,this._targetInst=f,this.type=c,this.nativeEvent=g,this.target=x,this.currentTarget=null;for(var T in r)r.hasOwnProperty(T)&&(a=r[T],this[T]=a?a(g):g[T]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?uo:Oh,this.isPropagationStopped=Oh,this}return K(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=uo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=uo)},persist:function(){},isPersistent:uo}),s}var Ar={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},yl=Tt(Ar),Ls=K({},Ar,{view:0,detail:0}),sw=Tt(Ls),vl,wl,Ms,co=K({},Ls,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:bl,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Ms&&(Ms&&r.type==="mousemove"?(vl=r.screenX-Ms.screenX,wl=r.screenY-Ms.screenY):wl=vl=0,Ms=r),vl)},movementY:function(r){return"movementY"in r?r.movementY:wl}}),Ih=Tt(co),iw=K({},co,{dataTransfer:0}),ow=Tt(iw),aw=K({},Ls,{relatedTarget:0}),xl=Tt(aw),lw=K({},Ar,{animationName:0,elapsedTime:0,pseudoElement:0}),uw=Tt(lw),cw=K({},Ar,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),dw=Tt(cw),hw=K({},Ar,{data:0}),Dh=Tt(hw),fw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pw={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},mw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function gw(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=mw[r])?!!s[r]:!1}function bl(){return gw}var yw=K({},Ls,{key:function(r){if(r.key){var s=fw[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=lo(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?pw[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:bl,charCode:function(r){return r.type==="keypress"?lo(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?lo(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),vw=Tt(yw),ww=K({},co,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lh=Tt(ww),xw=K({},Ls,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:bl}),bw=Tt(xw),_w=K({},Ar,{propertyName:0,elapsedTime:0,pseudoElement:0}),Sw=Tt(_w),kw=K({},co,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),Ew=Tt(kw),Tw=[9,13,27,32],_l=d&&"CompositionEvent"in window,Us=null;d&&"documentMode"in document&&(Us=document.documentMode);var jw=d&&"TextEvent"in window&&!Us,Mh=d&&(!_l||Us&&8<Us&&11>=Us),Uh=" ",$h=!1;function Vh(r,s){switch(r){case"keyup":return Tw.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fh(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Pr=!1;function Cw(r,s){switch(r){case"compositionend":return Fh(s);case"keypress":return s.which!==32?null:($h=!0,Uh);case"textInput":return r=s.data,r===Uh&&$h?null:r;default:return null}}function Nw(r,s){if(Pr)return r==="compositionend"||!_l&&Vh(r,s)?(r=Rh(),ao=gl=Cn=null,Pr=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Mh&&s.locale!=="ko"?null:s.data;default:return null}}var Aw={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Bh(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!Aw[r.type]:s==="textarea"}function zh(r,s,a,c){uh(c),s=go(s,"onChange"),0<s.length&&(a=new yl("onChange","change",null,a,c),r.push({event:a,listeners:s}))}var $s=null,Vs=null;function Pw(r){lf(r,0)}function ho(r){var s=Lr(r);if(Qd(s))return r}function Rw(r,s){if(r==="change")return s}var qh=!1;if(d){var Sl;if(d){var kl="oninput"in document;if(!kl){var Wh=document.createElement("div");Wh.setAttribute("oninput","return;"),kl=typeof Wh.oninput=="function"}Sl=kl}else Sl=!1;qh=Sl&&(!document.documentMode||9<document.documentMode)}function Hh(){$s&&($s.detachEvent("onpropertychange",Kh),Vs=$s=null)}function Kh(r){if(r.propertyName==="value"&&ho(Vs)){var s=[];zh(s,Vs,r,rl(r)),fh(Pw,s)}}function Ow(r,s,a){r==="focusin"?(Hh(),$s=s,Vs=a,$s.attachEvent("onpropertychange",Kh)):r==="focusout"&&Hh()}function Iw(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return ho(Vs)}function Dw(r,s){if(r==="click")return ho(s)}function Lw(r,s){if(r==="input"||r==="change")return ho(s)}function Mw(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var qt=typeof Object.is=="function"?Object.is:Mw;function Fs(r,s){if(qt(r,s))return!0;if(typeof r!="object"||r===null||typeof s!="object"||s===null)return!1;var a=Object.keys(r),c=Object.keys(s);if(a.length!==c.length)return!1;for(c=0;c<a.length;c++){var f=a[c];if(!h.call(s,f)||!qt(r[f],s[f]))return!1}return!0}function Gh(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Jh(r,s){var a=Gh(r);r=0;for(var c;a;){if(a.nodeType===3){if(c=r+a.textContent.length,r<=s&&c>=s)return{node:a,offset:s-r};r=c}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Gh(a)}}function Yh(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?Yh(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function Qh(){for(var r=window,s=Gi();s instanceof r.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)r=s.contentWindow;else break;s=Gi(r.document)}return s}function El(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}function Uw(r){var s=Qh(),a=r.focusedElem,c=r.selectionRange;if(s!==a&&a&&a.ownerDocument&&Yh(a.ownerDocument.documentElement,a)){if(c!==null&&El(a)){if(s=c.start,r=c.end,r===void 0&&(r=s),"selectionStart"in a)a.selectionStart=s,a.selectionEnd=Math.min(r,a.value.length);else if(r=(s=a.ownerDocument||document)&&s.defaultView||window,r.getSelection){r=r.getSelection();var f=a.textContent.length,g=Math.min(c.start,f);c=c.end===void 0?g:Math.min(c.end,f),!r.extend&&g>c&&(f=c,c=g,g=f),f=Jh(a,g);var x=Jh(a,c);f&&x&&(r.rangeCount!==1||r.anchorNode!==f.node||r.anchorOffset!==f.offset||r.focusNode!==x.node||r.focusOffset!==x.offset)&&(s=s.createRange(),s.setStart(f.node,f.offset),r.removeAllRanges(),g>c?(r.addRange(s),r.extend(x.node,x.offset)):(s.setEnd(x.node,x.offset),r.addRange(s)))}}for(s=[],r=a;r=r.parentNode;)r.nodeType===1&&s.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<s.length;a++)r=s[a],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var $w=d&&"documentMode"in document&&11>=document.documentMode,Rr=null,Tl=null,Bs=null,jl=!1;function Xh(r,s,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;jl||Rr==null||Rr!==Gi(c)||(c=Rr,"selectionStart"in c&&El(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Bs&&Fs(Bs,c)||(Bs=c,c=go(Tl,"onSelect"),0<c.length&&(s=new yl("onSelect","select",null,s,a),r.push({event:s,listeners:c}),s.target=Rr)))}function fo(r,s){var a={};return a[r.toLowerCase()]=s.toLowerCase(),a["Webkit"+r]="webkit"+s,a["Moz"+r]="moz"+s,a}var Or={animationend:fo("Animation","AnimationEnd"),animationiteration:fo("Animation","AnimationIteration"),animationstart:fo("Animation","AnimationStart"),transitionend:fo("Transition","TransitionEnd")},Cl={},Zh={};d&&(Zh=document.createElement("div").style,"AnimationEvent"in window||(delete Or.animationend.animation,delete Or.animationiteration.animation,delete Or.animationstart.animation),"TransitionEvent"in window||delete Or.transitionend.transition);function po(r){if(Cl[r])return Cl[r];if(!Or[r])return r;var s=Or[r],a;for(a in s)if(s.hasOwnProperty(a)&&a in Zh)return Cl[r]=s[a];return r}var ef=po("animationend"),tf=po("animationiteration"),nf=po("animationstart"),rf=po("transitionend"),sf=new Map,of="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Nn(r,s){sf.set(r,s),l(s,[r])}for(var Nl=0;Nl<of.length;Nl++){var Al=of[Nl],Vw=Al.toLowerCase(),Fw=Al[0].toUpperCase()+Al.slice(1);Nn(Vw,"on"+Fw)}Nn(ef,"onAnimationEnd"),Nn(tf,"onAnimationIteration"),Nn(nf,"onAnimationStart"),Nn("dblclick","onDoubleClick"),Nn("focusin","onFocus"),Nn("focusout","onBlur"),Nn(rf,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var zs="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Bw=new Set("cancel close invalid load scroll toggle".split(" ").concat(zs));function af(r,s,a){var c=r.type||"unknown-event";r.currentTarget=a,V0(c,s,void 0,r),r.currentTarget=null}function lf(r,s){s=(s&4)!==0;for(var a=0;a<r.length;a++){var c=r[a],f=c.event;c=c.listeners;e:{var g=void 0;if(s)for(var x=c.length-1;0<=x;x--){var T=c[x],C=T.instance,L=T.currentTarget;if(T=T.listener,C!==g&&f.isPropagationStopped())break e;af(f,T,L),g=C}else for(x=0;x<c.length;x++){if(T=c[x],C=T.instance,L=T.currentTarget,T=T.listener,C!==g&&f.isPropagationStopped())break e;af(f,T,L),g=C}}}if(Qi)throw r=al,Qi=!1,al=null,r}function Ie(r,s){var a=s[Ul];a===void 0&&(a=s[Ul]=new Set);var c=r+"__bubble";a.has(c)||(uf(s,r,2,!1),a.add(c))}function Pl(r,s,a){var c=0;s&&(c|=4),uf(a,r,c,s)}var mo="_reactListening"+Math.random().toString(36).slice(2);function qs(r){if(!r[mo]){r[mo]=!0,i.forEach(function(a){a!=="selectionchange"&&(Bw.has(a)||Pl(a,!1,r),Pl(a,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[mo]||(s[mo]=!0,Pl("selectionchange",!1,s))}}function uf(r,s,a,c){switch(Ph(s)){case 1:var f=nw;break;case 4:f=rw;break;default:f=pl}a=f.bind(null,s,a,r),f=void 0,!ol||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(f=!0),c?f!==void 0?r.addEventListener(s,a,{capture:!0,passive:f}):r.addEventListener(s,a,!0):f!==void 0?r.addEventListener(s,a,{passive:f}):r.addEventListener(s,a,!1)}function Rl(r,s,a,c,f){var g=c;if((s&1)===0&&(s&2)===0&&c!==null)e:for(;;){if(c===null)return;var x=c.tag;if(x===3||x===4){var T=c.stateNode.containerInfo;if(T===f||T.nodeType===8&&T.parentNode===f)break;if(x===4)for(x=c.return;x!==null;){var C=x.tag;if((C===3||C===4)&&(C=x.stateNode.containerInfo,C===f||C.nodeType===8&&C.parentNode===f))return;x=x.return}for(;T!==null;){if(x=Xn(T),x===null)return;if(C=x.tag,C===5||C===6){c=g=x;continue e}T=T.parentNode}}c=c.return}fh(function(){var L=g,W=rl(a),H=[];e:{var q=sf.get(r);if(q!==void 0){var Q=yl,Z=r;switch(r){case"keypress":if(lo(a)===0)break e;case"keydown":case"keyup":Q=vw;break;case"focusin":Z="focus",Q=xl;break;case"focusout":Z="blur",Q=xl;break;case"beforeblur":case"afterblur":Q=xl;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Q=Ih;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=ow;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=bw;break;case ef:case tf:case nf:Q=uw;break;case rf:Q=Sw;break;case"scroll":Q=sw;break;case"wheel":Q=Ew;break;case"copy":case"cut":case"paste":Q=dw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=Lh}var ee=(s&4)!==0,Ke=!ee&&r==="scroll",O=ee?q!==null?q+"Capture":null:q;ee=[];for(var N=L,I;N!==null;){I=N;var G=I.stateNode;if(I.tag===5&&G!==null&&(I=G,O!==null&&(G=Ts(N,O),G!=null&&ee.push(Ws(N,G,I)))),Ke)break;N=N.return}0<ee.length&&(q=new Q(q,Z,null,a,W),H.push({event:q,listeners:ee}))}}if((s&7)===0){e:{if(q=r==="mouseover"||r==="pointerover",Q=r==="mouseout"||r==="pointerout",q&&a!==nl&&(Z=a.relatedTarget||a.fromElement)&&(Xn(Z)||Z[cn]))break e;if((Q||q)&&(q=W.window===W?W:(q=W.ownerDocument)?q.defaultView||q.parentWindow:window,Q?(Z=a.relatedTarget||a.toElement,Q=L,Z=Z?Xn(Z):null,Z!==null&&(Ke=Qn(Z),Z!==Ke||Z.tag!==5&&Z.tag!==6)&&(Z=null)):(Q=null,Z=L),Q!==Z)){if(ee=Ih,G="onMouseLeave",O="onMouseEnter",N="mouse",(r==="pointerout"||r==="pointerover")&&(ee=Lh,G="onPointerLeave",O="onPointerEnter",N="pointer"),Ke=Q==null?q:Lr(Q),I=Z==null?q:Lr(Z),q=new ee(G,N+"leave",Q,a,W),q.target=Ke,q.relatedTarget=I,G=null,Xn(W)===L&&(ee=new ee(O,N+"enter",Z,a,W),ee.target=I,ee.relatedTarget=Ke,G=ee),Ke=G,Q&&Z)t:{for(ee=Q,O=Z,N=0,I=ee;I;I=Ir(I))N++;for(I=0,G=O;G;G=Ir(G))I++;for(;0<N-I;)ee=Ir(ee),N--;for(;0<I-N;)O=Ir(O),I--;for(;N--;){if(ee===O||O!==null&&ee===O.alternate)break t;ee=Ir(ee),O=Ir(O)}ee=null}else ee=null;Q!==null&&cf(H,q,Q,ee,!1),Z!==null&&Ke!==null&&cf(H,Ke,Z,ee,!0)}}e:{if(q=L?Lr(L):window,Q=q.nodeName&&q.nodeName.toLowerCase(),Q==="select"||Q==="input"&&q.type==="file")var te=Rw;else if(Bh(q))if(qh)te=Lw;else{te=Iw;var ae=Ow}else(Q=q.nodeName)&&Q.toLowerCase()==="input"&&(q.type==="checkbox"||q.type==="radio")&&(te=Dw);if(te&&(te=te(r,L))){zh(H,te,a,W);break e}ae&&ae(r,q,L),r==="focusout"&&(ae=q._wrapperState)&&ae.controlled&&q.type==="number"&&Qa(q,"number",q.value)}switch(ae=L?Lr(L):window,r){case"focusin":(Bh(ae)||ae.contentEditable==="true")&&(Rr=ae,Tl=L,Bs=null);break;case"focusout":Bs=Tl=Rr=null;break;case"mousedown":jl=!0;break;case"contextmenu":case"mouseup":case"dragend":jl=!1,Xh(H,a,W);break;case"selectionchange":if($w)break;case"keydown":case"keyup":Xh(H,a,W)}var le;if(_l)e:{switch(r){case"compositionstart":var me="onCompositionStart";break e;case"compositionend":me="onCompositionEnd";break e;case"compositionupdate":me="onCompositionUpdate";break e}me=void 0}else Pr?Vh(r,a)&&(me="onCompositionEnd"):r==="keydown"&&a.keyCode===229&&(me="onCompositionStart");me&&(Mh&&a.locale!=="ko"&&(Pr||me!=="onCompositionStart"?me==="onCompositionEnd"&&Pr&&(le=Rh()):(Cn=W,gl="value"in Cn?Cn.value:Cn.textContent,Pr=!0)),ae=go(L,me),0<ae.length&&(me=new Dh(me,r,null,a,W),H.push({event:me,listeners:ae}),le?me.data=le:(le=Fh(a),le!==null&&(me.data=le)))),(le=jw?Cw(r,a):Nw(r,a))&&(L=go(L,"onBeforeInput"),0<L.length&&(W=new Dh("onBeforeInput","beforeinput",null,a,W),H.push({event:W,listeners:L}),W.data=le))}lf(H,s)})}function Ws(r,s,a){return{instance:r,listener:s,currentTarget:a}}function go(r,s){for(var a=s+"Capture",c=[];r!==null;){var f=r,g=f.stateNode;f.tag===5&&g!==null&&(f=g,g=Ts(r,a),g!=null&&c.unshift(Ws(r,g,f)),g=Ts(r,s),g!=null&&c.push(Ws(r,g,f))),r=r.return}return c}function Ir(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function cf(r,s,a,c,f){for(var g=s._reactName,x=[];a!==null&&a!==c;){var T=a,C=T.alternate,L=T.stateNode;if(C!==null&&C===c)break;T.tag===5&&L!==null&&(T=L,f?(C=Ts(a,g),C!=null&&x.unshift(Ws(a,C,T))):f||(C=Ts(a,g),C!=null&&x.push(Ws(a,C,T)))),a=a.return}x.length!==0&&r.push({event:s,listeners:x})}var zw=/\r\n?/g,qw=/\u0000|\uFFFD/g;function df(r){return(typeof r=="string"?r:""+r).replace(zw,`
6
- `).replace(qw,"")}function yo(r,s,a){if(s=df(s),df(r)!==s&&a)throw Error(n(425))}function vo(){}var Ol=null,Il=null;function Dl(r,s){return r==="textarea"||r==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Ll=typeof setTimeout=="function"?setTimeout:void 0,Ww=typeof clearTimeout=="function"?clearTimeout:void 0,hf=typeof Promise=="function"?Promise:void 0,Hw=typeof queueMicrotask=="function"?queueMicrotask:typeof hf<"u"?function(r){return hf.resolve(null).then(r).catch(Kw)}:Ll;function Kw(r){setTimeout(function(){throw r})}function Ml(r,s){var a=s,c=0;do{var f=a.nextSibling;if(r.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"){if(c===0){r.removeChild(f),Ds(s);return}c--}else a!=="$"&&a!=="$?"&&a!=="$!"||c++;a=f}while(a);Ds(s)}function An(r){for(;r!=null;r=r.nextSibling){var s=r.nodeType;if(s===1||s===3)break;if(s===8){if(s=r.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return r}function ff(r){r=r.previousSibling;for(var s=0;r;){if(r.nodeType===8){var a=r.data;if(a==="$"||a==="$!"||a==="$?"){if(s===0)return r;s--}else a==="/$"&&s++}r=r.previousSibling}return null}var Dr=Math.random().toString(36).slice(2),nn="__reactFiber$"+Dr,Hs="__reactProps$"+Dr,cn="__reactContainer$"+Dr,Ul="__reactEvents$"+Dr,Gw="__reactListeners$"+Dr,Jw="__reactHandles$"+Dr;function Xn(r){var s=r[nn];if(s)return s;for(var a=r.parentNode;a;){if(s=a[cn]||a[nn]){if(a=s.alternate,s.child!==null||a!==null&&a.child!==null)for(r=ff(r);r!==null;){if(a=r[nn])return a;r=ff(r)}return s}r=a,a=r.parentNode}return null}function Ks(r){return r=r[nn]||r[cn],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function Lr(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function wo(r){return r[Hs]||null}var $l=[],Mr=-1;function Pn(r){return{current:r}}function De(r){0>Mr||(r.current=$l[Mr],$l[Mr]=null,Mr--)}function Ae(r,s){Mr++,$l[Mr]=r.current,r.current=s}var Rn={},lt=Pn(Rn),yt=Pn(!1),Zn=Rn;function Ur(r,s){var a=r.type.contextTypes;if(!a)return Rn;var c=r.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===s)return c.__reactInternalMemoizedMaskedChildContext;var f={},g;for(g in a)f[g]=s[g];return c&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=s,r.__reactInternalMemoizedMaskedChildContext=f),f}function vt(r){return r=r.childContextTypes,r!=null}function xo(){De(yt),De(lt)}function pf(r,s,a){if(lt.current!==Rn)throw Error(n(168));Ae(lt,s),Ae(yt,a)}function mf(r,s,a){var c=r.stateNode;if(s=s.childContextTypes,typeof c.getChildContext!="function")return a;c=c.getChildContext();for(var f in c)if(!(f in s))throw Error(n(108,Ee(r)||"Unknown",f));return K({},a,c)}function bo(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||Rn,Zn=lt.current,Ae(lt,r),Ae(yt,yt.current),!0}function gf(r,s,a){var c=r.stateNode;if(!c)throw Error(n(169));a?(r=mf(r,s,Zn),c.__reactInternalMemoizedMergedChildContext=r,De(yt),De(lt),Ae(lt,r)):De(yt),Ae(yt,a)}var dn=null,_o=!1,Vl=!1;function yf(r){dn===null?dn=[r]:dn.push(r)}function Yw(r){_o=!0,yf(r)}function On(){if(!Vl&&dn!==null){Vl=!0;var r=0,s=Ce;try{var a=dn;for(Ce=1;r<a.length;r++){var c=a[r];do c=c(!0);while(c!==null)}dn=null,_o=!1}catch(f){throw dn!==null&&(dn=dn.slice(r+1)),vh(ll,On),f}finally{Ce=s,Vl=!1}}return null}var $r=[],Vr=0,So=null,ko=0,Dt=[],Lt=0,er=null,hn=1,fn="";function tr(r,s){$r[Vr++]=ko,$r[Vr++]=So,So=r,ko=s}function vf(r,s,a){Dt[Lt++]=hn,Dt[Lt++]=fn,Dt[Lt++]=er,er=r;var c=hn;r=fn;var f=32-zt(c)-1;c&=~(1<<f),a+=1;var g=32-zt(s)+f;if(30<g){var x=f-f%5;g=(c&(1<<x)-1).toString(32),c>>=x,f-=x,hn=1<<32-zt(s)+f|a<<f|c,fn=g+r}else hn=1<<g|a<<f|c,fn=r}function Fl(r){r.return!==null&&(tr(r,1),vf(r,1,0))}function Bl(r){for(;r===So;)So=$r[--Vr],$r[Vr]=null,ko=$r[--Vr],$r[Vr]=null;for(;r===er;)er=Dt[--Lt],Dt[Lt]=null,fn=Dt[--Lt],Dt[Lt]=null,hn=Dt[--Lt],Dt[Lt]=null}var jt=null,Ct=null,Ue=!1,Wt=null;function wf(r,s){var a=Vt(5,null,null,0);a.elementType="DELETED",a.stateNode=s,a.return=r,s=r.deletions,s===null?(r.deletions=[a],r.flags|=16):s.push(a)}function xf(r,s){switch(r.tag){case 5:var a=r.type;return s=s.nodeType!==1||a.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(r.stateNode=s,jt=r,Ct=An(s.firstChild),!0):!1;case 6:return s=r.pendingProps===""||s.nodeType!==3?null:s,s!==null?(r.stateNode=s,jt=r,Ct=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(a=er!==null?{id:hn,overflow:fn}:null,r.memoizedState={dehydrated:s,treeContext:a,retryLane:1073741824},a=Vt(18,null,null,0),a.stateNode=s,a.return=r,r.child=a,jt=r,Ct=null,!0):!1;default:return!1}}function zl(r){return(r.mode&1)!==0&&(r.flags&128)===0}function ql(r){if(Ue){var s=Ct;if(s){var a=s;if(!xf(r,s)){if(zl(r))throw Error(n(418));s=An(a.nextSibling);var c=jt;s&&xf(r,s)?wf(c,a):(r.flags=r.flags&-4097|2,Ue=!1,jt=r)}}else{if(zl(r))throw Error(n(418));r.flags=r.flags&-4097|2,Ue=!1,jt=r}}}function bf(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;jt=r}function Eo(r){if(r!==jt)return!1;if(!Ue)return bf(r),Ue=!0,!1;var s;if((s=r.tag!==3)&&!(s=r.tag!==5)&&(s=r.type,s=s!=="head"&&s!=="body"&&!Dl(r.type,r.memoizedProps)),s&&(s=Ct)){if(zl(r))throw _f(),Error(n(418));for(;s;)wf(r,s),s=An(s.nextSibling)}if(bf(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,s=0;r;){if(r.nodeType===8){var a=r.data;if(a==="/$"){if(s===0){Ct=An(r.nextSibling);break e}s--}else a!=="$"&&a!=="$!"&&a!=="$?"||s++}r=r.nextSibling}Ct=null}}else Ct=jt?An(r.stateNode.nextSibling):null;return!0}function _f(){for(var r=Ct;r;)r=An(r.nextSibling)}function Fr(){Ct=jt=null,Ue=!1}function Wl(r){Wt===null?Wt=[r]:Wt.push(r)}var Qw=U.ReactCurrentBatchConfig;function Gs(r,s,a){if(r=a.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(a._owner){if(a=a._owner,a){if(a.tag!==1)throw Error(n(309));var c=a.stateNode}if(!c)throw Error(n(147,r));var f=c,g=""+r;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===g?s.ref:(s=function(x){var T=f.refs;x===null?delete T[g]:T[g]=x},s._stringRef=g,s)}if(typeof r!="string")throw Error(n(284));if(!a._owner)throw Error(n(290,r))}return r}function To(r,s){throw r=Object.prototype.toString.call(s),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r))}function Sf(r){var s=r._init;return s(r._payload)}function kf(r){function s(O,N){if(r){var I=O.deletions;I===null?(O.deletions=[N],O.flags|=16):I.push(N)}}function a(O,N){if(!r)return null;for(;N!==null;)s(O,N),N=N.sibling;return null}function c(O,N){for(O=new Map;N!==null;)N.key!==null?O.set(N.key,N):O.set(N.index,N),N=N.sibling;return O}function f(O,N){return O=Fn(O,N),O.index=0,O.sibling=null,O}function g(O,N,I){return O.index=I,r?(I=O.alternate,I!==null?(I=I.index,I<N?(O.flags|=2,N):I):(O.flags|=2,N)):(O.flags|=1048576,N)}function x(O){return r&&O.alternate===null&&(O.flags|=2),O}function T(O,N,I,G){return N===null||N.tag!==6?(N=Lu(I,O.mode,G),N.return=O,N):(N=f(N,I),N.return=O,N)}function C(O,N,I,G){var te=I.type;return te===$?W(O,N,I.props.children,G,I.key):N!==null&&(N.elementType===te||typeof te=="object"&&te!==null&&te.$$typeof===be&&Sf(te)===N.type)?(G=f(N,I.props),G.ref=Gs(O,N,I),G.return=O,G):(G=Yo(I.type,I.key,I.props,null,O.mode,G),G.ref=Gs(O,N,I),G.return=O,G)}function L(O,N,I,G){return N===null||N.tag!==4||N.stateNode.containerInfo!==I.containerInfo||N.stateNode.implementation!==I.implementation?(N=Mu(I,O.mode,G),N.return=O,N):(N=f(N,I.children||[]),N.return=O,N)}function W(O,N,I,G,te){return N===null||N.tag!==7?(N=ur(I,O.mode,G,te),N.return=O,N):(N=f(N,I),N.return=O,N)}function H(O,N,I){if(typeof N=="string"&&N!==""||typeof N=="number")return N=Lu(""+N,O.mode,I),N.return=O,N;if(typeof N=="object"&&N!==null){switch(N.$$typeof){case V:return I=Yo(N.type,N.key,N.props,null,O.mode,I),I.ref=Gs(O,null,N),I.return=O,I;case z:return N=Mu(N,O.mode,I),N.return=O,N;case be:var G=N._init;return H(O,G(N._payload),I)}if(Ss(N)||J(N))return N=ur(N,O.mode,I,null),N.return=O,N;To(O,N)}return null}function q(O,N,I,G){var te=N!==null?N.key:null;if(typeof I=="string"&&I!==""||typeof I=="number")return te!==null?null:T(O,N,""+I,G);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case V:return I.key===te?C(O,N,I,G):null;case z:return I.key===te?L(O,N,I,G):null;case be:return te=I._init,q(O,N,te(I._payload),G)}if(Ss(I)||J(I))return te!==null?null:W(O,N,I,G,null);To(O,I)}return null}function Q(O,N,I,G,te){if(typeof G=="string"&&G!==""||typeof G=="number")return O=O.get(I)||null,T(N,O,""+G,te);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case V:return O=O.get(G.key===null?I:G.key)||null,C(N,O,G,te);case z:return O=O.get(G.key===null?I:G.key)||null,L(N,O,G,te);case be:var ae=G._init;return Q(O,N,I,ae(G._payload),te)}if(Ss(G)||J(G))return O=O.get(I)||null,W(N,O,G,te,null);To(N,G)}return null}function Z(O,N,I,G){for(var te=null,ae=null,le=N,me=N=0,nt=null;le!==null&&me<I.length;me++){le.index>me?(nt=le,le=null):nt=le.sibling;var Se=q(O,le,I[me],G);if(Se===null){le===null&&(le=nt);break}r&&le&&Se.alternate===null&&s(O,le),N=g(Se,N,me),ae===null?te=Se:ae.sibling=Se,ae=Se,le=nt}if(me===I.length)return a(O,le),Ue&&tr(O,me),te;if(le===null){for(;me<I.length;me++)le=H(O,I[me],G),le!==null&&(N=g(le,N,me),ae===null?te=le:ae.sibling=le,ae=le);return Ue&&tr(O,me),te}for(le=c(O,le);me<I.length;me++)nt=Q(le,O,me,I[me],G),nt!==null&&(r&&nt.alternate!==null&&le.delete(nt.key===null?me:nt.key),N=g(nt,N,me),ae===null?te=nt:ae.sibling=nt,ae=nt);return r&&le.forEach(function(Bn){return s(O,Bn)}),Ue&&tr(O,me),te}function ee(O,N,I,G){var te=J(I);if(typeof te!="function")throw Error(n(150));if(I=te.call(I),I==null)throw Error(n(151));for(var ae=te=null,le=N,me=N=0,nt=null,Se=I.next();le!==null&&!Se.done;me++,Se=I.next()){le.index>me?(nt=le,le=null):nt=le.sibling;var Bn=q(O,le,Se.value,G);if(Bn===null){le===null&&(le=nt);break}r&&le&&Bn.alternate===null&&s(O,le),N=g(Bn,N,me),ae===null?te=Bn:ae.sibling=Bn,ae=Bn,le=nt}if(Se.done)return a(O,le),Ue&&tr(O,me),te;if(le===null){for(;!Se.done;me++,Se=I.next())Se=H(O,Se.value,G),Se!==null&&(N=g(Se,N,me),ae===null?te=Se:ae.sibling=Se,ae=Se);return Ue&&tr(O,me),te}for(le=c(O,le);!Se.done;me++,Se=I.next())Se=Q(le,O,me,Se.value,G),Se!==null&&(r&&Se.alternate!==null&&le.delete(Se.key===null?me:Se.key),N=g(Se,N,me),ae===null?te=Se:ae.sibling=Se,ae=Se);return r&&le.forEach(function(Ax){return s(O,Ax)}),Ue&&tr(O,me),te}function Ke(O,N,I,G){if(typeof I=="object"&&I!==null&&I.type===$&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case V:e:{for(var te=I.key,ae=N;ae!==null;){if(ae.key===te){if(te=I.type,te===$){if(ae.tag===7){a(O,ae.sibling),N=f(ae,I.props.children),N.return=O,O=N;break e}}else if(ae.elementType===te||typeof te=="object"&&te!==null&&te.$$typeof===be&&Sf(te)===ae.type){a(O,ae.sibling),N=f(ae,I.props),N.ref=Gs(O,ae,I),N.return=O,O=N;break e}a(O,ae);break}else s(O,ae);ae=ae.sibling}I.type===$?(N=ur(I.props.children,O.mode,G,I.key),N.return=O,O=N):(G=Yo(I.type,I.key,I.props,null,O.mode,G),G.ref=Gs(O,N,I),G.return=O,O=G)}return x(O);case z:e:{for(ae=I.key;N!==null;){if(N.key===ae)if(N.tag===4&&N.stateNode.containerInfo===I.containerInfo&&N.stateNode.implementation===I.implementation){a(O,N.sibling),N=f(N,I.children||[]),N.return=O,O=N;break e}else{a(O,N);break}else s(O,N);N=N.sibling}N=Mu(I,O.mode,G),N.return=O,O=N}return x(O);case be:return ae=I._init,Ke(O,N,ae(I._payload),G)}if(Ss(I))return Z(O,N,I,G);if(J(I))return ee(O,N,I,G);To(O,I)}return typeof I=="string"&&I!==""||typeof I=="number"?(I=""+I,N!==null&&N.tag===6?(a(O,N.sibling),N=f(N,I),N.return=O,O=N):(a(O,N),N=Lu(I,O.mode,G),N.return=O,O=N),x(O)):a(O,N)}return Ke}var Br=kf(!0),Ef=kf(!1),jo=Pn(null),Co=null,zr=null,Hl=null;function Kl(){Hl=zr=Co=null}function Gl(r){var s=jo.current;De(jo),r._currentValue=s}function Jl(r,s,a){for(;r!==null;){var c=r.alternate;if((r.childLanes&s)!==s?(r.childLanes|=s,c!==null&&(c.childLanes|=s)):c!==null&&(c.childLanes&s)!==s&&(c.childLanes|=s),r===a)break;r=r.return}}function qr(r,s){Co=r,Hl=zr=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&s)!==0&&(wt=!0),r.firstContext=null)}function Mt(r){var s=r._currentValue;if(Hl!==r)if(r={context:r,memoizedValue:s,next:null},zr===null){if(Co===null)throw Error(n(308));zr=r,Co.dependencies={lanes:0,firstContext:r}}else zr=zr.next=r;return s}var nr=null;function Yl(r){nr===null?nr=[r]:nr.push(r)}function Tf(r,s,a,c){var f=s.interleaved;return f===null?(a.next=a,Yl(s)):(a.next=f.next,f.next=a),s.interleaved=a,pn(r,c)}function pn(r,s){r.lanes|=s;var a=r.alternate;for(a!==null&&(a.lanes|=s),a=r,r=r.return;r!==null;)r.childLanes|=s,a=r.alternate,a!==null&&(a.childLanes|=s),a=r,r=r.return;return a.tag===3?a.stateNode:null}var In=!1;function Ql(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function jf(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function mn(r,s){return{eventTime:r,lane:s,tag:0,payload:null,callback:null,next:null}}function Dn(r,s,a){var c=r.updateQueue;if(c===null)return null;if(c=c.shared,(_e&2)!==0){var f=c.pending;return f===null?s.next=s:(s.next=f.next,f.next=s),c.pending=s,pn(r,a)}return f=c.interleaved,f===null?(s.next=s,Yl(c)):(s.next=f.next,f.next=s),c.interleaved=s,pn(r,a)}function No(r,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194240)!==0)){var c=s.lanes;c&=r.pendingLanes,a|=c,s.lanes=a,dl(r,a)}}function Cf(r,s){var a=r.updateQueue,c=r.alternate;if(c!==null&&(c=c.updateQueue,a===c)){var f=null,g=null;if(a=a.firstBaseUpdate,a!==null){do{var x={eventTime:a.eventTime,lane:a.lane,tag:a.tag,payload:a.payload,callback:a.callback,next:null};g===null?f=g=x:g=g.next=x,a=a.next}while(a!==null);g===null?f=g=s:g=g.next=s}else f=g=s;a={baseState:c.baseState,firstBaseUpdate:f,lastBaseUpdate:g,shared:c.shared,effects:c.effects},r.updateQueue=a;return}r=a.lastBaseUpdate,r===null?a.firstBaseUpdate=s:r.next=s,a.lastBaseUpdate=s}function Ao(r,s,a,c){var f=r.updateQueue;In=!1;var g=f.firstBaseUpdate,x=f.lastBaseUpdate,T=f.shared.pending;if(T!==null){f.shared.pending=null;var C=T,L=C.next;C.next=null,x===null?g=L:x.next=L,x=C;var W=r.alternate;W!==null&&(W=W.updateQueue,T=W.lastBaseUpdate,T!==x&&(T===null?W.firstBaseUpdate=L:T.next=L,W.lastBaseUpdate=C))}if(g!==null){var H=f.baseState;x=0,W=L=C=null,T=g;do{var q=T.lane,Q=T.eventTime;if((c&q)===q){W!==null&&(W=W.next={eventTime:Q,lane:0,tag:T.tag,payload:T.payload,callback:T.callback,next:null});e:{var Z=r,ee=T;switch(q=s,Q=a,ee.tag){case 1:if(Z=ee.payload,typeof Z=="function"){H=Z.call(Q,H,q);break e}H=Z;break e;case 3:Z.flags=Z.flags&-65537|128;case 0:if(Z=ee.payload,q=typeof Z=="function"?Z.call(Q,H,q):Z,q==null)break e;H=K({},H,q);break e;case 2:In=!0}}T.callback!==null&&T.lane!==0&&(r.flags|=64,q=f.effects,q===null?f.effects=[T]:q.push(T))}else Q={eventTime:Q,lane:q,tag:T.tag,payload:T.payload,callback:T.callback,next:null},W===null?(L=W=Q,C=H):W=W.next=Q,x|=q;if(T=T.next,T===null){if(T=f.shared.pending,T===null)break;q=T,T=q.next,q.next=null,f.lastBaseUpdate=q,f.shared.pending=null}}while(!0);if(W===null&&(C=H),f.baseState=C,f.firstBaseUpdate=L,f.lastBaseUpdate=W,s=f.shared.interleaved,s!==null){f=s;do x|=f.lane,f=f.next;while(f!==s)}else g===null&&(f.shared.lanes=0);ir|=x,r.lanes=x,r.memoizedState=H}}function Nf(r,s,a){if(r=s.effects,s.effects=null,r!==null)for(s=0;s<r.length;s++){var c=r[s],f=c.callback;if(f!==null){if(c.callback=null,c=a,typeof f!="function")throw Error(n(191,f));f.call(c)}}}var Js={},rn=Pn(Js),Ys=Pn(Js),Qs=Pn(Js);function rr(r){if(r===Js)throw Error(n(174));return r}function Xl(r,s){switch(Ae(Qs,s),Ae(Ys,r),Ae(rn,Js),r=s.nodeType,r){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:Za(null,"");break;default:r=r===8?s.parentNode:s,s=r.namespaceURI||null,r=r.tagName,s=Za(s,r)}De(rn),Ae(rn,s)}function Wr(){De(rn),De(Ys),De(Qs)}function Af(r){rr(Qs.current);var s=rr(rn.current),a=Za(s,r.type);s!==a&&(Ae(Ys,r),Ae(rn,a))}function Zl(r){Ys.current===r&&(De(rn),De(Ys))}var $e=Pn(0);function Po(r){for(var s=r;s!==null;){if(s.tag===13){var a=s.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||a.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var eu=[];function tu(){for(var r=0;r<eu.length;r++)eu[r]._workInProgressVersionPrimary=null;eu.length=0}var Ro=U.ReactCurrentDispatcher,nu=U.ReactCurrentBatchConfig,sr=0,Ve=null,Qe=null,et=null,Oo=!1,Xs=!1,Zs=0,Xw=0;function ut(){throw Error(n(321))}function ru(r,s){if(s===null)return!1;for(var a=0;a<s.length&&a<r.length;a++)if(!qt(r[a],s[a]))return!1;return!0}function su(r,s,a,c,f,g){if(sr=g,Ve=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,Ro.current=r===null||r.memoizedState===null?nx:rx,r=a(c,f),Xs){g=0;do{if(Xs=!1,Zs=0,25<=g)throw Error(n(301));g+=1,et=Qe=null,s.updateQueue=null,Ro.current=sx,r=a(c,f)}while(Xs)}if(Ro.current=Lo,s=Qe!==null&&Qe.next!==null,sr=0,et=Qe=Ve=null,Oo=!1,s)throw Error(n(300));return r}function iu(){var r=Zs!==0;return Zs=0,r}function sn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return et===null?Ve.memoizedState=et=r:et=et.next=r,et}function Ut(){if(Qe===null){var r=Ve.alternate;r=r!==null?r.memoizedState:null}else r=Qe.next;var s=et===null?Ve.memoizedState:et.next;if(s!==null)et=s,Qe=r;else{if(r===null)throw Error(n(310));Qe=r,r={memoizedState:Qe.memoizedState,baseState:Qe.baseState,baseQueue:Qe.baseQueue,queue:Qe.queue,next:null},et===null?Ve.memoizedState=et=r:et=et.next=r}return et}function ei(r,s){return typeof s=="function"?s(r):s}function ou(r){var s=Ut(),a=s.queue;if(a===null)throw Error(n(311));a.lastRenderedReducer=r;var c=Qe,f=c.baseQueue,g=a.pending;if(g!==null){if(f!==null){var x=f.next;f.next=g.next,g.next=x}c.baseQueue=f=g,a.pending=null}if(f!==null){g=f.next,c=c.baseState;var T=x=null,C=null,L=g;do{var W=L.lane;if((sr&W)===W)C!==null&&(C=C.next={lane:0,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null}),c=L.hasEagerState?L.eagerState:r(c,L.action);else{var H={lane:W,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null};C===null?(T=C=H,x=c):C=C.next=H,Ve.lanes|=W,ir|=W}L=L.next}while(L!==null&&L!==g);C===null?x=c:C.next=T,qt(c,s.memoizedState)||(wt=!0),s.memoizedState=c,s.baseState=x,s.baseQueue=C,a.lastRenderedState=c}if(r=a.interleaved,r!==null){f=r;do g=f.lane,Ve.lanes|=g,ir|=g,f=f.next;while(f!==r)}else f===null&&(a.lanes=0);return[s.memoizedState,a.dispatch]}function au(r){var s=Ut(),a=s.queue;if(a===null)throw Error(n(311));a.lastRenderedReducer=r;var c=a.dispatch,f=a.pending,g=s.memoizedState;if(f!==null){a.pending=null;var x=f=f.next;do g=r(g,x.action),x=x.next;while(x!==f);qt(g,s.memoizedState)||(wt=!0),s.memoizedState=g,s.baseQueue===null&&(s.baseState=g),a.lastRenderedState=g}return[g,c]}function Pf(){}function Rf(r,s){var a=Ve,c=Ut(),f=s(),g=!qt(c.memoizedState,f);if(g&&(c.memoizedState=f,wt=!0),c=c.queue,lu(Df.bind(null,a,c,r),[r]),c.getSnapshot!==s||g||et!==null&&et.memoizedState.tag&1){if(a.flags|=2048,ti(9,If.bind(null,a,c,f,s),void 0,null),tt===null)throw Error(n(349));(sr&30)!==0||Of(a,s,f)}return f}function Of(r,s,a){r.flags|=16384,r={getSnapshot:s,value:a},s=Ve.updateQueue,s===null?(s={lastEffect:null,stores:null},Ve.updateQueue=s,s.stores=[r]):(a=s.stores,a===null?s.stores=[r]:a.push(r))}function If(r,s,a,c){s.value=a,s.getSnapshot=c,Lf(s)&&Mf(r)}function Df(r,s,a){return a(function(){Lf(s)&&Mf(r)})}function Lf(r){var s=r.getSnapshot;r=r.value;try{var a=s();return!qt(r,a)}catch{return!0}}function Mf(r){var s=pn(r,1);s!==null&&Jt(s,r,1,-1)}function Uf(r){var s=sn();return typeof r=="function"&&(r=r()),s.memoizedState=s.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ei,lastRenderedState:r},s.queue=r,r=r.dispatch=tx.bind(null,Ve,r),[s.memoizedState,r]}function ti(r,s,a,c){return r={tag:r,create:s,destroy:a,deps:c,next:null},s=Ve.updateQueue,s===null?(s={lastEffect:null,stores:null},Ve.updateQueue=s,s.lastEffect=r.next=r):(a=s.lastEffect,a===null?s.lastEffect=r.next=r:(c=a.next,a.next=r,r.next=c,s.lastEffect=r)),r}function $f(){return Ut().memoizedState}function Io(r,s,a,c){var f=sn();Ve.flags|=r,f.memoizedState=ti(1|s,a,void 0,c===void 0?null:c)}function Do(r,s,a,c){var f=Ut();c=c===void 0?null:c;var g=void 0;if(Qe!==null){var x=Qe.memoizedState;if(g=x.destroy,c!==null&&ru(c,x.deps)){f.memoizedState=ti(s,a,g,c);return}}Ve.flags|=r,f.memoizedState=ti(1|s,a,g,c)}function Vf(r,s){return Io(8390656,8,r,s)}function lu(r,s){return Do(2048,8,r,s)}function Ff(r,s){return Do(4,2,r,s)}function Bf(r,s){return Do(4,4,r,s)}function zf(r,s){if(typeof s=="function")return r=r(),s(r),function(){s(null)};if(s!=null)return r=r(),s.current=r,function(){s.current=null}}function qf(r,s,a){return a=a!=null?a.concat([r]):null,Do(4,4,zf.bind(null,s,r),a)}function uu(){}function Wf(r,s){var a=Ut();s=s===void 0?null:s;var c=a.memoizedState;return c!==null&&s!==null&&ru(s,c[1])?c[0]:(a.memoizedState=[r,s],r)}function Hf(r,s){var a=Ut();s=s===void 0?null:s;var c=a.memoizedState;return c!==null&&s!==null&&ru(s,c[1])?c[0]:(r=r(),a.memoizedState=[r,s],r)}function Kf(r,s,a){return(sr&21)===0?(r.baseState&&(r.baseState=!1,wt=!0),r.memoizedState=a):(qt(a,s)||(a=_h(),Ve.lanes|=a,ir|=a,r.baseState=!0),s)}function Zw(r,s){var a=Ce;Ce=a!==0&&4>a?a:4,r(!0);var c=nu.transition;nu.transition={};try{r(!1),s()}finally{Ce=a,nu.transition=c}}function Gf(){return Ut().memoizedState}function ex(r,s,a){var c=$n(r);if(a={lane:c,action:a,hasEagerState:!1,eagerState:null,next:null},Jf(r))Yf(s,a);else if(a=Tf(r,s,a,c),a!==null){var f=gt();Jt(a,r,c,f),Qf(a,s,c)}}function tx(r,s,a){var c=$n(r),f={lane:c,action:a,hasEagerState:!1,eagerState:null,next:null};if(Jf(r))Yf(s,f);else{var g=r.alternate;if(r.lanes===0&&(g===null||g.lanes===0)&&(g=s.lastRenderedReducer,g!==null))try{var x=s.lastRenderedState,T=g(x,a);if(f.hasEagerState=!0,f.eagerState=T,qt(T,x)){var C=s.interleaved;C===null?(f.next=f,Yl(s)):(f.next=C.next,C.next=f),s.interleaved=f;return}}catch{}a=Tf(r,s,f,c),a!==null&&(f=gt(),Jt(a,r,c,f),Qf(a,s,c))}}function Jf(r){var s=r.alternate;return r===Ve||s!==null&&s===Ve}function Yf(r,s){Xs=Oo=!0;var a=r.pending;a===null?s.next=s:(s.next=a.next,a.next=s),r.pending=s}function Qf(r,s,a){if((a&4194240)!==0){var c=s.lanes;c&=r.pendingLanes,a|=c,s.lanes=a,dl(r,a)}}var Lo={readContext:Mt,useCallback:ut,useContext:ut,useEffect:ut,useImperativeHandle:ut,useInsertionEffect:ut,useLayoutEffect:ut,useMemo:ut,useReducer:ut,useRef:ut,useState:ut,useDebugValue:ut,useDeferredValue:ut,useTransition:ut,useMutableSource:ut,useSyncExternalStore:ut,useId:ut,unstable_isNewReconciler:!1},nx={readContext:Mt,useCallback:function(r,s){return sn().memoizedState=[r,s===void 0?null:s],r},useContext:Mt,useEffect:Vf,useImperativeHandle:function(r,s,a){return a=a!=null?a.concat([r]):null,Io(4194308,4,zf.bind(null,s,r),a)},useLayoutEffect:function(r,s){return Io(4194308,4,r,s)},useInsertionEffect:function(r,s){return Io(4,2,r,s)},useMemo:function(r,s){var a=sn();return s=s===void 0?null:s,r=r(),a.memoizedState=[r,s],r},useReducer:function(r,s,a){var c=sn();return s=a!==void 0?a(s):s,c.memoizedState=c.baseState=s,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:s},c.queue=r,r=r.dispatch=ex.bind(null,Ve,r),[c.memoizedState,r]},useRef:function(r){var s=sn();return r={current:r},s.memoizedState=r},useState:Uf,useDebugValue:uu,useDeferredValue:function(r){return sn().memoizedState=r},useTransition:function(){var r=Uf(!1),s=r[0];return r=Zw.bind(null,r[1]),sn().memoizedState=r,[s,r]},useMutableSource:function(){},useSyncExternalStore:function(r,s,a){var c=Ve,f=sn();if(Ue){if(a===void 0)throw Error(n(407));a=a()}else{if(a=s(),tt===null)throw Error(n(349));(sr&30)!==0||Of(c,s,a)}f.memoizedState=a;var g={value:a,getSnapshot:s};return f.queue=g,Vf(Df.bind(null,c,g,r),[r]),c.flags|=2048,ti(9,If.bind(null,c,g,a,s),void 0,null),a},useId:function(){var r=sn(),s=tt.identifierPrefix;if(Ue){var a=fn,c=hn;a=(c&~(1<<32-zt(c)-1)).toString(32)+a,s=":"+s+"R"+a,a=Zs++,0<a&&(s+="H"+a.toString(32)),s+=":"}else a=Xw++,s=":"+s+"r"+a.toString(32)+":";return r.memoizedState=s},unstable_isNewReconciler:!1},rx={readContext:Mt,useCallback:Wf,useContext:Mt,useEffect:lu,useImperativeHandle:qf,useInsertionEffect:Ff,useLayoutEffect:Bf,useMemo:Hf,useReducer:ou,useRef:$f,useState:function(){return ou(ei)},useDebugValue:uu,useDeferredValue:function(r){var s=Ut();return Kf(s,Qe.memoizedState,r)},useTransition:function(){var r=ou(ei)[0],s=Ut().memoizedState;return[r,s]},useMutableSource:Pf,useSyncExternalStore:Rf,useId:Gf,unstable_isNewReconciler:!1},sx={readContext:Mt,useCallback:Wf,useContext:Mt,useEffect:lu,useImperativeHandle:qf,useInsertionEffect:Ff,useLayoutEffect:Bf,useMemo:Hf,useReducer:au,useRef:$f,useState:function(){return au(ei)},useDebugValue:uu,useDeferredValue:function(r){var s=Ut();return Qe===null?s.memoizedState=r:Kf(s,Qe.memoizedState,r)},useTransition:function(){var r=au(ei)[0],s=Ut().memoizedState;return[r,s]},useMutableSource:Pf,useSyncExternalStore:Rf,useId:Gf,unstable_isNewReconciler:!1};function Ht(r,s){if(r&&r.defaultProps){s=K({},s),r=r.defaultProps;for(var a in r)s[a]===void 0&&(s[a]=r[a]);return s}return s}function cu(r,s,a,c){s=r.memoizedState,a=a(c,s),a=a==null?s:K({},s,a),r.memoizedState=a,r.lanes===0&&(r.updateQueue.baseState=a)}var Mo={isMounted:function(r){return(r=r._reactInternals)?Qn(r)===r:!1},enqueueSetState:function(r,s,a){r=r._reactInternals;var c=gt(),f=$n(r),g=mn(c,f);g.payload=s,a!=null&&(g.callback=a),s=Dn(r,g,f),s!==null&&(Jt(s,r,f,c),No(s,r,f))},enqueueReplaceState:function(r,s,a){r=r._reactInternals;var c=gt(),f=$n(r),g=mn(c,f);g.tag=1,g.payload=s,a!=null&&(g.callback=a),s=Dn(r,g,f),s!==null&&(Jt(s,r,f,c),No(s,r,f))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var a=gt(),c=$n(r),f=mn(a,c);f.tag=2,s!=null&&(f.callback=s),s=Dn(r,f,c),s!==null&&(Jt(s,r,c,a),No(s,r,c))}};function Xf(r,s,a,c,f,g,x){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(c,g,x):s.prototype&&s.prototype.isPureReactComponent?!Fs(a,c)||!Fs(f,g):!0}function Zf(r,s,a){var c=!1,f=Rn,g=s.contextType;return typeof g=="object"&&g!==null?g=Mt(g):(f=vt(s)?Zn:lt.current,c=s.contextTypes,g=(c=c!=null)?Ur(r,f):Rn),s=new s(a,g),r.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Mo,r.stateNode=s,s._reactInternals=r,c&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=f,r.__reactInternalMemoizedMaskedChildContext=g),s}function ep(r,s,a,c){r=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(a,c),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(a,c),s.state!==r&&Mo.enqueueReplaceState(s,s.state,null)}function du(r,s,a,c){var f=r.stateNode;f.props=a,f.state=r.memoizedState,f.refs={},Ql(r);var g=s.contextType;typeof g=="object"&&g!==null?f.context=Mt(g):(g=vt(s)?Zn:lt.current,f.context=Ur(r,g)),f.state=r.memoizedState,g=s.getDerivedStateFromProps,typeof g=="function"&&(cu(r,s,g,a),f.state=r.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(s=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),s!==f.state&&Mo.enqueueReplaceState(f,f.state,null),Ao(r,a,f,c),f.state=r.memoizedState),typeof f.componentDidMount=="function"&&(r.flags|=4194308)}function Hr(r,s){try{var a="",c=s;do a+=fe(c),c=c.return;while(c);var f=a}catch(g){f=`
5
+ `+f[x].replace(" at new "," at ");return r.displayName&&C.includes("<anonymous>")&&(C=C.replace("<anonymous>",r.displayName)),C}while(1<=x&&0<=T);break}}}finally{re=!1,Error.prepareStackTrace=a}return(r=r?r.displayName||r.name:"")?D(r):""}function fe(r){switch(r.tag){case 5:return D(r.type);case 16:return D("Lazy");case 13:return D("Suspense");case 19:return D("SuspenseList");case 0:case 2:case 15:return r=ue(r.type,!1),r;case 11:return r=ue(r.type.render,!1),r;case 1:return r=ue(r.type,!0),r;default:return""}}function ie(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case $:return"Fragment";case z:return"Portal";case Y:return"Profiler";case B:return"StrictMode";case je:return"Suspense";case xe:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case Te:return(r.displayName||"Context")+".Consumer";case oe:return(r._context.displayName||"Context")+".Provider";case ve:var s=r.render;return r=r.displayName,r||(r=s.displayName||s.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case Oe:return s=r.displayName||null,s!==null?s:ie(r.type)||"Memo";case be:s=r._payload,r=r._init;try{return ie(r(s))}catch{}}return null}function Ee(r){var s=r.type;switch(r.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=s.render,r=r.displayName||r.name||"",s.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ie(s);case 8:return s===B?"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 s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function ke(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Me(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Et(r){var s=Me(r)?"checked":"value",a=Object.getOwnPropertyDescriptor(r.constructor.prototype,s),c=""+r[s];if(!r.hasOwnProperty(s)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var f=a.get,g=a.set;return Object.defineProperty(r,s,{configurable:!0,get:function(){return f.call(this)},set:function(x){c=""+x,g.call(this,x)}}),Object.defineProperty(r,s,{enumerable:a.enumerable}),{getValue:function(){return c},setValue:function(x){c=""+x},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function Ki(r){r._valueTracker||(r._valueTracker=Et(r))}function Qd(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var a=s.getValue(),c="";return r&&(c=Me(r)?r.checked?"true":"false":r.value),r=c,r!==a?(s.setValue(r),!0):!1}function Gi(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Ya(r,s){var a=s.checked;return K({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:a??r._wrapperState.initialChecked})}function Xd(r,s){var a=s.defaultValue==null?"":s.defaultValue,c=s.checked!=null?s.checked:s.defaultChecked;a=ke(s.value!=null?s.value:a),r._wrapperState={initialChecked:c,initialValue:a,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Zd(r,s){s=s.checked,s!=null&&N(r,"checked",s,!1)}function Qa(r,s){Zd(r,s);var a=ke(s.value),c=s.type;if(a!=null)c==="number"?(a===0&&r.value===""||r.value!=a)&&(r.value=""+a):r.value!==""+a&&(r.value=""+a);else if(c==="submit"||c==="reset"){r.removeAttribute("value");return}s.hasOwnProperty("value")?Xa(r,s.type,a):s.hasOwnProperty("defaultValue")&&Xa(r,s.type,ke(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(r.defaultChecked=!!s.defaultChecked)}function eh(r,s,a){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var c=s.type;if(!(c!=="submit"&&c!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+r._wrapperState.initialValue,a||s===r.value||(r.value=s),r.defaultValue=s}a=r.name,a!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,a!==""&&(r.name=a)}function Xa(r,s,a){(s!=="number"||Gi(r.ownerDocument)!==r)&&(a==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+a&&(r.defaultValue=""+a))}var Ss=Array.isArray;function jr(r,s,a,c){if(r=r.options,s){s={};for(var f=0;f<a.length;f++)s["$"+a[f]]=!0;for(a=0;a<r.length;a++)f=s.hasOwnProperty("$"+r[a].value),r[a].selected!==f&&(r[a].selected=f),f&&c&&(r[a].defaultSelected=!0)}else{for(a=""+ke(a),s=null,f=0;f<r.length;f++){if(r[f].value===a){r[f].selected=!0,c&&(r[f].defaultSelected=!0);return}s!==null||r[f].disabled||(s=r[f])}s!==null&&(s.selected=!0)}}function Za(r,s){if(s.dangerouslySetInnerHTML!=null)throw Error(n(91));return K({},s,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function th(r,s){var a=s.value;if(a==null){if(a=s.children,s=s.defaultValue,a!=null){if(s!=null)throw Error(n(92));if(Ss(a)){if(1<a.length)throw Error(n(93));a=a[0]}s=a}s==null&&(s=""),a=s}r._wrapperState={initialValue:ke(a)}}function nh(r,s){var a=ke(s.value),c=ke(s.defaultValue);a!=null&&(a=""+a,a!==r.value&&(r.value=a),s.defaultValue==null&&r.defaultValue!==a&&(r.defaultValue=a)),c!=null&&(r.defaultValue=""+c)}function rh(r){var s=r.textContent;s===r._wrapperState.initialValue&&s!==""&&s!==null&&(r.value=s)}function sh(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function el(r,s){return r==null||r==="http://www.w3.org/1999/xhtml"?sh(s):r==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var Ji,ih=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,a,c,f){MSApp.execUnsafeLocalFunction(function(){return r(s,a,c,f)})}:r})(function(r,s){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=s;else{for(Ji=Ji||document.createElement("div"),Ji.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=Ji.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;s.firstChild;)r.appendChild(s.firstChild)}});function ks(r,s){if(s){var a=r.firstChild;if(a&&a===r.lastChild&&a.nodeType===3){a.nodeValue=s;return}}r.textContent=s}var Es={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},D0=["Webkit","ms","Moz","O"];Object.keys(Es).forEach(function(r){D0.forEach(function(s){s=s+r.charAt(0).toUpperCase()+r.substring(1),Es[s]=Es[r]})});function oh(r,s,a){return s==null||typeof s=="boolean"||s===""?"":a||typeof s!="number"||s===0||Es.hasOwnProperty(r)&&Es[r]?(""+s).trim():s+"px"}function ah(r,s){r=r.style;for(var a in s)if(s.hasOwnProperty(a)){var c=a.indexOf("--")===0,f=oh(a,s[a],c);a==="float"&&(a="cssFloat"),c?r.setProperty(a,f):r[a]=f}}var L0=K({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 tl(r,s){if(s){if(L0[r]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(n(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(n(61))}if(s.style!=null&&typeof s.style!="object")throw Error(n(62))}}function nl(r,s){if(r.indexOf("-")===-1)return typeof s.is=="string";switch(r){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 rl=null;function sl(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var il=null,Cr=null,Nr=null;function lh(r){if(r=Ks(r)){if(typeof il!="function")throw Error(n(280));var s=r.stateNode;s&&(s=wo(s),il(r.stateNode,r.type,s))}}function uh(r){Cr?Nr?Nr.push(r):Nr=[r]:Cr=r}function ch(){if(Cr){var r=Cr,s=Nr;if(Nr=Cr=null,lh(r),s)for(r=0;r<s.length;r++)lh(s[r])}}function dh(r,s){return r(s)}function hh(){}var ol=!1;function fh(r,s,a){if(ol)return r(s,a);ol=!0;try{return dh(r,s,a)}finally{ol=!1,(Cr!==null||Nr!==null)&&(hh(),ch())}}function Ts(r,s){var a=r.stateNode;if(a===null)return null;var c=wo(a);if(c===null)return null;a=c[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(r=r.type,c=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!c;break e;default:r=!1}if(r)return null;if(a&&typeof a!="function")throw Error(n(231,s,typeof a));return a}var al=!1;if(d)try{var js={};Object.defineProperty(js,"passive",{get:function(){al=!0}}),window.addEventListener("test",js,js),window.removeEventListener("test",js,js)}catch{al=!1}function M0(r,s,a,c,f,g,x,T,C){var L=Array.prototype.slice.call(arguments,3);try{s.apply(a,L)}catch(W){this.onError(W)}}var Cs=!1,Yi=null,Qi=!1,ll=null,U0={onError:function(r){Cs=!0,Yi=r}};function $0(r,s,a,c,f,g,x,T,C){Cs=!1,Yi=null,M0.apply(U0,arguments)}function V0(r,s,a,c,f,g,x,T,C){if($0.apply(this,arguments),Cs){if(Cs){var L=Yi;Cs=!1,Yi=null}else throw Error(n(198));Qi||(Qi=!0,ll=L)}}function Qn(r){var s=r,a=r;if(r.alternate)for(;s.return;)s=s.return;else{r=s;do s=r,(s.flags&4098)!==0&&(a=s.return),r=s.return;while(r)}return s.tag===3?a:null}function ph(r){if(r.tag===13){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function mh(r){if(Qn(r)!==r)throw Error(n(188))}function F0(r){var s=r.alternate;if(!s){if(s=Qn(r),s===null)throw Error(n(188));return s!==r?null:r}for(var a=r,c=s;;){var f=a.return;if(f===null)break;var g=f.alternate;if(g===null){if(c=f.return,c!==null){a=c;continue}break}if(f.child===g.child){for(g=f.child;g;){if(g===a)return mh(f),r;if(g===c)return mh(f),s;g=g.sibling}throw Error(n(188))}if(a.return!==c.return)a=f,c=g;else{for(var x=!1,T=f.child;T;){if(T===a){x=!0,a=f,c=g;break}if(T===c){x=!0,c=f,a=g;break}T=T.sibling}if(!x){for(T=g.child;T;){if(T===a){x=!0,a=g,c=f;break}if(T===c){x=!0,c=g,a=f;break}T=T.sibling}if(!x)throw Error(n(189))}}if(a.alternate!==c)throw Error(n(190))}if(a.tag!==3)throw Error(n(188));return a.stateNode.current===a?r:s}function gh(r){return r=F0(r),r!==null?yh(r):null}function yh(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var s=yh(r);if(s!==null)return s;r=r.sibling}return null}var vh=e.unstable_scheduleCallback,wh=e.unstable_cancelCallback,B0=e.unstable_shouldYield,z0=e.unstable_requestPaint,He=e.unstable_now,q0=e.unstable_getCurrentPriorityLevel,ul=e.unstable_ImmediatePriority,xh=e.unstable_UserBlockingPriority,Xi=e.unstable_NormalPriority,W0=e.unstable_LowPriority,bh=e.unstable_IdlePriority,Zi=null,tn=null;function H0(r){if(tn&&typeof tn.onCommitFiberRoot=="function")try{tn.onCommitFiberRoot(Zi,r,void 0,(r.current.flags&128)===128)}catch{}}var zt=Math.clz32?Math.clz32:J0,K0=Math.log,G0=Math.LN2;function J0(r){return r>>>=0,r===0?32:31-(K0(r)/G0|0)|0}var eo=64,to=4194304;function Ns(r){switch(r&-r){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 r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function no(r,s){var a=r.pendingLanes;if(a===0)return 0;var c=0,f=r.suspendedLanes,g=r.pingedLanes,x=a&268435455;if(x!==0){var T=x&~f;T!==0?c=Ns(T):(g&=x,g!==0&&(c=Ns(g)))}else x=a&~f,x!==0?c=Ns(x):g!==0&&(c=Ns(g));if(c===0)return 0;if(s!==0&&s!==c&&(s&f)===0&&(f=c&-c,g=s&-s,f>=g||f===16&&(g&4194240)!==0))return s;if((c&4)!==0&&(c|=a&16),s=r.entangledLanes,s!==0)for(r=r.entanglements,s&=c;0<s;)a=31-zt(s),f=1<<a,c|=r[a],s&=~f;return c}function Y0(r,s){switch(r){case 1:case 2:case 4:return s+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Q0(r,s){for(var a=r.suspendedLanes,c=r.pingedLanes,f=r.expirationTimes,g=r.pendingLanes;0<g;){var x=31-zt(g),T=1<<x,C=f[x];C===-1?((T&a)===0||(T&c)!==0)&&(f[x]=Y0(T,s)):C<=s&&(r.expiredLanes|=T),g&=~T}}function cl(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function _h(){var r=eo;return eo<<=1,(eo&4194240)===0&&(eo=64),r}function dl(r){for(var s=[],a=0;31>a;a++)s.push(r);return s}function As(r,s,a){r.pendingLanes|=s,s!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,s=31-zt(s),r[s]=a}function X0(r,s){var a=r.pendingLanes&~s;r.pendingLanes=s,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=s,r.mutableReadLanes&=s,r.entangledLanes&=s,s=r.entanglements;var c=r.eventTimes;for(r=r.expirationTimes;0<a;){var f=31-zt(a),g=1<<f;s[f]=0,c[f]=-1,r[f]=-1,a&=~g}}function hl(r,s){var a=r.entangledLanes|=s;for(r=r.entanglements;a;){var c=31-zt(a),f=1<<c;f&s|r[c]&s&&(r[c]|=s),a&=~f}}var Ce=0;function Sh(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var kh,fl,Eh,Th,jh,pl=!1,ro=[],En=null,Tn=null,jn=null,Ps=new Map,Rs=new Map,Cn=[],Z0="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Ch(r,s){switch(r){case"focusin":case"focusout":En=null;break;case"dragenter":case"dragleave":Tn=null;break;case"mouseover":case"mouseout":jn=null;break;case"pointerover":case"pointerout":Ps.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Rs.delete(s.pointerId)}}function Os(r,s,a,c,f,g){return r===null||r.nativeEvent!==g?(r={blockedOn:s,domEventName:a,eventSystemFlags:c,nativeEvent:g,targetContainers:[f]},s!==null&&(s=Ks(s),s!==null&&fl(s)),r):(r.eventSystemFlags|=c,s=r.targetContainers,f!==null&&s.indexOf(f)===-1&&s.push(f),r)}function ew(r,s,a,c,f){switch(s){case"focusin":return En=Os(En,r,s,a,c,f),!0;case"dragenter":return Tn=Os(Tn,r,s,a,c,f),!0;case"mouseover":return jn=Os(jn,r,s,a,c,f),!0;case"pointerover":var g=f.pointerId;return Ps.set(g,Os(Ps.get(g)||null,r,s,a,c,f)),!0;case"gotpointercapture":return g=f.pointerId,Rs.set(g,Os(Rs.get(g)||null,r,s,a,c,f)),!0}return!1}function Nh(r){var s=Xn(r.target);if(s!==null){var a=Qn(s);if(a!==null){if(s=a.tag,s===13){if(s=ph(a),s!==null){r.blockedOn=s,jh(r.priority,function(){Eh(a)});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){r.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}r.blockedOn=null}function so(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var a=gl(r.domEventName,r.eventSystemFlags,s[0],r.nativeEvent);if(a===null){a=r.nativeEvent;var c=new a.constructor(a.type,a);rl=c,a.target.dispatchEvent(c),rl=null}else return s=Ks(a),s!==null&&fl(s),r.blockedOn=a,!1;s.shift()}return!0}function Ah(r,s,a){so(r)&&a.delete(s)}function tw(){pl=!1,En!==null&&so(En)&&(En=null),Tn!==null&&so(Tn)&&(Tn=null),jn!==null&&so(jn)&&(jn=null),Ps.forEach(Ah),Rs.forEach(Ah)}function Is(r,s){r.blockedOn===s&&(r.blockedOn=null,pl||(pl=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,tw)))}function Ds(r){function s(f){return Is(f,r)}if(0<ro.length){Is(ro[0],r);for(var a=1;a<ro.length;a++){var c=ro[a];c.blockedOn===r&&(c.blockedOn=null)}}for(En!==null&&Is(En,r),Tn!==null&&Is(Tn,r),jn!==null&&Is(jn,r),Ps.forEach(s),Rs.forEach(s),a=0;a<Cn.length;a++)c=Cn[a],c.blockedOn===r&&(c.blockedOn=null);for(;0<Cn.length&&(a=Cn[0],a.blockedOn===null);)Nh(a),a.blockedOn===null&&Cn.shift()}var Ar=U.ReactCurrentBatchConfig,io=!0;function nw(r,s,a,c){var f=Ce,g=Ar.transition;Ar.transition=null;try{Ce=1,ml(r,s,a,c)}finally{Ce=f,Ar.transition=g}}function rw(r,s,a,c){var f=Ce,g=Ar.transition;Ar.transition=null;try{Ce=4,ml(r,s,a,c)}finally{Ce=f,Ar.transition=g}}function ml(r,s,a,c){if(io){var f=gl(r,s,a,c);if(f===null)Ol(r,s,c,oo,a),Ch(r,c);else if(ew(f,r,s,a,c))c.stopPropagation();else if(Ch(r,c),s&4&&-1<Z0.indexOf(r)){for(;f!==null;){var g=Ks(f);if(g!==null&&kh(g),g=gl(r,s,a,c),g===null&&Ol(r,s,c,oo,a),g===f)break;f=g}f!==null&&c.stopPropagation()}else Ol(r,s,c,null,a)}}var oo=null;function gl(r,s,a,c){if(oo=null,r=sl(c),r=Xn(r),r!==null)if(s=Qn(r),s===null)r=null;else if(a=s.tag,a===13){if(r=ph(s),r!==null)return r;r=null}else if(a===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;r=null}else s!==r&&(r=null);return oo=r,null}function Ph(r){switch(r){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(q0()){case ul:return 1;case xh:return 4;case Xi:case W0:return 16;case bh:return 536870912;default:return 16}default:return 16}}var Nn=null,yl=null,ao=null;function Rh(){if(ao)return ao;var r,s=yl,a=s.length,c,f="value"in Nn?Nn.value:Nn.textContent,g=f.length;for(r=0;r<a&&s[r]===f[r];r++);var x=a-r;for(c=1;c<=x&&s[a-c]===f[g-c];c++);return ao=f.slice(r,1<c?1-c:void 0)}function lo(r){var s=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&s===13&&(r=13)):r=s,r===10&&(r=13),32<=r||r===13?r:0}function uo(){return!0}function Oh(){return!1}function Tt(r){function s(a,c,f,g,x){this._reactName=a,this._targetInst=f,this.type=c,this.nativeEvent=g,this.target=x,this.currentTarget=null;for(var T in r)r.hasOwnProperty(T)&&(a=r[T],this[T]=a?a(g):g[T]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?uo:Oh,this.isPropagationStopped=Oh,this}return K(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=uo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=uo)},persist:function(){},isPersistent:uo}),s}var Pr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vl=Tt(Pr),Ls=K({},Pr,{view:0,detail:0}),sw=Tt(Ls),wl,xl,Ms,co=K({},Ls,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_l,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Ms&&(Ms&&r.type==="mousemove"?(wl=r.screenX-Ms.screenX,xl=r.screenY-Ms.screenY):xl=wl=0,Ms=r),wl)},movementY:function(r){return"movementY"in r?r.movementY:xl}}),Ih=Tt(co),iw=K({},co,{dataTransfer:0}),ow=Tt(iw),aw=K({},Ls,{relatedTarget:0}),bl=Tt(aw),lw=K({},Pr,{animationName:0,elapsedTime:0,pseudoElement:0}),uw=Tt(lw),cw=K({},Pr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),dw=Tt(cw),hw=K({},Pr,{data:0}),Dh=Tt(hw),fw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pw={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},mw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function gw(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=mw[r])?!!s[r]:!1}function _l(){return gw}var yw=K({},Ls,{key:function(r){if(r.key){var s=fw[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=lo(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?pw[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_l,charCode:function(r){return r.type==="keypress"?lo(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?lo(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),vw=Tt(yw),ww=K({},co,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lh=Tt(ww),xw=K({},Ls,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_l}),bw=Tt(xw),_w=K({},Pr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Sw=Tt(_w),kw=K({},co,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),Ew=Tt(kw),Tw=[9,13,27,32],Sl=d&&"CompositionEvent"in window,Us=null;d&&"documentMode"in document&&(Us=document.documentMode);var jw=d&&"TextEvent"in window&&!Us,Mh=d&&(!Sl||Us&&8<Us&&11>=Us),Uh=" ",$h=!1;function Vh(r,s){switch(r){case"keyup":return Tw.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fh(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Rr=!1;function Cw(r,s){switch(r){case"compositionend":return Fh(s);case"keypress":return s.which!==32?null:($h=!0,Uh);case"textInput":return r=s.data,r===Uh&&$h?null:r;default:return null}}function Nw(r,s){if(Rr)return r==="compositionend"||!Sl&&Vh(r,s)?(r=Rh(),ao=yl=Nn=null,Rr=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Mh&&s.locale!=="ko"?null:s.data;default:return null}}var Aw={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Bh(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!Aw[r.type]:s==="textarea"}function zh(r,s,a,c){uh(c),s=go(s,"onChange"),0<s.length&&(a=new vl("onChange","change",null,a,c),r.push({event:a,listeners:s}))}var $s=null,Vs=null;function Pw(r){lf(r,0)}function ho(r){var s=Mr(r);if(Qd(s))return r}function Rw(r,s){if(r==="change")return s}var qh=!1;if(d){var kl;if(d){var El="oninput"in document;if(!El){var Wh=document.createElement("div");Wh.setAttribute("oninput","return;"),El=typeof Wh.oninput=="function"}kl=El}else kl=!1;qh=kl&&(!document.documentMode||9<document.documentMode)}function Hh(){$s&&($s.detachEvent("onpropertychange",Kh),Vs=$s=null)}function Kh(r){if(r.propertyName==="value"&&ho(Vs)){var s=[];zh(s,Vs,r,sl(r)),fh(Pw,s)}}function Ow(r,s,a){r==="focusin"?(Hh(),$s=s,Vs=a,$s.attachEvent("onpropertychange",Kh)):r==="focusout"&&Hh()}function Iw(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return ho(Vs)}function Dw(r,s){if(r==="click")return ho(s)}function Lw(r,s){if(r==="input"||r==="change")return ho(s)}function Mw(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var qt=typeof Object.is=="function"?Object.is:Mw;function Fs(r,s){if(qt(r,s))return!0;if(typeof r!="object"||r===null||typeof s!="object"||s===null)return!1;var a=Object.keys(r),c=Object.keys(s);if(a.length!==c.length)return!1;for(c=0;c<a.length;c++){var f=a[c];if(!h.call(s,f)||!qt(r[f],s[f]))return!1}return!0}function Gh(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Jh(r,s){var a=Gh(r);r=0;for(var c;a;){if(a.nodeType===3){if(c=r+a.textContent.length,r<=s&&c>=s)return{node:a,offset:s-r};r=c}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Gh(a)}}function Yh(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?Yh(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function Qh(){for(var r=window,s=Gi();s instanceof r.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)r=s.contentWindow;else break;s=Gi(r.document)}return s}function Tl(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}function Uw(r){var s=Qh(),a=r.focusedElem,c=r.selectionRange;if(s!==a&&a&&a.ownerDocument&&Yh(a.ownerDocument.documentElement,a)){if(c!==null&&Tl(a)){if(s=c.start,r=c.end,r===void 0&&(r=s),"selectionStart"in a)a.selectionStart=s,a.selectionEnd=Math.min(r,a.value.length);else if(r=(s=a.ownerDocument||document)&&s.defaultView||window,r.getSelection){r=r.getSelection();var f=a.textContent.length,g=Math.min(c.start,f);c=c.end===void 0?g:Math.min(c.end,f),!r.extend&&g>c&&(f=c,c=g,g=f),f=Jh(a,g);var x=Jh(a,c);f&&x&&(r.rangeCount!==1||r.anchorNode!==f.node||r.anchorOffset!==f.offset||r.focusNode!==x.node||r.focusOffset!==x.offset)&&(s=s.createRange(),s.setStart(f.node,f.offset),r.removeAllRanges(),g>c?(r.addRange(s),r.extend(x.node,x.offset)):(s.setEnd(x.node,x.offset),r.addRange(s)))}}for(s=[],r=a;r=r.parentNode;)r.nodeType===1&&s.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<s.length;a++)r=s[a],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var $w=d&&"documentMode"in document&&11>=document.documentMode,Or=null,jl=null,Bs=null,Cl=!1;function Xh(r,s,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Cl||Or==null||Or!==Gi(c)||(c=Or,"selectionStart"in c&&Tl(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Bs&&Fs(Bs,c)||(Bs=c,c=go(jl,"onSelect"),0<c.length&&(s=new vl("onSelect","select",null,s,a),r.push({event:s,listeners:c}),s.target=Or)))}function fo(r,s){var a={};return a[r.toLowerCase()]=s.toLowerCase(),a["Webkit"+r]="webkit"+s,a["Moz"+r]="moz"+s,a}var Ir={animationend:fo("Animation","AnimationEnd"),animationiteration:fo("Animation","AnimationIteration"),animationstart:fo("Animation","AnimationStart"),transitionend:fo("Transition","TransitionEnd")},Nl={},Zh={};d&&(Zh=document.createElement("div").style,"AnimationEvent"in window||(delete Ir.animationend.animation,delete Ir.animationiteration.animation,delete Ir.animationstart.animation),"TransitionEvent"in window||delete Ir.transitionend.transition);function po(r){if(Nl[r])return Nl[r];if(!Ir[r])return r;var s=Ir[r],a;for(a in s)if(s.hasOwnProperty(a)&&a in Zh)return Nl[r]=s[a];return r}var ef=po("animationend"),tf=po("animationiteration"),nf=po("animationstart"),rf=po("transitionend"),sf=new Map,of="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function An(r,s){sf.set(r,s),l(s,[r])}for(var Al=0;Al<of.length;Al++){var Pl=of[Al],Vw=Pl.toLowerCase(),Fw=Pl[0].toUpperCase()+Pl.slice(1);An(Vw,"on"+Fw)}An(ef,"onAnimationEnd"),An(tf,"onAnimationIteration"),An(nf,"onAnimationStart"),An("dblclick","onDoubleClick"),An("focusin","onFocus"),An("focusout","onBlur"),An(rf,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var zs="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Bw=new Set("cancel close invalid load scroll toggle".split(" ").concat(zs));function af(r,s,a){var c=r.type||"unknown-event";r.currentTarget=a,V0(c,s,void 0,r),r.currentTarget=null}function lf(r,s){s=(s&4)!==0;for(var a=0;a<r.length;a++){var c=r[a],f=c.event;c=c.listeners;e:{var g=void 0;if(s)for(var x=c.length-1;0<=x;x--){var T=c[x],C=T.instance,L=T.currentTarget;if(T=T.listener,C!==g&&f.isPropagationStopped())break e;af(f,T,L),g=C}else for(x=0;x<c.length;x++){if(T=c[x],C=T.instance,L=T.currentTarget,T=T.listener,C!==g&&f.isPropagationStopped())break e;af(f,T,L),g=C}}}if(Qi)throw r=ll,Qi=!1,ll=null,r}function Ie(r,s){var a=s[$l];a===void 0&&(a=s[$l]=new Set);var c=r+"__bubble";a.has(c)||(uf(s,r,2,!1),a.add(c))}function Rl(r,s,a){var c=0;s&&(c|=4),uf(a,r,c,s)}var mo="_reactListening"+Math.random().toString(36).slice(2);function qs(r){if(!r[mo]){r[mo]=!0,i.forEach(function(a){a!=="selectionchange"&&(Bw.has(a)||Rl(a,!1,r),Rl(a,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[mo]||(s[mo]=!0,Rl("selectionchange",!1,s))}}function uf(r,s,a,c){switch(Ph(s)){case 1:var f=nw;break;case 4:f=rw;break;default:f=ml}a=f.bind(null,s,a,r),f=void 0,!al||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(f=!0),c?f!==void 0?r.addEventListener(s,a,{capture:!0,passive:f}):r.addEventListener(s,a,!0):f!==void 0?r.addEventListener(s,a,{passive:f}):r.addEventListener(s,a,!1)}function Ol(r,s,a,c,f){var g=c;if((s&1)===0&&(s&2)===0&&c!==null)e:for(;;){if(c===null)return;var x=c.tag;if(x===3||x===4){var T=c.stateNode.containerInfo;if(T===f||T.nodeType===8&&T.parentNode===f)break;if(x===4)for(x=c.return;x!==null;){var C=x.tag;if((C===3||C===4)&&(C=x.stateNode.containerInfo,C===f||C.nodeType===8&&C.parentNode===f))return;x=x.return}for(;T!==null;){if(x=Xn(T),x===null)return;if(C=x.tag,C===5||C===6){c=g=x;continue e}T=T.parentNode}}c=c.return}fh(function(){var L=g,W=sl(a),H=[];e:{var q=sf.get(r);if(q!==void 0){var Q=vl,Z=r;switch(r){case"keypress":if(lo(a)===0)break e;case"keydown":case"keyup":Q=vw;break;case"focusin":Z="focus",Q=bl;break;case"focusout":Z="blur",Q=bl;break;case"beforeblur":case"afterblur":Q=bl;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Q=Ih;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=ow;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=bw;break;case ef:case tf:case nf:Q=uw;break;case rf:Q=Sw;break;case"scroll":Q=sw;break;case"wheel":Q=Ew;break;case"copy":case"cut":case"paste":Q=dw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=Lh}var ee=(s&4)!==0,Ke=!ee&&r==="scroll",O=ee?q!==null?q+"Capture":null:q;ee=[];for(var A=L,I;A!==null;){I=A;var G=I.stateNode;if(I.tag===5&&G!==null&&(I=G,O!==null&&(G=Ts(A,O),G!=null&&ee.push(Ws(A,G,I)))),Ke)break;A=A.return}0<ee.length&&(q=new Q(q,Z,null,a,W),H.push({event:q,listeners:ee}))}}if((s&7)===0){e:{if(q=r==="mouseover"||r==="pointerover",Q=r==="mouseout"||r==="pointerout",q&&a!==rl&&(Z=a.relatedTarget||a.fromElement)&&(Xn(Z)||Z[cn]))break e;if((Q||q)&&(q=W.window===W?W:(q=W.ownerDocument)?q.defaultView||q.parentWindow:window,Q?(Z=a.relatedTarget||a.toElement,Q=L,Z=Z?Xn(Z):null,Z!==null&&(Ke=Qn(Z),Z!==Ke||Z.tag!==5&&Z.tag!==6)&&(Z=null)):(Q=null,Z=L),Q!==Z)){if(ee=Ih,G="onMouseLeave",O="onMouseEnter",A="mouse",(r==="pointerout"||r==="pointerover")&&(ee=Lh,G="onPointerLeave",O="onPointerEnter",A="pointer"),Ke=Q==null?q:Mr(Q),I=Z==null?q:Mr(Z),q=new ee(G,A+"leave",Q,a,W),q.target=Ke,q.relatedTarget=I,G=null,Xn(W)===L&&(ee=new ee(O,A+"enter",Z,a,W),ee.target=I,ee.relatedTarget=Ke,G=ee),Ke=G,Q&&Z)t:{for(ee=Q,O=Z,A=0,I=ee;I;I=Dr(I))A++;for(I=0,G=O;G;G=Dr(G))I++;for(;0<A-I;)ee=Dr(ee),A--;for(;0<I-A;)O=Dr(O),I--;for(;A--;){if(ee===O||O!==null&&ee===O.alternate)break t;ee=Dr(ee),O=Dr(O)}ee=null}else ee=null;Q!==null&&cf(H,q,Q,ee,!1),Z!==null&&Ke!==null&&cf(H,Ke,Z,ee,!0)}}e:{if(q=L?Mr(L):window,Q=q.nodeName&&q.nodeName.toLowerCase(),Q==="select"||Q==="input"&&q.type==="file")var te=Rw;else if(Bh(q))if(qh)te=Lw;else{te=Iw;var ae=Ow}else(Q=q.nodeName)&&Q.toLowerCase()==="input"&&(q.type==="checkbox"||q.type==="radio")&&(te=Dw);if(te&&(te=te(r,L))){zh(H,te,a,W);break e}ae&&ae(r,q,L),r==="focusout"&&(ae=q._wrapperState)&&ae.controlled&&q.type==="number"&&Xa(q,"number",q.value)}switch(ae=L?Mr(L):window,r){case"focusin":(Bh(ae)||ae.contentEditable==="true")&&(Or=ae,jl=L,Bs=null);break;case"focusout":Bs=jl=Or=null;break;case"mousedown":Cl=!0;break;case"contextmenu":case"mouseup":case"dragend":Cl=!1,Xh(H,a,W);break;case"selectionchange":if($w)break;case"keydown":case"keyup":Xh(H,a,W)}var le;if(Sl)e:{switch(r){case"compositionstart":var ge="onCompositionStart";break e;case"compositionend":ge="onCompositionEnd";break e;case"compositionupdate":ge="onCompositionUpdate";break e}ge=void 0}else Rr?Vh(r,a)&&(ge="onCompositionEnd"):r==="keydown"&&a.keyCode===229&&(ge="onCompositionStart");ge&&(Mh&&a.locale!=="ko"&&(Rr||ge!=="onCompositionStart"?ge==="onCompositionEnd"&&Rr&&(le=Rh()):(Nn=W,yl="value"in Nn?Nn.value:Nn.textContent,Rr=!0)),ae=go(L,ge),0<ae.length&&(ge=new Dh(ge,r,null,a,W),H.push({event:ge,listeners:ae}),le?ge.data=le:(le=Fh(a),le!==null&&(ge.data=le)))),(le=jw?Cw(r,a):Nw(r,a))&&(L=go(L,"onBeforeInput"),0<L.length&&(W=new Dh("onBeforeInput","beforeinput",null,a,W),H.push({event:W,listeners:L}),W.data=le))}lf(H,s)})}function Ws(r,s,a){return{instance:r,listener:s,currentTarget:a}}function go(r,s){for(var a=s+"Capture",c=[];r!==null;){var f=r,g=f.stateNode;f.tag===5&&g!==null&&(f=g,g=Ts(r,a),g!=null&&c.unshift(Ws(r,g,f)),g=Ts(r,s),g!=null&&c.push(Ws(r,g,f))),r=r.return}return c}function Dr(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function cf(r,s,a,c,f){for(var g=s._reactName,x=[];a!==null&&a!==c;){var T=a,C=T.alternate,L=T.stateNode;if(C!==null&&C===c)break;T.tag===5&&L!==null&&(T=L,f?(C=Ts(a,g),C!=null&&x.unshift(Ws(a,C,T))):f||(C=Ts(a,g),C!=null&&x.push(Ws(a,C,T)))),a=a.return}x.length!==0&&r.push({event:s,listeners:x})}var zw=/\r\n?/g,qw=/\u0000|\uFFFD/g;function df(r){return(typeof r=="string"?r:""+r).replace(zw,`
6
+ `).replace(qw,"")}function yo(r,s,a){if(s=df(s),df(r)!==s&&a)throw Error(n(425))}function vo(){}var Il=null,Dl=null;function Ll(r,s){return r==="textarea"||r==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Ml=typeof setTimeout=="function"?setTimeout:void 0,Ww=typeof clearTimeout=="function"?clearTimeout:void 0,hf=typeof Promise=="function"?Promise:void 0,Hw=typeof queueMicrotask=="function"?queueMicrotask:typeof hf<"u"?function(r){return hf.resolve(null).then(r).catch(Kw)}:Ml;function Kw(r){setTimeout(function(){throw r})}function Ul(r,s){var a=s,c=0;do{var f=a.nextSibling;if(r.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"){if(c===0){r.removeChild(f),Ds(s);return}c--}else a!=="$"&&a!=="$?"&&a!=="$!"||c++;a=f}while(a);Ds(s)}function Pn(r){for(;r!=null;r=r.nextSibling){var s=r.nodeType;if(s===1||s===3)break;if(s===8){if(s=r.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return r}function ff(r){r=r.previousSibling;for(var s=0;r;){if(r.nodeType===8){var a=r.data;if(a==="$"||a==="$!"||a==="$?"){if(s===0)return r;s--}else a==="/$"&&s++}r=r.previousSibling}return null}var Lr=Math.random().toString(36).slice(2),nn="__reactFiber$"+Lr,Hs="__reactProps$"+Lr,cn="__reactContainer$"+Lr,$l="__reactEvents$"+Lr,Gw="__reactListeners$"+Lr,Jw="__reactHandles$"+Lr;function Xn(r){var s=r[nn];if(s)return s;for(var a=r.parentNode;a;){if(s=a[cn]||a[nn]){if(a=s.alternate,s.child!==null||a!==null&&a.child!==null)for(r=ff(r);r!==null;){if(a=r[nn])return a;r=ff(r)}return s}r=a,a=r.parentNode}return null}function Ks(r){return r=r[nn]||r[cn],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function Mr(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function wo(r){return r[Hs]||null}var Vl=[],Ur=-1;function Rn(r){return{current:r}}function De(r){0>Ur||(r.current=Vl[Ur],Vl[Ur]=null,Ur--)}function Ae(r,s){Ur++,Vl[Ur]=r.current,r.current=s}var On={},lt=Rn(On),yt=Rn(!1),Zn=On;function $r(r,s){var a=r.type.contextTypes;if(!a)return On;var c=r.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===s)return c.__reactInternalMemoizedMaskedChildContext;var f={},g;for(g in a)f[g]=s[g];return c&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=s,r.__reactInternalMemoizedMaskedChildContext=f),f}function vt(r){return r=r.childContextTypes,r!=null}function xo(){De(yt),De(lt)}function pf(r,s,a){if(lt.current!==On)throw Error(n(168));Ae(lt,s),Ae(yt,a)}function mf(r,s,a){var c=r.stateNode;if(s=s.childContextTypes,typeof c.getChildContext!="function")return a;c=c.getChildContext();for(var f in c)if(!(f in s))throw Error(n(108,Ee(r)||"Unknown",f));return K({},a,c)}function bo(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||On,Zn=lt.current,Ae(lt,r),Ae(yt,yt.current),!0}function gf(r,s,a){var c=r.stateNode;if(!c)throw Error(n(169));a?(r=mf(r,s,Zn),c.__reactInternalMemoizedMergedChildContext=r,De(yt),De(lt),Ae(lt,r)):De(yt),Ae(yt,a)}var dn=null,_o=!1,Fl=!1;function yf(r){dn===null?dn=[r]:dn.push(r)}function Yw(r){_o=!0,yf(r)}function In(){if(!Fl&&dn!==null){Fl=!0;var r=0,s=Ce;try{var a=dn;for(Ce=1;r<a.length;r++){var c=a[r];do c=c(!0);while(c!==null)}dn=null,_o=!1}catch(f){throw dn!==null&&(dn=dn.slice(r+1)),vh(ul,In),f}finally{Ce=s,Fl=!1}}return null}var Vr=[],Fr=0,So=null,ko=0,Dt=[],Lt=0,er=null,hn=1,fn="";function tr(r,s){Vr[Fr++]=ko,Vr[Fr++]=So,So=r,ko=s}function vf(r,s,a){Dt[Lt++]=hn,Dt[Lt++]=fn,Dt[Lt++]=er,er=r;var c=hn;r=fn;var f=32-zt(c)-1;c&=~(1<<f),a+=1;var g=32-zt(s)+f;if(30<g){var x=f-f%5;g=(c&(1<<x)-1).toString(32),c>>=x,f-=x,hn=1<<32-zt(s)+f|a<<f|c,fn=g+r}else hn=1<<g|a<<f|c,fn=r}function Bl(r){r.return!==null&&(tr(r,1),vf(r,1,0))}function zl(r){for(;r===So;)So=Vr[--Fr],Vr[Fr]=null,ko=Vr[--Fr],Vr[Fr]=null;for(;r===er;)er=Dt[--Lt],Dt[Lt]=null,fn=Dt[--Lt],Dt[Lt]=null,hn=Dt[--Lt],Dt[Lt]=null}var jt=null,Ct=null,Ue=!1,Wt=null;function wf(r,s){var a=Vt(5,null,null,0);a.elementType="DELETED",a.stateNode=s,a.return=r,s=r.deletions,s===null?(r.deletions=[a],r.flags|=16):s.push(a)}function xf(r,s){switch(r.tag){case 5:var a=r.type;return s=s.nodeType!==1||a.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(r.stateNode=s,jt=r,Ct=Pn(s.firstChild),!0):!1;case 6:return s=r.pendingProps===""||s.nodeType!==3?null:s,s!==null?(r.stateNode=s,jt=r,Ct=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(a=er!==null?{id:hn,overflow:fn}:null,r.memoizedState={dehydrated:s,treeContext:a,retryLane:1073741824},a=Vt(18,null,null,0),a.stateNode=s,a.return=r,r.child=a,jt=r,Ct=null,!0):!1;default:return!1}}function ql(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Wl(r){if(Ue){var s=Ct;if(s){var a=s;if(!xf(r,s)){if(ql(r))throw Error(n(418));s=Pn(a.nextSibling);var c=jt;s&&xf(r,s)?wf(c,a):(r.flags=r.flags&-4097|2,Ue=!1,jt=r)}}else{if(ql(r))throw Error(n(418));r.flags=r.flags&-4097|2,Ue=!1,jt=r}}}function bf(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;jt=r}function Eo(r){if(r!==jt)return!1;if(!Ue)return bf(r),Ue=!0,!1;var s;if((s=r.tag!==3)&&!(s=r.tag!==5)&&(s=r.type,s=s!=="head"&&s!=="body"&&!Ll(r.type,r.memoizedProps)),s&&(s=Ct)){if(ql(r))throw _f(),Error(n(418));for(;s;)wf(r,s),s=Pn(s.nextSibling)}if(bf(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,s=0;r;){if(r.nodeType===8){var a=r.data;if(a==="/$"){if(s===0){Ct=Pn(r.nextSibling);break e}s--}else a!=="$"&&a!=="$!"&&a!=="$?"||s++}r=r.nextSibling}Ct=null}}else Ct=jt?Pn(r.stateNode.nextSibling):null;return!0}function _f(){for(var r=Ct;r;)r=Pn(r.nextSibling)}function Br(){Ct=jt=null,Ue=!1}function Hl(r){Wt===null?Wt=[r]:Wt.push(r)}var Qw=U.ReactCurrentBatchConfig;function Gs(r,s,a){if(r=a.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(a._owner){if(a=a._owner,a){if(a.tag!==1)throw Error(n(309));var c=a.stateNode}if(!c)throw Error(n(147,r));var f=c,g=""+r;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===g?s.ref:(s=function(x){var T=f.refs;x===null?delete T[g]:T[g]=x},s._stringRef=g,s)}if(typeof r!="string")throw Error(n(284));if(!a._owner)throw Error(n(290,r))}return r}function To(r,s){throw r=Object.prototype.toString.call(s),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r))}function Sf(r){var s=r._init;return s(r._payload)}function kf(r){function s(O,A){if(r){var I=O.deletions;I===null?(O.deletions=[A],O.flags|=16):I.push(A)}}function a(O,A){if(!r)return null;for(;A!==null;)s(O,A),A=A.sibling;return null}function c(O,A){for(O=new Map;A!==null;)A.key!==null?O.set(A.key,A):O.set(A.index,A),A=A.sibling;return O}function f(O,A){return O=Bn(O,A),O.index=0,O.sibling=null,O}function g(O,A,I){return O.index=I,r?(I=O.alternate,I!==null?(I=I.index,I<A?(O.flags|=2,A):I):(O.flags|=2,A)):(O.flags|=1048576,A)}function x(O){return r&&O.alternate===null&&(O.flags|=2),O}function T(O,A,I,G){return A===null||A.tag!==6?(A=Mu(I,O.mode,G),A.return=O,A):(A=f(A,I),A.return=O,A)}function C(O,A,I,G){var te=I.type;return te===$?W(O,A,I.props.children,G,I.key):A!==null&&(A.elementType===te||typeof te=="object"&&te!==null&&te.$$typeof===be&&Sf(te)===A.type)?(G=f(A,I.props),G.ref=Gs(O,A,I),G.return=O,G):(G=Yo(I.type,I.key,I.props,null,O.mode,G),G.ref=Gs(O,A,I),G.return=O,G)}function L(O,A,I,G){return A===null||A.tag!==4||A.stateNode.containerInfo!==I.containerInfo||A.stateNode.implementation!==I.implementation?(A=Uu(I,O.mode,G),A.return=O,A):(A=f(A,I.children||[]),A.return=O,A)}function W(O,A,I,G,te){return A===null||A.tag!==7?(A=ur(I,O.mode,G,te),A.return=O,A):(A=f(A,I),A.return=O,A)}function H(O,A,I){if(typeof A=="string"&&A!==""||typeof A=="number")return A=Mu(""+A,O.mode,I),A.return=O,A;if(typeof A=="object"&&A!==null){switch(A.$$typeof){case V:return I=Yo(A.type,A.key,A.props,null,O.mode,I),I.ref=Gs(O,null,A),I.return=O,I;case z:return A=Uu(A,O.mode,I),A.return=O,A;case be:var G=A._init;return H(O,G(A._payload),I)}if(Ss(A)||J(A))return A=ur(A,O.mode,I,null),A.return=O,A;To(O,A)}return null}function q(O,A,I,G){var te=A!==null?A.key:null;if(typeof I=="string"&&I!==""||typeof I=="number")return te!==null?null:T(O,A,""+I,G);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case V:return I.key===te?C(O,A,I,G):null;case z:return I.key===te?L(O,A,I,G):null;case be:return te=I._init,q(O,A,te(I._payload),G)}if(Ss(I)||J(I))return te!==null?null:W(O,A,I,G,null);To(O,I)}return null}function Q(O,A,I,G,te){if(typeof G=="string"&&G!==""||typeof G=="number")return O=O.get(I)||null,T(A,O,""+G,te);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case V:return O=O.get(G.key===null?I:G.key)||null,C(A,O,G,te);case z:return O=O.get(G.key===null?I:G.key)||null,L(A,O,G,te);case be:var ae=G._init;return Q(O,A,I,ae(G._payload),te)}if(Ss(G)||J(G))return O=O.get(I)||null,W(A,O,G,te,null);To(A,G)}return null}function Z(O,A,I,G){for(var te=null,ae=null,le=A,ge=A=0,nt=null;le!==null&&ge<I.length;ge++){le.index>ge?(nt=le,le=null):nt=le.sibling;var Se=q(O,le,I[ge],G);if(Se===null){le===null&&(le=nt);break}r&&le&&Se.alternate===null&&s(O,le),A=g(Se,A,ge),ae===null?te=Se:ae.sibling=Se,ae=Se,le=nt}if(ge===I.length)return a(O,le),Ue&&tr(O,ge),te;if(le===null){for(;ge<I.length;ge++)le=H(O,I[ge],G),le!==null&&(A=g(le,A,ge),ae===null?te=le:ae.sibling=le,ae=le);return Ue&&tr(O,ge),te}for(le=c(O,le);ge<I.length;ge++)nt=Q(le,O,ge,I[ge],G),nt!==null&&(r&&nt.alternate!==null&&le.delete(nt.key===null?ge:nt.key),A=g(nt,A,ge),ae===null?te=nt:ae.sibling=nt,ae=nt);return r&&le.forEach(function(zn){return s(O,zn)}),Ue&&tr(O,ge),te}function ee(O,A,I,G){var te=J(I);if(typeof te!="function")throw Error(n(150));if(I=te.call(I),I==null)throw Error(n(151));for(var ae=te=null,le=A,ge=A=0,nt=null,Se=I.next();le!==null&&!Se.done;ge++,Se=I.next()){le.index>ge?(nt=le,le=null):nt=le.sibling;var zn=q(O,le,Se.value,G);if(zn===null){le===null&&(le=nt);break}r&&le&&zn.alternate===null&&s(O,le),A=g(zn,A,ge),ae===null?te=zn:ae.sibling=zn,ae=zn,le=nt}if(Se.done)return a(O,le),Ue&&tr(O,ge),te;if(le===null){for(;!Se.done;ge++,Se=I.next())Se=H(O,Se.value,G),Se!==null&&(A=g(Se,A,ge),ae===null?te=Se:ae.sibling=Se,ae=Se);return Ue&&tr(O,ge),te}for(le=c(O,le);!Se.done;ge++,Se=I.next())Se=Q(le,O,ge,Se.value,G),Se!==null&&(r&&Se.alternate!==null&&le.delete(Se.key===null?ge:Se.key),A=g(Se,A,ge),ae===null?te=Se:ae.sibling=Se,ae=Se);return r&&le.forEach(function(Ax){return s(O,Ax)}),Ue&&tr(O,ge),te}function Ke(O,A,I,G){if(typeof I=="object"&&I!==null&&I.type===$&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case V:e:{for(var te=I.key,ae=A;ae!==null;){if(ae.key===te){if(te=I.type,te===$){if(ae.tag===7){a(O,ae.sibling),A=f(ae,I.props.children),A.return=O,O=A;break e}}else if(ae.elementType===te||typeof te=="object"&&te!==null&&te.$$typeof===be&&Sf(te)===ae.type){a(O,ae.sibling),A=f(ae,I.props),A.ref=Gs(O,ae,I),A.return=O,O=A;break e}a(O,ae);break}else s(O,ae);ae=ae.sibling}I.type===$?(A=ur(I.props.children,O.mode,G,I.key),A.return=O,O=A):(G=Yo(I.type,I.key,I.props,null,O.mode,G),G.ref=Gs(O,A,I),G.return=O,O=G)}return x(O);case z:e:{for(ae=I.key;A!==null;){if(A.key===ae)if(A.tag===4&&A.stateNode.containerInfo===I.containerInfo&&A.stateNode.implementation===I.implementation){a(O,A.sibling),A=f(A,I.children||[]),A.return=O,O=A;break e}else{a(O,A);break}else s(O,A);A=A.sibling}A=Uu(I,O.mode,G),A.return=O,O=A}return x(O);case be:return ae=I._init,Ke(O,A,ae(I._payload),G)}if(Ss(I))return Z(O,A,I,G);if(J(I))return ee(O,A,I,G);To(O,I)}return typeof I=="string"&&I!==""||typeof I=="number"?(I=""+I,A!==null&&A.tag===6?(a(O,A.sibling),A=f(A,I),A.return=O,O=A):(a(O,A),A=Mu(I,O.mode,G),A.return=O,O=A),x(O)):a(O,A)}return Ke}var zr=kf(!0),Ef=kf(!1),jo=Rn(null),Co=null,qr=null,Kl=null;function Gl(){Kl=qr=Co=null}function Jl(r){var s=jo.current;De(jo),r._currentValue=s}function Yl(r,s,a){for(;r!==null;){var c=r.alternate;if((r.childLanes&s)!==s?(r.childLanes|=s,c!==null&&(c.childLanes|=s)):c!==null&&(c.childLanes&s)!==s&&(c.childLanes|=s),r===a)break;r=r.return}}function Wr(r,s){Co=r,Kl=qr=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&s)!==0&&(wt=!0),r.firstContext=null)}function Mt(r){var s=r._currentValue;if(Kl!==r)if(r={context:r,memoizedValue:s,next:null},qr===null){if(Co===null)throw Error(n(308));qr=r,Co.dependencies={lanes:0,firstContext:r}}else qr=qr.next=r;return s}var nr=null;function Ql(r){nr===null?nr=[r]:nr.push(r)}function Tf(r,s,a,c){var f=s.interleaved;return f===null?(a.next=a,Ql(s)):(a.next=f.next,f.next=a),s.interleaved=a,pn(r,c)}function pn(r,s){r.lanes|=s;var a=r.alternate;for(a!==null&&(a.lanes|=s),a=r,r=r.return;r!==null;)r.childLanes|=s,a=r.alternate,a!==null&&(a.childLanes|=s),a=r,r=r.return;return a.tag===3?a.stateNode:null}var Dn=!1;function Xl(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function jf(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function mn(r,s){return{eventTime:r,lane:s,tag:0,payload:null,callback:null,next:null}}function Ln(r,s,a){var c=r.updateQueue;if(c===null)return null;if(c=c.shared,(_e&2)!==0){var f=c.pending;return f===null?s.next=s:(s.next=f.next,f.next=s),c.pending=s,pn(r,a)}return f=c.interleaved,f===null?(s.next=s,Ql(c)):(s.next=f.next,f.next=s),c.interleaved=s,pn(r,a)}function No(r,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194240)!==0)){var c=s.lanes;c&=r.pendingLanes,a|=c,s.lanes=a,hl(r,a)}}function Cf(r,s){var a=r.updateQueue,c=r.alternate;if(c!==null&&(c=c.updateQueue,a===c)){var f=null,g=null;if(a=a.firstBaseUpdate,a!==null){do{var x={eventTime:a.eventTime,lane:a.lane,tag:a.tag,payload:a.payload,callback:a.callback,next:null};g===null?f=g=x:g=g.next=x,a=a.next}while(a!==null);g===null?f=g=s:g=g.next=s}else f=g=s;a={baseState:c.baseState,firstBaseUpdate:f,lastBaseUpdate:g,shared:c.shared,effects:c.effects},r.updateQueue=a;return}r=a.lastBaseUpdate,r===null?a.firstBaseUpdate=s:r.next=s,a.lastBaseUpdate=s}function Ao(r,s,a,c){var f=r.updateQueue;Dn=!1;var g=f.firstBaseUpdate,x=f.lastBaseUpdate,T=f.shared.pending;if(T!==null){f.shared.pending=null;var C=T,L=C.next;C.next=null,x===null?g=L:x.next=L,x=C;var W=r.alternate;W!==null&&(W=W.updateQueue,T=W.lastBaseUpdate,T!==x&&(T===null?W.firstBaseUpdate=L:T.next=L,W.lastBaseUpdate=C))}if(g!==null){var H=f.baseState;x=0,W=L=C=null,T=g;do{var q=T.lane,Q=T.eventTime;if((c&q)===q){W!==null&&(W=W.next={eventTime:Q,lane:0,tag:T.tag,payload:T.payload,callback:T.callback,next:null});e:{var Z=r,ee=T;switch(q=s,Q=a,ee.tag){case 1:if(Z=ee.payload,typeof Z=="function"){H=Z.call(Q,H,q);break e}H=Z;break e;case 3:Z.flags=Z.flags&-65537|128;case 0:if(Z=ee.payload,q=typeof Z=="function"?Z.call(Q,H,q):Z,q==null)break e;H=K({},H,q);break e;case 2:Dn=!0}}T.callback!==null&&T.lane!==0&&(r.flags|=64,q=f.effects,q===null?f.effects=[T]:q.push(T))}else Q={eventTime:Q,lane:q,tag:T.tag,payload:T.payload,callback:T.callback,next:null},W===null?(L=W=Q,C=H):W=W.next=Q,x|=q;if(T=T.next,T===null){if(T=f.shared.pending,T===null)break;q=T,T=q.next,q.next=null,f.lastBaseUpdate=q,f.shared.pending=null}}while(!0);if(W===null&&(C=H),f.baseState=C,f.firstBaseUpdate=L,f.lastBaseUpdate=W,s=f.shared.interleaved,s!==null){f=s;do x|=f.lane,f=f.next;while(f!==s)}else g===null&&(f.shared.lanes=0);ir|=x,r.lanes=x,r.memoizedState=H}}function Nf(r,s,a){if(r=s.effects,s.effects=null,r!==null)for(s=0;s<r.length;s++){var c=r[s],f=c.callback;if(f!==null){if(c.callback=null,c=a,typeof f!="function")throw Error(n(191,f));f.call(c)}}}var Js={},rn=Rn(Js),Ys=Rn(Js),Qs=Rn(Js);function rr(r){if(r===Js)throw Error(n(174));return r}function Zl(r,s){switch(Ae(Qs,s),Ae(Ys,r),Ae(rn,Js),r=s.nodeType,r){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:el(null,"");break;default:r=r===8?s.parentNode:s,s=r.namespaceURI||null,r=r.tagName,s=el(s,r)}De(rn),Ae(rn,s)}function Hr(){De(rn),De(Ys),De(Qs)}function Af(r){rr(Qs.current);var s=rr(rn.current),a=el(s,r.type);s!==a&&(Ae(Ys,r),Ae(rn,a))}function eu(r){Ys.current===r&&(De(rn),De(Ys))}var $e=Rn(0);function Po(r){for(var s=r;s!==null;){if(s.tag===13){var a=s.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||a.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var tu=[];function nu(){for(var r=0;r<tu.length;r++)tu[r]._workInProgressVersionPrimary=null;tu.length=0}var Ro=U.ReactCurrentDispatcher,ru=U.ReactCurrentBatchConfig,sr=0,Ve=null,Qe=null,et=null,Oo=!1,Xs=!1,Zs=0,Xw=0;function ut(){throw Error(n(321))}function su(r,s){if(s===null)return!1;for(var a=0;a<s.length&&a<r.length;a++)if(!qt(r[a],s[a]))return!1;return!0}function iu(r,s,a,c,f,g){if(sr=g,Ve=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,Ro.current=r===null||r.memoizedState===null?nx:rx,r=a(c,f),Xs){g=0;do{if(Xs=!1,Zs=0,25<=g)throw Error(n(301));g+=1,et=Qe=null,s.updateQueue=null,Ro.current=sx,r=a(c,f)}while(Xs)}if(Ro.current=Lo,s=Qe!==null&&Qe.next!==null,sr=0,et=Qe=Ve=null,Oo=!1,s)throw Error(n(300));return r}function ou(){var r=Zs!==0;return Zs=0,r}function sn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return et===null?Ve.memoizedState=et=r:et=et.next=r,et}function Ut(){if(Qe===null){var r=Ve.alternate;r=r!==null?r.memoizedState:null}else r=Qe.next;var s=et===null?Ve.memoizedState:et.next;if(s!==null)et=s,Qe=r;else{if(r===null)throw Error(n(310));Qe=r,r={memoizedState:Qe.memoizedState,baseState:Qe.baseState,baseQueue:Qe.baseQueue,queue:Qe.queue,next:null},et===null?Ve.memoizedState=et=r:et=et.next=r}return et}function ei(r,s){return typeof s=="function"?s(r):s}function au(r){var s=Ut(),a=s.queue;if(a===null)throw Error(n(311));a.lastRenderedReducer=r;var c=Qe,f=c.baseQueue,g=a.pending;if(g!==null){if(f!==null){var x=f.next;f.next=g.next,g.next=x}c.baseQueue=f=g,a.pending=null}if(f!==null){g=f.next,c=c.baseState;var T=x=null,C=null,L=g;do{var W=L.lane;if((sr&W)===W)C!==null&&(C=C.next={lane:0,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null}),c=L.hasEagerState?L.eagerState:r(c,L.action);else{var H={lane:W,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null};C===null?(T=C=H,x=c):C=C.next=H,Ve.lanes|=W,ir|=W}L=L.next}while(L!==null&&L!==g);C===null?x=c:C.next=T,qt(c,s.memoizedState)||(wt=!0),s.memoizedState=c,s.baseState=x,s.baseQueue=C,a.lastRenderedState=c}if(r=a.interleaved,r!==null){f=r;do g=f.lane,Ve.lanes|=g,ir|=g,f=f.next;while(f!==r)}else f===null&&(a.lanes=0);return[s.memoizedState,a.dispatch]}function lu(r){var s=Ut(),a=s.queue;if(a===null)throw Error(n(311));a.lastRenderedReducer=r;var c=a.dispatch,f=a.pending,g=s.memoizedState;if(f!==null){a.pending=null;var x=f=f.next;do g=r(g,x.action),x=x.next;while(x!==f);qt(g,s.memoizedState)||(wt=!0),s.memoizedState=g,s.baseQueue===null&&(s.baseState=g),a.lastRenderedState=g}return[g,c]}function Pf(){}function Rf(r,s){var a=Ve,c=Ut(),f=s(),g=!qt(c.memoizedState,f);if(g&&(c.memoizedState=f,wt=!0),c=c.queue,uu(Df.bind(null,a,c,r),[r]),c.getSnapshot!==s||g||et!==null&&et.memoizedState.tag&1){if(a.flags|=2048,ti(9,If.bind(null,a,c,f,s),void 0,null),tt===null)throw Error(n(349));(sr&30)!==0||Of(a,s,f)}return f}function Of(r,s,a){r.flags|=16384,r={getSnapshot:s,value:a},s=Ve.updateQueue,s===null?(s={lastEffect:null,stores:null},Ve.updateQueue=s,s.stores=[r]):(a=s.stores,a===null?s.stores=[r]:a.push(r))}function If(r,s,a,c){s.value=a,s.getSnapshot=c,Lf(s)&&Mf(r)}function Df(r,s,a){return a(function(){Lf(s)&&Mf(r)})}function Lf(r){var s=r.getSnapshot;r=r.value;try{var a=s();return!qt(r,a)}catch{return!0}}function Mf(r){var s=pn(r,1);s!==null&&Jt(s,r,1,-1)}function Uf(r){var s=sn();return typeof r=="function"&&(r=r()),s.memoizedState=s.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ei,lastRenderedState:r},s.queue=r,r=r.dispatch=tx.bind(null,Ve,r),[s.memoizedState,r]}function ti(r,s,a,c){return r={tag:r,create:s,destroy:a,deps:c,next:null},s=Ve.updateQueue,s===null?(s={lastEffect:null,stores:null},Ve.updateQueue=s,s.lastEffect=r.next=r):(a=s.lastEffect,a===null?s.lastEffect=r.next=r:(c=a.next,a.next=r,r.next=c,s.lastEffect=r)),r}function $f(){return Ut().memoizedState}function Io(r,s,a,c){var f=sn();Ve.flags|=r,f.memoizedState=ti(1|s,a,void 0,c===void 0?null:c)}function Do(r,s,a,c){var f=Ut();c=c===void 0?null:c;var g=void 0;if(Qe!==null){var x=Qe.memoizedState;if(g=x.destroy,c!==null&&su(c,x.deps)){f.memoizedState=ti(s,a,g,c);return}}Ve.flags|=r,f.memoizedState=ti(1|s,a,g,c)}function Vf(r,s){return Io(8390656,8,r,s)}function uu(r,s){return Do(2048,8,r,s)}function Ff(r,s){return Do(4,2,r,s)}function Bf(r,s){return Do(4,4,r,s)}function zf(r,s){if(typeof s=="function")return r=r(),s(r),function(){s(null)};if(s!=null)return r=r(),s.current=r,function(){s.current=null}}function qf(r,s,a){return a=a!=null?a.concat([r]):null,Do(4,4,zf.bind(null,s,r),a)}function cu(){}function Wf(r,s){var a=Ut();s=s===void 0?null:s;var c=a.memoizedState;return c!==null&&s!==null&&su(s,c[1])?c[0]:(a.memoizedState=[r,s],r)}function Hf(r,s){var a=Ut();s=s===void 0?null:s;var c=a.memoizedState;return c!==null&&s!==null&&su(s,c[1])?c[0]:(r=r(),a.memoizedState=[r,s],r)}function Kf(r,s,a){return(sr&21)===0?(r.baseState&&(r.baseState=!1,wt=!0),r.memoizedState=a):(qt(a,s)||(a=_h(),Ve.lanes|=a,ir|=a,r.baseState=!0),s)}function Zw(r,s){var a=Ce;Ce=a!==0&&4>a?a:4,r(!0);var c=ru.transition;ru.transition={};try{r(!1),s()}finally{Ce=a,ru.transition=c}}function Gf(){return Ut().memoizedState}function ex(r,s,a){var c=Vn(r);if(a={lane:c,action:a,hasEagerState:!1,eagerState:null,next:null},Jf(r))Yf(s,a);else if(a=Tf(r,s,a,c),a!==null){var f=gt();Jt(a,r,c,f),Qf(a,s,c)}}function tx(r,s,a){var c=Vn(r),f={lane:c,action:a,hasEagerState:!1,eagerState:null,next:null};if(Jf(r))Yf(s,f);else{var g=r.alternate;if(r.lanes===0&&(g===null||g.lanes===0)&&(g=s.lastRenderedReducer,g!==null))try{var x=s.lastRenderedState,T=g(x,a);if(f.hasEagerState=!0,f.eagerState=T,qt(T,x)){var C=s.interleaved;C===null?(f.next=f,Ql(s)):(f.next=C.next,C.next=f),s.interleaved=f;return}}catch{}a=Tf(r,s,f,c),a!==null&&(f=gt(),Jt(a,r,c,f),Qf(a,s,c))}}function Jf(r){var s=r.alternate;return r===Ve||s!==null&&s===Ve}function Yf(r,s){Xs=Oo=!0;var a=r.pending;a===null?s.next=s:(s.next=a.next,a.next=s),r.pending=s}function Qf(r,s,a){if((a&4194240)!==0){var c=s.lanes;c&=r.pendingLanes,a|=c,s.lanes=a,hl(r,a)}}var Lo={readContext:Mt,useCallback:ut,useContext:ut,useEffect:ut,useImperativeHandle:ut,useInsertionEffect:ut,useLayoutEffect:ut,useMemo:ut,useReducer:ut,useRef:ut,useState:ut,useDebugValue:ut,useDeferredValue:ut,useTransition:ut,useMutableSource:ut,useSyncExternalStore:ut,useId:ut,unstable_isNewReconciler:!1},nx={readContext:Mt,useCallback:function(r,s){return sn().memoizedState=[r,s===void 0?null:s],r},useContext:Mt,useEffect:Vf,useImperativeHandle:function(r,s,a){return a=a!=null?a.concat([r]):null,Io(4194308,4,zf.bind(null,s,r),a)},useLayoutEffect:function(r,s){return Io(4194308,4,r,s)},useInsertionEffect:function(r,s){return Io(4,2,r,s)},useMemo:function(r,s){var a=sn();return s=s===void 0?null:s,r=r(),a.memoizedState=[r,s],r},useReducer:function(r,s,a){var c=sn();return s=a!==void 0?a(s):s,c.memoizedState=c.baseState=s,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:s},c.queue=r,r=r.dispatch=ex.bind(null,Ve,r),[c.memoizedState,r]},useRef:function(r){var s=sn();return r={current:r},s.memoizedState=r},useState:Uf,useDebugValue:cu,useDeferredValue:function(r){return sn().memoizedState=r},useTransition:function(){var r=Uf(!1),s=r[0];return r=Zw.bind(null,r[1]),sn().memoizedState=r,[s,r]},useMutableSource:function(){},useSyncExternalStore:function(r,s,a){var c=Ve,f=sn();if(Ue){if(a===void 0)throw Error(n(407));a=a()}else{if(a=s(),tt===null)throw Error(n(349));(sr&30)!==0||Of(c,s,a)}f.memoizedState=a;var g={value:a,getSnapshot:s};return f.queue=g,Vf(Df.bind(null,c,g,r),[r]),c.flags|=2048,ti(9,If.bind(null,c,g,a,s),void 0,null),a},useId:function(){var r=sn(),s=tt.identifierPrefix;if(Ue){var a=fn,c=hn;a=(c&~(1<<32-zt(c)-1)).toString(32)+a,s=":"+s+"R"+a,a=Zs++,0<a&&(s+="H"+a.toString(32)),s+=":"}else a=Xw++,s=":"+s+"r"+a.toString(32)+":";return r.memoizedState=s},unstable_isNewReconciler:!1},rx={readContext:Mt,useCallback:Wf,useContext:Mt,useEffect:uu,useImperativeHandle:qf,useInsertionEffect:Ff,useLayoutEffect:Bf,useMemo:Hf,useReducer:au,useRef:$f,useState:function(){return au(ei)},useDebugValue:cu,useDeferredValue:function(r){var s=Ut();return Kf(s,Qe.memoizedState,r)},useTransition:function(){var r=au(ei)[0],s=Ut().memoizedState;return[r,s]},useMutableSource:Pf,useSyncExternalStore:Rf,useId:Gf,unstable_isNewReconciler:!1},sx={readContext:Mt,useCallback:Wf,useContext:Mt,useEffect:uu,useImperativeHandle:qf,useInsertionEffect:Ff,useLayoutEffect:Bf,useMemo:Hf,useReducer:lu,useRef:$f,useState:function(){return lu(ei)},useDebugValue:cu,useDeferredValue:function(r){var s=Ut();return Qe===null?s.memoizedState=r:Kf(s,Qe.memoizedState,r)},useTransition:function(){var r=lu(ei)[0],s=Ut().memoizedState;return[r,s]},useMutableSource:Pf,useSyncExternalStore:Rf,useId:Gf,unstable_isNewReconciler:!1};function Ht(r,s){if(r&&r.defaultProps){s=K({},s),r=r.defaultProps;for(var a in r)s[a]===void 0&&(s[a]=r[a]);return s}return s}function du(r,s,a,c){s=r.memoizedState,a=a(c,s),a=a==null?s:K({},s,a),r.memoizedState=a,r.lanes===0&&(r.updateQueue.baseState=a)}var Mo={isMounted:function(r){return(r=r._reactInternals)?Qn(r)===r:!1},enqueueSetState:function(r,s,a){r=r._reactInternals;var c=gt(),f=Vn(r),g=mn(c,f);g.payload=s,a!=null&&(g.callback=a),s=Ln(r,g,f),s!==null&&(Jt(s,r,f,c),No(s,r,f))},enqueueReplaceState:function(r,s,a){r=r._reactInternals;var c=gt(),f=Vn(r),g=mn(c,f);g.tag=1,g.payload=s,a!=null&&(g.callback=a),s=Ln(r,g,f),s!==null&&(Jt(s,r,f,c),No(s,r,f))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var a=gt(),c=Vn(r),f=mn(a,c);f.tag=2,s!=null&&(f.callback=s),s=Ln(r,f,c),s!==null&&(Jt(s,r,c,a),No(s,r,c))}};function Xf(r,s,a,c,f,g,x){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(c,g,x):s.prototype&&s.prototype.isPureReactComponent?!Fs(a,c)||!Fs(f,g):!0}function Zf(r,s,a){var c=!1,f=On,g=s.contextType;return typeof g=="object"&&g!==null?g=Mt(g):(f=vt(s)?Zn:lt.current,c=s.contextTypes,g=(c=c!=null)?$r(r,f):On),s=new s(a,g),r.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Mo,r.stateNode=s,s._reactInternals=r,c&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=f,r.__reactInternalMemoizedMaskedChildContext=g),s}function ep(r,s,a,c){r=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(a,c),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(a,c),s.state!==r&&Mo.enqueueReplaceState(s,s.state,null)}function hu(r,s,a,c){var f=r.stateNode;f.props=a,f.state=r.memoizedState,f.refs={},Xl(r);var g=s.contextType;typeof g=="object"&&g!==null?f.context=Mt(g):(g=vt(s)?Zn:lt.current,f.context=$r(r,g)),f.state=r.memoizedState,g=s.getDerivedStateFromProps,typeof g=="function"&&(du(r,s,g,a),f.state=r.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(s=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),s!==f.state&&Mo.enqueueReplaceState(f,f.state,null),Ao(r,a,f,c),f.state=r.memoizedState),typeof f.componentDidMount=="function"&&(r.flags|=4194308)}function Kr(r,s){try{var a="",c=s;do a+=fe(c),c=c.return;while(c);var f=a}catch(g){f=`
7
7
  Error generating stack: `+g.message+`
8
- `+g.stack}return{value:r,source:s,stack:f,digest:null}}function hu(r,s,a){return{value:r,source:null,stack:a??null,digest:s??null}}function fu(r,s){try{console.error(s.value)}catch(a){setTimeout(function(){throw a})}}var ix=typeof WeakMap=="function"?WeakMap:Map;function tp(r,s,a){a=mn(-1,a),a.tag=3,a.payload={element:null};var c=s.value;return a.callback=function(){qo||(qo=!0,Cu=c),fu(r,s)},a}function np(r,s,a){a=mn(-1,a),a.tag=3;var c=r.type.getDerivedStateFromError;if(typeof c=="function"){var f=s.value;a.payload=function(){return c(f)},a.callback=function(){fu(r,s)}}var g=r.stateNode;return g!==null&&typeof g.componentDidCatch=="function"&&(a.callback=function(){fu(r,s),typeof c!="function"&&(Mn===null?Mn=new Set([this]):Mn.add(this));var x=s.stack;this.componentDidCatch(s.value,{componentStack:x!==null?x:""})}),a}function rp(r,s,a){var c=r.pingCache;if(c===null){c=r.pingCache=new ix;var f=new Set;c.set(s,f)}else f=c.get(s),f===void 0&&(f=new Set,c.set(s,f));f.has(a)||(f.add(a),r=wx.bind(null,r,s,a),s.then(r,r))}function sp(r){do{var s;if((s=r.tag===13)&&(s=r.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return r;r=r.return}while(r!==null);return null}function ip(r,s,a,c,f){return(r.mode&1)===0?(r===s?r.flags|=65536:(r.flags|=128,a.flags|=131072,a.flags&=-52805,a.tag===1&&(a.alternate===null?a.tag=17:(s=mn(-1,1),s.tag=2,Dn(a,s,1))),a.lanes|=1),r):(r.flags|=65536,r.lanes=f,r)}var ox=U.ReactCurrentOwner,wt=!1;function mt(r,s,a,c){s.child=r===null?Ef(s,null,a,c):Br(s,r.child,a,c)}function op(r,s,a,c,f){a=a.render;var g=s.ref;return qr(s,f),c=su(r,s,a,c,g,f),a=iu(),r!==null&&!wt?(s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~f,gn(r,s,f)):(Ue&&a&&Fl(s),s.flags|=1,mt(r,s,c,f),s.child)}function ap(r,s,a,c,f){if(r===null){var g=a.type;return typeof g=="function"&&!Du(g)&&g.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(s.tag=15,s.type=g,lp(r,s,g,c,f)):(r=Yo(a.type,null,c,s,s.mode,f),r.ref=s.ref,r.return=s,s.child=r)}if(g=r.child,(r.lanes&f)===0){var x=g.memoizedProps;if(a=a.compare,a=a!==null?a:Fs,a(x,c)&&r.ref===s.ref)return gn(r,s,f)}return s.flags|=1,r=Fn(g,c),r.ref=s.ref,r.return=s,s.child=r}function lp(r,s,a,c,f){if(r!==null){var g=r.memoizedProps;if(Fs(g,c)&&r.ref===s.ref)if(wt=!1,s.pendingProps=c=g,(r.lanes&f)!==0)(r.flags&131072)!==0&&(wt=!0);else return s.lanes=r.lanes,gn(r,s,f)}return pu(r,s,a,c,f)}function up(r,s,a){var c=s.pendingProps,f=c.children,g=r!==null?r.memoizedState:null;if(c.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ae(Gr,Nt),Nt|=a;else{if((a&1073741824)===0)return r=g!==null?g.baseLanes|a:a,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:r,cachePool:null,transitions:null},s.updateQueue=null,Ae(Gr,Nt),Nt|=r,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=g!==null?g.baseLanes:a,Ae(Gr,Nt),Nt|=c}else g!==null?(c=g.baseLanes|a,s.memoizedState=null):c=a,Ae(Gr,Nt),Nt|=c;return mt(r,s,f,a),s.child}function cp(r,s){var a=s.ref;(r===null&&a!==null||r!==null&&r.ref!==a)&&(s.flags|=512,s.flags|=2097152)}function pu(r,s,a,c,f){var g=vt(a)?Zn:lt.current;return g=Ur(s,g),qr(s,f),a=su(r,s,a,c,g,f),c=iu(),r!==null&&!wt?(s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~f,gn(r,s,f)):(Ue&&c&&Fl(s),s.flags|=1,mt(r,s,a,f),s.child)}function dp(r,s,a,c,f){if(vt(a)){var g=!0;bo(s)}else g=!1;if(qr(s,f),s.stateNode===null)$o(r,s),Zf(s,a,c),du(s,a,c,f),c=!0;else if(r===null){var x=s.stateNode,T=s.memoizedProps;x.props=T;var C=x.context,L=a.contextType;typeof L=="object"&&L!==null?L=Mt(L):(L=vt(a)?Zn:lt.current,L=Ur(s,L));var W=a.getDerivedStateFromProps,H=typeof W=="function"||typeof x.getSnapshotBeforeUpdate=="function";H||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(T!==c||C!==L)&&ep(s,x,c,L),In=!1;var q=s.memoizedState;x.state=q,Ao(s,c,x,f),C=s.memoizedState,T!==c||q!==C||yt.current||In?(typeof W=="function"&&(cu(s,a,W,c),C=s.memoizedState),(T=In||Xf(s,a,T,c,q,C,L))?(H||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(s.flags|=4194308)):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=c,s.memoizedState=C),x.props=c,x.state=C,x.context=L,c=T):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),c=!1)}else{x=s.stateNode,jf(r,s),T=s.memoizedProps,L=s.type===s.elementType?T:Ht(s.type,T),x.props=L,H=s.pendingProps,q=x.context,C=a.contextType,typeof C=="object"&&C!==null?C=Mt(C):(C=vt(a)?Zn:lt.current,C=Ur(s,C));var Q=a.getDerivedStateFromProps;(W=typeof Q=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(T!==H||q!==C)&&ep(s,x,c,C),In=!1,q=s.memoizedState,x.state=q,Ao(s,c,x,f);var Z=s.memoizedState;T!==H||q!==Z||yt.current||In?(typeof Q=="function"&&(cu(s,a,Q,c),Z=s.memoizedState),(L=In||Xf(s,a,L,c,q,Z,C)||!1)?(W||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(c,Z,C),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(c,Z,C)),typeof x.componentDidUpdate=="function"&&(s.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof x.componentDidUpdate!="function"||T===r.memoizedProps&&q===r.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||T===r.memoizedProps&&q===r.memoizedState||(s.flags|=1024),s.memoizedProps=c,s.memoizedState=Z),x.props=c,x.state=Z,x.context=C,c=L):(typeof x.componentDidUpdate!="function"||T===r.memoizedProps&&q===r.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||T===r.memoizedProps&&q===r.memoizedState||(s.flags|=1024),c=!1)}return mu(r,s,a,c,g,f)}function mu(r,s,a,c,f,g){cp(r,s);var x=(s.flags&128)!==0;if(!c&&!x)return f&&gf(s,a,!1),gn(r,s,g);c=s.stateNode,ox.current=s;var T=x&&typeof a.getDerivedStateFromError!="function"?null:c.render();return s.flags|=1,r!==null&&x?(s.child=Br(s,r.child,null,g),s.child=Br(s,null,T,g)):mt(r,s,T,g),s.memoizedState=c.state,f&&gf(s,a,!0),s.child}function hp(r){var s=r.stateNode;s.pendingContext?pf(r,s.pendingContext,s.pendingContext!==s.context):s.context&&pf(r,s.context,!1),Xl(r,s.containerInfo)}function fp(r,s,a,c,f){return Fr(),Wl(f),s.flags|=256,mt(r,s,a,c),s.child}var gu={dehydrated:null,treeContext:null,retryLane:0};function yu(r){return{baseLanes:r,cachePool:null,transitions:null}}function pp(r,s,a){var c=s.pendingProps,f=$e.current,g=!1,x=(s.flags&128)!==0,T;if((T=x)||(T=r!==null&&r.memoizedState===null?!1:(f&2)!==0),T?(g=!0,s.flags&=-129):(r===null||r.memoizedState!==null)&&(f|=1),Ae($e,f&1),r===null)return ql(s),r=s.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((s.mode&1)===0?s.lanes=1:r.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(x=c.children,r=c.fallback,g?(c=s.mode,g=s.child,x={mode:"hidden",children:x},(c&1)===0&&g!==null?(g.childLanes=0,g.pendingProps=x):g=Qo(x,c,0,null),r=ur(r,c,a,null),g.return=s,r.return=s,g.sibling=r,s.child=g,s.child.memoizedState=yu(a),s.memoizedState=gu,r):vu(s,x));if(f=r.memoizedState,f!==null&&(T=f.dehydrated,T!==null))return ax(r,s,x,c,T,f,a);if(g){g=c.fallback,x=s.mode,f=r.child,T=f.sibling;var C={mode:"hidden",children:c.children};return(x&1)===0&&s.child!==f?(c=s.child,c.childLanes=0,c.pendingProps=C,s.deletions=null):(c=Fn(f,C),c.subtreeFlags=f.subtreeFlags&14680064),T!==null?g=Fn(T,g):(g=ur(g,x,a,null),g.flags|=2),g.return=s,c.return=s,c.sibling=g,s.child=c,c=g,g=s.child,x=r.child.memoizedState,x=x===null?yu(a):{baseLanes:x.baseLanes|a,cachePool:null,transitions:x.transitions},g.memoizedState=x,g.childLanes=r.childLanes&~a,s.memoizedState=gu,c}return g=r.child,r=g.sibling,c=Fn(g,{mode:"visible",children:c.children}),(s.mode&1)===0&&(c.lanes=a),c.return=s,c.sibling=null,r!==null&&(a=s.deletions,a===null?(s.deletions=[r],s.flags|=16):a.push(r)),s.child=c,s.memoizedState=null,c}function vu(r,s){return s=Qo({mode:"visible",children:s},r.mode,0,null),s.return=r,r.child=s}function Uo(r,s,a,c){return c!==null&&Wl(c),Br(s,r.child,null,a),r=vu(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function ax(r,s,a,c,f,g,x){if(a)return s.flags&256?(s.flags&=-257,c=hu(Error(n(422))),Uo(r,s,x,c)):s.memoizedState!==null?(s.child=r.child,s.flags|=128,null):(g=c.fallback,f=s.mode,c=Qo({mode:"visible",children:c.children},f,0,null),g=ur(g,f,x,null),g.flags|=2,c.return=s,g.return=s,c.sibling=g,s.child=c,(s.mode&1)!==0&&Br(s,r.child,null,x),s.child.memoizedState=yu(x),s.memoizedState=gu,g);if((s.mode&1)===0)return Uo(r,s,x,null);if(f.data==="$!"){if(c=f.nextSibling&&f.nextSibling.dataset,c)var T=c.dgst;return c=T,g=Error(n(419)),c=hu(g,c,void 0),Uo(r,s,x,c)}if(T=(x&r.childLanes)!==0,wt||T){if(c=tt,c!==null){switch(x&-x){case 4:f=2;break;case 16:f=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:f=32;break;case 536870912:f=268435456;break;default:f=0}f=(f&(c.suspendedLanes|x))!==0?0:f,f!==0&&f!==g.retryLane&&(g.retryLane=f,pn(r,f),Jt(c,r,f,-1))}return Iu(),c=hu(Error(n(421))),Uo(r,s,x,c)}return f.data==="$?"?(s.flags|=128,s.child=r.child,s=xx.bind(null,r),f._reactRetry=s,null):(r=g.treeContext,Ct=An(f.nextSibling),jt=s,Ue=!0,Wt=null,r!==null&&(Dt[Lt++]=hn,Dt[Lt++]=fn,Dt[Lt++]=er,hn=r.id,fn=r.overflow,er=s),s=vu(s,c.children),s.flags|=4096,s)}function mp(r,s,a){r.lanes|=s;var c=r.alternate;c!==null&&(c.lanes|=s),Jl(r.return,s,a)}function wu(r,s,a,c,f){var g=r.memoizedState;g===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:c,tail:a,tailMode:f}:(g.isBackwards=s,g.rendering=null,g.renderingStartTime=0,g.last=c,g.tail=a,g.tailMode=f)}function gp(r,s,a){var c=s.pendingProps,f=c.revealOrder,g=c.tail;if(mt(r,s,c.children,a),c=$e.current,(c&2)!==0)c=c&1|2,s.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&mp(r,a,s);else if(r.tag===19)mp(r,a,s);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}c&=1}if(Ae($e,c),(s.mode&1)===0)s.memoizedState=null;else switch(f){case"forwards":for(a=s.child,f=null;a!==null;)r=a.alternate,r!==null&&Po(r)===null&&(f=a),a=a.sibling;a=f,a===null?(f=s.child,s.child=null):(f=a.sibling,a.sibling=null),wu(s,!1,f,a,g);break;case"backwards":for(a=null,f=s.child,s.child=null;f!==null;){if(r=f.alternate,r!==null&&Po(r)===null){s.child=f;break}r=f.sibling,f.sibling=a,a=f,f=r}wu(s,!0,a,null,g);break;case"together":wu(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function $o(r,s){(s.mode&1)===0&&r!==null&&(r.alternate=null,s.alternate=null,s.flags|=2)}function gn(r,s,a){if(r!==null&&(s.dependencies=r.dependencies),ir|=s.lanes,(a&s.childLanes)===0)return null;if(r!==null&&s.child!==r.child)throw Error(n(153));if(s.child!==null){for(r=s.child,a=Fn(r,r.pendingProps),s.child=a,a.return=s;r.sibling!==null;)r=r.sibling,a=a.sibling=Fn(r,r.pendingProps),a.return=s;a.sibling=null}return s.child}function lx(r,s,a){switch(s.tag){case 3:hp(s),Fr();break;case 5:Af(s);break;case 1:vt(s.type)&&bo(s);break;case 4:Xl(s,s.stateNode.containerInfo);break;case 10:var c=s.type._context,f=s.memoizedProps.value;Ae(jo,c._currentValue),c._currentValue=f;break;case 13:if(c=s.memoizedState,c!==null)return c.dehydrated!==null?(Ae($e,$e.current&1),s.flags|=128,null):(a&s.child.childLanes)!==0?pp(r,s,a):(Ae($e,$e.current&1),r=gn(r,s,a),r!==null?r.sibling:null);Ae($e,$e.current&1);break;case 19:if(c=(a&s.childLanes)!==0,(r.flags&128)!==0){if(c)return gp(r,s,a);s.flags|=128}if(f=s.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Ae($e,$e.current),c)break;return null;case 22:case 23:return s.lanes=0,up(r,s,a)}return gn(r,s,a)}var yp,xu,vp,wp;yp=function(r,s){for(var a=s.child;a!==null;){if(a.tag===5||a.tag===6)r.appendChild(a.stateNode);else if(a.tag!==4&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return;a=a.return}a.sibling.return=a.return,a=a.sibling}},xu=function(){},vp=function(r,s,a,c){var f=r.memoizedProps;if(f!==c){r=s.stateNode,rr(rn.current);var g=null;switch(a){case"input":f=Ja(r,f),c=Ja(r,c),g=[];break;case"select":f=K({},f,{value:void 0}),c=K({},c,{value:void 0}),g=[];break;case"textarea":f=Xa(r,f),c=Xa(r,c),g=[];break;default:typeof f.onClick!="function"&&typeof c.onClick=="function"&&(r.onclick=vo)}el(a,c);var x;a=null;for(L in f)if(!c.hasOwnProperty(L)&&f.hasOwnProperty(L)&&f[L]!=null)if(L==="style"){var T=f[L];for(x in T)T.hasOwnProperty(x)&&(a||(a={}),a[x]="")}else L!=="dangerouslySetInnerHTML"&&L!=="children"&&L!=="suppressContentEditableWarning"&&L!=="suppressHydrationWarning"&&L!=="autoFocus"&&(o.hasOwnProperty(L)?g||(g=[]):(g=g||[]).push(L,null));for(L in c){var C=c[L];if(T=f?.[L],c.hasOwnProperty(L)&&C!==T&&(C!=null||T!=null))if(L==="style")if(T){for(x in T)!T.hasOwnProperty(x)||C&&C.hasOwnProperty(x)||(a||(a={}),a[x]="");for(x in C)C.hasOwnProperty(x)&&T[x]!==C[x]&&(a||(a={}),a[x]=C[x])}else a||(g||(g=[]),g.push(L,a)),a=C;else L==="dangerouslySetInnerHTML"?(C=C?C.__html:void 0,T=T?T.__html:void 0,C!=null&&T!==C&&(g=g||[]).push(L,C)):L==="children"?typeof C!="string"&&typeof C!="number"||(g=g||[]).push(L,""+C):L!=="suppressContentEditableWarning"&&L!=="suppressHydrationWarning"&&(o.hasOwnProperty(L)?(C!=null&&L==="onScroll"&&Ie("scroll",r),g||T===C||(g=[])):(g=g||[]).push(L,C))}a&&(g=g||[]).push("style",a);var L=g;(s.updateQueue=L)&&(s.flags|=4)}},wp=function(r,s,a,c){a!==c&&(s.flags|=4)};function ni(r,s){if(!Ue)switch(r.tailMode){case"hidden":s=r.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?r.tail=null:a.sibling=null;break;case"collapsed":a=r.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:c.sibling=null}}function ct(r){var s=r.alternate!==null&&r.alternate.child===r.child,a=0,c=0;if(s)for(var f=r.child;f!==null;)a|=f.lanes|f.childLanes,c|=f.subtreeFlags&14680064,c|=f.flags&14680064,f.return=r,f=f.sibling;else for(f=r.child;f!==null;)a|=f.lanes|f.childLanes,c|=f.subtreeFlags,c|=f.flags,f.return=r,f=f.sibling;return r.subtreeFlags|=c,r.childLanes=a,s}function ux(r,s,a){var c=s.pendingProps;switch(Bl(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ct(s),null;case 1:return vt(s.type)&&xo(),ct(s),null;case 3:return c=s.stateNode,Wr(),De(yt),De(lt),tu(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(Eo(s)?s.flags|=4:r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Wt!==null&&(Pu(Wt),Wt=null))),xu(r,s),ct(s),null;case 5:Zl(s);var f=rr(Qs.current);if(a=s.type,r!==null&&s.stateNode!=null)vp(r,s,a,c,f),r.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!c){if(s.stateNode===null)throw Error(n(166));return ct(s),null}if(r=rr(rn.current),Eo(s)){c=s.stateNode,a=s.type;var g=s.memoizedProps;switch(c[nn]=s,c[Hs]=g,r=(s.mode&1)!==0,a){case"dialog":Ie("cancel",c),Ie("close",c);break;case"iframe":case"object":case"embed":Ie("load",c);break;case"video":case"audio":for(f=0;f<zs.length;f++)Ie(zs[f],c);break;case"source":Ie("error",c);break;case"img":case"image":case"link":Ie("error",c),Ie("load",c);break;case"details":Ie("toggle",c);break;case"input":Xd(c,g),Ie("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!g.multiple},Ie("invalid",c);break;case"textarea":th(c,g),Ie("invalid",c)}el(a,g),f=null;for(var x in g)if(g.hasOwnProperty(x)){var T=g[x];x==="children"?typeof T=="string"?c.textContent!==T&&(g.suppressHydrationWarning!==!0&&yo(c.textContent,T,r),f=["children",T]):typeof T=="number"&&c.textContent!==""+T&&(g.suppressHydrationWarning!==!0&&yo(c.textContent,T,r),f=["children",""+T]):o.hasOwnProperty(x)&&T!=null&&x==="onScroll"&&Ie("scroll",c)}switch(a){case"input":Ki(c),eh(c,g,!0);break;case"textarea":Ki(c),rh(c);break;case"select":case"option":break;default:typeof g.onClick=="function"&&(c.onclick=vo)}c=f,s.updateQueue=c,c!==null&&(s.flags|=4)}else{x=f.nodeType===9?f:f.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=sh(a)),r==="http://www.w3.org/1999/xhtml"?a==="script"?(r=x.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof c.is=="string"?r=x.createElement(a,{is:c.is}):(r=x.createElement(a),a==="select"&&(x=r,c.multiple?x.multiple=!0:c.size&&(x.size=c.size))):r=x.createElementNS(r,a),r[nn]=s,r[Hs]=c,yp(r,s,!1,!1),s.stateNode=r;e:{switch(x=tl(a,c),a){case"dialog":Ie("cancel",r),Ie("close",r),f=c;break;case"iframe":case"object":case"embed":Ie("load",r),f=c;break;case"video":case"audio":for(f=0;f<zs.length;f++)Ie(zs[f],r);f=c;break;case"source":Ie("error",r),f=c;break;case"img":case"image":case"link":Ie("error",r),Ie("load",r),f=c;break;case"details":Ie("toggle",r),f=c;break;case"input":Xd(r,c),f=Ja(r,c),Ie("invalid",r);break;case"option":f=c;break;case"select":r._wrapperState={wasMultiple:!!c.multiple},f=K({},c,{value:void 0}),Ie("invalid",r);break;case"textarea":th(r,c),f=Xa(r,c),Ie("invalid",r);break;default:f=c}el(a,f),T=f;for(g in T)if(T.hasOwnProperty(g)){var C=T[g];g==="style"?ah(r,C):g==="dangerouslySetInnerHTML"?(C=C?C.__html:void 0,C!=null&&ih(r,C)):g==="children"?typeof C=="string"?(a!=="textarea"||C!=="")&&ks(r,C):typeof C=="number"&&ks(r,""+C):g!=="suppressContentEditableWarning"&&g!=="suppressHydrationWarning"&&g!=="autoFocus"&&(o.hasOwnProperty(g)?C!=null&&g==="onScroll"&&Ie("scroll",r):C!=null&&P(r,g,C,x))}switch(a){case"input":Ki(r),eh(r,c,!1);break;case"textarea":Ki(r),rh(r);break;case"option":c.value!=null&&r.setAttribute("value",""+ke(c.value));break;case"select":r.multiple=!!c.multiple,g=c.value,g!=null?Tr(r,!!c.multiple,g,!1):c.defaultValue!=null&&Tr(r,!!c.multiple,c.defaultValue,!0);break;default:typeof f.onClick=="function"&&(r.onclick=vo)}switch(a){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return ct(s),null;case 6:if(r&&s.stateNode!=null)wp(r,s,r.memoizedProps,c);else{if(typeof c!="string"&&s.stateNode===null)throw Error(n(166));if(a=rr(Qs.current),rr(rn.current),Eo(s)){if(c=s.stateNode,a=s.memoizedProps,c[nn]=s,(g=c.nodeValue!==a)&&(r=jt,r!==null))switch(r.tag){case 3:yo(c.nodeValue,a,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&yo(c.nodeValue,a,(r.mode&1)!==0)}g&&(s.flags|=4)}else c=(a.nodeType===9?a:a.ownerDocument).createTextNode(c),c[nn]=s,s.stateNode=c}return ct(s),null;case 13:if(De($e),c=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(Ue&&Ct!==null&&(s.mode&1)!==0&&(s.flags&128)===0)_f(),Fr(),s.flags|=98560,g=!1;else if(g=Eo(s),c!==null&&c.dehydrated!==null){if(r===null){if(!g)throw Error(n(318));if(g=s.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(n(317));g[nn]=s}else Fr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;ct(s),g=!1}else Wt!==null&&(Pu(Wt),Wt=null),g=!0;if(!g)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=a,s):(c=c!==null,c!==(r!==null&&r.memoizedState!==null)&&c&&(s.child.flags|=8192,(s.mode&1)!==0&&(r===null||($e.current&1)!==0?Xe===0&&(Xe=3):Iu())),s.updateQueue!==null&&(s.flags|=4),ct(s),null);case 4:return Wr(),xu(r,s),r===null&&qs(s.stateNode.containerInfo),ct(s),null;case 10:return Gl(s.type._context),ct(s),null;case 17:return vt(s.type)&&xo(),ct(s),null;case 19:if(De($e),g=s.memoizedState,g===null)return ct(s),null;if(c=(s.flags&128)!==0,x=g.rendering,x===null)if(c)ni(g,!1);else{if(Xe!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(x=Po(r),x!==null){for(s.flags|=128,ni(g,!1),c=x.updateQueue,c!==null&&(s.updateQueue=c,s.flags|=4),s.subtreeFlags=0,c=a,a=s.child;a!==null;)g=a,r=c,g.flags&=14680066,x=g.alternate,x===null?(g.childLanes=0,g.lanes=r,g.child=null,g.subtreeFlags=0,g.memoizedProps=null,g.memoizedState=null,g.updateQueue=null,g.dependencies=null,g.stateNode=null):(g.childLanes=x.childLanes,g.lanes=x.lanes,g.child=x.child,g.subtreeFlags=0,g.deletions=null,g.memoizedProps=x.memoizedProps,g.memoizedState=x.memoizedState,g.updateQueue=x.updateQueue,g.type=x.type,r=x.dependencies,g.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),a=a.sibling;return Ae($e,$e.current&1|2),s.child}r=r.sibling}g.tail!==null&&He()>Jr&&(s.flags|=128,c=!0,ni(g,!1),s.lanes=4194304)}else{if(!c)if(r=Po(x),r!==null){if(s.flags|=128,c=!0,a=r.updateQueue,a!==null&&(s.updateQueue=a,s.flags|=4),ni(g,!0),g.tail===null&&g.tailMode==="hidden"&&!x.alternate&&!Ue)return ct(s),null}else 2*He()-g.renderingStartTime>Jr&&a!==1073741824&&(s.flags|=128,c=!0,ni(g,!1),s.lanes=4194304);g.isBackwards?(x.sibling=s.child,s.child=x):(a=g.last,a!==null?a.sibling=x:s.child=x,g.last=x)}return g.tail!==null?(s=g.tail,g.rendering=s,g.tail=s.sibling,g.renderingStartTime=He(),s.sibling=null,a=$e.current,Ae($e,c?a&1|2:a&1),s):(ct(s),null);case 22:case 23:return Ou(),c=s.memoizedState!==null,r!==null&&r.memoizedState!==null!==c&&(s.flags|=8192),c&&(s.mode&1)!==0?(Nt&1073741824)!==0&&(ct(s),s.subtreeFlags&6&&(s.flags|=8192)):ct(s),null;case 24:return null;case 25:return null}throw Error(n(156,s.tag))}function cx(r,s){switch(Bl(s),s.tag){case 1:return vt(s.type)&&xo(),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return Wr(),De(yt),De(lt),tu(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 5:return Zl(s),null;case 13:if(De($e),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(n(340));Fr()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return De($e),null;case 4:return Wr(),null;case 10:return Gl(s.type._context),null;case 22:case 23:return Ou(),null;case 24:return null;default:return null}}var Vo=!1,dt=!1,dx=typeof WeakSet=="function"?WeakSet:Set,X=null;function Kr(r,s){var a=r.ref;if(a!==null)if(typeof a=="function")try{a(null)}catch(c){ze(r,s,c)}else a.current=null}function bu(r,s,a){try{a()}catch(c){ze(r,s,c)}}var xp=!1;function hx(r,s){if(Ol=io,r=Qh(),El(r)){if("selectionStart"in r)var a={start:r.selectionStart,end:r.selectionEnd};else e:{a=(a=r.ownerDocument)&&a.defaultView||window;var c=a.getSelection&&a.getSelection();if(c&&c.rangeCount!==0){a=c.anchorNode;var f=c.anchorOffset,g=c.focusNode;c=c.focusOffset;try{a.nodeType,g.nodeType}catch{a=null;break e}var x=0,T=-1,C=-1,L=0,W=0,H=r,q=null;t:for(;;){for(var Q;H!==a||f!==0&&H.nodeType!==3||(T=x+f),H!==g||c!==0&&H.nodeType!==3||(C=x+c),H.nodeType===3&&(x+=H.nodeValue.length),(Q=H.firstChild)!==null;)q=H,H=Q;for(;;){if(H===r)break t;if(q===a&&++L===f&&(T=x),q===g&&++W===c&&(C=x),(Q=H.nextSibling)!==null)break;H=q,q=H.parentNode}H=Q}a=T===-1||C===-1?null:{start:T,end:C}}else a=null}a=a||{start:0,end:0}}else a=null;for(Il={focusedElem:r,selectionRange:a},io=!1,X=s;X!==null;)if(s=X,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,X=r;else for(;X!==null;){s=X;try{var Z=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Z!==null){var ee=Z.memoizedProps,Ke=Z.memoizedState,O=s.stateNode,N=O.getSnapshotBeforeUpdate(s.elementType===s.type?ee:Ht(s.type,ee),Ke);O.__reactInternalSnapshotBeforeUpdate=N}break;case 3:var I=s.stateNode.containerInfo;I.nodeType===1?I.textContent="":I.nodeType===9&&I.documentElement&&I.removeChild(I.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(G){ze(s,s.return,G)}if(r=s.sibling,r!==null){r.return=s.return,X=r;break}X=s.return}return Z=xp,xp=!1,Z}function ri(r,s,a){var c=s.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var f=c=c.next;do{if((f.tag&r)===r){var g=f.destroy;f.destroy=void 0,g!==void 0&&bu(s,a,g)}f=f.next}while(f!==c)}}function Fo(r,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var a=s=s.next;do{if((a.tag&r)===r){var c=a.create;a.destroy=c()}a=a.next}while(a!==s)}}function _u(r){var s=r.ref;if(s!==null){var a=r.stateNode;r.tag,r=a,typeof s=="function"?s(r):s.current=r}}function bp(r){var s=r.alternate;s!==null&&(r.alternate=null,bp(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&(delete s[nn],delete s[Hs],delete s[Ul],delete s[Gw],delete s[Jw])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function _p(r){return r.tag===5||r.tag===3||r.tag===4}function Sp(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||_p(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Su(r,s,a){var c=r.tag;if(c===5||c===6)r=r.stateNode,s?a.nodeType===8?a.parentNode.insertBefore(r,s):a.insertBefore(r,s):(a.nodeType===8?(s=a.parentNode,s.insertBefore(r,a)):(s=a,s.appendChild(r)),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=vo));else if(c!==4&&(r=r.child,r!==null))for(Su(r,s,a),r=r.sibling;r!==null;)Su(r,s,a),r=r.sibling}function ku(r,s,a){var c=r.tag;if(c===5||c===6)r=r.stateNode,s?a.insertBefore(r,s):a.appendChild(r);else if(c!==4&&(r=r.child,r!==null))for(ku(r,s,a),r=r.sibling;r!==null;)ku(r,s,a),r=r.sibling}var rt=null,Kt=!1;function Ln(r,s,a){for(a=a.child;a!==null;)kp(r,s,a),a=a.sibling}function kp(r,s,a){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount(Zi,a)}catch{}switch(a.tag){case 5:dt||Kr(a,s);case 6:var c=rt,f=Kt;rt=null,Ln(r,s,a),rt=c,Kt=f,rt!==null&&(Kt?(r=rt,a=a.stateNode,r.nodeType===8?r.parentNode.removeChild(a):r.removeChild(a)):rt.removeChild(a.stateNode));break;case 18:rt!==null&&(Kt?(r=rt,a=a.stateNode,r.nodeType===8?Ml(r.parentNode,a):r.nodeType===1&&Ml(r,a),Ds(r)):Ml(rt,a.stateNode));break;case 4:c=rt,f=Kt,rt=a.stateNode.containerInfo,Kt=!0,Ln(r,s,a),rt=c,Kt=f;break;case 0:case 11:case 14:case 15:if(!dt&&(c=a.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){f=c=c.next;do{var g=f,x=g.destroy;g=g.tag,x!==void 0&&((g&2)!==0||(g&4)!==0)&&bu(a,s,x),f=f.next}while(f!==c)}Ln(r,s,a);break;case 1:if(!dt&&(Kr(a,s),c=a.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=a.memoizedProps,c.state=a.memoizedState,c.componentWillUnmount()}catch(T){ze(a,s,T)}Ln(r,s,a);break;case 21:Ln(r,s,a);break;case 22:a.mode&1?(dt=(c=dt)||a.memoizedState!==null,Ln(r,s,a),dt=c):Ln(r,s,a);break;default:Ln(r,s,a)}}function Ep(r){var s=r.updateQueue;if(s!==null){r.updateQueue=null;var a=r.stateNode;a===null&&(a=r.stateNode=new dx),s.forEach(function(c){var f=bx.bind(null,r,c);a.has(c)||(a.add(c),c.then(f,f))})}}function Gt(r,s){var a=s.deletions;if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];try{var g=r,x=s,T=x;e:for(;T!==null;){switch(T.tag){case 5:rt=T.stateNode,Kt=!1;break e;case 3:rt=T.stateNode.containerInfo,Kt=!0;break e;case 4:rt=T.stateNode.containerInfo,Kt=!0;break e}T=T.return}if(rt===null)throw Error(n(160));kp(g,x,f),rt=null,Kt=!1;var C=f.alternate;C!==null&&(C.return=null),f.return=null}catch(L){ze(f,s,L)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Tp(s,r),s=s.sibling}function Tp(r,s){var a=r.alternate,c=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(Gt(s,r),on(r),c&4){try{ri(3,r,r.return),Fo(3,r)}catch(ee){ze(r,r.return,ee)}try{ri(5,r,r.return)}catch(ee){ze(r,r.return,ee)}}break;case 1:Gt(s,r),on(r),c&512&&a!==null&&Kr(a,a.return);break;case 5:if(Gt(s,r),on(r),c&512&&a!==null&&Kr(a,a.return),r.flags&32){var f=r.stateNode;try{ks(f,"")}catch(ee){ze(r,r.return,ee)}}if(c&4&&(f=r.stateNode,f!=null)){var g=r.memoizedProps,x=a!==null?a.memoizedProps:g,T=r.type,C=r.updateQueue;if(r.updateQueue=null,C!==null)try{T==="input"&&g.type==="radio"&&g.name!=null&&Zd(f,g),tl(T,x);var L=tl(T,g);for(x=0;x<C.length;x+=2){var W=C[x],H=C[x+1];W==="style"?ah(f,H):W==="dangerouslySetInnerHTML"?ih(f,H):W==="children"?ks(f,H):P(f,W,H,L)}switch(T){case"input":Ya(f,g);break;case"textarea":nh(f,g);break;case"select":var q=f._wrapperState.wasMultiple;f._wrapperState.wasMultiple=!!g.multiple;var Q=g.value;Q!=null?Tr(f,!!g.multiple,Q,!1):q!==!!g.multiple&&(g.defaultValue!=null?Tr(f,!!g.multiple,g.defaultValue,!0):Tr(f,!!g.multiple,g.multiple?[]:"",!1))}f[Hs]=g}catch(ee){ze(r,r.return,ee)}}break;case 6:if(Gt(s,r),on(r),c&4){if(r.stateNode===null)throw Error(n(162));f=r.stateNode,g=r.memoizedProps;try{f.nodeValue=g}catch(ee){ze(r,r.return,ee)}}break;case 3:if(Gt(s,r),on(r),c&4&&a!==null&&a.memoizedState.isDehydrated)try{Ds(s.containerInfo)}catch(ee){ze(r,r.return,ee)}break;case 4:Gt(s,r),on(r);break;case 13:Gt(s,r),on(r),f=r.child,f.flags&8192&&(g=f.memoizedState!==null,f.stateNode.isHidden=g,!g||f.alternate!==null&&f.alternate.memoizedState!==null||(ju=He())),c&4&&Ep(r);break;case 22:if(W=a!==null&&a.memoizedState!==null,r.mode&1?(dt=(L=dt)||W,Gt(s,r),dt=L):Gt(s,r),on(r),c&8192){if(L=r.memoizedState!==null,(r.stateNode.isHidden=L)&&!W&&(r.mode&1)!==0)for(X=r,W=r.child;W!==null;){for(H=X=W;X!==null;){switch(q=X,Q=q.child,q.tag){case 0:case 11:case 14:case 15:ri(4,q,q.return);break;case 1:Kr(q,q.return);var Z=q.stateNode;if(typeof Z.componentWillUnmount=="function"){c=q,a=q.return;try{s=c,Z.props=s.memoizedProps,Z.state=s.memoizedState,Z.componentWillUnmount()}catch(ee){ze(c,a,ee)}}break;case 5:Kr(q,q.return);break;case 22:if(q.memoizedState!==null){Np(H);continue}}Q!==null?(Q.return=q,X=Q):Np(H)}W=W.sibling}e:for(W=null,H=r;;){if(H.tag===5){if(W===null){W=H;try{f=H.stateNode,L?(g=f.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none"):(T=H.stateNode,C=H.memoizedProps.style,x=C!=null&&C.hasOwnProperty("display")?C.display:null,T.style.display=oh("display",x))}catch(ee){ze(r,r.return,ee)}}}else if(H.tag===6){if(W===null)try{H.stateNode.nodeValue=L?"":H.memoizedProps}catch(ee){ze(r,r.return,ee)}}else if((H.tag!==22&&H.tag!==23||H.memoizedState===null||H===r)&&H.child!==null){H.child.return=H,H=H.child;continue}if(H===r)break e;for(;H.sibling===null;){if(H.return===null||H.return===r)break e;W===H&&(W=null),H=H.return}W===H&&(W=null),H.sibling.return=H.return,H=H.sibling}}break;case 19:Gt(s,r),on(r),c&4&&Ep(r);break;case 21:break;default:Gt(s,r),on(r)}}function on(r){var s=r.flags;if(s&2){try{e:{for(var a=r.return;a!==null;){if(_p(a)){var c=a;break e}a=a.return}throw Error(n(160))}switch(c.tag){case 5:var f=c.stateNode;c.flags&32&&(ks(f,""),c.flags&=-33);var g=Sp(r);ku(r,g,f);break;case 3:case 4:var x=c.stateNode.containerInfo,T=Sp(r);Su(r,T,x);break;default:throw Error(n(161))}}catch(C){ze(r,r.return,C)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function fx(r,s,a){X=r,jp(r)}function jp(r,s,a){for(var c=(r.mode&1)!==0;X!==null;){var f=X,g=f.child;if(f.tag===22&&c){var x=f.memoizedState!==null||Vo;if(!x){var T=f.alternate,C=T!==null&&T.memoizedState!==null||dt;T=Vo;var L=dt;if(Vo=x,(dt=C)&&!L)for(X=f;X!==null;)x=X,C=x.child,x.tag===22&&x.memoizedState!==null?Ap(f):C!==null?(C.return=x,X=C):Ap(f);for(;g!==null;)X=g,jp(g),g=g.sibling;X=f,Vo=T,dt=L}Cp(r)}else(f.subtreeFlags&8772)!==0&&g!==null?(g.return=f,X=g):Cp(r)}}function Cp(r){for(;X!==null;){var s=X;if((s.flags&8772)!==0){var a=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:dt||Fo(5,s);break;case 1:var c=s.stateNode;if(s.flags&4&&!dt)if(a===null)c.componentDidMount();else{var f=s.elementType===s.type?a.memoizedProps:Ht(s.type,a.memoizedProps);c.componentDidUpdate(f,a.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var g=s.updateQueue;g!==null&&Nf(s,g,c);break;case 3:var x=s.updateQueue;if(x!==null){if(a=null,s.child!==null)switch(s.child.tag){case 5:a=s.child.stateNode;break;case 1:a=s.child.stateNode}Nf(s,x,a)}break;case 5:var T=s.stateNode;if(a===null&&s.flags&4){a=T;var C=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":C.autoFocus&&a.focus();break;case"img":C.src&&(a.src=C.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var L=s.alternate;if(L!==null){var W=L.memoizedState;if(W!==null){var H=W.dehydrated;H!==null&&Ds(H)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}dt||s.flags&512&&_u(s)}catch(q){ze(s,s.return,q)}}if(s===r){X=null;break}if(a=s.sibling,a!==null){a.return=s.return,X=a;break}X=s.return}}function Np(r){for(;X!==null;){var s=X;if(s===r){X=null;break}var a=s.sibling;if(a!==null){a.return=s.return,X=a;break}X=s.return}}function Ap(r){for(;X!==null;){var s=X;try{switch(s.tag){case 0:case 11:case 15:var a=s.return;try{Fo(4,s)}catch(C){ze(s,a,C)}break;case 1:var c=s.stateNode;if(typeof c.componentDidMount=="function"){var f=s.return;try{c.componentDidMount()}catch(C){ze(s,f,C)}}var g=s.return;try{_u(s)}catch(C){ze(s,g,C)}break;case 5:var x=s.return;try{_u(s)}catch(C){ze(s,x,C)}}}catch(C){ze(s,s.return,C)}if(s===r){X=null;break}var T=s.sibling;if(T!==null){T.return=s.return,X=T;break}X=s.return}}var px=Math.ceil,Bo=U.ReactCurrentDispatcher,Eu=U.ReactCurrentOwner,$t=U.ReactCurrentBatchConfig,_e=0,tt=null,Je=null,st=0,Nt=0,Gr=Pn(0),Xe=0,si=null,ir=0,zo=0,Tu=0,ii=null,xt=null,ju=0,Jr=1/0,yn=null,qo=!1,Cu=null,Mn=null,Wo=!1,Un=null,Ho=0,oi=0,Nu=null,Ko=-1,Go=0;function gt(){return(_e&6)!==0?He():Ko!==-1?Ko:Ko=He()}function $n(r){return(r.mode&1)===0?1:(_e&2)!==0&&st!==0?st&-st:Qw.transition!==null?(Go===0&&(Go=_h()),Go):(r=Ce,r!==0||(r=window.event,r=r===void 0?16:Ph(r.type)),r)}function Jt(r,s,a,c){if(50<oi)throw oi=0,Nu=null,Error(n(185));As(r,a,c),((_e&2)===0||r!==tt)&&(r===tt&&((_e&2)===0&&(zo|=a),Xe===4&&Vn(r,st)),bt(r,c),a===1&&_e===0&&(s.mode&1)===0&&(Jr=He()+500,_o&&On()))}function bt(r,s){var a=r.callbackNode;Q0(r,s);var c=no(r,r===tt?st:0);if(c===0)a!==null&&wh(a),r.callbackNode=null,r.callbackPriority=0;else if(s=c&-c,r.callbackPriority!==s){if(a!=null&&wh(a),s===1)r.tag===0?Yw(Rp.bind(null,r)):yf(Rp.bind(null,r)),Hw(function(){(_e&6)===0&&On()}),a=null;else{switch(Sh(c)){case 1:a=ll;break;case 4:a=xh;break;case 16:a=Xi;break;case 536870912:a=bh;break;default:a=Xi}a=Vp(a,Pp.bind(null,r))}r.callbackPriority=s,r.callbackNode=a}}function Pp(r,s){if(Ko=-1,Go=0,(_e&6)!==0)throw Error(n(327));var a=r.callbackNode;if(Yr()&&r.callbackNode!==a)return null;var c=no(r,r===tt?st:0);if(c===0)return null;if((c&30)!==0||(c&r.expiredLanes)!==0||s)s=Jo(r,c);else{s=c;var f=_e;_e|=2;var g=Ip();(tt!==r||st!==s)&&(yn=null,Jr=He()+500,ar(r,s));do try{yx();break}catch(T){Op(r,T)}while(!0);Kl(),Bo.current=g,_e=f,Je!==null?s=0:(tt=null,st=0,s=Xe)}if(s!==0){if(s===2&&(f=ul(r),f!==0&&(c=f,s=Au(r,f))),s===1)throw a=si,ar(r,0),Vn(r,c),bt(r,He()),a;if(s===6)Vn(r,c);else{if(f=r.current.alternate,(c&30)===0&&!mx(f)&&(s=Jo(r,c),s===2&&(g=ul(r),g!==0&&(c=g,s=Au(r,g))),s===1))throw a=si,ar(r,0),Vn(r,c),bt(r,He()),a;switch(r.finishedWork=f,r.finishedLanes=c,s){case 0:case 1:throw Error(n(345));case 2:lr(r,xt,yn);break;case 3:if(Vn(r,c),(c&130023424)===c&&(s=ju+500-He(),10<s)){if(no(r,0)!==0)break;if(f=r.suspendedLanes,(f&c)!==c){gt(),r.pingedLanes|=r.suspendedLanes&f;break}r.timeoutHandle=Ll(lr.bind(null,r,xt,yn),s);break}lr(r,xt,yn);break;case 4:if(Vn(r,c),(c&4194240)===c)break;for(s=r.eventTimes,f=-1;0<c;){var x=31-zt(c);g=1<<x,x=s[x],x>f&&(f=x),c&=~g}if(c=f,c=He()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*px(c/1960))-c,10<c){r.timeoutHandle=Ll(lr.bind(null,r,xt,yn),c);break}lr(r,xt,yn);break;case 5:lr(r,xt,yn);break;default:throw Error(n(329))}}}return bt(r,He()),r.callbackNode===a?Pp.bind(null,r):null}function Au(r,s){var a=ii;return r.current.memoizedState.isDehydrated&&(ar(r,s).flags|=256),r=Jo(r,s),r!==2&&(s=xt,xt=a,s!==null&&Pu(s)),r}function Pu(r){xt===null?xt=r:xt.push.apply(xt,r)}function mx(r){for(var s=r;;){if(s.flags&16384){var a=s.updateQueue;if(a!==null&&(a=a.stores,a!==null))for(var c=0;c<a.length;c++){var f=a[c],g=f.getSnapshot;f=f.value;try{if(!qt(g(),f))return!1}catch{return!1}}}if(a=s.child,s.subtreeFlags&16384&&a!==null)a.return=s,s=a;else{if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Vn(r,s){for(s&=~Tu,s&=~zo,r.suspendedLanes|=s,r.pingedLanes&=~s,r=r.expirationTimes;0<s;){var a=31-zt(s),c=1<<a;r[a]=-1,s&=~c}}function Rp(r){if((_e&6)!==0)throw Error(n(327));Yr();var s=no(r,0);if((s&1)===0)return bt(r,He()),null;var a=Jo(r,s);if(r.tag!==0&&a===2){var c=ul(r);c!==0&&(s=c,a=Au(r,c))}if(a===1)throw a=si,ar(r,0),Vn(r,s),bt(r,He()),a;if(a===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=s,lr(r,xt,yn),bt(r,He()),null}function Ru(r,s){var a=_e;_e|=1;try{return r(s)}finally{_e=a,_e===0&&(Jr=He()+500,_o&&On())}}function or(r){Un!==null&&Un.tag===0&&(_e&6)===0&&Yr();var s=_e;_e|=1;var a=$t.transition,c=Ce;try{if($t.transition=null,Ce=1,r)return r()}finally{Ce=c,$t.transition=a,_e=s,(_e&6)===0&&On()}}function Ou(){Nt=Gr.current,De(Gr)}function ar(r,s){r.finishedWork=null,r.finishedLanes=0;var a=r.timeoutHandle;if(a!==-1&&(r.timeoutHandle=-1,Ww(a)),Je!==null)for(a=Je.return;a!==null;){var c=a;switch(Bl(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&xo();break;case 3:Wr(),De(yt),De(lt),tu();break;case 5:Zl(c);break;case 4:Wr();break;case 13:De($e);break;case 19:De($e);break;case 10:Gl(c.type._context);break;case 22:case 23:Ou()}a=a.return}if(tt=r,Je=r=Fn(r.current,null),st=Nt=s,Xe=0,si=null,Tu=zo=ir=0,xt=ii=null,nr!==null){for(s=0;s<nr.length;s++)if(a=nr[s],c=a.interleaved,c!==null){a.interleaved=null;var f=c.next,g=a.pending;if(g!==null){var x=g.next;g.next=f,c.next=x}a.pending=c}nr=null}return r}function Op(r,s){do{var a=Je;try{if(Kl(),Ro.current=Lo,Oo){for(var c=Ve.memoizedState;c!==null;){var f=c.queue;f!==null&&(f.pending=null),c=c.next}Oo=!1}if(sr=0,et=Qe=Ve=null,Xs=!1,Zs=0,Eu.current=null,a===null||a.return===null){Xe=1,si=s,Je=null;break}e:{var g=r,x=a.return,T=a,C=s;if(s=st,T.flags|=32768,C!==null&&typeof C=="object"&&typeof C.then=="function"){var L=C,W=T,H=W.tag;if((W.mode&1)===0&&(H===0||H===11||H===15)){var q=W.alternate;q?(W.updateQueue=q.updateQueue,W.memoizedState=q.memoizedState,W.lanes=q.lanes):(W.updateQueue=null,W.memoizedState=null)}var Q=sp(x);if(Q!==null){Q.flags&=-257,ip(Q,x,T,g,s),Q.mode&1&&rp(g,L,s),s=Q,C=L;var Z=s.updateQueue;if(Z===null){var ee=new Set;ee.add(C),s.updateQueue=ee}else Z.add(C);break e}else{if((s&1)===0){rp(g,L,s),Iu();break e}C=Error(n(426))}}else if(Ue&&T.mode&1){var Ke=sp(x);if(Ke!==null){(Ke.flags&65536)===0&&(Ke.flags|=256),ip(Ke,x,T,g,s),Wl(Hr(C,T));break e}}g=C=Hr(C,T),Xe!==4&&(Xe=2),ii===null?ii=[g]:ii.push(g),g=x;do{switch(g.tag){case 3:g.flags|=65536,s&=-s,g.lanes|=s;var O=tp(g,C,s);Cf(g,O);break e;case 1:T=C;var N=g.type,I=g.stateNode;if((g.flags&128)===0&&(typeof N.getDerivedStateFromError=="function"||I!==null&&typeof I.componentDidCatch=="function"&&(Mn===null||!Mn.has(I)))){g.flags|=65536,s&=-s,g.lanes|=s;var G=np(g,T,s);Cf(g,G);break e}}g=g.return}while(g!==null)}Lp(a)}catch(te){s=te,Je===a&&a!==null&&(Je=a=a.return);continue}break}while(!0)}function Ip(){var r=Bo.current;return Bo.current=Lo,r===null?Lo:r}function Iu(){(Xe===0||Xe===3||Xe===2)&&(Xe=4),tt===null||(ir&268435455)===0&&(zo&268435455)===0||Vn(tt,st)}function Jo(r,s){var a=_e;_e|=2;var c=Ip();(tt!==r||st!==s)&&(yn=null,ar(r,s));do try{gx();break}catch(f){Op(r,f)}while(!0);if(Kl(),_e=a,Bo.current=c,Je!==null)throw Error(n(261));return tt=null,st=0,Xe}function gx(){for(;Je!==null;)Dp(Je)}function yx(){for(;Je!==null&&!B0();)Dp(Je)}function Dp(r){var s=$p(r.alternate,r,Nt);r.memoizedProps=r.pendingProps,s===null?Lp(r):Je=s,Eu.current=null}function Lp(r){var s=r;do{var a=s.alternate;if(r=s.return,(s.flags&32768)===0){if(a=ux(a,s,Nt),a!==null){Je=a;return}}else{if(a=cx(a,s),a!==null){a.flags&=32767,Je=a;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Xe=6,Je=null;return}}if(s=s.sibling,s!==null){Je=s;return}Je=s=r}while(s!==null);Xe===0&&(Xe=5)}function lr(r,s,a){var c=Ce,f=$t.transition;try{$t.transition=null,Ce=1,vx(r,s,a,c)}finally{$t.transition=f,Ce=c}return null}function vx(r,s,a,c){do Yr();while(Un!==null);if((_e&6)!==0)throw Error(n(327));a=r.finishedWork;var f=r.finishedLanes;if(a===null)return null;if(r.finishedWork=null,r.finishedLanes=0,a===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var g=a.lanes|a.childLanes;if(X0(r,g),r===tt&&(Je=tt=null,st=0),(a.subtreeFlags&2064)===0&&(a.flags&2064)===0||Wo||(Wo=!0,Vp(Xi,function(){return Yr(),null})),g=(a.flags&15990)!==0,(a.subtreeFlags&15990)!==0||g){g=$t.transition,$t.transition=null;var x=Ce;Ce=1;var T=_e;_e|=4,Eu.current=null,hx(r,a),Tp(a,r),Uw(Il),io=!!Ol,Il=Ol=null,r.current=a,fx(a),z0(),_e=T,Ce=x,$t.transition=g}else r.current=a;if(Wo&&(Wo=!1,Un=r,Ho=f),g=r.pendingLanes,g===0&&(Mn=null),H0(a.stateNode),bt(r,He()),s!==null)for(c=r.onRecoverableError,a=0;a<s.length;a++)f=s[a],c(f.value,{componentStack:f.stack,digest:f.digest});if(qo)throw qo=!1,r=Cu,Cu=null,r;return(Ho&1)!==0&&r.tag!==0&&Yr(),g=r.pendingLanes,(g&1)!==0?r===Nu?oi++:(oi=0,Nu=r):oi=0,On(),null}function Yr(){if(Un!==null){var r=Sh(Ho),s=$t.transition,a=Ce;try{if($t.transition=null,Ce=16>r?16:r,Un===null)var c=!1;else{if(r=Un,Un=null,Ho=0,(_e&6)!==0)throw Error(n(331));var f=_e;for(_e|=4,X=r.current;X!==null;){var g=X,x=g.child;if((X.flags&16)!==0){var T=g.deletions;if(T!==null){for(var C=0;C<T.length;C++){var L=T[C];for(X=L;X!==null;){var W=X;switch(W.tag){case 0:case 11:case 15:ri(8,W,g)}var H=W.child;if(H!==null)H.return=W,X=H;else for(;X!==null;){W=X;var q=W.sibling,Q=W.return;if(bp(W),W===L){X=null;break}if(q!==null){q.return=Q,X=q;break}X=Q}}}var Z=g.alternate;if(Z!==null){var ee=Z.child;if(ee!==null){Z.child=null;do{var Ke=ee.sibling;ee.sibling=null,ee=Ke}while(ee!==null)}}X=g}}if((g.subtreeFlags&2064)!==0&&x!==null)x.return=g,X=x;else e:for(;X!==null;){if(g=X,(g.flags&2048)!==0)switch(g.tag){case 0:case 11:case 15:ri(9,g,g.return)}var O=g.sibling;if(O!==null){O.return=g.return,X=O;break e}X=g.return}}var N=r.current;for(X=N;X!==null;){x=X;var I=x.child;if((x.subtreeFlags&2064)!==0&&I!==null)I.return=x,X=I;else e:for(x=N;X!==null;){if(T=X,(T.flags&2048)!==0)try{switch(T.tag){case 0:case 11:case 15:Fo(9,T)}}catch(te){ze(T,T.return,te)}if(T===x){X=null;break e}var G=T.sibling;if(G!==null){G.return=T.return,X=G;break e}X=T.return}}if(_e=f,On(),tn&&typeof tn.onPostCommitFiberRoot=="function")try{tn.onPostCommitFiberRoot(Zi,r)}catch{}c=!0}return c}finally{Ce=a,$t.transition=s}}return!1}function Mp(r,s,a){s=Hr(a,s),s=tp(r,s,1),r=Dn(r,s,1),s=gt(),r!==null&&(As(r,1,s),bt(r,s))}function ze(r,s,a){if(r.tag===3)Mp(r,r,a);else for(;s!==null;){if(s.tag===3){Mp(s,r,a);break}else if(s.tag===1){var c=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Mn===null||!Mn.has(c))){r=Hr(a,r),r=np(s,r,1),s=Dn(s,r,1),r=gt(),s!==null&&(As(s,1,r),bt(s,r));break}}s=s.return}}function wx(r,s,a){var c=r.pingCache;c!==null&&c.delete(s),s=gt(),r.pingedLanes|=r.suspendedLanes&a,tt===r&&(st&a)===a&&(Xe===4||Xe===3&&(st&130023424)===st&&500>He()-ju?ar(r,0):Tu|=a),bt(r,s)}function Up(r,s){s===0&&((r.mode&1)===0?s=1:(s=to,to<<=1,(to&130023424)===0&&(to=4194304)));var a=gt();r=pn(r,s),r!==null&&(As(r,s,a),bt(r,a))}function xx(r){var s=r.memoizedState,a=0;s!==null&&(a=s.retryLane),Up(r,a)}function bx(r,s){var a=0;switch(r.tag){case 13:var c=r.stateNode,f=r.memoizedState;f!==null&&(a=f.retryLane);break;case 19:c=r.stateNode;break;default:throw Error(n(314))}c!==null&&c.delete(s),Up(r,a)}var $p;$p=function(r,s,a){if(r!==null)if(r.memoizedProps!==s.pendingProps||yt.current)wt=!0;else{if((r.lanes&a)===0&&(s.flags&128)===0)return wt=!1,lx(r,s,a);wt=(r.flags&131072)!==0}else wt=!1,Ue&&(s.flags&1048576)!==0&&vf(s,ko,s.index);switch(s.lanes=0,s.tag){case 2:var c=s.type;$o(r,s),r=s.pendingProps;var f=Ur(s,lt.current);qr(s,a),f=su(null,s,c,r,f,a);var g=iu();return s.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,vt(c)?(g=!0,bo(s)):g=!1,s.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Ql(s),f.updater=Mo,s.stateNode=f,f._reactInternals=s,du(s,c,r,a),s=mu(null,s,c,!0,g,a)):(s.tag=0,Ue&&g&&Fl(s),mt(null,s,f,a),s=s.child),s;case 16:c=s.elementType;e:{switch($o(r,s),r=s.pendingProps,f=c._init,c=f(c._payload),s.type=c,f=s.tag=Sx(c),r=Ht(c,r),f){case 0:s=pu(null,s,c,r,a);break e;case 1:s=dp(null,s,c,r,a);break e;case 11:s=op(null,s,c,r,a);break e;case 14:s=ap(null,s,c,Ht(c.type,r),a);break e}throw Error(n(306,c,""))}return s;case 0:return c=s.type,f=s.pendingProps,f=s.elementType===c?f:Ht(c,f),pu(r,s,c,f,a);case 1:return c=s.type,f=s.pendingProps,f=s.elementType===c?f:Ht(c,f),dp(r,s,c,f,a);case 3:e:{if(hp(s),r===null)throw Error(n(387));c=s.pendingProps,g=s.memoizedState,f=g.element,jf(r,s),Ao(s,c,null,a);var x=s.memoizedState;if(c=x.element,g.isDehydrated)if(g={element:c,isDehydrated:!1,cache:x.cache,pendingSuspenseBoundaries:x.pendingSuspenseBoundaries,transitions:x.transitions},s.updateQueue.baseState=g,s.memoizedState=g,s.flags&256){f=Hr(Error(n(423)),s),s=fp(r,s,c,a,f);break e}else if(c!==f){f=Hr(Error(n(424)),s),s=fp(r,s,c,a,f);break e}else for(Ct=An(s.stateNode.containerInfo.firstChild),jt=s,Ue=!0,Wt=null,a=Ef(s,null,c,a),s.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Fr(),c===f){s=gn(r,s,a);break e}mt(r,s,c,a)}s=s.child}return s;case 5:return Af(s),r===null&&ql(s),c=s.type,f=s.pendingProps,g=r!==null?r.memoizedProps:null,x=f.children,Dl(c,f)?x=null:g!==null&&Dl(c,g)&&(s.flags|=32),cp(r,s),mt(r,s,x,a),s.child;case 6:return r===null&&ql(s),null;case 13:return pp(r,s,a);case 4:return Xl(s,s.stateNode.containerInfo),c=s.pendingProps,r===null?s.child=Br(s,null,c,a):mt(r,s,c,a),s.child;case 11:return c=s.type,f=s.pendingProps,f=s.elementType===c?f:Ht(c,f),op(r,s,c,f,a);case 7:return mt(r,s,s.pendingProps,a),s.child;case 8:return mt(r,s,s.pendingProps.children,a),s.child;case 12:return mt(r,s,s.pendingProps.children,a),s.child;case 10:e:{if(c=s.type._context,f=s.pendingProps,g=s.memoizedProps,x=f.value,Ae(jo,c._currentValue),c._currentValue=x,g!==null)if(qt(g.value,x)){if(g.children===f.children&&!yt.current){s=gn(r,s,a);break e}}else for(g=s.child,g!==null&&(g.return=s);g!==null;){var T=g.dependencies;if(T!==null){x=g.child;for(var C=T.firstContext;C!==null;){if(C.context===c){if(g.tag===1){C=mn(-1,a&-a),C.tag=2;var L=g.updateQueue;if(L!==null){L=L.shared;var W=L.pending;W===null?C.next=C:(C.next=W.next,W.next=C),L.pending=C}}g.lanes|=a,C=g.alternate,C!==null&&(C.lanes|=a),Jl(g.return,a,s),T.lanes|=a;break}C=C.next}}else if(g.tag===10)x=g.type===s.type?null:g.child;else if(g.tag===18){if(x=g.return,x===null)throw Error(n(341));x.lanes|=a,T=x.alternate,T!==null&&(T.lanes|=a),Jl(x,a,s),x=g.sibling}else x=g.child;if(x!==null)x.return=g;else for(x=g;x!==null;){if(x===s){x=null;break}if(g=x.sibling,g!==null){g.return=x.return,x=g;break}x=x.return}g=x}mt(r,s,f.children,a),s=s.child}return s;case 9:return f=s.type,c=s.pendingProps.children,qr(s,a),f=Mt(f),c=c(f),s.flags|=1,mt(r,s,c,a),s.child;case 14:return c=s.type,f=Ht(c,s.pendingProps),f=Ht(c.type,f),ap(r,s,c,f,a);case 15:return lp(r,s,s.type,s.pendingProps,a);case 17:return c=s.type,f=s.pendingProps,f=s.elementType===c?f:Ht(c,f),$o(r,s),s.tag=1,vt(c)?(r=!0,bo(s)):r=!1,qr(s,a),Zf(s,c,f),du(s,c,f,a),mu(null,s,c,!0,r,a);case 19:return gp(r,s,a);case 22:return up(r,s,a)}throw Error(n(156,s.tag))};function Vp(r,s){return vh(r,s)}function _x(r,s,a,c){this.tag=r,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vt(r,s,a,c){return new _x(r,s,a,c)}function Du(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Sx(r){if(typeof r=="function")return Du(r)?1:0;if(r!=null){if(r=r.$$typeof,r===ve)return 11;if(r===Oe)return 14}return 2}function Fn(r,s){var a=r.alternate;return a===null?(a=Vt(r.tag,s,r.key,r.mode),a.elementType=r.elementType,a.type=r.type,a.stateNode=r.stateNode,a.alternate=r,r.alternate=a):(a.pendingProps=s,a.type=r.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=r.flags&14680064,a.childLanes=r.childLanes,a.lanes=r.lanes,a.child=r.child,a.memoizedProps=r.memoizedProps,a.memoizedState=r.memoizedState,a.updateQueue=r.updateQueue,s=r.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},a.sibling=r.sibling,a.index=r.index,a.ref=r.ref,a}function Yo(r,s,a,c,f,g){var x=2;if(c=r,typeof r=="function")Du(r)&&(x=1);else if(typeof r=="string")x=5;else e:switch(r){case $:return ur(a.children,f,g,s);case B:x=8,f|=8;break;case Y:return r=Vt(12,a,s,f|2),r.elementType=Y,r.lanes=g,r;case je:return r=Vt(13,a,s,f),r.elementType=je,r.lanes=g,r;case xe:return r=Vt(19,a,s,f),r.elementType=xe,r.lanes=g,r;case pe:return Qo(a,f,g,s);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case oe:x=10;break e;case Te:x=9;break e;case ve:x=11;break e;case Oe:x=14;break e;case be:x=16,c=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return s=Vt(x,a,s,f),s.elementType=r,s.type=c,s.lanes=g,s}function ur(r,s,a,c){return r=Vt(7,r,c,s),r.lanes=a,r}function Qo(r,s,a,c){return r=Vt(22,r,c,s),r.elementType=pe,r.lanes=a,r.stateNode={isHidden:!1},r}function Lu(r,s,a){return r=Vt(6,r,null,s),r.lanes=a,r}function Mu(r,s,a){return s=Vt(4,r.children!==null?r.children:[],r.key,s),s.lanes=a,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}function kx(r,s,a,c,f){this.tag=s,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=cl(0),this.expirationTimes=cl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=cl(0),this.identifierPrefix=c,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function Uu(r,s,a,c,f,g,x,T,C){return r=new kx(r,s,a,T,C),s===1?(s=1,g===!0&&(s|=8)):s=0,g=Vt(3,null,null,s),r.current=g,g.stateNode=r,g.memoizedState={element:c,isDehydrated:a,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ql(g),r}function Ex(r,s,a){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:z,key:c==null?null:""+c,children:r,containerInfo:s,implementation:a}}function Fp(r){if(!r)return Rn;r=r._reactInternals;e:{if(Qn(r)!==r||r.tag!==1)throw Error(n(170));var s=r;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(vt(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(n(171))}if(r.tag===1){var a=r.type;if(vt(a))return mf(r,a,s)}return s}function Bp(r,s,a,c,f,g,x,T,C){return r=Uu(a,c,!0,r,f,g,x,T,C),r.context=Fp(null),a=r.current,c=gt(),f=$n(a),g=mn(c,f),g.callback=s??null,Dn(a,g,f),r.current.lanes=f,As(r,f,c),bt(r,c),r}function Xo(r,s,a,c){var f=s.current,g=gt(),x=$n(f);return a=Fp(a),s.context===null?s.context=a:s.pendingContext=a,s=mn(g,x),s.payload={element:r},c=c===void 0?null:c,c!==null&&(s.callback=c),r=Dn(f,s,x),r!==null&&(Jt(r,f,x,g),No(r,f,x)),x}function Zo(r){return r=r.current,r.child?(r.child.tag===5,r.child.stateNode):null}function zp(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var a=r.retryLane;r.retryLane=a!==0&&a<s?a:s}}function $u(r,s){zp(r,s),(r=r.alternate)&&zp(r,s)}function Tx(){return null}var qp=typeof reportError=="function"?reportError:function(r){console.error(r)};function Vu(r){this._internalRoot=r}ea.prototype.render=Vu.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(n(409));Xo(r,s,null,null)},ea.prototype.unmount=Vu.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;or(function(){Xo(null,r,null,null)}),s[cn]=null}};function ea(r){this._internalRoot=r}ea.prototype.unstable_scheduleHydration=function(r){if(r){var s=Th();r={blockedOn:null,target:r,priority:s};for(var a=0;a<jn.length&&s!==0&&s<jn[a].priority;a++);jn.splice(a,0,r),a===0&&Nh(r)}};function Fu(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function ta(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Wp(){}function jx(r,s,a,c,f){if(f){if(typeof c=="function"){var g=c;c=function(){var L=Zo(x);g.call(L)}}var x=Bp(s,c,r,0,null,!1,!1,"",Wp);return r._reactRootContainer=x,r[cn]=x.current,qs(r.nodeType===8?r.parentNode:r),or(),x}for(;f=r.lastChild;)r.removeChild(f);if(typeof c=="function"){var T=c;c=function(){var L=Zo(C);T.call(L)}}var C=Uu(r,0,!1,null,null,!1,!1,"",Wp);return r._reactRootContainer=C,r[cn]=C.current,qs(r.nodeType===8?r.parentNode:r),or(function(){Xo(s,C,a,c)}),C}function na(r,s,a,c,f){var g=a._reactRootContainer;if(g){var x=g;if(typeof f=="function"){var T=f;f=function(){var C=Zo(x);T.call(C)}}Xo(s,x,r,f)}else x=jx(a,s,r,f,c);return Zo(x)}kh=function(r){switch(r.tag){case 3:var s=r.stateNode;if(s.current.memoizedState.isDehydrated){var a=Ns(s.pendingLanes);a!==0&&(dl(s,a|1),bt(s,He()),(_e&6)===0&&(Jr=He()+500,On()))}break;case 13:or(function(){var c=pn(r,1);if(c!==null){var f=gt();Jt(c,r,1,f)}}),$u(r,1)}},hl=function(r){if(r.tag===13){var s=pn(r,134217728);if(s!==null){var a=gt();Jt(s,r,134217728,a)}$u(r,134217728)}},Eh=function(r){if(r.tag===13){var s=$n(r),a=pn(r,s);if(a!==null){var c=gt();Jt(a,r,s,c)}$u(r,s)}},Th=function(){return Ce},jh=function(r,s){var a=Ce;try{return Ce=r,s()}finally{Ce=a}},sl=function(r,s,a){switch(s){case"input":if(Ya(r,a),s=a.name,a.type==="radio"&&s!=null){for(a=r;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<a.length;s++){var c=a[s];if(c!==r&&c.form===r.form){var f=wo(c);if(!f)throw Error(n(90));Qd(c),Ya(c,f)}}}break;case"textarea":nh(r,a);break;case"select":s=a.value,s!=null&&Tr(r,!!a.multiple,s,!1)}},dh=Ru,hh=or;var Cx={usingClientEntryPoint:!1,Events:[Ks,Lr,wo,uh,ch,Ru]},ai={findFiberByHostInstance:Xn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Nx={bundleType:ai.bundleType,version:ai.version,rendererPackageName:ai.rendererPackageName,rendererConfig:ai.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:U.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=gh(r),r===null?null:r.stateNode},findFiberByHostInstance:ai.findFiberByHostInstance||Tx,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ra=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ra.isDisabled&&ra.supportsFiber)try{Zi=ra.inject(Nx),tn=ra}catch{}}return _t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Cx,_t.createPortal=function(r,s){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Fu(s))throw Error(n(200));return Ex(r,s,null,a)},_t.createRoot=function(r,s){if(!Fu(r))throw Error(n(299));var a=!1,c="",f=qp;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(c=s.identifierPrefix),s.onRecoverableError!==void 0&&(f=s.onRecoverableError)),s=Uu(r,1,!1,null,null,a,!1,c,f),r[cn]=s.current,qs(r.nodeType===8?r.parentNode:r),new Vu(s)},_t.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var s=r._reactInternals;if(s===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=gh(s),r=r===null?null:r.stateNode,r},_t.flushSync=function(r){return or(r)},_t.hydrate=function(r,s,a){if(!ta(s))throw Error(n(200));return na(null,r,s,!0,a)},_t.hydrateRoot=function(r,s,a){if(!Fu(r))throw Error(n(405));var c=a!=null&&a.hydratedSources||null,f=!1,g="",x=qp;if(a!=null&&(a.unstable_strictMode===!0&&(f=!0),a.identifierPrefix!==void 0&&(g=a.identifierPrefix),a.onRecoverableError!==void 0&&(x=a.onRecoverableError)),s=Bp(s,null,r,1,a??null,f,!1,g,x),r[cn]=s.current,qs(r),c)for(r=0;r<c.length;r++)a=c[r],f=a._getVersion,f=f(a._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[a,f]:s.mutableSourceEagerHydrationData.push(a,f);return new ea(s)},_t.render=function(r,s,a){if(!ta(s))throw Error(n(200));return na(null,r,s,!1,a)},_t.unmountComponentAtNode=function(r){if(!ta(r))throw Error(n(40));return r._reactRootContainer?(or(function(){na(null,null,r,!1,function(){r._reactRootContainer=null,r[cn]=null})}),!0):!1},_t.unstable_batchedUpdates=Ru,_t.unstable_renderSubtreeIntoContainer=function(r,s,a,c){if(!ta(a))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return na(r,s,a,!1,c)},_t.version="18.3.1-next-f1338f8080-20240426",_t}var Zp;function Mx(){if(Zp)return qu.exports;Zp=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),qu.exports=Lx(),qu.exports}var em;function Ux(){if(em)return sa;em=1;var t=Mx();return sa.createRoot=t.createRoot,sa.hydrateRoot=t.hydrateRoot,sa}var $x=Ux();const Vx=uy($x);var Fx={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"};const Bx=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),se=(t,e)=>{const n=R.forwardRef(({color:i="currentColor",size:o=24,strokeWidth:l=2,absoluteStrokeWidth:u,className:d="",children:h,...m},y)=>R.createElement("svg",{ref:y,...Fx,width:o,height:o,stroke:i,strokeWidth:u?Number(l)*24/Number(o):l,className:["lucide",`lucide-${Bx(t)}`,d].join(" "),...m},[...e.map(([v,w])=>R.createElement(v,w)),...Array.isArray(h)?h:[h]]));return n.displayName=`${t}`,n};const zx=se("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]);const Mi=se("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const qx=se("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Wx=se("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);const Hx=se("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const Kx=se("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Gx=se("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);const Jx=se("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);const Yx=se("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);const Qx=se("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);const Xx=se("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"}]]);const nd=se("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"}]]);const Si=se("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const bc=se("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const tm=se("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const Zx=se("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const e1=se("Chrome",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["line",{x1:"21.17",x2:"12",y1:"8",y2:"8",key:"a0cw5f"}],["line",{x1:"3.95",x2:"8.54",y1:"6.06",y2:"14",key:"1kftof"}],["line",{x1:"10.88",x2:"15.46",y1:"21.94",y2:"14",key:"1ymyh8"}]]);const fs=se("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const cy=se("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const dy=se("Cpu",[["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"9",y:"9",width:"6",height:"6",key:"o3kz5p"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);const ki=se("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);const nm=se("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);const Oa=se("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const t1=se("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);const n1=se("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);const r1=se("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);const Ku=se("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);const hy=se("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const s1=se("KeyRound",[["path",{d:"M2 18v3c0 .6.4 1 1 1h4v-3h3v-3h2l1.4-1.4a6.5 6.5 0 1 0-4-4Z",key:"167ctg"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);const i1=se("Key",[["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["path",{d:"m15.5 7.5 3 3L22 7l-3-3",key:"1rn1fs"}]]);const o1=se("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);const Kn=se("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const a1=se("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);const rm=se("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);const sm=se("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"}]]);const l1=se("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);const u1=se("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);const c1=se("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);const d1=se("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const rd=se("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);const h1=se("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);const sd=se("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);const _c=se("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const f1=se("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"}]]);const fy=se("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);const p1=se("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);const m1=se("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"}]]);const Sc=se("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);const g1=se("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"}]]);const y1=se("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);const id=se("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"}]]);const im=se("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"}]]);const om=se("VolumeX",[["polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5",key:"16drj5"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);const am=se("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"}]]);const ps=se("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const Sr=se("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),od=R.createContext({});function ad(t){const e=R.useRef(null);return e.current===null&&(e.current=t()),e.current}const Ia=R.createContext(null),ld=R.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class v1 extends R.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const i=this.props.sizeRef.current;i.height=n.offsetHeight||0,i.width=n.offsetWidth||0,i.top=n.offsetTop,i.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function w1({children:t,isPresent:e}){const n=R.useId(),i=R.useRef(null),o=R.useRef({width:0,height:0,top:0,left:0}),{nonce:l}=R.useContext(ld);return R.useInsertionEffect(()=>{const{width:u,height:d,top:h,left:m}=o.current;if(e||!i.current||!u||!d)return;i.current.dataset.motionPopId=n;const y=document.createElement("style");return l&&(y.nonce=l),document.head.appendChild(y),y.sheet&&y.sheet.insertRule(`
8
+ `+g.stack}return{value:r,source:s,stack:f,digest:null}}function fu(r,s,a){return{value:r,source:null,stack:a??null,digest:s??null}}function pu(r,s){try{console.error(s.value)}catch(a){setTimeout(function(){throw a})}}var ix=typeof WeakMap=="function"?WeakMap:Map;function tp(r,s,a){a=mn(-1,a),a.tag=3,a.payload={element:null};var c=s.value;return a.callback=function(){qo||(qo=!0,Nu=c),pu(r,s)},a}function np(r,s,a){a=mn(-1,a),a.tag=3;var c=r.type.getDerivedStateFromError;if(typeof c=="function"){var f=s.value;a.payload=function(){return c(f)},a.callback=function(){pu(r,s)}}var g=r.stateNode;return g!==null&&typeof g.componentDidCatch=="function"&&(a.callback=function(){pu(r,s),typeof c!="function"&&(Un===null?Un=new Set([this]):Un.add(this));var x=s.stack;this.componentDidCatch(s.value,{componentStack:x!==null?x:""})}),a}function rp(r,s,a){var c=r.pingCache;if(c===null){c=r.pingCache=new ix;var f=new Set;c.set(s,f)}else f=c.get(s),f===void 0&&(f=new Set,c.set(s,f));f.has(a)||(f.add(a),r=wx.bind(null,r,s,a),s.then(r,r))}function sp(r){do{var s;if((s=r.tag===13)&&(s=r.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return r;r=r.return}while(r!==null);return null}function ip(r,s,a,c,f){return(r.mode&1)===0?(r===s?r.flags|=65536:(r.flags|=128,a.flags|=131072,a.flags&=-52805,a.tag===1&&(a.alternate===null?a.tag=17:(s=mn(-1,1),s.tag=2,Ln(a,s,1))),a.lanes|=1),r):(r.flags|=65536,r.lanes=f,r)}var ox=U.ReactCurrentOwner,wt=!1;function mt(r,s,a,c){s.child=r===null?Ef(s,null,a,c):zr(s,r.child,a,c)}function op(r,s,a,c,f){a=a.render;var g=s.ref;return Wr(s,f),c=iu(r,s,a,c,g,f),a=ou(),r!==null&&!wt?(s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~f,gn(r,s,f)):(Ue&&a&&Bl(s),s.flags|=1,mt(r,s,c,f),s.child)}function ap(r,s,a,c,f){if(r===null){var g=a.type;return typeof g=="function"&&!Lu(g)&&g.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(s.tag=15,s.type=g,lp(r,s,g,c,f)):(r=Yo(a.type,null,c,s,s.mode,f),r.ref=s.ref,r.return=s,s.child=r)}if(g=r.child,(r.lanes&f)===0){var x=g.memoizedProps;if(a=a.compare,a=a!==null?a:Fs,a(x,c)&&r.ref===s.ref)return gn(r,s,f)}return s.flags|=1,r=Bn(g,c),r.ref=s.ref,r.return=s,s.child=r}function lp(r,s,a,c,f){if(r!==null){var g=r.memoizedProps;if(Fs(g,c)&&r.ref===s.ref)if(wt=!1,s.pendingProps=c=g,(r.lanes&f)!==0)(r.flags&131072)!==0&&(wt=!0);else return s.lanes=r.lanes,gn(r,s,f)}return mu(r,s,a,c,f)}function up(r,s,a){var c=s.pendingProps,f=c.children,g=r!==null?r.memoizedState:null;if(c.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ae(Jr,Nt),Nt|=a;else{if((a&1073741824)===0)return r=g!==null?g.baseLanes|a:a,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:r,cachePool:null,transitions:null},s.updateQueue=null,Ae(Jr,Nt),Nt|=r,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=g!==null?g.baseLanes:a,Ae(Jr,Nt),Nt|=c}else g!==null?(c=g.baseLanes|a,s.memoizedState=null):c=a,Ae(Jr,Nt),Nt|=c;return mt(r,s,f,a),s.child}function cp(r,s){var a=s.ref;(r===null&&a!==null||r!==null&&r.ref!==a)&&(s.flags|=512,s.flags|=2097152)}function mu(r,s,a,c,f){var g=vt(a)?Zn:lt.current;return g=$r(s,g),Wr(s,f),a=iu(r,s,a,c,g,f),c=ou(),r!==null&&!wt?(s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~f,gn(r,s,f)):(Ue&&c&&Bl(s),s.flags|=1,mt(r,s,a,f),s.child)}function dp(r,s,a,c,f){if(vt(a)){var g=!0;bo(s)}else g=!1;if(Wr(s,f),s.stateNode===null)$o(r,s),Zf(s,a,c),hu(s,a,c,f),c=!0;else if(r===null){var x=s.stateNode,T=s.memoizedProps;x.props=T;var C=x.context,L=a.contextType;typeof L=="object"&&L!==null?L=Mt(L):(L=vt(a)?Zn:lt.current,L=$r(s,L));var W=a.getDerivedStateFromProps,H=typeof W=="function"||typeof x.getSnapshotBeforeUpdate=="function";H||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(T!==c||C!==L)&&ep(s,x,c,L),Dn=!1;var q=s.memoizedState;x.state=q,Ao(s,c,x,f),C=s.memoizedState,T!==c||q!==C||yt.current||Dn?(typeof W=="function"&&(du(s,a,W,c),C=s.memoizedState),(T=Dn||Xf(s,a,T,c,q,C,L))?(H||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(s.flags|=4194308)):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=c,s.memoizedState=C),x.props=c,x.state=C,x.context=L,c=T):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),c=!1)}else{x=s.stateNode,jf(r,s),T=s.memoizedProps,L=s.type===s.elementType?T:Ht(s.type,T),x.props=L,H=s.pendingProps,q=x.context,C=a.contextType,typeof C=="object"&&C!==null?C=Mt(C):(C=vt(a)?Zn:lt.current,C=$r(s,C));var Q=a.getDerivedStateFromProps;(W=typeof Q=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(T!==H||q!==C)&&ep(s,x,c,C),Dn=!1,q=s.memoizedState,x.state=q,Ao(s,c,x,f);var Z=s.memoizedState;T!==H||q!==Z||yt.current||Dn?(typeof Q=="function"&&(du(s,a,Q,c),Z=s.memoizedState),(L=Dn||Xf(s,a,L,c,q,Z,C)||!1)?(W||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(c,Z,C),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(c,Z,C)),typeof x.componentDidUpdate=="function"&&(s.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof x.componentDidUpdate!="function"||T===r.memoizedProps&&q===r.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||T===r.memoizedProps&&q===r.memoizedState||(s.flags|=1024),s.memoizedProps=c,s.memoizedState=Z),x.props=c,x.state=Z,x.context=C,c=L):(typeof x.componentDidUpdate!="function"||T===r.memoizedProps&&q===r.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||T===r.memoizedProps&&q===r.memoizedState||(s.flags|=1024),c=!1)}return gu(r,s,a,c,g,f)}function gu(r,s,a,c,f,g){cp(r,s);var x=(s.flags&128)!==0;if(!c&&!x)return f&&gf(s,a,!1),gn(r,s,g);c=s.stateNode,ox.current=s;var T=x&&typeof a.getDerivedStateFromError!="function"?null:c.render();return s.flags|=1,r!==null&&x?(s.child=zr(s,r.child,null,g),s.child=zr(s,null,T,g)):mt(r,s,T,g),s.memoizedState=c.state,f&&gf(s,a,!0),s.child}function hp(r){var s=r.stateNode;s.pendingContext?pf(r,s.pendingContext,s.pendingContext!==s.context):s.context&&pf(r,s.context,!1),Zl(r,s.containerInfo)}function fp(r,s,a,c,f){return Br(),Hl(f),s.flags|=256,mt(r,s,a,c),s.child}var yu={dehydrated:null,treeContext:null,retryLane:0};function vu(r){return{baseLanes:r,cachePool:null,transitions:null}}function pp(r,s,a){var c=s.pendingProps,f=$e.current,g=!1,x=(s.flags&128)!==0,T;if((T=x)||(T=r!==null&&r.memoizedState===null?!1:(f&2)!==0),T?(g=!0,s.flags&=-129):(r===null||r.memoizedState!==null)&&(f|=1),Ae($e,f&1),r===null)return Wl(s),r=s.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((s.mode&1)===0?s.lanes=1:r.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(x=c.children,r=c.fallback,g?(c=s.mode,g=s.child,x={mode:"hidden",children:x},(c&1)===0&&g!==null?(g.childLanes=0,g.pendingProps=x):g=Qo(x,c,0,null),r=ur(r,c,a,null),g.return=s,r.return=s,g.sibling=r,s.child=g,s.child.memoizedState=vu(a),s.memoizedState=yu,r):wu(s,x));if(f=r.memoizedState,f!==null&&(T=f.dehydrated,T!==null))return ax(r,s,x,c,T,f,a);if(g){g=c.fallback,x=s.mode,f=r.child,T=f.sibling;var C={mode:"hidden",children:c.children};return(x&1)===0&&s.child!==f?(c=s.child,c.childLanes=0,c.pendingProps=C,s.deletions=null):(c=Bn(f,C),c.subtreeFlags=f.subtreeFlags&14680064),T!==null?g=Bn(T,g):(g=ur(g,x,a,null),g.flags|=2),g.return=s,c.return=s,c.sibling=g,s.child=c,c=g,g=s.child,x=r.child.memoizedState,x=x===null?vu(a):{baseLanes:x.baseLanes|a,cachePool:null,transitions:x.transitions},g.memoizedState=x,g.childLanes=r.childLanes&~a,s.memoizedState=yu,c}return g=r.child,r=g.sibling,c=Bn(g,{mode:"visible",children:c.children}),(s.mode&1)===0&&(c.lanes=a),c.return=s,c.sibling=null,r!==null&&(a=s.deletions,a===null?(s.deletions=[r],s.flags|=16):a.push(r)),s.child=c,s.memoizedState=null,c}function wu(r,s){return s=Qo({mode:"visible",children:s},r.mode,0,null),s.return=r,r.child=s}function Uo(r,s,a,c){return c!==null&&Hl(c),zr(s,r.child,null,a),r=wu(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function ax(r,s,a,c,f,g,x){if(a)return s.flags&256?(s.flags&=-257,c=fu(Error(n(422))),Uo(r,s,x,c)):s.memoizedState!==null?(s.child=r.child,s.flags|=128,null):(g=c.fallback,f=s.mode,c=Qo({mode:"visible",children:c.children},f,0,null),g=ur(g,f,x,null),g.flags|=2,c.return=s,g.return=s,c.sibling=g,s.child=c,(s.mode&1)!==0&&zr(s,r.child,null,x),s.child.memoizedState=vu(x),s.memoizedState=yu,g);if((s.mode&1)===0)return Uo(r,s,x,null);if(f.data==="$!"){if(c=f.nextSibling&&f.nextSibling.dataset,c)var T=c.dgst;return c=T,g=Error(n(419)),c=fu(g,c,void 0),Uo(r,s,x,c)}if(T=(x&r.childLanes)!==0,wt||T){if(c=tt,c!==null){switch(x&-x){case 4:f=2;break;case 16:f=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:f=32;break;case 536870912:f=268435456;break;default:f=0}f=(f&(c.suspendedLanes|x))!==0?0:f,f!==0&&f!==g.retryLane&&(g.retryLane=f,pn(r,f),Jt(c,r,f,-1))}return Du(),c=fu(Error(n(421))),Uo(r,s,x,c)}return f.data==="$?"?(s.flags|=128,s.child=r.child,s=xx.bind(null,r),f._reactRetry=s,null):(r=g.treeContext,Ct=Pn(f.nextSibling),jt=s,Ue=!0,Wt=null,r!==null&&(Dt[Lt++]=hn,Dt[Lt++]=fn,Dt[Lt++]=er,hn=r.id,fn=r.overflow,er=s),s=wu(s,c.children),s.flags|=4096,s)}function mp(r,s,a){r.lanes|=s;var c=r.alternate;c!==null&&(c.lanes|=s),Yl(r.return,s,a)}function xu(r,s,a,c,f){var g=r.memoizedState;g===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:c,tail:a,tailMode:f}:(g.isBackwards=s,g.rendering=null,g.renderingStartTime=0,g.last=c,g.tail=a,g.tailMode=f)}function gp(r,s,a){var c=s.pendingProps,f=c.revealOrder,g=c.tail;if(mt(r,s,c.children,a),c=$e.current,(c&2)!==0)c=c&1|2,s.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&mp(r,a,s);else if(r.tag===19)mp(r,a,s);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}c&=1}if(Ae($e,c),(s.mode&1)===0)s.memoizedState=null;else switch(f){case"forwards":for(a=s.child,f=null;a!==null;)r=a.alternate,r!==null&&Po(r)===null&&(f=a),a=a.sibling;a=f,a===null?(f=s.child,s.child=null):(f=a.sibling,a.sibling=null),xu(s,!1,f,a,g);break;case"backwards":for(a=null,f=s.child,s.child=null;f!==null;){if(r=f.alternate,r!==null&&Po(r)===null){s.child=f;break}r=f.sibling,f.sibling=a,a=f,f=r}xu(s,!0,a,null,g);break;case"together":xu(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function $o(r,s){(s.mode&1)===0&&r!==null&&(r.alternate=null,s.alternate=null,s.flags|=2)}function gn(r,s,a){if(r!==null&&(s.dependencies=r.dependencies),ir|=s.lanes,(a&s.childLanes)===0)return null;if(r!==null&&s.child!==r.child)throw Error(n(153));if(s.child!==null){for(r=s.child,a=Bn(r,r.pendingProps),s.child=a,a.return=s;r.sibling!==null;)r=r.sibling,a=a.sibling=Bn(r,r.pendingProps),a.return=s;a.sibling=null}return s.child}function lx(r,s,a){switch(s.tag){case 3:hp(s),Br();break;case 5:Af(s);break;case 1:vt(s.type)&&bo(s);break;case 4:Zl(s,s.stateNode.containerInfo);break;case 10:var c=s.type._context,f=s.memoizedProps.value;Ae(jo,c._currentValue),c._currentValue=f;break;case 13:if(c=s.memoizedState,c!==null)return c.dehydrated!==null?(Ae($e,$e.current&1),s.flags|=128,null):(a&s.child.childLanes)!==0?pp(r,s,a):(Ae($e,$e.current&1),r=gn(r,s,a),r!==null?r.sibling:null);Ae($e,$e.current&1);break;case 19:if(c=(a&s.childLanes)!==0,(r.flags&128)!==0){if(c)return gp(r,s,a);s.flags|=128}if(f=s.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Ae($e,$e.current),c)break;return null;case 22:case 23:return s.lanes=0,up(r,s,a)}return gn(r,s,a)}var yp,bu,vp,wp;yp=function(r,s){for(var a=s.child;a!==null;){if(a.tag===5||a.tag===6)r.appendChild(a.stateNode);else if(a.tag!==4&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return;a=a.return}a.sibling.return=a.return,a=a.sibling}},bu=function(){},vp=function(r,s,a,c){var f=r.memoizedProps;if(f!==c){r=s.stateNode,rr(rn.current);var g=null;switch(a){case"input":f=Ya(r,f),c=Ya(r,c),g=[];break;case"select":f=K({},f,{value:void 0}),c=K({},c,{value:void 0}),g=[];break;case"textarea":f=Za(r,f),c=Za(r,c),g=[];break;default:typeof f.onClick!="function"&&typeof c.onClick=="function"&&(r.onclick=vo)}tl(a,c);var x;a=null;for(L in f)if(!c.hasOwnProperty(L)&&f.hasOwnProperty(L)&&f[L]!=null)if(L==="style"){var T=f[L];for(x in T)T.hasOwnProperty(x)&&(a||(a={}),a[x]="")}else L!=="dangerouslySetInnerHTML"&&L!=="children"&&L!=="suppressContentEditableWarning"&&L!=="suppressHydrationWarning"&&L!=="autoFocus"&&(o.hasOwnProperty(L)?g||(g=[]):(g=g||[]).push(L,null));for(L in c){var C=c[L];if(T=f?.[L],c.hasOwnProperty(L)&&C!==T&&(C!=null||T!=null))if(L==="style")if(T){for(x in T)!T.hasOwnProperty(x)||C&&C.hasOwnProperty(x)||(a||(a={}),a[x]="");for(x in C)C.hasOwnProperty(x)&&T[x]!==C[x]&&(a||(a={}),a[x]=C[x])}else a||(g||(g=[]),g.push(L,a)),a=C;else L==="dangerouslySetInnerHTML"?(C=C?C.__html:void 0,T=T?T.__html:void 0,C!=null&&T!==C&&(g=g||[]).push(L,C)):L==="children"?typeof C!="string"&&typeof C!="number"||(g=g||[]).push(L,""+C):L!=="suppressContentEditableWarning"&&L!=="suppressHydrationWarning"&&(o.hasOwnProperty(L)?(C!=null&&L==="onScroll"&&Ie("scroll",r),g||T===C||(g=[])):(g=g||[]).push(L,C))}a&&(g=g||[]).push("style",a);var L=g;(s.updateQueue=L)&&(s.flags|=4)}},wp=function(r,s,a,c){a!==c&&(s.flags|=4)};function ni(r,s){if(!Ue)switch(r.tailMode){case"hidden":s=r.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?r.tail=null:a.sibling=null;break;case"collapsed":a=r.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:c.sibling=null}}function ct(r){var s=r.alternate!==null&&r.alternate.child===r.child,a=0,c=0;if(s)for(var f=r.child;f!==null;)a|=f.lanes|f.childLanes,c|=f.subtreeFlags&14680064,c|=f.flags&14680064,f.return=r,f=f.sibling;else for(f=r.child;f!==null;)a|=f.lanes|f.childLanes,c|=f.subtreeFlags,c|=f.flags,f.return=r,f=f.sibling;return r.subtreeFlags|=c,r.childLanes=a,s}function ux(r,s,a){var c=s.pendingProps;switch(zl(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ct(s),null;case 1:return vt(s.type)&&xo(),ct(s),null;case 3:return c=s.stateNode,Hr(),De(yt),De(lt),nu(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(Eo(s)?s.flags|=4:r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Wt!==null&&(Ru(Wt),Wt=null))),bu(r,s),ct(s),null;case 5:eu(s);var f=rr(Qs.current);if(a=s.type,r!==null&&s.stateNode!=null)vp(r,s,a,c,f),r.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!c){if(s.stateNode===null)throw Error(n(166));return ct(s),null}if(r=rr(rn.current),Eo(s)){c=s.stateNode,a=s.type;var g=s.memoizedProps;switch(c[nn]=s,c[Hs]=g,r=(s.mode&1)!==0,a){case"dialog":Ie("cancel",c),Ie("close",c);break;case"iframe":case"object":case"embed":Ie("load",c);break;case"video":case"audio":for(f=0;f<zs.length;f++)Ie(zs[f],c);break;case"source":Ie("error",c);break;case"img":case"image":case"link":Ie("error",c),Ie("load",c);break;case"details":Ie("toggle",c);break;case"input":Xd(c,g),Ie("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!g.multiple},Ie("invalid",c);break;case"textarea":th(c,g),Ie("invalid",c)}tl(a,g),f=null;for(var x in g)if(g.hasOwnProperty(x)){var T=g[x];x==="children"?typeof T=="string"?c.textContent!==T&&(g.suppressHydrationWarning!==!0&&yo(c.textContent,T,r),f=["children",T]):typeof T=="number"&&c.textContent!==""+T&&(g.suppressHydrationWarning!==!0&&yo(c.textContent,T,r),f=["children",""+T]):o.hasOwnProperty(x)&&T!=null&&x==="onScroll"&&Ie("scroll",c)}switch(a){case"input":Ki(c),eh(c,g,!0);break;case"textarea":Ki(c),rh(c);break;case"select":case"option":break;default:typeof g.onClick=="function"&&(c.onclick=vo)}c=f,s.updateQueue=c,c!==null&&(s.flags|=4)}else{x=f.nodeType===9?f:f.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=sh(a)),r==="http://www.w3.org/1999/xhtml"?a==="script"?(r=x.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof c.is=="string"?r=x.createElement(a,{is:c.is}):(r=x.createElement(a),a==="select"&&(x=r,c.multiple?x.multiple=!0:c.size&&(x.size=c.size))):r=x.createElementNS(r,a),r[nn]=s,r[Hs]=c,yp(r,s,!1,!1),s.stateNode=r;e:{switch(x=nl(a,c),a){case"dialog":Ie("cancel",r),Ie("close",r),f=c;break;case"iframe":case"object":case"embed":Ie("load",r),f=c;break;case"video":case"audio":for(f=0;f<zs.length;f++)Ie(zs[f],r);f=c;break;case"source":Ie("error",r),f=c;break;case"img":case"image":case"link":Ie("error",r),Ie("load",r),f=c;break;case"details":Ie("toggle",r),f=c;break;case"input":Xd(r,c),f=Ya(r,c),Ie("invalid",r);break;case"option":f=c;break;case"select":r._wrapperState={wasMultiple:!!c.multiple},f=K({},c,{value:void 0}),Ie("invalid",r);break;case"textarea":th(r,c),f=Za(r,c),Ie("invalid",r);break;default:f=c}tl(a,f),T=f;for(g in T)if(T.hasOwnProperty(g)){var C=T[g];g==="style"?ah(r,C):g==="dangerouslySetInnerHTML"?(C=C?C.__html:void 0,C!=null&&ih(r,C)):g==="children"?typeof C=="string"?(a!=="textarea"||C!=="")&&ks(r,C):typeof C=="number"&&ks(r,""+C):g!=="suppressContentEditableWarning"&&g!=="suppressHydrationWarning"&&g!=="autoFocus"&&(o.hasOwnProperty(g)?C!=null&&g==="onScroll"&&Ie("scroll",r):C!=null&&N(r,g,C,x))}switch(a){case"input":Ki(r),eh(r,c,!1);break;case"textarea":Ki(r),rh(r);break;case"option":c.value!=null&&r.setAttribute("value",""+ke(c.value));break;case"select":r.multiple=!!c.multiple,g=c.value,g!=null?jr(r,!!c.multiple,g,!1):c.defaultValue!=null&&jr(r,!!c.multiple,c.defaultValue,!0);break;default:typeof f.onClick=="function"&&(r.onclick=vo)}switch(a){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return ct(s),null;case 6:if(r&&s.stateNode!=null)wp(r,s,r.memoizedProps,c);else{if(typeof c!="string"&&s.stateNode===null)throw Error(n(166));if(a=rr(Qs.current),rr(rn.current),Eo(s)){if(c=s.stateNode,a=s.memoizedProps,c[nn]=s,(g=c.nodeValue!==a)&&(r=jt,r!==null))switch(r.tag){case 3:yo(c.nodeValue,a,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&yo(c.nodeValue,a,(r.mode&1)!==0)}g&&(s.flags|=4)}else c=(a.nodeType===9?a:a.ownerDocument).createTextNode(c),c[nn]=s,s.stateNode=c}return ct(s),null;case 13:if(De($e),c=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(Ue&&Ct!==null&&(s.mode&1)!==0&&(s.flags&128)===0)_f(),Br(),s.flags|=98560,g=!1;else if(g=Eo(s),c!==null&&c.dehydrated!==null){if(r===null){if(!g)throw Error(n(318));if(g=s.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(n(317));g[nn]=s}else Br(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;ct(s),g=!1}else Wt!==null&&(Ru(Wt),Wt=null),g=!0;if(!g)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=a,s):(c=c!==null,c!==(r!==null&&r.memoizedState!==null)&&c&&(s.child.flags|=8192,(s.mode&1)!==0&&(r===null||($e.current&1)!==0?Xe===0&&(Xe=3):Du())),s.updateQueue!==null&&(s.flags|=4),ct(s),null);case 4:return Hr(),bu(r,s),r===null&&qs(s.stateNode.containerInfo),ct(s),null;case 10:return Jl(s.type._context),ct(s),null;case 17:return vt(s.type)&&xo(),ct(s),null;case 19:if(De($e),g=s.memoizedState,g===null)return ct(s),null;if(c=(s.flags&128)!==0,x=g.rendering,x===null)if(c)ni(g,!1);else{if(Xe!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(x=Po(r),x!==null){for(s.flags|=128,ni(g,!1),c=x.updateQueue,c!==null&&(s.updateQueue=c,s.flags|=4),s.subtreeFlags=0,c=a,a=s.child;a!==null;)g=a,r=c,g.flags&=14680066,x=g.alternate,x===null?(g.childLanes=0,g.lanes=r,g.child=null,g.subtreeFlags=0,g.memoizedProps=null,g.memoizedState=null,g.updateQueue=null,g.dependencies=null,g.stateNode=null):(g.childLanes=x.childLanes,g.lanes=x.lanes,g.child=x.child,g.subtreeFlags=0,g.deletions=null,g.memoizedProps=x.memoizedProps,g.memoizedState=x.memoizedState,g.updateQueue=x.updateQueue,g.type=x.type,r=x.dependencies,g.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),a=a.sibling;return Ae($e,$e.current&1|2),s.child}r=r.sibling}g.tail!==null&&He()>Yr&&(s.flags|=128,c=!0,ni(g,!1),s.lanes=4194304)}else{if(!c)if(r=Po(x),r!==null){if(s.flags|=128,c=!0,a=r.updateQueue,a!==null&&(s.updateQueue=a,s.flags|=4),ni(g,!0),g.tail===null&&g.tailMode==="hidden"&&!x.alternate&&!Ue)return ct(s),null}else 2*He()-g.renderingStartTime>Yr&&a!==1073741824&&(s.flags|=128,c=!0,ni(g,!1),s.lanes=4194304);g.isBackwards?(x.sibling=s.child,s.child=x):(a=g.last,a!==null?a.sibling=x:s.child=x,g.last=x)}return g.tail!==null?(s=g.tail,g.rendering=s,g.tail=s.sibling,g.renderingStartTime=He(),s.sibling=null,a=$e.current,Ae($e,c?a&1|2:a&1),s):(ct(s),null);case 22:case 23:return Iu(),c=s.memoizedState!==null,r!==null&&r.memoizedState!==null!==c&&(s.flags|=8192),c&&(s.mode&1)!==0?(Nt&1073741824)!==0&&(ct(s),s.subtreeFlags&6&&(s.flags|=8192)):ct(s),null;case 24:return null;case 25:return null}throw Error(n(156,s.tag))}function cx(r,s){switch(zl(s),s.tag){case 1:return vt(s.type)&&xo(),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return Hr(),De(yt),De(lt),nu(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 5:return eu(s),null;case 13:if(De($e),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(n(340));Br()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return De($e),null;case 4:return Hr(),null;case 10:return Jl(s.type._context),null;case 22:case 23:return Iu(),null;case 24:return null;default:return null}}var Vo=!1,dt=!1,dx=typeof WeakSet=="function"?WeakSet:Set,X=null;function Gr(r,s){var a=r.ref;if(a!==null)if(typeof a=="function")try{a(null)}catch(c){ze(r,s,c)}else a.current=null}function _u(r,s,a){try{a()}catch(c){ze(r,s,c)}}var xp=!1;function hx(r,s){if(Il=io,r=Qh(),Tl(r)){if("selectionStart"in r)var a={start:r.selectionStart,end:r.selectionEnd};else e:{a=(a=r.ownerDocument)&&a.defaultView||window;var c=a.getSelection&&a.getSelection();if(c&&c.rangeCount!==0){a=c.anchorNode;var f=c.anchorOffset,g=c.focusNode;c=c.focusOffset;try{a.nodeType,g.nodeType}catch{a=null;break e}var x=0,T=-1,C=-1,L=0,W=0,H=r,q=null;t:for(;;){for(var Q;H!==a||f!==0&&H.nodeType!==3||(T=x+f),H!==g||c!==0&&H.nodeType!==3||(C=x+c),H.nodeType===3&&(x+=H.nodeValue.length),(Q=H.firstChild)!==null;)q=H,H=Q;for(;;){if(H===r)break t;if(q===a&&++L===f&&(T=x),q===g&&++W===c&&(C=x),(Q=H.nextSibling)!==null)break;H=q,q=H.parentNode}H=Q}a=T===-1||C===-1?null:{start:T,end:C}}else a=null}a=a||{start:0,end:0}}else a=null;for(Dl={focusedElem:r,selectionRange:a},io=!1,X=s;X!==null;)if(s=X,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,X=r;else for(;X!==null;){s=X;try{var Z=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Z!==null){var ee=Z.memoizedProps,Ke=Z.memoizedState,O=s.stateNode,A=O.getSnapshotBeforeUpdate(s.elementType===s.type?ee:Ht(s.type,ee),Ke);O.__reactInternalSnapshotBeforeUpdate=A}break;case 3:var I=s.stateNode.containerInfo;I.nodeType===1?I.textContent="":I.nodeType===9&&I.documentElement&&I.removeChild(I.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(G){ze(s,s.return,G)}if(r=s.sibling,r!==null){r.return=s.return,X=r;break}X=s.return}return Z=xp,xp=!1,Z}function ri(r,s,a){var c=s.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var f=c=c.next;do{if((f.tag&r)===r){var g=f.destroy;f.destroy=void 0,g!==void 0&&_u(s,a,g)}f=f.next}while(f!==c)}}function Fo(r,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var a=s=s.next;do{if((a.tag&r)===r){var c=a.create;a.destroy=c()}a=a.next}while(a!==s)}}function Su(r){var s=r.ref;if(s!==null){var a=r.stateNode;r.tag,r=a,typeof s=="function"?s(r):s.current=r}}function bp(r){var s=r.alternate;s!==null&&(r.alternate=null,bp(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&(delete s[nn],delete s[Hs],delete s[$l],delete s[Gw],delete s[Jw])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function _p(r){return r.tag===5||r.tag===3||r.tag===4}function Sp(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||_p(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function ku(r,s,a){var c=r.tag;if(c===5||c===6)r=r.stateNode,s?a.nodeType===8?a.parentNode.insertBefore(r,s):a.insertBefore(r,s):(a.nodeType===8?(s=a.parentNode,s.insertBefore(r,a)):(s=a,s.appendChild(r)),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=vo));else if(c!==4&&(r=r.child,r!==null))for(ku(r,s,a),r=r.sibling;r!==null;)ku(r,s,a),r=r.sibling}function Eu(r,s,a){var c=r.tag;if(c===5||c===6)r=r.stateNode,s?a.insertBefore(r,s):a.appendChild(r);else if(c!==4&&(r=r.child,r!==null))for(Eu(r,s,a),r=r.sibling;r!==null;)Eu(r,s,a),r=r.sibling}var rt=null,Kt=!1;function Mn(r,s,a){for(a=a.child;a!==null;)kp(r,s,a),a=a.sibling}function kp(r,s,a){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount(Zi,a)}catch{}switch(a.tag){case 5:dt||Gr(a,s);case 6:var c=rt,f=Kt;rt=null,Mn(r,s,a),rt=c,Kt=f,rt!==null&&(Kt?(r=rt,a=a.stateNode,r.nodeType===8?r.parentNode.removeChild(a):r.removeChild(a)):rt.removeChild(a.stateNode));break;case 18:rt!==null&&(Kt?(r=rt,a=a.stateNode,r.nodeType===8?Ul(r.parentNode,a):r.nodeType===1&&Ul(r,a),Ds(r)):Ul(rt,a.stateNode));break;case 4:c=rt,f=Kt,rt=a.stateNode.containerInfo,Kt=!0,Mn(r,s,a),rt=c,Kt=f;break;case 0:case 11:case 14:case 15:if(!dt&&(c=a.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){f=c=c.next;do{var g=f,x=g.destroy;g=g.tag,x!==void 0&&((g&2)!==0||(g&4)!==0)&&_u(a,s,x),f=f.next}while(f!==c)}Mn(r,s,a);break;case 1:if(!dt&&(Gr(a,s),c=a.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=a.memoizedProps,c.state=a.memoizedState,c.componentWillUnmount()}catch(T){ze(a,s,T)}Mn(r,s,a);break;case 21:Mn(r,s,a);break;case 22:a.mode&1?(dt=(c=dt)||a.memoizedState!==null,Mn(r,s,a),dt=c):Mn(r,s,a);break;default:Mn(r,s,a)}}function Ep(r){var s=r.updateQueue;if(s!==null){r.updateQueue=null;var a=r.stateNode;a===null&&(a=r.stateNode=new dx),s.forEach(function(c){var f=bx.bind(null,r,c);a.has(c)||(a.add(c),c.then(f,f))})}}function Gt(r,s){var a=s.deletions;if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];try{var g=r,x=s,T=x;e:for(;T!==null;){switch(T.tag){case 5:rt=T.stateNode,Kt=!1;break e;case 3:rt=T.stateNode.containerInfo,Kt=!0;break e;case 4:rt=T.stateNode.containerInfo,Kt=!0;break e}T=T.return}if(rt===null)throw Error(n(160));kp(g,x,f),rt=null,Kt=!1;var C=f.alternate;C!==null&&(C.return=null),f.return=null}catch(L){ze(f,s,L)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Tp(s,r),s=s.sibling}function Tp(r,s){var a=r.alternate,c=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(Gt(s,r),on(r),c&4){try{ri(3,r,r.return),Fo(3,r)}catch(ee){ze(r,r.return,ee)}try{ri(5,r,r.return)}catch(ee){ze(r,r.return,ee)}}break;case 1:Gt(s,r),on(r),c&512&&a!==null&&Gr(a,a.return);break;case 5:if(Gt(s,r),on(r),c&512&&a!==null&&Gr(a,a.return),r.flags&32){var f=r.stateNode;try{ks(f,"")}catch(ee){ze(r,r.return,ee)}}if(c&4&&(f=r.stateNode,f!=null)){var g=r.memoizedProps,x=a!==null?a.memoizedProps:g,T=r.type,C=r.updateQueue;if(r.updateQueue=null,C!==null)try{T==="input"&&g.type==="radio"&&g.name!=null&&Zd(f,g),nl(T,x);var L=nl(T,g);for(x=0;x<C.length;x+=2){var W=C[x],H=C[x+1];W==="style"?ah(f,H):W==="dangerouslySetInnerHTML"?ih(f,H):W==="children"?ks(f,H):N(f,W,H,L)}switch(T){case"input":Qa(f,g);break;case"textarea":nh(f,g);break;case"select":var q=f._wrapperState.wasMultiple;f._wrapperState.wasMultiple=!!g.multiple;var Q=g.value;Q!=null?jr(f,!!g.multiple,Q,!1):q!==!!g.multiple&&(g.defaultValue!=null?jr(f,!!g.multiple,g.defaultValue,!0):jr(f,!!g.multiple,g.multiple?[]:"",!1))}f[Hs]=g}catch(ee){ze(r,r.return,ee)}}break;case 6:if(Gt(s,r),on(r),c&4){if(r.stateNode===null)throw Error(n(162));f=r.stateNode,g=r.memoizedProps;try{f.nodeValue=g}catch(ee){ze(r,r.return,ee)}}break;case 3:if(Gt(s,r),on(r),c&4&&a!==null&&a.memoizedState.isDehydrated)try{Ds(s.containerInfo)}catch(ee){ze(r,r.return,ee)}break;case 4:Gt(s,r),on(r);break;case 13:Gt(s,r),on(r),f=r.child,f.flags&8192&&(g=f.memoizedState!==null,f.stateNode.isHidden=g,!g||f.alternate!==null&&f.alternate.memoizedState!==null||(Cu=He())),c&4&&Ep(r);break;case 22:if(W=a!==null&&a.memoizedState!==null,r.mode&1?(dt=(L=dt)||W,Gt(s,r),dt=L):Gt(s,r),on(r),c&8192){if(L=r.memoizedState!==null,(r.stateNode.isHidden=L)&&!W&&(r.mode&1)!==0)for(X=r,W=r.child;W!==null;){for(H=X=W;X!==null;){switch(q=X,Q=q.child,q.tag){case 0:case 11:case 14:case 15:ri(4,q,q.return);break;case 1:Gr(q,q.return);var Z=q.stateNode;if(typeof Z.componentWillUnmount=="function"){c=q,a=q.return;try{s=c,Z.props=s.memoizedProps,Z.state=s.memoizedState,Z.componentWillUnmount()}catch(ee){ze(c,a,ee)}}break;case 5:Gr(q,q.return);break;case 22:if(q.memoizedState!==null){Np(H);continue}}Q!==null?(Q.return=q,X=Q):Np(H)}W=W.sibling}e:for(W=null,H=r;;){if(H.tag===5){if(W===null){W=H;try{f=H.stateNode,L?(g=f.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none"):(T=H.stateNode,C=H.memoizedProps.style,x=C!=null&&C.hasOwnProperty("display")?C.display:null,T.style.display=oh("display",x))}catch(ee){ze(r,r.return,ee)}}}else if(H.tag===6){if(W===null)try{H.stateNode.nodeValue=L?"":H.memoizedProps}catch(ee){ze(r,r.return,ee)}}else if((H.tag!==22&&H.tag!==23||H.memoizedState===null||H===r)&&H.child!==null){H.child.return=H,H=H.child;continue}if(H===r)break e;for(;H.sibling===null;){if(H.return===null||H.return===r)break e;W===H&&(W=null),H=H.return}W===H&&(W=null),H.sibling.return=H.return,H=H.sibling}}break;case 19:Gt(s,r),on(r),c&4&&Ep(r);break;case 21:break;default:Gt(s,r),on(r)}}function on(r){var s=r.flags;if(s&2){try{e:{for(var a=r.return;a!==null;){if(_p(a)){var c=a;break e}a=a.return}throw Error(n(160))}switch(c.tag){case 5:var f=c.stateNode;c.flags&32&&(ks(f,""),c.flags&=-33);var g=Sp(r);Eu(r,g,f);break;case 3:case 4:var x=c.stateNode.containerInfo,T=Sp(r);ku(r,T,x);break;default:throw Error(n(161))}}catch(C){ze(r,r.return,C)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function fx(r,s,a){X=r,jp(r)}function jp(r,s,a){for(var c=(r.mode&1)!==0;X!==null;){var f=X,g=f.child;if(f.tag===22&&c){var x=f.memoizedState!==null||Vo;if(!x){var T=f.alternate,C=T!==null&&T.memoizedState!==null||dt;T=Vo;var L=dt;if(Vo=x,(dt=C)&&!L)for(X=f;X!==null;)x=X,C=x.child,x.tag===22&&x.memoizedState!==null?Ap(f):C!==null?(C.return=x,X=C):Ap(f);for(;g!==null;)X=g,jp(g),g=g.sibling;X=f,Vo=T,dt=L}Cp(r)}else(f.subtreeFlags&8772)!==0&&g!==null?(g.return=f,X=g):Cp(r)}}function Cp(r){for(;X!==null;){var s=X;if((s.flags&8772)!==0){var a=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:dt||Fo(5,s);break;case 1:var c=s.stateNode;if(s.flags&4&&!dt)if(a===null)c.componentDidMount();else{var f=s.elementType===s.type?a.memoizedProps:Ht(s.type,a.memoizedProps);c.componentDidUpdate(f,a.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var g=s.updateQueue;g!==null&&Nf(s,g,c);break;case 3:var x=s.updateQueue;if(x!==null){if(a=null,s.child!==null)switch(s.child.tag){case 5:a=s.child.stateNode;break;case 1:a=s.child.stateNode}Nf(s,x,a)}break;case 5:var T=s.stateNode;if(a===null&&s.flags&4){a=T;var C=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":C.autoFocus&&a.focus();break;case"img":C.src&&(a.src=C.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var L=s.alternate;if(L!==null){var W=L.memoizedState;if(W!==null){var H=W.dehydrated;H!==null&&Ds(H)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}dt||s.flags&512&&Su(s)}catch(q){ze(s,s.return,q)}}if(s===r){X=null;break}if(a=s.sibling,a!==null){a.return=s.return,X=a;break}X=s.return}}function Np(r){for(;X!==null;){var s=X;if(s===r){X=null;break}var a=s.sibling;if(a!==null){a.return=s.return,X=a;break}X=s.return}}function Ap(r){for(;X!==null;){var s=X;try{switch(s.tag){case 0:case 11:case 15:var a=s.return;try{Fo(4,s)}catch(C){ze(s,a,C)}break;case 1:var c=s.stateNode;if(typeof c.componentDidMount=="function"){var f=s.return;try{c.componentDidMount()}catch(C){ze(s,f,C)}}var g=s.return;try{Su(s)}catch(C){ze(s,g,C)}break;case 5:var x=s.return;try{Su(s)}catch(C){ze(s,x,C)}}}catch(C){ze(s,s.return,C)}if(s===r){X=null;break}var T=s.sibling;if(T!==null){T.return=s.return,X=T;break}X=s.return}}var px=Math.ceil,Bo=U.ReactCurrentDispatcher,Tu=U.ReactCurrentOwner,$t=U.ReactCurrentBatchConfig,_e=0,tt=null,Je=null,st=0,Nt=0,Jr=Rn(0),Xe=0,si=null,ir=0,zo=0,ju=0,ii=null,xt=null,Cu=0,Yr=1/0,yn=null,qo=!1,Nu=null,Un=null,Wo=!1,$n=null,Ho=0,oi=0,Au=null,Ko=-1,Go=0;function gt(){return(_e&6)!==0?He():Ko!==-1?Ko:Ko=He()}function Vn(r){return(r.mode&1)===0?1:(_e&2)!==0&&st!==0?st&-st:Qw.transition!==null?(Go===0&&(Go=_h()),Go):(r=Ce,r!==0||(r=window.event,r=r===void 0?16:Ph(r.type)),r)}function Jt(r,s,a,c){if(50<oi)throw oi=0,Au=null,Error(n(185));As(r,a,c),((_e&2)===0||r!==tt)&&(r===tt&&((_e&2)===0&&(zo|=a),Xe===4&&Fn(r,st)),bt(r,c),a===1&&_e===0&&(s.mode&1)===0&&(Yr=He()+500,_o&&In()))}function bt(r,s){var a=r.callbackNode;Q0(r,s);var c=no(r,r===tt?st:0);if(c===0)a!==null&&wh(a),r.callbackNode=null,r.callbackPriority=0;else if(s=c&-c,r.callbackPriority!==s){if(a!=null&&wh(a),s===1)r.tag===0?Yw(Rp.bind(null,r)):yf(Rp.bind(null,r)),Hw(function(){(_e&6)===0&&In()}),a=null;else{switch(Sh(c)){case 1:a=ul;break;case 4:a=xh;break;case 16:a=Xi;break;case 536870912:a=bh;break;default:a=Xi}a=Vp(a,Pp.bind(null,r))}r.callbackPriority=s,r.callbackNode=a}}function Pp(r,s){if(Ko=-1,Go=0,(_e&6)!==0)throw Error(n(327));var a=r.callbackNode;if(Qr()&&r.callbackNode!==a)return null;var c=no(r,r===tt?st:0);if(c===0)return null;if((c&30)!==0||(c&r.expiredLanes)!==0||s)s=Jo(r,c);else{s=c;var f=_e;_e|=2;var g=Ip();(tt!==r||st!==s)&&(yn=null,Yr=He()+500,ar(r,s));do try{yx();break}catch(T){Op(r,T)}while(!0);Gl(),Bo.current=g,_e=f,Je!==null?s=0:(tt=null,st=0,s=Xe)}if(s!==0){if(s===2&&(f=cl(r),f!==0&&(c=f,s=Pu(r,f))),s===1)throw a=si,ar(r,0),Fn(r,c),bt(r,He()),a;if(s===6)Fn(r,c);else{if(f=r.current.alternate,(c&30)===0&&!mx(f)&&(s=Jo(r,c),s===2&&(g=cl(r),g!==0&&(c=g,s=Pu(r,g))),s===1))throw a=si,ar(r,0),Fn(r,c),bt(r,He()),a;switch(r.finishedWork=f,r.finishedLanes=c,s){case 0:case 1:throw Error(n(345));case 2:lr(r,xt,yn);break;case 3:if(Fn(r,c),(c&130023424)===c&&(s=Cu+500-He(),10<s)){if(no(r,0)!==0)break;if(f=r.suspendedLanes,(f&c)!==c){gt(),r.pingedLanes|=r.suspendedLanes&f;break}r.timeoutHandle=Ml(lr.bind(null,r,xt,yn),s);break}lr(r,xt,yn);break;case 4:if(Fn(r,c),(c&4194240)===c)break;for(s=r.eventTimes,f=-1;0<c;){var x=31-zt(c);g=1<<x,x=s[x],x>f&&(f=x),c&=~g}if(c=f,c=He()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*px(c/1960))-c,10<c){r.timeoutHandle=Ml(lr.bind(null,r,xt,yn),c);break}lr(r,xt,yn);break;case 5:lr(r,xt,yn);break;default:throw Error(n(329))}}}return bt(r,He()),r.callbackNode===a?Pp.bind(null,r):null}function Pu(r,s){var a=ii;return r.current.memoizedState.isDehydrated&&(ar(r,s).flags|=256),r=Jo(r,s),r!==2&&(s=xt,xt=a,s!==null&&Ru(s)),r}function Ru(r){xt===null?xt=r:xt.push.apply(xt,r)}function mx(r){for(var s=r;;){if(s.flags&16384){var a=s.updateQueue;if(a!==null&&(a=a.stores,a!==null))for(var c=0;c<a.length;c++){var f=a[c],g=f.getSnapshot;f=f.value;try{if(!qt(g(),f))return!1}catch{return!1}}}if(a=s.child,s.subtreeFlags&16384&&a!==null)a.return=s,s=a;else{if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Fn(r,s){for(s&=~ju,s&=~zo,r.suspendedLanes|=s,r.pingedLanes&=~s,r=r.expirationTimes;0<s;){var a=31-zt(s),c=1<<a;r[a]=-1,s&=~c}}function Rp(r){if((_e&6)!==0)throw Error(n(327));Qr();var s=no(r,0);if((s&1)===0)return bt(r,He()),null;var a=Jo(r,s);if(r.tag!==0&&a===2){var c=cl(r);c!==0&&(s=c,a=Pu(r,c))}if(a===1)throw a=si,ar(r,0),Fn(r,s),bt(r,He()),a;if(a===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=s,lr(r,xt,yn),bt(r,He()),null}function Ou(r,s){var a=_e;_e|=1;try{return r(s)}finally{_e=a,_e===0&&(Yr=He()+500,_o&&In())}}function or(r){$n!==null&&$n.tag===0&&(_e&6)===0&&Qr();var s=_e;_e|=1;var a=$t.transition,c=Ce;try{if($t.transition=null,Ce=1,r)return r()}finally{Ce=c,$t.transition=a,_e=s,(_e&6)===0&&In()}}function Iu(){Nt=Jr.current,De(Jr)}function ar(r,s){r.finishedWork=null,r.finishedLanes=0;var a=r.timeoutHandle;if(a!==-1&&(r.timeoutHandle=-1,Ww(a)),Je!==null)for(a=Je.return;a!==null;){var c=a;switch(zl(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&xo();break;case 3:Hr(),De(yt),De(lt),nu();break;case 5:eu(c);break;case 4:Hr();break;case 13:De($e);break;case 19:De($e);break;case 10:Jl(c.type._context);break;case 22:case 23:Iu()}a=a.return}if(tt=r,Je=r=Bn(r.current,null),st=Nt=s,Xe=0,si=null,ju=zo=ir=0,xt=ii=null,nr!==null){for(s=0;s<nr.length;s++)if(a=nr[s],c=a.interleaved,c!==null){a.interleaved=null;var f=c.next,g=a.pending;if(g!==null){var x=g.next;g.next=f,c.next=x}a.pending=c}nr=null}return r}function Op(r,s){do{var a=Je;try{if(Gl(),Ro.current=Lo,Oo){for(var c=Ve.memoizedState;c!==null;){var f=c.queue;f!==null&&(f.pending=null),c=c.next}Oo=!1}if(sr=0,et=Qe=Ve=null,Xs=!1,Zs=0,Tu.current=null,a===null||a.return===null){Xe=1,si=s,Je=null;break}e:{var g=r,x=a.return,T=a,C=s;if(s=st,T.flags|=32768,C!==null&&typeof C=="object"&&typeof C.then=="function"){var L=C,W=T,H=W.tag;if((W.mode&1)===0&&(H===0||H===11||H===15)){var q=W.alternate;q?(W.updateQueue=q.updateQueue,W.memoizedState=q.memoizedState,W.lanes=q.lanes):(W.updateQueue=null,W.memoizedState=null)}var Q=sp(x);if(Q!==null){Q.flags&=-257,ip(Q,x,T,g,s),Q.mode&1&&rp(g,L,s),s=Q,C=L;var Z=s.updateQueue;if(Z===null){var ee=new Set;ee.add(C),s.updateQueue=ee}else Z.add(C);break e}else{if((s&1)===0){rp(g,L,s),Du();break e}C=Error(n(426))}}else if(Ue&&T.mode&1){var Ke=sp(x);if(Ke!==null){(Ke.flags&65536)===0&&(Ke.flags|=256),ip(Ke,x,T,g,s),Hl(Kr(C,T));break e}}g=C=Kr(C,T),Xe!==4&&(Xe=2),ii===null?ii=[g]:ii.push(g),g=x;do{switch(g.tag){case 3:g.flags|=65536,s&=-s,g.lanes|=s;var O=tp(g,C,s);Cf(g,O);break e;case 1:T=C;var A=g.type,I=g.stateNode;if((g.flags&128)===0&&(typeof A.getDerivedStateFromError=="function"||I!==null&&typeof I.componentDidCatch=="function"&&(Un===null||!Un.has(I)))){g.flags|=65536,s&=-s,g.lanes|=s;var G=np(g,T,s);Cf(g,G);break e}}g=g.return}while(g!==null)}Lp(a)}catch(te){s=te,Je===a&&a!==null&&(Je=a=a.return);continue}break}while(!0)}function Ip(){var r=Bo.current;return Bo.current=Lo,r===null?Lo:r}function Du(){(Xe===0||Xe===3||Xe===2)&&(Xe=4),tt===null||(ir&268435455)===0&&(zo&268435455)===0||Fn(tt,st)}function Jo(r,s){var a=_e;_e|=2;var c=Ip();(tt!==r||st!==s)&&(yn=null,ar(r,s));do try{gx();break}catch(f){Op(r,f)}while(!0);if(Gl(),_e=a,Bo.current=c,Je!==null)throw Error(n(261));return tt=null,st=0,Xe}function gx(){for(;Je!==null;)Dp(Je)}function yx(){for(;Je!==null&&!B0();)Dp(Je)}function Dp(r){var s=$p(r.alternate,r,Nt);r.memoizedProps=r.pendingProps,s===null?Lp(r):Je=s,Tu.current=null}function Lp(r){var s=r;do{var a=s.alternate;if(r=s.return,(s.flags&32768)===0){if(a=ux(a,s,Nt),a!==null){Je=a;return}}else{if(a=cx(a,s),a!==null){a.flags&=32767,Je=a;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Xe=6,Je=null;return}}if(s=s.sibling,s!==null){Je=s;return}Je=s=r}while(s!==null);Xe===0&&(Xe=5)}function lr(r,s,a){var c=Ce,f=$t.transition;try{$t.transition=null,Ce=1,vx(r,s,a,c)}finally{$t.transition=f,Ce=c}return null}function vx(r,s,a,c){do Qr();while($n!==null);if((_e&6)!==0)throw Error(n(327));a=r.finishedWork;var f=r.finishedLanes;if(a===null)return null;if(r.finishedWork=null,r.finishedLanes=0,a===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var g=a.lanes|a.childLanes;if(X0(r,g),r===tt&&(Je=tt=null,st=0),(a.subtreeFlags&2064)===0&&(a.flags&2064)===0||Wo||(Wo=!0,Vp(Xi,function(){return Qr(),null})),g=(a.flags&15990)!==0,(a.subtreeFlags&15990)!==0||g){g=$t.transition,$t.transition=null;var x=Ce;Ce=1;var T=_e;_e|=4,Tu.current=null,hx(r,a),Tp(a,r),Uw(Dl),io=!!Il,Dl=Il=null,r.current=a,fx(a),z0(),_e=T,Ce=x,$t.transition=g}else r.current=a;if(Wo&&(Wo=!1,$n=r,Ho=f),g=r.pendingLanes,g===0&&(Un=null),H0(a.stateNode),bt(r,He()),s!==null)for(c=r.onRecoverableError,a=0;a<s.length;a++)f=s[a],c(f.value,{componentStack:f.stack,digest:f.digest});if(qo)throw qo=!1,r=Nu,Nu=null,r;return(Ho&1)!==0&&r.tag!==0&&Qr(),g=r.pendingLanes,(g&1)!==0?r===Au?oi++:(oi=0,Au=r):oi=0,In(),null}function Qr(){if($n!==null){var r=Sh(Ho),s=$t.transition,a=Ce;try{if($t.transition=null,Ce=16>r?16:r,$n===null)var c=!1;else{if(r=$n,$n=null,Ho=0,(_e&6)!==0)throw Error(n(331));var f=_e;for(_e|=4,X=r.current;X!==null;){var g=X,x=g.child;if((X.flags&16)!==0){var T=g.deletions;if(T!==null){for(var C=0;C<T.length;C++){var L=T[C];for(X=L;X!==null;){var W=X;switch(W.tag){case 0:case 11:case 15:ri(8,W,g)}var H=W.child;if(H!==null)H.return=W,X=H;else for(;X!==null;){W=X;var q=W.sibling,Q=W.return;if(bp(W),W===L){X=null;break}if(q!==null){q.return=Q,X=q;break}X=Q}}}var Z=g.alternate;if(Z!==null){var ee=Z.child;if(ee!==null){Z.child=null;do{var Ke=ee.sibling;ee.sibling=null,ee=Ke}while(ee!==null)}}X=g}}if((g.subtreeFlags&2064)!==0&&x!==null)x.return=g,X=x;else e:for(;X!==null;){if(g=X,(g.flags&2048)!==0)switch(g.tag){case 0:case 11:case 15:ri(9,g,g.return)}var O=g.sibling;if(O!==null){O.return=g.return,X=O;break e}X=g.return}}var A=r.current;for(X=A;X!==null;){x=X;var I=x.child;if((x.subtreeFlags&2064)!==0&&I!==null)I.return=x,X=I;else e:for(x=A;X!==null;){if(T=X,(T.flags&2048)!==0)try{switch(T.tag){case 0:case 11:case 15:Fo(9,T)}}catch(te){ze(T,T.return,te)}if(T===x){X=null;break e}var G=T.sibling;if(G!==null){G.return=T.return,X=G;break e}X=T.return}}if(_e=f,In(),tn&&typeof tn.onPostCommitFiberRoot=="function")try{tn.onPostCommitFiberRoot(Zi,r)}catch{}c=!0}return c}finally{Ce=a,$t.transition=s}}return!1}function Mp(r,s,a){s=Kr(a,s),s=tp(r,s,1),r=Ln(r,s,1),s=gt(),r!==null&&(As(r,1,s),bt(r,s))}function ze(r,s,a){if(r.tag===3)Mp(r,r,a);else for(;s!==null;){if(s.tag===3){Mp(s,r,a);break}else if(s.tag===1){var c=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Un===null||!Un.has(c))){r=Kr(a,r),r=np(s,r,1),s=Ln(s,r,1),r=gt(),s!==null&&(As(s,1,r),bt(s,r));break}}s=s.return}}function wx(r,s,a){var c=r.pingCache;c!==null&&c.delete(s),s=gt(),r.pingedLanes|=r.suspendedLanes&a,tt===r&&(st&a)===a&&(Xe===4||Xe===3&&(st&130023424)===st&&500>He()-Cu?ar(r,0):ju|=a),bt(r,s)}function Up(r,s){s===0&&((r.mode&1)===0?s=1:(s=to,to<<=1,(to&130023424)===0&&(to=4194304)));var a=gt();r=pn(r,s),r!==null&&(As(r,s,a),bt(r,a))}function xx(r){var s=r.memoizedState,a=0;s!==null&&(a=s.retryLane),Up(r,a)}function bx(r,s){var a=0;switch(r.tag){case 13:var c=r.stateNode,f=r.memoizedState;f!==null&&(a=f.retryLane);break;case 19:c=r.stateNode;break;default:throw Error(n(314))}c!==null&&c.delete(s),Up(r,a)}var $p;$p=function(r,s,a){if(r!==null)if(r.memoizedProps!==s.pendingProps||yt.current)wt=!0;else{if((r.lanes&a)===0&&(s.flags&128)===0)return wt=!1,lx(r,s,a);wt=(r.flags&131072)!==0}else wt=!1,Ue&&(s.flags&1048576)!==0&&vf(s,ko,s.index);switch(s.lanes=0,s.tag){case 2:var c=s.type;$o(r,s),r=s.pendingProps;var f=$r(s,lt.current);Wr(s,a),f=iu(null,s,c,r,f,a);var g=ou();return s.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,vt(c)?(g=!0,bo(s)):g=!1,s.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Xl(s),f.updater=Mo,s.stateNode=f,f._reactInternals=s,hu(s,c,r,a),s=gu(null,s,c,!0,g,a)):(s.tag=0,Ue&&g&&Bl(s),mt(null,s,f,a),s=s.child),s;case 16:c=s.elementType;e:{switch($o(r,s),r=s.pendingProps,f=c._init,c=f(c._payload),s.type=c,f=s.tag=Sx(c),r=Ht(c,r),f){case 0:s=mu(null,s,c,r,a);break e;case 1:s=dp(null,s,c,r,a);break e;case 11:s=op(null,s,c,r,a);break e;case 14:s=ap(null,s,c,Ht(c.type,r),a);break e}throw Error(n(306,c,""))}return s;case 0:return c=s.type,f=s.pendingProps,f=s.elementType===c?f:Ht(c,f),mu(r,s,c,f,a);case 1:return c=s.type,f=s.pendingProps,f=s.elementType===c?f:Ht(c,f),dp(r,s,c,f,a);case 3:e:{if(hp(s),r===null)throw Error(n(387));c=s.pendingProps,g=s.memoizedState,f=g.element,jf(r,s),Ao(s,c,null,a);var x=s.memoizedState;if(c=x.element,g.isDehydrated)if(g={element:c,isDehydrated:!1,cache:x.cache,pendingSuspenseBoundaries:x.pendingSuspenseBoundaries,transitions:x.transitions},s.updateQueue.baseState=g,s.memoizedState=g,s.flags&256){f=Kr(Error(n(423)),s),s=fp(r,s,c,a,f);break e}else if(c!==f){f=Kr(Error(n(424)),s),s=fp(r,s,c,a,f);break e}else for(Ct=Pn(s.stateNode.containerInfo.firstChild),jt=s,Ue=!0,Wt=null,a=Ef(s,null,c,a),s.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Br(),c===f){s=gn(r,s,a);break e}mt(r,s,c,a)}s=s.child}return s;case 5:return Af(s),r===null&&Wl(s),c=s.type,f=s.pendingProps,g=r!==null?r.memoizedProps:null,x=f.children,Ll(c,f)?x=null:g!==null&&Ll(c,g)&&(s.flags|=32),cp(r,s),mt(r,s,x,a),s.child;case 6:return r===null&&Wl(s),null;case 13:return pp(r,s,a);case 4:return Zl(s,s.stateNode.containerInfo),c=s.pendingProps,r===null?s.child=zr(s,null,c,a):mt(r,s,c,a),s.child;case 11:return c=s.type,f=s.pendingProps,f=s.elementType===c?f:Ht(c,f),op(r,s,c,f,a);case 7:return mt(r,s,s.pendingProps,a),s.child;case 8:return mt(r,s,s.pendingProps.children,a),s.child;case 12:return mt(r,s,s.pendingProps.children,a),s.child;case 10:e:{if(c=s.type._context,f=s.pendingProps,g=s.memoizedProps,x=f.value,Ae(jo,c._currentValue),c._currentValue=x,g!==null)if(qt(g.value,x)){if(g.children===f.children&&!yt.current){s=gn(r,s,a);break e}}else for(g=s.child,g!==null&&(g.return=s);g!==null;){var T=g.dependencies;if(T!==null){x=g.child;for(var C=T.firstContext;C!==null;){if(C.context===c){if(g.tag===1){C=mn(-1,a&-a),C.tag=2;var L=g.updateQueue;if(L!==null){L=L.shared;var W=L.pending;W===null?C.next=C:(C.next=W.next,W.next=C),L.pending=C}}g.lanes|=a,C=g.alternate,C!==null&&(C.lanes|=a),Yl(g.return,a,s),T.lanes|=a;break}C=C.next}}else if(g.tag===10)x=g.type===s.type?null:g.child;else if(g.tag===18){if(x=g.return,x===null)throw Error(n(341));x.lanes|=a,T=x.alternate,T!==null&&(T.lanes|=a),Yl(x,a,s),x=g.sibling}else x=g.child;if(x!==null)x.return=g;else for(x=g;x!==null;){if(x===s){x=null;break}if(g=x.sibling,g!==null){g.return=x.return,x=g;break}x=x.return}g=x}mt(r,s,f.children,a),s=s.child}return s;case 9:return f=s.type,c=s.pendingProps.children,Wr(s,a),f=Mt(f),c=c(f),s.flags|=1,mt(r,s,c,a),s.child;case 14:return c=s.type,f=Ht(c,s.pendingProps),f=Ht(c.type,f),ap(r,s,c,f,a);case 15:return lp(r,s,s.type,s.pendingProps,a);case 17:return c=s.type,f=s.pendingProps,f=s.elementType===c?f:Ht(c,f),$o(r,s),s.tag=1,vt(c)?(r=!0,bo(s)):r=!1,Wr(s,a),Zf(s,c,f),hu(s,c,f,a),gu(null,s,c,!0,r,a);case 19:return gp(r,s,a);case 22:return up(r,s,a)}throw Error(n(156,s.tag))};function Vp(r,s){return vh(r,s)}function _x(r,s,a,c){this.tag=r,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vt(r,s,a,c){return new _x(r,s,a,c)}function Lu(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Sx(r){if(typeof r=="function")return Lu(r)?1:0;if(r!=null){if(r=r.$$typeof,r===ve)return 11;if(r===Oe)return 14}return 2}function Bn(r,s){var a=r.alternate;return a===null?(a=Vt(r.tag,s,r.key,r.mode),a.elementType=r.elementType,a.type=r.type,a.stateNode=r.stateNode,a.alternate=r,r.alternate=a):(a.pendingProps=s,a.type=r.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=r.flags&14680064,a.childLanes=r.childLanes,a.lanes=r.lanes,a.child=r.child,a.memoizedProps=r.memoizedProps,a.memoizedState=r.memoizedState,a.updateQueue=r.updateQueue,s=r.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},a.sibling=r.sibling,a.index=r.index,a.ref=r.ref,a}function Yo(r,s,a,c,f,g){var x=2;if(c=r,typeof r=="function")Lu(r)&&(x=1);else if(typeof r=="string")x=5;else e:switch(r){case $:return ur(a.children,f,g,s);case B:x=8,f|=8;break;case Y:return r=Vt(12,a,s,f|2),r.elementType=Y,r.lanes=g,r;case je:return r=Vt(13,a,s,f),r.elementType=je,r.lanes=g,r;case xe:return r=Vt(19,a,s,f),r.elementType=xe,r.lanes=g,r;case pe:return Qo(a,f,g,s);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case oe:x=10;break e;case Te:x=9;break e;case ve:x=11;break e;case Oe:x=14;break e;case be:x=16,c=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return s=Vt(x,a,s,f),s.elementType=r,s.type=c,s.lanes=g,s}function ur(r,s,a,c){return r=Vt(7,r,c,s),r.lanes=a,r}function Qo(r,s,a,c){return r=Vt(22,r,c,s),r.elementType=pe,r.lanes=a,r.stateNode={isHidden:!1},r}function Mu(r,s,a){return r=Vt(6,r,null,s),r.lanes=a,r}function Uu(r,s,a){return s=Vt(4,r.children!==null?r.children:[],r.key,s),s.lanes=a,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}function kx(r,s,a,c,f){this.tag=s,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=dl(0),this.expirationTimes=dl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dl(0),this.identifierPrefix=c,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function $u(r,s,a,c,f,g,x,T,C){return r=new kx(r,s,a,T,C),s===1?(s=1,g===!0&&(s|=8)):s=0,g=Vt(3,null,null,s),r.current=g,g.stateNode=r,g.memoizedState={element:c,isDehydrated:a,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xl(g),r}function Ex(r,s,a){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:z,key:c==null?null:""+c,children:r,containerInfo:s,implementation:a}}function Fp(r){if(!r)return On;r=r._reactInternals;e:{if(Qn(r)!==r||r.tag!==1)throw Error(n(170));var s=r;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(vt(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(n(171))}if(r.tag===1){var a=r.type;if(vt(a))return mf(r,a,s)}return s}function Bp(r,s,a,c,f,g,x,T,C){return r=$u(a,c,!0,r,f,g,x,T,C),r.context=Fp(null),a=r.current,c=gt(),f=Vn(a),g=mn(c,f),g.callback=s??null,Ln(a,g,f),r.current.lanes=f,As(r,f,c),bt(r,c),r}function Xo(r,s,a,c){var f=s.current,g=gt(),x=Vn(f);return a=Fp(a),s.context===null?s.context=a:s.pendingContext=a,s=mn(g,x),s.payload={element:r},c=c===void 0?null:c,c!==null&&(s.callback=c),r=Ln(f,s,x),r!==null&&(Jt(r,f,x,g),No(r,f,x)),x}function Zo(r){return r=r.current,r.child?(r.child.tag===5,r.child.stateNode):null}function zp(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var a=r.retryLane;r.retryLane=a!==0&&a<s?a:s}}function Vu(r,s){zp(r,s),(r=r.alternate)&&zp(r,s)}function Tx(){return null}var qp=typeof reportError=="function"?reportError:function(r){console.error(r)};function Fu(r){this._internalRoot=r}ea.prototype.render=Fu.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(n(409));Xo(r,s,null,null)},ea.prototype.unmount=Fu.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;or(function(){Xo(null,r,null,null)}),s[cn]=null}};function ea(r){this._internalRoot=r}ea.prototype.unstable_scheduleHydration=function(r){if(r){var s=Th();r={blockedOn:null,target:r,priority:s};for(var a=0;a<Cn.length&&s!==0&&s<Cn[a].priority;a++);Cn.splice(a,0,r),a===0&&Nh(r)}};function Bu(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function ta(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Wp(){}function jx(r,s,a,c,f){if(f){if(typeof c=="function"){var g=c;c=function(){var L=Zo(x);g.call(L)}}var x=Bp(s,c,r,0,null,!1,!1,"",Wp);return r._reactRootContainer=x,r[cn]=x.current,qs(r.nodeType===8?r.parentNode:r),or(),x}for(;f=r.lastChild;)r.removeChild(f);if(typeof c=="function"){var T=c;c=function(){var L=Zo(C);T.call(L)}}var C=$u(r,0,!1,null,null,!1,!1,"",Wp);return r._reactRootContainer=C,r[cn]=C.current,qs(r.nodeType===8?r.parentNode:r),or(function(){Xo(s,C,a,c)}),C}function na(r,s,a,c,f){var g=a._reactRootContainer;if(g){var x=g;if(typeof f=="function"){var T=f;f=function(){var C=Zo(x);T.call(C)}}Xo(s,x,r,f)}else x=jx(a,s,r,f,c);return Zo(x)}kh=function(r){switch(r.tag){case 3:var s=r.stateNode;if(s.current.memoizedState.isDehydrated){var a=Ns(s.pendingLanes);a!==0&&(hl(s,a|1),bt(s,He()),(_e&6)===0&&(Yr=He()+500,In()))}break;case 13:or(function(){var c=pn(r,1);if(c!==null){var f=gt();Jt(c,r,1,f)}}),Vu(r,1)}},fl=function(r){if(r.tag===13){var s=pn(r,134217728);if(s!==null){var a=gt();Jt(s,r,134217728,a)}Vu(r,134217728)}},Eh=function(r){if(r.tag===13){var s=Vn(r),a=pn(r,s);if(a!==null){var c=gt();Jt(a,r,s,c)}Vu(r,s)}},Th=function(){return Ce},jh=function(r,s){var a=Ce;try{return Ce=r,s()}finally{Ce=a}},il=function(r,s,a){switch(s){case"input":if(Qa(r,a),s=a.name,a.type==="radio"&&s!=null){for(a=r;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<a.length;s++){var c=a[s];if(c!==r&&c.form===r.form){var f=wo(c);if(!f)throw Error(n(90));Qd(c),Qa(c,f)}}}break;case"textarea":nh(r,a);break;case"select":s=a.value,s!=null&&jr(r,!!a.multiple,s,!1)}},dh=Ou,hh=or;var Cx={usingClientEntryPoint:!1,Events:[Ks,Mr,wo,uh,ch,Ou]},ai={findFiberByHostInstance:Xn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Nx={bundleType:ai.bundleType,version:ai.version,rendererPackageName:ai.rendererPackageName,rendererConfig:ai.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:U.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=gh(r),r===null?null:r.stateNode},findFiberByHostInstance:ai.findFiberByHostInstance||Tx,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ra=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ra.isDisabled&&ra.supportsFiber)try{Zi=ra.inject(Nx),tn=ra}catch{}}return _t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Cx,_t.createPortal=function(r,s){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Bu(s))throw Error(n(200));return Ex(r,s,null,a)},_t.createRoot=function(r,s){if(!Bu(r))throw Error(n(299));var a=!1,c="",f=qp;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(c=s.identifierPrefix),s.onRecoverableError!==void 0&&(f=s.onRecoverableError)),s=$u(r,1,!1,null,null,a,!1,c,f),r[cn]=s.current,qs(r.nodeType===8?r.parentNode:r),new Fu(s)},_t.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var s=r._reactInternals;if(s===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=gh(s),r=r===null?null:r.stateNode,r},_t.flushSync=function(r){return or(r)},_t.hydrate=function(r,s,a){if(!ta(s))throw Error(n(200));return na(null,r,s,!0,a)},_t.hydrateRoot=function(r,s,a){if(!Bu(r))throw Error(n(405));var c=a!=null&&a.hydratedSources||null,f=!1,g="",x=qp;if(a!=null&&(a.unstable_strictMode===!0&&(f=!0),a.identifierPrefix!==void 0&&(g=a.identifierPrefix),a.onRecoverableError!==void 0&&(x=a.onRecoverableError)),s=Bp(s,null,r,1,a??null,f,!1,g,x),r[cn]=s.current,qs(r),c)for(r=0;r<c.length;r++)a=c[r],f=a._getVersion,f=f(a._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[a,f]:s.mutableSourceEagerHydrationData.push(a,f);return new ea(s)},_t.render=function(r,s,a){if(!ta(s))throw Error(n(200));return na(null,r,s,!1,a)},_t.unmountComponentAtNode=function(r){if(!ta(r))throw Error(n(40));return r._reactRootContainer?(or(function(){na(null,null,r,!1,function(){r._reactRootContainer=null,r[cn]=null})}),!0):!1},_t.unstable_batchedUpdates=Ou,_t.unstable_renderSubtreeIntoContainer=function(r,s,a,c){if(!ta(a))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return na(r,s,a,!1,c)},_t.version="18.3.1-next-f1338f8080-20240426",_t}var Zp;function Mx(){if(Zp)return Wu.exports;Zp=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Wu.exports=Lx(),Wu.exports}var em;function Ux(){if(em)return sa;em=1;var t=Mx();return sa.createRoot=t.createRoot,sa.hydrateRoot=t.hydrateRoot,sa}var $x=Ux();const Vx=uy($x);var Fx={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"};const Bx=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),se=(t,e)=>{const n=R.forwardRef(({color:i="currentColor",size:o=24,strokeWidth:l=2,absoluteStrokeWidth:u,className:d="",children:h,...m},y)=>R.createElement("svg",{ref:y,...Fx,width:o,height:o,stroke:i,strokeWidth:u?Number(l)*24/Number(o):l,className:["lucide",`lucide-${Bx(t)}`,d].join(" "),...m},[...e.map(([v,w])=>R.createElement(v,w)),...Array.isArray(h)?h:[h]]));return n.displayName=`${t}`,n};const zx=se("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]);const Mi=se("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const qx=se("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Wx=se("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);const Hx=se("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const Kx=se("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Gx=se("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);const Jx=se("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);const Yx=se("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);const Qx=se("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);const Xx=se("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"}]]);const rd=se("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"}]]);const Si=se("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const _c=se("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const tm=se("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const Zx=se("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const e1=se("Chrome",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["line",{x1:"21.17",x2:"12",y1:"8",y2:"8",key:"a0cw5f"}],["line",{x1:"3.95",x2:"8.54",y1:"6.06",y2:"14",key:"1kftof"}],["line",{x1:"10.88",x2:"15.46",y1:"21.94",y2:"14",key:"1ymyh8"}]]);const ps=se("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const cy=se("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const dy=se("Cpu",[["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"9",y:"9",width:"6",height:"6",key:"o3kz5p"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);const ki=se("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);const nm=se("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);const Ia=se("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const t1=se("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);const n1=se("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);const r1=se("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);const Gu=se("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);const hy=se("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const s1=se("KeyRound",[["path",{d:"M2 18v3c0 .6.4 1 1 1h4v-3h3v-3h2l1.4-1.4a6.5 6.5 0 1 0-4-4Z",key:"167ctg"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);const i1=se("Key",[["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["path",{d:"m15.5 7.5 3 3L22 7l-3-3",key:"1rn1fs"}]]);const o1=se("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);const wn=se("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const a1=se("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);const rm=se("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);const sm=se("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"}]]);const l1=se("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);const u1=se("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);const c1=se("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);const d1=se("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const sd=se("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);const h1=se("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);const ba=se("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);const Sc=se("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const f1=se("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"}]]);const fy=se("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);const p1=se("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);const m1=se("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"}]]);const kc=se("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);const g1=se("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"}]]);const y1=se("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);const id=se("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"}]]);const im=se("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"}]]);const om=se("VolumeX",[["polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5",key:"16drj5"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);const am=se("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"}]]);const Sr=se("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const kr=se("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),od=R.createContext({});function ad(t){const e=R.useRef(null);return e.current===null&&(e.current=t()),e.current}const Da=R.createContext(null),ld=R.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class v1 extends R.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const i=this.props.sizeRef.current;i.height=n.offsetHeight||0,i.width=n.offsetWidth||0,i.top=n.offsetTop,i.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function w1({children:t,isPresent:e}){const n=R.useId(),i=R.useRef(null),o=R.useRef({width:0,height:0,top:0,left:0}),{nonce:l}=R.useContext(ld);return R.useInsertionEffect(()=>{const{width:u,height:d,top:h,left:m}=o.current;if(e||!i.current||!u||!d)return;i.current.dataset.motionPopId=n;const y=document.createElement("style");return l&&(y.nonce=l),document.head.appendChild(y),y.sheet&&y.sheet.insertRule(`
9
9
  [data-motion-pop-id="${n}"] {
10
10
  position: absolute !important;
11
11
  width: ${u}px !important;
@@ -13,24 +13,24 @@ Error generating stack: `+g.message+`
13
13
  top: ${h}px !important;
14
14
  left: ${m}px !important;
15
15
  }
16
- `),()=>{document.head.removeChild(y)}},[e]),p.jsx(v1,{isPresent:e,childRef:i,sizeRef:o,children:R.cloneElement(t,{ref:i})})}const x1=({children:t,initial:e,isPresent:n,onExitComplete:i,custom:o,presenceAffectsLayout:l,mode:u})=>{const d=ad(b1),h=R.useId(),m=R.useCallback(v=>{d.set(v,!0);for(const w of d.values())if(!w)return;i&&i()},[d,i]),y=R.useMemo(()=>({id:h,initial:e,isPresent:n,custom:o,onExitComplete:m,register:v=>(d.set(v,!1),()=>d.delete(v))}),l?[Math.random(),m]:[n,m]);return R.useMemo(()=>{d.forEach((v,w)=>d.set(w,!1))},[n]),R.useEffect(()=>{!n&&!d.size&&i&&i()},[n]),u==="popLayout"&&(t=p.jsx(w1,{isPresent:n,children:t})),p.jsx(Ia.Provider,{value:y,children:t})};function b1(){return new Map}function py(t=!0){const e=R.useContext(Ia);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:o}=e,l=R.useId();R.useEffect(()=>{t&&o(l)},[t]);const u=R.useCallback(()=>t&&i&&i(l),[l,i,t]);return!n&&i?[!1,u]:[!0]}const ia=t=>t.key||"";function lm(t){const e=[];return R.Children.forEach(t,n=>{R.isValidElement(n)&&e.push(n)}),e}const ud=typeof window<"u",my=ud?R.useLayoutEffect:R.useEffect,bn=({children:t,custom:e,initial:n=!0,onExitComplete:i,presenceAffectsLayout:o=!0,mode:l="sync",propagate:u=!1})=>{const[d,h]=py(u),m=R.useMemo(()=>lm(t),[t]),y=u&&!d?[]:m.map(ia),v=R.useRef(!0),w=R.useRef(m),_=ad(()=>new Map),[b,k]=R.useState(m),[S,E]=R.useState(m);my(()=>{v.current=!1,w.current=m;for(let U=0;U<S.length;U++){const V=ia(S[U]);y.includes(V)?_.delete(V):_.get(V)!==!0&&_.set(V,!1)}},[S,y.length,y.join("-")]);const A=[];if(m!==b){let U=[...m];for(let V=0;V<S.length;V++){const z=S[V],$=ia(z);y.includes($)||(U.splice(V,0,z),A.push(z))}l==="wait"&&A.length&&(U=A),E(lm(U)),k(m);return}const{forceRender:P}=R.useContext(od);return p.jsx(p.Fragment,{children:S.map(U=>{const V=ia(U),z=u&&!d?!1:m===S||y.includes(V),$=()=>{if(_.has(V))_.set(V,!0);else return;let B=!0;_.forEach(Y=>{Y||(B=!1)}),B&&(P?.(),E(w.current),u&&h?.(),i&&i())};return p.jsx(x1,{isPresent:z,initial:!v.current||n?void 0:!1,custom:z?void 0:e,presenceAffectsLayout:o,mode:l,onExitComplete:z?void 0:$,children:U},V)})})},Ot=t=>t;let gy=Ot;function cd(t){let e;return()=>(e===void 0&&(e=t()),e)}const ms=(t,e,n)=>{const i=e-t;return i===0?1:(n-t)/i},wn=t=>t*1e3,xn=t=>t/1e3,_1={useManualTiming:!1};function S1(t){let e=new Set,n=new Set,i=!1,o=!1;const l=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function d(m){l.has(m)&&(h.schedule(m),t()),m(u)}const h={schedule:(m,y=!1,v=!1)=>{const _=v&&i?e:n;return y&&l.add(m),_.has(m)||_.add(m),m},cancel:m=>{n.delete(m),l.delete(m)},process:m=>{if(u=m,i){o=!0;return}i=!0,[e,n]=[n,e],e.forEach(d),e.clear(),i=!1,o&&(o=!1,h.process(m))}};return h}const oa=["read","resolveKeyframes","update","preRender","render","postRender"],k1=40;function yy(t,e){let n=!1,i=!0;const o={delta:0,timestamp:0,isProcessing:!1},l=()=>n=!0,u=oa.reduce((E,A)=>(E[A]=S1(l),E),{}),{read:d,resolveKeyframes:h,update:m,preRender:y,render:v,postRender:w}=u,_=()=>{const E=performance.now();n=!1,o.delta=i?1e3/60:Math.max(Math.min(E-o.timestamp,k1),1),o.timestamp=E,o.isProcessing=!0,d.process(o),h.process(o),m.process(o),y.process(o),v.process(o),w.process(o),o.isProcessing=!1,n&&e&&(i=!1,t(_))},b=()=>{n=!0,i=!0,o.isProcessing||t(_)};return{schedule:oa.reduce((E,A)=>{const P=u[A];return E[A]=(U,V=!1,z=!1)=>(n||b(),P.schedule(U,V,z)),E},{}),cancel:E=>{for(let A=0;A<oa.length;A++)u[oa[A]].cancel(E)},state:o,steps:u}}const{schedule:Le,cancel:Gn,state:at,steps:Gu}=yy(typeof requestAnimationFrame<"u"?requestAnimationFrame:Ot,!0),vy=R.createContext({strict:!1}),um={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"]},gs={};for(const t in um)gs[t]={isEnabled:e=>um[t].some(n=>!!e[n])};function E1(t){for(const e in t)gs[e]={...gs[e],...t[e]}}const T1=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function ba(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||T1.has(t)}let wy=t=>!ba(t);function j1(t){t&&(wy=e=>e.startsWith("on")?!ba(e):t(e))}try{j1(require("@emotion/is-prop-valid").default)}catch{}function C1(t,e,n){const i={};for(const o in t)o==="values"&&typeof t.values=="object"||(wy(o)||n===!0&&ba(o)||!e&&!ba(o)||t.draggable&&o.startsWith("onDrag"))&&(i[o]=t[o]);return i}function N1(t){if(typeof Proxy>"u")return t;const e=new Map,n=(...i)=>t(...i);return new Proxy(n,{get:(i,o)=>o==="create"?t:(e.has(o)||e.set(o,t(o)),e.get(o))})}const Da=R.createContext({});function Ei(t){return typeof t=="string"||Array.isArray(t)}function La(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const dd=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],hd=["initial",...dd];function Ma(t){return La(t.animate)||hd.some(e=>Ei(t[e]))}function xy(t){return!!(Ma(t)||t.variants)}function A1(t,e){if(Ma(t)){const{initial:n,animate:i}=t;return{initial:n===!1||Ei(n)?n:void 0,animate:Ei(i)?i:void 0}}return t.inherit!==!1?e:{}}function P1(t){const{initial:e,animate:n}=A1(t,R.useContext(Da));return R.useMemo(()=>({initial:e,animate:n}),[cm(e),cm(n)])}function cm(t){return Array.isArray(t)?t.join(" "):t}const R1=Symbol.for("motionComponentSymbol");function os(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function O1(t,e,n){return R.useCallback(i=>{i&&t.onMount&&t.onMount(i),e&&(i?e.mount(i):e.unmount()),n&&(typeof n=="function"?n(i):os(n)&&(n.current=i))},[e])}const fd=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),I1="framerAppearId",by="data-"+fd(I1),{schedule:pd}=yy(queueMicrotask,!1),_y=R.createContext({});function D1(t,e,n,i,o){var l,u;const{visualElement:d}=R.useContext(Da),h=R.useContext(vy),m=R.useContext(Ia),y=R.useContext(ld).reducedMotion,v=R.useRef(null);i=i||h.renderer,!v.current&&i&&(v.current=i(t,{visualState:e,parent:d,props:n,presenceContext:m,blockInitialAnimation:m?m.initial===!1:!1,reducedMotionConfig:y}));const w=v.current,_=R.useContext(_y);w&&!w.projection&&o&&(w.type==="html"||w.type==="svg")&&L1(v.current,n,o,_);const b=R.useRef(!1);R.useInsertionEffect(()=>{w&&b.current&&w.update(n,m)});const k=n[by],S=R.useRef(!!k&&!(!((l=window.MotionHandoffIsComplete)===null||l===void 0)&&l.call(window,k))&&((u=window.MotionHasOptimisedAnimation)===null||u===void 0?void 0:u.call(window,k)));return my(()=>{w&&(b.current=!0,window.MotionIsMounted=!0,w.updateFeatures(),pd.render(w.render),S.current&&w.animationState&&w.animationState.animateChanges())}),R.useEffect(()=>{w&&(!S.current&&w.animationState&&w.animationState.animateChanges(),S.current&&(queueMicrotask(()=>{var E;(E=window.MotionHandoffMarkAsComplete)===null||E===void 0||E.call(window,k)}),S.current=!1))}),w}function L1(t,e,n,i){const{layoutId:o,layout:l,drag:u,dragConstraints:d,layoutScroll:h,layoutRoot:m}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Sy(t.parent)),t.projection.setOptions({layoutId:o,layout:l,alwaysMeasureLayout:!!u||d&&os(d),visualElement:t,animationType:typeof l=="string"?l:"both",initialPromotionConfig:i,layoutScroll:h,layoutRoot:m})}function Sy(t){if(t)return t.options.allowProjection!==!1?t.projection:Sy(t.parent)}function M1({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:i,Component:o}){var l,u;t&&E1(t);function d(m,y){let v;const w={...R.useContext(ld),...m,layoutId:U1(m)},{isStatic:_}=w,b=P1(m),k=i(m,_);if(!_&&ud){$1();const S=V1(w);v=S.MeasureLayout,b.visualElement=D1(o,k,w,e,S.ProjectionNode)}return p.jsxs(Da.Provider,{value:b,children:[v&&b.visualElement?p.jsx(v,{visualElement:b.visualElement,...w}):null,n(o,m,O1(k,b.visualElement,y),k,_,b.visualElement)]})}d.displayName=`motion.${typeof o=="string"?o:`create(${(u=(l=o.displayName)!==null&&l!==void 0?l:o.name)!==null&&u!==void 0?u:""})`}`;const h=R.forwardRef(d);return h[R1]=o,h}function U1({layoutId:t}){const e=R.useContext(od).id;return e&&t!==void 0?e+"-"+t:t}function $1(t,e){R.useContext(vy).strict}function V1(t){const{drag:e,layout:n}=gs;if(!e&&!n)return{};const i={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}const F1=["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 md(t){return typeof t!="string"||t.includes("-")?!1:!!(F1.indexOf(t)>-1||/[A-Z]/u.test(t))}function dm(t){const e=[{},{}];return t?.values.forEach((n,i)=>{e[0][i]=n.get(),e[1][i]=n.getVelocity()}),e}function gd(t,e,n,i){if(typeof e=="function"){const[o,l]=dm(i);e=e(n!==void 0?n:t.custom,o,l)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[o,l]=dm(i);e=e(n!==void 0?n:t.custom,o,l)}return e}const kc=t=>Array.isArray(t),B1=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),z1=t=>kc(t)?t[t.length-1]||0:t,pt=t=>!!(t&&t.getVelocity);function ma(t){const e=pt(t)?t.get():t;return B1(e)?e.toValue():e}function q1({scrapeMotionValuesFromProps:t,createRenderState:e,onUpdate:n},i,o,l){const u={latestValues:W1(i,o,l,t),renderState:e()};return n&&(u.onMount=d=>n({props:i,current:d,...u}),u.onUpdate=d=>n(d)),u}const ky=t=>(e,n)=>{const i=R.useContext(Da),o=R.useContext(Ia),l=()=>q1(t,e,i,o);return n?l():ad(l)};function W1(t,e,n,i){const o={},l=i(t,{});for(const w in l)o[w]=ma(l[w]);let{initial:u,animate:d}=t;const h=Ma(t),m=xy(t);e&&m&&!h&&t.inherit!==!1&&(u===void 0&&(u=e.initial),d===void 0&&(d=e.animate));let y=n?n.initial===!1:!1;y=y||u===!1;const v=y?d:u;if(v&&typeof v!="boolean"&&!La(v)){const w=Array.isArray(v)?v:[v];for(let _=0;_<w.length;_++){const b=gd(t,w[_]);if(b){const{transitionEnd:k,transition:S,...E}=b;for(const A in E){let P=E[A];if(Array.isArray(P)){const U=y?P.length-1:0;P=P[U]}P!==null&&(o[A]=P)}for(const A in k)o[A]=k[A]}}}return o}const ws=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Er=new Set(ws),Ey=t=>e=>typeof e=="string"&&e.startsWith(t),Ty=Ey("--"),H1=Ey("var(--"),yd=t=>H1(t)?K1.test(t.split("/*")[0].trim()):!1,K1=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,jy=(t,e)=>e&&typeof t=="number"?e.transform(t):t,_n=(t,e,n)=>n>e?e:n<t?t:n,xs={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Ti={...xs,transform:t=>_n(0,1,t)},aa={...xs,default:1},Ui=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),qn=Ui("deg"),ln=Ui("%"),de=Ui("px"),G1=Ui("vh"),J1=Ui("vw"),hm={...ln,parse:t=>ln.parse(t)/100,transform:t=>ln.transform(t*100)},Y1={borderWidth:de,borderTopWidth:de,borderRightWidth:de,borderBottomWidth:de,borderLeftWidth:de,borderRadius:de,radius:de,borderTopLeftRadius:de,borderTopRightRadius:de,borderBottomRightRadius:de,borderBottomLeftRadius:de,width:de,maxWidth:de,height:de,maxHeight:de,top:de,right:de,bottom:de,left:de,padding:de,paddingTop:de,paddingRight:de,paddingBottom:de,paddingLeft:de,margin:de,marginTop:de,marginRight:de,marginBottom:de,marginLeft:de,backgroundPositionX:de,backgroundPositionY:de},Q1={rotate:qn,rotateX:qn,rotateY:qn,rotateZ:qn,scale:aa,scaleX:aa,scaleY:aa,scaleZ:aa,skew:qn,skewX:qn,skewY:qn,distance:de,translateX:de,translateY:de,translateZ:de,x:de,y:de,z:de,perspective:de,transformPerspective:de,opacity:Ti,originX:hm,originY:hm,originZ:de},fm={...xs,transform:Math.round},vd={...Y1,...Q1,zIndex:fm,size:de,fillOpacity:Ti,strokeOpacity:Ti,numOctaves:fm},X1={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Z1=ws.length;function eb(t,e,n){let i="",o=!0;for(let l=0;l<Z1;l++){const u=ws[l],d=t[u];if(d===void 0)continue;let h=!0;if(typeof d=="number"?h=d===(u.startsWith("scale")?1:0):h=parseFloat(d)===0,!h||n){const m=jy(d,vd[u]);if(!h){o=!1;const y=X1[u]||u;i+=`${y}(${m}) `}n&&(e[u]=m)}}return i=i.trim(),n?i=n(e,o?"":i):o&&(i="none"),i}function wd(t,e,n){const{style:i,vars:o,transformOrigin:l}=t;let u=!1,d=!1;for(const h in e){const m=e[h];if(Er.has(h)){u=!0;continue}else if(Ty(h)){o[h]=m;continue}else{const y=jy(m,vd[h]);h.startsWith("origin")?(d=!0,l[h]=y):i[h]=y}}if(e.transform||(u||n?i.transform=eb(e,t.transform,n):i.transform&&(i.transform="none")),d){const{originX:h="50%",originY:m="50%",originZ:y=0}=l;i.transformOrigin=`${h} ${m} ${y}`}}const tb={offset:"stroke-dashoffset",array:"stroke-dasharray"},nb={offset:"strokeDashoffset",array:"strokeDasharray"};function rb(t,e,n=1,i=0,o=!0){t.pathLength=1;const l=o?tb:nb;t[l.offset]=de.transform(-i);const u=de.transform(e),d=de.transform(n);t[l.array]=`${u} ${d}`}function pm(t,e,n){return typeof t=="string"?t:de.transform(e+n*t)}function sb(t,e,n){const i=pm(e,t.x,t.width),o=pm(n,t.y,t.height);return`${i} ${o}`}function xd(t,{attrX:e,attrY:n,attrScale:i,originX:o,originY:l,pathLength:u,pathSpacing:d=1,pathOffset:h=0,...m},y,v){if(wd(t,m,v),y){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:w,style:_,dimensions:b}=t;w.transform&&(b&&(_.transform=w.transform),delete w.transform),b&&(o!==void 0||l!==void 0||_.transform)&&(_.transformOrigin=sb(b,o!==void 0?o:.5,l!==void 0?l:.5)),e!==void 0&&(w.x=e),n!==void 0&&(w.y=n),i!==void 0&&(w.scale=i),u!==void 0&&rb(w,u,d,h,!1)}const bd=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Cy=()=>({...bd(),attrs:{}}),_d=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Ny(t,{style:e,vars:n},i,o){Object.assign(t.style,e,o&&o.getProjectionStyles(i));for(const l in n)t.style.setProperty(l,n[l])}const Ay=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 Py(t,e,n,i){Ny(t,e,void 0,i);for(const o in e.attrs)t.setAttribute(Ay.has(o)?o:fd(o),e.attrs[o])}const _a={};function ib(t){Object.assign(_a,t)}function Ry(t,{layout:e,layoutId:n}){return Er.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!_a[t]||t==="opacity")}function Sd(t,e,n){var i;const{style:o}=t,l={};for(const u in o)(pt(o[u])||e.style&&pt(e.style[u])||Ry(u,t)||((i=n?.getValue(u))===null||i===void 0?void 0:i.liveStyle)!==void 0)&&(l[u]=o[u]);return l}function Oy(t,e,n){const i=Sd(t,e,n);for(const o in t)if(pt(t[o])||pt(e[o])){const l=ws.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;i[l]=t[o]}return i}function ob(t,e){try{e.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{e.dimensions={x:0,y:0,width:0,height:0}}}const mm=["x","y","width","height","cx","cy","r"],ab={useVisualState:ky({scrapeMotionValuesFromProps:Oy,createRenderState:Cy,onUpdate:({props:t,prevProps:e,current:n,renderState:i,latestValues:o})=>{if(!n)return;let l=!!t.drag;if(!l){for(const d in o)if(Er.has(d)){l=!0;break}}if(!l)return;let u=!e;if(e)for(let d=0;d<mm.length;d++){const h=mm[d];t[h]!==e[h]&&(u=!0)}u&&Le.read(()=>{ob(n,i),Le.render(()=>{xd(i,o,_d(n.tagName),t.transformTemplate),Py(n,i)})})}})},lb={useVisualState:ky({scrapeMotionValuesFromProps:Sd,createRenderState:bd})};function Iy(t,e,n){for(const i in e)!pt(e[i])&&!Ry(i,n)&&(t[i]=e[i])}function ub({transformTemplate:t},e){return R.useMemo(()=>{const n=bd();return wd(n,e,t),Object.assign({},n.vars,n.style)},[e])}function cb(t,e){const n=t.style||{},i={};return Iy(i,n,t),Object.assign(i,ub(t,e)),i}function db(t,e){const n={},i=cb(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=i,n}function hb(t,e,n,i){const o=R.useMemo(()=>{const l=Cy();return xd(l,e,_d(i),t.transformTemplate),{...l.attrs,style:{...l.style}}},[e]);if(t.style){const l={};Iy(l,t.style,t),o.style={...l,...o.style}}return o}function fb(t=!1){return(n,i,o,{latestValues:l},u)=>{const h=(md(n)?hb:db)(i,l,u,n),m=C1(i,typeof n=="string",t),y=n!==R.Fragment?{...m,...h,ref:o}:{},{children:v}=i,w=R.useMemo(()=>pt(v)?v.get():v,[v]);return R.createElement(n,{...y,children:w})}}function pb(t,e){return function(i,{forwardMotionProps:o}={forwardMotionProps:!1}){const u={...md(i)?ab:lb,preloadedFeatures:t,useRender:fb(o),createVisualElement:e,Component:i};return M1(u)}}function Dy(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}function Ua(t,e,n){const i=t.getProps();return gd(i,e,n!==void 0?n:i.custom,t)}const mb=cd(()=>window.ScrollTimeline!==void 0);class gb{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>"finished"in e?e.finished:e))}getAll(e){return this.animations[0][e]}setAll(e,n){for(let i=0;i<this.animations.length;i++)this.animations[i][e]=n}attachTimeline(e,n){const i=this.animations.map(o=>{if(mb()&&o.attachTimeline)return o.attachTimeline(e);if(typeof n=="function")return n(o)});return()=>{i.forEach((o,l)=>{o&&o(),this.animations[l].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let n=0;n<this.animations.length;n++)e=Math.max(e,this.animations[n].duration);return e}runAll(e){this.animations.forEach(n=>n[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class yb extends gb{then(e,n){return Promise.all(this.animations).then(e).catch(n)}}function kd(t,e){return t?t[e]||t.default||t:void 0}const Ec=2e4;function Ly(t){let e=0;const n=50;let i=t.next(e);for(;!i.done&&e<Ec;)e+=n,i=t.next(e);return e>=Ec?1/0:e}function Ed(t){return typeof t=="function"}function gm(t,e){t.timeline=e,t.onfinish=null}const Td=t=>Array.isArray(t)&&typeof t[0]=="number",vb={linearEasing:void 0};function wb(t,e){const n=cd(t);return()=>{var i;return(i=vb[e])!==null&&i!==void 0?i:n()}}const Sa=wb(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),My=(t,e,n=10)=>{let i="";const o=Math.max(Math.round(e/n),2);for(let l=0;l<o;l++)i+=t(ms(0,o-1,l))+", ";return`linear(${i.substring(0,i.length-2)})`};function Uy(t){return!!(typeof t=="function"&&Sa()||!t||typeof t=="string"&&(t in Tc||Sa())||Td(t)||Array.isArray(t)&&t.every(Uy))}const hi=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,Tc={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:hi([0,.65,.55,1]),circOut:hi([.55,0,1,.45]),backIn:hi([.31,.01,.66,-.59]),backOut:hi([.33,1.53,.69,.99])};function $y(t,e){if(t)return typeof t=="function"&&Sa()?My(t,e):Td(t)?hi(t):Array.isArray(t)?t.map(n=>$y(n,e)||Tc.easeOut):Tc[t]}const Qt={x:!1,y:!1};function Vy(){return Qt.x||Qt.y}function xb(t,e,n){var i;if(t instanceof Element)return[t];if(typeof t=="string"){let o=document;const l=(i=void 0)!==null&&i!==void 0?i:o.querySelectorAll(t);return l?Array.from(l):[]}return Array.from(t)}function Fy(t,e){const n=xb(t),i=new AbortController,o={passive:!0,...e,signal:i.signal};return[n,o,()=>i.abort()]}function ym(t){return e=>{e.pointerType==="touch"||Vy()||t(e)}}function bb(t,e,n={}){const[i,o,l]=Fy(t,n),u=ym(d=>{const{target:h}=d,m=e(d);if(typeof m!="function"||!h)return;const y=ym(v=>{m(v),h.removeEventListener("pointerleave",y)});h.addEventListener("pointerleave",y,o)});return i.forEach(d=>{d.addEventListener("pointerenter",u,o)}),l}const By=(t,e)=>e?t===e?!0:By(t,e.parentElement):!1,jd=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,_b=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Sb(t){return _b.has(t.tagName)||t.tabIndex!==-1}const fi=new WeakSet;function vm(t){return e=>{e.key==="Enter"&&t(e)}}function Ju(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const kb=(t,e)=>{const n=t.currentTarget;if(!n)return;const i=vm(()=>{if(fi.has(n))return;Ju(n,"down");const o=vm(()=>{Ju(n,"up")}),l=()=>Ju(n,"cancel");n.addEventListener("keyup",o,e),n.addEventListener("blur",l,e)});n.addEventListener("keydown",i,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),e)};function wm(t){return jd(t)&&!Vy()}function Eb(t,e,n={}){const[i,o,l]=Fy(t,n),u=d=>{const h=d.currentTarget;if(!wm(d)||fi.has(h))return;fi.add(h);const m=e(d),y=(_,b)=>{window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",w),!(!wm(_)||!fi.has(h))&&(fi.delete(h),typeof m=="function"&&m(_,{success:b}))},v=_=>{y(_,n.useGlobalTarget||By(h,_.target))},w=_=>{y(_,!1)};window.addEventListener("pointerup",v,o),window.addEventListener("pointercancel",w,o)};return i.forEach(d=>{!Sb(d)&&d.getAttribute("tabindex")===null&&(d.tabIndex=0),(n.useGlobalTarget?window:d).addEventListener("pointerdown",u,o),d.addEventListener("focus",m=>kb(m,o),o)}),l}function Tb(t){return t==="x"||t==="y"?Qt[t]?null:(Qt[t]=!0,()=>{Qt[t]=!1}):Qt.x||Qt.y?null:(Qt.x=Qt.y=!0,()=>{Qt.x=Qt.y=!1})}const zy=new Set(["width","height","top","left","right","bottom",...ws]);let ga;function jb(){ga=void 0}const un={now:()=>(ga===void 0&&un.set(at.isProcessing||_1.useManualTiming?at.timestamp:performance.now()),ga),set:t=>{ga=t,queueMicrotask(jb)}};function Cd(t,e){t.indexOf(e)===-1&&t.push(e)}function Nd(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class Ad{constructor(){this.subscriptions=[]}add(e){return Cd(this.subscriptions,e),()=>Nd(this.subscriptions,e)}notify(e,n,i){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](e,n,i);else for(let l=0;l<o;l++){const u=this.subscriptions[l];u&&u(e,n,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function qy(t,e){return e?t*(1e3/e):0}const xm=30,Cb=t=>!isNaN(parseFloat(t));class Nb{constructor(e,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(i,o=!0)=>{const l=un.now();this.updatedAt!==l&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),o&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=un.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Cb(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new Ad);const i=this.events[e].add(n);return e==="change"?()=>{i(),Le.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,i){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-i}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=un.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>xm)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,xm);return qy(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),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 ji(t,e){return new Nb(t,e)}function Ab(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,ji(n))}function Pb(t,e){const n=Ua(t,e);let{transitionEnd:i={},transition:o={},...l}=n||{};l={...l,...i};for(const u in l){const d=z1(l[u]);Ab(t,u,d)}}function Rb(t){return!!(pt(t)&&t.add)}function jc(t,e){const n=t.getValue("willChange");if(Rb(n))return n.add(e)}function Wy(t){return t.props[by]}const Hy=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Ob=1e-7,Ib=12;function Db(t,e,n,i,o){let l,u,d=0;do u=e+(n-e)/2,l=Hy(u,i,o)-t,l>0?n=u:e=u;while(Math.abs(l)>Ob&&++d<Ib);return u}function $i(t,e,n,i){if(t===e&&n===i)return Ot;const o=l=>Db(l,0,1,t,n);return l=>l===0||l===1?l:Hy(o(l),e,i)}const Ky=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Gy=t=>e=>1-t(1-e),Jy=$i(.33,1.53,.69,.99),Pd=Gy(Jy),Yy=Ky(Pd),Qy=t=>(t*=2)<1?.5*Pd(t):.5*(2-Math.pow(2,-10*(t-1))),Rd=t=>1-Math.sin(Math.acos(t)),Xy=Gy(Rd),Zy=Ky(Rd),ev=t=>/^0[^.\s]+$/u.test(t);function Lb(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||ev(t):!0}const gi=t=>Math.round(t*1e5)/1e5,Od=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Mb(t){return t==null}const Ub=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Id=(t,e)=>n=>!!(typeof n=="string"&&Ub.test(n)&&n.startsWith(t)||e&&!Mb(n)&&Object.prototype.hasOwnProperty.call(n,e)),tv=(t,e,n)=>i=>{if(typeof i!="string")return i;const[o,l,u,d]=i.match(Od);return{[t]:parseFloat(o),[e]:parseFloat(l),[n]:parseFloat(u),alpha:d!==void 0?parseFloat(d):1}},$b=t=>_n(0,255,t),Yu={...xs,transform:t=>Math.round($b(t))},vr={test:Id("rgb","red"),parse:tv("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+Yu.transform(t)+", "+Yu.transform(e)+", "+Yu.transform(n)+", "+gi(Ti.transform(i))+")"};function Vb(t){let e="",n="",i="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),i=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),i=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,i+=i,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:o?parseInt(o,16)/255:1}}const Cc={test:Id("#"),parse:Vb,transform:vr.transform},as={test:Id("hsl","hue"),parse:tv("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+ln.transform(gi(e))+", "+ln.transform(gi(n))+", "+gi(Ti.transform(i))+")"},ht={test:t=>vr.test(t)||Cc.test(t)||as.test(t),parse:t=>vr.test(t)?vr.parse(t):as.test(t)?as.parse(t):Cc.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?vr.transform(t):as.transform(t)},Fb=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Bb(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Od))===null||e===void 0?void 0:e.length)||0)+(((n=t.match(Fb))===null||n===void 0?void 0:n.length)||0)>0}const nv="number",rv="color",zb="var",qb="var(",bm="${}",Wb=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ci(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},o=[];let l=0;const d=e.replace(Wb,h=>(ht.test(h)?(i.color.push(l),o.push(rv),n.push(ht.parse(h))):h.startsWith(qb)?(i.var.push(l),o.push(zb),n.push(h)):(i.number.push(l),o.push(nv),n.push(parseFloat(h))),++l,bm)).split(bm);return{values:n,split:d,indexes:i,types:o}}function sv(t){return Ci(t).values}function iv(t){const{split:e,types:n}=Ci(t),i=e.length;return o=>{let l="";for(let u=0;u<i;u++)if(l+=e[u],o[u]!==void 0){const d=n[u];d===nv?l+=gi(o[u]):d===rv?l+=ht.transform(o[u]):l+=o[u]}return l}}const Hb=t=>typeof t=="number"?0:t;function Kb(t){const e=sv(t);return iv(t)(e.map(Hb))}const Jn={test:Bb,parse:sv,createTransformer:iv,getAnimatableNone:Kb},Gb=new Set(["brightness","contrast","saturate","opacity"]);function Jb(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[i]=n.match(Od)||[];if(!i)return t;const o=n.replace(i,"");let l=Gb.has(e)?1:0;return i!==n&&(l*=100),e+"("+l+o+")"}const Yb=/\b([a-z-]*)\(.*?\)/gu,Nc={...Jn,getAnimatableNone:t=>{const e=t.match(Yb);return e?e.map(Jb).join(" "):t}},Qb={...vd,color:ht,backgroundColor:ht,outlineColor:ht,fill:ht,stroke:ht,borderColor:ht,borderTopColor:ht,borderRightColor:ht,borderBottomColor:ht,borderLeftColor:ht,filter:Nc,WebkitFilter:Nc},Dd=t=>Qb[t];function ov(t,e){let n=Dd(t);return n!==Nc&&(n=Jn),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Xb=new Set(["auto","none","0"]);function Zb(t,e,n){let i=0,o;for(;i<t.length&&!o;){const l=t[i];typeof l=="string"&&!Xb.has(l)&&Ci(l).values.length&&(o=t[i]),i++}if(o&&n)for(const l of e)t[l]=ov(n,o)}const _m=t=>t===xs||t===de,Sm=(t,e)=>parseFloat(t.split(", ")[e]),km=(t,e)=>(n,{transform:i})=>{if(i==="none"||!i)return 0;const o=i.match(/^matrix3d\((.+)\)$/u);if(o)return Sm(o[1],e);{const l=i.match(/^matrix\((.+)\)$/u);return l?Sm(l[1],t):0}},e_=new Set(["x","y","z"]),t_=ws.filter(t=>!e_.has(t));function n_(t){const e=[];return t_.forEach(n=>{const i=t.getValue(n);i!==void 0&&(e.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),e}const ys={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:km(4,13),y:km(5,14)};ys.translateX=ys.x;ys.translateY=ys.y;const br=new Set;let Ac=!1,Pc=!1;function av(){if(Pc){const t=Array.from(br).filter(i=>i.needsMeasurement),e=new Set(t.map(i=>i.element)),n=new Map;e.forEach(i=>{const o=n_(i);o.length&&(n.set(i,o),i.render())}),t.forEach(i=>i.measureInitialState()),e.forEach(i=>{i.render();const o=n.get(i);o&&o.forEach(([l,u])=>{var d;(d=i.getValue(l))===null||d===void 0||d.set(u)})}),t.forEach(i=>i.measureEndState()),t.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}Pc=!1,Ac=!1,br.forEach(t=>t.complete()),br.clear()}function lv(){br.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Pc=!0)})}function r_(){lv(),av()}class Ld{constructor(e,n,i,o,l,u=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=i,this.motionValue=o,this.element=l,this.isAsync=u}scheduleResolve(){this.isScheduled=!0,this.isAsync?(br.add(this),Ac||(Ac=!0,Le.read(lv),Le.resolveKeyframes(av))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:i,motionValue:o}=this;for(let l=0;l<e.length;l++)if(e[l]===null)if(l===0){const u=o?.get(),d=e[e.length-1];if(u!==void 0)e[0]=u;else if(i&&n){const h=i.readValue(n,d);h!=null&&(e[0]=h)}e[0]===void 0&&(e[0]=d),o&&u===void 0&&o.set(e[0])}else e[l]=e[l-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),br.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,br.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const uv=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),s_=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function i_(t){const e=s_.exec(t);if(!e)return[,];const[,n,i,o]=e;return[`--${n??i}`,o]}function cv(t,e,n=1){const[i,o]=i_(t);if(!i)return;const l=window.getComputedStyle(e).getPropertyValue(i);if(l){const u=l.trim();return uv(u)?parseFloat(u):u}return yd(o)?cv(o,e,n+1):o}const dv=t=>e=>e.test(t),o_={test:t=>t==="auto",parse:t=>t},hv=[xs,de,ln,qn,J1,G1,o_],Em=t=>hv.find(dv(t));class fv extends Ld{constructor(e,n,i,o,l){super(e,n,i,o,l,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:i}=this;if(!n||!n.current)return;super.readKeyframes();for(let h=0;h<e.length;h++){let m=e[h];if(typeof m=="string"&&(m=m.trim(),yd(m))){const y=cv(m,n.current);y!==void 0&&(e[h]=y),h===e.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!zy.has(i)||e.length!==2)return;const[o,l]=e,u=Em(o),d=Em(l);if(u!==d)if(_m(u)&&_m(d))for(let h=0;h<e.length;h++){const m=e[h];typeof m=="string"&&(e[h]=parseFloat(m))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,i=[];for(let o=0;o<e.length;o++)Lb(e[o])&&i.push(o);i.length&&Zb(e,i,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:i}=this;if(!e||!e.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ys[i](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const o=n[n.length-1];o!==void 0&&e.getValue(i,o).jump(o,!1)}measureEndState(){var e;const{element:n,name:i,unresolvedKeyframes:o}=this;if(!n||!n.current)return;const l=n.getValue(i);l&&l.jump(this.measuredOrigin,!1);const u=o.length-1,d=o[u];o[u]=ys[i](n.measureViewportBox(),window.getComputedStyle(n.current)),d!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=d),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([h,m])=>{n.getValue(h).set(m)}),this.resolveNoneKeyframes()}}const Tm=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Jn.test(t)||t==="0")&&!t.startsWith("url("));function a_(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function l_(t,e,n,i){const o=t[0];if(o===null)return!1;if(e==="display"||e==="visibility")return!0;const l=t[t.length-1],u=Tm(o,e),d=Tm(l,e);return!u||!d?!1:a_(t)||(n==="spring"||Ed(n))&&i}const u_=t=>t!==null;function $a(t,{repeat:e,repeatType:n="loop"},i){const o=t.filter(u_),l=e&&n!=="loop"&&e%2===1?0:o.length-1;return!l||i===void 0?o[l]:i}const c_=40;class pv{constructor({autoplay:e=!0,delay:n=0,type:i="keyframes",repeat:o=0,repeatDelay:l=0,repeatType:u="loop",...d}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=un.now(),this.options={autoplay:e,delay:n,type:i,repeat:o,repeatDelay:l,repeatType:u,...d},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>c_?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&r_(),this._resolved}onKeyframesResolved(e,n){this.resolvedAt=un.now(),this.hasAttemptedResolve=!0;const{name:i,type:o,velocity:l,delay:u,onComplete:d,onUpdate:h,isGenerator:m}=this.options;if(!m&&!l_(e,i,o,l))if(u)this.options.duration=0;else{h&&h($a(e,this.options,n)),d&&d(),this.resolveFinishedPromise();return}const y=this.initPlayback(e,n);y!==!1&&(this._resolved={keyframes:e,finalKeyframe:n,...y},this.onPostResolved())}onPostResolved(){}then(e,n){return this.currentFinishedPromise.then(e,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}const Be=(t,e,n)=>t+(e-t)*n;function Qu(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function d_({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,e/=100,n/=100;let o=0,l=0,u=0;if(!e)o=l=u=n;else{const d=n<.5?n*(1+e):n+e-n*e,h=2*n-d;o=Qu(h,d,t+1/3),l=Qu(h,d,t),u=Qu(h,d,t-1/3)}return{red:Math.round(o*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:i}}function ka(t,e){return n=>n>0?e:t}const Xu=(t,e,n)=>{const i=t*t,o=n*(e*e-i)+i;return o<0?0:Math.sqrt(o)},h_=[Cc,vr,as],f_=t=>h_.find(e=>e.test(t));function jm(t){const e=f_(t);if(!e)return!1;let n=e.parse(t);return e===as&&(n=d_(n)),n}const Cm=(t,e)=>{const n=jm(t),i=jm(e);if(!n||!i)return ka(t,e);const o={...n};return l=>(o.red=Xu(n.red,i.red,l),o.green=Xu(n.green,i.green,l),o.blue=Xu(n.blue,i.blue,l),o.alpha=Be(n.alpha,i.alpha,l),vr.transform(o))},p_=(t,e)=>n=>e(t(n)),Vi=(...t)=>t.reduce(p_),Rc=new Set(["none","hidden"]);function m_(t,e){return Rc.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function g_(t,e){return n=>Be(t,e,n)}function Md(t){return typeof t=="number"?g_:typeof t=="string"?yd(t)?ka:ht.test(t)?Cm:w_:Array.isArray(t)?mv:typeof t=="object"?ht.test(t)?Cm:y_:ka}function mv(t,e){const n=[...t],i=n.length,o=t.map((l,u)=>Md(l)(l,e[u]));return l=>{for(let u=0;u<i;u++)n[u]=o[u](l);return n}}function y_(t,e){const n={...t,...e},i={};for(const o in n)t[o]!==void 0&&e[o]!==void 0&&(i[o]=Md(t[o])(t[o],e[o]));return o=>{for(const l in i)n[l]=i[l](o);return n}}function v_(t,e){var n;const i=[],o={color:0,var:0,number:0};for(let l=0;l<e.values.length;l++){const u=e.types[l],d=t.indexes[u][o[u]],h=(n=t.values[d])!==null&&n!==void 0?n:0;i[l]=h,o[u]++}return i}const w_=(t,e)=>{const n=Jn.createTransformer(e),i=Ci(t),o=Ci(e);return i.indexes.var.length===o.indexes.var.length&&i.indexes.color.length===o.indexes.color.length&&i.indexes.number.length>=o.indexes.number.length?Rc.has(t)&&!o.values.length||Rc.has(e)&&!i.values.length?m_(t,e):Vi(mv(v_(i,o),o.values),n):ka(t,e)};function gv(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Be(t,e,n):Md(t)(t,e)}const x_=5;function yv(t,e,n){const i=Math.max(e-x_,0);return qy(n-t(i),e-i)}const We={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Zu=.001;function b_({duration:t=We.duration,bounce:e=We.bounce,velocity:n=We.velocity,mass:i=We.mass}){let o,l,u=1-e;u=_n(We.minDamping,We.maxDamping,u),t=_n(We.minDuration,We.maxDuration,xn(t)),u<1?(o=m=>{const y=m*u,v=y*t,w=y-n,_=Oc(m,u),b=Math.exp(-v);return Zu-w/_*b},l=m=>{const v=m*u*t,w=v*n+n,_=Math.pow(u,2)*Math.pow(m,2)*t,b=Math.exp(-v),k=Oc(Math.pow(m,2),u);return(-o(m)+Zu>0?-1:1)*((w-_)*b)/k}):(o=m=>{const y=Math.exp(-m*t),v=(m-n)*t+1;return-Zu+y*v},l=m=>{const y=Math.exp(-m*t),v=(n-m)*(t*t);return y*v});const d=5/t,h=S_(o,l,d);if(t=wn(t),isNaN(h))return{stiffness:We.stiffness,damping:We.damping,duration:t};{const m=Math.pow(h,2)*i;return{stiffness:m,damping:u*2*Math.sqrt(i*m),duration:t}}}const __=12;function S_(t,e,n){let i=n;for(let o=1;o<__;o++)i=i-t(i)/e(i);return i}function Oc(t,e){return t*Math.sqrt(1-e*e)}const k_=["duration","bounce"],E_=["stiffness","damping","mass"];function Nm(t,e){return e.some(n=>t[n]!==void 0)}function T_(t){let e={velocity:We.velocity,stiffness:We.stiffness,damping:We.damping,mass:We.mass,isResolvedFromDuration:!1,...t};if(!Nm(t,E_)&&Nm(t,k_))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(n*1.2),o=i*i,l=2*_n(.05,1,1-(t.bounce||0))*Math.sqrt(o);e={...e,mass:We.mass,stiffness:o,damping:l}}else{const n=b_(t);e={...e,...n,mass:We.mass},e.isResolvedFromDuration=!0}return e}function vv(t=We.visualDuration,e=We.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:o}=n;const l=n.keyframes[0],u=n.keyframes[n.keyframes.length-1],d={done:!1,value:l},{stiffness:h,damping:m,mass:y,duration:v,velocity:w,isResolvedFromDuration:_}=T_({...n,velocity:-xn(n.velocity||0)}),b=w||0,k=m/(2*Math.sqrt(h*y)),S=u-l,E=xn(Math.sqrt(h/y)),A=Math.abs(S)<5;i||(i=A?We.restSpeed.granular:We.restSpeed.default),o||(o=A?We.restDelta.granular:We.restDelta.default);let P;if(k<1){const V=Oc(E,k);P=z=>{const $=Math.exp(-k*E*z);return u-$*((b+k*E*S)/V*Math.sin(V*z)+S*Math.cos(V*z))}}else if(k===1)P=V=>u-Math.exp(-E*V)*(S+(b+E*S)*V);else{const V=E*Math.sqrt(k*k-1);P=z=>{const $=Math.exp(-k*E*z),B=Math.min(V*z,300);return u-$*((b+k*E*S)*Math.sinh(B)+V*S*Math.cosh(B))/V}}const U={calculatedDuration:_&&v||null,next:V=>{const z=P(V);if(_)d.done=V>=v;else{let $=0;k<1&&($=V===0?wn(b):yv(P,V,z));const B=Math.abs($)<=i,Y=Math.abs(u-z)<=o;d.done=B&&Y}return d.value=d.done?u:z,d},toString:()=>{const V=Math.min(Ly(U),Ec),z=My($=>U.next(V*$).value,V,30);return V+"ms "+z}};return U}function Am({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:o=10,bounceStiffness:l=500,modifyTarget:u,min:d,max:h,restDelta:m=.5,restSpeed:y}){const v=t[0],w={done:!1,value:v},_=B=>d!==void 0&&B<d||h!==void 0&&B>h,b=B=>d===void 0?h:h===void 0||Math.abs(d-B)<Math.abs(h-B)?d:h;let k=n*e;const S=v+k,E=u===void 0?S:u(S);E!==S&&(k=E-v);const A=B=>-k*Math.exp(-B/i),P=B=>E+A(B),U=B=>{const Y=A(B),oe=P(B);w.done=Math.abs(Y)<=m,w.value=w.done?E:oe};let V,z;const $=B=>{_(w.value)&&(V=B,z=vv({keyframes:[w.value,b(w.value)],velocity:yv(P,B,w.value),damping:o,stiffness:l,restDelta:m,restSpeed:y}))};return $(0),{calculatedDuration:null,next:B=>{let Y=!1;return!z&&V===void 0&&(Y=!0,U(B),$(B)),V!==void 0&&B>=V?z.next(B-V):(!Y&&U(B),w)}}}const j_=$i(.42,0,1,1),C_=$i(0,0,.58,1),wv=$i(.42,0,.58,1),N_=t=>Array.isArray(t)&&typeof t[0]!="number",A_={linear:Ot,easeIn:j_,easeInOut:wv,easeOut:C_,circIn:Rd,circInOut:Zy,circOut:Xy,backIn:Pd,backInOut:Yy,backOut:Jy,anticipate:Qy},Pm=t=>{if(Td(t)){gy(t.length===4);const[e,n,i,o]=t;return $i(e,n,i,o)}else if(typeof t=="string")return A_[t];return t};function P_(t,e,n){const i=[],o=n||gv,l=t.length-1;for(let u=0;u<l;u++){let d=o(t[u],t[u+1]);if(e){const h=Array.isArray(e)?e[u]||Ot:e;d=Vi(h,d)}i.push(d)}return i}function R_(t,e,{clamp:n=!0,ease:i,mixer:o}={}){const l=t.length;if(gy(l===e.length),l===1)return()=>e[0];if(l===2&&e[0]===e[1])return()=>e[1];const u=t[0]===t[1];t[0]>t[l-1]&&(t=[...t].reverse(),e=[...e].reverse());const d=P_(e,i,o),h=d.length,m=y=>{if(u&&y<t[0])return e[0];let v=0;if(h>1)for(;v<t.length-2&&!(y<t[v+1]);v++);const w=ms(t[v],t[v+1],y);return d[v](w)};return n?y=>m(_n(t[0],t[l-1],y)):m}function O_(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const o=ms(0,e,i);t.push(Be(n,1,o))}}function I_(t){const e=[0];return O_(e,t.length-1),e}function D_(t,e){return t.map(n=>n*e)}function L_(t,e){return t.map(()=>e||wv).splice(0,t.length-1)}function Ea({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const o=N_(i)?i.map(Pm):Pm(i),l={done:!1,value:e[0]},u=D_(n&&n.length===e.length?n:I_(e),t),d=R_(u,e,{ease:Array.isArray(o)?o:L_(e,o)});return{calculatedDuration:t,next:h=>(l.value=d(h),l.done=h>=t,l)}}const M_=t=>{const e=({timestamp:n})=>t(n);return{start:()=>Le.update(e,!0),stop:()=>Gn(e),now:()=>at.isProcessing?at.timestamp:un.now()}},U_={decay:Am,inertia:Am,tween:Ea,keyframes:Ea,spring:vv},$_=t=>t/100;class Ud extends pv{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:h}=this.options;h&&h()};const{name:n,motionValue:i,element:o,keyframes:l}=this.options,u=o?.KeyframeResolver||Ld,d=(h,m)=>this.onKeyframesResolved(h,m);this.resolver=new u(l,d,n,i,o),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:n="keyframes",repeat:i=0,repeatDelay:o=0,repeatType:l,velocity:u=0}=this.options,d=Ed(n)?n:U_[n]||Ea;let h,m;d!==Ea&&typeof e[0]!="number"&&(h=Vi($_,gv(e[0],e[1])),e=[0,100]);const y=d({...this.options,keyframes:e});l==="mirror"&&(m=d({...this.options,keyframes:[...e].reverse(),velocity:-u})),y.calculatedDuration===null&&(y.calculatedDuration=Ly(y));const{calculatedDuration:v}=y,w=v+o,_=w*(i+1)-o;return{generator:y,mirroredGenerator:m,mapPercentToKeyframes:h,calculatedDuration:v,resolvedDuration:w,totalDuration:_}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,n=!1){const{resolved:i}=this;if(!i){const{keyframes:B}=this.options;return{done:!0,value:B[B.length-1]}}const{finalKeyframe:o,generator:l,mirroredGenerator:u,mapPercentToKeyframes:d,keyframes:h,calculatedDuration:m,totalDuration:y,resolvedDuration:v}=i;if(this.startTime===null)return l.next(0);const{delay:w,repeat:_,repeatType:b,repeatDelay:k,onUpdate:S}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-y/this.speed,this.startTime)),n?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const E=this.currentTime-w*(this.speed>=0?1:-1),A=this.speed>=0?E<0:E>y;this.currentTime=Math.max(E,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=y);let P=this.currentTime,U=l;if(_){const B=Math.min(this.currentTime,y)/v;let Y=Math.floor(B),oe=B%1;!oe&&B>=1&&(oe=1),oe===1&&Y--,Y=Math.min(Y,_+1),Y%2&&(b==="reverse"?(oe=1-oe,k&&(oe-=k/v)):b==="mirror"&&(U=u)),P=_n(0,1,oe)*v}const V=A?{done:!1,value:h[0]}:U.next(P);d&&(V.value=d(V.value));let{done:z}=V;!A&&m!==null&&(z=this.speed>=0?this.currentTime>=y:this.currentTime<=0);const $=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&z);return $&&o!==void 0&&(V.value=$a(h,this.options,o)),S&&S(V.value),$&&this.finish(),V}get duration(){const{resolved:e}=this;return e?xn(e.calculatedDuration):0}get time(){return xn(this.currentTime)}set time(e){e=wn(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=xn(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=M_,onPlay:n,startTime:i}=this.options;this.driver||(this.driver=e(l=>this.tick(l))),n&&n();const o=this.driver.now();this.holdTime!==null?this.startTime=o-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=o):this.startTime=i??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const V_=new Set(["opacity","clipPath","filter","transform"]);function F_(t,e,n,{delay:i=0,duration:o=300,repeat:l=0,repeatType:u="loop",ease:d="easeInOut",times:h}={}){const m={[e]:n};h&&(m.offset=h);const y=$y(d,o);return Array.isArray(y)&&(m.easing=y),t.animate(m,{delay:i,duration:o,easing:Array.isArray(y)?"linear":y,fill:"both",iterations:l+1,direction:u==="reverse"?"alternate":"normal"})}const B_=cd(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Ta=10,z_=2e4;function q_(t){return Ed(t.type)||t.type==="spring"||!Uy(t.ease)}function W_(t,e){const n=new Ud({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let i={done:!1,value:t[0]};const o=[];let l=0;for(;!i.done&&l<z_;)i=n.sample(l),o.push(i.value),l+=Ta;return{times:void 0,keyframes:o,duration:l-Ta,ease:"linear"}}const xv={anticipate:Qy,backInOut:Yy,circInOut:Zy};function H_(t){return t in xv}class Rm extends pv{constructor(e){super(e);const{name:n,motionValue:i,element:o,keyframes:l}=this.options;this.resolver=new fv(l,(u,d)=>this.onKeyframesResolved(u,d),n,i,o),this.resolver.scheduleResolve()}initPlayback(e,n){let{duration:i=300,times:o,ease:l,type:u,motionValue:d,name:h,startTime:m}=this.options;if(!d.owner||!d.owner.current)return!1;if(typeof l=="string"&&Sa()&&H_(l)&&(l=xv[l]),q_(this.options)){const{onComplete:v,onUpdate:w,motionValue:_,element:b,...k}=this.options,S=W_(e,k);e=S.keyframes,e.length===1&&(e[1]=e[0]),i=S.duration,o=S.times,l=S.ease,u="keyframes"}const y=F_(d.owner.current,h,e,{...this.options,duration:i,times:o,ease:l});return y.startTime=m??this.calcStartTime(),this.pendingTimeline?(gm(y,this.pendingTimeline),this.pendingTimeline=void 0):y.onfinish=()=>{const{onComplete:v}=this.options;d.set($a(e,this.options,n)),v&&v(),this.cancel(),this.resolveFinishedPromise()},{animation:y,duration:i,times:o,type:u,ease:l,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:n}=e;return xn(n)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:n}=e;return xn(n.currentTime||0)}set time(e){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.currentTime=wn(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:n}=e;return n.playbackRate}set speed(e){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:n}=e;return n.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:n}=e;return n.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:n}=this;if(!n)return Ot;const{animation:i}=n;gm(i,e)}return Ot}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:n,keyframes:i,duration:o,type:l,ease:u,times:d}=e;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:m,onUpdate:y,onComplete:v,element:w,..._}=this.options,b=new Ud({..._,keyframes:i,duration:o,type:l,ease:u,times:d,isGenerator:!0}),k=wn(this.time);m.setWithVelocity(b.sample(k-Ta).value,b.sample(k).value,Ta)}const{onStop:h}=this.options;h&&h(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:n,name:i,repeatDelay:o,repeatType:l,damping:u,type:d}=e;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:m}=n.owner.getProps();return B_()&&i&&V_.has(i)&&!h&&!m&&!o&&l!=="mirror"&&u!==0&&d!=="inertia"}}const K_={type:"spring",stiffness:500,damping:25,restSpeed:10},G_=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),J_={type:"keyframes",duration:.8},Y_={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Q_=(t,{keyframes:e})=>e.length>2?J_:Er.has(t)?t.startsWith("scale")?G_(e[1]):K_:Y_;function X_({when:t,delay:e,delayChildren:n,staggerChildren:i,staggerDirection:o,repeat:l,repeatType:u,repeatDelay:d,from:h,elapsed:m,...y}){return!!Object.keys(y).length}const $d=(t,e,n,i={},o,l)=>u=>{const d=kd(i,t)||{},h=d.delay||i.delay||0;let{elapsed:m=0}=i;m=m-wn(h);let y={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...d,delay:-m,onUpdate:w=>{e.set(w),d.onUpdate&&d.onUpdate(w)},onComplete:()=>{u(),d.onComplete&&d.onComplete()},name:t,motionValue:e,element:l?void 0:o};X_(d)||(y={...y,...Q_(t,y)}),y.duration&&(y.duration=wn(y.duration)),y.repeatDelay&&(y.repeatDelay=wn(y.repeatDelay)),y.from!==void 0&&(y.keyframes[0]=y.from);let v=!1;if((y.type===!1||y.duration===0&&!y.repeatDelay)&&(y.duration=0,y.delay===0&&(v=!0)),v&&!l&&e.get()!==void 0){const w=$a(y.keyframes,d);if(w!==void 0)return Le.update(()=>{y.onUpdate(w),y.onComplete()}),new yb([])}return!l&&Rm.supports(y)?new Rm(y):new Ud(y)};function Z_({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,i}function bv(t,e,{delay:n=0,transitionOverride:i,type:o}={}){var l;let{transition:u=t.getDefaultTransition(),transitionEnd:d,...h}=e;i&&(u=i);const m=[],y=o&&t.animationState&&t.animationState.getState()[o];for(const v in h){const w=t.getValue(v,(l=t.latestValues[v])!==null&&l!==void 0?l:null),_=h[v];if(_===void 0||y&&Z_(y,v))continue;const b={delay:n,...kd(u||{},v)};let k=!1;if(window.MotionHandoffAnimation){const E=Wy(t);if(E){const A=window.MotionHandoffAnimation(E,v,Le);A!==null&&(b.startTime=A,k=!0)}}jc(t,v),w.start($d(v,w,_,t.shouldReduceMotion&&zy.has(v)?{type:!1}:b,t,k));const S=w.animation;S&&m.push(S)}return d&&Promise.all(m).then(()=>{Le.update(()=>{d&&Pb(t,d)})}),m}function Ic(t,e,n={}){var i;const o=Ua(t,e,n.type==="exit"?(i=t.presenceContext)===null||i===void 0?void 0:i.custom:void 0);let{transition:l=t.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(l=n.transitionOverride);const u=o?()=>Promise.all(bv(t,o,n)):()=>Promise.resolve(),d=t.variantChildren&&t.variantChildren.size?(m=0)=>{const{delayChildren:y=0,staggerChildren:v,staggerDirection:w}=l;return eS(t,e,y+m,v,w,n)}:()=>Promise.resolve(),{when:h}=l;if(h){const[m,y]=h==="beforeChildren"?[u,d]:[d,u];return m().then(()=>y())}else return Promise.all([u(),d(n.delay)])}function eS(t,e,n=0,i=0,o=1,l){const u=[],d=(t.variantChildren.size-1)*i,h=o===1?(m=0)=>m*i:(m=0)=>d-m*i;return Array.from(t.variantChildren).sort(tS).forEach((m,y)=>{m.notify("AnimationStart",e),u.push(Ic(m,e,{...l,delay:n+h(y)}).then(()=>m.notify("AnimationComplete",e)))}),Promise.all(u)}function tS(t,e){return t.sortNodePosition(e)}function nS(t,e,n={}){t.notify("AnimationStart",e);let i;if(Array.isArray(e)){const o=e.map(l=>Ic(t,l,n));i=Promise.all(o)}else if(typeof e=="string")i=Ic(t,e,n);else{const o=typeof e=="function"?Ua(t,e,n.custom):e;i=Promise.all(bv(t,o,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}const rS=hd.length;function _v(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?_v(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<rS;n++){const i=hd[n],o=t.props[i];(Ei(o)||o===!1)&&(e[i]=o)}return e}const sS=[...dd].reverse(),iS=dd.length;function oS(t){return e=>Promise.all(e.map(({animation:n,options:i})=>nS(t,n,i)))}function aS(t){let e=oS(t),n=Om(),i=!0;const o=h=>(m,y)=>{var v;const w=Ua(t,y,h==="exit"?(v=t.presenceContext)===null||v===void 0?void 0:v.custom:void 0);if(w){const{transition:_,transitionEnd:b,...k}=w;m={...m,...k,...b}}return m};function l(h){e=h(t)}function u(h){const{props:m}=t,y=_v(t.parent)||{},v=[],w=new Set;let _={},b=1/0;for(let S=0;S<iS;S++){const E=sS[S],A=n[E],P=m[E]!==void 0?m[E]:y[E],U=Ei(P),V=E===h?A.isActive:null;V===!1&&(b=S);let z=P===y[E]&&P!==m[E]&&U;if(z&&i&&t.manuallyAnimateOnMount&&(z=!1),A.protectedKeys={..._},!A.isActive&&V===null||!P&&!A.prevProp||La(P)||typeof P=="boolean")continue;const $=lS(A.prevProp,P);let B=$||E===h&&A.isActive&&!z&&U||S>b&&U,Y=!1;const oe=Array.isArray(P)?P:[P];let Te=oe.reduce(o(E),{});V===!1&&(Te={});const{prevResolvedValues:ve={}}=A,je={...ve,...Te},xe=pe=>{B=!0,w.has(pe)&&(Y=!0,w.delete(pe)),A.needsAnimating[pe]=!0;const F=t.getValue(pe);F&&(F.liveStyle=!1)};for(const pe in je){const F=Te[pe],J=ve[pe];if(_.hasOwnProperty(pe))continue;let K=!1;kc(F)&&kc(J)?K=!Dy(F,J):K=F!==J,K?F!=null?xe(pe):w.add(pe):F!==void 0&&w.has(pe)?xe(pe):A.protectedKeys[pe]=!0}A.prevProp=P,A.prevResolvedValues=Te,A.isActive&&(_={..._,...Te}),i&&t.blockInitialAnimation&&(B=!1),B&&(!(z&&$)||Y)&&v.push(...oe.map(pe=>({animation:pe,options:{type:E}})))}if(w.size){const S={};w.forEach(E=>{const A=t.getBaseTarget(E),P=t.getValue(E);P&&(P.liveStyle=!0),S[E]=A??null}),v.push({animation:S})}let k=!!v.length;return i&&(m.initial===!1||m.initial===m.animate)&&!t.manuallyAnimateOnMount&&(k=!1),i=!1,k?e(v):Promise.resolve()}function d(h,m){var y;if(n[h].isActive===m)return Promise.resolve();(y=t.variantChildren)===null||y===void 0||y.forEach(w=>{var _;return(_=w.animationState)===null||_===void 0?void 0:_.setActive(h,m)}),n[h].isActive=m;const v=u(h);for(const w in n)n[w].protectedKeys={};return v}return{animateChanges:u,setActive:d,setAnimateFunction:l,getState:()=>n,reset:()=>{n=Om(),i=!0}}}function lS(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Dy(e,t):!1}function cr(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Om(){return{animate:cr(!0),whileInView:cr(),whileHover:cr(),whileTap:cr(),whileDrag:cr(),whileFocus:cr(),exit:cr()}}class Yn{constructor(e){this.isMounted=!1,this.node=e}update(){}}class uS extends Yn{constructor(e){super(e),e.animationState||(e.animationState=aS(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();La(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let cS=0;class dS extends Yn{constructor(){super(...arguments),this.id=cS++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const o=this.node.animationState.setActive("exit",!e);n&&!e&&o.then(()=>n(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const hS={animation:{Feature:uS},exit:{Feature:dS}};function Ni(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n)}function Fi(t){return{point:{x:t.pageX,y:t.pageY}}}const fS=t=>e=>jd(e)&&t(e,Fi(e));function yi(t,e,n,i){return Ni(t,e,fS(n),i)}const Im=(t,e)=>Math.abs(t-e);function pS(t,e){const n=Im(t.x,e.x),i=Im(t.y,e.y);return Math.sqrt(n**2+i**2)}class Sv{constructor(e,n,{transformPagePoint:i,contextWindow:o,dragSnapToOrigin:l=!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 v=tc(this.lastMoveEventInfo,this.history),w=this.startEvent!==null,_=pS(v.offset,{x:0,y:0})>=3;if(!w&&!_)return;const{point:b}=v,{timestamp:k}=at;this.history.push({...b,timestamp:k});const{onStart:S,onMove:E}=this.handlers;w||(S&&S(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),E&&E(this.lastMoveEvent,v)},this.handlePointerMove=(v,w)=>{this.lastMoveEvent=v,this.lastMoveEventInfo=ec(w,this.transformPagePoint),Le.update(this.updatePoint,!0)},this.handlePointerUp=(v,w)=>{this.end();const{onEnd:_,onSessionEnd:b,resumeAnimation:k}=this.handlers;if(this.dragSnapToOrigin&&k&&k(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const S=tc(v.type==="pointercancel"?this.lastMoveEventInfo:ec(w,this.transformPagePoint),this.history);this.startEvent&&_&&_(v,S),b&&b(v,S)},!jd(e))return;this.dragSnapToOrigin=l,this.handlers=n,this.transformPagePoint=i,this.contextWindow=o||window;const u=Fi(e),d=ec(u,this.transformPagePoint),{point:h}=d,{timestamp:m}=at;this.history=[{...h,timestamp:m}];const{onSessionStart:y}=n;y&&y(e,tc(d,this.history)),this.removeListeners=Vi(yi(this.contextWindow,"pointermove",this.handlePointerMove),yi(this.contextWindow,"pointerup",this.handlePointerUp),yi(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Gn(this.updatePoint)}}function ec(t,e){return e?{point:e(t.point)}:t}function Dm(t,e){return{x:t.x-e.x,y:t.y-e.y}}function tc({point:t},e){return{point:t,delta:Dm(t,kv(e)),offset:Dm(t,mS(e)),velocity:gS(e,.1)}}function mS(t){return t[0]}function kv(t){return t[t.length-1]}function gS(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,i=null;const o=kv(t);for(;n>=0&&(i=t[n],!(o.timestamp-i.timestamp>wn(e)));)n--;if(!i)return{x:0,y:0};const l=xn(o.timestamp-i.timestamp);if(l===0)return{x:0,y:0};const u={x:(o.x-i.x)/l,y:(o.y-i.y)/l};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}const Ev=1e-4,yS=1-Ev,vS=1+Ev,Tv=.01,wS=0-Tv,xS=0+Tv;function It(t){return t.max-t.min}function bS(t,e,n){return Math.abs(t-e)<=n}function Lm(t,e,n,i=.5){t.origin=i,t.originPoint=Be(e.min,e.max,t.origin),t.scale=It(n)/It(e),t.translate=Be(n.min,n.max,t.origin)-t.originPoint,(t.scale>=yS&&t.scale<=vS||isNaN(t.scale))&&(t.scale=1),(t.translate>=wS&&t.translate<=xS||isNaN(t.translate))&&(t.translate=0)}function vi(t,e,n,i){Lm(t.x,e.x,n.x,i?i.originX:void 0),Lm(t.y,e.y,n.y,i?i.originY:void 0)}function Mm(t,e,n){t.min=n.min+e.min,t.max=t.min+It(e)}function _S(t,e,n){Mm(t.x,e.x,n.x),Mm(t.y,e.y,n.y)}function Um(t,e,n){t.min=e.min-n.min,t.max=t.min+It(e)}function wi(t,e,n){Um(t.x,e.x,n.x),Um(t.y,e.y,n.y)}function SS(t,{min:e,max:n},i){return e!==void 0&&t<e?t=i?Be(e,t,i.min):Math.max(t,e):n!==void 0&&t>n&&(t=i?Be(n,t,i.max):Math.min(t,n)),t}function $m(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function kS(t,{top:e,left:n,bottom:i,right:o}){return{x:$m(t.x,n,o),y:$m(t.y,e,i)}}function Vm(t,e){let n=e.min-t.min,i=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,i]=[i,n]),{min:n,max:i}}function ES(t,e){return{x:Vm(t.x,e.x),y:Vm(t.y,e.y)}}function TS(t,e){let n=.5;const i=It(t),o=It(e);return o>i?n=ms(e.min,e.max-i,t.min):i>o&&(n=ms(t.min,t.max-o,e.min)),_n(0,1,n)}function jS(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Dc=.35;function CS(t=Dc){return t===!1?t=0:t===!0&&(t=Dc),{x:Fm(t,"left","right"),y:Fm(t,"top","bottom")}}function Fm(t,e,n){return{min:Bm(t,e),max:Bm(t,n)}}function Bm(t,e){return typeof t=="number"?t:t[e]||0}const zm=()=>({translate:0,scale:1,origin:0,originPoint:0}),ls=()=>({x:zm(),y:zm()}),qm=()=>({min:0,max:0}),Ge=()=>({x:qm(),y:qm()});function Bt(t){return[t("x"),t("y")]}function jv({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}function NS({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function AS(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),i=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function nc(t){return t===void 0||t===1}function Lc({scale:t,scaleX:e,scaleY:n}){return!nc(t)||!nc(e)||!nc(n)}function fr(t){return Lc(t)||Cv(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Cv(t){return Wm(t.x)||Wm(t.y)}function Wm(t){return t&&t!=="0%"}function ja(t,e,n){const i=t-n,o=e*i;return n+o}function Hm(t,e,n,i,o){return o!==void 0&&(t=ja(t,o,i)),ja(t,n,i)+e}function Mc(t,e=0,n=1,i,o){t.min=Hm(t.min,e,n,i,o),t.max=Hm(t.max,e,n,i,o)}function Nv(t,{x:e,y:n}){Mc(t.x,e.translate,e.scale,e.originPoint),Mc(t.y,n.translate,n.scale,n.originPoint)}const Km=.999999999999,Gm=1.0000000000001;function PS(t,e,n,i=!1){const o=n.length;if(!o)return;e.x=e.y=1;let l,u;for(let d=0;d<o;d++){l=n[d],u=l.projectionDelta;const{visualElement:h}=l.options;h&&h.props.style&&h.props.style.display==="contents"||(i&&l.options.layoutScroll&&l.scroll&&l!==l.root&&cs(t,{x:-l.scroll.offset.x,y:-l.scroll.offset.y}),u&&(e.x*=u.x.scale,e.y*=u.y.scale,Nv(t,u)),i&&fr(l.latestValues)&&cs(t,l.latestValues))}e.x<Gm&&e.x>Km&&(e.x=1),e.y<Gm&&e.y>Km&&(e.y=1)}function us(t,e){t.min=t.min+e,t.max=t.max+e}function Jm(t,e,n,i,o=.5){const l=Be(t.min,t.max,o);Mc(t,e,n,l,i)}function cs(t,e){Jm(t.x,e.x,e.scaleX,e.scale,e.originX),Jm(t.y,e.y,e.scaleY,e.scale,e.originY)}function Av(t,e){return jv(AS(t.getBoundingClientRect(),e))}function RS(t,e,n){const i=Av(t,n),{scroll:o}=e;return o&&(us(i.x,o.offset.x),us(i.y,o.offset.y)),i}const Pv=({current:t})=>t?t.ownerDocument.defaultView:null,OS=new WeakMap;class IS{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ge(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const o=y=>{const{dragSnapToOrigin:v}=this.getProps();v?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Fi(y).point)},l=(y,v)=>{const{drag:w,dragPropagation:_,onDragStart:b}=this.getProps();if(w&&!_&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Tb(w),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Bt(S=>{let E=this.getAxisMotionValue(S).get()||0;if(ln.test(E)){const{projection:A}=this.visualElement;if(A&&A.layout){const P=A.layout.layoutBox[S];P&&(E=It(P)*(parseFloat(E)/100))}}this.originPoint[S]=E}),b&&Le.postRender(()=>b(y,v)),jc(this.visualElement,"transform");const{animationState:k}=this.visualElement;k&&k.setActive("whileDrag",!0)},u=(y,v)=>{const{dragPropagation:w,dragDirectionLock:_,onDirectionLock:b,onDrag:k}=this.getProps();if(!w&&!this.openDragLock)return;const{offset:S}=v;if(_&&this.currentDirection===null){this.currentDirection=DS(S),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",v.point,S),this.updateAxis("y",v.point,S),this.visualElement.render(),k&&k(y,v)},d=(y,v)=>this.stop(y,v),h=()=>Bt(y=>{var v;return this.getAnimationState(y)==="paused"&&((v=this.getAxisMotionValue(y).animation)===null||v===void 0?void 0:v.play())}),{dragSnapToOrigin:m}=this.getProps();this.panSession=new Sv(e,{onSessionStart:o,onStart:l,onMove:u,onSessionEnd:d,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:m,contextWindow:Pv(this.visualElement)})}stop(e,n){const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:o}=n;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&Le.postRender(()=>l(e,n))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,i){const{drag:o}=this.getProps();if(!i||!la(e,o,this.currentDirection))return;const l=this.getAxisMotionValue(e);let u=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(u=SS(u,this.constraints[e],this.elastic[e])),l.set(u)}resolveConstraints(){var e;const{dragConstraints:n,dragElastic:i}=this.getProps(),o=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,l=this.constraints;n&&os(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&o?this.constraints=kS(o.layoutBox,n):this.constraints=!1,this.elastic=CS(i),l!==this.constraints&&o&&this.constraints&&!this.hasMutatedConstraints&&Bt(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=jS(o.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!os(e))return!1;const i=e.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const l=RS(i,o.root,this.visualElement.getTransformPagePoint());let u=ES(o.layout.layoutBox,l);if(n){const d=n(NS(u));this.hasMutatedConstraints=!!d,d&&(u=jv(d))}return u}startAnimation(e){const{drag:n,dragMomentum:i,dragElastic:o,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:d}=this.getProps(),h=this.constraints||{},m=Bt(y=>{if(!la(y,n,this.currentDirection))return;let v=h&&h[y]||{};u&&(v={min:0,max:0});const w=o?200:1e6,_=o?40:1e7,b={type:"inertia",velocity:i?e[y]:0,bounceStiffness:w,bounceDamping:_,timeConstant:750,restDelta:1,restSpeed:10,...l,...v};return this.startAxisValueAnimation(y,b)});return Promise.all(m).then(d)}startAxisValueAnimation(e,n){const i=this.getAxisMotionValue(e);return jc(this.visualElement,e),i.start($d(e,i,0,n,this.visualElement,!1))}stopAnimation(){Bt(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Bt(e=>{var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,i=this.visualElement.getProps(),o=i[n];return o||this.visualElement.getValue(e,(i.initial?i.initial[e]:void 0)||0)}snapToCursor(e){Bt(n=>{const{drag:i}=this.getProps();if(!la(n,i,this.currentDirection))return;const{projection:o}=this.visualElement,l=this.getAxisMotionValue(n);if(o&&o.layout){const{min:u,max:d}=o.layout.layoutBox[n];l.set(e[n]-Be(u,d,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!os(n)||!i||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};Bt(u=>{const d=this.getAxisMotionValue(u);if(d&&this.constraints!==!1){const h=d.get();o[u]=TS({min:h,max:h},this.constraints[u])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),Bt(u=>{if(!la(u,e,null))return;const d=this.getAxisMotionValue(u),{min:h,max:m}=this.constraints[u];d.set(Be(h,m,o[u]))})}addListeners(){if(!this.visualElement.current)return;OS.set(this.visualElement,this);const e=this.visualElement.current,n=yi(e,"pointerdown",h=>{const{drag:m,dragListener:y=!0}=this.getProps();m&&y&&this.start(h)}),i=()=>{const{dragConstraints:h}=this.getProps();os(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,l=o.addEventListener("measure",i);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),Le.read(i);const u=Ni(window,"resize",()=>this.scalePositionWithinConstraints()),d=o.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:m})=>{this.isDragging&&m&&(Bt(y=>{const v=this.getAxisMotionValue(y);v&&(this.originPoint[y]+=h[y].translate,v.set(v.get()+h[y].translate))}),this.visualElement.render())}));return()=>{u(),n(),l(),d&&d()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:o=!1,dragConstraints:l=!1,dragElastic:u=Dc,dragMomentum:d=!0}=e;return{...e,drag:n,dragDirectionLock:i,dragPropagation:o,dragConstraints:l,dragElastic:u,dragMomentum:d}}}function la(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function DS(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class LS extends Yn{constructor(e){super(e),this.removeGroupControls=Ot,this.removeListeners=Ot,this.controls=new IS(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ot}unmount(){this.removeGroupControls(),this.removeListeners()}}const Ym=t=>(e,n)=>{t&&Le.postRender(()=>t(e,n))};class MS extends Yn{constructor(){super(...arguments),this.removePointerDownListener=Ot}onPointerDown(e){this.session=new Sv(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Pv(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:i,onPanEnd:o}=this.node.getProps();return{onSessionStart:Ym(e),onStart:Ym(n),onMove:i,onEnd:(l,u)=>{delete this.session,o&&Le.postRender(()=>o(l,u))}}}mount(){this.removePointerDownListener=yi(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const ya={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Qm(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ui={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(de.test(t))t=parseFloat(t);else return t;const n=Qm(t,e.target.x),i=Qm(t,e.target.y);return`${n}% ${i}%`}},US={correct:(t,{treeScale:e,projectionDelta:n})=>{const i=t,o=Jn.parse(t);if(o.length>5)return i;const l=Jn.createTransformer(t),u=typeof o[0]!="number"?1:0,d=n.x.scale*e.x,h=n.y.scale*e.y;o[0+u]/=d,o[1+u]/=h;const m=Be(d,h,.5);return typeof o[2+u]=="number"&&(o[2+u]/=m),typeof o[3+u]=="number"&&(o[3+u]/=m),l(o)}};class $S extends R.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i,layoutId:o}=this.props,{projection:l}=e;ib(VS),l&&(n.group&&n.group.add(l),i&&i.register&&o&&i.register(l),l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,onExitComplete:()=>this.safeToRemove()})),ya.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:i,drag:o,isPresent:l}=this.props,u=i.projection;return u&&(u.isPresent=l,o||e.layoutDependency!==n||n===void 0?u.willUpdate():this.safeToRemove(),e.isPresent!==l&&(l?u.promote():u.relegate()||Le.postRender(()=>{const d=u.getStack();(!d||!d.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),pd.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:o}=e;o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),i&&i.deregister&&i.deregister(o))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Rv(t){const[e,n]=py(),i=R.useContext(od);return p.jsx($S,{...t,layoutGroup:i,switchLayoutGroup:R.useContext(_y),isPresent:e,safeToRemove:n})}const VS={borderRadius:{...ui,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ui,borderTopRightRadius:ui,borderBottomLeftRadius:ui,borderBottomRightRadius:ui,boxShadow:US};function FS(t,e,n){const i=pt(t)?t:ji(t);return i.start($d("",i,e,n)),i.animation}function BS(t){return t instanceof SVGElement&&t.tagName!=="svg"}const zS=(t,e)=>t.depth-e.depth;class qS{constructor(){this.children=[],this.isDirty=!1}add(e){Cd(this.children,e),this.isDirty=!0}remove(e){Nd(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(zS),this.isDirty=!1,this.children.forEach(e)}}function WS(t,e){const n=un.now(),i=({timestamp:o})=>{const l=o-n;l>=e&&(Gn(i),t(l-e))};return Le.read(i,!0),()=>Gn(i)}const Ov=["TopLeft","TopRight","BottomLeft","BottomRight"],HS=Ov.length,Xm=t=>typeof t=="string"?parseFloat(t):t,Zm=t=>typeof t=="number"||de.test(t);function KS(t,e,n,i,o,l){o?(t.opacity=Be(0,n.opacity!==void 0?n.opacity:1,GS(i)),t.opacityExit=Be(e.opacity!==void 0?e.opacity:1,0,JS(i))):l&&(t.opacity=Be(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,i));for(let u=0;u<HS;u++){const d=`border${Ov[u]}Radius`;let h=eg(e,d),m=eg(n,d);if(h===void 0&&m===void 0)continue;h||(h=0),m||(m=0),h===0||m===0||Zm(h)===Zm(m)?(t[d]=Math.max(Be(Xm(h),Xm(m),i),0),(ln.test(m)||ln.test(h))&&(t[d]+="%")):t[d]=m}(e.rotate||n.rotate)&&(t.rotate=Be(e.rotate||0,n.rotate||0,i))}function eg(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const GS=Iv(0,.5,Xy),JS=Iv(.5,.95,Ot);function Iv(t,e,n){return i=>i<t?0:i>e?1:n(ms(t,e,i))}function tg(t,e){t.min=e.min,t.max=e.max}function Ft(t,e){tg(t.x,e.x),tg(t.y,e.y)}function ng(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function rg(t,e,n,i,o){return t-=e,t=ja(t,1/n,i),o!==void 0&&(t=ja(t,1/o,i)),t}function YS(t,e=0,n=1,i=.5,o,l=t,u=t){if(ln.test(e)&&(e=parseFloat(e),e=Be(u.min,u.max,e/100)-u.min),typeof e!="number")return;let d=Be(l.min,l.max,i);t===l&&(d-=e),t.min=rg(t.min,e,n,d,o),t.max=rg(t.max,e,n,d,o)}function sg(t,e,[n,i,o],l,u){YS(t,e[n],e[i],e[o],e.scale,l,u)}const QS=["x","scaleX","originX"],XS=["y","scaleY","originY"];function ig(t,e,n,i){sg(t.x,e,QS,n?n.x:void 0,i?i.x:void 0),sg(t.y,e,XS,n?n.y:void 0,i?i.y:void 0)}function og(t){return t.translate===0&&t.scale===1}function Dv(t){return og(t.x)&&og(t.y)}function ag(t,e){return t.min===e.min&&t.max===e.max}function ZS(t,e){return ag(t.x,e.x)&&ag(t.y,e.y)}function lg(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function Lv(t,e){return lg(t.x,e.x)&&lg(t.y,e.y)}function ug(t){return It(t.x)/It(t.y)}function cg(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class ek{constructor(){this.members=[]}add(e){Cd(this.members,e),e.scheduleRender()}remove(e){if(Nd(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(o=>e===o);if(n===0)return!1;let i;for(let o=n;o>=0;o--){const l=this.members[o];if(l.isPresent!==!1){i=l;break}}return i?(this.promote(i),!0):!1}promote(e,n){const i=this.lead;if(e!==i&&(this.prevLead=i,this.lead=e,e.show(),i)){i.instance&&i.scheduleRender(),e.scheduleRender(),e.resumeFrom=i,n&&(e.resumeFrom.preserveOpacity=!0),i.snapshot&&(e.snapshot=i.snapshot,e.snapshot.latestValues=i.animationValues||i.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:o}=e.options;o===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:i}=e;n.onExitComplete&&n.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function tk(t,e,n){let i="";const o=t.x.translate/e.x,l=t.y.translate/e.y,u=n?.z||0;if((o||l||u)&&(i=`translate3d(${o}px, ${l}px, ${u}px) `),(e.x!==1||e.y!==1)&&(i+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:m,rotate:y,rotateX:v,rotateY:w,skewX:_,skewY:b}=n;m&&(i=`perspective(${m}px) ${i}`),y&&(i+=`rotate(${y}deg) `),v&&(i+=`rotateX(${v}deg) `),w&&(i+=`rotateY(${w}deg) `),_&&(i+=`skewX(${_}deg) `),b&&(i+=`skewY(${b}deg) `)}const d=t.x.scale*e.x,h=t.y.scale*e.y;return(d!==1||h!==1)&&(i+=`scale(${d}, ${h})`),i||"none"}const pr={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},pi=typeof window<"u"&&window.MotionDebug!==void 0,rc=["","X","Y","Z"],nk={visibility:"hidden"},dg=1e3;let rk=0;function sc(t,e,n,i){const{latestValues:o}=e;o[t]&&(n[t]=o[t],e.setStaticValue(t,0),i&&(i[t]=0))}function Mv(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Wy(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:l}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Le,!(o||l))}const{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&Mv(i)}function Uv({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:i,resetTransform:o}){return class{constructor(u={},d=e?.()){this.id=rk++,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.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,pi&&(pr.totalNodes=pr.resolvedTargetDeltas=pr.recalculatedProjection=0),this.nodes.forEach(ok),this.nodes.forEach(dk),this.nodes.forEach(hk),this.nodes.forEach(ak),pi&&window.MotionDebug.record(pr)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=d?d.root||d:this,this.path=d?[...d.path,d]:[],this.parent=d,this.depth=d?d.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new qS)}addEventListener(u,d){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Ad),this.eventHandlers.get(u).add(d)}notifyListeners(u,...d){const h=this.eventHandlers.get(u);h&&h.notify(...d)}hasListeners(u){return this.eventHandlers.has(u)}mount(u,d=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=BS(u),this.instance=u;const{layoutId:h,layout:m,visualElement:y}=this.options;if(y&&!y.current&&y.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),d&&(m||h)&&(this.isLayoutDirty=!0),t){let v;const w=()=>this.root.updateBlockedByResize=!1;t(u,()=>{this.root.updateBlockedByResize=!0,v&&v(),v=WS(w,250),ya.hasAnimatedSinceResize&&(ya.hasAnimatedSinceResize=!1,this.nodes.forEach(fg))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&y&&(h||m)&&this.addEventListener("didUpdate",({delta:v,hasLayoutChanged:w,hasRelativeTargetChanged:_,layout:b})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const k=this.options.transition||y.getDefaultTransition()||yk,{onLayoutAnimationStart:S,onLayoutAnimationComplete:E}=y.getProps(),A=!this.targetLayout||!Lv(this.targetLayout,b)||_,P=!w&&_;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||P||w&&(A||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(v,P);const U={...kd(k,"layout"),onPlay:S,onComplete:E};(y.shouldReduceMotion||this.options.layoutRoot)&&(U.delay=0,U.type=!1),this.startAnimation(U)}else w||fg(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=b})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Gn(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(fk),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Mv(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let y=0;y<this.path.length;y++){const v=this.path[y];v.shouldResetTransform=!0,v.updateScroll("snapshot"),v.options.layoutRoot&&v.willUpdate(!1)}const{layoutId:d,layout:h}=this.options;if(d===void 0&&!h)return;const m=this.getTransformTemplate();this.prevTransformTemplateValue=m?m(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(hg);return}this.isUpdating||this.nodes.forEach(uk),this.isUpdating=!1,this.nodes.forEach(ck),this.nodes.forEach(sk),this.nodes.forEach(ik),this.clearAllSnapshots();const d=un.now();at.delta=_n(0,1e3/60,d-at.timestamp),at.timestamp=d,at.isProcessing=!0,Gu.update.process(at),Gu.preRender.process(at),Gu.render.process(at),at.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,pd.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(lk),this.sharedNodes.forEach(pk)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Le.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Le.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 h=0;h<this.path.length;h++)this.path[h].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Ge(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:d}=this.options;d&&d.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let d=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(d=!1),d){const h=i(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:h,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!o)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,d=this.projectionDelta&&!Dv(this.projectionDelta),h=this.getTransformTemplate(),m=h?h(this.latestValues,""):void 0,y=m!==this.prevTransformTemplateValue;u&&(d||fr(this.latestValues)||y)&&(o(this.instance,m),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const d=this.measurePageBox();let h=this.removeElementScroll(d);return u&&(h=this.removeTransform(h)),vk(h),{animationId:this.root.animationId,measuredBox:d,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:d}=this.options;if(!d)return Ge();const h=d.measureViewportBox();if(!(((u=this.scroll)===null||u===void 0?void 0:u.wasRoot)||this.path.some(wk))){const{scroll:y}=this.root;y&&(us(h.x,y.offset.x),us(h.y,y.offset.y))}return h}removeElementScroll(u){var d;const h=Ge();if(Ft(h,u),!((d=this.scroll)===null||d===void 0)&&d.wasRoot)return h;for(let m=0;m<this.path.length;m++){const y=this.path[m],{scroll:v,options:w}=y;y!==this.root&&v&&w.layoutScroll&&(v.wasRoot&&Ft(h,u),us(h.x,v.offset.x),us(h.y,v.offset.y))}return h}applyTransform(u,d=!1){const h=Ge();Ft(h,u);for(let m=0;m<this.path.length;m++){const y=this.path[m];!d&&y.options.layoutScroll&&y.scroll&&y!==y.root&&cs(h,{x:-y.scroll.offset.x,y:-y.scroll.offset.y}),fr(y.latestValues)&&cs(h,y.latestValues)}return fr(this.latestValues)&&cs(h,this.latestValues),h}removeTransform(u){const d=Ge();Ft(d,u);for(let h=0;h<this.path.length;h++){const m=this.path[h];if(!m.instance||!fr(m.latestValues))continue;Lc(m.latestValues)&&m.updateSnapshot();const y=Ge(),v=m.measurePageBox();Ft(y,v),ig(d,m.latestValues,m.snapshot?m.snapshot.layoutBox:void 0,y)}return fr(this.latestValues)&&ig(d,this.latestValues),d}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==at.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){var d;const h=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=h.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=h.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=h.isSharedProjectionDirty);const m=!!this.resumingFrom||this!==h;if(!(u||m&&this.isSharedProjectionDirty||this.isProjectionDirty||!((d=this.parent)===null||d===void 0)&&d.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:v,layoutId:w}=this.options;if(!(!this.layout||!(v||w))){if(this.resolvedRelativeTargetAt=at.timestamp,!this.targetDelta&&!this.relativeTarget){const _=this.getClosestProjectingParent();_&&_.layout&&this.animationProgress!==1?(this.relativeParent=_,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ge(),this.relativeTargetOrigin=Ge(),wi(this.relativeTargetOrigin,this.layout.layoutBox,_.layout.layoutBox),Ft(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Ge(),this.targetWithTransforms=Ge()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),_S(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Ft(this.target,this.layout.layoutBox),Nv(this.target,this.targetDelta)):Ft(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const _=this.getClosestProjectingParent();_&&!!_.resumingFrom==!!this.resumingFrom&&!_.options.layoutScroll&&_.target&&this.animationProgress!==1?(this.relativeParent=_,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ge(),this.relativeTargetOrigin=Ge(),wi(this.relativeTargetOrigin,this.target,_.target),Ft(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}pi&&pr.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Lc(this.parent.latestValues)||Cv(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var u;const d=this.getLead(),h=!!this.resumingFrom||this!==d;let m=!0;if((this.isProjectionDirty||!((u=this.parent)===null||u===void 0)&&u.isProjectionDirty)&&(m=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(m=!1),this.resolvedRelativeTargetAt===at.timestamp&&(m=!1),m)return;const{layout:y,layoutId:v}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(y||v))return;Ft(this.layoutCorrected,this.layout.layoutBox);const w=this.treeScale.x,_=this.treeScale.y;PS(this.layoutCorrected,this.treeScale,this.path,h),d.layout&&!d.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(d.target=d.layout.layoutBox,d.targetWithTransforms=Ge());const{target:b}=d;if(!b){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(ng(this.prevProjectionDelta.x,this.projectionDelta.x),ng(this.prevProjectionDelta.y,this.projectionDelta.y)),vi(this.projectionDelta,this.layoutCorrected,b,this.latestValues),(this.treeScale.x!==w||this.treeScale.y!==_||!cg(this.projectionDelta.x,this.prevProjectionDelta.x)||!cg(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",b)),pi&&pr.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){var d;if((d=this.options.visualElement)===null||d===void 0||d.scheduleRender(),u){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ls(),this.projectionDelta=ls(),this.projectionDeltaWithTransform=ls()}setAnimationOrigin(u,d=!1){const h=this.snapshot,m=h?h.latestValues:{},y={...this.latestValues},v=ls();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!d;const w=Ge(),_=h?h.source:void 0,b=this.layout?this.layout.source:void 0,k=_!==b,S=this.getStack(),E=!S||S.members.length<=1,A=!!(k&&!E&&this.options.crossfade===!0&&!this.path.some(gk));this.animationProgress=0;let P;this.mixTargetDelta=U=>{const V=U/1e3;pg(v.x,u.x,V),pg(v.y,u.y,V),this.setTargetDelta(v),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(wi(w,this.layout.layoutBox,this.relativeParent.layout.layoutBox),mk(this.relativeTarget,this.relativeTargetOrigin,w,V),P&&ZS(this.relativeTarget,P)&&(this.isProjectionDirty=!1),P||(P=Ge()),Ft(P,this.relativeTarget)),k&&(this.animationValues=y,KS(y,m,this.latestValues,V,A,E)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=V},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Gn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Le.update(()=>{ya.hasAnimatedSinceResize=!0,this.currentAnimation=FS(0,dg,{...u,onUpdate:d=>{this.mixTargetDelta(d),u.onUpdate&&u.onUpdate(d)},onComplete:()=>{u.onComplete&&u.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 u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(dg),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:d,target:h,layout:m,latestValues:y}=u;if(!(!d||!h||!m)){if(this!==u&&this.layout&&m&&$v(this.options.animationType,this.layout.layoutBox,m.layoutBox)){h=this.target||Ge();const v=It(this.layout.layoutBox.x);h.x.min=u.target.x.min,h.x.max=h.x.min+v;const w=It(this.layout.layoutBox.y);h.y.min=u.target.y.min,h.y.max=h.y.min+w}Ft(d,h),cs(d,y),vi(this.projectionDeltaWithTransform,this.layoutCorrected,d,y)}}registerSharedNode(u,d){this.sharedNodes.has(u)||this.sharedNodes.set(u,new ek),this.sharedNodes.get(u).add(d);const m=d.options.initialPromotionConfig;d.promote({transition:m?m.transition:void 0,preserveFollowOpacity:m&&m.shouldPreserveFollowOpacity?m.shouldPreserveFollowOpacity(d):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){var u;const{layoutId:d}=this.options;return d?((u=this.getStack())===null||u===void 0?void 0:u.lead)||this:this}getPrevLead(){var u;const{layoutId:d}=this.options;return d?(u=this.getStack())===null||u===void 0?void 0:u.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:d,preserveFollowOpacity:h}={}){const m=this.getStack();m&&m.promote(this,h),u&&(this.projectionDelta=void 0,this.needsReset=!0),d&&this.setOptions({transition:d})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let d=!1;const{latestValues:h}=u;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(d=!0),!d)return;const m={};h.z&&sc("z",u,m,this.animationValues);for(let y=0;y<rc.length;y++)sc(`rotate${rc[y]}`,u,m,this.animationValues),sc(`skew${rc[y]}`,u,m,this.animationValues);u.render();for(const y in m)u.setStaticValue(y,m[y]),this.animationValues&&(this.animationValues[y]=m[y]);u.scheduleRender()}getProjectionStyles(u){var d,h;if(!this.instance||this.isSVG)return;if(!this.isVisible)return nk;const m={visibility:""},y=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,m.opacity="",m.pointerEvents=ma(u?.pointerEvents)||"",m.transform=y?y(this.latestValues,""):"none",m;const v=this.getLead();if(!this.projectionDelta||!this.layout||!v.target){const k={};return this.options.layoutId&&(k.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,k.pointerEvents=ma(u?.pointerEvents)||""),this.hasProjected&&!fr(this.latestValues)&&(k.transform=y?y({},""):"none",this.hasProjected=!1),k}const w=v.animationValues||v.latestValues;this.applyTransformsToTarget(),m.transform=tk(this.projectionDeltaWithTransform,this.treeScale,w),y&&(m.transform=y(w,m.transform));const{x:_,y:b}=this.projectionDelta;m.transformOrigin=`${_.origin*100}% ${b.origin*100}% 0`,v.animationValues?m.opacity=v===this?(h=(d=w.opacity)!==null&&d!==void 0?d:this.latestValues.opacity)!==null&&h!==void 0?h:1:this.preserveOpacity?this.latestValues.opacity:w.opacityExit:m.opacity=v===this?w.opacity!==void 0?w.opacity:"":w.opacityExit!==void 0?w.opacityExit:0;for(const k in _a){if(w[k]===void 0)continue;const{correct:S,applyTo:E}=_a[k],A=m.transform==="none"?w[k]:S(w[k],v);if(E){const P=E.length;for(let U=0;U<P;U++)m[E[U]]=A}else m[k]=A}return this.options.layoutId&&(m.pointerEvents=v===this?ma(u?.pointerEvents)||"":"none"),m}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>{var d;return(d=u.currentAnimation)===null||d===void 0?void 0:d.stop()}),this.root.nodes.forEach(hg),this.root.sharedNodes.clear()}}}function sk(t){t.updateLayout()}function ik(t){var e;const n=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:o}=t.layout,{animationType:l}=t.options,u=n.source!==t.layout.source;l==="size"?Bt(v=>{const w=u?n.measuredBox[v]:n.layoutBox[v],_=It(w);w.min=i[v].min,w.max=w.min+_}):$v(l,n.layoutBox,i)&&Bt(v=>{const w=u?n.measuredBox[v]:n.layoutBox[v],_=It(i[v]);w.max=w.min+_,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[v].max=t.relativeTarget[v].min+_)});const d=ls();vi(d,i,n.layoutBox);const h=ls();u?vi(h,t.applyTransform(o,!0),n.measuredBox):vi(h,i,n.layoutBox);const m=!Dv(d);let y=!1;if(!t.resumeFrom){const v=t.getClosestProjectingParent();if(v&&!v.resumeFrom){const{snapshot:w,layout:_}=v;if(w&&_){const b=Ge();wi(b,n.layoutBox,w.layoutBox);const k=Ge();wi(k,i,_.layoutBox),Lv(b,k)||(y=!0),v.options.layoutRoot&&(t.relativeTarget=k,t.relativeTargetOrigin=b,t.relativeParent=v)}}}t.notifyListeners("didUpdate",{layout:i,snapshot:n,delta:h,layoutDelta:d,hasLayoutChanged:m,hasRelativeTargetChanged:y})}else if(t.isLead()){const{onExitComplete:i}=t.options;i&&i()}t.options.transition=void 0}function ok(t){pi&&pr.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function ak(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function lk(t){t.clearSnapshot()}function hg(t){t.clearMeasurements()}function uk(t){t.isLayoutDirty=!1}function ck(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function fg(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function dk(t){t.resolveTargetDelta()}function hk(t){t.calcProjection()}function fk(t){t.resetSkewAndRotation()}function pk(t){t.removeLeadSnapshot()}function pg(t,e,n){t.translate=Be(e.translate,0,n),t.scale=Be(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function mg(t,e,n,i){t.min=Be(e.min,n.min,i),t.max=Be(e.max,n.max,i)}function mk(t,e,n,i){mg(t.x,e.x,n.x,i),mg(t.y,e.y,n.y,i)}function gk(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const yk={duration:.45,ease:[.4,0,.1,1]},gg=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),yg=gg("applewebkit/")&&!gg("chrome/")?Math.round:Ot;function vg(t){t.min=yg(t.min),t.max=yg(t.max)}function vk(t){vg(t.x),vg(t.y)}function $v(t,e,n){return t==="position"||t==="preserve-aspect"&&!bS(ug(e),ug(n),.2)}function wk(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const xk=Uv({attachResizeListener:(t,e)=>Ni(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ic={current:void 0},Vv=Uv({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!ic.current){const t=new xk({});t.mount(window),t.setOptions({layoutScroll:!0}),ic.current=t}return ic.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),bk={pan:{Feature:MS},drag:{Feature:LS,ProjectionNode:Vv,MeasureLayout:Rv}};function wg(t,e,n){const{props:i}=t;t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,l=i[o];l&&Le.postRender(()=>l(e,Fi(e)))}class _k extends Yn{mount(){const{current:e}=this.node;e&&(this.unmount=bb(e,n=>(wg(this.node,n,"Start"),i=>wg(this.node,i,"End"))))}unmount(){}}class Sk extends Yn{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Vi(Ni(this.node.current,"focus",()=>this.onFocus()),Ni(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function xg(t,e,n){const{props:i}=t;t.animationState&&i.whileTap&&t.animationState.setActive("whileTap",n==="Start");const o="onTap"+(n==="End"?"":n),l=i[o];l&&Le.postRender(()=>l(e,Fi(e)))}class kk extends Yn{mount(){const{current:e}=this.node;e&&(this.unmount=Eb(e,n=>(xg(this.node,n,"Start"),(i,{success:o})=>xg(this.node,i,o?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Uc=new WeakMap,oc=new WeakMap,Ek=t=>{const e=Uc.get(t.target);e&&e(t)},Tk=t=>{t.forEach(Ek)};function jk({root:t,...e}){const n=t||document;oc.has(n)||oc.set(n,{});const i=oc.get(n),o=JSON.stringify(e);return i[o]||(i[o]=new IntersectionObserver(Tk,{root:t,...e})),i[o]}function Ck(t,e,n){const i=jk(e);return Uc.set(t,n),i.observe(t),()=>{Uc.delete(t),i.unobserve(t)}}const Nk={some:0,all:1};class Ak extends Yn{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:i,amount:o="some",once:l}=e,u={root:n?n.current:void 0,rootMargin:i,threshold:typeof o=="number"?o:Nk[o]},d=h=>{const{isIntersecting:m}=h;if(this.isInView===m||(this.isInView=m,l&&!m&&this.hasEnteredView))return;m&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",m);const{onViewportEnter:y,onViewportLeave:v}=this.node.getProps(),w=m?y:v;w&&w(h)};return Ck(this.node.current,u,d)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(Pk(e,n))&&this.startObserver()}unmount(){}}function Pk({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const Rk={inView:{Feature:Ak},tap:{Feature:kk},focus:{Feature:Sk},hover:{Feature:_k}},Ok={layout:{ProjectionNode:Vv,MeasureLayout:Rv}},$c={current:null},Fv={current:!1};function Ik(){if(Fv.current=!0,!!ud)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>$c.current=t.matches;t.addListener(e),e()}else $c.current=!1}const Dk=[...hv,ht,Jn],Lk=t=>Dk.find(dv(t)),bg=new WeakMap;function Mk(t,e,n){for(const i in e){const o=e[i],l=n[i];if(pt(o))t.addValue(i,o);else if(pt(l))t.addValue(i,ji(o,{owner:t}));else if(l!==o)if(t.hasValue(i)){const u=t.getValue(i);u.liveStyle===!0?u.jump(o):u.hasAnimated||u.set(o)}else{const u=t.getStaticValue(i);t.addValue(i,ji(u!==void 0?u:o,{owner:t}))}}for(const i in n)e[i]===void 0&&t.removeValue(i);return e}const _g=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Uk{scrapeMotionValuesFromProps(e,n,i){return{}}constructor({parent:e,props:n,presenceContext:i,reducedMotionConfig:o,blockInitialAnimation:l,visualState:u},d={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Ld,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.renderScheduledAt=0,this.scheduleRender=()=>{const _=un.now();this.renderScheduledAt<_&&(this.renderScheduledAt=_,Le.render(this.render,!1,!0))};const{latestValues:h,renderState:m,onUpdate:y}=u;this.onUpdate=y,this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=m,this.parent=e,this.props=n,this.presenceContext=i,this.depth=e?e.depth+1:0,this.reducedMotionConfig=o,this.options=d,this.blockInitialAnimation=!!l,this.isControllingVariants=Ma(n),this.isVariantNode=xy(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:v,...w}=this.scrapeMotionValuesFromProps(n,{},this);for(const _ in w){const b=w[_];h[_]!==void 0&&pt(b)&&b.set(h[_],!1)}}mount(e){this.current=e,bg.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,i)=>this.bindToMotionValue(i,n)),Fv.current||Ik(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:$c.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){bg.delete(this.current),this.projection&&this.projection.unmount(),Gn(this.notifyUpdate),Gn(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const i=Er.has(e),o=n.on("change",d=>{this.latestValues[e]=d,this.props.onUpdate&&Le.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0)}),l=n.on("renderRequest",this.scheduleRender);let u;window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{o(),l(),u&&u(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in gs){const n=gs[e];if(!n)continue;const{isEnabled:i,Feature:o}=n;if(!this.features[e]&&o&&i(this.props)&&(this.features[e]=new o(this)),this.features[e]){const l=this.features[e];l.isMounted?l.update():(l.mount(),l.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ge()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let i=0;i<_g.length;i++){const o=_g[i];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const l="on"+o,u=e[l];u&&(this.propEventSubscriptions[o]=this.on(o,u))}this.prevMotionValues=Mk(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const i=this.values.get(e);n!==i&&(i&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let i=this.values.get(e);return i===void 0&&n!==void 0&&(i=ji(n===null?void 0:n,{owner:this}),this.addValue(e,i)),i}readValue(e,n){var i;let o=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(i=this.getBaseTargetFromProps(this.props,e))!==null&&i!==void 0?i:this.readValueFromInstance(this.current,e,this.options);return o!=null&&(typeof o=="string"&&(uv(o)||ev(o))?o=parseFloat(o):!Lk(o)&&Jn.test(n)&&(o=ov(e,n)),this.setBaseTarget(e,pt(o)?o.get():o)),pt(o)?o.get():o}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;const{initial:i}=this.props;let o;if(typeof i=="string"||typeof i=="object"){const u=gd(this.props,i,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);u&&(o=u[e])}if(i&&o!==void 0)return o;const l=this.getBaseTargetFromProps(this.props,e);return l!==void 0&&!pt(l)?l:this.initialValues[e]!==void 0&&o===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new Ad),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class Bv extends Uk{constructor(){super(...arguments),this.KeyframeResolver=fv}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:i}){delete n[e],delete i[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;pt(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function $k(t){return window.getComputedStyle(t)}class Vk extends Bv{constructor(){super(...arguments),this.type="html",this.renderInstance=Ny}readValueFromInstance(e,n){if(Er.has(n)){const i=Dd(n);return i&&i.default||0}else{const i=$k(e),o=(Ty(n)?i.getPropertyValue(n):i[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(e,{transformPagePoint:n}){return Av(e,n)}build(e,n,i){wd(e,n,i.transformTemplate)}scrapeMotionValuesFromProps(e,n,i){return Sd(e,n,i)}}class Fk extends Bv{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ge}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Er.has(n)){const i=Dd(n);return i&&i.default||0}return n=Ay.has(n)?n:fd(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,i){return Oy(e,n,i)}build(e,n,i){xd(e,n,this.isSVGTag,i.transformTemplate)}renderInstance(e,n,i,o){Py(e,n,i,o)}mount(e){this.isSVGTag=_d(e.tagName),super.mount(e)}}const Bk=(t,e)=>md(t)?new Fk(e):new Vk(e,{allowProjection:t!==R.Fragment}),zk=pb({...hS,...Rk,...bk,...Ok},Bk),Ne=N1(zk);function zv(t,e){return function(){return t.apply(e,arguments)}}const{toString:qk}=Object.prototype,{getPrototypeOf:Vd}=Object,{iterator:Va,toStringTag:qv}=Symbol,Fa=(t=>e=>{const n=qk.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),en=t=>(t=t.toLowerCase(),e=>Fa(e)===t),Ba=t=>e=>typeof e===t,{isArray:bs}=Array,vs=Ba("undefined");function Bi(t){return t!==null&&!vs(t)&&t.constructor!==null&&!vs(t.constructor)&&St(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Wv=en("ArrayBuffer");function Wk(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Wv(t.buffer),e}const Hk=Ba("string"),St=Ba("function"),Hv=Ba("number"),zi=t=>t!==null&&typeof t=="object",Kk=t=>t===!0||t===!1,va=t=>{if(Fa(t)!=="object")return!1;const e=Vd(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(qv in t)&&!(Va in t)},Gk=t=>{if(!zi(t)||Bi(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Jk=en("Date"),Yk=en("File"),Qk=en("Blob"),Xk=en("FileList"),Zk=t=>zi(t)&&St(t.pipe),eE=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||St(t.append)&&((e=Fa(t))==="formdata"||e==="object"&&St(t.toString)&&t.toString()==="[object FormData]"))},tE=en("URLSearchParams"),[nE,rE,sE,iE]=["ReadableStream","Request","Response","Headers"].map(en),oE=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function qi(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let i,o;if(typeof t!="object"&&(t=[t]),bs(t))for(i=0,o=t.length;i<o;i++)e.call(null,t[i],i,t);else{if(Bi(t))return;const l=n?Object.getOwnPropertyNames(t):Object.keys(t),u=l.length;let d;for(i=0;i<u;i++)d=l[i],e.call(null,t[d],d,t)}}function Kv(t,e){if(Bi(t))return null;e=e.toLowerCase();const n=Object.keys(t);let i=n.length,o;for(;i-- >0;)if(o=n[i],e===o.toLowerCase())return o;return null}const wr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Gv=t=>!vs(t)&&t!==wr;function Vc(){const{caseless:t,skipUndefined:e}=Gv(this)&&this||{},n={},i=(o,l)=>{const u=t&&Kv(n,l)||l;va(n[u])&&va(o)?n[u]=Vc(n[u],o):va(o)?n[u]=Vc({},o):bs(o)?n[u]=o.slice():(!e||!vs(o))&&(n[u]=o)};for(let o=0,l=arguments.length;o<l;o++)arguments[o]&&qi(arguments[o],i);return n}const aE=(t,e,n,{allOwnKeys:i}={})=>(qi(e,(o,l)=>{n&&St(o)?t[l]=zv(o,n):t[l]=o},{allOwnKeys:i}),t),lE=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),uE=(t,e,n,i)=>{t.prototype=Object.create(e.prototype,i),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},cE=(t,e,n,i)=>{let o,l,u;const d={};if(e=e||{},t==null)return e;do{for(o=Object.getOwnPropertyNames(t),l=o.length;l-- >0;)u=o[l],(!i||i(u,t,e))&&!d[u]&&(e[u]=t[u],d[u]=!0);t=n!==!1&&Vd(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},dE=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const i=t.indexOf(e,n);return i!==-1&&i===n},hE=t=>{if(!t)return null;if(bs(t))return t;let e=t.length;if(!Hv(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},fE=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Vd(Uint8Array)),pE=(t,e)=>{const i=(t&&t[Va]).call(t);let o;for(;(o=i.next())&&!o.done;){const l=o.value;e.call(t,l[0],l[1])}},mE=(t,e)=>{let n;const i=[];for(;(n=t.exec(e))!==null;)i.push(n);return i},gE=en("HTMLFormElement"),yE=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,i,o){return i.toUpperCase()+o}),Sg=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),vE=en("RegExp"),Jv=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),i={};qi(n,(o,l)=>{let u;(u=e(o,l,t))!==!1&&(i[l]=u||o)}),Object.defineProperties(t,i)},wE=t=>{Jv(t,(e,n)=>{if(St(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const i=t[n];if(St(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},xE=(t,e)=>{const n={},i=o=>{o.forEach(l=>{n[l]=!0})};return bs(t)?i(t):i(String(t).split(e)),n},bE=()=>{},_E=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function SE(t){return!!(t&&St(t.append)&&t[qv]==="FormData"&&t[Va])}const kE=t=>{const e=new Array(10),n=(i,o)=>{if(zi(i)){if(e.indexOf(i)>=0)return;if(Bi(i))return i;if(!("toJSON"in i)){e[o]=i;const l=bs(i)?[]:{};return qi(i,(u,d)=>{const h=n(u,o+1);!vs(h)&&(l[d]=h)}),e[o]=void 0,l}}return i};return n(t,0)},EE=en("AsyncFunction"),TE=t=>t&&(zi(t)||St(t))&&St(t.then)&&St(t.catch),Yv=((t,e)=>t?setImmediate:e?((n,i)=>(wr.addEventListener("message",({source:o,data:l})=>{o===wr&&l===n&&i.length&&i.shift()()},!1),o=>{i.push(o),wr.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",St(wr.postMessage)),jE=typeof queueMicrotask<"u"?queueMicrotask.bind(wr):typeof process<"u"&&process.nextTick||Yv,CE=t=>t!=null&&St(t[Va]),M={isArray:bs,isArrayBuffer:Wv,isBuffer:Bi,isFormData:eE,isArrayBufferView:Wk,isString:Hk,isNumber:Hv,isBoolean:Kk,isObject:zi,isPlainObject:va,isEmptyObject:Gk,isReadableStream:nE,isRequest:rE,isResponse:sE,isHeaders:iE,isUndefined:vs,isDate:Jk,isFile:Yk,isBlob:Qk,isRegExp:vE,isFunction:St,isStream:Zk,isURLSearchParams:tE,isTypedArray:fE,isFileList:Xk,forEach:qi,merge:Vc,extend:aE,trim:oE,stripBOM:lE,inherits:uE,toFlatObject:cE,kindOf:Fa,kindOfTest:en,endsWith:dE,toArray:hE,forEachEntry:pE,matchAll:mE,isHTMLForm:gE,hasOwnProperty:Sg,hasOwnProp:Sg,reduceDescriptors:Jv,freezeMethods:wE,toObjectSet:xE,toCamelCase:yE,noop:bE,toFiniteNumber:_E,findKey:Kv,global:wr,isContextDefined:Gv,isSpecCompliantForm:SE,toJSONObject:kE,isAsyncFn:EE,isThenable:TE,setImmediate:Yv,asap:jE,isIterable:CE};function ye(t,e,n,i,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),i&&(this.request=i),o&&(this.response=o,this.status=o.status?o.status:null)}M.inherits(ye,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:M.toJSONObject(this.config),code:this.code,status:this.status}}});const Qv=ye.prototype,Xv={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{Xv[t]={value:t}});Object.defineProperties(ye,Xv);Object.defineProperty(Qv,"isAxiosError",{value:!0});ye.from=(t,e,n,i,o,l)=>{const u=Object.create(Qv);M.toFlatObject(t,u,function(y){return y!==Error.prototype},m=>m!=="isAxiosError");const d=t&&t.message?t.message:"Error",h=e==null&&t?t.code:e;return ye.call(u,d,h,n,i,o),t&&u.cause==null&&Object.defineProperty(u,"cause",{value:t,configurable:!0}),u.name=t&&t.name||"Error",l&&Object.assign(u,l),u};const NE=null;function Fc(t){return M.isPlainObject(t)||M.isArray(t)}function Zv(t){return M.endsWith(t,"[]")?t.slice(0,-2):t}function kg(t,e,n){return t?t.concat(e).map(function(o,l){return o=Zv(o),!n&&l?"["+o+"]":o}).join(n?".":""):e}function AE(t){return M.isArray(t)&&!t.some(Fc)}const PE=M.toFlatObject(M,{},null,function(e){return/^is[A-Z]/.test(e)});function za(t,e,n){if(!M.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=M.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(k,S){return!M.isUndefined(S[k])});const i=n.metaTokens,o=n.visitor||y,l=n.dots,u=n.indexes,h=(n.Blob||typeof Blob<"u"&&Blob)&&M.isSpecCompliantForm(e);if(!M.isFunction(o))throw new TypeError("visitor must be a function");function m(b){if(b===null)return"";if(M.isDate(b))return b.toISOString();if(M.isBoolean(b))return b.toString();if(!h&&M.isBlob(b))throw new ye("Blob is not supported. Use a Buffer instead.");return M.isArrayBuffer(b)||M.isTypedArray(b)?h&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function y(b,k,S){let E=b;if(b&&!S&&typeof b=="object"){if(M.endsWith(k,"{}"))k=i?k:k.slice(0,-2),b=JSON.stringify(b);else if(M.isArray(b)&&AE(b)||(M.isFileList(b)||M.endsWith(k,"[]"))&&(E=M.toArray(b)))return k=Zv(k),E.forEach(function(P,U){!(M.isUndefined(P)||P===null)&&e.append(u===!0?kg([k],U,l):u===null?k:k+"[]",m(P))}),!1}return Fc(b)?!0:(e.append(kg(S,k,l),m(b)),!1)}const v=[],w=Object.assign(PE,{defaultVisitor:y,convertValue:m,isVisitable:Fc});function _(b,k){if(!M.isUndefined(b)){if(v.indexOf(b)!==-1)throw Error("Circular reference detected in "+k.join("."));v.push(b),M.forEach(b,function(E,A){(!(M.isUndefined(E)||E===null)&&o.call(e,E,M.isString(A)?A.trim():A,k,w))===!0&&_(E,k?k.concat(A):[A])}),v.pop()}}if(!M.isObject(t))throw new TypeError("data must be an object");return _(t),e}function Eg(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function Fd(t,e){this._pairs=[],t&&za(t,this,e)}const e0=Fd.prototype;e0.append=function(e,n){this._pairs.push([e,n])};e0.toString=function(e){const n=e?function(i){return e.call(this,i,Eg)}:Eg;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function RE(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function t0(t,e,n){if(!e)return t;const i=n&&n.encode||RE;M.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let l;if(o?l=o(e,n):l=M.isURLSearchParams(e)?e.toString():new Fd(e,n).toString(i),l){const u=t.indexOf("#");u!==-1&&(t=t.slice(0,u)),t+=(t.indexOf("?")===-1?"?":"&")+l}return t}class Tg{constructor(){this.handlers=[]}use(e,n,i){return this.handlers.push({fulfilled:e,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){M.forEach(this.handlers,function(i){i!==null&&e(i)})}}const n0={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},OE=typeof URLSearchParams<"u"?URLSearchParams:Fd,IE=typeof FormData<"u"?FormData:null,DE=typeof Blob<"u"?Blob:null,LE={isBrowser:!0,classes:{URLSearchParams:OE,FormData:IE,Blob:DE},protocols:["http","https","file","blob","url","data"]},Bd=typeof window<"u"&&typeof document<"u",Bc=typeof navigator=="object"&&navigator||void 0,ME=Bd&&(!Bc||["ReactNative","NativeScript","NS"].indexOf(Bc.product)<0),UE=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",$E=Bd&&window.location.href||"http://localhost",VE=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Bd,hasStandardBrowserEnv:ME,hasStandardBrowserWebWorkerEnv:UE,navigator:Bc,origin:$E},Symbol.toStringTag,{value:"Module"})),ft={...VE,...LE};function FE(t,e){return za(t,new ft.classes.URLSearchParams,{visitor:function(n,i,o,l){return ft.isNode&&M.isBuffer(n)?(this.append(i,n.toString("base64")),!1):l.defaultVisitor.apply(this,arguments)},...e})}function BE(t){return M.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function zE(t){const e={},n=Object.keys(t);let i;const o=n.length;let l;for(i=0;i<o;i++)l=n[i],e[l]=t[l];return e}function r0(t){function e(n,i,o,l){let u=n[l++];if(u==="__proto__")return!0;const d=Number.isFinite(+u),h=l>=n.length;return u=!u&&M.isArray(o)?o.length:u,h?(M.hasOwnProp(o,u)?o[u]=[o[u],i]:o[u]=i,!d):((!o[u]||!M.isObject(o[u]))&&(o[u]=[]),e(n,i,o[u],l)&&M.isArray(o[u])&&(o[u]=zE(o[u])),!d)}if(M.isFormData(t)&&M.isFunction(t.entries)){const n={};return M.forEachEntry(t,(i,o)=>{e(BE(i),o,n,0)}),n}return null}function qE(t,e,n){if(M.isString(t))try{return(e||JSON.parse)(t),M.trim(t)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(t)}const Wi={transitional:n0,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const i=n.getContentType()||"",o=i.indexOf("application/json")>-1,l=M.isObject(e);if(l&&M.isHTMLForm(e)&&(e=new FormData(e)),M.isFormData(e))return o?JSON.stringify(r0(e)):e;if(M.isArrayBuffer(e)||M.isBuffer(e)||M.isStream(e)||M.isFile(e)||M.isBlob(e)||M.isReadableStream(e))return e;if(M.isArrayBufferView(e))return e.buffer;if(M.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let d;if(l){if(i.indexOf("application/x-www-form-urlencoded")>-1)return FE(e,this.formSerializer).toString();if((d=M.isFileList(e))||i.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return za(d?{"files[]":e}:e,h&&new h,this.formSerializer)}}return l||o?(n.setContentType("application/json",!1),qE(e)):e}],transformResponse:[function(e){const n=this.transitional||Wi.transitional,i=n&&n.forcedJSONParsing,o=this.responseType==="json";if(M.isResponse(e)||M.isReadableStream(e))return e;if(e&&M.isString(e)&&(i&&!this.responseType||o)){const u=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(e,this.parseReviver)}catch(d){if(u)throw d.name==="SyntaxError"?ye.from(d,ye.ERR_BAD_RESPONSE,this,null,this.response):d}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ft.classes.FormData,Blob:ft.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};M.forEach(["delete","get","head","post","put","patch"],t=>{Wi.headers[t]={}});const WE=M.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),HE=t=>{const e={};let n,i,o;return t&&t.split(`
17
- `).forEach(function(u){o=u.indexOf(":"),n=u.substring(0,o).trim().toLowerCase(),i=u.substring(o+1).trim(),!(!n||e[n]&&WE[n])&&(n==="set-cookie"?e[n]?e[n].push(i):e[n]=[i]:e[n]=e[n]?e[n]+", "+i:i)}),e},jg=Symbol("internals");function ci(t){return t&&String(t).trim().toLowerCase()}function wa(t){return t===!1||t==null?t:M.isArray(t)?t.map(wa):String(t)}function KE(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(t);)e[i[1]]=i[2];return e}const GE=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function ac(t,e,n,i,o){if(M.isFunction(i))return i.call(this,e,n);if(o&&(e=n),!!M.isString(e)){if(M.isString(i))return e.indexOf(i)!==-1;if(M.isRegExp(i))return i.test(e)}}function JE(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,i)=>n.toUpperCase()+i)}function YE(t,e){const n=M.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(t,i+n,{value:function(o,l,u){return this[i].call(this,e,o,l,u)},configurable:!0})})}let kt=class{constructor(e){e&&this.set(e)}set(e,n,i){const o=this;function l(d,h,m){const y=ci(h);if(!y)throw new Error("header name must be a non-empty string");const v=M.findKey(o,y);(!v||o[v]===void 0||m===!0||m===void 0&&o[v]!==!1)&&(o[v||h]=wa(d))}const u=(d,h)=>M.forEach(d,(m,y)=>l(m,y,h));if(M.isPlainObject(e)||e instanceof this.constructor)u(e,n);else if(M.isString(e)&&(e=e.trim())&&!GE(e))u(HE(e),n);else if(M.isObject(e)&&M.isIterable(e)){let d={},h,m;for(const y of e){if(!M.isArray(y))throw TypeError("Object iterator must return a key-value pair");d[m=y[0]]=(h=d[m])?M.isArray(h)?[...h,y[1]]:[h,y[1]]:y[1]}u(d,n)}else e!=null&&l(n,e,i);return this}get(e,n){if(e=ci(e),e){const i=M.findKey(this,e);if(i){const o=this[i];if(!n)return o;if(n===!0)return KE(o);if(M.isFunction(n))return n.call(this,o,i);if(M.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=ci(e),e){const i=M.findKey(this,e);return!!(i&&this[i]!==void 0&&(!n||ac(this,this[i],i,n)))}return!1}delete(e,n){const i=this;let o=!1;function l(u){if(u=ci(u),u){const d=M.findKey(i,u);d&&(!n||ac(i,i[d],d,n))&&(delete i[d],o=!0)}}return M.isArray(e)?e.forEach(l):l(e),o}clear(e){const n=Object.keys(this);let i=n.length,o=!1;for(;i--;){const l=n[i];(!e||ac(this,this[l],l,e,!0))&&(delete this[l],o=!0)}return o}normalize(e){const n=this,i={};return M.forEach(this,(o,l)=>{const u=M.findKey(i,l);if(u){n[u]=wa(o),delete n[l];return}const d=e?JE(l):String(l).trim();d!==l&&delete n[l],n[d]=wa(o),i[d]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return M.forEach(this,(i,o)=>{i!=null&&i!==!1&&(n[o]=e&&M.isArray(i)?i.join(", "):i)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
18
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const i=new this(e);return n.forEach(o=>i.set(o)),i}static accessor(e){const i=(this[jg]=this[jg]={accessors:{}}).accessors,o=this.prototype;function l(u){const d=ci(u);i[d]||(YE(o,u),i[d]=!0)}return M.isArray(e)?e.forEach(l):l(e),this}};kt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);M.reduceDescriptors(kt.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(i){this[n]=i}}});M.freezeMethods(kt);function lc(t,e){const n=this||Wi,i=e||n,o=kt.from(i.headers);let l=i.data;return M.forEach(t,function(d){l=d.call(n,l,o.normalize(),e?e.status:void 0)}),o.normalize(),l}function s0(t){return!!(t&&t.__CANCEL__)}function _s(t,e,n){ye.call(this,t??"canceled",ye.ERR_CANCELED,e,n),this.name="CanceledError"}M.inherits(_s,ye,{__CANCEL__:!0});function i0(t,e,n){const i=n.config.validateStatus;!n.status||!i||i(n.status)?t(n):e(new ye("Request failed with status code "+n.status,[ye.ERR_BAD_REQUEST,ye.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function QE(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function XE(t,e){t=t||10;const n=new Array(t),i=new Array(t);let o=0,l=0,u;return e=e!==void 0?e:1e3,function(h){const m=Date.now(),y=i[l];u||(u=m),n[o]=h,i[o]=m;let v=l,w=0;for(;v!==o;)w+=n[v++],v=v%t;if(o=(o+1)%t,o===l&&(l=(l+1)%t),m-u<e)return;const _=y&&m-y;return _?Math.round(w*1e3/_):void 0}}function ZE(t,e){let n=0,i=1e3/e,o,l;const u=(m,y=Date.now())=>{n=y,o=null,l&&(clearTimeout(l),l=null),t(...m)};return[(...m)=>{const y=Date.now(),v=y-n;v>=i?u(m,y):(o=m,l||(l=setTimeout(()=>{l=null,u(o)},i-v)))},()=>o&&u(o)]}const Ca=(t,e,n=3)=>{let i=0;const o=XE(50,250);return ZE(l=>{const u=l.loaded,d=l.lengthComputable?l.total:void 0,h=u-i,m=o(h),y=u<=d;i=u;const v={loaded:u,total:d,progress:d?u/d:void 0,bytes:h,rate:m||void 0,estimated:m&&d&&y?(d-u)/m:void 0,event:l,lengthComputable:d!=null,[e?"download":"upload"]:!0};t(v)},n)},Cg=(t,e)=>{const n=t!=null;return[i=>e[0]({lengthComputable:n,total:t,loaded:i}),e[1]]},Ng=t=>(...e)=>M.asap(()=>t(...e)),eT=ft.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,ft.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(ft.origin),ft.navigator&&/(msie|trident)/i.test(ft.navigator.userAgent)):()=>!0,tT=ft.hasStandardBrowserEnv?{write(t,e,n,i,o,l,u){if(typeof document>"u")return;const d=[`${t}=${encodeURIComponent(e)}`];M.isNumber(n)&&d.push(`expires=${new Date(n).toUTCString()}`),M.isString(i)&&d.push(`path=${i}`),M.isString(o)&&d.push(`domain=${o}`),l===!0&&d.push("secure"),M.isString(u)&&d.push(`SameSite=${u}`),document.cookie=d.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function nT(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function rT(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function o0(t,e,n){let i=!nT(e);return t&&(i||n==!1)?rT(t,e):e}const Ag=t=>t instanceof kt?{...t}:t;function kr(t,e){e=e||{};const n={};function i(m,y,v,w){return M.isPlainObject(m)&&M.isPlainObject(y)?M.merge.call({caseless:w},m,y):M.isPlainObject(y)?M.merge({},y):M.isArray(y)?y.slice():y}function o(m,y,v,w){if(M.isUndefined(y)){if(!M.isUndefined(m))return i(void 0,m,v,w)}else return i(m,y,v,w)}function l(m,y){if(!M.isUndefined(y))return i(void 0,y)}function u(m,y){if(M.isUndefined(y)){if(!M.isUndefined(m))return i(void 0,m)}else return i(void 0,y)}function d(m,y,v){if(v in e)return i(m,y);if(v in t)return i(void 0,m)}const h={url:l,method:l,data:l,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:d,headers:(m,y,v)=>o(Ag(m),Ag(y),v,!0)};return M.forEach(Object.keys({...t,...e}),function(y){const v=h[y]||o,w=v(t[y],e[y],y);M.isUndefined(w)&&v!==d||(n[y]=w)}),n}const a0=t=>{const e=kr({},t);let{data:n,withXSRFToken:i,xsrfHeaderName:o,xsrfCookieName:l,headers:u,auth:d}=e;if(e.headers=u=kt.from(u),e.url=t0(o0(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),d&&u.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):""))),M.isFormData(n)){if(ft.hasStandardBrowserEnv||ft.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if(M.isFunction(n.getHeaders)){const h=n.getHeaders(),m=["content-type","content-length"];Object.entries(h).forEach(([y,v])=>{m.includes(y.toLowerCase())&&u.set(y,v)})}}if(ft.hasStandardBrowserEnv&&(i&&M.isFunction(i)&&(i=i(e)),i||i!==!1&&eT(e.url))){const h=o&&l&&tT.read(l);h&&u.set(o,h)}return e},sT=typeof XMLHttpRequest<"u",iT=sT&&function(t){return new Promise(function(n,i){const o=a0(t);let l=o.data;const u=kt.from(o.headers).normalize();let{responseType:d,onUploadProgress:h,onDownloadProgress:m}=o,y,v,w,_,b;function k(){_&&_(),b&&b(),o.cancelToken&&o.cancelToken.unsubscribe(y),o.signal&&o.signal.removeEventListener("abort",y)}let S=new XMLHttpRequest;S.open(o.method.toUpperCase(),o.url,!0),S.timeout=o.timeout;function E(){if(!S)return;const P=kt.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),V={data:!d||d==="text"||d==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:P,config:t,request:S};i0(function($){n($),k()},function($){i($),k()},V),S=null}"onloadend"in S?S.onloadend=E:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(E)},S.onabort=function(){S&&(i(new ye("Request aborted",ye.ECONNABORTED,t,S)),S=null)},S.onerror=function(U){const V=U&&U.message?U.message:"Network Error",z=new ye(V,ye.ERR_NETWORK,t,S);z.event=U||null,i(z),S=null},S.ontimeout=function(){let U=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const V=o.transitional||n0;o.timeoutErrorMessage&&(U=o.timeoutErrorMessage),i(new ye(U,V.clarifyTimeoutError?ye.ETIMEDOUT:ye.ECONNABORTED,t,S)),S=null},l===void 0&&u.setContentType(null),"setRequestHeader"in S&&M.forEach(u.toJSON(),function(U,V){S.setRequestHeader(V,U)}),M.isUndefined(o.withCredentials)||(S.withCredentials=!!o.withCredentials),d&&d!=="json"&&(S.responseType=o.responseType),m&&([w,b]=Ca(m,!0),S.addEventListener("progress",w)),h&&S.upload&&([v,_]=Ca(h),S.upload.addEventListener("progress",v),S.upload.addEventListener("loadend",_)),(o.cancelToken||o.signal)&&(y=P=>{S&&(i(!P||P.type?new _s(null,t,S):P),S.abort(),S=null)},o.cancelToken&&o.cancelToken.subscribe(y),o.signal&&(o.signal.aborted?y():o.signal.addEventListener("abort",y)));const A=QE(o.url);if(A&&ft.protocols.indexOf(A)===-1){i(new ye("Unsupported protocol "+A+":",ye.ERR_BAD_REQUEST,t));return}S.send(l||null)})},oT=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let i=new AbortController,o;const l=function(m){if(!o){o=!0,d();const y=m instanceof Error?m:this.reason;i.abort(y instanceof ye?y:new _s(y instanceof Error?y.message:y))}};let u=e&&setTimeout(()=>{u=null,l(new ye(`timeout ${e} of ms exceeded`,ye.ETIMEDOUT))},e);const d=()=>{t&&(u&&clearTimeout(u),u=null,t.forEach(m=>{m.unsubscribe?m.unsubscribe(l):m.removeEventListener("abort",l)}),t=null)};t.forEach(m=>m.addEventListener("abort",l));const{signal:h}=i;return h.unsubscribe=()=>M.asap(d),h}},aT=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let i=0,o;for(;i<n;)o=i+e,yield t.slice(i,o),i=o},lT=async function*(t,e){for await(const n of uT(t))yield*aT(n,e)},uT=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:i}=await e.read();if(n)break;yield i}}finally{await e.cancel()}},Pg=(t,e,n,i)=>{const o=lT(t,e);let l=0,u,d=h=>{u||(u=!0,i&&i(h))};return new ReadableStream({async pull(h){try{const{done:m,value:y}=await o.next();if(m){d(),h.close();return}let v=y.byteLength;if(n){let w=l+=v;n(w)}h.enqueue(new Uint8Array(y))}catch(m){throw d(m),m}},cancel(h){return d(h),o.return()}},{highWaterMark:2})},Rg=64*1024,{isFunction:ua}=M,cT=(({Request:t,Response:e})=>({Request:t,Response:e}))(M.global),{ReadableStream:Og,TextEncoder:Ig}=M.global,Dg=(t,...e)=>{try{return!!t(...e)}catch{return!1}},dT=t=>{t=M.merge.call({skipUndefined:!0},cT,t);const{fetch:e,Request:n,Response:i}=t,o=e?ua(e):typeof fetch=="function",l=ua(n),u=ua(i);if(!o)return!1;const d=o&&ua(Og),h=o&&(typeof Ig=="function"?(b=>k=>b.encode(k))(new Ig):async b=>new Uint8Array(await new n(b).arrayBuffer())),m=l&&d&&Dg(()=>{let b=!1;const k=new n(ft.origin,{body:new Og,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!k}),y=u&&d&&Dg(()=>M.isReadableStream(new i("").body)),v={stream:y&&(b=>b.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!v[b]&&(v[b]=(k,S)=>{let E=k&&k[b];if(E)return E.call(k);throw new ye(`Response type '${b}' is not supported`,ye.ERR_NOT_SUPPORT,S)})});const w=async b=>{if(b==null)return 0;if(M.isBlob(b))return b.size;if(M.isSpecCompliantForm(b))return(await new n(ft.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(M.isArrayBufferView(b)||M.isArrayBuffer(b))return b.byteLength;if(M.isURLSearchParams(b)&&(b=b+""),M.isString(b))return(await h(b)).byteLength},_=async(b,k)=>{const S=M.toFiniteNumber(b.getContentLength());return S??w(k)};return async b=>{let{url:k,method:S,data:E,signal:A,cancelToken:P,timeout:U,onDownloadProgress:V,onUploadProgress:z,responseType:$,headers:B,withCredentials:Y="same-origin",fetchOptions:oe}=a0(b),Te=e||fetch;$=$?($+"").toLowerCase():"text";let ve=oT([A,P&&P.toAbortSignal()],U),je=null;const xe=ve&&ve.unsubscribe&&(()=>{ve.unsubscribe()});let Oe;try{if(z&&m&&S!=="get"&&S!=="head"&&(Oe=await _(B,E))!==0){let j=new n(k,{method:"POST",body:E,duplex:"half"}),D;if(M.isFormData(E)&&(D=j.headers.get("content-type"))&&B.setContentType(D),j.body){const[re,ue]=Cg(Oe,Ca(Ng(z)));E=Pg(j.body,Rg,re,ue)}}M.isString(Y)||(Y=Y?"include":"omit");const be=l&&"credentials"in n.prototype,pe={...oe,signal:ve,method:S.toUpperCase(),headers:B.normalize().toJSON(),body:E,duplex:"half",credentials:be?Y:void 0};je=l&&new n(k,pe);let F=await(l?Te(je,oe):Te(k,pe));const J=y&&($==="stream"||$==="response");if(y&&(V||J&&xe)){const j={};["status","statusText","headers"].forEach(fe=>{j[fe]=F[fe]});const D=M.toFiniteNumber(F.headers.get("content-length")),[re,ue]=V&&Cg(D,Ca(Ng(V),!0))||[];F=new i(Pg(F.body,Rg,re,()=>{ue&&ue(),xe&&xe()}),j)}$=$||"text";let K=await v[M.findKey(v,$)||"text"](F,b);return!J&&xe&&xe(),await new Promise((j,D)=>{i0(j,D,{data:K,headers:kt.from(F.headers),status:F.status,statusText:F.statusText,config:b,request:je})})}catch(be){throw xe&&xe(),be&&be.name==="TypeError"&&/Load failed|fetch/i.test(be.message)?Object.assign(new ye("Network Error",ye.ERR_NETWORK,b,je),{cause:be.cause||be}):ye.from(be,be&&be.code,b,je)}}},hT=new Map,l0=t=>{let e=t&&t.env||{};const{fetch:n,Request:i,Response:o}=e,l=[i,o,n];let u=l.length,d=u,h,m,y=hT;for(;d--;)h=l[d],m=y.get(h),m===void 0&&y.set(h,m=d?new Map:dT(e)),y=m;return m};l0();const zd={http:NE,xhr:iT,fetch:{get:l0}};M.forEach(zd,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Lg=t=>`- ${t}`,fT=t=>M.isFunction(t)||t===null||t===!1;function pT(t,e){t=M.isArray(t)?t:[t];const{length:n}=t;let i,o;const l={};for(let u=0;u<n;u++){i=t[u];let d;if(o=i,!fT(i)&&(o=zd[(d=String(i)).toLowerCase()],o===void 0))throw new ye(`Unknown adapter '${d}'`);if(o&&(M.isFunction(o)||(o=o.get(e))))break;l[d||"#"+u]=o}if(!o){const u=Object.entries(l).map(([h,m])=>`adapter ${h} `+(m===!1?"is not supported by the environment":"is not available in the build"));let d=n?u.length>1?`since :
16
+ `),()=>{document.head.removeChild(y)}},[e]),p.jsx(v1,{isPresent:e,childRef:i,sizeRef:o,children:R.cloneElement(t,{ref:i})})}const x1=({children:t,initial:e,isPresent:n,onExitComplete:i,custom:o,presenceAffectsLayout:l,mode:u})=>{const d=ad(b1),h=R.useId(),m=R.useCallback(v=>{d.set(v,!0);for(const w of d.values())if(!w)return;i&&i()},[d,i]),y=R.useMemo(()=>({id:h,initial:e,isPresent:n,custom:o,onExitComplete:m,register:v=>(d.set(v,!1),()=>d.delete(v))}),l?[Math.random(),m]:[n,m]);return R.useMemo(()=>{d.forEach((v,w)=>d.set(w,!1))},[n]),R.useEffect(()=>{!n&&!d.size&&i&&i()},[n]),u==="popLayout"&&(t=p.jsx(w1,{isPresent:n,children:t})),p.jsx(Da.Provider,{value:y,children:t})};function b1(){return new Map}function py(t=!0){const e=R.useContext(Da);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:o}=e,l=R.useId();R.useEffect(()=>{t&&o(l)},[t]);const u=R.useCallback(()=>t&&i&&i(l),[l,i,t]);return!n&&i?[!1,u]:[!0]}const ia=t=>t.key||"";function lm(t){const e=[];return R.Children.forEach(t,n=>{R.isValidElement(n)&&e.push(n)}),e}const ud=typeof window<"u",my=ud?R.useLayoutEffect:R.useEffect,_n=({children:t,custom:e,initial:n=!0,onExitComplete:i,presenceAffectsLayout:o=!0,mode:l="sync",propagate:u=!1})=>{const[d,h]=py(u),m=R.useMemo(()=>lm(t),[t]),y=u&&!d?[]:m.map(ia),v=R.useRef(!0),w=R.useRef(m),_=ad(()=>new Map),[b,S]=R.useState(m),[k,E]=R.useState(m);my(()=>{v.current=!1,w.current=m;for(let U=0;U<k.length;U++){const V=ia(k[U]);y.includes(V)?_.delete(V):_.get(V)!==!0&&_.set(V,!1)}},[k,y.length,y.join("-")]);const P=[];if(m!==b){let U=[...m];for(let V=0;V<k.length;V++){const z=k[V],$=ia(z);y.includes($)||(U.splice(V,0,z),P.push(z))}l==="wait"&&P.length&&(U=P),E(lm(U)),S(m);return}const{forceRender:N}=R.useContext(od);return p.jsx(p.Fragment,{children:k.map(U=>{const V=ia(U),z=u&&!d?!1:m===k||y.includes(V),$=()=>{if(_.has(V))_.set(V,!0);else return;let B=!0;_.forEach(Y=>{Y||(B=!1)}),B&&(N?.(),E(w.current),u&&h?.(),i&&i())};return p.jsx(x1,{isPresent:z,initial:!v.current||n?void 0:!1,custom:z?void 0:e,presenceAffectsLayout:o,mode:l,onExitComplete:z?void 0:$,children:U},V)})})},Ot=t=>t;let gy=Ot;function cd(t){let e;return()=>(e===void 0&&(e=t()),e)}const ms=(t,e,n)=>{const i=e-t;return i===0?1:(n-t)/i},xn=t=>t*1e3,bn=t=>t/1e3,_1={useManualTiming:!1};function S1(t){let e=new Set,n=new Set,i=!1,o=!1;const l=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function d(m){l.has(m)&&(h.schedule(m),t()),m(u)}const h={schedule:(m,y=!1,v=!1)=>{const _=v&&i?e:n;return y&&l.add(m),_.has(m)||_.add(m),m},cancel:m=>{n.delete(m),l.delete(m)},process:m=>{if(u=m,i){o=!0;return}i=!0,[e,n]=[n,e],e.forEach(d),e.clear(),i=!1,o&&(o=!1,h.process(m))}};return h}const oa=["read","resolveKeyframes","update","preRender","render","postRender"],k1=40;function yy(t,e){let n=!1,i=!0;const o={delta:0,timestamp:0,isProcessing:!1},l=()=>n=!0,u=oa.reduce((E,P)=>(E[P]=S1(l),E),{}),{read:d,resolveKeyframes:h,update:m,preRender:y,render:v,postRender:w}=u,_=()=>{const E=performance.now();n=!1,o.delta=i?1e3/60:Math.max(Math.min(E-o.timestamp,k1),1),o.timestamp=E,o.isProcessing=!0,d.process(o),h.process(o),m.process(o),y.process(o),v.process(o),w.process(o),o.isProcessing=!1,n&&e&&(i=!1,t(_))},b=()=>{n=!0,i=!0,o.isProcessing||t(_)};return{schedule:oa.reduce((E,P)=>{const N=u[P];return E[P]=(U,V=!1,z=!1)=>(n||b(),N.schedule(U,V,z)),E},{}),cancel:E=>{for(let P=0;P<oa.length;P++)u[oa[P]].cancel(E)},state:o,steps:u}}const{schedule:Le,cancel:Gn,state:at,steps:Ju}=yy(typeof requestAnimationFrame<"u"?requestAnimationFrame:Ot,!0),vy=R.createContext({strict:!1}),um={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"]},gs={};for(const t in um)gs[t]={isEnabled:e=>um[t].some(n=>!!e[n])};function E1(t){for(const e in t)gs[e]={...gs[e],...t[e]}}const T1=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function _a(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||T1.has(t)}let wy=t=>!_a(t);function j1(t){t&&(wy=e=>e.startsWith("on")?!_a(e):t(e))}try{j1(require("@emotion/is-prop-valid").default)}catch{}function C1(t,e,n){const i={};for(const o in t)o==="values"&&typeof t.values=="object"||(wy(o)||n===!0&&_a(o)||!e&&!_a(o)||t.draggable&&o.startsWith("onDrag"))&&(i[o]=t[o]);return i}function N1(t){if(typeof Proxy>"u")return t;const e=new Map,n=(...i)=>t(...i);return new Proxy(n,{get:(i,o)=>o==="create"?t:(e.has(o)||e.set(o,t(o)),e.get(o))})}const La=R.createContext({});function Ei(t){return typeof t=="string"||Array.isArray(t)}function Ma(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const dd=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],hd=["initial",...dd];function Ua(t){return Ma(t.animate)||hd.some(e=>Ei(t[e]))}function xy(t){return!!(Ua(t)||t.variants)}function A1(t,e){if(Ua(t)){const{initial:n,animate:i}=t;return{initial:n===!1||Ei(n)?n:void 0,animate:Ei(i)?i:void 0}}return t.inherit!==!1?e:{}}function P1(t){const{initial:e,animate:n}=A1(t,R.useContext(La));return R.useMemo(()=>({initial:e,animate:n}),[cm(e),cm(n)])}function cm(t){return Array.isArray(t)?t.join(" "):t}const R1=Symbol.for("motionComponentSymbol");function as(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function O1(t,e,n){return R.useCallback(i=>{i&&t.onMount&&t.onMount(i),e&&(i?e.mount(i):e.unmount()),n&&(typeof n=="function"?n(i):as(n)&&(n.current=i))},[e])}const fd=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),I1="framerAppearId",by="data-"+fd(I1),{schedule:pd}=yy(queueMicrotask,!1),_y=R.createContext({});function D1(t,e,n,i,o){var l,u;const{visualElement:d}=R.useContext(La),h=R.useContext(vy),m=R.useContext(Da),y=R.useContext(ld).reducedMotion,v=R.useRef(null);i=i||h.renderer,!v.current&&i&&(v.current=i(t,{visualState:e,parent:d,props:n,presenceContext:m,blockInitialAnimation:m?m.initial===!1:!1,reducedMotionConfig:y}));const w=v.current,_=R.useContext(_y);w&&!w.projection&&o&&(w.type==="html"||w.type==="svg")&&L1(v.current,n,o,_);const b=R.useRef(!1);R.useInsertionEffect(()=>{w&&b.current&&w.update(n,m)});const S=n[by],k=R.useRef(!!S&&!(!((l=window.MotionHandoffIsComplete)===null||l===void 0)&&l.call(window,S))&&((u=window.MotionHasOptimisedAnimation)===null||u===void 0?void 0:u.call(window,S)));return my(()=>{w&&(b.current=!0,window.MotionIsMounted=!0,w.updateFeatures(),pd.render(w.render),k.current&&w.animationState&&w.animationState.animateChanges())}),R.useEffect(()=>{w&&(!k.current&&w.animationState&&w.animationState.animateChanges(),k.current&&(queueMicrotask(()=>{var E;(E=window.MotionHandoffMarkAsComplete)===null||E===void 0||E.call(window,S)}),k.current=!1))}),w}function L1(t,e,n,i){const{layoutId:o,layout:l,drag:u,dragConstraints:d,layoutScroll:h,layoutRoot:m}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Sy(t.parent)),t.projection.setOptions({layoutId:o,layout:l,alwaysMeasureLayout:!!u||d&&as(d),visualElement:t,animationType:typeof l=="string"?l:"both",initialPromotionConfig:i,layoutScroll:h,layoutRoot:m})}function Sy(t){if(t)return t.options.allowProjection!==!1?t.projection:Sy(t.parent)}function M1({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:i,Component:o}){var l,u;t&&E1(t);function d(m,y){let v;const w={...R.useContext(ld),...m,layoutId:U1(m)},{isStatic:_}=w,b=P1(m),S=i(m,_);if(!_&&ud){$1();const k=V1(w);v=k.MeasureLayout,b.visualElement=D1(o,S,w,e,k.ProjectionNode)}return p.jsxs(La.Provider,{value:b,children:[v&&b.visualElement?p.jsx(v,{visualElement:b.visualElement,...w}):null,n(o,m,O1(S,b.visualElement,y),S,_,b.visualElement)]})}d.displayName=`motion.${typeof o=="string"?o:`create(${(u=(l=o.displayName)!==null&&l!==void 0?l:o.name)!==null&&u!==void 0?u:""})`}`;const h=R.forwardRef(d);return h[R1]=o,h}function U1({layoutId:t}){const e=R.useContext(od).id;return e&&t!==void 0?e+"-"+t:t}function $1(t,e){R.useContext(vy).strict}function V1(t){const{drag:e,layout:n}=gs;if(!e&&!n)return{};const i={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}const F1=["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 md(t){return typeof t!="string"||t.includes("-")?!1:!!(F1.indexOf(t)>-1||/[A-Z]/u.test(t))}function dm(t){const e=[{},{}];return t?.values.forEach((n,i)=>{e[0][i]=n.get(),e[1][i]=n.getVelocity()}),e}function gd(t,e,n,i){if(typeof e=="function"){const[o,l]=dm(i);e=e(n!==void 0?n:t.custom,o,l)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[o,l]=dm(i);e=e(n!==void 0?n:t.custom,o,l)}return e}const Ec=t=>Array.isArray(t),B1=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),z1=t=>Ec(t)?t[t.length-1]||0:t,pt=t=>!!(t&&t.getVelocity);function ma(t){const e=pt(t)?t.get():t;return B1(e)?e.toValue():e}function q1({scrapeMotionValuesFromProps:t,createRenderState:e,onUpdate:n},i,o,l){const u={latestValues:W1(i,o,l,t),renderState:e()};return n&&(u.onMount=d=>n({props:i,current:d,...u}),u.onUpdate=d=>n(d)),u}const ky=t=>(e,n)=>{const i=R.useContext(La),o=R.useContext(Da),l=()=>q1(t,e,i,o);return n?l():ad(l)};function W1(t,e,n,i){const o={},l=i(t,{});for(const w in l)o[w]=ma(l[w]);let{initial:u,animate:d}=t;const h=Ua(t),m=xy(t);e&&m&&!h&&t.inherit!==!1&&(u===void 0&&(u=e.initial),d===void 0&&(d=e.animate));let y=n?n.initial===!1:!1;y=y||u===!1;const v=y?d:u;if(v&&typeof v!="boolean"&&!Ma(v)){const w=Array.isArray(v)?v:[v];for(let _=0;_<w.length;_++){const b=gd(t,w[_]);if(b){const{transitionEnd:S,transition:k,...E}=b;for(const P in E){let N=E[P];if(Array.isArray(N)){const U=y?N.length-1:0;N=N[U]}N!==null&&(o[P]=N)}for(const P in S)o[P]=S[P]}}}return o}const ws=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Tr=new Set(ws),Ey=t=>e=>typeof e=="string"&&e.startsWith(t),Ty=Ey("--"),H1=Ey("var(--"),yd=t=>H1(t)?K1.test(t.split("/*")[0].trim()):!1,K1=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,jy=(t,e)=>e&&typeof t=="number"?e.transform(t):t,Sn=(t,e,n)=>n>e?e:n<t?t:n,xs={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Ti={...xs,transform:t=>Sn(0,1,t)},aa={...xs,default:1},Ui=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Wn=Ui("deg"),ln=Ui("%"),de=Ui("px"),G1=Ui("vh"),J1=Ui("vw"),hm={...ln,parse:t=>ln.parse(t)/100,transform:t=>ln.transform(t*100)},Y1={borderWidth:de,borderTopWidth:de,borderRightWidth:de,borderBottomWidth:de,borderLeftWidth:de,borderRadius:de,radius:de,borderTopLeftRadius:de,borderTopRightRadius:de,borderBottomRightRadius:de,borderBottomLeftRadius:de,width:de,maxWidth:de,height:de,maxHeight:de,top:de,right:de,bottom:de,left:de,padding:de,paddingTop:de,paddingRight:de,paddingBottom:de,paddingLeft:de,margin:de,marginTop:de,marginRight:de,marginBottom:de,marginLeft:de,backgroundPositionX:de,backgroundPositionY:de},Q1={rotate:Wn,rotateX:Wn,rotateY:Wn,rotateZ:Wn,scale:aa,scaleX:aa,scaleY:aa,scaleZ:aa,skew:Wn,skewX:Wn,skewY:Wn,distance:de,translateX:de,translateY:de,translateZ:de,x:de,y:de,z:de,perspective:de,transformPerspective:de,opacity:Ti,originX:hm,originY:hm,originZ:de},fm={...xs,transform:Math.round},vd={...Y1,...Q1,zIndex:fm,size:de,fillOpacity:Ti,strokeOpacity:Ti,numOctaves:fm},X1={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Z1=ws.length;function eb(t,e,n){let i="",o=!0;for(let l=0;l<Z1;l++){const u=ws[l],d=t[u];if(d===void 0)continue;let h=!0;if(typeof d=="number"?h=d===(u.startsWith("scale")?1:0):h=parseFloat(d)===0,!h||n){const m=jy(d,vd[u]);if(!h){o=!1;const y=X1[u]||u;i+=`${y}(${m}) `}n&&(e[u]=m)}}return i=i.trim(),n?i=n(e,o?"":i):o&&(i="none"),i}function wd(t,e,n){const{style:i,vars:o,transformOrigin:l}=t;let u=!1,d=!1;for(const h in e){const m=e[h];if(Tr.has(h)){u=!0;continue}else if(Ty(h)){o[h]=m;continue}else{const y=jy(m,vd[h]);h.startsWith("origin")?(d=!0,l[h]=y):i[h]=y}}if(e.transform||(u||n?i.transform=eb(e,t.transform,n):i.transform&&(i.transform="none")),d){const{originX:h="50%",originY:m="50%",originZ:y=0}=l;i.transformOrigin=`${h} ${m} ${y}`}}const tb={offset:"stroke-dashoffset",array:"stroke-dasharray"},nb={offset:"strokeDashoffset",array:"strokeDasharray"};function rb(t,e,n=1,i=0,o=!0){t.pathLength=1;const l=o?tb:nb;t[l.offset]=de.transform(-i);const u=de.transform(e),d=de.transform(n);t[l.array]=`${u} ${d}`}function pm(t,e,n){return typeof t=="string"?t:de.transform(e+n*t)}function sb(t,e,n){const i=pm(e,t.x,t.width),o=pm(n,t.y,t.height);return`${i} ${o}`}function xd(t,{attrX:e,attrY:n,attrScale:i,originX:o,originY:l,pathLength:u,pathSpacing:d=1,pathOffset:h=0,...m},y,v){if(wd(t,m,v),y){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:w,style:_,dimensions:b}=t;w.transform&&(b&&(_.transform=w.transform),delete w.transform),b&&(o!==void 0||l!==void 0||_.transform)&&(_.transformOrigin=sb(b,o!==void 0?o:.5,l!==void 0?l:.5)),e!==void 0&&(w.x=e),n!==void 0&&(w.y=n),i!==void 0&&(w.scale=i),u!==void 0&&rb(w,u,d,h,!1)}const bd=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Cy=()=>({...bd(),attrs:{}}),_d=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Ny(t,{style:e,vars:n},i,o){Object.assign(t.style,e,o&&o.getProjectionStyles(i));for(const l in n)t.style.setProperty(l,n[l])}const Ay=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 Py(t,e,n,i){Ny(t,e,void 0,i);for(const o in e.attrs)t.setAttribute(Ay.has(o)?o:fd(o),e.attrs[o])}const Sa={};function ib(t){Object.assign(Sa,t)}function Ry(t,{layout:e,layoutId:n}){return Tr.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Sa[t]||t==="opacity")}function Sd(t,e,n){var i;const{style:o}=t,l={};for(const u in o)(pt(o[u])||e.style&&pt(e.style[u])||Ry(u,t)||((i=n?.getValue(u))===null||i===void 0?void 0:i.liveStyle)!==void 0)&&(l[u]=o[u]);return l}function Oy(t,e,n){const i=Sd(t,e,n);for(const o in t)if(pt(t[o])||pt(e[o])){const l=ws.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;i[l]=t[o]}return i}function ob(t,e){try{e.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{e.dimensions={x:0,y:0,width:0,height:0}}}const mm=["x","y","width","height","cx","cy","r"],ab={useVisualState:ky({scrapeMotionValuesFromProps:Oy,createRenderState:Cy,onUpdate:({props:t,prevProps:e,current:n,renderState:i,latestValues:o})=>{if(!n)return;let l=!!t.drag;if(!l){for(const d in o)if(Tr.has(d)){l=!0;break}}if(!l)return;let u=!e;if(e)for(let d=0;d<mm.length;d++){const h=mm[d];t[h]!==e[h]&&(u=!0)}u&&Le.read(()=>{ob(n,i),Le.render(()=>{xd(i,o,_d(n.tagName),t.transformTemplate),Py(n,i)})})}})},lb={useVisualState:ky({scrapeMotionValuesFromProps:Sd,createRenderState:bd})};function Iy(t,e,n){for(const i in e)!pt(e[i])&&!Ry(i,n)&&(t[i]=e[i])}function ub({transformTemplate:t},e){return R.useMemo(()=>{const n=bd();return wd(n,e,t),Object.assign({},n.vars,n.style)},[e])}function cb(t,e){const n=t.style||{},i={};return Iy(i,n,t),Object.assign(i,ub(t,e)),i}function db(t,e){const n={},i=cb(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=i,n}function hb(t,e,n,i){const o=R.useMemo(()=>{const l=Cy();return xd(l,e,_d(i),t.transformTemplate),{...l.attrs,style:{...l.style}}},[e]);if(t.style){const l={};Iy(l,t.style,t),o.style={...l,...o.style}}return o}function fb(t=!1){return(n,i,o,{latestValues:l},u)=>{const h=(md(n)?hb:db)(i,l,u,n),m=C1(i,typeof n=="string",t),y=n!==R.Fragment?{...m,...h,ref:o}:{},{children:v}=i,w=R.useMemo(()=>pt(v)?v.get():v,[v]);return R.createElement(n,{...y,children:w})}}function pb(t,e){return function(i,{forwardMotionProps:o}={forwardMotionProps:!1}){const u={...md(i)?ab:lb,preloadedFeatures:t,useRender:fb(o),createVisualElement:e,Component:i};return M1(u)}}function Dy(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}function $a(t,e,n){const i=t.getProps();return gd(i,e,n!==void 0?n:i.custom,t)}const mb=cd(()=>window.ScrollTimeline!==void 0);class gb{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>"finished"in e?e.finished:e))}getAll(e){return this.animations[0][e]}setAll(e,n){for(let i=0;i<this.animations.length;i++)this.animations[i][e]=n}attachTimeline(e,n){const i=this.animations.map(o=>{if(mb()&&o.attachTimeline)return o.attachTimeline(e);if(typeof n=="function")return n(o)});return()=>{i.forEach((o,l)=>{o&&o(),this.animations[l].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let n=0;n<this.animations.length;n++)e=Math.max(e,this.animations[n].duration);return e}runAll(e){this.animations.forEach(n=>n[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class yb extends gb{then(e,n){return Promise.all(this.animations).then(e).catch(n)}}function kd(t,e){return t?t[e]||t.default||t:void 0}const Tc=2e4;function Ly(t){let e=0;const n=50;let i=t.next(e);for(;!i.done&&e<Tc;)e+=n,i=t.next(e);return e>=Tc?1/0:e}function Ed(t){return typeof t=="function"}function gm(t,e){t.timeline=e,t.onfinish=null}const Td=t=>Array.isArray(t)&&typeof t[0]=="number",vb={linearEasing:void 0};function wb(t,e){const n=cd(t);return()=>{var i;return(i=vb[e])!==null&&i!==void 0?i:n()}}const ka=wb(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),My=(t,e,n=10)=>{let i="";const o=Math.max(Math.round(e/n),2);for(let l=0;l<o;l++)i+=t(ms(0,o-1,l))+", ";return`linear(${i.substring(0,i.length-2)})`};function Uy(t){return!!(typeof t=="function"&&ka()||!t||typeof t=="string"&&(t in jc||ka())||Td(t)||Array.isArray(t)&&t.every(Uy))}const hi=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,jc={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:hi([0,.65,.55,1]),circOut:hi([.55,0,1,.45]),backIn:hi([.31,.01,.66,-.59]),backOut:hi([.33,1.53,.69,.99])};function $y(t,e){if(t)return typeof t=="function"&&ka()?My(t,e):Td(t)?hi(t):Array.isArray(t)?t.map(n=>$y(n,e)||jc.easeOut):jc[t]}const Qt={x:!1,y:!1};function Vy(){return Qt.x||Qt.y}function xb(t,e,n){var i;if(t instanceof Element)return[t];if(typeof t=="string"){let o=document;const l=(i=void 0)!==null&&i!==void 0?i:o.querySelectorAll(t);return l?Array.from(l):[]}return Array.from(t)}function Fy(t,e){const n=xb(t),i=new AbortController,o={passive:!0,...e,signal:i.signal};return[n,o,()=>i.abort()]}function ym(t){return e=>{e.pointerType==="touch"||Vy()||t(e)}}function bb(t,e,n={}){const[i,o,l]=Fy(t,n),u=ym(d=>{const{target:h}=d,m=e(d);if(typeof m!="function"||!h)return;const y=ym(v=>{m(v),h.removeEventListener("pointerleave",y)});h.addEventListener("pointerleave",y,o)});return i.forEach(d=>{d.addEventListener("pointerenter",u,o)}),l}const By=(t,e)=>e?t===e?!0:By(t,e.parentElement):!1,jd=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,_b=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Sb(t){return _b.has(t.tagName)||t.tabIndex!==-1}const fi=new WeakSet;function vm(t){return e=>{e.key==="Enter"&&t(e)}}function Yu(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const kb=(t,e)=>{const n=t.currentTarget;if(!n)return;const i=vm(()=>{if(fi.has(n))return;Yu(n,"down");const o=vm(()=>{Yu(n,"up")}),l=()=>Yu(n,"cancel");n.addEventListener("keyup",o,e),n.addEventListener("blur",l,e)});n.addEventListener("keydown",i,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),e)};function wm(t){return jd(t)&&!Vy()}function Eb(t,e,n={}){const[i,o,l]=Fy(t,n),u=d=>{const h=d.currentTarget;if(!wm(d)||fi.has(h))return;fi.add(h);const m=e(d),y=(_,b)=>{window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",w),!(!wm(_)||!fi.has(h))&&(fi.delete(h),typeof m=="function"&&m(_,{success:b}))},v=_=>{y(_,n.useGlobalTarget||By(h,_.target))},w=_=>{y(_,!1)};window.addEventListener("pointerup",v,o),window.addEventListener("pointercancel",w,o)};return i.forEach(d=>{!Sb(d)&&d.getAttribute("tabindex")===null&&(d.tabIndex=0),(n.useGlobalTarget?window:d).addEventListener("pointerdown",u,o),d.addEventListener("focus",m=>kb(m,o),o)}),l}function Tb(t){return t==="x"||t==="y"?Qt[t]?null:(Qt[t]=!0,()=>{Qt[t]=!1}):Qt.x||Qt.y?null:(Qt.x=Qt.y=!0,()=>{Qt.x=Qt.y=!1})}const zy=new Set(["width","height","top","left","right","bottom",...ws]);let ga;function jb(){ga=void 0}const un={now:()=>(ga===void 0&&un.set(at.isProcessing||_1.useManualTiming?at.timestamp:performance.now()),ga),set:t=>{ga=t,queueMicrotask(jb)}};function Cd(t,e){t.indexOf(e)===-1&&t.push(e)}function Nd(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class Ad{constructor(){this.subscriptions=[]}add(e){return Cd(this.subscriptions,e),()=>Nd(this.subscriptions,e)}notify(e,n,i){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](e,n,i);else for(let l=0;l<o;l++){const u=this.subscriptions[l];u&&u(e,n,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function qy(t,e){return e?t*(1e3/e):0}const xm=30,Cb=t=>!isNaN(parseFloat(t));class Nb{constructor(e,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(i,o=!0)=>{const l=un.now();this.updatedAt!==l&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),o&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=un.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Cb(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new Ad);const i=this.events[e].add(n);return e==="change"?()=>{i(),Le.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,i){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-i}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=un.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>xm)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,xm);return qy(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),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 ji(t,e){return new Nb(t,e)}function Ab(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,ji(n))}function Pb(t,e){const n=$a(t,e);let{transitionEnd:i={},transition:o={},...l}=n||{};l={...l,...i};for(const u in l){const d=z1(l[u]);Ab(t,u,d)}}function Rb(t){return!!(pt(t)&&t.add)}function Cc(t,e){const n=t.getValue("willChange");if(Rb(n))return n.add(e)}function Wy(t){return t.props[by]}const Hy=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Ob=1e-7,Ib=12;function Db(t,e,n,i,o){let l,u,d=0;do u=e+(n-e)/2,l=Hy(u,i,o)-t,l>0?n=u:e=u;while(Math.abs(l)>Ob&&++d<Ib);return u}function $i(t,e,n,i){if(t===e&&n===i)return Ot;const o=l=>Db(l,0,1,t,n);return l=>l===0||l===1?l:Hy(o(l),e,i)}const Ky=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Gy=t=>e=>1-t(1-e),Jy=$i(.33,1.53,.69,.99),Pd=Gy(Jy),Yy=Ky(Pd),Qy=t=>(t*=2)<1?.5*Pd(t):.5*(2-Math.pow(2,-10*(t-1))),Rd=t=>1-Math.sin(Math.acos(t)),Xy=Gy(Rd),Zy=Ky(Rd),ev=t=>/^0[^.\s]+$/u.test(t);function Lb(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||ev(t):!0}const gi=t=>Math.round(t*1e5)/1e5,Od=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Mb(t){return t==null}const Ub=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Id=(t,e)=>n=>!!(typeof n=="string"&&Ub.test(n)&&n.startsWith(t)||e&&!Mb(n)&&Object.prototype.hasOwnProperty.call(n,e)),tv=(t,e,n)=>i=>{if(typeof i!="string")return i;const[o,l,u,d]=i.match(Od);return{[t]:parseFloat(o),[e]:parseFloat(l),[n]:parseFloat(u),alpha:d!==void 0?parseFloat(d):1}},$b=t=>Sn(0,255,t),Qu={...xs,transform:t=>Math.round($b(t))},vr={test:Id("rgb","red"),parse:tv("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+Qu.transform(t)+", "+Qu.transform(e)+", "+Qu.transform(n)+", "+gi(Ti.transform(i))+")"};function Vb(t){let e="",n="",i="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),i=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),i=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,i+=i,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:o?parseInt(o,16)/255:1}}const Nc={test:Id("#"),parse:Vb,transform:vr.transform},ls={test:Id("hsl","hue"),parse:tv("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+ln.transform(gi(e))+", "+ln.transform(gi(n))+", "+gi(Ti.transform(i))+")"},ht={test:t=>vr.test(t)||Nc.test(t)||ls.test(t),parse:t=>vr.test(t)?vr.parse(t):ls.test(t)?ls.parse(t):Nc.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?vr.transform(t):ls.transform(t)},Fb=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Bb(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Od))===null||e===void 0?void 0:e.length)||0)+(((n=t.match(Fb))===null||n===void 0?void 0:n.length)||0)>0}const nv="number",rv="color",zb="var",qb="var(",bm="${}",Wb=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ci(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},o=[];let l=0;const d=e.replace(Wb,h=>(ht.test(h)?(i.color.push(l),o.push(rv),n.push(ht.parse(h))):h.startsWith(qb)?(i.var.push(l),o.push(zb),n.push(h)):(i.number.push(l),o.push(nv),n.push(parseFloat(h))),++l,bm)).split(bm);return{values:n,split:d,indexes:i,types:o}}function sv(t){return Ci(t).values}function iv(t){const{split:e,types:n}=Ci(t),i=e.length;return o=>{let l="";for(let u=0;u<i;u++)if(l+=e[u],o[u]!==void 0){const d=n[u];d===nv?l+=gi(o[u]):d===rv?l+=ht.transform(o[u]):l+=o[u]}return l}}const Hb=t=>typeof t=="number"?0:t;function Kb(t){const e=sv(t);return iv(t)(e.map(Hb))}const Jn={test:Bb,parse:sv,createTransformer:iv,getAnimatableNone:Kb},Gb=new Set(["brightness","contrast","saturate","opacity"]);function Jb(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[i]=n.match(Od)||[];if(!i)return t;const o=n.replace(i,"");let l=Gb.has(e)?1:0;return i!==n&&(l*=100),e+"("+l+o+")"}const Yb=/\b([a-z-]*)\(.*?\)/gu,Ac={...Jn,getAnimatableNone:t=>{const e=t.match(Yb);return e?e.map(Jb).join(" "):t}},Qb={...vd,color:ht,backgroundColor:ht,outlineColor:ht,fill:ht,stroke:ht,borderColor:ht,borderTopColor:ht,borderRightColor:ht,borderBottomColor:ht,borderLeftColor:ht,filter:Ac,WebkitFilter:Ac},Dd=t=>Qb[t];function ov(t,e){let n=Dd(t);return n!==Ac&&(n=Jn),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Xb=new Set(["auto","none","0"]);function Zb(t,e,n){let i=0,o;for(;i<t.length&&!o;){const l=t[i];typeof l=="string"&&!Xb.has(l)&&Ci(l).values.length&&(o=t[i]),i++}if(o&&n)for(const l of e)t[l]=ov(n,o)}const _m=t=>t===xs||t===de,Sm=(t,e)=>parseFloat(t.split(", ")[e]),km=(t,e)=>(n,{transform:i})=>{if(i==="none"||!i)return 0;const o=i.match(/^matrix3d\((.+)\)$/u);if(o)return Sm(o[1],e);{const l=i.match(/^matrix\((.+)\)$/u);return l?Sm(l[1],t):0}},e_=new Set(["x","y","z"]),t_=ws.filter(t=>!e_.has(t));function n_(t){const e=[];return t_.forEach(n=>{const i=t.getValue(n);i!==void 0&&(e.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),e}const ys={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:km(4,13),y:km(5,14)};ys.translateX=ys.x;ys.translateY=ys.y;const br=new Set;let Pc=!1,Rc=!1;function av(){if(Rc){const t=Array.from(br).filter(i=>i.needsMeasurement),e=new Set(t.map(i=>i.element)),n=new Map;e.forEach(i=>{const o=n_(i);o.length&&(n.set(i,o),i.render())}),t.forEach(i=>i.measureInitialState()),e.forEach(i=>{i.render();const o=n.get(i);o&&o.forEach(([l,u])=>{var d;(d=i.getValue(l))===null||d===void 0||d.set(u)})}),t.forEach(i=>i.measureEndState()),t.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}Rc=!1,Pc=!1,br.forEach(t=>t.complete()),br.clear()}function lv(){br.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Rc=!0)})}function r_(){lv(),av()}class Ld{constructor(e,n,i,o,l,u=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=i,this.motionValue=o,this.element=l,this.isAsync=u}scheduleResolve(){this.isScheduled=!0,this.isAsync?(br.add(this),Pc||(Pc=!0,Le.read(lv),Le.resolveKeyframes(av))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:i,motionValue:o}=this;for(let l=0;l<e.length;l++)if(e[l]===null)if(l===0){const u=o?.get(),d=e[e.length-1];if(u!==void 0)e[0]=u;else if(i&&n){const h=i.readValue(n,d);h!=null&&(e[0]=h)}e[0]===void 0&&(e[0]=d),o&&u===void 0&&o.set(e[0])}else e[l]=e[l-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),br.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,br.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const uv=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),s_=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function i_(t){const e=s_.exec(t);if(!e)return[,];const[,n,i,o]=e;return[`--${n??i}`,o]}function cv(t,e,n=1){const[i,o]=i_(t);if(!i)return;const l=window.getComputedStyle(e).getPropertyValue(i);if(l){const u=l.trim();return uv(u)?parseFloat(u):u}return yd(o)?cv(o,e,n+1):o}const dv=t=>e=>e.test(t),o_={test:t=>t==="auto",parse:t=>t},hv=[xs,de,ln,Wn,J1,G1,o_],Em=t=>hv.find(dv(t));class fv extends Ld{constructor(e,n,i,o,l){super(e,n,i,o,l,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:i}=this;if(!n||!n.current)return;super.readKeyframes();for(let h=0;h<e.length;h++){let m=e[h];if(typeof m=="string"&&(m=m.trim(),yd(m))){const y=cv(m,n.current);y!==void 0&&(e[h]=y),h===e.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!zy.has(i)||e.length!==2)return;const[o,l]=e,u=Em(o),d=Em(l);if(u!==d)if(_m(u)&&_m(d))for(let h=0;h<e.length;h++){const m=e[h];typeof m=="string"&&(e[h]=parseFloat(m))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,i=[];for(let o=0;o<e.length;o++)Lb(e[o])&&i.push(o);i.length&&Zb(e,i,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:i}=this;if(!e||!e.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ys[i](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const o=n[n.length-1];o!==void 0&&e.getValue(i,o).jump(o,!1)}measureEndState(){var e;const{element:n,name:i,unresolvedKeyframes:o}=this;if(!n||!n.current)return;const l=n.getValue(i);l&&l.jump(this.measuredOrigin,!1);const u=o.length-1,d=o[u];o[u]=ys[i](n.measureViewportBox(),window.getComputedStyle(n.current)),d!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=d),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([h,m])=>{n.getValue(h).set(m)}),this.resolveNoneKeyframes()}}const Tm=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Jn.test(t)||t==="0")&&!t.startsWith("url("));function a_(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function l_(t,e,n,i){const o=t[0];if(o===null)return!1;if(e==="display"||e==="visibility")return!0;const l=t[t.length-1],u=Tm(o,e),d=Tm(l,e);return!u||!d?!1:a_(t)||(n==="spring"||Ed(n))&&i}const u_=t=>t!==null;function Va(t,{repeat:e,repeatType:n="loop"},i){const o=t.filter(u_),l=e&&n!=="loop"&&e%2===1?0:o.length-1;return!l||i===void 0?o[l]:i}const c_=40;class pv{constructor({autoplay:e=!0,delay:n=0,type:i="keyframes",repeat:o=0,repeatDelay:l=0,repeatType:u="loop",...d}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=un.now(),this.options={autoplay:e,delay:n,type:i,repeat:o,repeatDelay:l,repeatType:u,...d},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>c_?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&r_(),this._resolved}onKeyframesResolved(e,n){this.resolvedAt=un.now(),this.hasAttemptedResolve=!0;const{name:i,type:o,velocity:l,delay:u,onComplete:d,onUpdate:h,isGenerator:m}=this.options;if(!m&&!l_(e,i,o,l))if(u)this.options.duration=0;else{h&&h(Va(e,this.options,n)),d&&d(),this.resolveFinishedPromise();return}const y=this.initPlayback(e,n);y!==!1&&(this._resolved={keyframes:e,finalKeyframe:n,...y},this.onPostResolved())}onPostResolved(){}then(e,n){return this.currentFinishedPromise.then(e,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}const Be=(t,e,n)=>t+(e-t)*n;function Xu(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function d_({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,e/=100,n/=100;let o=0,l=0,u=0;if(!e)o=l=u=n;else{const d=n<.5?n*(1+e):n+e-n*e,h=2*n-d;o=Xu(h,d,t+1/3),l=Xu(h,d,t),u=Xu(h,d,t-1/3)}return{red:Math.round(o*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:i}}function Ea(t,e){return n=>n>0?e:t}const Zu=(t,e,n)=>{const i=t*t,o=n*(e*e-i)+i;return o<0?0:Math.sqrt(o)},h_=[Nc,vr,ls],f_=t=>h_.find(e=>e.test(t));function jm(t){const e=f_(t);if(!e)return!1;let n=e.parse(t);return e===ls&&(n=d_(n)),n}const Cm=(t,e)=>{const n=jm(t),i=jm(e);if(!n||!i)return Ea(t,e);const o={...n};return l=>(o.red=Zu(n.red,i.red,l),o.green=Zu(n.green,i.green,l),o.blue=Zu(n.blue,i.blue,l),o.alpha=Be(n.alpha,i.alpha,l),vr.transform(o))},p_=(t,e)=>n=>e(t(n)),Vi=(...t)=>t.reduce(p_),Oc=new Set(["none","hidden"]);function m_(t,e){return Oc.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function g_(t,e){return n=>Be(t,e,n)}function Md(t){return typeof t=="number"?g_:typeof t=="string"?yd(t)?Ea:ht.test(t)?Cm:w_:Array.isArray(t)?mv:typeof t=="object"?ht.test(t)?Cm:y_:Ea}function mv(t,e){const n=[...t],i=n.length,o=t.map((l,u)=>Md(l)(l,e[u]));return l=>{for(let u=0;u<i;u++)n[u]=o[u](l);return n}}function y_(t,e){const n={...t,...e},i={};for(const o in n)t[o]!==void 0&&e[o]!==void 0&&(i[o]=Md(t[o])(t[o],e[o]));return o=>{for(const l in i)n[l]=i[l](o);return n}}function v_(t,e){var n;const i=[],o={color:0,var:0,number:0};for(let l=0;l<e.values.length;l++){const u=e.types[l],d=t.indexes[u][o[u]],h=(n=t.values[d])!==null&&n!==void 0?n:0;i[l]=h,o[u]++}return i}const w_=(t,e)=>{const n=Jn.createTransformer(e),i=Ci(t),o=Ci(e);return i.indexes.var.length===o.indexes.var.length&&i.indexes.color.length===o.indexes.color.length&&i.indexes.number.length>=o.indexes.number.length?Oc.has(t)&&!o.values.length||Oc.has(e)&&!i.values.length?m_(t,e):Vi(mv(v_(i,o),o.values),n):Ea(t,e)};function gv(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Be(t,e,n):Md(t)(t,e)}const x_=5;function yv(t,e,n){const i=Math.max(e-x_,0);return qy(n-t(i),e-i)}const We={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},ec=.001;function b_({duration:t=We.duration,bounce:e=We.bounce,velocity:n=We.velocity,mass:i=We.mass}){let o,l,u=1-e;u=Sn(We.minDamping,We.maxDamping,u),t=Sn(We.minDuration,We.maxDuration,bn(t)),u<1?(o=m=>{const y=m*u,v=y*t,w=y-n,_=Ic(m,u),b=Math.exp(-v);return ec-w/_*b},l=m=>{const v=m*u*t,w=v*n+n,_=Math.pow(u,2)*Math.pow(m,2)*t,b=Math.exp(-v),S=Ic(Math.pow(m,2),u);return(-o(m)+ec>0?-1:1)*((w-_)*b)/S}):(o=m=>{const y=Math.exp(-m*t),v=(m-n)*t+1;return-ec+y*v},l=m=>{const y=Math.exp(-m*t),v=(n-m)*(t*t);return y*v});const d=5/t,h=S_(o,l,d);if(t=xn(t),isNaN(h))return{stiffness:We.stiffness,damping:We.damping,duration:t};{const m=Math.pow(h,2)*i;return{stiffness:m,damping:u*2*Math.sqrt(i*m),duration:t}}}const __=12;function S_(t,e,n){let i=n;for(let o=1;o<__;o++)i=i-t(i)/e(i);return i}function Ic(t,e){return t*Math.sqrt(1-e*e)}const k_=["duration","bounce"],E_=["stiffness","damping","mass"];function Nm(t,e){return e.some(n=>t[n]!==void 0)}function T_(t){let e={velocity:We.velocity,stiffness:We.stiffness,damping:We.damping,mass:We.mass,isResolvedFromDuration:!1,...t};if(!Nm(t,E_)&&Nm(t,k_))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(n*1.2),o=i*i,l=2*Sn(.05,1,1-(t.bounce||0))*Math.sqrt(o);e={...e,mass:We.mass,stiffness:o,damping:l}}else{const n=b_(t);e={...e,...n,mass:We.mass},e.isResolvedFromDuration=!0}return e}function vv(t=We.visualDuration,e=We.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:o}=n;const l=n.keyframes[0],u=n.keyframes[n.keyframes.length-1],d={done:!1,value:l},{stiffness:h,damping:m,mass:y,duration:v,velocity:w,isResolvedFromDuration:_}=T_({...n,velocity:-bn(n.velocity||0)}),b=w||0,S=m/(2*Math.sqrt(h*y)),k=u-l,E=bn(Math.sqrt(h/y)),P=Math.abs(k)<5;i||(i=P?We.restSpeed.granular:We.restSpeed.default),o||(o=P?We.restDelta.granular:We.restDelta.default);let N;if(S<1){const V=Ic(E,S);N=z=>{const $=Math.exp(-S*E*z);return u-$*((b+S*E*k)/V*Math.sin(V*z)+k*Math.cos(V*z))}}else if(S===1)N=V=>u-Math.exp(-E*V)*(k+(b+E*k)*V);else{const V=E*Math.sqrt(S*S-1);N=z=>{const $=Math.exp(-S*E*z),B=Math.min(V*z,300);return u-$*((b+S*E*k)*Math.sinh(B)+V*k*Math.cosh(B))/V}}const U={calculatedDuration:_&&v||null,next:V=>{const z=N(V);if(_)d.done=V>=v;else{let $=0;S<1&&($=V===0?xn(b):yv(N,V,z));const B=Math.abs($)<=i,Y=Math.abs(u-z)<=o;d.done=B&&Y}return d.value=d.done?u:z,d},toString:()=>{const V=Math.min(Ly(U),Tc),z=My($=>U.next(V*$).value,V,30);return V+"ms "+z}};return U}function Am({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:o=10,bounceStiffness:l=500,modifyTarget:u,min:d,max:h,restDelta:m=.5,restSpeed:y}){const v=t[0],w={done:!1,value:v},_=B=>d!==void 0&&B<d||h!==void 0&&B>h,b=B=>d===void 0?h:h===void 0||Math.abs(d-B)<Math.abs(h-B)?d:h;let S=n*e;const k=v+S,E=u===void 0?k:u(k);E!==k&&(S=E-v);const P=B=>-S*Math.exp(-B/i),N=B=>E+P(B),U=B=>{const Y=P(B),oe=N(B);w.done=Math.abs(Y)<=m,w.value=w.done?E:oe};let V,z;const $=B=>{_(w.value)&&(V=B,z=vv({keyframes:[w.value,b(w.value)],velocity:yv(N,B,w.value),damping:o,stiffness:l,restDelta:m,restSpeed:y}))};return $(0),{calculatedDuration:null,next:B=>{let Y=!1;return!z&&V===void 0&&(Y=!0,U(B),$(B)),V!==void 0&&B>=V?z.next(B-V):(!Y&&U(B),w)}}}const j_=$i(.42,0,1,1),C_=$i(0,0,.58,1),wv=$i(.42,0,.58,1),N_=t=>Array.isArray(t)&&typeof t[0]!="number",A_={linear:Ot,easeIn:j_,easeInOut:wv,easeOut:C_,circIn:Rd,circInOut:Zy,circOut:Xy,backIn:Pd,backInOut:Yy,backOut:Jy,anticipate:Qy},Pm=t=>{if(Td(t)){gy(t.length===4);const[e,n,i,o]=t;return $i(e,n,i,o)}else if(typeof t=="string")return A_[t];return t};function P_(t,e,n){const i=[],o=n||gv,l=t.length-1;for(let u=0;u<l;u++){let d=o(t[u],t[u+1]);if(e){const h=Array.isArray(e)?e[u]||Ot:e;d=Vi(h,d)}i.push(d)}return i}function R_(t,e,{clamp:n=!0,ease:i,mixer:o}={}){const l=t.length;if(gy(l===e.length),l===1)return()=>e[0];if(l===2&&e[0]===e[1])return()=>e[1];const u=t[0]===t[1];t[0]>t[l-1]&&(t=[...t].reverse(),e=[...e].reverse());const d=P_(e,i,o),h=d.length,m=y=>{if(u&&y<t[0])return e[0];let v=0;if(h>1)for(;v<t.length-2&&!(y<t[v+1]);v++);const w=ms(t[v],t[v+1],y);return d[v](w)};return n?y=>m(Sn(t[0],t[l-1],y)):m}function O_(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const o=ms(0,e,i);t.push(Be(n,1,o))}}function I_(t){const e=[0];return O_(e,t.length-1),e}function D_(t,e){return t.map(n=>n*e)}function L_(t,e){return t.map(()=>e||wv).splice(0,t.length-1)}function Ta({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const o=N_(i)?i.map(Pm):Pm(i),l={done:!1,value:e[0]},u=D_(n&&n.length===e.length?n:I_(e),t),d=R_(u,e,{ease:Array.isArray(o)?o:L_(e,o)});return{calculatedDuration:t,next:h=>(l.value=d(h),l.done=h>=t,l)}}const M_=t=>{const e=({timestamp:n})=>t(n);return{start:()=>Le.update(e,!0),stop:()=>Gn(e),now:()=>at.isProcessing?at.timestamp:un.now()}},U_={decay:Am,inertia:Am,tween:Ta,keyframes:Ta,spring:vv},$_=t=>t/100;class Ud extends pv{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:h}=this.options;h&&h()};const{name:n,motionValue:i,element:o,keyframes:l}=this.options,u=o?.KeyframeResolver||Ld,d=(h,m)=>this.onKeyframesResolved(h,m);this.resolver=new u(l,d,n,i,o),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:n="keyframes",repeat:i=0,repeatDelay:o=0,repeatType:l,velocity:u=0}=this.options,d=Ed(n)?n:U_[n]||Ta;let h,m;d!==Ta&&typeof e[0]!="number"&&(h=Vi($_,gv(e[0],e[1])),e=[0,100]);const y=d({...this.options,keyframes:e});l==="mirror"&&(m=d({...this.options,keyframes:[...e].reverse(),velocity:-u})),y.calculatedDuration===null&&(y.calculatedDuration=Ly(y));const{calculatedDuration:v}=y,w=v+o,_=w*(i+1)-o;return{generator:y,mirroredGenerator:m,mapPercentToKeyframes:h,calculatedDuration:v,resolvedDuration:w,totalDuration:_}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,n=!1){const{resolved:i}=this;if(!i){const{keyframes:B}=this.options;return{done:!0,value:B[B.length-1]}}const{finalKeyframe:o,generator:l,mirroredGenerator:u,mapPercentToKeyframes:d,keyframes:h,calculatedDuration:m,totalDuration:y,resolvedDuration:v}=i;if(this.startTime===null)return l.next(0);const{delay:w,repeat:_,repeatType:b,repeatDelay:S,onUpdate:k}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-y/this.speed,this.startTime)),n?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const E=this.currentTime-w*(this.speed>=0?1:-1),P=this.speed>=0?E<0:E>y;this.currentTime=Math.max(E,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=y);let N=this.currentTime,U=l;if(_){const B=Math.min(this.currentTime,y)/v;let Y=Math.floor(B),oe=B%1;!oe&&B>=1&&(oe=1),oe===1&&Y--,Y=Math.min(Y,_+1),Y%2&&(b==="reverse"?(oe=1-oe,S&&(oe-=S/v)):b==="mirror"&&(U=u)),N=Sn(0,1,oe)*v}const V=P?{done:!1,value:h[0]}:U.next(N);d&&(V.value=d(V.value));let{done:z}=V;!P&&m!==null&&(z=this.speed>=0?this.currentTime>=y:this.currentTime<=0);const $=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&z);return $&&o!==void 0&&(V.value=Va(h,this.options,o)),k&&k(V.value),$&&this.finish(),V}get duration(){const{resolved:e}=this;return e?bn(e.calculatedDuration):0}get time(){return bn(this.currentTime)}set time(e){e=xn(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=bn(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=M_,onPlay:n,startTime:i}=this.options;this.driver||(this.driver=e(l=>this.tick(l))),n&&n();const o=this.driver.now();this.holdTime!==null?this.startTime=o-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=o):this.startTime=i??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const V_=new Set(["opacity","clipPath","filter","transform"]);function F_(t,e,n,{delay:i=0,duration:o=300,repeat:l=0,repeatType:u="loop",ease:d="easeInOut",times:h}={}){const m={[e]:n};h&&(m.offset=h);const y=$y(d,o);return Array.isArray(y)&&(m.easing=y),t.animate(m,{delay:i,duration:o,easing:Array.isArray(y)?"linear":y,fill:"both",iterations:l+1,direction:u==="reverse"?"alternate":"normal"})}const B_=cd(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),ja=10,z_=2e4;function q_(t){return Ed(t.type)||t.type==="spring"||!Uy(t.ease)}function W_(t,e){const n=new Ud({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let i={done:!1,value:t[0]};const o=[];let l=0;for(;!i.done&&l<z_;)i=n.sample(l),o.push(i.value),l+=ja;return{times:void 0,keyframes:o,duration:l-ja,ease:"linear"}}const xv={anticipate:Qy,backInOut:Yy,circInOut:Zy};function H_(t){return t in xv}class Rm extends pv{constructor(e){super(e);const{name:n,motionValue:i,element:o,keyframes:l}=this.options;this.resolver=new fv(l,(u,d)=>this.onKeyframesResolved(u,d),n,i,o),this.resolver.scheduleResolve()}initPlayback(e,n){let{duration:i=300,times:o,ease:l,type:u,motionValue:d,name:h,startTime:m}=this.options;if(!d.owner||!d.owner.current)return!1;if(typeof l=="string"&&ka()&&H_(l)&&(l=xv[l]),q_(this.options)){const{onComplete:v,onUpdate:w,motionValue:_,element:b,...S}=this.options,k=W_(e,S);e=k.keyframes,e.length===1&&(e[1]=e[0]),i=k.duration,o=k.times,l=k.ease,u="keyframes"}const y=F_(d.owner.current,h,e,{...this.options,duration:i,times:o,ease:l});return y.startTime=m??this.calcStartTime(),this.pendingTimeline?(gm(y,this.pendingTimeline),this.pendingTimeline=void 0):y.onfinish=()=>{const{onComplete:v}=this.options;d.set(Va(e,this.options,n)),v&&v(),this.cancel(),this.resolveFinishedPromise()},{animation:y,duration:i,times:o,type:u,ease:l,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:n}=e;return bn(n)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:n}=e;return bn(n.currentTime||0)}set time(e){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.currentTime=xn(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:n}=e;return n.playbackRate}set speed(e){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:n}=e;return n.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:n}=e;return n.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:n}=this;if(!n)return Ot;const{animation:i}=n;gm(i,e)}return Ot}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:n,keyframes:i,duration:o,type:l,ease:u,times:d}=e;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:m,onUpdate:y,onComplete:v,element:w,..._}=this.options,b=new Ud({..._,keyframes:i,duration:o,type:l,ease:u,times:d,isGenerator:!0}),S=xn(this.time);m.setWithVelocity(b.sample(S-ja).value,b.sample(S).value,ja)}const{onStop:h}=this.options;h&&h(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:n,name:i,repeatDelay:o,repeatType:l,damping:u,type:d}=e;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:m}=n.owner.getProps();return B_()&&i&&V_.has(i)&&!h&&!m&&!o&&l!=="mirror"&&u!==0&&d!=="inertia"}}const K_={type:"spring",stiffness:500,damping:25,restSpeed:10},G_=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),J_={type:"keyframes",duration:.8},Y_={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Q_=(t,{keyframes:e})=>e.length>2?J_:Tr.has(t)?t.startsWith("scale")?G_(e[1]):K_:Y_;function X_({when:t,delay:e,delayChildren:n,staggerChildren:i,staggerDirection:o,repeat:l,repeatType:u,repeatDelay:d,from:h,elapsed:m,...y}){return!!Object.keys(y).length}const $d=(t,e,n,i={},o,l)=>u=>{const d=kd(i,t)||{},h=d.delay||i.delay||0;let{elapsed:m=0}=i;m=m-xn(h);let y={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...d,delay:-m,onUpdate:w=>{e.set(w),d.onUpdate&&d.onUpdate(w)},onComplete:()=>{u(),d.onComplete&&d.onComplete()},name:t,motionValue:e,element:l?void 0:o};X_(d)||(y={...y,...Q_(t,y)}),y.duration&&(y.duration=xn(y.duration)),y.repeatDelay&&(y.repeatDelay=xn(y.repeatDelay)),y.from!==void 0&&(y.keyframes[0]=y.from);let v=!1;if((y.type===!1||y.duration===0&&!y.repeatDelay)&&(y.duration=0,y.delay===0&&(v=!0)),v&&!l&&e.get()!==void 0){const w=Va(y.keyframes,d);if(w!==void 0)return Le.update(()=>{y.onUpdate(w),y.onComplete()}),new yb([])}return!l&&Rm.supports(y)?new Rm(y):new Ud(y)};function Z_({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,i}function bv(t,e,{delay:n=0,transitionOverride:i,type:o}={}){var l;let{transition:u=t.getDefaultTransition(),transitionEnd:d,...h}=e;i&&(u=i);const m=[],y=o&&t.animationState&&t.animationState.getState()[o];for(const v in h){const w=t.getValue(v,(l=t.latestValues[v])!==null&&l!==void 0?l:null),_=h[v];if(_===void 0||y&&Z_(y,v))continue;const b={delay:n,...kd(u||{},v)};let S=!1;if(window.MotionHandoffAnimation){const E=Wy(t);if(E){const P=window.MotionHandoffAnimation(E,v,Le);P!==null&&(b.startTime=P,S=!0)}}Cc(t,v),w.start($d(v,w,_,t.shouldReduceMotion&&zy.has(v)?{type:!1}:b,t,S));const k=w.animation;k&&m.push(k)}return d&&Promise.all(m).then(()=>{Le.update(()=>{d&&Pb(t,d)})}),m}function Dc(t,e,n={}){var i;const o=$a(t,e,n.type==="exit"?(i=t.presenceContext)===null||i===void 0?void 0:i.custom:void 0);let{transition:l=t.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(l=n.transitionOverride);const u=o?()=>Promise.all(bv(t,o,n)):()=>Promise.resolve(),d=t.variantChildren&&t.variantChildren.size?(m=0)=>{const{delayChildren:y=0,staggerChildren:v,staggerDirection:w}=l;return eS(t,e,y+m,v,w,n)}:()=>Promise.resolve(),{when:h}=l;if(h){const[m,y]=h==="beforeChildren"?[u,d]:[d,u];return m().then(()=>y())}else return Promise.all([u(),d(n.delay)])}function eS(t,e,n=0,i=0,o=1,l){const u=[],d=(t.variantChildren.size-1)*i,h=o===1?(m=0)=>m*i:(m=0)=>d-m*i;return Array.from(t.variantChildren).sort(tS).forEach((m,y)=>{m.notify("AnimationStart",e),u.push(Dc(m,e,{...l,delay:n+h(y)}).then(()=>m.notify("AnimationComplete",e)))}),Promise.all(u)}function tS(t,e){return t.sortNodePosition(e)}function nS(t,e,n={}){t.notify("AnimationStart",e);let i;if(Array.isArray(e)){const o=e.map(l=>Dc(t,l,n));i=Promise.all(o)}else if(typeof e=="string")i=Dc(t,e,n);else{const o=typeof e=="function"?$a(t,e,n.custom):e;i=Promise.all(bv(t,o,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}const rS=hd.length;function _v(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?_v(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<rS;n++){const i=hd[n],o=t.props[i];(Ei(o)||o===!1)&&(e[i]=o)}return e}const sS=[...dd].reverse(),iS=dd.length;function oS(t){return e=>Promise.all(e.map(({animation:n,options:i})=>nS(t,n,i)))}function aS(t){let e=oS(t),n=Om(),i=!0;const o=h=>(m,y)=>{var v;const w=$a(t,y,h==="exit"?(v=t.presenceContext)===null||v===void 0?void 0:v.custom:void 0);if(w){const{transition:_,transitionEnd:b,...S}=w;m={...m,...S,...b}}return m};function l(h){e=h(t)}function u(h){const{props:m}=t,y=_v(t.parent)||{},v=[],w=new Set;let _={},b=1/0;for(let k=0;k<iS;k++){const E=sS[k],P=n[E],N=m[E]!==void 0?m[E]:y[E],U=Ei(N),V=E===h?P.isActive:null;V===!1&&(b=k);let z=N===y[E]&&N!==m[E]&&U;if(z&&i&&t.manuallyAnimateOnMount&&(z=!1),P.protectedKeys={..._},!P.isActive&&V===null||!N&&!P.prevProp||Ma(N)||typeof N=="boolean")continue;const $=lS(P.prevProp,N);let B=$||E===h&&P.isActive&&!z&&U||k>b&&U,Y=!1;const oe=Array.isArray(N)?N:[N];let Te=oe.reduce(o(E),{});V===!1&&(Te={});const{prevResolvedValues:ve={}}=P,je={...ve,...Te},xe=pe=>{B=!0,w.has(pe)&&(Y=!0,w.delete(pe)),P.needsAnimating[pe]=!0;const F=t.getValue(pe);F&&(F.liveStyle=!1)};for(const pe in je){const F=Te[pe],J=ve[pe];if(_.hasOwnProperty(pe))continue;let K=!1;Ec(F)&&Ec(J)?K=!Dy(F,J):K=F!==J,K?F!=null?xe(pe):w.add(pe):F!==void 0&&w.has(pe)?xe(pe):P.protectedKeys[pe]=!0}P.prevProp=N,P.prevResolvedValues=Te,P.isActive&&(_={..._,...Te}),i&&t.blockInitialAnimation&&(B=!1),B&&(!(z&&$)||Y)&&v.push(...oe.map(pe=>({animation:pe,options:{type:E}})))}if(w.size){const k={};w.forEach(E=>{const P=t.getBaseTarget(E),N=t.getValue(E);N&&(N.liveStyle=!0),k[E]=P??null}),v.push({animation:k})}let S=!!v.length;return i&&(m.initial===!1||m.initial===m.animate)&&!t.manuallyAnimateOnMount&&(S=!1),i=!1,S?e(v):Promise.resolve()}function d(h,m){var y;if(n[h].isActive===m)return Promise.resolve();(y=t.variantChildren)===null||y===void 0||y.forEach(w=>{var _;return(_=w.animationState)===null||_===void 0?void 0:_.setActive(h,m)}),n[h].isActive=m;const v=u(h);for(const w in n)n[w].protectedKeys={};return v}return{animateChanges:u,setActive:d,setAnimateFunction:l,getState:()=>n,reset:()=>{n=Om(),i=!0}}}function lS(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Dy(e,t):!1}function cr(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Om(){return{animate:cr(!0),whileInView:cr(),whileHover:cr(),whileTap:cr(),whileDrag:cr(),whileFocus:cr(),exit:cr()}}class Yn{constructor(e){this.isMounted=!1,this.node=e}update(){}}class uS extends Yn{constructor(e){super(e),e.animationState||(e.animationState=aS(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Ma(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let cS=0;class dS extends Yn{constructor(){super(...arguments),this.id=cS++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const o=this.node.animationState.setActive("exit",!e);n&&!e&&o.then(()=>n(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const hS={animation:{Feature:uS},exit:{Feature:dS}};function Ni(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n)}function Fi(t){return{point:{x:t.pageX,y:t.pageY}}}const fS=t=>e=>jd(e)&&t(e,Fi(e));function yi(t,e,n,i){return Ni(t,e,fS(n),i)}const Im=(t,e)=>Math.abs(t-e);function pS(t,e){const n=Im(t.x,e.x),i=Im(t.y,e.y);return Math.sqrt(n**2+i**2)}class Sv{constructor(e,n,{transformPagePoint:i,contextWindow:o,dragSnapToOrigin:l=!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 v=nc(this.lastMoveEventInfo,this.history),w=this.startEvent!==null,_=pS(v.offset,{x:0,y:0})>=3;if(!w&&!_)return;const{point:b}=v,{timestamp:S}=at;this.history.push({...b,timestamp:S});const{onStart:k,onMove:E}=this.handlers;w||(k&&k(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),E&&E(this.lastMoveEvent,v)},this.handlePointerMove=(v,w)=>{this.lastMoveEvent=v,this.lastMoveEventInfo=tc(w,this.transformPagePoint),Le.update(this.updatePoint,!0)},this.handlePointerUp=(v,w)=>{this.end();const{onEnd:_,onSessionEnd:b,resumeAnimation:S}=this.handlers;if(this.dragSnapToOrigin&&S&&S(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=nc(v.type==="pointercancel"?this.lastMoveEventInfo:tc(w,this.transformPagePoint),this.history);this.startEvent&&_&&_(v,k),b&&b(v,k)},!jd(e))return;this.dragSnapToOrigin=l,this.handlers=n,this.transformPagePoint=i,this.contextWindow=o||window;const u=Fi(e),d=tc(u,this.transformPagePoint),{point:h}=d,{timestamp:m}=at;this.history=[{...h,timestamp:m}];const{onSessionStart:y}=n;y&&y(e,nc(d,this.history)),this.removeListeners=Vi(yi(this.contextWindow,"pointermove",this.handlePointerMove),yi(this.contextWindow,"pointerup",this.handlePointerUp),yi(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Gn(this.updatePoint)}}function tc(t,e){return e?{point:e(t.point)}:t}function Dm(t,e){return{x:t.x-e.x,y:t.y-e.y}}function nc({point:t},e){return{point:t,delta:Dm(t,kv(e)),offset:Dm(t,mS(e)),velocity:gS(e,.1)}}function mS(t){return t[0]}function kv(t){return t[t.length-1]}function gS(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,i=null;const o=kv(t);for(;n>=0&&(i=t[n],!(o.timestamp-i.timestamp>xn(e)));)n--;if(!i)return{x:0,y:0};const l=bn(o.timestamp-i.timestamp);if(l===0)return{x:0,y:0};const u={x:(o.x-i.x)/l,y:(o.y-i.y)/l};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}const Ev=1e-4,yS=1-Ev,vS=1+Ev,Tv=.01,wS=0-Tv,xS=0+Tv;function It(t){return t.max-t.min}function bS(t,e,n){return Math.abs(t-e)<=n}function Lm(t,e,n,i=.5){t.origin=i,t.originPoint=Be(e.min,e.max,t.origin),t.scale=It(n)/It(e),t.translate=Be(n.min,n.max,t.origin)-t.originPoint,(t.scale>=yS&&t.scale<=vS||isNaN(t.scale))&&(t.scale=1),(t.translate>=wS&&t.translate<=xS||isNaN(t.translate))&&(t.translate=0)}function vi(t,e,n,i){Lm(t.x,e.x,n.x,i?i.originX:void 0),Lm(t.y,e.y,n.y,i?i.originY:void 0)}function Mm(t,e,n){t.min=n.min+e.min,t.max=t.min+It(e)}function _S(t,e,n){Mm(t.x,e.x,n.x),Mm(t.y,e.y,n.y)}function Um(t,e,n){t.min=e.min-n.min,t.max=t.min+It(e)}function wi(t,e,n){Um(t.x,e.x,n.x),Um(t.y,e.y,n.y)}function SS(t,{min:e,max:n},i){return e!==void 0&&t<e?t=i?Be(e,t,i.min):Math.max(t,e):n!==void 0&&t>n&&(t=i?Be(n,t,i.max):Math.min(t,n)),t}function $m(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function kS(t,{top:e,left:n,bottom:i,right:o}){return{x:$m(t.x,n,o),y:$m(t.y,e,i)}}function Vm(t,e){let n=e.min-t.min,i=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,i]=[i,n]),{min:n,max:i}}function ES(t,e){return{x:Vm(t.x,e.x),y:Vm(t.y,e.y)}}function TS(t,e){let n=.5;const i=It(t),o=It(e);return o>i?n=ms(e.min,e.max-i,t.min):i>o&&(n=ms(t.min,t.max-o,e.min)),Sn(0,1,n)}function jS(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Lc=.35;function CS(t=Lc){return t===!1?t=0:t===!0&&(t=Lc),{x:Fm(t,"left","right"),y:Fm(t,"top","bottom")}}function Fm(t,e,n){return{min:Bm(t,e),max:Bm(t,n)}}function Bm(t,e){return typeof t=="number"?t:t[e]||0}const zm=()=>({translate:0,scale:1,origin:0,originPoint:0}),us=()=>({x:zm(),y:zm()}),qm=()=>({min:0,max:0}),Ge=()=>({x:qm(),y:qm()});function Bt(t){return[t("x"),t("y")]}function jv({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}function NS({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function AS(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),i=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function rc(t){return t===void 0||t===1}function Mc({scale:t,scaleX:e,scaleY:n}){return!rc(t)||!rc(e)||!rc(n)}function fr(t){return Mc(t)||Cv(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Cv(t){return Wm(t.x)||Wm(t.y)}function Wm(t){return t&&t!=="0%"}function Ca(t,e,n){const i=t-n,o=e*i;return n+o}function Hm(t,e,n,i,o){return o!==void 0&&(t=Ca(t,o,i)),Ca(t,n,i)+e}function Uc(t,e=0,n=1,i,o){t.min=Hm(t.min,e,n,i,o),t.max=Hm(t.max,e,n,i,o)}function Nv(t,{x:e,y:n}){Uc(t.x,e.translate,e.scale,e.originPoint),Uc(t.y,n.translate,n.scale,n.originPoint)}const Km=.999999999999,Gm=1.0000000000001;function PS(t,e,n,i=!1){const o=n.length;if(!o)return;e.x=e.y=1;let l,u;for(let d=0;d<o;d++){l=n[d],u=l.projectionDelta;const{visualElement:h}=l.options;h&&h.props.style&&h.props.style.display==="contents"||(i&&l.options.layoutScroll&&l.scroll&&l!==l.root&&ds(t,{x:-l.scroll.offset.x,y:-l.scroll.offset.y}),u&&(e.x*=u.x.scale,e.y*=u.y.scale,Nv(t,u)),i&&fr(l.latestValues)&&ds(t,l.latestValues))}e.x<Gm&&e.x>Km&&(e.x=1),e.y<Gm&&e.y>Km&&(e.y=1)}function cs(t,e){t.min=t.min+e,t.max=t.max+e}function Jm(t,e,n,i,o=.5){const l=Be(t.min,t.max,o);Uc(t,e,n,l,i)}function ds(t,e){Jm(t.x,e.x,e.scaleX,e.scale,e.originX),Jm(t.y,e.y,e.scaleY,e.scale,e.originY)}function Av(t,e){return jv(AS(t.getBoundingClientRect(),e))}function RS(t,e,n){const i=Av(t,n),{scroll:o}=e;return o&&(cs(i.x,o.offset.x),cs(i.y,o.offset.y)),i}const Pv=({current:t})=>t?t.ownerDocument.defaultView:null,OS=new WeakMap;class IS{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ge(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const o=y=>{const{dragSnapToOrigin:v}=this.getProps();v?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Fi(y).point)},l=(y,v)=>{const{drag:w,dragPropagation:_,onDragStart:b}=this.getProps();if(w&&!_&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Tb(w),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Bt(k=>{let E=this.getAxisMotionValue(k).get()||0;if(ln.test(E)){const{projection:P}=this.visualElement;if(P&&P.layout){const N=P.layout.layoutBox[k];N&&(E=It(N)*(parseFloat(E)/100))}}this.originPoint[k]=E}),b&&Le.postRender(()=>b(y,v)),Cc(this.visualElement,"transform");const{animationState:S}=this.visualElement;S&&S.setActive("whileDrag",!0)},u=(y,v)=>{const{dragPropagation:w,dragDirectionLock:_,onDirectionLock:b,onDrag:S}=this.getProps();if(!w&&!this.openDragLock)return;const{offset:k}=v;if(_&&this.currentDirection===null){this.currentDirection=DS(k),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",v.point,k),this.updateAxis("y",v.point,k),this.visualElement.render(),S&&S(y,v)},d=(y,v)=>this.stop(y,v),h=()=>Bt(y=>{var v;return this.getAnimationState(y)==="paused"&&((v=this.getAxisMotionValue(y).animation)===null||v===void 0?void 0:v.play())}),{dragSnapToOrigin:m}=this.getProps();this.panSession=new Sv(e,{onSessionStart:o,onStart:l,onMove:u,onSessionEnd:d,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:m,contextWindow:Pv(this.visualElement)})}stop(e,n){const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:o}=n;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&Le.postRender(()=>l(e,n))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,i){const{drag:o}=this.getProps();if(!i||!la(e,o,this.currentDirection))return;const l=this.getAxisMotionValue(e);let u=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(u=SS(u,this.constraints[e],this.elastic[e])),l.set(u)}resolveConstraints(){var e;const{dragConstraints:n,dragElastic:i}=this.getProps(),o=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,l=this.constraints;n&&as(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&o?this.constraints=kS(o.layoutBox,n):this.constraints=!1,this.elastic=CS(i),l!==this.constraints&&o&&this.constraints&&!this.hasMutatedConstraints&&Bt(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=jS(o.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!as(e))return!1;const i=e.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const l=RS(i,o.root,this.visualElement.getTransformPagePoint());let u=ES(o.layout.layoutBox,l);if(n){const d=n(NS(u));this.hasMutatedConstraints=!!d,d&&(u=jv(d))}return u}startAnimation(e){const{drag:n,dragMomentum:i,dragElastic:o,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:d}=this.getProps(),h=this.constraints||{},m=Bt(y=>{if(!la(y,n,this.currentDirection))return;let v=h&&h[y]||{};u&&(v={min:0,max:0});const w=o?200:1e6,_=o?40:1e7,b={type:"inertia",velocity:i?e[y]:0,bounceStiffness:w,bounceDamping:_,timeConstant:750,restDelta:1,restSpeed:10,...l,...v};return this.startAxisValueAnimation(y,b)});return Promise.all(m).then(d)}startAxisValueAnimation(e,n){const i=this.getAxisMotionValue(e);return Cc(this.visualElement,e),i.start($d(e,i,0,n,this.visualElement,!1))}stopAnimation(){Bt(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Bt(e=>{var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,i=this.visualElement.getProps(),o=i[n];return o||this.visualElement.getValue(e,(i.initial?i.initial[e]:void 0)||0)}snapToCursor(e){Bt(n=>{const{drag:i}=this.getProps();if(!la(n,i,this.currentDirection))return;const{projection:o}=this.visualElement,l=this.getAxisMotionValue(n);if(o&&o.layout){const{min:u,max:d}=o.layout.layoutBox[n];l.set(e[n]-Be(u,d,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!as(n)||!i||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};Bt(u=>{const d=this.getAxisMotionValue(u);if(d&&this.constraints!==!1){const h=d.get();o[u]=TS({min:h,max:h},this.constraints[u])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),Bt(u=>{if(!la(u,e,null))return;const d=this.getAxisMotionValue(u),{min:h,max:m}=this.constraints[u];d.set(Be(h,m,o[u]))})}addListeners(){if(!this.visualElement.current)return;OS.set(this.visualElement,this);const e=this.visualElement.current,n=yi(e,"pointerdown",h=>{const{drag:m,dragListener:y=!0}=this.getProps();m&&y&&this.start(h)}),i=()=>{const{dragConstraints:h}=this.getProps();as(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,l=o.addEventListener("measure",i);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),Le.read(i);const u=Ni(window,"resize",()=>this.scalePositionWithinConstraints()),d=o.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:m})=>{this.isDragging&&m&&(Bt(y=>{const v=this.getAxisMotionValue(y);v&&(this.originPoint[y]+=h[y].translate,v.set(v.get()+h[y].translate))}),this.visualElement.render())}));return()=>{u(),n(),l(),d&&d()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:o=!1,dragConstraints:l=!1,dragElastic:u=Lc,dragMomentum:d=!0}=e;return{...e,drag:n,dragDirectionLock:i,dragPropagation:o,dragConstraints:l,dragElastic:u,dragMomentum:d}}}function la(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function DS(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class LS extends Yn{constructor(e){super(e),this.removeGroupControls=Ot,this.removeListeners=Ot,this.controls=new IS(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ot}unmount(){this.removeGroupControls(),this.removeListeners()}}const Ym=t=>(e,n)=>{t&&Le.postRender(()=>t(e,n))};class MS extends Yn{constructor(){super(...arguments),this.removePointerDownListener=Ot}onPointerDown(e){this.session=new Sv(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Pv(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:i,onPanEnd:o}=this.node.getProps();return{onSessionStart:Ym(e),onStart:Ym(n),onMove:i,onEnd:(l,u)=>{delete this.session,o&&Le.postRender(()=>o(l,u))}}}mount(){this.removePointerDownListener=yi(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const ya={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Qm(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ui={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(de.test(t))t=parseFloat(t);else return t;const n=Qm(t,e.target.x),i=Qm(t,e.target.y);return`${n}% ${i}%`}},US={correct:(t,{treeScale:e,projectionDelta:n})=>{const i=t,o=Jn.parse(t);if(o.length>5)return i;const l=Jn.createTransformer(t),u=typeof o[0]!="number"?1:0,d=n.x.scale*e.x,h=n.y.scale*e.y;o[0+u]/=d,o[1+u]/=h;const m=Be(d,h,.5);return typeof o[2+u]=="number"&&(o[2+u]/=m),typeof o[3+u]=="number"&&(o[3+u]/=m),l(o)}};class $S extends R.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i,layoutId:o}=this.props,{projection:l}=e;ib(VS),l&&(n.group&&n.group.add(l),i&&i.register&&o&&i.register(l),l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,onExitComplete:()=>this.safeToRemove()})),ya.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:i,drag:o,isPresent:l}=this.props,u=i.projection;return u&&(u.isPresent=l,o||e.layoutDependency!==n||n===void 0?u.willUpdate():this.safeToRemove(),e.isPresent!==l&&(l?u.promote():u.relegate()||Le.postRender(()=>{const d=u.getStack();(!d||!d.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),pd.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:o}=e;o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),i&&i.deregister&&i.deregister(o))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Rv(t){const[e,n]=py(),i=R.useContext(od);return p.jsx($S,{...t,layoutGroup:i,switchLayoutGroup:R.useContext(_y),isPresent:e,safeToRemove:n})}const VS={borderRadius:{...ui,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ui,borderTopRightRadius:ui,borderBottomLeftRadius:ui,borderBottomRightRadius:ui,boxShadow:US};function FS(t,e,n){const i=pt(t)?t:ji(t);return i.start($d("",i,e,n)),i.animation}function BS(t){return t instanceof SVGElement&&t.tagName!=="svg"}const zS=(t,e)=>t.depth-e.depth;class qS{constructor(){this.children=[],this.isDirty=!1}add(e){Cd(this.children,e),this.isDirty=!0}remove(e){Nd(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(zS),this.isDirty=!1,this.children.forEach(e)}}function WS(t,e){const n=un.now(),i=({timestamp:o})=>{const l=o-n;l>=e&&(Gn(i),t(l-e))};return Le.read(i,!0),()=>Gn(i)}const Ov=["TopLeft","TopRight","BottomLeft","BottomRight"],HS=Ov.length,Xm=t=>typeof t=="string"?parseFloat(t):t,Zm=t=>typeof t=="number"||de.test(t);function KS(t,e,n,i,o,l){o?(t.opacity=Be(0,n.opacity!==void 0?n.opacity:1,GS(i)),t.opacityExit=Be(e.opacity!==void 0?e.opacity:1,0,JS(i))):l&&(t.opacity=Be(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,i));for(let u=0;u<HS;u++){const d=`border${Ov[u]}Radius`;let h=eg(e,d),m=eg(n,d);if(h===void 0&&m===void 0)continue;h||(h=0),m||(m=0),h===0||m===0||Zm(h)===Zm(m)?(t[d]=Math.max(Be(Xm(h),Xm(m),i),0),(ln.test(m)||ln.test(h))&&(t[d]+="%")):t[d]=m}(e.rotate||n.rotate)&&(t.rotate=Be(e.rotate||0,n.rotate||0,i))}function eg(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const GS=Iv(0,.5,Xy),JS=Iv(.5,.95,Ot);function Iv(t,e,n){return i=>i<t?0:i>e?1:n(ms(t,e,i))}function tg(t,e){t.min=e.min,t.max=e.max}function Ft(t,e){tg(t.x,e.x),tg(t.y,e.y)}function ng(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function rg(t,e,n,i,o){return t-=e,t=Ca(t,1/n,i),o!==void 0&&(t=Ca(t,1/o,i)),t}function YS(t,e=0,n=1,i=.5,o,l=t,u=t){if(ln.test(e)&&(e=parseFloat(e),e=Be(u.min,u.max,e/100)-u.min),typeof e!="number")return;let d=Be(l.min,l.max,i);t===l&&(d-=e),t.min=rg(t.min,e,n,d,o),t.max=rg(t.max,e,n,d,o)}function sg(t,e,[n,i,o],l,u){YS(t,e[n],e[i],e[o],e.scale,l,u)}const QS=["x","scaleX","originX"],XS=["y","scaleY","originY"];function ig(t,e,n,i){sg(t.x,e,QS,n?n.x:void 0,i?i.x:void 0),sg(t.y,e,XS,n?n.y:void 0,i?i.y:void 0)}function og(t){return t.translate===0&&t.scale===1}function Dv(t){return og(t.x)&&og(t.y)}function ag(t,e){return t.min===e.min&&t.max===e.max}function ZS(t,e){return ag(t.x,e.x)&&ag(t.y,e.y)}function lg(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function Lv(t,e){return lg(t.x,e.x)&&lg(t.y,e.y)}function ug(t){return It(t.x)/It(t.y)}function cg(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class ek{constructor(){this.members=[]}add(e){Cd(this.members,e),e.scheduleRender()}remove(e){if(Nd(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(o=>e===o);if(n===0)return!1;let i;for(let o=n;o>=0;o--){const l=this.members[o];if(l.isPresent!==!1){i=l;break}}return i?(this.promote(i),!0):!1}promote(e,n){const i=this.lead;if(e!==i&&(this.prevLead=i,this.lead=e,e.show(),i)){i.instance&&i.scheduleRender(),e.scheduleRender(),e.resumeFrom=i,n&&(e.resumeFrom.preserveOpacity=!0),i.snapshot&&(e.snapshot=i.snapshot,e.snapshot.latestValues=i.animationValues||i.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:o}=e.options;o===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:i}=e;n.onExitComplete&&n.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function tk(t,e,n){let i="";const o=t.x.translate/e.x,l=t.y.translate/e.y,u=n?.z||0;if((o||l||u)&&(i=`translate3d(${o}px, ${l}px, ${u}px) `),(e.x!==1||e.y!==1)&&(i+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:m,rotate:y,rotateX:v,rotateY:w,skewX:_,skewY:b}=n;m&&(i=`perspective(${m}px) ${i}`),y&&(i+=`rotate(${y}deg) `),v&&(i+=`rotateX(${v}deg) `),w&&(i+=`rotateY(${w}deg) `),_&&(i+=`skewX(${_}deg) `),b&&(i+=`skewY(${b}deg) `)}const d=t.x.scale*e.x,h=t.y.scale*e.y;return(d!==1||h!==1)&&(i+=`scale(${d}, ${h})`),i||"none"}const pr={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},pi=typeof window<"u"&&window.MotionDebug!==void 0,sc=["","X","Y","Z"],nk={visibility:"hidden"},dg=1e3;let rk=0;function ic(t,e,n,i){const{latestValues:o}=e;o[t]&&(n[t]=o[t],e.setStaticValue(t,0),i&&(i[t]=0))}function Mv(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Wy(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:l}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Le,!(o||l))}const{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&Mv(i)}function Uv({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:i,resetTransform:o}){return class{constructor(u={},d=e?.()){this.id=rk++,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.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,pi&&(pr.totalNodes=pr.resolvedTargetDeltas=pr.recalculatedProjection=0),this.nodes.forEach(ok),this.nodes.forEach(dk),this.nodes.forEach(hk),this.nodes.forEach(ak),pi&&window.MotionDebug.record(pr)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=d?d.root||d:this,this.path=d?[...d.path,d]:[],this.parent=d,this.depth=d?d.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new qS)}addEventListener(u,d){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Ad),this.eventHandlers.get(u).add(d)}notifyListeners(u,...d){const h=this.eventHandlers.get(u);h&&h.notify(...d)}hasListeners(u){return this.eventHandlers.has(u)}mount(u,d=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=BS(u),this.instance=u;const{layoutId:h,layout:m,visualElement:y}=this.options;if(y&&!y.current&&y.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),d&&(m||h)&&(this.isLayoutDirty=!0),t){let v;const w=()=>this.root.updateBlockedByResize=!1;t(u,()=>{this.root.updateBlockedByResize=!0,v&&v(),v=WS(w,250),ya.hasAnimatedSinceResize&&(ya.hasAnimatedSinceResize=!1,this.nodes.forEach(fg))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&y&&(h||m)&&this.addEventListener("didUpdate",({delta:v,hasLayoutChanged:w,hasRelativeTargetChanged:_,layout:b})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const S=this.options.transition||y.getDefaultTransition()||yk,{onLayoutAnimationStart:k,onLayoutAnimationComplete:E}=y.getProps(),P=!this.targetLayout||!Lv(this.targetLayout,b)||_,N=!w&&_;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||N||w&&(P||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(v,N);const U={...kd(S,"layout"),onPlay:k,onComplete:E};(y.shouldReduceMotion||this.options.layoutRoot)&&(U.delay=0,U.type=!1),this.startAnimation(U)}else w||fg(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=b})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Gn(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(fk),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Mv(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let y=0;y<this.path.length;y++){const v=this.path[y];v.shouldResetTransform=!0,v.updateScroll("snapshot"),v.options.layoutRoot&&v.willUpdate(!1)}const{layoutId:d,layout:h}=this.options;if(d===void 0&&!h)return;const m=this.getTransformTemplate();this.prevTransformTemplateValue=m?m(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(hg);return}this.isUpdating||this.nodes.forEach(uk),this.isUpdating=!1,this.nodes.forEach(ck),this.nodes.forEach(sk),this.nodes.forEach(ik),this.clearAllSnapshots();const d=un.now();at.delta=Sn(0,1e3/60,d-at.timestamp),at.timestamp=d,at.isProcessing=!0,Ju.update.process(at),Ju.preRender.process(at),Ju.render.process(at),at.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,pd.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(lk),this.sharedNodes.forEach(pk)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Le.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Le.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 h=0;h<this.path.length;h++)this.path[h].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Ge(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:d}=this.options;d&&d.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let d=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(d=!1),d){const h=i(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:h,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!o)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,d=this.projectionDelta&&!Dv(this.projectionDelta),h=this.getTransformTemplate(),m=h?h(this.latestValues,""):void 0,y=m!==this.prevTransformTemplateValue;u&&(d||fr(this.latestValues)||y)&&(o(this.instance,m),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const d=this.measurePageBox();let h=this.removeElementScroll(d);return u&&(h=this.removeTransform(h)),vk(h),{animationId:this.root.animationId,measuredBox:d,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:d}=this.options;if(!d)return Ge();const h=d.measureViewportBox();if(!(((u=this.scroll)===null||u===void 0?void 0:u.wasRoot)||this.path.some(wk))){const{scroll:y}=this.root;y&&(cs(h.x,y.offset.x),cs(h.y,y.offset.y))}return h}removeElementScroll(u){var d;const h=Ge();if(Ft(h,u),!((d=this.scroll)===null||d===void 0)&&d.wasRoot)return h;for(let m=0;m<this.path.length;m++){const y=this.path[m],{scroll:v,options:w}=y;y!==this.root&&v&&w.layoutScroll&&(v.wasRoot&&Ft(h,u),cs(h.x,v.offset.x),cs(h.y,v.offset.y))}return h}applyTransform(u,d=!1){const h=Ge();Ft(h,u);for(let m=0;m<this.path.length;m++){const y=this.path[m];!d&&y.options.layoutScroll&&y.scroll&&y!==y.root&&ds(h,{x:-y.scroll.offset.x,y:-y.scroll.offset.y}),fr(y.latestValues)&&ds(h,y.latestValues)}return fr(this.latestValues)&&ds(h,this.latestValues),h}removeTransform(u){const d=Ge();Ft(d,u);for(let h=0;h<this.path.length;h++){const m=this.path[h];if(!m.instance||!fr(m.latestValues))continue;Mc(m.latestValues)&&m.updateSnapshot();const y=Ge(),v=m.measurePageBox();Ft(y,v),ig(d,m.latestValues,m.snapshot?m.snapshot.layoutBox:void 0,y)}return fr(this.latestValues)&&ig(d,this.latestValues),d}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==at.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){var d;const h=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=h.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=h.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=h.isSharedProjectionDirty);const m=!!this.resumingFrom||this!==h;if(!(u||m&&this.isSharedProjectionDirty||this.isProjectionDirty||!((d=this.parent)===null||d===void 0)&&d.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:v,layoutId:w}=this.options;if(!(!this.layout||!(v||w))){if(this.resolvedRelativeTargetAt=at.timestamp,!this.targetDelta&&!this.relativeTarget){const _=this.getClosestProjectingParent();_&&_.layout&&this.animationProgress!==1?(this.relativeParent=_,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ge(),this.relativeTargetOrigin=Ge(),wi(this.relativeTargetOrigin,this.layout.layoutBox,_.layout.layoutBox),Ft(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Ge(),this.targetWithTransforms=Ge()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),_S(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Ft(this.target,this.layout.layoutBox),Nv(this.target,this.targetDelta)):Ft(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const _=this.getClosestProjectingParent();_&&!!_.resumingFrom==!!this.resumingFrom&&!_.options.layoutScroll&&_.target&&this.animationProgress!==1?(this.relativeParent=_,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ge(),this.relativeTargetOrigin=Ge(),wi(this.relativeTargetOrigin,this.target,_.target),Ft(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}pi&&pr.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Mc(this.parent.latestValues)||Cv(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var u;const d=this.getLead(),h=!!this.resumingFrom||this!==d;let m=!0;if((this.isProjectionDirty||!((u=this.parent)===null||u===void 0)&&u.isProjectionDirty)&&(m=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(m=!1),this.resolvedRelativeTargetAt===at.timestamp&&(m=!1),m)return;const{layout:y,layoutId:v}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(y||v))return;Ft(this.layoutCorrected,this.layout.layoutBox);const w=this.treeScale.x,_=this.treeScale.y;PS(this.layoutCorrected,this.treeScale,this.path,h),d.layout&&!d.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(d.target=d.layout.layoutBox,d.targetWithTransforms=Ge());const{target:b}=d;if(!b){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(ng(this.prevProjectionDelta.x,this.projectionDelta.x),ng(this.prevProjectionDelta.y,this.projectionDelta.y)),vi(this.projectionDelta,this.layoutCorrected,b,this.latestValues),(this.treeScale.x!==w||this.treeScale.y!==_||!cg(this.projectionDelta.x,this.prevProjectionDelta.x)||!cg(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",b)),pi&&pr.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){var d;if((d=this.options.visualElement)===null||d===void 0||d.scheduleRender(),u){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=us(),this.projectionDelta=us(),this.projectionDeltaWithTransform=us()}setAnimationOrigin(u,d=!1){const h=this.snapshot,m=h?h.latestValues:{},y={...this.latestValues},v=us();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!d;const w=Ge(),_=h?h.source:void 0,b=this.layout?this.layout.source:void 0,S=_!==b,k=this.getStack(),E=!k||k.members.length<=1,P=!!(S&&!E&&this.options.crossfade===!0&&!this.path.some(gk));this.animationProgress=0;let N;this.mixTargetDelta=U=>{const V=U/1e3;pg(v.x,u.x,V),pg(v.y,u.y,V),this.setTargetDelta(v),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(wi(w,this.layout.layoutBox,this.relativeParent.layout.layoutBox),mk(this.relativeTarget,this.relativeTargetOrigin,w,V),N&&ZS(this.relativeTarget,N)&&(this.isProjectionDirty=!1),N||(N=Ge()),Ft(N,this.relativeTarget)),S&&(this.animationValues=y,KS(y,m,this.latestValues,V,P,E)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=V},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Gn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Le.update(()=>{ya.hasAnimatedSinceResize=!0,this.currentAnimation=FS(0,dg,{...u,onUpdate:d=>{this.mixTargetDelta(d),u.onUpdate&&u.onUpdate(d)},onComplete:()=>{u.onComplete&&u.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 u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(dg),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:d,target:h,layout:m,latestValues:y}=u;if(!(!d||!h||!m)){if(this!==u&&this.layout&&m&&$v(this.options.animationType,this.layout.layoutBox,m.layoutBox)){h=this.target||Ge();const v=It(this.layout.layoutBox.x);h.x.min=u.target.x.min,h.x.max=h.x.min+v;const w=It(this.layout.layoutBox.y);h.y.min=u.target.y.min,h.y.max=h.y.min+w}Ft(d,h),ds(d,y),vi(this.projectionDeltaWithTransform,this.layoutCorrected,d,y)}}registerSharedNode(u,d){this.sharedNodes.has(u)||this.sharedNodes.set(u,new ek),this.sharedNodes.get(u).add(d);const m=d.options.initialPromotionConfig;d.promote({transition:m?m.transition:void 0,preserveFollowOpacity:m&&m.shouldPreserveFollowOpacity?m.shouldPreserveFollowOpacity(d):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){var u;const{layoutId:d}=this.options;return d?((u=this.getStack())===null||u===void 0?void 0:u.lead)||this:this}getPrevLead(){var u;const{layoutId:d}=this.options;return d?(u=this.getStack())===null||u===void 0?void 0:u.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:d,preserveFollowOpacity:h}={}){const m=this.getStack();m&&m.promote(this,h),u&&(this.projectionDelta=void 0,this.needsReset=!0),d&&this.setOptions({transition:d})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let d=!1;const{latestValues:h}=u;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(d=!0),!d)return;const m={};h.z&&ic("z",u,m,this.animationValues);for(let y=0;y<sc.length;y++)ic(`rotate${sc[y]}`,u,m,this.animationValues),ic(`skew${sc[y]}`,u,m,this.animationValues);u.render();for(const y in m)u.setStaticValue(y,m[y]),this.animationValues&&(this.animationValues[y]=m[y]);u.scheduleRender()}getProjectionStyles(u){var d,h;if(!this.instance||this.isSVG)return;if(!this.isVisible)return nk;const m={visibility:""},y=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,m.opacity="",m.pointerEvents=ma(u?.pointerEvents)||"",m.transform=y?y(this.latestValues,""):"none",m;const v=this.getLead();if(!this.projectionDelta||!this.layout||!v.target){const S={};return this.options.layoutId&&(S.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,S.pointerEvents=ma(u?.pointerEvents)||""),this.hasProjected&&!fr(this.latestValues)&&(S.transform=y?y({},""):"none",this.hasProjected=!1),S}const w=v.animationValues||v.latestValues;this.applyTransformsToTarget(),m.transform=tk(this.projectionDeltaWithTransform,this.treeScale,w),y&&(m.transform=y(w,m.transform));const{x:_,y:b}=this.projectionDelta;m.transformOrigin=`${_.origin*100}% ${b.origin*100}% 0`,v.animationValues?m.opacity=v===this?(h=(d=w.opacity)!==null&&d!==void 0?d:this.latestValues.opacity)!==null&&h!==void 0?h:1:this.preserveOpacity?this.latestValues.opacity:w.opacityExit:m.opacity=v===this?w.opacity!==void 0?w.opacity:"":w.opacityExit!==void 0?w.opacityExit:0;for(const S in Sa){if(w[S]===void 0)continue;const{correct:k,applyTo:E}=Sa[S],P=m.transform==="none"?w[S]:k(w[S],v);if(E){const N=E.length;for(let U=0;U<N;U++)m[E[U]]=P}else m[S]=P}return this.options.layoutId&&(m.pointerEvents=v===this?ma(u?.pointerEvents)||"":"none"),m}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>{var d;return(d=u.currentAnimation)===null||d===void 0?void 0:d.stop()}),this.root.nodes.forEach(hg),this.root.sharedNodes.clear()}}}function sk(t){t.updateLayout()}function ik(t){var e;const n=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:o}=t.layout,{animationType:l}=t.options,u=n.source!==t.layout.source;l==="size"?Bt(v=>{const w=u?n.measuredBox[v]:n.layoutBox[v],_=It(w);w.min=i[v].min,w.max=w.min+_}):$v(l,n.layoutBox,i)&&Bt(v=>{const w=u?n.measuredBox[v]:n.layoutBox[v],_=It(i[v]);w.max=w.min+_,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[v].max=t.relativeTarget[v].min+_)});const d=us();vi(d,i,n.layoutBox);const h=us();u?vi(h,t.applyTransform(o,!0),n.measuredBox):vi(h,i,n.layoutBox);const m=!Dv(d);let y=!1;if(!t.resumeFrom){const v=t.getClosestProjectingParent();if(v&&!v.resumeFrom){const{snapshot:w,layout:_}=v;if(w&&_){const b=Ge();wi(b,n.layoutBox,w.layoutBox);const S=Ge();wi(S,i,_.layoutBox),Lv(b,S)||(y=!0),v.options.layoutRoot&&(t.relativeTarget=S,t.relativeTargetOrigin=b,t.relativeParent=v)}}}t.notifyListeners("didUpdate",{layout:i,snapshot:n,delta:h,layoutDelta:d,hasLayoutChanged:m,hasRelativeTargetChanged:y})}else if(t.isLead()){const{onExitComplete:i}=t.options;i&&i()}t.options.transition=void 0}function ok(t){pi&&pr.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function ak(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function lk(t){t.clearSnapshot()}function hg(t){t.clearMeasurements()}function uk(t){t.isLayoutDirty=!1}function ck(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function fg(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function dk(t){t.resolveTargetDelta()}function hk(t){t.calcProjection()}function fk(t){t.resetSkewAndRotation()}function pk(t){t.removeLeadSnapshot()}function pg(t,e,n){t.translate=Be(e.translate,0,n),t.scale=Be(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function mg(t,e,n,i){t.min=Be(e.min,n.min,i),t.max=Be(e.max,n.max,i)}function mk(t,e,n,i){mg(t.x,e.x,n.x,i),mg(t.y,e.y,n.y,i)}function gk(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const yk={duration:.45,ease:[.4,0,.1,1]},gg=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),yg=gg("applewebkit/")&&!gg("chrome/")?Math.round:Ot;function vg(t){t.min=yg(t.min),t.max=yg(t.max)}function vk(t){vg(t.x),vg(t.y)}function $v(t,e,n){return t==="position"||t==="preserve-aspect"&&!bS(ug(e),ug(n),.2)}function wk(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const xk=Uv({attachResizeListener:(t,e)=>Ni(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),oc={current:void 0},Vv=Uv({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!oc.current){const t=new xk({});t.mount(window),t.setOptions({layoutScroll:!0}),oc.current=t}return oc.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),bk={pan:{Feature:MS},drag:{Feature:LS,ProjectionNode:Vv,MeasureLayout:Rv}};function wg(t,e,n){const{props:i}=t;t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,l=i[o];l&&Le.postRender(()=>l(e,Fi(e)))}class _k extends Yn{mount(){const{current:e}=this.node;e&&(this.unmount=bb(e,n=>(wg(this.node,n,"Start"),i=>wg(this.node,i,"End"))))}unmount(){}}class Sk extends Yn{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Vi(Ni(this.node.current,"focus",()=>this.onFocus()),Ni(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function xg(t,e,n){const{props:i}=t;t.animationState&&i.whileTap&&t.animationState.setActive("whileTap",n==="Start");const o="onTap"+(n==="End"?"":n),l=i[o];l&&Le.postRender(()=>l(e,Fi(e)))}class kk extends Yn{mount(){const{current:e}=this.node;e&&(this.unmount=Eb(e,n=>(xg(this.node,n,"Start"),(i,{success:o})=>xg(this.node,i,o?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const $c=new WeakMap,ac=new WeakMap,Ek=t=>{const e=$c.get(t.target);e&&e(t)},Tk=t=>{t.forEach(Ek)};function jk({root:t,...e}){const n=t||document;ac.has(n)||ac.set(n,{});const i=ac.get(n),o=JSON.stringify(e);return i[o]||(i[o]=new IntersectionObserver(Tk,{root:t,...e})),i[o]}function Ck(t,e,n){const i=jk(e);return $c.set(t,n),i.observe(t),()=>{$c.delete(t),i.unobserve(t)}}const Nk={some:0,all:1};class Ak extends Yn{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:i,amount:o="some",once:l}=e,u={root:n?n.current:void 0,rootMargin:i,threshold:typeof o=="number"?o:Nk[o]},d=h=>{const{isIntersecting:m}=h;if(this.isInView===m||(this.isInView=m,l&&!m&&this.hasEnteredView))return;m&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",m);const{onViewportEnter:y,onViewportLeave:v}=this.node.getProps(),w=m?y:v;w&&w(h)};return Ck(this.node.current,u,d)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(Pk(e,n))&&this.startObserver()}unmount(){}}function Pk({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const Rk={inView:{Feature:Ak},tap:{Feature:kk},focus:{Feature:Sk},hover:{Feature:_k}},Ok={layout:{ProjectionNode:Vv,MeasureLayout:Rv}},Vc={current:null},Fv={current:!1};function Ik(){if(Fv.current=!0,!!ud)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Vc.current=t.matches;t.addListener(e),e()}else Vc.current=!1}const Dk=[...hv,ht,Jn],Lk=t=>Dk.find(dv(t)),bg=new WeakMap;function Mk(t,e,n){for(const i in e){const o=e[i],l=n[i];if(pt(o))t.addValue(i,o);else if(pt(l))t.addValue(i,ji(o,{owner:t}));else if(l!==o)if(t.hasValue(i)){const u=t.getValue(i);u.liveStyle===!0?u.jump(o):u.hasAnimated||u.set(o)}else{const u=t.getStaticValue(i);t.addValue(i,ji(u!==void 0?u:o,{owner:t}))}}for(const i in n)e[i]===void 0&&t.removeValue(i);return e}const _g=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Uk{scrapeMotionValuesFromProps(e,n,i){return{}}constructor({parent:e,props:n,presenceContext:i,reducedMotionConfig:o,blockInitialAnimation:l,visualState:u},d={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Ld,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.renderScheduledAt=0,this.scheduleRender=()=>{const _=un.now();this.renderScheduledAt<_&&(this.renderScheduledAt=_,Le.render(this.render,!1,!0))};const{latestValues:h,renderState:m,onUpdate:y}=u;this.onUpdate=y,this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=m,this.parent=e,this.props=n,this.presenceContext=i,this.depth=e?e.depth+1:0,this.reducedMotionConfig=o,this.options=d,this.blockInitialAnimation=!!l,this.isControllingVariants=Ua(n),this.isVariantNode=xy(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:v,...w}=this.scrapeMotionValuesFromProps(n,{},this);for(const _ in w){const b=w[_];h[_]!==void 0&&pt(b)&&b.set(h[_],!1)}}mount(e){this.current=e,bg.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,i)=>this.bindToMotionValue(i,n)),Fv.current||Ik(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Vc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){bg.delete(this.current),this.projection&&this.projection.unmount(),Gn(this.notifyUpdate),Gn(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const i=Tr.has(e),o=n.on("change",d=>{this.latestValues[e]=d,this.props.onUpdate&&Le.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0)}),l=n.on("renderRequest",this.scheduleRender);let u;window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{o(),l(),u&&u(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in gs){const n=gs[e];if(!n)continue;const{isEnabled:i,Feature:o}=n;if(!this.features[e]&&o&&i(this.props)&&(this.features[e]=new o(this)),this.features[e]){const l=this.features[e];l.isMounted?l.update():(l.mount(),l.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ge()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let i=0;i<_g.length;i++){const o=_g[i];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const l="on"+o,u=e[l];u&&(this.propEventSubscriptions[o]=this.on(o,u))}this.prevMotionValues=Mk(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const i=this.values.get(e);n!==i&&(i&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let i=this.values.get(e);return i===void 0&&n!==void 0&&(i=ji(n===null?void 0:n,{owner:this}),this.addValue(e,i)),i}readValue(e,n){var i;let o=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(i=this.getBaseTargetFromProps(this.props,e))!==null&&i!==void 0?i:this.readValueFromInstance(this.current,e,this.options);return o!=null&&(typeof o=="string"&&(uv(o)||ev(o))?o=parseFloat(o):!Lk(o)&&Jn.test(n)&&(o=ov(e,n)),this.setBaseTarget(e,pt(o)?o.get():o)),pt(o)?o.get():o}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;const{initial:i}=this.props;let o;if(typeof i=="string"||typeof i=="object"){const u=gd(this.props,i,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);u&&(o=u[e])}if(i&&o!==void 0)return o;const l=this.getBaseTargetFromProps(this.props,e);return l!==void 0&&!pt(l)?l:this.initialValues[e]!==void 0&&o===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new Ad),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class Bv extends Uk{constructor(){super(...arguments),this.KeyframeResolver=fv}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:i}){delete n[e],delete i[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;pt(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function $k(t){return window.getComputedStyle(t)}class Vk extends Bv{constructor(){super(...arguments),this.type="html",this.renderInstance=Ny}readValueFromInstance(e,n){if(Tr.has(n)){const i=Dd(n);return i&&i.default||0}else{const i=$k(e),o=(Ty(n)?i.getPropertyValue(n):i[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(e,{transformPagePoint:n}){return Av(e,n)}build(e,n,i){wd(e,n,i.transformTemplate)}scrapeMotionValuesFromProps(e,n,i){return Sd(e,n,i)}}class Fk extends Bv{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ge}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Tr.has(n)){const i=Dd(n);return i&&i.default||0}return n=Ay.has(n)?n:fd(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,i){return Oy(e,n,i)}build(e,n,i){xd(e,n,this.isSVGTag,i.transformTemplate)}renderInstance(e,n,i,o){Py(e,n,i,o)}mount(e){this.isSVGTag=_d(e.tagName),super.mount(e)}}const Bk=(t,e)=>md(t)?new Fk(e):new Vk(e,{allowProjection:t!==R.Fragment}),zk=pb({...hS,...Rk,...bk,...Ok},Bk),Ne=N1(zk);function zv(t,e){return function(){return t.apply(e,arguments)}}const{toString:qk}=Object.prototype,{getPrototypeOf:Vd}=Object,{iterator:Fa,toStringTag:qv}=Symbol,Ba=(t=>e=>{const n=qk.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),en=t=>(t=t.toLowerCase(),e=>Ba(e)===t),za=t=>e=>typeof e===t,{isArray:bs}=Array,vs=za("undefined");function Bi(t){return t!==null&&!vs(t)&&t.constructor!==null&&!vs(t.constructor)&&St(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Wv=en("ArrayBuffer");function Wk(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Wv(t.buffer),e}const Hk=za("string"),St=za("function"),Hv=za("number"),zi=t=>t!==null&&typeof t=="object",Kk=t=>t===!0||t===!1,va=t=>{if(Ba(t)!=="object")return!1;const e=Vd(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(qv in t)&&!(Fa in t)},Gk=t=>{if(!zi(t)||Bi(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Jk=en("Date"),Yk=en("File"),Qk=en("Blob"),Xk=en("FileList"),Zk=t=>zi(t)&&St(t.pipe),eE=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||St(t.append)&&((e=Ba(t))==="formdata"||e==="object"&&St(t.toString)&&t.toString()==="[object FormData]"))},tE=en("URLSearchParams"),[nE,rE,sE,iE]=["ReadableStream","Request","Response","Headers"].map(en),oE=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function qi(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let i,o;if(typeof t!="object"&&(t=[t]),bs(t))for(i=0,o=t.length;i<o;i++)e.call(null,t[i],i,t);else{if(Bi(t))return;const l=n?Object.getOwnPropertyNames(t):Object.keys(t),u=l.length;let d;for(i=0;i<u;i++)d=l[i],e.call(null,t[d],d,t)}}function Kv(t,e){if(Bi(t))return null;e=e.toLowerCase();const n=Object.keys(t);let i=n.length,o;for(;i-- >0;)if(o=n[i],e===o.toLowerCase())return o;return null}const wr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Gv=t=>!vs(t)&&t!==wr;function Fc(){const{caseless:t,skipUndefined:e}=Gv(this)&&this||{},n={},i=(o,l)=>{const u=t&&Kv(n,l)||l;va(n[u])&&va(o)?n[u]=Fc(n[u],o):va(o)?n[u]=Fc({},o):bs(o)?n[u]=o.slice():(!e||!vs(o))&&(n[u]=o)};for(let o=0,l=arguments.length;o<l;o++)arguments[o]&&qi(arguments[o],i);return n}const aE=(t,e,n,{allOwnKeys:i}={})=>(qi(e,(o,l)=>{n&&St(o)?t[l]=zv(o,n):t[l]=o},{allOwnKeys:i}),t),lE=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),uE=(t,e,n,i)=>{t.prototype=Object.create(e.prototype,i),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},cE=(t,e,n,i)=>{let o,l,u;const d={};if(e=e||{},t==null)return e;do{for(o=Object.getOwnPropertyNames(t),l=o.length;l-- >0;)u=o[l],(!i||i(u,t,e))&&!d[u]&&(e[u]=t[u],d[u]=!0);t=n!==!1&&Vd(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},dE=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const i=t.indexOf(e,n);return i!==-1&&i===n},hE=t=>{if(!t)return null;if(bs(t))return t;let e=t.length;if(!Hv(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},fE=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Vd(Uint8Array)),pE=(t,e)=>{const i=(t&&t[Fa]).call(t);let o;for(;(o=i.next())&&!o.done;){const l=o.value;e.call(t,l[0],l[1])}},mE=(t,e)=>{let n;const i=[];for(;(n=t.exec(e))!==null;)i.push(n);return i},gE=en("HTMLFormElement"),yE=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,i,o){return i.toUpperCase()+o}),Sg=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),vE=en("RegExp"),Jv=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),i={};qi(n,(o,l)=>{let u;(u=e(o,l,t))!==!1&&(i[l]=u||o)}),Object.defineProperties(t,i)},wE=t=>{Jv(t,(e,n)=>{if(St(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const i=t[n];if(St(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},xE=(t,e)=>{const n={},i=o=>{o.forEach(l=>{n[l]=!0})};return bs(t)?i(t):i(String(t).split(e)),n},bE=()=>{},_E=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function SE(t){return!!(t&&St(t.append)&&t[qv]==="FormData"&&t[Fa])}const kE=t=>{const e=new Array(10),n=(i,o)=>{if(zi(i)){if(e.indexOf(i)>=0)return;if(Bi(i))return i;if(!("toJSON"in i)){e[o]=i;const l=bs(i)?[]:{};return qi(i,(u,d)=>{const h=n(u,o+1);!vs(h)&&(l[d]=h)}),e[o]=void 0,l}}return i};return n(t,0)},EE=en("AsyncFunction"),TE=t=>t&&(zi(t)||St(t))&&St(t.then)&&St(t.catch),Yv=((t,e)=>t?setImmediate:e?((n,i)=>(wr.addEventListener("message",({source:o,data:l})=>{o===wr&&l===n&&i.length&&i.shift()()},!1),o=>{i.push(o),wr.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",St(wr.postMessage)),jE=typeof queueMicrotask<"u"?queueMicrotask.bind(wr):typeof process<"u"&&process.nextTick||Yv,CE=t=>t!=null&&St(t[Fa]),M={isArray:bs,isArrayBuffer:Wv,isBuffer:Bi,isFormData:eE,isArrayBufferView:Wk,isString:Hk,isNumber:Hv,isBoolean:Kk,isObject:zi,isPlainObject:va,isEmptyObject:Gk,isReadableStream:nE,isRequest:rE,isResponse:sE,isHeaders:iE,isUndefined:vs,isDate:Jk,isFile:Yk,isBlob:Qk,isRegExp:vE,isFunction:St,isStream:Zk,isURLSearchParams:tE,isTypedArray:fE,isFileList:Xk,forEach:qi,merge:Fc,extend:aE,trim:oE,stripBOM:lE,inherits:uE,toFlatObject:cE,kindOf:Ba,kindOfTest:en,endsWith:dE,toArray:hE,forEachEntry:pE,matchAll:mE,isHTMLForm:gE,hasOwnProperty:Sg,hasOwnProp:Sg,reduceDescriptors:Jv,freezeMethods:wE,toObjectSet:xE,toCamelCase:yE,noop:bE,toFiniteNumber:_E,findKey:Kv,global:wr,isContextDefined:Gv,isSpecCompliantForm:SE,toJSONObject:kE,isAsyncFn:EE,isThenable:TE,setImmediate:Yv,asap:jE,isIterable:CE};function ye(t,e,n,i,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),i&&(this.request=i),o&&(this.response=o,this.status=o.status?o.status:null)}M.inherits(ye,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:M.toJSONObject(this.config),code:this.code,status:this.status}}});const Qv=ye.prototype,Xv={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{Xv[t]={value:t}});Object.defineProperties(ye,Xv);Object.defineProperty(Qv,"isAxiosError",{value:!0});ye.from=(t,e,n,i,o,l)=>{const u=Object.create(Qv);M.toFlatObject(t,u,function(y){return y!==Error.prototype},m=>m!=="isAxiosError");const d=t&&t.message?t.message:"Error",h=e==null&&t?t.code:e;return ye.call(u,d,h,n,i,o),t&&u.cause==null&&Object.defineProperty(u,"cause",{value:t,configurable:!0}),u.name=t&&t.name||"Error",l&&Object.assign(u,l),u};const NE=null;function Bc(t){return M.isPlainObject(t)||M.isArray(t)}function Zv(t){return M.endsWith(t,"[]")?t.slice(0,-2):t}function kg(t,e,n){return t?t.concat(e).map(function(o,l){return o=Zv(o),!n&&l?"["+o+"]":o}).join(n?".":""):e}function AE(t){return M.isArray(t)&&!t.some(Bc)}const PE=M.toFlatObject(M,{},null,function(e){return/^is[A-Z]/.test(e)});function qa(t,e,n){if(!M.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=M.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,k){return!M.isUndefined(k[S])});const i=n.metaTokens,o=n.visitor||y,l=n.dots,u=n.indexes,h=(n.Blob||typeof Blob<"u"&&Blob)&&M.isSpecCompliantForm(e);if(!M.isFunction(o))throw new TypeError("visitor must be a function");function m(b){if(b===null)return"";if(M.isDate(b))return b.toISOString();if(M.isBoolean(b))return b.toString();if(!h&&M.isBlob(b))throw new ye("Blob is not supported. Use a Buffer instead.");return M.isArrayBuffer(b)||M.isTypedArray(b)?h&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function y(b,S,k){let E=b;if(b&&!k&&typeof b=="object"){if(M.endsWith(S,"{}"))S=i?S:S.slice(0,-2),b=JSON.stringify(b);else if(M.isArray(b)&&AE(b)||(M.isFileList(b)||M.endsWith(S,"[]"))&&(E=M.toArray(b)))return S=Zv(S),E.forEach(function(N,U){!(M.isUndefined(N)||N===null)&&e.append(u===!0?kg([S],U,l):u===null?S:S+"[]",m(N))}),!1}return Bc(b)?!0:(e.append(kg(k,S,l),m(b)),!1)}const v=[],w=Object.assign(PE,{defaultVisitor:y,convertValue:m,isVisitable:Bc});function _(b,S){if(!M.isUndefined(b)){if(v.indexOf(b)!==-1)throw Error("Circular reference detected in "+S.join("."));v.push(b),M.forEach(b,function(E,P){(!(M.isUndefined(E)||E===null)&&o.call(e,E,M.isString(P)?P.trim():P,S,w))===!0&&_(E,S?S.concat(P):[P])}),v.pop()}}if(!M.isObject(t))throw new TypeError("data must be an object");return _(t),e}function Eg(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function Fd(t,e){this._pairs=[],t&&qa(t,this,e)}const e0=Fd.prototype;e0.append=function(e,n){this._pairs.push([e,n])};e0.toString=function(e){const n=e?function(i){return e.call(this,i,Eg)}:Eg;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function RE(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function t0(t,e,n){if(!e)return t;const i=n&&n.encode||RE;M.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let l;if(o?l=o(e,n):l=M.isURLSearchParams(e)?e.toString():new Fd(e,n).toString(i),l){const u=t.indexOf("#");u!==-1&&(t=t.slice(0,u)),t+=(t.indexOf("?")===-1?"?":"&")+l}return t}class Tg{constructor(){this.handlers=[]}use(e,n,i){return this.handlers.push({fulfilled:e,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){M.forEach(this.handlers,function(i){i!==null&&e(i)})}}const n0={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},OE=typeof URLSearchParams<"u"?URLSearchParams:Fd,IE=typeof FormData<"u"?FormData:null,DE=typeof Blob<"u"?Blob:null,LE={isBrowser:!0,classes:{URLSearchParams:OE,FormData:IE,Blob:DE},protocols:["http","https","file","blob","url","data"]},Bd=typeof window<"u"&&typeof document<"u",zc=typeof navigator=="object"&&navigator||void 0,ME=Bd&&(!zc||["ReactNative","NativeScript","NS"].indexOf(zc.product)<0),UE=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",$E=Bd&&window.location.href||"http://localhost",VE=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Bd,hasStandardBrowserEnv:ME,hasStandardBrowserWebWorkerEnv:UE,navigator:zc,origin:$E},Symbol.toStringTag,{value:"Module"})),ft={...VE,...LE};function FE(t,e){return qa(t,new ft.classes.URLSearchParams,{visitor:function(n,i,o,l){return ft.isNode&&M.isBuffer(n)?(this.append(i,n.toString("base64")),!1):l.defaultVisitor.apply(this,arguments)},...e})}function BE(t){return M.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function zE(t){const e={},n=Object.keys(t);let i;const o=n.length;let l;for(i=0;i<o;i++)l=n[i],e[l]=t[l];return e}function r0(t){function e(n,i,o,l){let u=n[l++];if(u==="__proto__")return!0;const d=Number.isFinite(+u),h=l>=n.length;return u=!u&&M.isArray(o)?o.length:u,h?(M.hasOwnProp(o,u)?o[u]=[o[u],i]:o[u]=i,!d):((!o[u]||!M.isObject(o[u]))&&(o[u]=[]),e(n,i,o[u],l)&&M.isArray(o[u])&&(o[u]=zE(o[u])),!d)}if(M.isFormData(t)&&M.isFunction(t.entries)){const n={};return M.forEachEntry(t,(i,o)=>{e(BE(i),o,n,0)}),n}return null}function qE(t,e,n){if(M.isString(t))try{return(e||JSON.parse)(t),M.trim(t)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(t)}const Wi={transitional:n0,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const i=n.getContentType()||"",o=i.indexOf("application/json")>-1,l=M.isObject(e);if(l&&M.isHTMLForm(e)&&(e=new FormData(e)),M.isFormData(e))return o?JSON.stringify(r0(e)):e;if(M.isArrayBuffer(e)||M.isBuffer(e)||M.isStream(e)||M.isFile(e)||M.isBlob(e)||M.isReadableStream(e))return e;if(M.isArrayBufferView(e))return e.buffer;if(M.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let d;if(l){if(i.indexOf("application/x-www-form-urlencoded")>-1)return FE(e,this.formSerializer).toString();if((d=M.isFileList(e))||i.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return qa(d?{"files[]":e}:e,h&&new h,this.formSerializer)}}return l||o?(n.setContentType("application/json",!1),qE(e)):e}],transformResponse:[function(e){const n=this.transitional||Wi.transitional,i=n&&n.forcedJSONParsing,o=this.responseType==="json";if(M.isResponse(e)||M.isReadableStream(e))return e;if(e&&M.isString(e)&&(i&&!this.responseType||o)){const u=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(e,this.parseReviver)}catch(d){if(u)throw d.name==="SyntaxError"?ye.from(d,ye.ERR_BAD_RESPONSE,this,null,this.response):d}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ft.classes.FormData,Blob:ft.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};M.forEach(["delete","get","head","post","put","patch"],t=>{Wi.headers[t]={}});const WE=M.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),HE=t=>{const e={};let n,i,o;return t&&t.split(`
17
+ `).forEach(function(u){o=u.indexOf(":"),n=u.substring(0,o).trim().toLowerCase(),i=u.substring(o+1).trim(),!(!n||e[n]&&WE[n])&&(n==="set-cookie"?e[n]?e[n].push(i):e[n]=[i]:e[n]=e[n]?e[n]+", "+i:i)}),e},jg=Symbol("internals");function ci(t){return t&&String(t).trim().toLowerCase()}function wa(t){return t===!1||t==null?t:M.isArray(t)?t.map(wa):String(t)}function KE(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(t);)e[i[1]]=i[2];return e}const GE=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function lc(t,e,n,i,o){if(M.isFunction(i))return i.call(this,e,n);if(o&&(e=n),!!M.isString(e)){if(M.isString(i))return e.indexOf(i)!==-1;if(M.isRegExp(i))return i.test(e)}}function JE(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,i)=>n.toUpperCase()+i)}function YE(t,e){const n=M.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(t,i+n,{value:function(o,l,u){return this[i].call(this,e,o,l,u)},configurable:!0})})}let kt=class{constructor(e){e&&this.set(e)}set(e,n,i){const o=this;function l(d,h,m){const y=ci(h);if(!y)throw new Error("header name must be a non-empty string");const v=M.findKey(o,y);(!v||o[v]===void 0||m===!0||m===void 0&&o[v]!==!1)&&(o[v||h]=wa(d))}const u=(d,h)=>M.forEach(d,(m,y)=>l(m,y,h));if(M.isPlainObject(e)||e instanceof this.constructor)u(e,n);else if(M.isString(e)&&(e=e.trim())&&!GE(e))u(HE(e),n);else if(M.isObject(e)&&M.isIterable(e)){let d={},h,m;for(const y of e){if(!M.isArray(y))throw TypeError("Object iterator must return a key-value pair");d[m=y[0]]=(h=d[m])?M.isArray(h)?[...h,y[1]]:[h,y[1]]:y[1]}u(d,n)}else e!=null&&l(n,e,i);return this}get(e,n){if(e=ci(e),e){const i=M.findKey(this,e);if(i){const o=this[i];if(!n)return o;if(n===!0)return KE(o);if(M.isFunction(n))return n.call(this,o,i);if(M.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=ci(e),e){const i=M.findKey(this,e);return!!(i&&this[i]!==void 0&&(!n||lc(this,this[i],i,n)))}return!1}delete(e,n){const i=this;let o=!1;function l(u){if(u=ci(u),u){const d=M.findKey(i,u);d&&(!n||lc(i,i[d],d,n))&&(delete i[d],o=!0)}}return M.isArray(e)?e.forEach(l):l(e),o}clear(e){const n=Object.keys(this);let i=n.length,o=!1;for(;i--;){const l=n[i];(!e||lc(this,this[l],l,e,!0))&&(delete this[l],o=!0)}return o}normalize(e){const n=this,i={};return M.forEach(this,(o,l)=>{const u=M.findKey(i,l);if(u){n[u]=wa(o),delete n[l];return}const d=e?JE(l):String(l).trim();d!==l&&delete n[l],n[d]=wa(o),i[d]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return M.forEach(this,(i,o)=>{i!=null&&i!==!1&&(n[o]=e&&M.isArray(i)?i.join(", "):i)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
18
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const i=new this(e);return n.forEach(o=>i.set(o)),i}static accessor(e){const i=(this[jg]=this[jg]={accessors:{}}).accessors,o=this.prototype;function l(u){const d=ci(u);i[d]||(YE(o,u),i[d]=!0)}return M.isArray(e)?e.forEach(l):l(e),this}};kt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);M.reduceDescriptors(kt.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(i){this[n]=i}}});M.freezeMethods(kt);function uc(t,e){const n=this||Wi,i=e||n,o=kt.from(i.headers);let l=i.data;return M.forEach(t,function(d){l=d.call(n,l,o.normalize(),e?e.status:void 0)}),o.normalize(),l}function s0(t){return!!(t&&t.__CANCEL__)}function _s(t,e,n){ye.call(this,t??"canceled",ye.ERR_CANCELED,e,n),this.name="CanceledError"}M.inherits(_s,ye,{__CANCEL__:!0});function i0(t,e,n){const i=n.config.validateStatus;!n.status||!i||i(n.status)?t(n):e(new ye("Request failed with status code "+n.status,[ye.ERR_BAD_REQUEST,ye.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function QE(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function XE(t,e){t=t||10;const n=new Array(t),i=new Array(t);let o=0,l=0,u;return e=e!==void 0?e:1e3,function(h){const m=Date.now(),y=i[l];u||(u=m),n[o]=h,i[o]=m;let v=l,w=0;for(;v!==o;)w+=n[v++],v=v%t;if(o=(o+1)%t,o===l&&(l=(l+1)%t),m-u<e)return;const _=y&&m-y;return _?Math.round(w*1e3/_):void 0}}function ZE(t,e){let n=0,i=1e3/e,o,l;const u=(m,y=Date.now())=>{n=y,o=null,l&&(clearTimeout(l),l=null),t(...m)};return[(...m)=>{const y=Date.now(),v=y-n;v>=i?u(m,y):(o=m,l||(l=setTimeout(()=>{l=null,u(o)},i-v)))},()=>o&&u(o)]}const Na=(t,e,n=3)=>{let i=0;const o=XE(50,250);return ZE(l=>{const u=l.loaded,d=l.lengthComputable?l.total:void 0,h=u-i,m=o(h),y=u<=d;i=u;const v={loaded:u,total:d,progress:d?u/d:void 0,bytes:h,rate:m||void 0,estimated:m&&d&&y?(d-u)/m:void 0,event:l,lengthComputable:d!=null,[e?"download":"upload"]:!0};t(v)},n)},Cg=(t,e)=>{const n=t!=null;return[i=>e[0]({lengthComputable:n,total:t,loaded:i}),e[1]]},Ng=t=>(...e)=>M.asap(()=>t(...e)),eT=ft.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,ft.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(ft.origin),ft.navigator&&/(msie|trident)/i.test(ft.navigator.userAgent)):()=>!0,tT=ft.hasStandardBrowserEnv?{write(t,e,n,i,o,l,u){if(typeof document>"u")return;const d=[`${t}=${encodeURIComponent(e)}`];M.isNumber(n)&&d.push(`expires=${new Date(n).toUTCString()}`),M.isString(i)&&d.push(`path=${i}`),M.isString(o)&&d.push(`domain=${o}`),l===!0&&d.push("secure"),M.isString(u)&&d.push(`SameSite=${u}`),document.cookie=d.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function nT(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function rT(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function o0(t,e,n){let i=!nT(e);return t&&(i||n==!1)?rT(t,e):e}const Ag=t=>t instanceof kt?{...t}:t;function Er(t,e){e=e||{};const n={};function i(m,y,v,w){return M.isPlainObject(m)&&M.isPlainObject(y)?M.merge.call({caseless:w},m,y):M.isPlainObject(y)?M.merge({},y):M.isArray(y)?y.slice():y}function o(m,y,v,w){if(M.isUndefined(y)){if(!M.isUndefined(m))return i(void 0,m,v,w)}else return i(m,y,v,w)}function l(m,y){if(!M.isUndefined(y))return i(void 0,y)}function u(m,y){if(M.isUndefined(y)){if(!M.isUndefined(m))return i(void 0,m)}else return i(void 0,y)}function d(m,y,v){if(v in e)return i(m,y);if(v in t)return i(void 0,m)}const h={url:l,method:l,data:l,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:d,headers:(m,y,v)=>o(Ag(m),Ag(y),v,!0)};return M.forEach(Object.keys({...t,...e}),function(y){const v=h[y]||o,w=v(t[y],e[y],y);M.isUndefined(w)&&v!==d||(n[y]=w)}),n}const a0=t=>{const e=Er({},t);let{data:n,withXSRFToken:i,xsrfHeaderName:o,xsrfCookieName:l,headers:u,auth:d}=e;if(e.headers=u=kt.from(u),e.url=t0(o0(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),d&&u.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):""))),M.isFormData(n)){if(ft.hasStandardBrowserEnv||ft.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if(M.isFunction(n.getHeaders)){const h=n.getHeaders(),m=["content-type","content-length"];Object.entries(h).forEach(([y,v])=>{m.includes(y.toLowerCase())&&u.set(y,v)})}}if(ft.hasStandardBrowserEnv&&(i&&M.isFunction(i)&&(i=i(e)),i||i!==!1&&eT(e.url))){const h=o&&l&&tT.read(l);h&&u.set(o,h)}return e},sT=typeof XMLHttpRequest<"u",iT=sT&&function(t){return new Promise(function(n,i){const o=a0(t);let l=o.data;const u=kt.from(o.headers).normalize();let{responseType:d,onUploadProgress:h,onDownloadProgress:m}=o,y,v,w,_,b;function S(){_&&_(),b&&b(),o.cancelToken&&o.cancelToken.unsubscribe(y),o.signal&&o.signal.removeEventListener("abort",y)}let k=new XMLHttpRequest;k.open(o.method.toUpperCase(),o.url,!0),k.timeout=o.timeout;function E(){if(!k)return;const N=kt.from("getAllResponseHeaders"in k&&k.getAllResponseHeaders()),V={data:!d||d==="text"||d==="json"?k.responseText:k.response,status:k.status,statusText:k.statusText,headers:N,config:t,request:k};i0(function($){n($),S()},function($){i($),S()},V),k=null}"onloadend"in k?k.onloadend=E:k.onreadystatechange=function(){!k||k.readyState!==4||k.status===0&&!(k.responseURL&&k.responseURL.indexOf("file:")===0)||setTimeout(E)},k.onabort=function(){k&&(i(new ye("Request aborted",ye.ECONNABORTED,t,k)),k=null)},k.onerror=function(U){const V=U&&U.message?U.message:"Network Error",z=new ye(V,ye.ERR_NETWORK,t,k);z.event=U||null,i(z),k=null},k.ontimeout=function(){let U=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const V=o.transitional||n0;o.timeoutErrorMessage&&(U=o.timeoutErrorMessage),i(new ye(U,V.clarifyTimeoutError?ye.ETIMEDOUT:ye.ECONNABORTED,t,k)),k=null},l===void 0&&u.setContentType(null),"setRequestHeader"in k&&M.forEach(u.toJSON(),function(U,V){k.setRequestHeader(V,U)}),M.isUndefined(o.withCredentials)||(k.withCredentials=!!o.withCredentials),d&&d!=="json"&&(k.responseType=o.responseType),m&&([w,b]=Na(m,!0),k.addEventListener("progress",w)),h&&k.upload&&([v,_]=Na(h),k.upload.addEventListener("progress",v),k.upload.addEventListener("loadend",_)),(o.cancelToken||o.signal)&&(y=N=>{k&&(i(!N||N.type?new _s(null,t,k):N),k.abort(),k=null)},o.cancelToken&&o.cancelToken.subscribe(y),o.signal&&(o.signal.aborted?y():o.signal.addEventListener("abort",y)));const P=QE(o.url);if(P&&ft.protocols.indexOf(P)===-1){i(new ye("Unsupported protocol "+P+":",ye.ERR_BAD_REQUEST,t));return}k.send(l||null)})},oT=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let i=new AbortController,o;const l=function(m){if(!o){o=!0,d();const y=m instanceof Error?m:this.reason;i.abort(y instanceof ye?y:new _s(y instanceof Error?y.message:y))}};let u=e&&setTimeout(()=>{u=null,l(new ye(`timeout ${e} of ms exceeded`,ye.ETIMEDOUT))},e);const d=()=>{t&&(u&&clearTimeout(u),u=null,t.forEach(m=>{m.unsubscribe?m.unsubscribe(l):m.removeEventListener("abort",l)}),t=null)};t.forEach(m=>m.addEventListener("abort",l));const{signal:h}=i;return h.unsubscribe=()=>M.asap(d),h}},aT=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let i=0,o;for(;i<n;)o=i+e,yield t.slice(i,o),i=o},lT=async function*(t,e){for await(const n of uT(t))yield*aT(n,e)},uT=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:i}=await e.read();if(n)break;yield i}}finally{await e.cancel()}},Pg=(t,e,n,i)=>{const o=lT(t,e);let l=0,u,d=h=>{u||(u=!0,i&&i(h))};return new ReadableStream({async pull(h){try{const{done:m,value:y}=await o.next();if(m){d(),h.close();return}let v=y.byteLength;if(n){let w=l+=v;n(w)}h.enqueue(new Uint8Array(y))}catch(m){throw d(m),m}},cancel(h){return d(h),o.return()}},{highWaterMark:2})},Rg=64*1024,{isFunction:ua}=M,cT=(({Request:t,Response:e})=>({Request:t,Response:e}))(M.global),{ReadableStream:Og,TextEncoder:Ig}=M.global,Dg=(t,...e)=>{try{return!!t(...e)}catch{return!1}},dT=t=>{t=M.merge.call({skipUndefined:!0},cT,t);const{fetch:e,Request:n,Response:i}=t,o=e?ua(e):typeof fetch=="function",l=ua(n),u=ua(i);if(!o)return!1;const d=o&&ua(Og),h=o&&(typeof Ig=="function"?(b=>S=>b.encode(S))(new Ig):async b=>new Uint8Array(await new n(b).arrayBuffer())),m=l&&d&&Dg(()=>{let b=!1;const S=new n(ft.origin,{body:new Og,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!S}),y=u&&d&&Dg(()=>M.isReadableStream(new i("").body)),v={stream:y&&(b=>b.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!v[b]&&(v[b]=(S,k)=>{let E=S&&S[b];if(E)return E.call(S);throw new ye(`Response type '${b}' is not supported`,ye.ERR_NOT_SUPPORT,k)})});const w=async b=>{if(b==null)return 0;if(M.isBlob(b))return b.size;if(M.isSpecCompliantForm(b))return(await new n(ft.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(M.isArrayBufferView(b)||M.isArrayBuffer(b))return b.byteLength;if(M.isURLSearchParams(b)&&(b=b+""),M.isString(b))return(await h(b)).byteLength},_=async(b,S)=>{const k=M.toFiniteNumber(b.getContentLength());return k??w(S)};return async b=>{let{url:S,method:k,data:E,signal:P,cancelToken:N,timeout:U,onDownloadProgress:V,onUploadProgress:z,responseType:$,headers:B,withCredentials:Y="same-origin",fetchOptions:oe}=a0(b),Te=e||fetch;$=$?($+"").toLowerCase():"text";let ve=oT([P,N&&N.toAbortSignal()],U),je=null;const xe=ve&&ve.unsubscribe&&(()=>{ve.unsubscribe()});let Oe;try{if(z&&m&&k!=="get"&&k!=="head"&&(Oe=await _(B,E))!==0){let j=new n(S,{method:"POST",body:E,duplex:"half"}),D;if(M.isFormData(E)&&(D=j.headers.get("content-type"))&&B.setContentType(D),j.body){const[re,ue]=Cg(Oe,Na(Ng(z)));E=Pg(j.body,Rg,re,ue)}}M.isString(Y)||(Y=Y?"include":"omit");const be=l&&"credentials"in n.prototype,pe={...oe,signal:ve,method:k.toUpperCase(),headers:B.normalize().toJSON(),body:E,duplex:"half",credentials:be?Y:void 0};je=l&&new n(S,pe);let F=await(l?Te(je,oe):Te(S,pe));const J=y&&($==="stream"||$==="response");if(y&&(V||J&&xe)){const j={};["status","statusText","headers"].forEach(fe=>{j[fe]=F[fe]});const D=M.toFiniteNumber(F.headers.get("content-length")),[re,ue]=V&&Cg(D,Na(Ng(V),!0))||[];F=new i(Pg(F.body,Rg,re,()=>{ue&&ue(),xe&&xe()}),j)}$=$||"text";let K=await v[M.findKey(v,$)||"text"](F,b);return!J&&xe&&xe(),await new Promise((j,D)=>{i0(j,D,{data:K,headers:kt.from(F.headers),status:F.status,statusText:F.statusText,config:b,request:je})})}catch(be){throw xe&&xe(),be&&be.name==="TypeError"&&/Load failed|fetch/i.test(be.message)?Object.assign(new ye("Network Error",ye.ERR_NETWORK,b,je),{cause:be.cause||be}):ye.from(be,be&&be.code,b,je)}}},hT=new Map,l0=t=>{let e=t&&t.env||{};const{fetch:n,Request:i,Response:o}=e,l=[i,o,n];let u=l.length,d=u,h,m,y=hT;for(;d--;)h=l[d],m=y.get(h),m===void 0&&y.set(h,m=d?new Map:dT(e)),y=m;return m};l0();const zd={http:NE,xhr:iT,fetch:{get:l0}};M.forEach(zd,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Lg=t=>`- ${t}`,fT=t=>M.isFunction(t)||t===null||t===!1;function pT(t,e){t=M.isArray(t)?t:[t];const{length:n}=t;let i,o;const l={};for(let u=0;u<n;u++){i=t[u];let d;if(o=i,!fT(i)&&(o=zd[(d=String(i)).toLowerCase()],o===void 0))throw new ye(`Unknown adapter '${d}'`);if(o&&(M.isFunction(o)||(o=o.get(e))))break;l[d||"#"+u]=o}if(!o){const u=Object.entries(l).map(([h,m])=>`adapter ${h} `+(m===!1?"is not supported by the environment":"is not available in the build"));let d=n?u.length>1?`since :
19
19
  `+u.map(Lg).join(`
20
- `):" "+Lg(u[0]):"as no adapter specified";throw new ye("There is no suitable adapter to dispatch the request "+d,"ERR_NOT_SUPPORT")}return o}const u0={getAdapter:pT,adapters:zd};function uc(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new _s(null,t)}function Mg(t){return uc(t),t.headers=kt.from(t.headers),t.data=lc.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),u0.getAdapter(t.adapter||Wi.adapter,t)(t).then(function(i){return uc(t),i.data=lc.call(t,t.transformResponse,i),i.headers=kt.from(i.headers),i},function(i){return s0(i)||(uc(t),i&&i.response&&(i.response.data=lc.call(t,t.transformResponse,i.response),i.response.headers=kt.from(i.response.headers))),Promise.reject(i)})}const c0="1.13.2",qa={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{qa[t]=function(i){return typeof i===t||"a"+(e<1?"n ":" ")+t}});const Ug={};qa.transitional=function(e,n,i){function o(l,u){return"[Axios v"+c0+"] Transitional option '"+l+"'"+u+(i?". "+i:"")}return(l,u,d)=>{if(e===!1)throw new ye(o(u," has been removed"+(n?" in "+n:"")),ye.ERR_DEPRECATED);return n&&!Ug[u]&&(Ug[u]=!0,console.warn(o(u," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(l,u,d):!0}};qa.spelling=function(e){return(n,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};function mT(t,e,n){if(typeof t!="object")throw new ye("options must be an object",ye.ERR_BAD_OPTION_VALUE);const i=Object.keys(t);let o=i.length;for(;o-- >0;){const l=i[o],u=e[l];if(u){const d=t[l],h=d===void 0||u(d,l,t);if(h!==!0)throw new ye("option "+l+" must be "+h,ye.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ye("Unknown option "+l,ye.ERR_BAD_OPTION)}}const xa={assertOptions:mT,validators:qa},an=xa.validators;let _r=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Tg,response:new Tg}}async request(e,n){try{return await this._request(e,n)}catch(i){if(i instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const l=o.stack?o.stack.replace(/^.+\n/,""):"";try{i.stack?l&&!String(i.stack).endsWith(l.replace(/^.+\n.+\n/,""))&&(i.stack+=`
21
- `+l):i.stack=l}catch{}}throw i}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=kr(this.defaults,n);const{transitional:i,paramsSerializer:o,headers:l}=n;i!==void 0&&xa.assertOptions(i,{silentJSONParsing:an.transitional(an.boolean),forcedJSONParsing:an.transitional(an.boolean),clarifyTimeoutError:an.transitional(an.boolean)},!1),o!=null&&(M.isFunction(o)?n.paramsSerializer={serialize:o}:xa.assertOptions(o,{encode:an.function,serialize:an.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),xa.assertOptions(n,{baseUrl:an.spelling("baseURL"),withXsrfToken:an.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let u=l&&M.merge(l.common,l[n.method]);l&&M.forEach(["delete","get","head","post","put","patch","common"],b=>{delete l[b]}),n.headers=kt.concat(u,l);const d=[];let h=!0;this.interceptors.request.forEach(function(k){typeof k.runWhen=="function"&&k.runWhen(n)===!1||(h=h&&k.synchronous,d.unshift(k.fulfilled,k.rejected))});const m=[];this.interceptors.response.forEach(function(k){m.push(k.fulfilled,k.rejected)});let y,v=0,w;if(!h){const b=[Mg.bind(this),void 0];for(b.unshift(...d),b.push(...m),w=b.length,y=Promise.resolve(n);v<w;)y=y.then(b[v++],b[v++]);return y}w=d.length;let _=n;for(;v<w;){const b=d[v++],k=d[v++];try{_=b(_)}catch(S){k.call(this,S);break}}try{y=Mg.call(this,_)}catch(b){return Promise.reject(b)}for(v=0,w=m.length;v<w;)y=y.then(m[v++],m[v++]);return y}getUri(e){e=kr(this.defaults,e);const n=o0(e.baseURL,e.url,e.allowAbsoluteUrls);return t0(n,e.params,e.paramsSerializer)}};M.forEach(["delete","get","head","options"],function(e){_r.prototype[e]=function(n,i){return this.request(kr(i||{},{method:e,url:n,data:(i||{}).data}))}});M.forEach(["post","put","patch"],function(e){function n(i){return function(l,u,d){return this.request(kr(d||{},{method:e,headers:i?{"Content-Type":"multipart/form-data"}:{},url:l,data:u}))}}_r.prototype[e]=n(),_r.prototype[e+"Form"]=n(!0)});let gT=class d0{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(l){n=l});const i=this;this.promise.then(o=>{if(!i._listeners)return;let l=i._listeners.length;for(;l-- >0;)i._listeners[l](o);i._listeners=null}),this.promise.then=o=>{let l;const u=new Promise(d=>{i.subscribe(d),l=d}).then(o);return u.cancel=function(){i.unsubscribe(l)},u},e(function(l,u,d){i.reason||(i.reason=new _s(l,u,d),n(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=i=>{e.abort(i)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new d0(function(o){e=o}),cancel:e}}};function yT(t){return function(n){return t.apply(null,n)}}function vT(t){return M.isObject(t)&&t.isAxiosError===!0}const zc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(zc).forEach(([t,e])=>{zc[e]=t});function h0(t){const e=new _r(t),n=zv(_r.prototype.request,e);return M.extend(n,_r.prototype,e,{allOwnKeys:!0}),M.extend(n,e,null,{allOwnKeys:!0}),n.create=function(o){return h0(kr(t,o))},n}const Re=h0(Wi);Re.Axios=_r;Re.CanceledError=_s;Re.CancelToken=gT;Re.isCancel=s0;Re.VERSION=c0;Re.toFormData=za;Re.AxiosError=ye;Re.Cancel=Re.CanceledError;Re.all=function(e){return Promise.all(e)};Re.spread=yT;Re.isAxiosError=vT;Re.mergeConfig=kr;Re.AxiosHeaders=kt;Re.formToJSON=t=>r0(M.isHTMLForm(t)?new FormData(t):t);Re.getAdapter=u0.getAdapter;Re.HttpStatusCode=zc;Re.default=Re;const{Axios:UC,AxiosError:$C,CanceledError:VC,isCancel:FC,CancelToken:BC,VERSION:zC,all:qC,Cancel:WC,isAxiosError:HC,spread:KC,toFormData:GC,AxiosHeaders:JC,HttpStatusCode:YC,formToJSON:QC,getAdapter:XC,mergeConfig:ZC}=Re;function Wa(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(t);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(t,i[o])&&(n[i[o]]=t[i[o]]);return n}function wT(t,e,n,i){function o(l){return l instanceof n?l:new n(function(u){u(l)})}return new(n||(n=Promise))(function(l,u){function d(y){try{m(i.next(y))}catch(v){u(v)}}function h(y){try{m(i.throw(y))}catch(v){u(v)}}function m(y){y.done?l(y.value):o(y.value).then(d,h)}m((i=i.apply(t,e||[])).next())})}const xT=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class qd extends Error{constructor(e,n="FunctionsError",i){super(e),this.name=n,this.context=i}}class bT extends qd{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class $g extends qd{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Vg extends qd{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var qc;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(qc||(qc={}));class _T{constructor(e,{headers:n={},customFetch:i,region:o=qc.Any}={}){this.url=e,this.headers=n,this.region=o,this.fetch=xT(i)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return wT(this,arguments,void 0,function*(n,i={}){var o;let l,u;try{const{headers:d,method:h,body:m,signal:y,timeout:v}=i;let w={},{region:_}=i;_||(_=this.region);const b=new URL(`${this.url}/${n}`);_&&_!=="any"&&(w["x-region"]=_,b.searchParams.set("forceFunctionRegion",_));let k;m&&(d&&!Object.prototype.hasOwnProperty.call(d,"Content-Type")||!d)?typeof Blob<"u"&&m instanceof Blob||m instanceof ArrayBuffer?(w["Content-Type"]="application/octet-stream",k=m):typeof m=="string"?(w["Content-Type"]="text/plain",k=m):typeof FormData<"u"&&m instanceof FormData?k=m:(w["Content-Type"]="application/json",k=JSON.stringify(m)):m&&typeof m!="string"&&!(typeof Blob<"u"&&m instanceof Blob)&&!(m instanceof ArrayBuffer)&&!(typeof FormData<"u"&&m instanceof FormData)?k=JSON.stringify(m):k=m;let S=y;v&&(u=new AbortController,l=setTimeout(()=>u.abort(),v),y?(S=u.signal,y.addEventListener("abort",()=>u.abort())):S=u.signal);const E=yield this.fetch(b.toString(),{method:h||"POST",headers:Object.assign(Object.assign(Object.assign({},w),this.headers),d),body:k,signal:S}).catch(V=>{throw new bT(V)}),A=E.headers.get("x-relay-error");if(A&&A==="true")throw new $g(E);if(!E.ok)throw new Vg(E);let P=((o=E.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),U;return P==="application/json"?U=yield E.json():P==="application/octet-stream"||P==="application/pdf"?U=yield E.blob():P==="text/event-stream"?U=E:P==="multipart/form-data"?U=yield E.formData():U=yield E.text(),{data:U,error:null,response:E}}catch(d){return{data:null,error:d,response:d instanceof Vg||d instanceof $g?d.context:void 0}}finally{l&&clearTimeout(l)}})}}var ST=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}},kT=class{constructor(t){var e,n;this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(n=t.isMaybeSingle)!==null&&n!==void 0?n:!1,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}then(t,e){var n=this;this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const i=this.fetch;let o=i(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async l=>{let u=null,d=null,h=null,m=l.status,y=l.statusText;if(l.ok){var v,w;if(n.method!=="HEAD"){var _;const E=await l.text();E===""||(n.headers.get("Accept")==="text/csv"||n.headers.get("Accept")&&(!((_=n.headers.get("Accept"))===null||_===void 0)&&_.includes("application/vnd.pgrst.plan+text"))?d=E:d=JSON.parse(E))}const k=(v=n.headers.get("Prefer"))===null||v===void 0?void 0:v.match(/count=(exact|planned|estimated)/),S=(w=l.headers.get("content-range"))===null||w===void 0?void 0:w.split("/");k&&S&&S.length>1&&(h=parseInt(S[1])),n.isMaybeSingle&&n.method==="GET"&&Array.isArray(d)&&(d.length>1?(u={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,h=null,m=406,y="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{var b;const k=await l.text();try{u=JSON.parse(k),Array.isArray(u)&&l.status===404&&(d=[],u=null,m=200,y="OK")}catch{l.status===404&&k===""?(m=204,y="No Content"):u={message:k}}if(u&&n.isMaybeSingle&&(!(u==null||(b=u.details)===null||b===void 0)&&b.includes("0 rows"))&&(u=null,m=200,y="OK"),u&&n.shouldThrowOnError)throw new ST(u)}return{error:u,data:d,count:h,status:m,statusText:y}});return this.shouldThrowOnError||(o=o.catch(l=>{var u;let d="";const h=l?.cause;if(h){var m,y,v,w;const b=(m=h?.message)!==null&&m!==void 0?m:"",k=(y=h?.code)!==null&&y!==void 0?y:"";d=`${(v=l?.name)!==null&&v!==void 0?v:"FetchError"}: ${l?.message}`,d+=`
20
+ `):" "+Lg(u[0]):"as no adapter specified";throw new ye("There is no suitable adapter to dispatch the request "+d,"ERR_NOT_SUPPORT")}return o}const u0={getAdapter:pT,adapters:zd};function cc(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new _s(null,t)}function Mg(t){return cc(t),t.headers=kt.from(t.headers),t.data=uc.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),u0.getAdapter(t.adapter||Wi.adapter,t)(t).then(function(i){return cc(t),i.data=uc.call(t,t.transformResponse,i),i.headers=kt.from(i.headers),i},function(i){return s0(i)||(cc(t),i&&i.response&&(i.response.data=uc.call(t,t.transformResponse,i.response),i.response.headers=kt.from(i.response.headers))),Promise.reject(i)})}const c0="1.13.2",Wa={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Wa[t]=function(i){return typeof i===t||"a"+(e<1?"n ":" ")+t}});const Ug={};Wa.transitional=function(e,n,i){function o(l,u){return"[Axios v"+c0+"] Transitional option '"+l+"'"+u+(i?". "+i:"")}return(l,u,d)=>{if(e===!1)throw new ye(o(u," has been removed"+(n?" in "+n:"")),ye.ERR_DEPRECATED);return n&&!Ug[u]&&(Ug[u]=!0,console.warn(o(u," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(l,u,d):!0}};Wa.spelling=function(e){return(n,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};function mT(t,e,n){if(typeof t!="object")throw new ye("options must be an object",ye.ERR_BAD_OPTION_VALUE);const i=Object.keys(t);let o=i.length;for(;o-- >0;){const l=i[o],u=e[l];if(u){const d=t[l],h=d===void 0||u(d,l,t);if(h!==!0)throw new ye("option "+l+" must be "+h,ye.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ye("Unknown option "+l,ye.ERR_BAD_OPTION)}}const xa={assertOptions:mT,validators:Wa},an=xa.validators;let _r=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Tg,response:new Tg}}async request(e,n){try{return await this._request(e,n)}catch(i){if(i instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const l=o.stack?o.stack.replace(/^.+\n/,""):"";try{i.stack?l&&!String(i.stack).endsWith(l.replace(/^.+\n.+\n/,""))&&(i.stack+=`
21
+ `+l):i.stack=l}catch{}}throw i}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Er(this.defaults,n);const{transitional:i,paramsSerializer:o,headers:l}=n;i!==void 0&&xa.assertOptions(i,{silentJSONParsing:an.transitional(an.boolean),forcedJSONParsing:an.transitional(an.boolean),clarifyTimeoutError:an.transitional(an.boolean)},!1),o!=null&&(M.isFunction(o)?n.paramsSerializer={serialize:o}:xa.assertOptions(o,{encode:an.function,serialize:an.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),xa.assertOptions(n,{baseUrl:an.spelling("baseURL"),withXsrfToken:an.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let u=l&&M.merge(l.common,l[n.method]);l&&M.forEach(["delete","get","head","post","put","patch","common"],b=>{delete l[b]}),n.headers=kt.concat(u,l);const d=[];let h=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(n)===!1||(h=h&&S.synchronous,d.unshift(S.fulfilled,S.rejected))});const m=[];this.interceptors.response.forEach(function(S){m.push(S.fulfilled,S.rejected)});let y,v=0,w;if(!h){const b=[Mg.bind(this),void 0];for(b.unshift(...d),b.push(...m),w=b.length,y=Promise.resolve(n);v<w;)y=y.then(b[v++],b[v++]);return y}w=d.length;let _=n;for(;v<w;){const b=d[v++],S=d[v++];try{_=b(_)}catch(k){S.call(this,k);break}}try{y=Mg.call(this,_)}catch(b){return Promise.reject(b)}for(v=0,w=m.length;v<w;)y=y.then(m[v++],m[v++]);return y}getUri(e){e=Er(this.defaults,e);const n=o0(e.baseURL,e.url,e.allowAbsoluteUrls);return t0(n,e.params,e.paramsSerializer)}};M.forEach(["delete","get","head","options"],function(e){_r.prototype[e]=function(n,i){return this.request(Er(i||{},{method:e,url:n,data:(i||{}).data}))}});M.forEach(["post","put","patch"],function(e){function n(i){return function(l,u,d){return this.request(Er(d||{},{method:e,headers:i?{"Content-Type":"multipart/form-data"}:{},url:l,data:u}))}}_r.prototype[e]=n(),_r.prototype[e+"Form"]=n(!0)});let gT=class d0{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(l){n=l});const i=this;this.promise.then(o=>{if(!i._listeners)return;let l=i._listeners.length;for(;l-- >0;)i._listeners[l](o);i._listeners=null}),this.promise.then=o=>{let l;const u=new Promise(d=>{i.subscribe(d),l=d}).then(o);return u.cancel=function(){i.unsubscribe(l)},u},e(function(l,u,d){i.reason||(i.reason=new _s(l,u,d),n(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=i=>{e.abort(i)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new d0(function(o){e=o}),cancel:e}}};function yT(t){return function(n){return t.apply(null,n)}}function vT(t){return M.isObject(t)&&t.isAxiosError===!0}const qc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(qc).forEach(([t,e])=>{qc[e]=t});function h0(t){const e=new _r(t),n=zv(_r.prototype.request,e);return M.extend(n,_r.prototype,e,{allOwnKeys:!0}),M.extend(n,e,null,{allOwnKeys:!0}),n.create=function(o){return h0(Er(t,o))},n}const Re=h0(Wi);Re.Axios=_r;Re.CanceledError=_s;Re.CancelToken=gT;Re.isCancel=s0;Re.VERSION=c0;Re.toFormData=qa;Re.AxiosError=ye;Re.Cancel=Re.CanceledError;Re.all=function(e){return Promise.all(e)};Re.spread=yT;Re.isAxiosError=vT;Re.mergeConfig=Er;Re.AxiosHeaders=kt;Re.formToJSON=t=>r0(M.isHTMLForm(t)?new FormData(t):t);Re.getAdapter=u0.getAdapter;Re.HttpStatusCode=qc;Re.default=Re;const{Axios:UC,AxiosError:$C,CanceledError:VC,isCancel:FC,CancelToken:BC,VERSION:zC,all:qC,Cancel:WC,isAxiosError:HC,spread:KC,toFormData:GC,AxiosHeaders:JC,HttpStatusCode:YC,formToJSON:QC,getAdapter:XC,mergeConfig:ZC}=Re;function Ha(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(t);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(t,i[o])&&(n[i[o]]=t[i[o]]);return n}function wT(t,e,n,i){function o(l){return l instanceof n?l:new n(function(u){u(l)})}return new(n||(n=Promise))(function(l,u){function d(y){try{m(i.next(y))}catch(v){u(v)}}function h(y){try{m(i.throw(y))}catch(v){u(v)}}function m(y){y.done?l(y.value):o(y.value).then(d,h)}m((i=i.apply(t,e||[])).next())})}const xT=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class qd extends Error{constructor(e,n="FunctionsError",i){super(e),this.name=n,this.context=i}}class bT extends qd{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class $g extends qd{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Vg extends qd{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Wc;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Wc||(Wc={}));class _T{constructor(e,{headers:n={},customFetch:i,region:o=Wc.Any}={}){this.url=e,this.headers=n,this.region=o,this.fetch=xT(i)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return wT(this,arguments,void 0,function*(n,i={}){var o;let l,u;try{const{headers:d,method:h,body:m,signal:y,timeout:v}=i;let w={},{region:_}=i;_||(_=this.region);const b=new URL(`${this.url}/${n}`);_&&_!=="any"&&(w["x-region"]=_,b.searchParams.set("forceFunctionRegion",_));let S;m&&(d&&!Object.prototype.hasOwnProperty.call(d,"Content-Type")||!d)?typeof Blob<"u"&&m instanceof Blob||m instanceof ArrayBuffer?(w["Content-Type"]="application/octet-stream",S=m):typeof m=="string"?(w["Content-Type"]="text/plain",S=m):typeof FormData<"u"&&m instanceof FormData?S=m:(w["Content-Type"]="application/json",S=JSON.stringify(m)):m&&typeof m!="string"&&!(typeof Blob<"u"&&m instanceof Blob)&&!(m instanceof ArrayBuffer)&&!(typeof FormData<"u"&&m instanceof FormData)?S=JSON.stringify(m):S=m;let k=y;v&&(u=new AbortController,l=setTimeout(()=>u.abort(),v),y?(k=u.signal,y.addEventListener("abort",()=>u.abort())):k=u.signal);const E=yield this.fetch(b.toString(),{method:h||"POST",headers:Object.assign(Object.assign(Object.assign({},w),this.headers),d),body:S,signal:k}).catch(V=>{throw new bT(V)}),P=E.headers.get("x-relay-error");if(P&&P==="true")throw new $g(E);if(!E.ok)throw new Vg(E);let N=((o=E.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),U;return N==="application/json"?U=yield E.json():N==="application/octet-stream"||N==="application/pdf"?U=yield E.blob():N==="text/event-stream"?U=E:N==="multipart/form-data"?U=yield E.formData():U=yield E.text(),{data:U,error:null,response:E}}catch(d){return{data:null,error:d,response:d instanceof Vg||d instanceof $g?d.context:void 0}}finally{l&&clearTimeout(l)}})}}var ST=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}},kT=class{constructor(t){var e,n;this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(n=t.isMaybeSingle)!==null&&n!==void 0?n:!1,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}then(t,e){var n=this;this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const i=this.fetch;let o=i(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async l=>{let u=null,d=null,h=null,m=l.status,y=l.statusText;if(l.ok){var v,w;if(n.method!=="HEAD"){var _;const E=await l.text();E===""||(n.headers.get("Accept")==="text/csv"||n.headers.get("Accept")&&(!((_=n.headers.get("Accept"))===null||_===void 0)&&_.includes("application/vnd.pgrst.plan+text"))?d=E:d=JSON.parse(E))}const S=(v=n.headers.get("Prefer"))===null||v===void 0?void 0:v.match(/count=(exact|planned|estimated)/),k=(w=l.headers.get("content-range"))===null||w===void 0?void 0:w.split("/");S&&k&&k.length>1&&(h=parseInt(k[1])),n.isMaybeSingle&&n.method==="GET"&&Array.isArray(d)&&(d.length>1?(u={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,h=null,m=406,y="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{var b;const S=await l.text();try{u=JSON.parse(S),Array.isArray(u)&&l.status===404&&(d=[],u=null,m=200,y="OK")}catch{l.status===404&&S===""?(m=204,y="No Content"):u={message:S}}if(u&&n.isMaybeSingle&&(!(u==null||(b=u.details)===null||b===void 0)&&b.includes("0 rows"))&&(u=null,m=200,y="OK"),u&&n.shouldThrowOnError)throw new ST(u)}return{error:u,data:d,count:h,status:m,statusText:y}});return this.shouldThrowOnError||(o=o.catch(l=>{var u;let d="";const h=l?.cause;if(h){var m,y,v,w;const b=(m=h?.message)!==null&&m!==void 0?m:"",S=(y=h?.code)!==null&&y!==void 0?y:"";d=`${(v=l?.name)!==null&&v!==void 0?v:"FetchError"}: ${l?.message}`,d+=`
22
22
 
23
- Caused by: ${(w=h?.name)!==null&&w!==void 0?w:"Error"}: ${b}`,k&&(d+=` (${k})`),h?.stack&&(d+=`
24
- ${h.stack}`)}else{var _;d=(_=l?.stack)!==null&&_!==void 0?_:""}return{error:{message:`${(u=l?.name)!==null&&u!==void 0?u:"FetchError"}: ${l?.message}`,details:d,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),o.then(t,e)}returns(){return this}overrideTypes(){return this}},ET=class extends kT{select(t){let e=!1;const n=(t??"*").split("").map(i=>/\s/.test(i)&&!e?"":(i==='"'&&(e=!e),i)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:n,foreignTable:i,referencedTable:o=i}={}){const l=o?`${o}.order`:"order",u=this.url.searchParams.get(l);return this.url.searchParams.set(l,`${u?`${u},`:""}${t}.${e?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:n=e}={}){const i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${t}`),this}range(t,e,{foreignTable:n,referencedTable:i=n}={}){const o=typeof i>"u"?"offset":`${i}.offset`,l=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(o,`${t}`),this.url.searchParams.set(l,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:n=!1,buffers:i=!1,wal:o=!1,format:l="text"}={}){var u;const d=[t?"analyze":null,e?"verbose":null,n?"settings":null,i?"buffers":null,o?"wal":null].filter(Boolean).join("|"),h=(u=this.headers.get("Accept"))!==null&&u!==void 0?u:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${l}; for="${h}"; options=${d};`),l==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const Fg=new RegExp("[,()]");var rs=class extends ET{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const n=Array.from(new Set(e)).map(i=>typeof i=="string"&&Fg.test(i)?`"${i}"`:`${i}`).join(",");return this.url.searchParams.append(t,`in.(${n})`),this}notIn(t,e){const n=Array.from(new Set(e)).map(i=>typeof i=="string"&&Fg.test(i)?`"${i}"`:`${i}`).join(",");return this.url.searchParams.append(t,`not.in.(${n})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:n,type:i}={}){let o="";i==="plain"?o="pl":i==="phrase"?o="ph":i==="websearch"&&(o="w");const l=n===void 0?"":`(${n})`;return this.url.searchParams.append(t,`${o}fts${l}.${e}`),this}match(t){return Object.entries(t).forEach(([e,n])=>{this.url.searchParams.append(e,`eq.${n}`)}),this}not(t,e,n){return this.url.searchParams.append(t,`not.${e}.${n}`),this}or(t,{foreignTable:e,referencedTable:n=e}={}){const i=n?`${n}.or`:"or";return this.url.searchParams.append(i,`(${t})`),this}filter(t,e,n){return this.url.searchParams.append(t,`${e}.${n}`),this}},TT=class{constructor(t,{headers:e={},schema:n,fetch:i}){this.url=t,this.headers=new Headers(e),this.schema=n,this.fetch=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:n=!1,count:i}=e??{},o=n?"HEAD":"GET";let l=!1;const u=(t??"*").split("").map(m=>/\s/.test(m)&&!l?"":(m==='"'&&(l=!l),m)).join(""),{url:d,headers:h}=this.cloneRequestState();return d.searchParams.set("select",u),i&&h.append("Prefer",`count=${i}`),new rs({method:o,url:d,headers:h,schema:this.schema,fetch:this.fetch})}insert(t,{count:e,defaultToNull:n=!0}={}){var i;const o="POST",{url:l,headers:u}=this.cloneRequestState();if(e&&u.append("Prefer",`count=${e}`),n||u.append("Prefer","missing=default"),Array.isArray(t)){const d=t.reduce((h,m)=>h.concat(Object.keys(m)),[]);if(d.length>0){const h=[...new Set(d)].map(m=>`"${m}"`);l.searchParams.set("columns",h.join(","))}}return new rs({method:o,url:l,headers:u,schema:this.schema,body:t,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}upsert(t,{onConflict:e,ignoreDuplicates:n=!1,count:i,defaultToNull:o=!0}={}){var l;const u="POST",{url:d,headers:h}=this.cloneRequestState();if(h.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),e!==void 0&&d.searchParams.set("on_conflict",e),i&&h.append("Prefer",`count=${i}`),o||h.append("Prefer","missing=default"),Array.isArray(t)){const m=t.reduce((y,v)=>y.concat(Object.keys(v)),[]);if(m.length>0){const y=[...new Set(m)].map(v=>`"${v}"`);d.searchParams.set("columns",y.join(","))}}return new rs({method:u,url:d,headers:h,schema:this.schema,body:t,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}update(t,{count:e}={}){var n;const i="PATCH",{url:o,headers:l}=this.cloneRequestState();return e&&l.append("Prefer",`count=${e}`),new rs({method:i,url:o,headers:l,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}delete({count:t}={}){var e;const n="DELETE",{url:i,headers:o}=this.cloneRequestState();return t&&o.append("Prefer",`count=${t}`),new rs({method:n,url:i,headers:o,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}},jT=class f0{constructor(e,{headers:n={},schema:i,fetch:o}={}){this.url=e,this.headers=new Headers(n),this.schemaName=i,this.fetch=o}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new TT(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new f0(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,n={},{head:i=!1,get:o=!1,count:l}={}){var u;let d;const h=new URL(`${this.url}/rpc/${e}`);let m;const y=_=>_!==null&&typeof _=="object"&&(!Array.isArray(_)||_.some(y)),v=i&&Object.values(n).some(y);v?(d="POST",m=n):i||o?(d=i?"HEAD":"GET",Object.entries(n).filter(([_,b])=>b!==void 0).map(([_,b])=>[_,Array.isArray(b)?`{${b.join(",")}}`:`${b}`]).forEach(([_,b])=>{h.searchParams.append(_,b)})):(d="POST",m=n);const w=new Headers(this.headers);return v?w.set("Prefer",l?`count=${l},return=minimal`:"return=minimal"):l&&w.set("Prefer",`count=${l}`),new rs({method:d,url:h,headers:w,schema:this.schemaName,body:m,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch})}};class CT{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const n=globalThis.process;if(n){const i=n.versions;if(i&&i.node){const o=i.node,l=parseInt(o.replace(/^v/,"").split(".")[0]);return l>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${l} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${l} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
23
+ Caused by: ${(w=h?.name)!==null&&w!==void 0?w:"Error"}: ${b}`,S&&(d+=` (${S})`),h?.stack&&(d+=`
24
+ ${h.stack}`)}else{var _;d=(_=l?.stack)!==null&&_!==void 0?_:""}return{error:{message:`${(u=l?.name)!==null&&u!==void 0?u:"FetchError"}: ${l?.message}`,details:d,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),o.then(t,e)}returns(){return this}overrideTypes(){return this}},ET=class extends kT{select(t){let e=!1;const n=(t??"*").split("").map(i=>/\s/.test(i)&&!e?"":(i==='"'&&(e=!e),i)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:n,foreignTable:i,referencedTable:o=i}={}){const l=o?`${o}.order`:"order",u=this.url.searchParams.get(l);return this.url.searchParams.set(l,`${u?`${u},`:""}${t}.${e?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:n=e}={}){const i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${t}`),this}range(t,e,{foreignTable:n,referencedTable:i=n}={}){const o=typeof i>"u"?"offset":`${i}.offset`,l=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(o,`${t}`),this.url.searchParams.set(l,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:n=!1,buffers:i=!1,wal:o=!1,format:l="text"}={}){var u;const d=[t?"analyze":null,e?"verbose":null,n?"settings":null,i?"buffers":null,o?"wal":null].filter(Boolean).join("|"),h=(u=this.headers.get("Accept"))!==null&&u!==void 0?u:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${l}; for="${h}"; options=${d};`),l==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const Fg=new RegExp("[,()]");var ss=class extends ET{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const n=Array.from(new Set(e)).map(i=>typeof i=="string"&&Fg.test(i)?`"${i}"`:`${i}`).join(",");return this.url.searchParams.append(t,`in.(${n})`),this}notIn(t,e){const n=Array.from(new Set(e)).map(i=>typeof i=="string"&&Fg.test(i)?`"${i}"`:`${i}`).join(",");return this.url.searchParams.append(t,`not.in.(${n})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:n,type:i}={}){let o="";i==="plain"?o="pl":i==="phrase"?o="ph":i==="websearch"&&(o="w");const l=n===void 0?"":`(${n})`;return this.url.searchParams.append(t,`${o}fts${l}.${e}`),this}match(t){return Object.entries(t).forEach(([e,n])=>{this.url.searchParams.append(e,`eq.${n}`)}),this}not(t,e,n){return this.url.searchParams.append(t,`not.${e}.${n}`),this}or(t,{foreignTable:e,referencedTable:n=e}={}){const i=n?`${n}.or`:"or";return this.url.searchParams.append(i,`(${t})`),this}filter(t,e,n){return this.url.searchParams.append(t,`${e}.${n}`),this}},TT=class{constructor(t,{headers:e={},schema:n,fetch:i}){this.url=t,this.headers=new Headers(e),this.schema=n,this.fetch=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:n=!1,count:i}=e??{},o=n?"HEAD":"GET";let l=!1;const u=(t??"*").split("").map(m=>/\s/.test(m)&&!l?"":(m==='"'&&(l=!l),m)).join(""),{url:d,headers:h}=this.cloneRequestState();return d.searchParams.set("select",u),i&&h.append("Prefer",`count=${i}`),new ss({method:o,url:d,headers:h,schema:this.schema,fetch:this.fetch})}insert(t,{count:e,defaultToNull:n=!0}={}){var i;const o="POST",{url:l,headers:u}=this.cloneRequestState();if(e&&u.append("Prefer",`count=${e}`),n||u.append("Prefer","missing=default"),Array.isArray(t)){const d=t.reduce((h,m)=>h.concat(Object.keys(m)),[]);if(d.length>0){const h=[...new Set(d)].map(m=>`"${m}"`);l.searchParams.set("columns",h.join(","))}}return new ss({method:o,url:l,headers:u,schema:this.schema,body:t,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}upsert(t,{onConflict:e,ignoreDuplicates:n=!1,count:i,defaultToNull:o=!0}={}){var l;const u="POST",{url:d,headers:h}=this.cloneRequestState();if(h.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),e!==void 0&&d.searchParams.set("on_conflict",e),i&&h.append("Prefer",`count=${i}`),o||h.append("Prefer","missing=default"),Array.isArray(t)){const m=t.reduce((y,v)=>y.concat(Object.keys(v)),[]);if(m.length>0){const y=[...new Set(m)].map(v=>`"${v}"`);d.searchParams.set("columns",y.join(","))}}return new ss({method:u,url:d,headers:h,schema:this.schema,body:t,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}update(t,{count:e}={}){var n;const i="PATCH",{url:o,headers:l}=this.cloneRequestState();return e&&l.append("Prefer",`count=${e}`),new ss({method:i,url:o,headers:l,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}delete({count:t}={}){var e;const n="DELETE",{url:i,headers:o}=this.cloneRequestState();return t&&o.append("Prefer",`count=${t}`),new ss({method:n,url:i,headers:o,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}},jT=class f0{constructor(e,{headers:n={},schema:i,fetch:o}={}){this.url=e,this.headers=new Headers(n),this.schemaName=i,this.fetch=o}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new TT(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new f0(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,n={},{head:i=!1,get:o=!1,count:l}={}){var u;let d;const h=new URL(`${this.url}/rpc/${e}`);let m;const y=_=>_!==null&&typeof _=="object"&&(!Array.isArray(_)||_.some(y)),v=i&&Object.values(n).some(y);v?(d="POST",m=n):i||o?(d=i?"HEAD":"GET",Object.entries(n).filter(([_,b])=>b!==void 0).map(([_,b])=>[_,Array.isArray(b)?`{${b.join(",")}}`:`${b}`]).forEach(([_,b])=>{h.searchParams.append(_,b)})):(d="POST",m=n);const w=new Headers(this.headers);return v?w.set("Prefer",l?`count=${l},return=minimal`:"return=minimal"):l&&w.set("Prefer",`count=${l}`),new ss({method:d,url:h,headers:w,schema:this.schemaName,body:m,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch})}};class CT{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const n=globalThis.process;if(n){const i=n.versions;if(i&&i.node){const o=i.node,l=parseInt(o.replace(/^v/,"").split(".")[0]);return l>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${l} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${l} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
25
25
  import ws from "ws"
26
26
  new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let n=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(n+=`
27
27
 
28
- Suggested solution: ${e.workaround}`),new Error(n)}static createWebSocket(e,n){const i=this.getWebSocketConstructor();return new i(e,n)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const NT="2.91.0",AT=`realtime-js/${NT}`,PT="1.0.0",p0="2.0.0",Bg=p0,Wc=1e4,RT=1e3,OT=100;var Wn;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(Wn||(Wn={}));var Ze;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(Ze||(Ze={}));var Zt;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(Zt||(Zt={}));var Hc;(function(t){t.websocket="websocket"})(Hc||(Hc={}));var gr;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(gr||(gr={}));class IT{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,n){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(e));let i=[e.join_ref,e.ref,e.topic,e.event,e.payload];return n(JSON.stringify(i))}_binaryEncodeUserBroadcastPush(e){var n;return this._isArrayBuffer((n=e.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var n,i;const o=(i=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&i!==void 0?i:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,o)}_encodeJsonUserBroadcastPush(e){var n,i;const o=(i=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&i!==void 0?i:{},u=new TextEncoder().encode(JSON.stringify(o)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,u)}_encodeUserBroadcastPush(e,n,i){var o,l;const u=e.topic,d=(o=e.ref)!==null&&o!==void 0?o:"",h=(l=e.join_ref)!==null&&l!==void 0?l:"",m=e.payload.event,y=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},v=Object.keys(y).length===0?"":JSON.stringify(y);if(h.length>255)throw new Error(`joinRef length ${h.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`ref length ${d.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`topic length ${u.length} exceeds maximum of 255`);if(m.length>255)throw new Error(`userEvent length ${m.length} exceeds maximum of 255`);if(v.length>255)throw new Error(`metadata length ${v.length} exceeds maximum of 255`);const w=this.USER_BROADCAST_PUSH_META_LENGTH+h.length+d.length+u.length+m.length+v.length,_=new ArrayBuffer(this.HEADER_LENGTH+w);let b=new DataView(_),k=0;b.setUint8(k++,this.KINDS.userBroadcastPush),b.setUint8(k++,h.length),b.setUint8(k++,d.length),b.setUint8(k++,u.length),b.setUint8(k++,m.length),b.setUint8(k++,v.length),b.setUint8(k++,n),Array.from(h,E=>b.setUint8(k++,E.charCodeAt(0))),Array.from(d,E=>b.setUint8(k++,E.charCodeAt(0))),Array.from(u,E=>b.setUint8(k++,E.charCodeAt(0))),Array.from(m,E=>b.setUint8(k++,E.charCodeAt(0))),Array.from(v,E=>b.setUint8(k++,E.charCodeAt(0)));var S=new Uint8Array(_.byteLength+i.byteLength);return S.set(new Uint8Array(_),0),S.set(new Uint8Array(i),_.byteLength),S.buffer}decode(e,n){if(this._isArrayBuffer(e)){let i=this._binaryDecode(e);return n(i)}if(typeof e=="string"){const i=JSON.parse(e),[o,l,u,d,h]=i;return n({join_ref:o,ref:l,topic:u,event:d,payload:h})}return n({})}_binaryDecode(e){const n=new DataView(e),i=n.getUint8(0),o=new TextDecoder;if(i===this.KINDS.userBroadcast)return this._decodeUserBroadcast(e,n,o)}_decodeUserBroadcast(e,n,i){const o=n.getUint8(1),l=n.getUint8(2),u=n.getUint8(3),d=n.getUint8(4);let h=this.HEADER_LENGTH+4;const m=i.decode(e.slice(h,h+o));h=h+o;const y=i.decode(e.slice(h,h+l));h=h+l;const v=i.decode(e.slice(h,h+u));h=h+u;const w=e.slice(h,e.byteLength),_=d===this.JSON_ENCODING?JSON.parse(i.decode(w)):w,b={type:this.BROADCAST_EVENT,event:y,payload:_};return u>0&&(b.meta=JSON.parse(v)),{join_ref:null,ref:null,topic:m,event:this.BROADCAST_EVENT,payload:b}}_isArrayBuffer(e){var n;return e instanceof ArrayBuffer||((n=e?.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(e,n){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([i])=>n.includes(i)))}}class m0{constructor(e,n){this.callback=e,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var Pe;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(Pe||(Pe={}));const zg=(t,e,n={})=>{var i;const o=(i=n.skipTypes)!==null&&i!==void 0?i:[];return e?Object.keys(e).reduce((l,u)=>(l[u]=DT(u,t,e,o),l),{}):{}},DT=(t,e,n,i)=>{const o=e.find(d=>d.name===t),l=o?.type,u=n[t];return l&&!i.includes(l)?g0(l,u):Kc(u)},g0=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return $T(e,n)}switch(t){case Pe.bool:return LT(e);case Pe.float4:case Pe.float8:case Pe.int2:case Pe.int4:case Pe.int8:case Pe.numeric:case Pe.oid:return MT(e);case Pe.json:case Pe.jsonb:return UT(e);case Pe.timestamp:return VT(e);case Pe.abstime:case Pe.date:case Pe.daterange:case Pe.int4range:case Pe.int8range:case Pe.money:case Pe.reltime:case Pe.text:case Pe.time:case Pe.timestamptz:case Pe.timetz:case Pe.tsrange:case Pe.tstzrange:return Kc(e);default:return Kc(e)}},Kc=t=>t,LT=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},MT=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},UT=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},$T=(t,e)=>{if(typeof t!="string")return t;const n=t.length-1,i=t[n];if(t[0]==="{"&&i==="}"){let l;const u=t.slice(1,n);try{l=JSON.parse("["+u+"]")}catch{l=u?u.split(","):[]}return l.map(d=>g0(e,d))}return t},VT=t=>typeof t=="string"?t.replace(" ","T"):t,y0=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};class cc{constructor(e,n,i={},o=Wc){this.channel=e,this.event=n,this.payload=i,this.timeout=o,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,n){var i;return this._hasReceived(e)&&n((i=this.receivedResp)===null||i===void 0?void 0:i.response),this.recHooks.push({status:e,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:n}){this.recHooks.filter(i=>i.status===e).forEach(i=>i.callback(n))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var qg;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(qg||(qg={}));class xi{constructor(e,n){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const i=n?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(i.state,{},o=>{const{onJoin:l,onLeave:u,onSync:d}=this.caller;this.joinRef=this.channel._joinRef(),this.state=xi.syncState(this.state,o,l,u),this.pendingDiffs.forEach(h=>{this.state=xi.syncDiff(this.state,h,l,u)}),this.pendingDiffs=[],d()}),this.channel._on(i.diff,{},o=>{const{onJoin:l,onLeave:u,onSync:d}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(o):(this.state=xi.syncDiff(this.state,o,l,u),d())}),this.onJoin((o,l,u)=>{this.channel._trigger("presence",{event:"join",key:o,currentPresences:l,newPresences:u})}),this.onLeave((o,l,u)=>{this.channel._trigger("presence",{event:"leave",key:o,currentPresences:l,leftPresences:u})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,n,i,o){const l=this.cloneDeep(e),u=this.transformState(n),d={},h={};return this.map(l,(m,y)=>{u[m]||(h[m]=y)}),this.map(u,(m,y)=>{const v=l[m];if(v){const w=y.map(S=>S.presence_ref),_=v.map(S=>S.presence_ref),b=y.filter(S=>_.indexOf(S.presence_ref)<0),k=v.filter(S=>w.indexOf(S.presence_ref)<0);b.length>0&&(d[m]=b),k.length>0&&(h[m]=k)}else d[m]=y}),this.syncDiff(l,{joins:d,leaves:h},i,o)}static syncDiff(e,n,i,o){const{joins:l,leaves:u}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return i||(i=()=>{}),o||(o=()=>{}),this.map(l,(d,h)=>{var m;const y=(m=e[d])!==null&&m!==void 0?m:[];if(e[d]=this.cloneDeep(h),y.length>0){const v=e[d].map(_=>_.presence_ref),w=y.filter(_=>v.indexOf(_.presence_ref)<0);e[d].unshift(...w)}i(d,y,h)}),this.map(u,(d,h)=>{let m=e[d];if(!m)return;const y=h.map(v=>v.presence_ref);m=m.filter(v=>y.indexOf(v.presence_ref)<0),e[d]=m,o(d,m,h),m.length===0&&delete e[d]}),e}static map(e,n){return Object.getOwnPropertyNames(e).map(i=>n(i,e[i]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((n,i)=>{const o=e[i];return"metas"in o?n[i]=o.metas.map(l=>(l.presence_ref=l.phx_ref,delete l.phx_ref,delete l.phx_ref_prev,l)):n[i]=o,n},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Wg;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(Wg||(Wg={}));var bi;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(bi||(bi={}));var vn;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(vn||(vn={}));class ds{constructor(e,n={config:{}},i){var o,l;if(this.topic=e,this.params=n,this.socket=i,this.bindings={},this.state=Ze.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.timeout=this.socket.timeout,this.joinPush=new cc(this,Zt.join,this.params,this.timeout),this.rejoinTimer=new m0(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ze.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(u=>u.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Ze.closed,this.socket._remove(this)}),this._onError(u=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,u),this.state=Ze.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ze.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",u=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,u),this.state=Ze.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Zt.reply,{},(u,d)=>{this._trigger(this._replyEventName(d),u)}),this.presence=new xi(this),this.broadcastEndpointURL=y0(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((l=(o=this.params.config)===null||o===void 0?void 0:o.broadcast)===null||l===void 0)&&l.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,n=this.timeout){var i,o,l;if(this.socket.isConnected()||this.socket.connect(),this.state==Ze.closed){const{config:{broadcast:u,presence:d,private:h}}=this.params,m=(o=(i=this.bindings.postgres_changes)===null||i===void 0?void 0:i.map(_=>_.filter))!==null&&o!==void 0?o:[],y=!!this.bindings[bi.PRESENCE]&&this.bindings[bi.PRESENCE].length>0||((l=this.params.config.presence)===null||l===void 0?void 0:l.enabled)===!0,v={},w={broadcast:u,presence:Object.assign(Object.assign({},d),{enabled:y}),postgres_changes:m,private:h};this.socket.accessTokenValue&&(v.access_token=this.socket.accessTokenValue),this._onError(_=>e?.(vn.CHANNEL_ERROR,_)),this._onClose(()=>e?.(vn.CLOSED)),this.updateJoinPayload(Object.assign({config:w},v)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:_})=>{var b;if(this.socket._isManualToken()||this.socket.setAuth(),_===void 0){e?.(vn.SUBSCRIBED);return}else{const k=this.bindings.postgres_changes,S=(b=k?.length)!==null&&b!==void 0?b:0,E=[];for(let A=0;A<S;A++){const P=k[A],{filter:{event:U,schema:V,table:z,filter:$}}=P,B=_&&_[A];if(B&&B.event===U&&ds.isFilterValueEqual(B.schema,V)&&ds.isFilterValueEqual(B.table,z)&&ds.isFilterValueEqual(B.filter,$))E.push(Object.assign(Object.assign({},P),{id:B.id}));else{this.unsubscribe(),this.state=Ze.errored,e?.(vn.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=E,e&&e(vn.SUBSCRIBED);return}}).receive("error",_=>{this.state=Ze.errored,e?.(vn.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(_).join(", ")||"error")))}).receive("timeout",()=>{e?.(vn.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,n={}){return await this.send({type:"presence",event:"track",payload:e},n.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,n,i){return this.state===Ze.joined&&e===bi.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(e,n,i)}async httpSend(e,n,i={}){var o;if(n==null)return Promise.reject("Payload is required for httpSend()");const l={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(l.Authorization=`Bearer ${this.socket.accessTokenValue}`);const u={method:"POST",headers:l,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:n,private:this.private}]})},d=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(o=i.timeout)!==null&&o!==void 0?o:this.timeout);if(d.status===202)return{success:!0};let h=d.statusText;try{const m=await d.json();h=m.error||m.message||h}catch{}return Promise.reject(new Error(h))}async send(e,n={}){var i,o;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:l,payload:u}=e,d={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(d.Authorization=`Bearer ${this.socket.accessTokenValue}`);const h={method:"POST",headers:d,body:JSON.stringify({messages:[{topic:this.subTopic,event:l,payload:u,private:this.private}]})};try{const m=await this._fetchWithTimeout(this.broadcastEndpointURL,h,(i=n.timeout)!==null&&i!==void 0?i:this.timeout);return await((o=m.body)===null||o===void 0?void 0:o.cancel()),m.ok?"ok":"error"}catch(m){return m.name==="AbortError"?"timed out":"error"}}else return new Promise(l=>{var u,d,h;const m=this._push(e.type,e,n.timeout||this.timeout);e.type==="broadcast"&&!(!((h=(d=(u=this.params)===null||u===void 0?void 0:u.config)===null||d===void 0?void 0:d.broadcast)===null||h===void 0)&&h.ack)&&l("ok"),m.receive("ok",()=>l("ok")),m.receive("error",()=>l("error")),m.receive("timeout",()=>l("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Ze.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Zt.close,"leave",this._joinRef())};this.joinPush.destroy();let i=null;return new Promise(o=>{i=new cc(this,Zt.leave,{},e),i.receive("ok",()=>{n(),o("ok")}).receive("timeout",()=>{n(),o("timed out")}).receive("error",()=>{o("error")}),i.send(),this._canPush()||i.trigger("ok",{})}).finally(()=>{i?.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ze.closed,this.bindings={}}async _fetchWithTimeout(e,n,i){const o=new AbortController,l=setTimeout(()=>o.abort(),i),u=await this.socket.fetch(e,Object.assign(Object.assign({},n),{signal:o.signal}));return clearTimeout(l),u}_push(e,n,i=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let o=new cc(this,e,n,i);return this._canPush()?o.send():this._addToPushBuffer(o),o}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>OT){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(e,n,i){return n}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,n,i){var o,l;const u=e.toLocaleLowerCase(),{close:d,error:h,leave:m,join:y}=Zt;if(i&&[d,h,m,y].indexOf(u)>=0&&i!==this._joinRef())return;let w=this._onMessage(u,n,i);if(n&&!w)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(u)?(o=this.bindings.postgres_changes)===null||o===void 0||o.filter(_=>{var b,k,S;return((b=_.filter)===null||b===void 0?void 0:b.event)==="*"||((S=(k=_.filter)===null||k===void 0?void 0:k.event)===null||S===void 0?void 0:S.toLocaleLowerCase())===u}).map(_=>_.callback(w,i)):(l=this.bindings[u])===null||l===void 0||l.filter(_=>{var b,k,S,E,A,P,U,V;if(["broadcast","presence","postgres_changes"].includes(u))if("id"in _){const z=_.id,$=(b=_.filter)===null||b===void 0?void 0:b.event;return z&&((k=n.ids)===null||k===void 0?void 0:k.includes(z))&&($==="*"||$?.toLocaleLowerCase()===((S=n.data)===null||S===void 0?void 0:S.type.toLocaleLowerCase()))&&(!(!((E=_.filter)===null||E===void 0)&&E.table)||_.filter.table===((A=n.data)===null||A===void 0?void 0:A.table))}else{const z=(U=(P=_?.filter)===null||P===void 0?void 0:P.event)===null||U===void 0?void 0:U.toLocaleLowerCase();return z==="*"||z===((V=n?.event)===null||V===void 0?void 0:V.toLocaleLowerCase())}else return _.type.toLocaleLowerCase()===u}).map(_=>{if(typeof w=="object"&&"ids"in w){const b=w.data,{schema:k,table:S,commit_timestamp:E,type:A,errors:P}=b;w=Object.assign(Object.assign({},{schema:k,table:S,commit_timestamp:E,eventType:A,new:{},old:{},errors:P}),this._getPayloadRecords(b))}_.callback(w,i)})}_isClosed(){return this.state===Ze.closed}_isJoined(){return this.state===Ze.joined}_isJoining(){return this.state===Ze.joining}_isLeaving(){return this.state===Ze.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,n,i){const o=e.toLocaleLowerCase(),l={type:o,filter:n,callback:i};return this.bindings[o]?this.bindings[o].push(l):this.bindings[o]=[l],this}_off(e,n){const i=e.toLocaleLowerCase();return this.bindings[i]&&(this.bindings[i]=this.bindings[i].filter(o=>{var l;return!(((l=o.type)===null||l===void 0?void 0:l.toLocaleLowerCase())===i&&ds.isEqual(o.filter,n))})),this}static isEqual(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const i in e)if(e[i]!==n[i])return!1;return!0}static isFilterValueEqual(e,n){return(e??void 0)===(n??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Zt.close,{},e)}_onError(e){this._on(Zt.error,{},n=>e(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Ze.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=zg(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=zg(e.columns,e.old_record)),n}}const dc=()=>{},ca={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},FT=[1e3,2e3,5e3,1e4],BT=1e4,zT=`
28
+ Suggested solution: ${e.workaround}`),new Error(n)}static createWebSocket(e,n){const i=this.getWebSocketConstructor();return new i(e,n)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const NT="2.91.0",AT=`realtime-js/${NT}`,PT="1.0.0",p0="2.0.0",Bg=p0,Hc=1e4,RT=1e3,OT=100;var Hn;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(Hn||(Hn={}));var Ze;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(Ze||(Ze={}));var Zt;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(Zt||(Zt={}));var Kc;(function(t){t.websocket="websocket"})(Kc||(Kc={}));var gr;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(gr||(gr={}));class IT{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,n){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(e));let i=[e.join_ref,e.ref,e.topic,e.event,e.payload];return n(JSON.stringify(i))}_binaryEncodeUserBroadcastPush(e){var n;return this._isArrayBuffer((n=e.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var n,i;const o=(i=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&i!==void 0?i:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,o)}_encodeJsonUserBroadcastPush(e){var n,i;const o=(i=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&i!==void 0?i:{},u=new TextEncoder().encode(JSON.stringify(o)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,u)}_encodeUserBroadcastPush(e,n,i){var o,l;const u=e.topic,d=(o=e.ref)!==null&&o!==void 0?o:"",h=(l=e.join_ref)!==null&&l!==void 0?l:"",m=e.payload.event,y=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},v=Object.keys(y).length===0?"":JSON.stringify(y);if(h.length>255)throw new Error(`joinRef length ${h.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`ref length ${d.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`topic length ${u.length} exceeds maximum of 255`);if(m.length>255)throw new Error(`userEvent length ${m.length} exceeds maximum of 255`);if(v.length>255)throw new Error(`metadata length ${v.length} exceeds maximum of 255`);const w=this.USER_BROADCAST_PUSH_META_LENGTH+h.length+d.length+u.length+m.length+v.length,_=new ArrayBuffer(this.HEADER_LENGTH+w);let b=new DataView(_),S=0;b.setUint8(S++,this.KINDS.userBroadcastPush),b.setUint8(S++,h.length),b.setUint8(S++,d.length),b.setUint8(S++,u.length),b.setUint8(S++,m.length),b.setUint8(S++,v.length),b.setUint8(S++,n),Array.from(h,E=>b.setUint8(S++,E.charCodeAt(0))),Array.from(d,E=>b.setUint8(S++,E.charCodeAt(0))),Array.from(u,E=>b.setUint8(S++,E.charCodeAt(0))),Array.from(m,E=>b.setUint8(S++,E.charCodeAt(0))),Array.from(v,E=>b.setUint8(S++,E.charCodeAt(0)));var k=new Uint8Array(_.byteLength+i.byteLength);return k.set(new Uint8Array(_),0),k.set(new Uint8Array(i),_.byteLength),k.buffer}decode(e,n){if(this._isArrayBuffer(e)){let i=this._binaryDecode(e);return n(i)}if(typeof e=="string"){const i=JSON.parse(e),[o,l,u,d,h]=i;return n({join_ref:o,ref:l,topic:u,event:d,payload:h})}return n({})}_binaryDecode(e){const n=new DataView(e),i=n.getUint8(0),o=new TextDecoder;if(i===this.KINDS.userBroadcast)return this._decodeUserBroadcast(e,n,o)}_decodeUserBroadcast(e,n,i){const o=n.getUint8(1),l=n.getUint8(2),u=n.getUint8(3),d=n.getUint8(4);let h=this.HEADER_LENGTH+4;const m=i.decode(e.slice(h,h+o));h=h+o;const y=i.decode(e.slice(h,h+l));h=h+l;const v=i.decode(e.slice(h,h+u));h=h+u;const w=e.slice(h,e.byteLength),_=d===this.JSON_ENCODING?JSON.parse(i.decode(w)):w,b={type:this.BROADCAST_EVENT,event:y,payload:_};return u>0&&(b.meta=JSON.parse(v)),{join_ref:null,ref:null,topic:m,event:this.BROADCAST_EVENT,payload:b}}_isArrayBuffer(e){var n;return e instanceof ArrayBuffer||((n=e?.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(e,n){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([i])=>n.includes(i)))}}class m0{constructor(e,n){this.callback=e,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var Pe;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(Pe||(Pe={}));const zg=(t,e,n={})=>{var i;const o=(i=n.skipTypes)!==null&&i!==void 0?i:[];return e?Object.keys(e).reduce((l,u)=>(l[u]=DT(u,t,e,o),l),{}):{}},DT=(t,e,n,i)=>{const o=e.find(d=>d.name===t),l=o?.type,u=n[t];return l&&!i.includes(l)?g0(l,u):Gc(u)},g0=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return $T(e,n)}switch(t){case Pe.bool:return LT(e);case Pe.float4:case Pe.float8:case Pe.int2:case Pe.int4:case Pe.int8:case Pe.numeric:case Pe.oid:return MT(e);case Pe.json:case Pe.jsonb:return UT(e);case Pe.timestamp:return VT(e);case Pe.abstime:case Pe.date:case Pe.daterange:case Pe.int4range:case Pe.int8range:case Pe.money:case Pe.reltime:case Pe.text:case Pe.time:case Pe.timestamptz:case Pe.timetz:case Pe.tsrange:case Pe.tstzrange:return Gc(e);default:return Gc(e)}},Gc=t=>t,LT=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},MT=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},UT=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},$T=(t,e)=>{if(typeof t!="string")return t;const n=t.length-1,i=t[n];if(t[0]==="{"&&i==="}"){let l;const u=t.slice(1,n);try{l=JSON.parse("["+u+"]")}catch{l=u?u.split(","):[]}return l.map(d=>g0(e,d))}return t},VT=t=>typeof t=="string"?t.replace(" ","T"):t,y0=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};class dc{constructor(e,n,i={},o=Hc){this.channel=e,this.event=n,this.payload=i,this.timeout=o,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,n){var i;return this._hasReceived(e)&&n((i=this.receivedResp)===null||i===void 0?void 0:i.response),this.recHooks.push({status:e,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:n}){this.recHooks.filter(i=>i.status===e).forEach(i=>i.callback(n))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var qg;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(qg||(qg={}));class xi{constructor(e,n){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const i=n?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(i.state,{},o=>{const{onJoin:l,onLeave:u,onSync:d}=this.caller;this.joinRef=this.channel._joinRef(),this.state=xi.syncState(this.state,o,l,u),this.pendingDiffs.forEach(h=>{this.state=xi.syncDiff(this.state,h,l,u)}),this.pendingDiffs=[],d()}),this.channel._on(i.diff,{},o=>{const{onJoin:l,onLeave:u,onSync:d}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(o):(this.state=xi.syncDiff(this.state,o,l,u),d())}),this.onJoin((o,l,u)=>{this.channel._trigger("presence",{event:"join",key:o,currentPresences:l,newPresences:u})}),this.onLeave((o,l,u)=>{this.channel._trigger("presence",{event:"leave",key:o,currentPresences:l,leftPresences:u})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,n,i,o){const l=this.cloneDeep(e),u=this.transformState(n),d={},h={};return this.map(l,(m,y)=>{u[m]||(h[m]=y)}),this.map(u,(m,y)=>{const v=l[m];if(v){const w=y.map(k=>k.presence_ref),_=v.map(k=>k.presence_ref),b=y.filter(k=>_.indexOf(k.presence_ref)<0),S=v.filter(k=>w.indexOf(k.presence_ref)<0);b.length>0&&(d[m]=b),S.length>0&&(h[m]=S)}else d[m]=y}),this.syncDiff(l,{joins:d,leaves:h},i,o)}static syncDiff(e,n,i,o){const{joins:l,leaves:u}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return i||(i=()=>{}),o||(o=()=>{}),this.map(l,(d,h)=>{var m;const y=(m=e[d])!==null&&m!==void 0?m:[];if(e[d]=this.cloneDeep(h),y.length>0){const v=e[d].map(_=>_.presence_ref),w=y.filter(_=>v.indexOf(_.presence_ref)<0);e[d].unshift(...w)}i(d,y,h)}),this.map(u,(d,h)=>{let m=e[d];if(!m)return;const y=h.map(v=>v.presence_ref);m=m.filter(v=>y.indexOf(v.presence_ref)<0),e[d]=m,o(d,m,h),m.length===0&&delete e[d]}),e}static map(e,n){return Object.getOwnPropertyNames(e).map(i=>n(i,e[i]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((n,i)=>{const o=e[i];return"metas"in o?n[i]=o.metas.map(l=>(l.presence_ref=l.phx_ref,delete l.phx_ref,delete l.phx_ref_prev,l)):n[i]=o,n},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Wg;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(Wg||(Wg={}));var bi;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(bi||(bi={}));var vn;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(vn||(vn={}));class hs{constructor(e,n={config:{}},i){var o,l;if(this.topic=e,this.params=n,this.socket=i,this.bindings={},this.state=Ze.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.timeout=this.socket.timeout,this.joinPush=new dc(this,Zt.join,this.params,this.timeout),this.rejoinTimer=new m0(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ze.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(u=>u.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Ze.closed,this.socket._remove(this)}),this._onError(u=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,u),this.state=Ze.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ze.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",u=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,u),this.state=Ze.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Zt.reply,{},(u,d)=>{this._trigger(this._replyEventName(d),u)}),this.presence=new xi(this),this.broadcastEndpointURL=y0(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((l=(o=this.params.config)===null||o===void 0?void 0:o.broadcast)===null||l===void 0)&&l.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,n=this.timeout){var i,o,l;if(this.socket.isConnected()||this.socket.connect(),this.state==Ze.closed){const{config:{broadcast:u,presence:d,private:h}}=this.params,m=(o=(i=this.bindings.postgres_changes)===null||i===void 0?void 0:i.map(_=>_.filter))!==null&&o!==void 0?o:[],y=!!this.bindings[bi.PRESENCE]&&this.bindings[bi.PRESENCE].length>0||((l=this.params.config.presence)===null||l===void 0?void 0:l.enabled)===!0,v={},w={broadcast:u,presence:Object.assign(Object.assign({},d),{enabled:y}),postgres_changes:m,private:h};this.socket.accessTokenValue&&(v.access_token=this.socket.accessTokenValue),this._onError(_=>e?.(vn.CHANNEL_ERROR,_)),this._onClose(()=>e?.(vn.CLOSED)),this.updateJoinPayload(Object.assign({config:w},v)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:_})=>{var b;if(this.socket._isManualToken()||this.socket.setAuth(),_===void 0){e?.(vn.SUBSCRIBED);return}else{const S=this.bindings.postgres_changes,k=(b=S?.length)!==null&&b!==void 0?b:0,E=[];for(let P=0;P<k;P++){const N=S[P],{filter:{event:U,schema:V,table:z,filter:$}}=N,B=_&&_[P];if(B&&B.event===U&&hs.isFilterValueEqual(B.schema,V)&&hs.isFilterValueEqual(B.table,z)&&hs.isFilterValueEqual(B.filter,$))E.push(Object.assign(Object.assign({},N),{id:B.id}));else{this.unsubscribe(),this.state=Ze.errored,e?.(vn.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=E,e&&e(vn.SUBSCRIBED);return}}).receive("error",_=>{this.state=Ze.errored,e?.(vn.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(_).join(", ")||"error")))}).receive("timeout",()=>{e?.(vn.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,n={}){return await this.send({type:"presence",event:"track",payload:e},n.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,n,i){return this.state===Ze.joined&&e===bi.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(e,n,i)}async httpSend(e,n,i={}){var o;if(n==null)return Promise.reject("Payload is required for httpSend()");const l={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(l.Authorization=`Bearer ${this.socket.accessTokenValue}`);const u={method:"POST",headers:l,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:n,private:this.private}]})},d=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(o=i.timeout)!==null&&o!==void 0?o:this.timeout);if(d.status===202)return{success:!0};let h=d.statusText;try{const m=await d.json();h=m.error||m.message||h}catch{}return Promise.reject(new Error(h))}async send(e,n={}){var i,o;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:l,payload:u}=e,d={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(d.Authorization=`Bearer ${this.socket.accessTokenValue}`);const h={method:"POST",headers:d,body:JSON.stringify({messages:[{topic:this.subTopic,event:l,payload:u,private:this.private}]})};try{const m=await this._fetchWithTimeout(this.broadcastEndpointURL,h,(i=n.timeout)!==null&&i!==void 0?i:this.timeout);return await((o=m.body)===null||o===void 0?void 0:o.cancel()),m.ok?"ok":"error"}catch(m){return m.name==="AbortError"?"timed out":"error"}}else return new Promise(l=>{var u,d,h;const m=this._push(e.type,e,n.timeout||this.timeout);e.type==="broadcast"&&!(!((h=(d=(u=this.params)===null||u===void 0?void 0:u.config)===null||d===void 0?void 0:d.broadcast)===null||h===void 0)&&h.ack)&&l("ok"),m.receive("ok",()=>l("ok")),m.receive("error",()=>l("error")),m.receive("timeout",()=>l("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Ze.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Zt.close,"leave",this._joinRef())};this.joinPush.destroy();let i=null;return new Promise(o=>{i=new dc(this,Zt.leave,{},e),i.receive("ok",()=>{n(),o("ok")}).receive("timeout",()=>{n(),o("timed out")}).receive("error",()=>{o("error")}),i.send(),this._canPush()||i.trigger("ok",{})}).finally(()=>{i?.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ze.closed,this.bindings={}}async _fetchWithTimeout(e,n,i){const o=new AbortController,l=setTimeout(()=>o.abort(),i),u=await this.socket.fetch(e,Object.assign(Object.assign({},n),{signal:o.signal}));return clearTimeout(l),u}_push(e,n,i=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let o=new dc(this,e,n,i);return this._canPush()?o.send():this._addToPushBuffer(o),o}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>OT){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(e,n,i){return n}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,n,i){var o,l;const u=e.toLocaleLowerCase(),{close:d,error:h,leave:m,join:y}=Zt;if(i&&[d,h,m,y].indexOf(u)>=0&&i!==this._joinRef())return;let w=this._onMessage(u,n,i);if(n&&!w)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(u)?(o=this.bindings.postgres_changes)===null||o===void 0||o.filter(_=>{var b,S,k;return((b=_.filter)===null||b===void 0?void 0:b.event)==="*"||((k=(S=_.filter)===null||S===void 0?void 0:S.event)===null||k===void 0?void 0:k.toLocaleLowerCase())===u}).map(_=>_.callback(w,i)):(l=this.bindings[u])===null||l===void 0||l.filter(_=>{var b,S,k,E,P,N,U,V;if(["broadcast","presence","postgres_changes"].includes(u))if("id"in _){const z=_.id,$=(b=_.filter)===null||b===void 0?void 0:b.event;return z&&((S=n.ids)===null||S===void 0?void 0:S.includes(z))&&($==="*"||$?.toLocaleLowerCase()===((k=n.data)===null||k===void 0?void 0:k.type.toLocaleLowerCase()))&&(!(!((E=_.filter)===null||E===void 0)&&E.table)||_.filter.table===((P=n.data)===null||P===void 0?void 0:P.table))}else{const z=(U=(N=_?.filter)===null||N===void 0?void 0:N.event)===null||U===void 0?void 0:U.toLocaleLowerCase();return z==="*"||z===((V=n?.event)===null||V===void 0?void 0:V.toLocaleLowerCase())}else return _.type.toLocaleLowerCase()===u}).map(_=>{if(typeof w=="object"&&"ids"in w){const b=w.data,{schema:S,table:k,commit_timestamp:E,type:P,errors:N}=b;w=Object.assign(Object.assign({},{schema:S,table:k,commit_timestamp:E,eventType:P,new:{},old:{},errors:N}),this._getPayloadRecords(b))}_.callback(w,i)})}_isClosed(){return this.state===Ze.closed}_isJoined(){return this.state===Ze.joined}_isJoining(){return this.state===Ze.joining}_isLeaving(){return this.state===Ze.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,n,i){const o=e.toLocaleLowerCase(),l={type:o,filter:n,callback:i};return this.bindings[o]?this.bindings[o].push(l):this.bindings[o]=[l],this}_off(e,n){const i=e.toLocaleLowerCase();return this.bindings[i]&&(this.bindings[i]=this.bindings[i].filter(o=>{var l;return!(((l=o.type)===null||l===void 0?void 0:l.toLocaleLowerCase())===i&&hs.isEqual(o.filter,n))})),this}static isEqual(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const i in e)if(e[i]!==n[i])return!1;return!0}static isFilterValueEqual(e,n){return(e??void 0)===(n??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Zt.close,{},e)}_onError(e){this._on(Zt.error,{},n=>e(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Ze.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=zg(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=zg(e.columns,e.old_record)),n}}const hc=()=>{},ca={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},FT=[1e3,2e3,5e3,1e4],BT=1e4,zT=`
29
29
  addEventListener("message", (e) => {
30
30
  if (e.data.event === "start") {
31
31
  setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
32
32
  }
33
- });`;class qT{constructor(e,n){var i;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Wc,this.transport=null,this.heartbeatIntervalMs=ca.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=dc,this.ref=0,this.reconnectTimer=null,this.vsn=Bg,this.logger=dc,this.conn=null,this.sendBuffer=[],this.serializer=new IT,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=o=>o?(...l)=>o(...l):(...l)=>fetch(...l),!(!((i=n?.params)===null||i===void 0)&&i.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${e}/${Hc.websocket}`,this.httpEndpoint=y0(e),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(n?.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=CT.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const n=e.message;throw n.includes("Node.js")?new Error(`${n}
33
+ });`;class qT{constructor(e,n){var i;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Hc,this.transport=null,this.heartbeatIntervalMs=ca.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=hc,this.ref=0,this.reconnectTimer=null,this.vsn=Bg,this.logger=hc,this.conn=null,this.sendBuffer=[],this.serializer=new IT,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=o=>o?(...l)=>o(...l):(...l)=>fetch(...l),!(!((i=n?.params)===null||i===void 0)&&i.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${e}/${Kc.websocket}`,this.httpEndpoint=y0(e),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(n?.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=CT.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const n=e.message;throw n.includes("Node.js")?new Error(`${n}
34
34
 
35
35
  To use Realtime in Node.js, you need to provide a WebSocket implementation:
36
36
 
@@ -43,30 +43,30 @@ Option 2: Install and provide the "ws" package:
43
43
  const client = new RealtimeClient(url, {
44
44
  ...options,
45
45
  transport: ws
46
- })`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const i=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(i),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(e?this.conn.close(e,n??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const n=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const e=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,n,i){this.logger(e,n,i)}connectionState(){switch(this.conn&&this.conn.readyState){case Wn.connecting:return gr.Connecting;case Wn.open:return gr.Open;case Wn.closing:return gr.Closing;default:return gr.Closed}}isConnected(){return this.connectionState()===gr.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,n={config:{}}){const i=`realtime:${e}`,o=this.getChannels().find(l=>l.topic===i);if(o)return o;{const l=new ds(`realtime:${e}`,n,this);return this.channels.push(l),l}}push(e){const{topic:n,event:i,payload:o,ref:l}=e,u=()=>{this.encode(e,d=>{var h;(h=this.conn)===null||h===void 0||h.send(d)})};this.log("push",`${n} ${i} (${l})`,o),this.isConnected()?u():this.sendBuffer.push(u)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this._heartbeatSentAt=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(RT,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},ca.HEARTBEAT_TIMEOUT_FALLBACK);return}this._heartbeatSentAt=Date.now(),this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(n){this.log("error","error in heartbeat callback",n)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let n=this.channels.find(i=>i.topic===e&&(i._isJoined()||i._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${e}"`),n.unsubscribe())}_remove(e){this.channels=this.channels.filter(n=>n.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply"&&n.ref&&n.ref===this.pendingHeartbeatRef){const m=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error",m)}catch(y){this.log("error","error in heartbeat callback",y)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:i,event:o,payload:l,ref:u}=n,d=u?`(${u})`:"",h=l.status||"";this.log("receive",`${h} ${i} ${o} ${d}`.trim(),l),this.channels.filter(m=>m._isMember(i)).forEach(m=>m._trigger(o,l,u)),this._triggerStateCallbacks("message",n)})}_clearTimer(e){var n;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e),this.conn.readyState===Wn.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Wn.open||this.conn.readyState===Wn.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(n=>{this.log("error","error waiting for auth on connect",n),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this._terminateWorker()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(e){var n;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(Zt.error))}_appendParams(e,n){if(Object.keys(n).length===0)return e;const i=e.match(/\?/)?"&":"?",o=new URLSearchParams(n);return`${e}${i}${o}`}_workerObjectUrl(e){let n;if(e)n=e;else{const i=new Blob([zT],{type:"application/javascript"});n=URL.createObjectURL(i)}return n}_setConnectionState(e,n=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(e=null){let n,i=!1;if(e)n=e,i=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(o){this.log("error","Error fetching access token from callback",o),n=this.accessTokenValue}else n=this.accessTokenValue;i?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(o=>{const l={access_token:n,version:AT};n&&o.updateJoinPayload(l),o.joinedOnce&&o._isJoined()&&o._push(Zt.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${e}`,n)})}_triggerStateCallbacks(e,n){try{this.stateChangeCallbacks[e].forEach(i=>{try{i(n)}catch(o){this.log("error",`error in ${e} callback`,o)}})}catch(i){this.log("error",`error triggering ${e} callbacks`,i)}}_setupReconnectionTimer(){this.reconnectTimer=new m0(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},ca.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var n,i,o,l,u,d,h,m,y,v,w,_;switch(this.transport=(n=e?.transport)!==null&&n!==void 0?n:null,this.timeout=(i=e?.timeout)!==null&&i!==void 0?i:Wc,this.heartbeatIntervalMs=(o=e?.heartbeatIntervalMs)!==null&&o!==void 0?o:ca.HEARTBEAT_INTERVAL,this.worker=(l=e?.worker)!==null&&l!==void 0?l:!1,this.accessToken=(u=e?.accessToken)!==null&&u!==void 0?u:null,this.heartbeatCallback=(d=e?.heartbeatCallback)!==null&&d!==void 0?d:dc,this.vsn=(h=e?.vsn)!==null&&h!==void 0?h:Bg,e?.params&&(this.params=e.params),e?.logger&&(this.logger=e.logger),(e?.logLevel||e?.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(m=e?.reconnectAfterMs)!==null&&m!==void 0?m:(b=>FT[b-1]||BT),this.vsn){case PT:this.encode=(y=e?.encode)!==null&&y!==void 0?y:((b,k)=>k(JSON.stringify(b))),this.decode=(v=e?.decode)!==null&&v!==void 0?v:((b,k)=>k(JSON.parse(b)));break;case p0:this.encode=(w=e?.encode)!==null&&w!==void 0?w:this.serializer.encode.bind(this.serializer),this.decode=(_=e?.decode)!==null&&_!==void 0?_:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e?.workerUrl}}}var Ai=class extends Error{constructor(t,e){super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&e.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function WT(t,e,n){const i=new URL(e,t);if(n)for(const[o,l]of Object.entries(n))l!==void 0&&i.searchParams.set(o,l);return i.toString()}async function HT(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function KT(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:n,path:i,query:o,body:l,headers:u}){const d=WT(t.baseUrl,i,o),h=await HT(t.auth),m=await e(d,{method:n,headers:{...l?{"Content-Type":"application/json"}:{},...h,...u},body:l?JSON.stringify(l):void 0}),y=await m.text(),v=(m.headers.get("content-type")||"").includes("application/json"),w=v&&y?JSON.parse(y):y;if(!m.ok){const _=v?w:void 0,b=_?.error;throw new Ai(b?.message??`Request failed with status ${m.status}`,{status:m.status,icebergType:b?.type,icebergCode:b?.code,details:_})}return{status:m.status,headers:m.headers,data:w}}}}function da(t){return t.join("")}var GT=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:da(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(i=>({namespace:i}))}async createNamespace(t,e){const n={namespace:t.namespace,properties:e?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${da(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${da(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${da(t.namespace)}`}),!0}catch(e){if(e instanceof Ai&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(n){if(n instanceof Ai&&n.status===409)return;throw n}}};function Qr(t){return t.join("")}var JT=class{constructor(t,e="",n){this.client=t,this.prefix=e,this.accessDelegation=n}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Qr(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Qr(t.namespace)}/tables`,body:e,headers:n})).data.metadata}async updateTable(t,e){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Qr(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Qr(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(e?.purge??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Qr(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Qr(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(n){if(n instanceof Ai&&n.status===404)return!1;throw n}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(n){if(n instanceof Ai&&n.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw n}}},YT=class{constructor(t){let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const n=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=KT({baseUrl:n,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new GT(this.client,e),this.tableOps=new JT(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}},Ha=class extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}};function Fe(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var QT=class extends Ha{constructor(t,e,n){super(t),this.name="StorageApiError",this.status=e,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Gc=class extends Ha{constructor(t,e){super(t),this.name="StorageUnknownError",this.originalError=e}};const Wd=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),XT=()=>Response,Jc=t=>{if(Array.isArray(t))return t.map(n=>Jc(n));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([n,i])=>{const o=n.replace(/([-_][a-z])/gi,l=>l.toUpperCase().replace(/[-_]/g,""));e[o]=Jc(i)}),e},ZT=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},ej=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t);function Pi(t){"@babel/helpers - typeof";return Pi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pi(t)}function tj(t,e){if(Pi(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(Pi(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function nj(t){var e=tj(t,"string");return Pi(e)=="symbol"?e:e+""}function rj(t,e,n){return(e=nj(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Hg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,i)}return n}function he(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Hg(Object(n),!0).forEach(function(i){rj(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Hg(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}const hc=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},sj=async(t,e,n)=>{t instanceof await XT()&&!n?.noResolveJson?t.json().then(i=>{const o=t.status||500,l=i?.statusCode||o+"";e(new QT(hc(i),o,l))}).catch(i=>{e(new Gc(hc(i),i))}):e(new Gc(hc(t),t))},ij=(t,e,n,i)=>{const o={method:t,headers:e?.headers||{}};return t==="GET"||!i?o:(ZT(i)?(o.headers=he({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(i)):o.body=i,e?.duplex&&(o.duplex=e.duplex),he(he({},o),n))};async function Hi(t,e,n,i,o,l){return new Promise((u,d)=>{t(n,ij(e,i,o,l)).then(h=>{if(!h.ok)throw h;return i?.noResolveJson?h:h.json()}).then(h=>u(h)).catch(h=>sj(h,d,i))})}async function Ri(t,e,n,i){return Hi(t,"GET",e,n,i)}async function Xt(t,e,n,i,o){return Hi(t,"POST",e,i,o,n)}async function Yc(t,e,n,i,o){return Hi(t,"PUT",e,i,o,n)}async function oj(t,e,n,i){return Hi(t,"HEAD",e,he(he({},n),{},{noResolveJson:!0}),i)}async function Hd(t,e,n,i,o){return Hi(t,"DELETE",e,i,o,n)}var aj=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(Fe(e))return{data:null,error:e};throw e}}};let v0;v0=Symbol.toStringTag;var lj=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[v0]="BlobDownloadBuilder",this.promise=null}asStream(){return new aj(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(Fe(e))return{data:null,error:e};throw e}}};const uj={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Kg={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var cj=class{constructor(t,e={},n,i){this.shouldThrowOnError=!1,this.url=t,this.headers=e,this.bucketId=n,this.fetch=Wd(i)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(t,e,n,i){var o=this;try{let l;const u=he(he({},Kg),i);let d=he(he({},o.headers),t==="POST"&&{"x-upsert":String(u.upsert)});const h=u.metadata;typeof Blob<"u"&&n instanceof Blob?(l=new FormData,l.append("cacheControl",u.cacheControl),h&&l.append("metadata",o.encodeMetadata(h)),l.append("",n)):typeof FormData<"u"&&n instanceof FormData?(l=n,l.has("cacheControl")||l.append("cacheControl",u.cacheControl),h&&!l.has("metadata")&&l.append("metadata",o.encodeMetadata(h))):(l=n,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType,h&&(d["x-metadata"]=o.toBase64(o.encodeMetadata(h))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!u.duplex&&(u.duplex="half")),i?.headers&&(d=he(he({},d),i.headers));const m=o._removeEmptyFolders(e),y=o._getFinalPath(m),v=await(t=="PUT"?Yc:Xt)(o.fetch,`${o.url}/object/${y}`,l,he({headers:d},u?.duplex?{duplex:u.duplex}:{}));return{data:{path:m,id:v.Id,fullPath:v.Key},error:null}}catch(l){if(o.shouldThrowOnError)throw l;if(Fe(l))return{data:null,error:l};throw l}}async upload(t,e,n){return this.uploadOrUpdate("POST",t,e,n)}async uploadToSignedUrl(t,e,n,i){var o=this;const l=o._removeEmptyFolders(t),u=o._getFinalPath(l),d=new URL(o.url+`/object/upload/sign/${u}`);d.searchParams.set("token",e);try{let h;const m=he({upsert:Kg.upsert},i),y=he(he({},o.headers),{"x-upsert":String(m.upsert)});return typeof Blob<"u"&&n instanceof Blob?(h=new FormData,h.append("cacheControl",m.cacheControl),h.append("",n)):typeof FormData<"u"&&n instanceof FormData?(h=n,h.append("cacheControl",m.cacheControl)):(h=n,y["cache-control"]=`max-age=${m.cacheControl}`,y["content-type"]=m.contentType),{data:{path:l,fullPath:(await Yc(o.fetch,d.toString(),h,{headers:y})).Key},error:null}}catch(h){if(o.shouldThrowOnError)throw h;if(Fe(h))return{data:null,error:h};throw h}}async createSignedUploadUrl(t,e){var n=this;try{let i=n._getFinalPath(t);const o=he({},n.headers);e?.upsert&&(o["x-upsert"]="true");const l=await Xt(n.fetch,`${n.url}/object/upload/sign/${i}`,{},{headers:o}),u=new URL(n.url+l.url),d=u.searchParams.get("token");if(!d)throw new Ha("No token returned by API");return{data:{signedUrl:u.toString(),path:t,token:d},error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}async update(t,e,n){return this.uploadOrUpdate("PUT",t,e,n)}async move(t,e,n){var i=this;try{return{data:await Xt(i.fetch,`${i.url}/object/move`,{bucketId:i.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n?.destinationBucket},{headers:i.headers}),error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}async copy(t,e,n){var i=this;try{return{data:{path:(await Xt(i.fetch,`${i.url}/object/copy`,{bucketId:i.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n?.destinationBucket},{headers:i.headers})).Key},error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}async createSignedUrl(t,e,n){var i=this;try{let o=i._getFinalPath(t),l=await Xt(i.fetch,`${i.url}/object/sign/${o}`,he({expiresIn:e},n?.transform?{transform:n.transform}:{}),{headers:i.headers});const u=n?.download?`&download=${n.download===!0?"":n.download}`:"";return l={signedUrl:encodeURI(`${i.url}${l.signedURL}${u}`)},{data:l,error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}async createSignedUrls(t,e,n){var i=this;try{const o=await Xt(i.fetch,`${i.url}/object/sign/${i.bucketId}`,{expiresIn:e,paths:t},{headers:i.headers}),l=n?.download?`&download=${n.download===!0?"":n.download}`:"";return{data:o.map(u=>he(he({},u),{},{signedUrl:u.signedURL?encodeURI(`${i.url}${u.signedURL}${l}`):null})),error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}download(t,e){const n=typeof e?.transform<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString(e?.transform||{}),o=i?`?${i}`:"",l=this._getFinalPath(t),u=()=>Ri(this.fetch,`${this.url}/${n}/${l}${o}`,{headers:this.headers,noResolveJson:!0});return new lj(u,this.shouldThrowOnError)}async info(t){var e=this;const n=e._getFinalPath(t);try{return{data:Jc(await Ri(e.fetch,`${e.url}/object/info/${n}`,{headers:e.headers})),error:null}}catch(i){if(e.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}async exists(t){var e=this;const n=e._getFinalPath(t);try{return await oj(e.fetch,`${e.url}/object/${n}`,{headers:e.headers}),{data:!0,error:null}}catch(i){if(e.shouldThrowOnError)throw i;if(Fe(i)&&i instanceof Gc){const o=i.originalError;if([400,404].includes(o?.status))return{data:!1,error:i}}throw i}}getPublicUrl(t,e){const n=this._getFinalPath(t),i=[],o=e?.download?`download=${e.download===!0?"":e.download}`:"";o!==""&&i.push(o);const l=typeof e?.transform<"u"?"render/image":"object",u=this.transformOptsToQueryString(e?.transform||{});u!==""&&i.push(u);let d=i.join("&");return d!==""&&(d=`?${d}`),{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${n}${d}`)}}}async remove(t){var e=this;try{return{data:await Hd(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async list(t,e,n){var i=this;try{const o=he(he(he({},uj),e),{},{prefix:t||""});return{data:await Xt(i.fetch,`${i.url}/object/list/${i.bucketId}`,o,{headers:i.headers},n),error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}async listV2(t,e){var n=this;try{const i=he({},t);return{data:await Xt(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,i,{headers:n.headers},e),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const e=[];return t.width&&e.push(`width=${t.width}`),t.height&&e.push(`height=${t.height}`),t.resize&&e.push(`resize=${t.resize}`),t.format&&e.push(`format=${t.format}`),t.quality&&e.push(`quality=${t.quality}`),e.join("&")}};const w0="2.91.0",x0={"X-Client-Info":`storage-js/${w0}`};var dj=class{constructor(t,e={},n,i){this.shouldThrowOnError=!1;const o=new URL(t);i?.useNewHostname&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase.")),this.url=o.href.replace(/\/$/,""),this.headers=he(he({},x0),e),this.fetch=Wd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(t){var e=this;try{const n=e.listBucketOptionsToQueryString(t);return{data:await Ri(e.fetch,`${e.url}/bucket${n}`,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async getBucket(t){var e=this;try{return{data:await Ri(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async createBucket(t,e={public:!1}){var n=this;try{return{data:await Xt(n.fetch,`${n.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}async updateBucket(t,e){var n=this;try{return{data:await Yc(n.fetch,`${n.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}async emptyBucket(t){var e=this;try{return{data:await Xt(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async deleteBucket(t){var e=this;try{return{data:await Hd(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},hj=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=he(he({},x0),e),this.fetch=Wd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await Xt(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async listBuckets(t){var e=this;try{const n=new URLSearchParams;t?.limit!==void 0&&n.set("limit",t.limit.toString()),t?.offset!==void 0&&n.set("offset",t.offset.toString()),t?.sortColumn&&n.set("sortColumn",t.sortColumn),t?.sortOrder&&n.set("sortOrder",t.sortOrder),t?.search&&n.set("search",t.search);const i=n.toString(),o=i?`${e.url}/bucket?${i}`:`${e.url}/bucket`;return{data:await Ri(e.fetch,o,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async deleteBucket(t){var e=this;try{return{data:await Hd(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}from(t){var e=this;if(!ej(t))throw new Ha("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new YT({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),i=this.shouldThrowOnError;return new Proxy(n,{get(o,l){const u=o[l];return typeof u!="function"?u:async(...d)=>{try{return{data:await u.apply(o,d),error:null}}catch(h){if(i)throw h;return{data:null,error:h}}}}})}};const Kd={"X-Client-Info":`storage-js/${w0}`,"Content-Type":"application/json"};var b0=class extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Pt(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var fc=class extends b0{constructor(t,e,n){super(t),this.name="StorageVectorsApiError",this.status=e,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},fj=class extends b0{constructor(t,e){super(t),this.name="StorageVectorsUnknownError",this.originalError=e}};const Gd=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),pj=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Gg=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),mj=async(t,e,n)=>{if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!n?.noResolveJson){const i=t.status||500,o=t;if(typeof o.json=="function")o.json().then(l=>{const u=l?.statusCode||l?.code||i+"";e(new fc(Gg(l),i,u))}).catch(()=>{const l=i+"";e(new fc(o.statusText||`HTTP ${i} error`,i,l))});else{const l=i+"";e(new fc(o.statusText||`HTTP ${i} error`,i,l))}}else e(new fj(Gg(t),t))},gj=(t,e,n,i)=>{const o={method:t,headers:e?.headers||{}};return i?(pj(i)?(o.headers=he({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(i)):o.body=i,he(he({},o),n)):o};async function yj(t,e,n,i,o,l){return new Promise((u,d)=>{t(n,gj(e,i,o,l)).then(h=>{if(!h.ok)throw h;if(i?.noResolveJson)return h;const m=h.headers.get("content-type");return!m||!m.includes("application/json")?{}:h.json()}).then(h=>u(h)).catch(h=>mj(h,d,i))})}async function Rt(t,e,n,i,o){return yj(t,"POST",e,i,o,n)}var vj=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=he(he({},Kd),e),this.fetch=Gd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async getIndex(t,e){var n=this;try{return{data:await Rt(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers}),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Pt(i))return{data:null,error:i};throw i}}async listIndexes(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async deleteIndex(t,e){var n=this;try{return{data:await Rt(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers})||{},error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Pt(i))return{data:null,error:i};throw i}}},wj=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=he(he({},Kd),e),this.fetch=Gd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(t){var e=this;try{if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await Rt(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async getVectors(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async listVectors(t){var e=this;try{if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return{data:await Rt(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async queryVectors(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async deleteVectors(t){var e=this;try{if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await Rt(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}},xj=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=he(he({},Kd),e),this.fetch=Gd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async getBucket(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async listBuckets(t={}){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async deleteBucket(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}},bj=class extends xj{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new _j(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,n=this;return e().call(n,t)}async getBucket(t){var e=()=>super.getBucket,n=this;return e().call(n,t)}async listBuckets(t={}){var e=()=>super.listBuckets,n=this;return e().call(n,t)}async deleteBucket(t){var e=()=>super.deleteBucket,n=this;return e().call(n,t)}},_j=class extends vj{constructor(t,e,n,i){super(t,e,i),this.vectorBucketName=n}async createIndex(t){var e=()=>super.createIndex,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,n=this;return e().call(n,n.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,n=this;return e().call(n,n.vectorBucketName,t)}index(t){return new Sj(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},Sj=class extends wj{constructor(t,e,n,i,o){super(t,e,o),this.vectorBucketName=n,this.indexName=i}async putVectors(t){var e=()=>super.putVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(t){var e=()=>super.getVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},kj=class extends dj{constructor(t,e={},n,i){super(t,e,n,i)}from(t){return new cj(this.url,this.headers,t,this.fetch)}get vectors(){return new bj(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new hj(this.url+"/iceberg",this.headers,this.fetch)}};const _0="2.91.0",ss=30*1e3,Qc=3,pc=Qc*ss,Ej="http://localhost:9999",Tj="supabase.auth.token",jj={"X-Client-Info":`gotrue-js/${_0}`},Xc="X-Supabase-Api-Version",S0={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Cj=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Nj=600*1e3;class Oi extends Error{constructor(e,n,i){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=i}}function ne(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class Aj extends Oi{constructor(e,n,i){super(e,n,i),this.name="AuthApiError",this.status=n,this.code=i}}function Pj(t){return ne(t)&&t.name==="AuthApiError"}class yr extends Oi{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class Sn extends Oi{constructor(e,n,i,o){super(e,i,o),this.name=n,this.status=i}}class At extends Sn{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Rj(t){return ne(t)&&t.name==="AuthSessionMissingError"}class Xr extends Sn{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class ha extends Sn{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class fa extends Sn{constructor(e,n=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function Oj(t){return ne(t)&&t.name==="AuthImplicitGrantRedirectError"}class Jg extends Sn{constructor(e,n=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Ij extends Sn{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class Zc extends Sn{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function mc(t){return ne(t)&&t.name==="AuthRetryableFetchError"}class Yg extends Sn{constructor(e,n,i){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=i}}class ed extends Sn{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Na="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Qg=`
47
- \r=`.split(""),Dj=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<Qg.length;e+=1)t[Qg[e].charCodeAt(0)]=-2;for(let e=0;e<Na.length;e+=1)t[Na[e].charCodeAt(0)]=e;return t})();function Xg(t,e,n){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const i=e.queue>>e.queuedBits-6&63;n(Na[i]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const i=e.queue>>e.queuedBits-6&63;n(Na[i]),e.queuedBits-=6}}function k0(t,e,n){const i=Dj[t];if(i>-1)for(e.queue=e.queue<<6|i,e.queuedBits+=6;e.queuedBits>=8;)n(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(i===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function Zg(t){const e=[],n=u=>{e.push(String.fromCodePoint(u))},i={utf8seq:0,codepoint:0},o={queue:0,queuedBits:0},l=u=>{Uj(u,i,n)};for(let u=0;u<t.length;u+=1)k0(t.charCodeAt(u),o,l);return e.join("")}function Lj(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function Mj(t,e){for(let n=0;n<t.length;n+=1){let i=t.charCodeAt(n);if(i>55295&&i<=56319){const o=(i-55296)*1024&65535;i=(t.charCodeAt(n+1)-56320&65535|o)+65536,n+=1}Lj(i,e)}}function Uj(t,e,n){if(e.utf8seq===0){if(t<=127){n(t);return}for(let i=1;i<6;i+=1)if((t>>7-i&1)===0){e.utf8seq=i;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&n(e.codepoint)}}function hs(t){const e=[],n={queue:0,queuedBits:0},i=o=>{e.push(o)};for(let o=0;o<t.length;o+=1)k0(t.charCodeAt(o),n,i);return new Uint8Array(e)}function $j(t){const e=[];return Mj(t,n=>e.push(n)),new Uint8Array(e)}function xr(t){const e=[],n={queue:0,queuedBits:0},i=o=>{e.push(o)};return t.forEach(o=>Xg(o,n,i)),Xg(null,n,i),e.join("")}function Vj(t){return Math.round(Date.now()/1e3)+t}function Fj(){return Symbol("auth-callback")}const ot=()=>typeof window<"u"&&typeof document<"u",dr={tested:!1,writable:!1},E0=()=>{if(!ot())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(dr.tested)return dr.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),dr.tested=!0,dr.writable=!0}catch{dr.tested=!0,dr.writable=!1}return dr.writable};function Bj(t){const e={},n=new URL(t);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((o,l)=>{e[l]=o})}catch{}return n.searchParams.forEach((i,o)=>{e[o]=i}),e}const T0=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),zj=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",is=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},hr=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return n}},it=async(t,e)=>{await t.removeItem(e)};class Ka{constructor(){this.promise=new Ka.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}Ka.promiseConstructor=Promise;function gc(t){const e=t.split(".");if(e.length!==3)throw new ed("Invalid JWT structure");for(let i=0;i<e.length;i++)if(!Cj.test(e[i]))throw new ed("JWT not in base64url format");return{header:JSON.parse(Zg(e[0])),payload:JSON.parse(Zg(e[1])),signature:hs(e[2]),raw:{header:e[0],payload:e[1]}}}async function qj(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function Wj(t,e){return new Promise((i,o)=>{(async()=>{for(let l=0;l<1/0;l++)try{const u=await t(l);if(!e(l,null,u)){i(u);return}}catch(u){if(!e(l,u)){o(u);return}}})()})}function Hj(t){return("0"+t.toString(16)).substr(-2)}function Kj(){const e=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",i=n.length;let o="";for(let l=0;l<56;l++)o+=n.charAt(Math.floor(Math.random()*i));return o}return crypto.getRandomValues(e),Array.from(e,Hj).join("")}async function Gj(t){const n=new TextEncoder().encode(t),i=await crypto.subtle.digest("SHA-256",n),o=new Uint8Array(i);return Array.from(o).map(l=>String.fromCharCode(l)).join("")}async function Jj(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const n=await Gj(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Zr(t,e,n=!1){const i=Kj();let o=i;n&&(o+="/PASSWORD_RECOVERY"),await is(t,`${e}-code-verifier`,o);const l=await Jj(i);return[l,i===l?"plain":"s256"]}const Yj=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Qj(t){const e=t.headers.get(Xc);if(!e||!e.match(Yj))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function Xj(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function Zj(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const e2=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function es(t){if(!e2.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function yc(){const t={};return new Proxy(t,{get:(e,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const i=n.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function t2(t,e){return new Proxy(t,{get:(n,i,o)=>{if(i==="__isInsecureUserWarningProxy")return!0;if(typeof i=="symbol"){const l=i.toString();if(l==="Symbol(Symbol.toPrimitive)"||l==="Symbol(Symbol.toStringTag)"||l==="Symbol(util.inspect.custom)"||l==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,i,o)}return!e.value&&typeof i=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(n,i,o)}})}function ey(t){return JSON.parse(JSON.stringify(t))}const mr=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),n2=[502,503,504];async function ty(t){var e;if(!zj(t))throw new Zc(mr(t),0);if(n2.includes(t.status))throw new Zc(mr(t),t.status);let n;try{n=await t.json()}catch(l){throw new yr(mr(l),l)}let i;const o=Qj(t);if(o&&o.getTime()>=S0["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?i=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(i=n.error_code),i){if(i==="weak_password")throw new Yg(mr(n),t.status,((e=n.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(i==="session_not_found")throw new At}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((l,u)=>l&&typeof u=="string",!0))throw new Yg(mr(n),t.status,n.weak_password.reasons);throw new Aj(mr(n),t.status||500,i)}const r2=(t,e,n,i)=>{const o={method:t,headers:e?.headers||{}};return t==="GET"?o:(o.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e?.headers),o.body=JSON.stringify(i),Object.assign(Object.assign({},o),n))};async function ce(t,e,n,i){var o;const l=Object.assign({},i?.headers);l[Xc]||(l[Xc]=S0["2024-01-01"].name),i?.jwt&&(l.Authorization=`Bearer ${i.jwt}`);const u=(o=i?.query)!==null&&o!==void 0?o:{};i?.redirectTo&&(u.redirect_to=i.redirectTo);const d=Object.keys(u).length?"?"+new URLSearchParams(u).toString():"",h=await s2(t,e,n+d,{headers:l,noResolveJson:i?.noResolveJson},{},i?.body);return i?.xform?i?.xform(h):{data:Object.assign({},h),error:null}}async function s2(t,e,n,i,o,l){const u=r2(e,i,o,l);let d;try{d=await t(n,Object.assign({},u))}catch(h){throw console.error(h),new Zc(mr(h),0)}if(d.ok||await ty(d),i?.noResolveJson)return d;try{return await d.json()}catch(h){await ty(h)}}function Yt(t){var e;let n=null;a2(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=Vj(t.expires_in)));const i=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:i},error:null}}function ny(t){const e=Yt(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((n,i)=>n&&typeof i=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Hn(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function i2(t){return{data:t,error:null}}function o2(t){const{action_link:e,email_otp:n,hashed_token:i,redirect_to:o,verification_type:l}=t,u=Wa(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),d={action_link:e,email_otp:n,hashed_token:i,redirect_to:o,verification_type:l},h=Object.assign({},u);return{data:{properties:d,user:h},error:null}}function ry(t){return t}function a2(t){return t.access_token&&t.refresh_token&&t.expires_in}const vc=["global","local","others"];class l2{constructor({url:e="",headers:n={},fetch:i}){this.url=e,this.headers=n,this.fetch=T0(i),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,n=vc[0]){if(vc.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${vc.join(", ")}`);try{return await ce(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(i){if(ne(i))return{data:null,error:i};throw i}}async inviteUserByEmail(e,n={}){try{return await ce(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:Hn})}catch(i){if(ne(i))return{data:{user:null},error:i};throw i}}async generateLink(e){try{const{options:n}=e,i=Wa(e,["options"]),o=Object.assign(Object.assign({},i),n);return"newEmail"in i&&(o.new_email=i?.newEmail,delete o.newEmail),await ce(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:o,headers:this.headers,xform:o2,redirectTo:n?.redirectTo})}catch(n){if(ne(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(e){try{return await ce(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Hn})}catch(n){if(ne(n))return{data:{user:null},error:n};throw n}}async listUsers(e){var n,i,o,l,u,d,h;try{const m={nextPage:null,lastPage:0,total:0},y=await ce(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(i=(n=e?.page)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:"",per_page:(l=(o=e?.perPage)===null||o===void 0?void 0:o.toString())!==null&&l!==void 0?l:""},xform:ry});if(y.error)throw y.error;const v=await y.json(),w=(u=y.headers.get("x-total-count"))!==null&&u!==void 0?u:0,_=(h=(d=y.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&h!==void 0?h:[];return _.length>0&&(_.forEach(b=>{const k=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),S=JSON.parse(b.split(";")[1].split("=")[1]);m[`${S}Page`]=k}),m.total=parseInt(w)),{data:Object.assign(Object.assign({},v),m),error:null}}catch(m){if(ne(m))return{data:{users:[]},error:m};throw m}}async getUserById(e){es(e);try{return await ce(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Hn})}catch(n){if(ne(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){es(e);try{return await ce(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:Hn})}catch(i){if(ne(i))return{data:{user:null},error:i};throw i}}async deleteUser(e,n=!1){es(e);try{return await ce(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:Hn})}catch(i){if(ne(i))return{data:{user:null},error:i};throw i}}async _listFactors(e){es(e.userId);try{const{data:n,error:i}=await ce(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:o=>({data:{factors:o},error:null})});return{data:n,error:i}}catch(n){if(ne(n))return{data:null,error:n};throw n}}async _deleteFactor(e){es(e.userId),es(e.id);try{return{data:await ce(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(ne(n))return{data:null,error:n};throw n}}async _listOAuthClients(e){var n,i,o,l,u,d,h;try{const m={nextPage:null,lastPage:0,total:0},y=await ce(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(i=(n=e?.page)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:"",per_page:(l=(o=e?.perPage)===null||o===void 0?void 0:o.toString())!==null&&l!==void 0?l:""},xform:ry});if(y.error)throw y.error;const v=await y.json(),w=(u=y.headers.get("x-total-count"))!==null&&u!==void 0?u:0,_=(h=(d=y.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&h!==void 0?h:[];return _.length>0&&(_.forEach(b=>{const k=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),S=JSON.parse(b.split(";")[1].split("=")[1]);m[`${S}Page`]=k}),m.total=parseInt(w)),{data:Object.assign(Object.assign({},v),m),error:null}}catch(m){if(ne(m))return{data:{clients:[]},error:m};throw m}}async _createOAuthClient(e){try{return await ce(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ne(n))return{data:null,error:n};throw n}}async _getOAuthClient(e){try{return await ce(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ne(n))return{data:null,error:n};throw n}}async _updateOAuthClient(e,n){try{return await ce(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:n,headers:this.headers,xform:i=>({data:i,error:null})})}catch(i){if(ne(i))return{data:null,error:i};throw i}}async _deleteOAuthClient(e){try{return await ce(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(ne(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(e){try{return await ce(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ne(n))return{data:null,error:n};throw n}}}function sy(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}const ts={debug:!!(globalThis&&E0()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class j0 extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class u2 extends j0{}async function c2(t,e,n){ts.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const i=new globalThis.AbortController;return e>0&&setTimeout(()=>{i.abort(),ts.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:i.signal},async o=>{if(o){ts.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,o.name);try{return await n()}finally{ts.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,o.name)}}else{if(e===0)throw ts.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new u2(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(ts.debug)try{const l=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(l,null," "))}catch(l){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",l)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await n()}}))}function d2(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function C0(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function h2(t){return parseInt(t,16)}function f2(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,i=>i.toString(16).padStart(2,"0")).join("")}function p2(t){var e;const{chainId:n,domain:i,expirationTime:o,issuedAt:l=new Date,nonce:u,notBefore:d,requestId:h,resources:m,scheme:y,uri:v,version:w}=t;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!i)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(u&&u.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${u}`);if(!v)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(w!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${w}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
48
- `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const _=C0(t.address),b=y?`${y}://${i}`:i,k=t.statement?`${t.statement}
49
- `:"",S=`${b} wants you to sign in with your Ethereum account:
46
+ })`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const i=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(i),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(e?this.conn.close(e,n??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const n=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const e=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,n,i){this.logger(e,n,i)}connectionState(){switch(this.conn&&this.conn.readyState){case Hn.connecting:return gr.Connecting;case Hn.open:return gr.Open;case Hn.closing:return gr.Closing;default:return gr.Closed}}isConnected(){return this.connectionState()===gr.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,n={config:{}}){const i=`realtime:${e}`,o=this.getChannels().find(l=>l.topic===i);if(o)return o;{const l=new hs(`realtime:${e}`,n,this);return this.channels.push(l),l}}push(e){const{topic:n,event:i,payload:o,ref:l}=e,u=()=>{this.encode(e,d=>{var h;(h=this.conn)===null||h===void 0||h.send(d)})};this.log("push",`${n} ${i} (${l})`,o),this.isConnected()?u():this.sendBuffer.push(u)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this._heartbeatSentAt=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(RT,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},ca.HEARTBEAT_TIMEOUT_FALLBACK);return}this._heartbeatSentAt=Date.now(),this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(n){this.log("error","error in heartbeat callback",n)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let n=this.channels.find(i=>i.topic===e&&(i._isJoined()||i._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${e}"`),n.unsubscribe())}_remove(e){this.channels=this.channels.filter(n=>n.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply"&&n.ref&&n.ref===this.pendingHeartbeatRef){const m=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error",m)}catch(y){this.log("error","error in heartbeat callback",y)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:i,event:o,payload:l,ref:u}=n,d=u?`(${u})`:"",h=l.status||"";this.log("receive",`${h} ${i} ${o} ${d}`.trim(),l),this.channels.filter(m=>m._isMember(i)).forEach(m=>m._trigger(o,l,u)),this._triggerStateCallbacks("message",n)})}_clearTimer(e){var n;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e),this.conn.readyState===Hn.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Hn.open||this.conn.readyState===Hn.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(n=>{this.log("error","error waiting for auth on connect",n),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this._terminateWorker()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(e){var n;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(Zt.error))}_appendParams(e,n){if(Object.keys(n).length===0)return e;const i=e.match(/\?/)?"&":"?",o=new URLSearchParams(n);return`${e}${i}${o}`}_workerObjectUrl(e){let n;if(e)n=e;else{const i=new Blob([zT],{type:"application/javascript"});n=URL.createObjectURL(i)}return n}_setConnectionState(e,n=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(e=null){let n,i=!1;if(e)n=e,i=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(o){this.log("error","Error fetching access token from callback",o),n=this.accessTokenValue}else n=this.accessTokenValue;i?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(o=>{const l={access_token:n,version:AT};n&&o.updateJoinPayload(l),o.joinedOnce&&o._isJoined()&&o._push(Zt.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${e}`,n)})}_triggerStateCallbacks(e,n){try{this.stateChangeCallbacks[e].forEach(i=>{try{i(n)}catch(o){this.log("error",`error in ${e} callback`,o)}})}catch(i){this.log("error",`error triggering ${e} callbacks`,i)}}_setupReconnectionTimer(){this.reconnectTimer=new m0(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},ca.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var n,i,o,l,u,d,h,m,y,v,w,_;switch(this.transport=(n=e?.transport)!==null&&n!==void 0?n:null,this.timeout=(i=e?.timeout)!==null&&i!==void 0?i:Hc,this.heartbeatIntervalMs=(o=e?.heartbeatIntervalMs)!==null&&o!==void 0?o:ca.HEARTBEAT_INTERVAL,this.worker=(l=e?.worker)!==null&&l!==void 0?l:!1,this.accessToken=(u=e?.accessToken)!==null&&u!==void 0?u:null,this.heartbeatCallback=(d=e?.heartbeatCallback)!==null&&d!==void 0?d:hc,this.vsn=(h=e?.vsn)!==null&&h!==void 0?h:Bg,e?.params&&(this.params=e.params),e?.logger&&(this.logger=e.logger),(e?.logLevel||e?.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(m=e?.reconnectAfterMs)!==null&&m!==void 0?m:(b=>FT[b-1]||BT),this.vsn){case PT:this.encode=(y=e?.encode)!==null&&y!==void 0?y:((b,S)=>S(JSON.stringify(b))),this.decode=(v=e?.decode)!==null&&v!==void 0?v:((b,S)=>S(JSON.parse(b)));break;case p0:this.encode=(w=e?.encode)!==null&&w!==void 0?w:this.serializer.encode.bind(this.serializer),this.decode=(_=e?.decode)!==null&&_!==void 0?_:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e?.workerUrl}}}var Ai=class extends Error{constructor(t,e){super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&e.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function WT(t,e,n){const i=new URL(e,t);if(n)for(const[o,l]of Object.entries(n))l!==void 0&&i.searchParams.set(o,l);return i.toString()}async function HT(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function KT(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:n,path:i,query:o,body:l,headers:u}){const d=WT(t.baseUrl,i,o),h=await HT(t.auth),m=await e(d,{method:n,headers:{...l?{"Content-Type":"application/json"}:{},...h,...u},body:l?JSON.stringify(l):void 0}),y=await m.text(),v=(m.headers.get("content-type")||"").includes("application/json"),w=v&&y?JSON.parse(y):y;if(!m.ok){const _=v?w:void 0,b=_?.error;throw new Ai(b?.message??`Request failed with status ${m.status}`,{status:m.status,icebergType:b?.type,icebergCode:b?.code,details:_})}return{status:m.status,headers:m.headers,data:w}}}}function da(t){return t.join("")}var GT=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:da(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(i=>({namespace:i}))}async createNamespace(t,e){const n={namespace:t.namespace,properties:e?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${da(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${da(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${da(t.namespace)}`}),!0}catch(e){if(e instanceof Ai&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(n){if(n instanceof Ai&&n.status===409)return;throw n}}};function Xr(t){return t.join("")}var JT=class{constructor(t,e="",n){this.client=t,this.prefix=e,this.accessDelegation=n}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables`,body:e,headers:n})).data.metadata}async updateTable(t,e){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(e?.purge??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(n){if(n instanceof Ai&&n.status===404)return!1;throw n}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(n){if(n instanceof Ai&&n.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw n}}},YT=class{constructor(t){let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const n=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=KT({baseUrl:n,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new GT(this.client,e),this.tableOps=new JT(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}},Ka=class extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}};function Fe(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var QT=class extends Ka{constructor(t,e,n){super(t),this.name="StorageApiError",this.status=e,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Jc=class extends Ka{constructor(t,e){super(t),this.name="StorageUnknownError",this.originalError=e}};const Wd=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),XT=()=>Response,Yc=t=>{if(Array.isArray(t))return t.map(n=>Yc(n));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([n,i])=>{const o=n.replace(/([-_][a-z])/gi,l=>l.toUpperCase().replace(/[-_]/g,""));e[o]=Yc(i)}),e},ZT=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},ej=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t);function Pi(t){"@babel/helpers - typeof";return Pi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pi(t)}function tj(t,e){if(Pi(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(Pi(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function nj(t){var e=tj(t,"string");return Pi(e)=="symbol"?e:e+""}function rj(t,e,n){return(e=nj(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Hg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,i)}return n}function he(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Hg(Object(n),!0).forEach(function(i){rj(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Hg(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}const fc=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},sj=async(t,e,n)=>{t instanceof await XT()&&!n?.noResolveJson?t.json().then(i=>{const o=t.status||500,l=i?.statusCode||o+"";e(new QT(fc(i),o,l))}).catch(i=>{e(new Jc(fc(i),i))}):e(new Jc(fc(t),t))},ij=(t,e,n,i)=>{const o={method:t,headers:e?.headers||{}};return t==="GET"||!i?o:(ZT(i)?(o.headers=he({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(i)):o.body=i,e?.duplex&&(o.duplex=e.duplex),he(he({},o),n))};async function Hi(t,e,n,i,o,l){return new Promise((u,d)=>{t(n,ij(e,i,o,l)).then(h=>{if(!h.ok)throw h;return i?.noResolveJson?h:h.json()}).then(h=>u(h)).catch(h=>sj(h,d,i))})}async function Ri(t,e,n,i){return Hi(t,"GET",e,n,i)}async function Xt(t,e,n,i,o){return Hi(t,"POST",e,i,o,n)}async function Qc(t,e,n,i,o){return Hi(t,"PUT",e,i,o,n)}async function oj(t,e,n,i){return Hi(t,"HEAD",e,he(he({},n),{},{noResolveJson:!0}),i)}async function Hd(t,e,n,i,o){return Hi(t,"DELETE",e,i,o,n)}var aj=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(Fe(e))return{data:null,error:e};throw e}}};let v0;v0=Symbol.toStringTag;var lj=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[v0]="BlobDownloadBuilder",this.promise=null}asStream(){return new aj(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(Fe(e))return{data:null,error:e};throw e}}};const uj={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Kg={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var cj=class{constructor(t,e={},n,i){this.shouldThrowOnError=!1,this.url=t,this.headers=e,this.bucketId=n,this.fetch=Wd(i)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(t,e,n,i){var o=this;try{let l;const u=he(he({},Kg),i);let d=he(he({},o.headers),t==="POST"&&{"x-upsert":String(u.upsert)});const h=u.metadata;typeof Blob<"u"&&n instanceof Blob?(l=new FormData,l.append("cacheControl",u.cacheControl),h&&l.append("metadata",o.encodeMetadata(h)),l.append("",n)):typeof FormData<"u"&&n instanceof FormData?(l=n,l.has("cacheControl")||l.append("cacheControl",u.cacheControl),h&&!l.has("metadata")&&l.append("metadata",o.encodeMetadata(h))):(l=n,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType,h&&(d["x-metadata"]=o.toBase64(o.encodeMetadata(h))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!u.duplex&&(u.duplex="half")),i?.headers&&(d=he(he({},d),i.headers));const m=o._removeEmptyFolders(e),y=o._getFinalPath(m),v=await(t=="PUT"?Qc:Xt)(o.fetch,`${o.url}/object/${y}`,l,he({headers:d},u?.duplex?{duplex:u.duplex}:{}));return{data:{path:m,id:v.Id,fullPath:v.Key},error:null}}catch(l){if(o.shouldThrowOnError)throw l;if(Fe(l))return{data:null,error:l};throw l}}async upload(t,e,n){return this.uploadOrUpdate("POST",t,e,n)}async uploadToSignedUrl(t,e,n,i){var o=this;const l=o._removeEmptyFolders(t),u=o._getFinalPath(l),d=new URL(o.url+`/object/upload/sign/${u}`);d.searchParams.set("token",e);try{let h;const m=he({upsert:Kg.upsert},i),y=he(he({},o.headers),{"x-upsert":String(m.upsert)});return typeof Blob<"u"&&n instanceof Blob?(h=new FormData,h.append("cacheControl",m.cacheControl),h.append("",n)):typeof FormData<"u"&&n instanceof FormData?(h=n,h.append("cacheControl",m.cacheControl)):(h=n,y["cache-control"]=`max-age=${m.cacheControl}`,y["content-type"]=m.contentType),{data:{path:l,fullPath:(await Qc(o.fetch,d.toString(),h,{headers:y})).Key},error:null}}catch(h){if(o.shouldThrowOnError)throw h;if(Fe(h))return{data:null,error:h};throw h}}async createSignedUploadUrl(t,e){var n=this;try{let i=n._getFinalPath(t);const o=he({},n.headers);e?.upsert&&(o["x-upsert"]="true");const l=await Xt(n.fetch,`${n.url}/object/upload/sign/${i}`,{},{headers:o}),u=new URL(n.url+l.url),d=u.searchParams.get("token");if(!d)throw new Ka("No token returned by API");return{data:{signedUrl:u.toString(),path:t,token:d},error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}async update(t,e,n){return this.uploadOrUpdate("PUT",t,e,n)}async move(t,e,n){var i=this;try{return{data:await Xt(i.fetch,`${i.url}/object/move`,{bucketId:i.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n?.destinationBucket},{headers:i.headers}),error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}async copy(t,e,n){var i=this;try{return{data:{path:(await Xt(i.fetch,`${i.url}/object/copy`,{bucketId:i.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n?.destinationBucket},{headers:i.headers})).Key},error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}async createSignedUrl(t,e,n){var i=this;try{let o=i._getFinalPath(t),l=await Xt(i.fetch,`${i.url}/object/sign/${o}`,he({expiresIn:e},n?.transform?{transform:n.transform}:{}),{headers:i.headers});const u=n?.download?`&download=${n.download===!0?"":n.download}`:"";return l={signedUrl:encodeURI(`${i.url}${l.signedURL}${u}`)},{data:l,error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}async createSignedUrls(t,e,n){var i=this;try{const o=await Xt(i.fetch,`${i.url}/object/sign/${i.bucketId}`,{expiresIn:e,paths:t},{headers:i.headers}),l=n?.download?`&download=${n.download===!0?"":n.download}`:"";return{data:o.map(u=>he(he({},u),{},{signedUrl:u.signedURL?encodeURI(`${i.url}${u.signedURL}${l}`):null})),error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}download(t,e){const n=typeof e?.transform<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString(e?.transform||{}),o=i?`?${i}`:"",l=this._getFinalPath(t),u=()=>Ri(this.fetch,`${this.url}/${n}/${l}${o}`,{headers:this.headers,noResolveJson:!0});return new lj(u,this.shouldThrowOnError)}async info(t){var e=this;const n=e._getFinalPath(t);try{return{data:Yc(await Ri(e.fetch,`${e.url}/object/info/${n}`,{headers:e.headers})),error:null}}catch(i){if(e.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}async exists(t){var e=this;const n=e._getFinalPath(t);try{return await oj(e.fetch,`${e.url}/object/${n}`,{headers:e.headers}),{data:!0,error:null}}catch(i){if(e.shouldThrowOnError)throw i;if(Fe(i)&&i instanceof Jc){const o=i.originalError;if([400,404].includes(o?.status))return{data:!1,error:i}}throw i}}getPublicUrl(t,e){const n=this._getFinalPath(t),i=[],o=e?.download?`download=${e.download===!0?"":e.download}`:"";o!==""&&i.push(o);const l=typeof e?.transform<"u"?"render/image":"object",u=this.transformOptsToQueryString(e?.transform||{});u!==""&&i.push(u);let d=i.join("&");return d!==""&&(d=`?${d}`),{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${n}${d}`)}}}async remove(t){var e=this;try{return{data:await Hd(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async list(t,e,n){var i=this;try{const o=he(he(he({},uj),e),{},{prefix:t||""});return{data:await Xt(i.fetch,`${i.url}/object/list/${i.bucketId}`,o,{headers:i.headers},n),error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}async listV2(t,e){var n=this;try{const i=he({},t);return{data:await Xt(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,i,{headers:n.headers},e),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const e=[];return t.width&&e.push(`width=${t.width}`),t.height&&e.push(`height=${t.height}`),t.resize&&e.push(`resize=${t.resize}`),t.format&&e.push(`format=${t.format}`),t.quality&&e.push(`quality=${t.quality}`),e.join("&")}};const w0="2.91.0",x0={"X-Client-Info":`storage-js/${w0}`};var dj=class{constructor(t,e={},n,i){this.shouldThrowOnError=!1;const o=new URL(t);i?.useNewHostname&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase.")),this.url=o.href.replace(/\/$/,""),this.headers=he(he({},x0),e),this.fetch=Wd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(t){var e=this;try{const n=e.listBucketOptionsToQueryString(t);return{data:await Ri(e.fetch,`${e.url}/bucket${n}`,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async getBucket(t){var e=this;try{return{data:await Ri(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async createBucket(t,e={public:!1}){var n=this;try{return{data:await Xt(n.fetch,`${n.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}async updateBucket(t,e){var n=this;try{return{data:await Qc(n.fetch,`${n.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}async emptyBucket(t){var e=this;try{return{data:await Xt(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async deleteBucket(t){var e=this;try{return{data:await Hd(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},hj=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=he(he({},x0),e),this.fetch=Wd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await Xt(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async listBuckets(t){var e=this;try{const n=new URLSearchParams;t?.limit!==void 0&&n.set("limit",t.limit.toString()),t?.offset!==void 0&&n.set("offset",t.offset.toString()),t?.sortColumn&&n.set("sortColumn",t.sortColumn),t?.sortOrder&&n.set("sortOrder",t.sortOrder),t?.search&&n.set("search",t.search);const i=n.toString(),o=i?`${e.url}/bucket?${i}`:`${e.url}/bucket`;return{data:await Ri(e.fetch,o,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async deleteBucket(t){var e=this;try{return{data:await Hd(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}from(t){var e=this;if(!ej(t))throw new Ka("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new YT({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),i=this.shouldThrowOnError;return new Proxy(n,{get(o,l){const u=o[l];return typeof u!="function"?u:async(...d)=>{try{return{data:await u.apply(o,d),error:null}}catch(h){if(i)throw h;return{data:null,error:h}}}}})}};const Kd={"X-Client-Info":`storage-js/${w0}`,"Content-Type":"application/json"};var b0=class extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Pt(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var pc=class extends b0{constructor(t,e,n){super(t),this.name="StorageVectorsApiError",this.status=e,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},fj=class extends b0{constructor(t,e){super(t),this.name="StorageVectorsUnknownError",this.originalError=e}};const Gd=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),pj=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Gg=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),mj=async(t,e,n)=>{if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!n?.noResolveJson){const i=t.status||500,o=t;if(typeof o.json=="function")o.json().then(l=>{const u=l?.statusCode||l?.code||i+"";e(new pc(Gg(l),i,u))}).catch(()=>{const l=i+"";e(new pc(o.statusText||`HTTP ${i} error`,i,l))});else{const l=i+"";e(new pc(o.statusText||`HTTP ${i} error`,i,l))}}else e(new fj(Gg(t),t))},gj=(t,e,n,i)=>{const o={method:t,headers:e?.headers||{}};return i?(pj(i)?(o.headers=he({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(i)):o.body=i,he(he({},o),n)):o};async function yj(t,e,n,i,o,l){return new Promise((u,d)=>{t(n,gj(e,i,o,l)).then(h=>{if(!h.ok)throw h;if(i?.noResolveJson)return h;const m=h.headers.get("content-type");return!m||!m.includes("application/json")?{}:h.json()}).then(h=>u(h)).catch(h=>mj(h,d,i))})}async function Rt(t,e,n,i,o){return yj(t,"POST",e,i,o,n)}var vj=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=he(he({},Kd),e),this.fetch=Gd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async getIndex(t,e){var n=this;try{return{data:await Rt(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers}),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Pt(i))return{data:null,error:i};throw i}}async listIndexes(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async deleteIndex(t,e){var n=this;try{return{data:await Rt(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers})||{},error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Pt(i))return{data:null,error:i};throw i}}},wj=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=he(he({},Kd),e),this.fetch=Gd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(t){var e=this;try{if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await Rt(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async getVectors(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async listVectors(t){var e=this;try{if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return{data:await Rt(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async queryVectors(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async deleteVectors(t){var e=this;try{if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await Rt(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}},xj=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=he(he({},Kd),e),this.fetch=Gd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async getBucket(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async listBuckets(t={}){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async deleteBucket(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}},bj=class extends xj{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new _j(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,n=this;return e().call(n,t)}async getBucket(t){var e=()=>super.getBucket,n=this;return e().call(n,t)}async listBuckets(t={}){var e=()=>super.listBuckets,n=this;return e().call(n,t)}async deleteBucket(t){var e=()=>super.deleteBucket,n=this;return e().call(n,t)}},_j=class extends vj{constructor(t,e,n,i){super(t,e,i),this.vectorBucketName=n}async createIndex(t){var e=()=>super.createIndex,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,n=this;return e().call(n,n.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,n=this;return e().call(n,n.vectorBucketName,t)}index(t){return new Sj(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},Sj=class extends wj{constructor(t,e,n,i,o){super(t,e,o),this.vectorBucketName=n,this.indexName=i}async putVectors(t){var e=()=>super.putVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(t){var e=()=>super.getVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},kj=class extends dj{constructor(t,e={},n,i){super(t,e,n,i)}from(t){return new cj(this.url,this.headers,t,this.fetch)}get vectors(){return new bj(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new hj(this.url+"/iceberg",this.headers,this.fetch)}};const _0="2.91.0",is=30*1e3,Xc=3,mc=Xc*is,Ej="http://localhost:9999",Tj="supabase.auth.token",jj={"X-Client-Info":`gotrue-js/${_0}`},Zc="X-Supabase-Api-Version",S0={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Cj=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Nj=600*1e3;class Oi extends Error{constructor(e,n,i){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=i}}function ne(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class Aj extends Oi{constructor(e,n,i){super(e,n,i),this.name="AuthApiError",this.status=n,this.code=i}}function Pj(t){return ne(t)&&t.name==="AuthApiError"}class yr extends Oi{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class kn extends Oi{constructor(e,n,i,o){super(e,i,o),this.name=n,this.status=i}}class At extends kn{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Rj(t){return ne(t)&&t.name==="AuthSessionMissingError"}class Zr extends kn{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class ha extends kn{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class fa extends kn{constructor(e,n=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function Oj(t){return ne(t)&&t.name==="AuthImplicitGrantRedirectError"}class Jg extends kn{constructor(e,n=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Ij extends kn{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class ed extends kn{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function gc(t){return ne(t)&&t.name==="AuthRetryableFetchError"}class Yg extends kn{constructor(e,n,i){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=i}}class td extends kn{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Aa="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Qg=`
47
+ \r=`.split(""),Dj=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<Qg.length;e+=1)t[Qg[e].charCodeAt(0)]=-2;for(let e=0;e<Aa.length;e+=1)t[Aa[e].charCodeAt(0)]=e;return t})();function Xg(t,e,n){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const i=e.queue>>e.queuedBits-6&63;n(Aa[i]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const i=e.queue>>e.queuedBits-6&63;n(Aa[i]),e.queuedBits-=6}}function k0(t,e,n){const i=Dj[t];if(i>-1)for(e.queue=e.queue<<6|i,e.queuedBits+=6;e.queuedBits>=8;)n(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(i===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function Zg(t){const e=[],n=u=>{e.push(String.fromCodePoint(u))},i={utf8seq:0,codepoint:0},o={queue:0,queuedBits:0},l=u=>{Uj(u,i,n)};for(let u=0;u<t.length;u+=1)k0(t.charCodeAt(u),o,l);return e.join("")}function Lj(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function Mj(t,e){for(let n=0;n<t.length;n+=1){let i=t.charCodeAt(n);if(i>55295&&i<=56319){const o=(i-55296)*1024&65535;i=(t.charCodeAt(n+1)-56320&65535|o)+65536,n+=1}Lj(i,e)}}function Uj(t,e,n){if(e.utf8seq===0){if(t<=127){n(t);return}for(let i=1;i<6;i+=1)if((t>>7-i&1)===0){e.utf8seq=i;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&n(e.codepoint)}}function fs(t){const e=[],n={queue:0,queuedBits:0},i=o=>{e.push(o)};for(let o=0;o<t.length;o+=1)k0(t.charCodeAt(o),n,i);return new Uint8Array(e)}function $j(t){const e=[];return Mj(t,n=>e.push(n)),new Uint8Array(e)}function xr(t){const e=[],n={queue:0,queuedBits:0},i=o=>{e.push(o)};return t.forEach(o=>Xg(o,n,i)),Xg(null,n,i),e.join("")}function Vj(t){return Math.round(Date.now()/1e3)+t}function Fj(){return Symbol("auth-callback")}const ot=()=>typeof window<"u"&&typeof document<"u",dr={tested:!1,writable:!1},E0=()=>{if(!ot())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(dr.tested)return dr.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),dr.tested=!0,dr.writable=!0}catch{dr.tested=!0,dr.writable=!1}return dr.writable};function Bj(t){const e={},n=new URL(t);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((o,l)=>{e[l]=o})}catch{}return n.searchParams.forEach((i,o)=>{e[o]=i}),e}const T0=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),zj=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",os=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},hr=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return n}},it=async(t,e)=>{await t.removeItem(e)};class Ga{constructor(){this.promise=new Ga.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}Ga.promiseConstructor=Promise;function yc(t){const e=t.split(".");if(e.length!==3)throw new td("Invalid JWT structure");for(let i=0;i<e.length;i++)if(!Cj.test(e[i]))throw new td("JWT not in base64url format");return{header:JSON.parse(Zg(e[0])),payload:JSON.parse(Zg(e[1])),signature:fs(e[2]),raw:{header:e[0],payload:e[1]}}}async function qj(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function Wj(t,e){return new Promise((i,o)=>{(async()=>{for(let l=0;l<1/0;l++)try{const u=await t(l);if(!e(l,null,u)){i(u);return}}catch(u){if(!e(l,u)){o(u);return}}})()})}function Hj(t){return("0"+t.toString(16)).substr(-2)}function Kj(){const e=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",i=n.length;let o="";for(let l=0;l<56;l++)o+=n.charAt(Math.floor(Math.random()*i));return o}return crypto.getRandomValues(e),Array.from(e,Hj).join("")}async function Gj(t){const n=new TextEncoder().encode(t),i=await crypto.subtle.digest("SHA-256",n),o=new Uint8Array(i);return Array.from(o).map(l=>String.fromCharCode(l)).join("")}async function Jj(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const n=await Gj(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function es(t,e,n=!1){const i=Kj();let o=i;n&&(o+="/PASSWORD_RECOVERY"),await os(t,`${e}-code-verifier`,o);const l=await Jj(i);return[l,i===l?"plain":"s256"]}const Yj=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Qj(t){const e=t.headers.get(Zc);if(!e||!e.match(Yj))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function Xj(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function Zj(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const e2=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function ts(t){if(!e2.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function vc(){const t={};return new Proxy(t,{get:(e,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const i=n.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function t2(t,e){return new Proxy(t,{get:(n,i,o)=>{if(i==="__isInsecureUserWarningProxy")return!0;if(typeof i=="symbol"){const l=i.toString();if(l==="Symbol(Symbol.toPrimitive)"||l==="Symbol(Symbol.toStringTag)"||l==="Symbol(util.inspect.custom)"||l==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,i,o)}return!e.value&&typeof i=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(n,i,o)}})}function ey(t){return JSON.parse(JSON.stringify(t))}const mr=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),n2=[502,503,504];async function ty(t){var e;if(!zj(t))throw new ed(mr(t),0);if(n2.includes(t.status))throw new ed(mr(t),t.status);let n;try{n=await t.json()}catch(l){throw new yr(mr(l),l)}let i;const o=Qj(t);if(o&&o.getTime()>=S0["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?i=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(i=n.error_code),i){if(i==="weak_password")throw new Yg(mr(n),t.status,((e=n.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(i==="session_not_found")throw new At}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((l,u)=>l&&typeof u=="string",!0))throw new Yg(mr(n),t.status,n.weak_password.reasons);throw new Aj(mr(n),t.status||500,i)}const r2=(t,e,n,i)=>{const o={method:t,headers:e?.headers||{}};return t==="GET"?o:(o.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e?.headers),o.body=JSON.stringify(i),Object.assign(Object.assign({},o),n))};async function ce(t,e,n,i){var o;const l=Object.assign({},i?.headers);l[Zc]||(l[Zc]=S0["2024-01-01"].name),i?.jwt&&(l.Authorization=`Bearer ${i.jwt}`);const u=(o=i?.query)!==null&&o!==void 0?o:{};i?.redirectTo&&(u.redirect_to=i.redirectTo);const d=Object.keys(u).length?"?"+new URLSearchParams(u).toString():"",h=await s2(t,e,n+d,{headers:l,noResolveJson:i?.noResolveJson},{},i?.body);return i?.xform?i?.xform(h):{data:Object.assign({},h),error:null}}async function s2(t,e,n,i,o,l){const u=r2(e,i,o,l);let d;try{d=await t(n,Object.assign({},u))}catch(h){throw console.error(h),new ed(mr(h),0)}if(d.ok||await ty(d),i?.noResolveJson)return d;try{return await d.json()}catch(h){await ty(h)}}function Yt(t){var e;let n=null;a2(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=Vj(t.expires_in)));const i=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:i},error:null}}function ny(t){const e=Yt(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((n,i)=>n&&typeof i=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Kn(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function i2(t){return{data:t,error:null}}function o2(t){const{action_link:e,email_otp:n,hashed_token:i,redirect_to:o,verification_type:l}=t,u=Ha(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),d={action_link:e,email_otp:n,hashed_token:i,redirect_to:o,verification_type:l},h=Object.assign({},u);return{data:{properties:d,user:h},error:null}}function ry(t){return t}function a2(t){return t.access_token&&t.refresh_token&&t.expires_in}const wc=["global","local","others"];class l2{constructor({url:e="",headers:n={},fetch:i}){this.url=e,this.headers=n,this.fetch=T0(i),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,n=wc[0]){if(wc.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${wc.join(", ")}`);try{return await ce(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(i){if(ne(i))return{data:null,error:i};throw i}}async inviteUserByEmail(e,n={}){try{return await ce(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:Kn})}catch(i){if(ne(i))return{data:{user:null},error:i};throw i}}async generateLink(e){try{const{options:n}=e,i=Ha(e,["options"]),o=Object.assign(Object.assign({},i),n);return"newEmail"in i&&(o.new_email=i?.newEmail,delete o.newEmail),await ce(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:o,headers:this.headers,xform:o2,redirectTo:n?.redirectTo})}catch(n){if(ne(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(e){try{return await ce(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Kn})}catch(n){if(ne(n))return{data:{user:null},error:n};throw n}}async listUsers(e){var n,i,o,l,u,d,h;try{const m={nextPage:null,lastPage:0,total:0},y=await ce(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(i=(n=e?.page)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:"",per_page:(l=(o=e?.perPage)===null||o===void 0?void 0:o.toString())!==null&&l!==void 0?l:""},xform:ry});if(y.error)throw y.error;const v=await y.json(),w=(u=y.headers.get("x-total-count"))!==null&&u!==void 0?u:0,_=(h=(d=y.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&h!==void 0?h:[];return _.length>0&&(_.forEach(b=>{const S=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(b.split(";")[1].split("=")[1]);m[`${k}Page`]=S}),m.total=parseInt(w)),{data:Object.assign(Object.assign({},v),m),error:null}}catch(m){if(ne(m))return{data:{users:[]},error:m};throw m}}async getUserById(e){ts(e);try{return await ce(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Kn})}catch(n){if(ne(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){ts(e);try{return await ce(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:Kn})}catch(i){if(ne(i))return{data:{user:null},error:i};throw i}}async deleteUser(e,n=!1){ts(e);try{return await ce(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:Kn})}catch(i){if(ne(i))return{data:{user:null},error:i};throw i}}async _listFactors(e){ts(e.userId);try{const{data:n,error:i}=await ce(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:o=>({data:{factors:o},error:null})});return{data:n,error:i}}catch(n){if(ne(n))return{data:null,error:n};throw n}}async _deleteFactor(e){ts(e.userId),ts(e.id);try{return{data:await ce(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(ne(n))return{data:null,error:n};throw n}}async _listOAuthClients(e){var n,i,o,l,u,d,h;try{const m={nextPage:null,lastPage:0,total:0},y=await ce(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(i=(n=e?.page)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:"",per_page:(l=(o=e?.perPage)===null||o===void 0?void 0:o.toString())!==null&&l!==void 0?l:""},xform:ry});if(y.error)throw y.error;const v=await y.json(),w=(u=y.headers.get("x-total-count"))!==null&&u!==void 0?u:0,_=(h=(d=y.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&h!==void 0?h:[];return _.length>0&&(_.forEach(b=>{const S=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(b.split(";")[1].split("=")[1]);m[`${k}Page`]=S}),m.total=parseInt(w)),{data:Object.assign(Object.assign({},v),m),error:null}}catch(m){if(ne(m))return{data:{clients:[]},error:m};throw m}}async _createOAuthClient(e){try{return await ce(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ne(n))return{data:null,error:n};throw n}}async _getOAuthClient(e){try{return await ce(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ne(n))return{data:null,error:n};throw n}}async _updateOAuthClient(e,n){try{return await ce(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:n,headers:this.headers,xform:i=>({data:i,error:null})})}catch(i){if(ne(i))return{data:null,error:i};throw i}}async _deleteOAuthClient(e){try{return await ce(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(ne(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(e){try{return await ce(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ne(n))return{data:null,error:n};throw n}}}function sy(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}const ns={debug:!!(globalThis&&E0()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class j0 extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class u2 extends j0{}async function c2(t,e,n){ns.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const i=new globalThis.AbortController;return e>0&&setTimeout(()=>{i.abort(),ns.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:i.signal},async o=>{if(o){ns.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,o.name);try{return await n()}finally{ns.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,o.name)}}else{if(e===0)throw ns.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new u2(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(ns.debug)try{const l=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(l,null," "))}catch(l){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",l)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await n()}}))}function d2(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function C0(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function h2(t){return parseInt(t,16)}function f2(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,i=>i.toString(16).padStart(2,"0")).join("")}function p2(t){var e;const{chainId:n,domain:i,expirationTime:o,issuedAt:l=new Date,nonce:u,notBefore:d,requestId:h,resources:m,scheme:y,uri:v,version:w}=t;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!i)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(u&&u.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${u}`);if(!v)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(w!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${w}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
48
+ `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const _=C0(t.address),b=y?`${y}://${i}`:i,S=t.statement?`${t.statement}
49
+ `:"",k=`${b} wants you to sign in with your Ethereum account:
50
50
  ${_}
51
51
 
52
- ${k}`;let E=`URI: ${v}
52
+ ${S}`;let E=`URI: ${v}
53
53
  Version: ${w}
54
54
  Chain ID: ${n}${u?`
55
55
  Nonce: ${u}`:""}
56
56
  Issued At: ${l.toISOString()}`;if(o&&(E+=`
57
57
  Expiration Time: ${o.toISOString()}`),d&&(E+=`
58
58
  Not Before: ${d.toISOString()}`),h&&(E+=`
59
- Request ID: ${h}`),m){let A=`
60
- Resources:`;for(const P of m){if(!P||typeof P!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${P}`);A+=`
61
- - ${P}`}E+=A}return`${S}
62
- ${E}`}class Ye extends Error{constructor({message:e,code:n,cause:i,name:o}){var l;super(e,{cause:i}),this.__isWebAuthnError=!0,this.name=(l=o??(i instanceof Error?i.name:void 0))!==null&&l!==void 0?l:"Unknown Error",this.code=n}}class Aa extends Ye{constructor(e,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:e}),this.name="WebAuthnUnknownError",this.originalError=n}}function m2({error:t,options:e}){var n,i,o;const{publicKey:l}=e;if(!l)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Ye({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((n=l.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new Ye({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((i=l.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new Ye({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((o=l.authenticatorSelection)===null||o===void 0?void 0:o.userVerification)==="required")return new Ye({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new Ye({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Ye({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return l.pubKeyCredParams.filter(d=>d.type==="public-key").length===0?new Ye({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Ye({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const u=window.location.hostname;if(N0(u)){if(l.rp.id!==u)return new Ye({message:`The RP ID "${l.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Ye({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(l.user.id.byteLength<1||l.user.id.byteLength>64)return new Ye({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new Ye({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Ye({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function g2({error:t,options:e}){const{publicKey:n}=e;if(!n)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Ye({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Ye({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const i=window.location.hostname;if(N0(i)){if(n.rpId!==i)return new Ye({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Ye({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Ye({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Ye({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class y2{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const v2=new y2;function w2(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:n,excludeCredentials:i}=t,o=Wa(t,["challenge","user","excludeCredentials"]),l=hs(e).buffer,u=Object.assign(Object.assign({},n),{id:hs(n.id).buffer}),d=Object.assign(Object.assign({},o),{challenge:l,user:u});if(i&&i.length>0){d.excludeCredentials=new Array(i.length);for(let h=0;h<i.length;h++){const m=i[h];d.excludeCredentials[h]=Object.assign(Object.assign({},m),{id:hs(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function x2(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:n}=t,i=Wa(t,["challenge","allowCredentials"]),o=hs(e).buffer,l=Object.assign(Object.assign({},i),{challenge:o});if(n&&n.length>0){l.allowCredentials=new Array(n.length);for(let u=0;u<n.length;u++){const d=n[u];l.allowCredentials[u]=Object.assign(Object.assign({},d),{id:hs(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return l}function b2(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t;return{id:t.id,rawId:t.id,response:{attestationObject:xr(new Uint8Array(t.response.attestationObject)),clientDataJSON:xr(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function _2(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t,i=t.getClientExtensionResults(),o=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:xr(new Uint8Array(o.authenticatorData)),clientDataJSON:xr(new Uint8Array(o.clientDataJSON)),signature:xr(new Uint8Array(o.signature)),userHandle:o.userHandle?xr(new Uint8Array(o.userHandle)):void 0},type:"public-key",clientExtensionResults:i,authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function N0(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function iy(){var t,e;return!!(ot()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.get)=="function")}async function S2(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Aa("Browser returned unexpected credential type",e)}:{data:null,error:new Aa("Empty credential response",e)}}catch(e){return{data:null,error:m2({error:e,options:t})}}}async function k2(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Aa("Browser returned unexpected credential type",e)}:{data:null,error:new Aa("Empty credential response",e)}}catch(e){return{data:null,error:g2({error:e,options:t})}}}const E2={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},T2={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Pa(...t){const e=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),n=o=>o instanceof ArrayBuffer||ArrayBuffer.isView(o),i={};for(const o of t)if(o)for(const l in o){const u=o[l];if(u!==void 0)if(Array.isArray(u))i[l]=u;else if(n(u))i[l]=u;else if(e(u)){const d=i[l];e(d)?i[l]=Pa(d,u):i[l]=Pa(u)}else i[l]=u}return i}function j2(t,e){return Pa(E2,t,e||{})}function C2(t,e){return Pa(T2,t,e||{})}class N2{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:n,friendlyName:i,signal:o},l){try{const{data:u,error:d}=await this.client.mfa.challenge({factorId:e,webauthn:n});if(!u)return{data:null,error:d};const h=o??v2.createNewAbortSignal();if(u.webauthn.type==="create"){const{user:m}=u.webauthn.credential_options.publicKey;m.name||(m.name=`${m.id}:${i}`),m.displayName||(m.displayName=m.name)}switch(u.webauthn.type){case"create":{const m=j2(u.webauthn.credential_options.publicKey,l?.create),{data:y,error:v}=await S2({publicKey:m,signal:h});return y?{data:{factorId:e,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:y}},error:null}:{data:null,error:v}}case"request":{const m=C2(u.webauthn.credential_options.publicKey,l?.request),{data:y,error:v}=await k2(Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:m,signal:h}));return y?{data:{factorId:e,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:y}},error:null}:{data:null,error:v}}}}catch(u){return ne(u)?{data:null,error:u}:{data:null,error:new yr("Unexpected error in challenge",u)}}}async _verify({challengeId:e,factorId:n,webauthn:i}){return this.client.mfa.verify({factorId:n,challengeId:e,webauthn:i})}async _authenticate({factorId:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:i=typeof window<"u"?[window.location.origin]:void 0,signal:o}={}},l){if(!n)return{data:null,error:new Oi("rpId is required for WebAuthn authentication")};try{if(!iy())return{data:null,error:new yr("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this.challenge({factorId:e,webauthn:{rpId:n,rpOrigins:i},signal:o},{request:l});if(!u)return{data:null,error:d};const{webauthn:h}=u;return this._verify({factorId:e,challengeId:u.challengeId,webauthn:{type:h.type,rpId:n,rpOrigins:i,credential_response:h.credential_response}})}catch(u){return ne(u)?{data:null,error:u}:{data:null,error:new yr("Unexpected error in authenticate",u)}}}async _register({friendlyName:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:i=typeof window<"u"?[window.location.origin]:void 0,signal:o}={}},l){if(!n)return{data:null,error:new Oi("rpId is required for WebAuthn registration")};try{if(!iy())return{data:null,error:new yr("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this._enroll({friendlyName:e});if(!u)return await this.client.mfa.listFactors().then(y=>{var v;return(v=y.data)===null||v===void 0?void 0:v.all.find(w=>w.factor_type==="webauthn"&&w.friendly_name===e&&w.status!=="unverified")}).then(y=>y?this.client.mfa.unenroll({factorId:y?.id}):void 0),{data:null,error:d};const{data:h,error:m}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:n,rpOrigins:i},signal:o},{create:l});return h?this._verify({factorId:u.id,challengeId:h.challengeId,webauthn:{rpId:n,rpOrigins:i,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:m}}catch(u){return ne(u)?{data:null,error:u}:{data:null,error:new yr("Unexpected error in register",u)}}}}d2();const A2={url:Ej,storageKey:Tj,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:jj,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function oy(t,e,n){return await n()}const ns={};class Ii{get jwks(){var e,n;return(n=(e=ns[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(e){ns[this.storageKey]=Object.assign(Object.assign({},ns[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,n;return(n=(e=ns[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){ns[this.storageKey]=Object.assign(Object.assign({},ns[this.storageKey]),{cachedAt:e})}constructor(e){var n,i,o;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const l=Object.assign(Object.assign({},A2),e);if(this.storageKey=l.storageKey,this.instanceID=(n=Ii.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,Ii.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!l.debug,typeof l.debug=="function"&&(this.logger=l.debug),this.instanceID>0&&ot()){const u=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(u),this.logDebugMessages&&console.trace(u)}if(this.persistSession=l.persistSession,this.autoRefreshToken=l.autoRefreshToken,this.admin=new l2({url:l.url,headers:l.headers,fetch:l.fetch}),this.url=l.url,this.headers=l.headers,this.fetch=T0(l.fetch),this.lock=l.lock||oy,this.detectSessionInUrl=l.detectSessionInUrl,this.flowType=l.flowType,this.hasCustomAuthorizationHeader=l.hasCustomAuthorizationHeader,this.throwOnError=l.throwOnError,this.lockAcquireTimeout=l.lockAcquireTimeout,l.lock?this.lock=l.lock:this.persistSession&&ot()&&(!((i=globalThis?.navigator)===null||i===void 0)&&i.locks)?this.lock=c2:this.lock=oy,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new N2(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(l.storage?this.storage=l.storage:E0()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=sy(this.memoryStorage)),l.userStorage&&(this.userStorage=l.userStorage)):(this.memoryStorage={},this.storage=sy(this.memoryStorage)),ot()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(u){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",u)}(o=this.broadcastChannel)===null||o===void 0||o.addEventListener("message",async u=>{this._debug("received broadcast notification from other tab or client",u),await this._notifyAllSubscribers(u.data.event,u.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${_0}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let n={},i="none";if(ot()&&(n=Bj(window.location.href),this._isImplicitGrantCallback(n)?i="implicit":await this._isPKCECallback(n)&&(i="pkce")),ot()&&this.detectSessionInUrl&&i!=="none"){const{data:o,error:l}=await this._getSessionFromURL(n,i);if(l){if(this._debug("#_initialize()","error detecting session from URL",l),Oj(l)){const h=(e=l.details)===null||e===void 0?void 0:e.code;if(h==="identity_already_exists"||h==="identity_not_found"||h==="single_identity_not_deletable")return{error:l}}return{error:l}}const{session:u,redirectType:d}=o;return this._debug("#_initialize()","detected session in URL",u,"redirect type",d),await this._saveSession(u),setTimeout(async()=>{d==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",u):await this._notifyAllSubscribers("SIGNED_IN",u)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return ne(n)?this._returnResult({error:n}):this._returnResult({error:new yr("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var n,i,o;try{const l=await ce(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(i=(n=e?.options)===null||n===void 0?void 0:n.data)!==null&&i!==void 0?i:{},gotrue_meta_security:{captcha_token:(o=e?.options)===null||o===void 0?void 0:o.captchaToken}},xform:Yt}),{data:u,error:d}=l;if(d||!u)return this._returnResult({data:{user:null,session:null},error:d});const h=u.session,m=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",h)),this._returnResult({data:{user:m,session:h},error:null})}catch(l){if(ne(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signUp(e){var n,i,o;try{let l;if("email"in e){const{email:y,password:v,options:w}=e;let _=null,b=null;this.flowType==="pkce"&&([_,b]=await Zr(this.storage,this.storageKey)),l=await ce(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:w?.emailRedirectTo,body:{email:y,password:v,data:(n=w?.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:w?.captchaToken},code_challenge:_,code_challenge_method:b},xform:Yt})}else if("phone"in e){const{phone:y,password:v,options:w}=e;l=await ce(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:y,password:v,data:(i=w?.data)!==null&&i!==void 0?i:{},channel:(o=w?.channel)!==null&&o!==void 0?o:"sms",gotrue_meta_security:{captcha_token:w?.captchaToken}},xform:Yt})}else throw new ha("You must provide either an email or phone number and a password");const{data:u,error:d}=l;if(d||!u)return await it(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:d});const h=u.session,m=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",h)),this._returnResult({data:{user:m,session:h},error:null})}catch(l){if(await it(this.storage,`${this.storageKey}-code-verifier`),ne(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signInWithPassword(e){try{let n;if("email"in e){const{email:l,password:u,options:d}=e;n=await ce(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:l,password:u,gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:ny})}else if("phone"in e){const{phone:l,password:u,options:d}=e;n=await ce(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:l,password:u,gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:ny})}else throw new ha("You must provide either an email or phone number and a password");const{data:i,error:o}=n;if(o)return this._returnResult({data:{user:null,session:null},error:o});if(!i||!i.session||!i.user){const l=new Xr;return this._returnResult({data:{user:null,session:null},error:l})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),this._returnResult({data:Object.assign({user:i.user,session:i.session},i.weak_password?{weakPassword:i.weak_password}:null),error:o})}catch(n){if(ne(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(e){var n,i,o,l;return await this._handleProviderSignIn(e.provider,{redirectTo:(n=e.options)===null||n===void 0?void 0:n.redirectTo,scopes:(i=e.options)===null||i===void 0?void 0:i.scopes,queryParams:(o=e.options)===null||o===void 0?void 0:o.queryParams,skipBrowserRedirect:(l=e.options)===null||l===void 0?void 0:l.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:n}=e;switch(n){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(e){var n,i,o,l,u,d,h,m,y,v,w;let _,b;if("message"in e)_=e.message,b=e.signature;else{const{chain:k,wallet:S,statement:E,options:A}=e;let P;if(ot())if(typeof S=="object")P=S;else{const Y=window;if("ethereum"in Y&&typeof Y.ethereum=="object"&&"request"in Y.ethereum&&typeof Y.ethereum.request=="function")P=Y.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof S!="object"||!A?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");P=S}const U=new URL((n=A?.url)!==null&&n!==void 0?n:window.location.href),V=await P.request({method:"eth_requestAccounts"}).then(Y=>Y).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!V||V.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const z=C0(V[0]);let $=(i=A?.signInWithEthereum)===null||i===void 0?void 0:i.chainId;if(!$){const Y=await P.request({method:"eth_chainId"});$=h2(Y)}const B={domain:U.host,address:z,statement:E,uri:U.href,version:"1",chainId:$,nonce:(o=A?.signInWithEthereum)===null||o===void 0?void 0:o.nonce,issuedAt:(u=(l=A?.signInWithEthereum)===null||l===void 0?void 0:l.issuedAt)!==null&&u!==void 0?u:new Date,expirationTime:(d=A?.signInWithEthereum)===null||d===void 0?void 0:d.expirationTime,notBefore:(h=A?.signInWithEthereum)===null||h===void 0?void 0:h.notBefore,requestId:(m=A?.signInWithEthereum)===null||m===void 0?void 0:m.requestId,resources:(y=A?.signInWithEthereum)===null||y===void 0?void 0:y.resources};_=p2(B),b=await P.request({method:"personal_sign",params:[f2(_),z]})}try{const{data:k,error:S}=await ce(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:_,signature:b},!((v=e.options)===null||v===void 0)&&v.captchaToken?{gotrue_meta_security:{captcha_token:(w=e.options)===null||w===void 0?void 0:w.captchaToken}}:null),xform:Yt});if(S)throw S;if(!k||!k.session||!k.user){const E=new Xr;return this._returnResult({data:{user:null,session:null},error:E})}return k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),this._returnResult({data:Object.assign({},k),error:S})}catch(k){if(ne(k))return this._returnResult({data:{user:null,session:null},error:k});throw k}}async signInWithSolana(e){var n,i,o,l,u,d,h,m,y,v,w,_;let b,k;if("message"in e)b=e.message,k=e.signature;else{const{chain:S,wallet:E,statement:A,options:P}=e;let U;if(ot())if(typeof E=="object")U=E;else{const z=window;if("solana"in z&&typeof z.solana=="object"&&("signIn"in z.solana&&typeof z.solana.signIn=="function"||"signMessage"in z.solana&&typeof z.solana.signMessage=="function"))U=z.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof E!="object"||!P?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");U=E}const V=new URL((n=P?.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in U&&U.signIn){const z=await U.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},P?.signInWithSolana),{version:"1",domain:V.host,uri:V.href}),A?{statement:A}:null));let $;if(Array.isArray(z)&&z[0]&&typeof z[0]=="object")$=z[0];else if(z&&typeof z=="object"&&"signedMessage"in z&&"signature"in z)$=z;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in $&&"signature"in $&&(typeof $.signedMessage=="string"||$.signedMessage instanceof Uint8Array)&&$.signature instanceof Uint8Array)b=typeof $.signedMessage=="string"?$.signedMessage:new TextDecoder().decode($.signedMessage),k=$.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in U)||typeof U.signMessage!="function"||!("publicKey"in U)||typeof U!="object"||!U.publicKey||!("toBase58"in U.publicKey)||typeof U.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");b=[`${V.host} wants you to sign in with your Solana account:`,U.publicKey.toBase58(),...A?["",A,""]:[""],"Version: 1",`URI: ${V.href}`,`Issued At: ${(o=(i=P?.signInWithSolana)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date().toISOString()}`,...!((l=P?.signInWithSolana)===null||l===void 0)&&l.notBefore?[`Not Before: ${P.signInWithSolana.notBefore}`]:[],...!((u=P?.signInWithSolana)===null||u===void 0)&&u.expirationTime?[`Expiration Time: ${P.signInWithSolana.expirationTime}`]:[],...!((d=P?.signInWithSolana)===null||d===void 0)&&d.chainId?[`Chain ID: ${P.signInWithSolana.chainId}`]:[],...!((h=P?.signInWithSolana)===null||h===void 0)&&h.nonce?[`Nonce: ${P.signInWithSolana.nonce}`]:[],...!((m=P?.signInWithSolana)===null||m===void 0)&&m.requestId?[`Request ID: ${P.signInWithSolana.requestId}`]:[],...!((v=(y=P?.signInWithSolana)===null||y===void 0?void 0:y.resources)===null||v===void 0)&&v.length?["Resources",...P.signInWithSolana.resources.map($=>`- ${$}`)]:[]].join(`
63
- `);const z=await U.signMessage(new TextEncoder().encode(b),"utf8");if(!z||!(z instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");k=z}}try{const{data:S,error:E}=await ce(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:b,signature:xr(k)},!((w=e.options)===null||w===void 0)&&w.captchaToken?{gotrue_meta_security:{captcha_token:(_=e.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:Yt});if(E)throw E;if(!S||!S.session||!S.user){const A=new Xr;return this._returnResult({data:{user:null,session:null},error:A})}return S.session&&(await this._saveSession(S.session),await this._notifyAllSubscribers("SIGNED_IN",S.session)),this._returnResult({data:Object.assign({},S),error:E})}catch(S){if(ne(S))return this._returnResult({data:{user:null,session:null},error:S});throw S}}async _exchangeCodeForSession(e){const n=await hr(this.storage,`${this.storageKey}-code-verifier`),[i,o]=(n??"").split("/");try{if(!i&&this.flowType==="pkce")throw new Ij;const{data:l,error:u}=await ce(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:i},xform:Yt});if(await it(this.storage,`${this.storageKey}-code-verifier`),u)throw u;if(!l||!l.session||!l.user){const d=new Xr;return this._returnResult({data:{user:null,session:null,redirectType:null},error:d})}return l.session&&(await this._saveSession(l.session),setTimeout(async()=>{await this._notifyAllSubscribers("SIGNED_IN",l.session)},0)),this._returnResult({data:Object.assign(Object.assign({},l),{redirectType:o??null}),error:u})}catch(l){if(await it(this.storage,`${this.storageKey}-code-verifier`),ne(l))return this._returnResult({data:{user:null,session:null,redirectType:null},error:l});throw l}}async signInWithIdToken(e){try{const{options:n,provider:i,token:o,access_token:l,nonce:u}=e,d=await ce(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:i,id_token:o,access_token:l,nonce:u,gotrue_meta_security:{captcha_token:n?.captchaToken}},xform:Yt}),{data:h,error:m}=d;if(m)return this._returnResult({data:{user:null,session:null},error:m});if(!h||!h.session||!h.user){const y=new Xr;return this._returnResult({data:{user:null,session:null},error:y})}return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",h.session)),this._returnResult({data:h,error:m})}catch(n){if(ne(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(e){var n,i,o,l,u;try{if("email"in e){const{email:d,options:h}=e;let m=null,y=null;this.flowType==="pkce"&&([m,y]=await Zr(this.storage,this.storageKey));const{error:v}=await ce(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:d,data:(n=h?.data)!==null&&n!==void 0?n:{},create_user:(i=h?.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:h?.captchaToken},code_challenge:m,code_challenge_method:y},redirectTo:h?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:v})}if("phone"in e){const{phone:d,options:h}=e,{data:m,error:y}=await ce(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:d,data:(o=h?.data)!==null&&o!==void 0?o:{},create_user:(l=h?.shouldCreateUser)!==null&&l!==void 0?l:!0,gotrue_meta_security:{captcha_token:h?.captchaToken},channel:(u=h?.channel)!==null&&u!==void 0?u:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:m?.message_id},error:y})}throw new ha("You must provide either an email or phone number.")}catch(d){if(await it(this.storage,`${this.storageKey}-code-verifier`),ne(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async verifyOtp(e){var n,i;try{let o,l;"options"in e&&(o=(n=e.options)===null||n===void 0?void 0:n.redirectTo,l=(i=e.options)===null||i===void 0?void 0:i.captchaToken);const{data:u,error:d}=await ce(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:l}}),redirectTo:o,xform:Yt});if(d)throw d;if(!u)throw new Error("An error occurred on token verification.");const h=u.session,m=u.user;return h?.access_token&&(await this._saveSession(h),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",h)),this._returnResult({data:{user:m,session:h},error:null})}catch(o){if(ne(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signInWithSSO(e){var n,i,o,l,u;try{let d=null,h=null;this.flowType==="pkce"&&([d,h]=await Zr(this.storage,this.storageKey));const m=await ce(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(i=(n=e.options)===null||n===void 0?void 0:n.redirectTo)!==null&&i!==void 0?i:void 0}),!((o=e?.options)===null||o===void 0)&&o.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:d,code_challenge_method:h}),headers:this.headers,xform:i2});return!((l=m.data)===null||l===void 0)&&l.url&&ot()&&!(!((u=e.options)===null||u===void 0)&&u.skipBrowserRedirect)&&window.location.assign(m.data.url),this._returnResult(m)}catch(d){if(await it(this.storage,`${this.storageKey}-code-verifier`),ne(d))return this._returnResult({data:null,error:d});throw d}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:n},error:i}=e;if(i)throw i;if(!n)throw new At;const{error:o}=await ce(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:o})})}catch(e){if(ne(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const n=`${this.url}/resend`;if("email"in e){const{email:i,type:o,options:l}=e,{error:u}=await ce(this.fetch,"POST",n,{headers:this.headers,body:{email:i,type:o,gotrue_meta_security:{captcha_token:l?.captchaToken}},redirectTo:l?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:u})}else if("phone"in e){const{phone:i,type:o,options:l}=e,{data:u,error:d}=await ce(this.fetch,"POST",n,{headers:this.headers,body:{phone:i,type:o,gotrue_meta_security:{captcha_token:l?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:u?.message_id},error:d})}throw new ha("You must provide either an email or phone number and a type")}catch(n){if(ne(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n))}async _acquireLock(e,n){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const i=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),o=(async()=>(await i,await n()))();return this.pendingInLock.push((async()=>{try{await o}catch{}})()),o}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const i=n();for(this.pendingInLock.push((async()=>{try{await i}catch{}})()),await i;this.pendingInLock.length;){const o=[...this.pendingInLock];await Promise.all(o),this.pendingInLock.splice(0,o.length)}return await i}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await e(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const n=await hr(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?e=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const i=e.expires_at?e.expires_at*1e3-Date.now()<pc:!1;if(this._debug("#__loadSession()",`session has${i?"":" not"} expired`,"expires_at",e.expires_at),!i){if(this.userStorage){const u=await hr(this.userStorage,this.storageKey+"-user");u?.user?e.user=u.user:e.user=yc()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const u={value:this.suppressGetSessionWarning};e.user=t2(e.user,u),u.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:o,error:l}=await this._callRefreshToken(e.refresh_token);return l?this._returnResult({data:{session:null},error:l}):this._returnResult({data:{session:o},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(e){try{return e?await ce(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Hn}):await this._useSession(async n=>{var i,o,l;const{data:u,error:d}=n;if(d)throw d;return!(!((i=u.session)===null||i===void 0)&&i.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new At}:await ce(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(l=(o=u.session)===null||o===void 0?void 0:o.access_token)!==null&&l!==void 0?l:void 0,xform:Hn})})}catch(n){if(ne(n))return Rj(n)&&(await this._removeSession(),await it(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(e,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,n))}async _updateUser(e,n={}){try{return await this._useSession(async i=>{const{data:o,error:l}=i;if(l)throw l;if(!o.session)throw new At;const u=o.session;let d=null,h=null;this.flowType==="pkce"&&e.email!=null&&([d,h]=await Zr(this.storage,this.storageKey));const{data:m,error:y}=await ce(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:d,code_challenge_method:h}),jwt:u.access_token,xform:Hn});if(y)throw y;return u.user=m.user,await this._saveSession(u),await this._notifyAllSubscribers("USER_UPDATED",u),this._returnResult({data:{user:u.user},error:null})})}catch(i){if(await it(this.storage,`${this.storageKey}-code-verifier`),ne(i))return this._returnResult({data:{user:null},error:i});throw i}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new At;const n=Date.now()/1e3;let i=n,o=!0,l=null;const{payload:u}=gc(e.access_token);if(u.exp&&(i=u.exp,o=i<=n),o){const{data:d,error:h}=await this._callRefreshToken(e.refresh_token);if(h)return this._returnResult({data:{user:null,session:null},error:h});if(!d)return{data:{user:null,session:null},error:null};l=d}else{const{data:d,error:h}=await this._getUser(e.access_token);if(h)throw h;l={access_token:e.access_token,refresh_token:e.refresh_token,user:d.user,token_type:"bearer",expires_in:i-n,expires_at:i},await this._saveSession(l),await this._notifyAllSubscribers("SIGNED_IN",l)}return this._returnResult({data:{user:l.user,session:l},error:null})}catch(n){if(ne(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async n=>{var i;if(!e){const{data:u,error:d}=n;if(d)throw d;e=(i=u.session)!==null&&i!==void 0?i:void 0}if(!e?.refresh_token)throw new At;const{data:o,error:l}=await this._callRefreshToken(e.refresh_token);return l?this._returnResult({data:{user:null,session:null},error:l}):o?this._returnResult({data:{user:o.user,session:o},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(ne(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(e,n){try{if(!ot())throw new fa("No browser detected.");if(e.error||e.error_description||e.error_code)throw new fa(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new Jg("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new fa("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Jg("No code detected.");const{data:A,error:P}=await this._exchangeCodeForSession(e.code);if(P)throw P;const U=new URL(window.location.href);return U.searchParams.delete("code"),window.history.replaceState(window.history.state,"",U.toString()),{data:{session:A.session,redirectType:null},error:null}}const{provider_token:i,provider_refresh_token:o,access_token:l,refresh_token:u,expires_in:d,expires_at:h,token_type:m}=e;if(!l||!d||!u||!m)throw new fa("No session defined in URL");const y=Math.round(Date.now()/1e3),v=parseInt(d);let w=y+v;h&&(w=parseInt(h));const _=w-y;_*1e3<=ss&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${_}s, should have been closer to ${v}s`);const b=w-v;y-b>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",b,w,y):y-b<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",b,w,y);const{data:k,error:S}=await this._getUser(l);if(S)throw S;const E={provider_token:i,provider_refresh_token:o,access_token:l,expires_in:v,expires_at:w,refresh_token:u,token_type:m,user:k.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:E,redirectType:e.type},error:null})}catch(i){if(ne(i))return this._returnResult({data:{session:null,redirectType:null},error:i});throw i}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const n=await hr(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&n)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async n=>{var i;const{data:o,error:l}=n;if(l)return this._returnResult({error:l});const u=(i=o.session)===null||i===void 0?void 0:i.access_token;if(u){const{error:d}=await this.admin.signOut(u,e);if(d&&!(Pj(d)&&(d.status===404||d.status===401||d.status===403)))return this._returnResult({error:d})}return e!=="others"&&(await this._removeSession(),await it(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const n=Fj(),i={id:n,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,i),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:i}}}async _emitInitialSession(e){return await this._useSession(async n=>{var i,o;try{const{data:{session:l},error:u}=n;if(u)throw u;await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",l)),this._debug("INITIAL_SESSION","callback id",e,"session",l)}catch(l){await((o=this.stateChangeEmitters.get(e))===null||o===void 0?void 0:o.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",l),console.error(l)}})}async resetPasswordForEmail(e,n={}){let i=null,o=null;this.flowType==="pkce"&&([i,o]=await Zr(this.storage,this.storageKey,!0));try{return await ce(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:i,code_challenge_method:o,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(l){if(await it(this.storage,`${this.storageKey}-code-verifier`),ne(l))return this._returnResult({data:null,error:l});throw l}}async getUserIdentities(){var e;try{const{data:n,error:i}=await this.getUser();if(i)throw i;return this._returnResult({data:{identities:(e=n.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(n){if(ne(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var n;try{const{data:i,error:o}=await this._useSession(async l=>{var u,d,h,m,y;const{data:v,error:w}=l;if(w)throw w;const _=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(u=e.options)===null||u===void 0?void 0:u.redirectTo,scopes:(d=e.options)===null||d===void 0?void 0:d.scopes,queryParams:(h=e.options)===null||h===void 0?void 0:h.queryParams,skipBrowserRedirect:!0});return await ce(this.fetch,"GET",_,{headers:this.headers,jwt:(y=(m=v.session)===null||m===void 0?void 0:m.access_token)!==null&&y!==void 0?y:void 0})});if(o)throw o;return ot()&&!(!((n=e.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(i?.url),this._returnResult({data:{provider:e.provider,url:i?.url},error:null})}catch(i){if(ne(i))return this._returnResult({data:{provider:e.provider,url:null},error:i});throw i}}async linkIdentityIdToken(e){return await this._useSession(async n=>{var i;try{const{error:o,data:{session:l}}=n;if(o)throw o;const{options:u,provider:d,token:h,access_token:m,nonce:y}=e,v=await ce(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(i=l?.access_token)!==null&&i!==void 0?i:void 0,body:{provider:d,id_token:h,access_token:m,nonce:y,link_identity:!0,gotrue_meta_security:{captcha_token:u?.captchaToken}},xform:Yt}),{data:w,error:_}=v;return _?this._returnResult({data:{user:null,session:null},error:_}):!w||!w.session||!w.user?this._returnResult({data:{user:null,session:null},error:new Xr}):(w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("USER_UPDATED",w.session)),this._returnResult({data:w,error:_}))}catch(o){if(await it(this.storage,`${this.storageKey}-code-verifier`),ne(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}})}async unlinkIdentity(e){try{return await this._useSession(async n=>{var i,o;const{data:l,error:u}=n;if(u)throw u;return await ce(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(o=(i=l.session)===null||i===void 0?void 0:i.access_token)!==null&&o!==void 0?o:void 0})})}catch(n){if(ne(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(e){const n=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{const i=Date.now();return await Wj(async o=>(o>0&&await qj(200*Math.pow(2,o-1)),this._debug(n,"refreshing attempt",o),await ce(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Yt})),(o,l)=>{const u=200*Math.pow(2,o);return l&&mc(l)&&Date.now()+u-i<ss})}catch(i){if(this._debug(n,"error",i),ne(i))return this._returnResult({data:{session:null,user:null},error:i});throw i}finally{this._debug(n,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,n){const i=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",n,"url",i),ot()&&!n.skipBrowserRedirect&&window.location.assign(i),{data:{provider:e,url:i},error:null}}async _recoverAndRefresh(){var e,n;const i="#_recoverAndRefresh()";this._debug(i,"begin");try{const o=await hr(this.storage,this.storageKey);if(o&&this.userStorage){let u=await hr(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!u&&(u={user:o.user},await is(this.userStorage,this.storageKey+"-user",u)),o.user=(e=u?.user)!==null&&e!==void 0?e:yc()}else if(o&&!o.user&&!o.user){const u=await hr(this.storage,this.storageKey+"-user");u&&u?.user?(o.user=u.user,await it(this.storage,this.storageKey+"-user"),await is(this.storage,this.storageKey,o)):o.user=yc()}if(this._debug(i,"session from storage",o),!this._isValidSession(o)){this._debug(i,"session is not valid"),o!==null&&await this._removeSession();return}const l=((n=o.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<pc;if(this._debug(i,`session has${l?"":" not"} expired with margin of ${pc}s`),l){if(this.autoRefreshToken&&o.refresh_token){const{error:u}=await this._callRefreshToken(o.refresh_token);u&&(console.error(u),mc(u)||(this._debug(i,"refresh failed with a non-retryable error, removing the session",u),await this._removeSession()))}}else if(o.user&&o.user.__isUserNotAvailableProxy===!0)try{const{data:u,error:d}=await this._getUser(o.access_token);!d&&u?.user?(o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)):this._debug(i,"could not get user data, skipping SIGNED_IN notification")}catch(u){console.error("Error getting user data:",u),this._debug(i,"error getting user data, skipping SIGNED_IN notification",u)}else await this._notifyAllSubscribers("SIGNED_IN",o)}catch(o){this._debug(i,"error",o),console.error(o);return}finally{this._debug(i,"end")}}async _callRefreshToken(e){var n,i;if(!e)throw new At;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const o=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(o,"begin");try{this.refreshingDeferred=new Ka;const{data:l,error:u}=await this._refreshAccessToken(e);if(u)throw u;if(!l.session)throw new At;await this._saveSession(l.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",l.session);const d={data:l.session,error:null};return this.refreshingDeferred.resolve(d),d}catch(l){if(this._debug(o,"error",l),ne(l)){const u={data:null,error:l};return mc(l)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(u),u}throw(i=this.refreshingDeferred)===null||i===void 0||i.reject(l),l}finally{this.refreshingDeferred=null,this._debug(o,"end")}}async _notifyAllSubscribers(e,n,i=!0){const o=`#_notifyAllSubscribers(${e})`;this._debug(o,"begin",n,`broadcast = ${i}`);try{this.broadcastChannel&&i&&this.broadcastChannel.postMessage({event:e,session:n});const l=[],u=Array.from(this.stateChangeEmitters.values()).map(async d=>{try{await d.callback(e,n)}catch(h){l.push(h)}});if(await Promise.all(u),l.length>0){for(let d=0;d<l.length;d+=1)console.error(l[d]);throw l[0]}}finally{this._debug(o,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await it(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},e),i=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!i&&n.user&&await is(this.userStorage,this.storageKey+"-user",{user:n.user});const o=Object.assign({},n);delete o.user;const l=ey(o);await is(this.storage,this.storageKey,l)}else{const o=ey(n);await is(this.storage,this.storageKey,o)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await it(this.storage,this.storageKey),await it(this.storage,this.storageKey+"-code-verifier"),await it(this.storage,this.storageKey+"-user"),this.userStorage&&await it(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&ot()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),ss);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async n=>{const{data:{session:i}}=n;if(!i||!i.refresh_token||!i.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const o=Math.floor((i.expires_at*1e3-e)/ss);this._debug("#_autoRefreshTokenTick()",`access token expires in ${o} ticks, a tick lasts ${ss}ms, refresh threshold is ${Qc} ticks`),o<=Qc&&await this._callRefreshToken(i.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof j0)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!ot()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const n=`#_onVisibilityChanged(${e})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,n,i){const o=[`provider=${encodeURIComponent(n)}`];if(i?.redirectTo&&o.push(`redirect_to=${encodeURIComponent(i.redirectTo)}`),i?.scopes&&o.push(`scopes=${encodeURIComponent(i.scopes)}`),this.flowType==="pkce"){const[l,u]=await Zr(this.storage,this.storageKey),d=new URLSearchParams({code_challenge:`${encodeURIComponent(l)}`,code_challenge_method:`${encodeURIComponent(u)}`});o.push(d.toString())}if(i?.queryParams){const l=new URLSearchParams(i.queryParams);o.push(l.toString())}return i?.skipBrowserRedirect&&o.push(`skip_http_redirect=${i.skipBrowserRedirect}`),`${e}?${o.join("&")}`}async _unenroll(e){try{return await this._useSession(async n=>{var i;const{data:o,error:l}=n;return l?this._returnResult({data:null,error:l}):await ce(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(i=o?.session)===null||i===void 0?void 0:i.access_token})})}catch(n){if(ne(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(e){try{return await this._useSession(async n=>{var i,o;const{data:l,error:u}=n;if(u)return this._returnResult({data:null,error:u});const d=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:h,error:m}=await ce(this.fetch,"POST",`${this.url}/factors`,{body:d,headers:this.headers,jwt:(i=l?.session)===null||i===void 0?void 0:i.access_token});return m?this._returnResult({data:null,error:m}):(e.factorType==="totp"&&h.type==="totp"&&(!((o=h?.totp)===null||o===void 0)&&o.qr_code)&&(h.totp.qr_code=`data:image/svg+xml;utf-8,${h.totp.qr_code}`),this._returnResult({data:h,error:null}))})}catch(n){if(ne(n))return this._returnResult({data:null,error:n});throw n}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var i;const{data:o,error:l}=n;if(l)return this._returnResult({data:null,error:l});const u=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?b2(e.webauthn.credential_response):_2(e.webauthn.credential_response)})}:{code:e.code}),{data:d,error:h}=await ce(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:u,headers:this.headers,jwt:(i=o?.session)===null||i===void 0?void 0:i.access_token});return h?this._returnResult({data:null,error:h}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+d.expires_in},d)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",d),this._returnResult({data:d,error:h}))})}catch(n){if(ne(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var i;const{data:o,error:l}=n;if(l)return this._returnResult({data:null,error:l});const u=await ce(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(i=o?.session)===null||i===void 0?void 0:i.access_token});if(u.error)return u;const{data:d}=u;if(d.type!=="webauthn")return{data:d,error:null};switch(d.webauthn.type){case"create":return{data:Object.assign(Object.assign({},d),{webauthn:Object.assign(Object.assign({},d.webauthn),{credential_options:Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:w2(d.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},d),{webauthn:Object.assign(Object.assign({},d.webauthn),{credential_options:Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:x2(d.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(ne(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(e){const{data:n,error:i}=await this._challenge({factorId:e.factorId});return i?this._returnResult({data:null,error:i}):await this._verify({factorId:e.factorId,challengeId:n.id,code:e.code})}async _listFactors(){var e;const{data:{user:n},error:i}=await this.getUser();if(i)return{data:null,error:i};const o={all:[],phone:[],totp:[],webauthn:[]};for(const l of(e=n?.factors)!==null&&e!==void 0?e:[])o.all.push(l),l.status==="verified"&&o[l.factor_type].push(l);return{data:o,error:null}}async _getAuthenticatorAssuranceLevel(){var e,n;const{data:{session:i},error:o}=await this.getSession();if(o)return this._returnResult({data:null,error:o});if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=gc(i.access_token);let u=null;l.aal&&(u=l.aal);let d=u;((n=(e=i.user.factors)===null||e===void 0?void 0:e.filter(y=>y.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(d="aal2");const m=l.amr||[];return{data:{currentLevel:u,nextLevel:d,currentAuthenticationMethods:m},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async n=>{const{data:{session:i},error:o}=n;return o?this._returnResult({data:null,error:o}):i?await ce(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:i.access_token,xform:l=>({data:l,error:null})}):this._returnResult({data:null,error:new At})})}catch(n){if(ne(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(e,n){try{return await this._useSession(async i=>{const{data:{session:o},error:l}=i;if(l)return this._returnResult({data:null,error:l});if(!o)return this._returnResult({data:null,error:new At});const u=await ce(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"approve"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&ot()&&!n?.skipBrowserRedirect&&window.location.assign(u.data.redirect_url),u})}catch(i){if(ne(i))return this._returnResult({data:null,error:i});throw i}}async _denyAuthorization(e,n){try{return await this._useSession(async i=>{const{data:{session:o},error:l}=i;if(l)return this._returnResult({data:null,error:l});if(!o)return this._returnResult({data:null,error:new At});const u=await ce(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"deny"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&ot()&&!n?.skipBrowserRedirect&&window.location.assign(u.data.redirect_url),u})}catch(i){if(ne(i))return this._returnResult({data:null,error:i});throw i}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:n},error:i}=e;return i?this._returnResult({data:null,error:i}):n?await ce(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:o=>({data:o,error:null})}):this._returnResult({data:null,error:new At})})}catch(e){if(ne(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async n=>{const{data:{session:i},error:o}=n;return o?this._returnResult({data:null,error:o}):i?(await ce(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:i.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new At})})}catch(n){if(ne(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(e,n={keys:[]}){let i=n.keys.find(d=>d.kid===e);if(i)return i;const o=Date.now();if(i=this.jwks.keys.find(d=>d.kid===e),i&&this.jwks_cached_at+Nj>o)return i;const{data:l,error:u}=await ce(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(u)throw u;return!l.keys||l.keys.length===0||(this.jwks=l,this.jwks_cached_at=o,i=l.keys.find(d=>d.kid===e),!i)?null:i}async getClaims(e,n={}){try{let i=e;if(!i){const{data:_,error:b}=await this.getSession();if(b||!_.session)return this._returnResult({data:null,error:b});i=_.session.access_token}const{header:o,payload:l,signature:u,raw:{header:d,payload:h}}=gc(i);n?.allowExpired||Xj(l.exp);const m=!o.alg||o.alg.startsWith("HS")||!o.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(o.kid,n?.keys?{keys:n.keys}:n?.jwks);if(!m){const{error:_}=await this.getUser(i);if(_)throw _;return{data:{claims:l,header:o,signature:u},error:null}}const y=Zj(o.alg),v=await crypto.subtle.importKey("jwk",m,y,!0,["verify"]);if(!await crypto.subtle.verify(y,v,u,$j(`${d}.${h}`)))throw new ed("Invalid JWT signature");return{data:{claims:l,header:o,signature:u},error:null}}catch(i){if(ne(i))return this._returnResult({data:null,error:i});throw i}}}Ii.nextInstanceID={};const P2=Ii,R2="2.91.0";let mi="";typeof Deno<"u"?mi="deno":typeof document<"u"?mi="web":typeof navigator<"u"&&navigator.product==="ReactNative"?mi="react-native":mi="node";const O2={"X-Client-Info":`supabase-js-${mi}/${R2}`},I2={headers:O2},D2={schema:"public"},L2={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},M2={};function Di(t){"@babel/helpers - typeof";return Di=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Di(t)}function U2(t,e){if(Di(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(Di(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $2(t){var e=U2(t,"string");return Di(e)=="symbol"?e:e+""}function V2(t,e,n){return(e=$2(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ay(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,i)}return n}function qe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ay(Object(n),!0).forEach(function(i){V2(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ay(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}const F2=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),B2=()=>Headers,z2=(t,e,n)=>{const i=F2(n),o=B2();return async(l,u)=>{var d;const h=(d=await e())!==null&&d!==void 0?d:t;let m=new o(u?.headers);return m.has("apikey")||m.set("apikey",t),m.has("Authorization")||m.set("Authorization",`Bearer ${h}`),i(l,qe(qe({},u),{},{headers:m}))}};function q2(t){return t.endsWith("/")?t:t+"/"}function W2(t,e){var n,i;const{db:o,auth:l,realtime:u,global:d}=t,{db:h,auth:m,realtime:y,global:v}=e,w={db:qe(qe({},h),o),auth:qe(qe({},m),l),realtime:qe(qe({},y),u),storage:{},global:qe(qe(qe({},v),d),{},{headers:qe(qe({},(n=v?.headers)!==null&&n!==void 0?n:{}),(i=d?.headers)!==null&&i!==void 0?i:{})}),accessToken:async()=>""};return t.accessToken?w.accessToken=t.accessToken:delete w.accessToken,w}function H2(t){const e=t?.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(q2(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var K2=class extends P2{constructor(t){super(t)}},G2=class{constructor(t,e,n){var i,o;this.supabaseUrl=t,this.supabaseKey=e;const l=H2(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",l),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",l),this.storageUrl=new URL("storage/v1",l),this.functionsUrl=new URL("functions/v1",l);const u=`sb-${l.hostname.split(".")[0]}-auth-token`,d={db:D2,realtime:M2,auth:qe(qe({},L2),{},{storageKey:u}),global:I2},h=W2(n??{},d);if(this.storageKey=(i=h.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(o=h.global.headers)!==null&&o!==void 0?o:{},h.accessToken)this.accessToken=h.accessToken,this.auth=new Proxy({},{get:(y,v)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(v)} is not possible`)}});else{var m;this.auth=this._initSupabaseAuthClient((m=h.auth)!==null&&m!==void 0?m:{},this.headers,h.global.fetch)}this.fetch=z2(e,this._getAccessToken.bind(this),h.global.fetch),this.realtime=this._initRealtimeClient(qe({headers:this.headers,accessToken:this._getAccessToken.bind(this)},h.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(y=>this.realtime.setAuth(y)).catch(y=>console.warn("Failed to set initial Realtime auth token:",y)),this.rest=new jT(new URL("rest/v1",l).href,{headers:this.headers,schema:h.db.schema,fetch:this.fetch}),this.storage=new kj(this.storageUrl.href,this.headers,this.fetch,n?.storage),h.accessToken||this._listenForAuthEvents()}get functions(){return new _T(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,n)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,n;if(t.accessToken)return await t.accessToken();const{data:i}=await t.auth.getSession();return(e=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:n,storage:i,userStorage:o,storageKey:l,flowType:u,lock:d,debug:h,throwOnError:m},y,v){const w={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new K2({url:this.authUrl.href,headers:qe(qe({},w),y),storageKey:l,autoRefreshToken:t,persistSession:e,detectSessionInUrl:n,storage:i,userStorage:o,flowType:u,lock:d,debug:h,throwOnError:m,fetch:v,hasCustomAuthorizationHeader:Object.keys(this.headers).some(_=>_.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new qT(this.realtimeUrl.href,qe(qe({},t),{},{params:qe(qe({},{apikey:this.supabaseKey}),t?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e?.access_token)})}_handleTokenChanged(t,e,n){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const J2=(t,e,n)=>new G2(t,e,n);function Y2(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const n=e.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}Y2()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const Ga="alchemy_supabase_config";function Jd(){try{const t=localStorage.getItem(Ga);if(t)return JSON.parse(t)}catch(t){console.error("Error reading Supabase config:",t)}return null}function Q2(t){try{localStorage.setItem(Ga,JSON.stringify(t))}catch(e){console.error("Error saving Supabase config:",e)}}function X2(){try{localStorage.removeItem(Ga)}catch(t){console.error("Error clearing Supabase config:",t)}}async function Z2(t,e){try{if(!t.startsWith("http://")&&!t.startsWith("https://"))return{valid:!1,error:"Invalid URL format"};const n=e.startsWith("eyJ"),i=e.startsWith("sb_publishable_");if(!n&&!i)return{valid:!1,error:"Invalid API key format"};if(i)return{valid:!0};const o=await fetch(`${t}/rest/v1/`,{method:"GET",headers:{apikey:e,Authorization:`Bearer ${e}`}});return o.ok?{valid:!0}:o.status===401||o.status===403?{valid:!1,error:"Invalid API key"}:{valid:!1,error:`Connection failed: ${o.statusText}`}}catch(n){return{valid:!1,error:n instanceof Error?n.message:"Connection failed"}}}function eC(){return localStorage.getItem(Ga)?"ui":"none"}const Yd=Jd(),tC=Yd?.url||void 0||"https://placeholder.supabase.co",nC=Yd?.anonKey||void 0||"placeholder",ge=J2(tC,nC,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),ly=!!Yd?.url;function rC({length:t=6,value:e,onChange:n,onComplete:i,disabled:o=!1,error:l=!1}){const u=R.useRef([]),[d,h]=R.useState(null),m=(w,_)=>{const b=_.replace(/[^0-9]/g,"");if(b.length===0){const E=e.split("");w<E.length&&E.splice(w,1);const A=E.join("");n(A),w>0&&u.current[w-1]?.focus();return}const k=[...e];k[w]=b[0];const S=k.join("");n(S),w<t-1&&b!==""&&u.current[w+1]?.focus(),S.length===t&&i&&i(S)},y=(w,_)=>{_.key==="Backspace"&&!e[w]&&w>0||_.key==="ArrowLeft"&&w>0?u.current[w-1]?.focus():_.key==="ArrowRight"&&w<t-1&&u.current[w+1]?.focus()},v=w=>{w.preventDefault();const b=w.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,t);n(b);const k=Math.min(b.length,t-1);u.current[k]?.focus(),b.length===t&&i&&i(b)};return p.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:t}).map((w,_)=>p.jsx("input",{ref:b=>{u.current[_]=b},type:"text",inputMode:"numeric",maxLength:1,value:e[_]||"",onChange:b=>m(_,b.target.value),onKeyDown:b=>y(_,b),onPaste:v,onFocus:()=>h(_),onBlur:()=>h(null),disabled:o,className:`
59
+ Request ID: ${h}`),m){let P=`
60
+ Resources:`;for(const N of m){if(!N||typeof N!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${N}`);P+=`
61
+ - ${N}`}E+=P}return`${k}
62
+ ${E}`}class Ye extends Error{constructor({message:e,code:n,cause:i,name:o}){var l;super(e,{cause:i}),this.__isWebAuthnError=!0,this.name=(l=o??(i instanceof Error?i.name:void 0))!==null&&l!==void 0?l:"Unknown Error",this.code=n}}class Pa extends Ye{constructor(e,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:e}),this.name="WebAuthnUnknownError",this.originalError=n}}function m2({error:t,options:e}){var n,i,o;const{publicKey:l}=e;if(!l)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Ye({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((n=l.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new Ye({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((i=l.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new Ye({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((o=l.authenticatorSelection)===null||o===void 0?void 0:o.userVerification)==="required")return new Ye({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new Ye({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Ye({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return l.pubKeyCredParams.filter(d=>d.type==="public-key").length===0?new Ye({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Ye({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const u=window.location.hostname;if(N0(u)){if(l.rp.id!==u)return new Ye({message:`The RP ID "${l.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Ye({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(l.user.id.byteLength<1||l.user.id.byteLength>64)return new Ye({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new Ye({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Ye({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function g2({error:t,options:e}){const{publicKey:n}=e;if(!n)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Ye({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Ye({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const i=window.location.hostname;if(N0(i)){if(n.rpId!==i)return new Ye({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Ye({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Ye({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Ye({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class y2{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const v2=new y2;function w2(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:n,excludeCredentials:i}=t,o=Ha(t,["challenge","user","excludeCredentials"]),l=fs(e).buffer,u=Object.assign(Object.assign({},n),{id:fs(n.id).buffer}),d=Object.assign(Object.assign({},o),{challenge:l,user:u});if(i&&i.length>0){d.excludeCredentials=new Array(i.length);for(let h=0;h<i.length;h++){const m=i[h];d.excludeCredentials[h]=Object.assign(Object.assign({},m),{id:fs(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function x2(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:n}=t,i=Ha(t,["challenge","allowCredentials"]),o=fs(e).buffer,l=Object.assign(Object.assign({},i),{challenge:o});if(n&&n.length>0){l.allowCredentials=new Array(n.length);for(let u=0;u<n.length;u++){const d=n[u];l.allowCredentials[u]=Object.assign(Object.assign({},d),{id:fs(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return l}function b2(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t;return{id:t.id,rawId:t.id,response:{attestationObject:xr(new Uint8Array(t.response.attestationObject)),clientDataJSON:xr(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function _2(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t,i=t.getClientExtensionResults(),o=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:xr(new Uint8Array(o.authenticatorData)),clientDataJSON:xr(new Uint8Array(o.clientDataJSON)),signature:xr(new Uint8Array(o.signature)),userHandle:o.userHandle?xr(new Uint8Array(o.userHandle)):void 0},type:"public-key",clientExtensionResults:i,authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function N0(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function iy(){var t,e;return!!(ot()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.get)=="function")}async function S2(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Pa("Browser returned unexpected credential type",e)}:{data:null,error:new Pa("Empty credential response",e)}}catch(e){return{data:null,error:m2({error:e,options:t})}}}async function k2(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Pa("Browser returned unexpected credential type",e)}:{data:null,error:new Pa("Empty credential response",e)}}catch(e){return{data:null,error:g2({error:e,options:t})}}}const E2={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},T2={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Ra(...t){const e=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),n=o=>o instanceof ArrayBuffer||ArrayBuffer.isView(o),i={};for(const o of t)if(o)for(const l in o){const u=o[l];if(u!==void 0)if(Array.isArray(u))i[l]=u;else if(n(u))i[l]=u;else if(e(u)){const d=i[l];e(d)?i[l]=Ra(d,u):i[l]=Ra(u)}else i[l]=u}return i}function j2(t,e){return Ra(E2,t,e||{})}function C2(t,e){return Ra(T2,t,e||{})}class N2{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:n,friendlyName:i,signal:o},l){try{const{data:u,error:d}=await this.client.mfa.challenge({factorId:e,webauthn:n});if(!u)return{data:null,error:d};const h=o??v2.createNewAbortSignal();if(u.webauthn.type==="create"){const{user:m}=u.webauthn.credential_options.publicKey;m.name||(m.name=`${m.id}:${i}`),m.displayName||(m.displayName=m.name)}switch(u.webauthn.type){case"create":{const m=j2(u.webauthn.credential_options.publicKey,l?.create),{data:y,error:v}=await S2({publicKey:m,signal:h});return y?{data:{factorId:e,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:y}},error:null}:{data:null,error:v}}case"request":{const m=C2(u.webauthn.credential_options.publicKey,l?.request),{data:y,error:v}=await k2(Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:m,signal:h}));return y?{data:{factorId:e,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:y}},error:null}:{data:null,error:v}}}}catch(u){return ne(u)?{data:null,error:u}:{data:null,error:new yr("Unexpected error in challenge",u)}}}async _verify({challengeId:e,factorId:n,webauthn:i}){return this.client.mfa.verify({factorId:n,challengeId:e,webauthn:i})}async _authenticate({factorId:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:i=typeof window<"u"?[window.location.origin]:void 0,signal:o}={}},l){if(!n)return{data:null,error:new Oi("rpId is required for WebAuthn authentication")};try{if(!iy())return{data:null,error:new yr("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this.challenge({factorId:e,webauthn:{rpId:n,rpOrigins:i},signal:o},{request:l});if(!u)return{data:null,error:d};const{webauthn:h}=u;return this._verify({factorId:e,challengeId:u.challengeId,webauthn:{type:h.type,rpId:n,rpOrigins:i,credential_response:h.credential_response}})}catch(u){return ne(u)?{data:null,error:u}:{data:null,error:new yr("Unexpected error in authenticate",u)}}}async _register({friendlyName:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:i=typeof window<"u"?[window.location.origin]:void 0,signal:o}={}},l){if(!n)return{data:null,error:new Oi("rpId is required for WebAuthn registration")};try{if(!iy())return{data:null,error:new yr("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this._enroll({friendlyName:e});if(!u)return await this.client.mfa.listFactors().then(y=>{var v;return(v=y.data)===null||v===void 0?void 0:v.all.find(w=>w.factor_type==="webauthn"&&w.friendly_name===e&&w.status!=="unverified")}).then(y=>y?this.client.mfa.unenroll({factorId:y?.id}):void 0),{data:null,error:d};const{data:h,error:m}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:n,rpOrigins:i},signal:o},{create:l});return h?this._verify({factorId:u.id,challengeId:h.challengeId,webauthn:{rpId:n,rpOrigins:i,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:m}}catch(u){return ne(u)?{data:null,error:u}:{data:null,error:new yr("Unexpected error in register",u)}}}}d2();const A2={url:Ej,storageKey:Tj,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:jj,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function oy(t,e,n){return await n()}const rs={};class Ii{get jwks(){var e,n;return(n=(e=rs[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(e){rs[this.storageKey]=Object.assign(Object.assign({},rs[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,n;return(n=(e=rs[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){rs[this.storageKey]=Object.assign(Object.assign({},rs[this.storageKey]),{cachedAt:e})}constructor(e){var n,i,o;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const l=Object.assign(Object.assign({},A2),e);if(this.storageKey=l.storageKey,this.instanceID=(n=Ii.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,Ii.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!l.debug,typeof l.debug=="function"&&(this.logger=l.debug),this.instanceID>0&&ot()){const u=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(u),this.logDebugMessages&&console.trace(u)}if(this.persistSession=l.persistSession,this.autoRefreshToken=l.autoRefreshToken,this.admin=new l2({url:l.url,headers:l.headers,fetch:l.fetch}),this.url=l.url,this.headers=l.headers,this.fetch=T0(l.fetch),this.lock=l.lock||oy,this.detectSessionInUrl=l.detectSessionInUrl,this.flowType=l.flowType,this.hasCustomAuthorizationHeader=l.hasCustomAuthorizationHeader,this.throwOnError=l.throwOnError,this.lockAcquireTimeout=l.lockAcquireTimeout,l.lock?this.lock=l.lock:this.persistSession&&ot()&&(!((i=globalThis?.navigator)===null||i===void 0)&&i.locks)?this.lock=c2:this.lock=oy,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new N2(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(l.storage?this.storage=l.storage:E0()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=sy(this.memoryStorage)),l.userStorage&&(this.userStorage=l.userStorage)):(this.memoryStorage={},this.storage=sy(this.memoryStorage)),ot()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(u){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",u)}(o=this.broadcastChannel)===null||o===void 0||o.addEventListener("message",async u=>{this._debug("received broadcast notification from other tab or client",u),await this._notifyAllSubscribers(u.data.event,u.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${_0}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let n={},i="none";if(ot()&&(n=Bj(window.location.href),this._isImplicitGrantCallback(n)?i="implicit":await this._isPKCECallback(n)&&(i="pkce")),ot()&&this.detectSessionInUrl&&i!=="none"){const{data:o,error:l}=await this._getSessionFromURL(n,i);if(l){if(this._debug("#_initialize()","error detecting session from URL",l),Oj(l)){const h=(e=l.details)===null||e===void 0?void 0:e.code;if(h==="identity_already_exists"||h==="identity_not_found"||h==="single_identity_not_deletable")return{error:l}}return{error:l}}const{session:u,redirectType:d}=o;return this._debug("#_initialize()","detected session in URL",u,"redirect type",d),await this._saveSession(u),setTimeout(async()=>{d==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",u):await this._notifyAllSubscribers("SIGNED_IN",u)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return ne(n)?this._returnResult({error:n}):this._returnResult({error:new yr("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var n,i,o;try{const l=await ce(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(i=(n=e?.options)===null||n===void 0?void 0:n.data)!==null&&i!==void 0?i:{},gotrue_meta_security:{captcha_token:(o=e?.options)===null||o===void 0?void 0:o.captchaToken}},xform:Yt}),{data:u,error:d}=l;if(d||!u)return this._returnResult({data:{user:null,session:null},error:d});const h=u.session,m=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",h)),this._returnResult({data:{user:m,session:h},error:null})}catch(l){if(ne(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signUp(e){var n,i,o;try{let l;if("email"in e){const{email:y,password:v,options:w}=e;let _=null,b=null;this.flowType==="pkce"&&([_,b]=await es(this.storage,this.storageKey)),l=await ce(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:w?.emailRedirectTo,body:{email:y,password:v,data:(n=w?.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:w?.captchaToken},code_challenge:_,code_challenge_method:b},xform:Yt})}else if("phone"in e){const{phone:y,password:v,options:w}=e;l=await ce(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:y,password:v,data:(i=w?.data)!==null&&i!==void 0?i:{},channel:(o=w?.channel)!==null&&o!==void 0?o:"sms",gotrue_meta_security:{captcha_token:w?.captchaToken}},xform:Yt})}else throw new ha("You must provide either an email or phone number and a password");const{data:u,error:d}=l;if(d||!u)return await it(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:d});const h=u.session,m=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",h)),this._returnResult({data:{user:m,session:h},error:null})}catch(l){if(await it(this.storage,`${this.storageKey}-code-verifier`),ne(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signInWithPassword(e){try{let n;if("email"in e){const{email:l,password:u,options:d}=e;n=await ce(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:l,password:u,gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:ny})}else if("phone"in e){const{phone:l,password:u,options:d}=e;n=await ce(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:l,password:u,gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:ny})}else throw new ha("You must provide either an email or phone number and a password");const{data:i,error:o}=n;if(o)return this._returnResult({data:{user:null,session:null},error:o});if(!i||!i.session||!i.user){const l=new Zr;return this._returnResult({data:{user:null,session:null},error:l})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),this._returnResult({data:Object.assign({user:i.user,session:i.session},i.weak_password?{weakPassword:i.weak_password}:null),error:o})}catch(n){if(ne(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(e){var n,i,o,l;return await this._handleProviderSignIn(e.provider,{redirectTo:(n=e.options)===null||n===void 0?void 0:n.redirectTo,scopes:(i=e.options)===null||i===void 0?void 0:i.scopes,queryParams:(o=e.options)===null||o===void 0?void 0:o.queryParams,skipBrowserRedirect:(l=e.options)===null||l===void 0?void 0:l.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:n}=e;switch(n){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(e){var n,i,o,l,u,d,h,m,y,v,w;let _,b;if("message"in e)_=e.message,b=e.signature;else{const{chain:S,wallet:k,statement:E,options:P}=e;let N;if(ot())if(typeof k=="object")N=k;else{const Y=window;if("ethereum"in Y&&typeof Y.ethereum=="object"&&"request"in Y.ethereum&&typeof Y.ethereum.request=="function")N=Y.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof k!="object"||!P?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");N=k}const U=new URL((n=P?.url)!==null&&n!==void 0?n:window.location.href),V=await N.request({method:"eth_requestAccounts"}).then(Y=>Y).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!V||V.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const z=C0(V[0]);let $=(i=P?.signInWithEthereum)===null||i===void 0?void 0:i.chainId;if(!$){const Y=await N.request({method:"eth_chainId"});$=h2(Y)}const B={domain:U.host,address:z,statement:E,uri:U.href,version:"1",chainId:$,nonce:(o=P?.signInWithEthereum)===null||o===void 0?void 0:o.nonce,issuedAt:(u=(l=P?.signInWithEthereum)===null||l===void 0?void 0:l.issuedAt)!==null&&u!==void 0?u:new Date,expirationTime:(d=P?.signInWithEthereum)===null||d===void 0?void 0:d.expirationTime,notBefore:(h=P?.signInWithEthereum)===null||h===void 0?void 0:h.notBefore,requestId:(m=P?.signInWithEthereum)===null||m===void 0?void 0:m.requestId,resources:(y=P?.signInWithEthereum)===null||y===void 0?void 0:y.resources};_=p2(B),b=await N.request({method:"personal_sign",params:[f2(_),z]})}try{const{data:S,error:k}=await ce(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:_,signature:b},!((v=e.options)===null||v===void 0)&&v.captchaToken?{gotrue_meta_security:{captcha_token:(w=e.options)===null||w===void 0?void 0:w.captchaToken}}:null),xform:Yt});if(k)throw k;if(!S||!S.session||!S.user){const E=new Zr;return this._returnResult({data:{user:null,session:null},error:E})}return S.session&&(await this._saveSession(S.session),await this._notifyAllSubscribers("SIGNED_IN",S.session)),this._returnResult({data:Object.assign({},S),error:k})}catch(S){if(ne(S))return this._returnResult({data:{user:null,session:null},error:S});throw S}}async signInWithSolana(e){var n,i,o,l,u,d,h,m,y,v,w,_;let b,S;if("message"in e)b=e.message,S=e.signature;else{const{chain:k,wallet:E,statement:P,options:N}=e;let U;if(ot())if(typeof E=="object")U=E;else{const z=window;if("solana"in z&&typeof z.solana=="object"&&("signIn"in z.solana&&typeof z.solana.signIn=="function"||"signMessage"in z.solana&&typeof z.solana.signMessage=="function"))U=z.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof E!="object"||!N?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");U=E}const V=new URL((n=N?.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in U&&U.signIn){const z=await U.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},N?.signInWithSolana),{version:"1",domain:V.host,uri:V.href}),P?{statement:P}:null));let $;if(Array.isArray(z)&&z[0]&&typeof z[0]=="object")$=z[0];else if(z&&typeof z=="object"&&"signedMessage"in z&&"signature"in z)$=z;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in $&&"signature"in $&&(typeof $.signedMessage=="string"||$.signedMessage instanceof Uint8Array)&&$.signature instanceof Uint8Array)b=typeof $.signedMessage=="string"?$.signedMessage:new TextDecoder().decode($.signedMessage),S=$.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in U)||typeof U.signMessage!="function"||!("publicKey"in U)||typeof U!="object"||!U.publicKey||!("toBase58"in U.publicKey)||typeof U.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");b=[`${V.host} wants you to sign in with your Solana account:`,U.publicKey.toBase58(),...P?["",P,""]:[""],"Version: 1",`URI: ${V.href}`,`Issued At: ${(o=(i=N?.signInWithSolana)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date().toISOString()}`,...!((l=N?.signInWithSolana)===null||l===void 0)&&l.notBefore?[`Not Before: ${N.signInWithSolana.notBefore}`]:[],...!((u=N?.signInWithSolana)===null||u===void 0)&&u.expirationTime?[`Expiration Time: ${N.signInWithSolana.expirationTime}`]:[],...!((d=N?.signInWithSolana)===null||d===void 0)&&d.chainId?[`Chain ID: ${N.signInWithSolana.chainId}`]:[],...!((h=N?.signInWithSolana)===null||h===void 0)&&h.nonce?[`Nonce: ${N.signInWithSolana.nonce}`]:[],...!((m=N?.signInWithSolana)===null||m===void 0)&&m.requestId?[`Request ID: ${N.signInWithSolana.requestId}`]:[],...!((v=(y=N?.signInWithSolana)===null||y===void 0?void 0:y.resources)===null||v===void 0)&&v.length?["Resources",...N.signInWithSolana.resources.map($=>`- ${$}`)]:[]].join(`
63
+ `);const z=await U.signMessage(new TextEncoder().encode(b),"utf8");if(!z||!(z instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");S=z}}try{const{data:k,error:E}=await ce(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:b,signature:xr(S)},!((w=e.options)===null||w===void 0)&&w.captchaToken?{gotrue_meta_security:{captcha_token:(_=e.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:Yt});if(E)throw E;if(!k||!k.session||!k.user){const P=new Zr;return this._returnResult({data:{user:null,session:null},error:P})}return k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),this._returnResult({data:Object.assign({},k),error:E})}catch(k){if(ne(k))return this._returnResult({data:{user:null,session:null},error:k});throw k}}async _exchangeCodeForSession(e){const n=await hr(this.storage,`${this.storageKey}-code-verifier`),[i,o]=(n??"").split("/");try{if(!i&&this.flowType==="pkce")throw new Ij;const{data:l,error:u}=await ce(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:i},xform:Yt});if(await it(this.storage,`${this.storageKey}-code-verifier`),u)throw u;if(!l||!l.session||!l.user){const d=new Zr;return this._returnResult({data:{user:null,session:null,redirectType:null},error:d})}return l.session&&(await this._saveSession(l.session),setTimeout(async()=>{await this._notifyAllSubscribers("SIGNED_IN",l.session)},0)),this._returnResult({data:Object.assign(Object.assign({},l),{redirectType:o??null}),error:u})}catch(l){if(await it(this.storage,`${this.storageKey}-code-verifier`),ne(l))return this._returnResult({data:{user:null,session:null,redirectType:null},error:l});throw l}}async signInWithIdToken(e){try{const{options:n,provider:i,token:o,access_token:l,nonce:u}=e,d=await ce(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:i,id_token:o,access_token:l,nonce:u,gotrue_meta_security:{captcha_token:n?.captchaToken}},xform:Yt}),{data:h,error:m}=d;if(m)return this._returnResult({data:{user:null,session:null},error:m});if(!h||!h.session||!h.user){const y=new Zr;return this._returnResult({data:{user:null,session:null},error:y})}return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",h.session)),this._returnResult({data:h,error:m})}catch(n){if(ne(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(e){var n,i,o,l,u;try{if("email"in e){const{email:d,options:h}=e;let m=null,y=null;this.flowType==="pkce"&&([m,y]=await es(this.storage,this.storageKey));const{error:v}=await ce(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:d,data:(n=h?.data)!==null&&n!==void 0?n:{},create_user:(i=h?.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:h?.captchaToken},code_challenge:m,code_challenge_method:y},redirectTo:h?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:v})}if("phone"in e){const{phone:d,options:h}=e,{data:m,error:y}=await ce(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:d,data:(o=h?.data)!==null&&o!==void 0?o:{},create_user:(l=h?.shouldCreateUser)!==null&&l!==void 0?l:!0,gotrue_meta_security:{captcha_token:h?.captchaToken},channel:(u=h?.channel)!==null&&u!==void 0?u:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:m?.message_id},error:y})}throw new ha("You must provide either an email or phone number.")}catch(d){if(await it(this.storage,`${this.storageKey}-code-verifier`),ne(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async verifyOtp(e){var n,i;try{let o,l;"options"in e&&(o=(n=e.options)===null||n===void 0?void 0:n.redirectTo,l=(i=e.options)===null||i===void 0?void 0:i.captchaToken);const{data:u,error:d}=await ce(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:l}}),redirectTo:o,xform:Yt});if(d)throw d;if(!u)throw new Error("An error occurred on token verification.");const h=u.session,m=u.user;return h?.access_token&&(await this._saveSession(h),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",h)),this._returnResult({data:{user:m,session:h},error:null})}catch(o){if(ne(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signInWithSSO(e){var n,i,o,l,u;try{let d=null,h=null;this.flowType==="pkce"&&([d,h]=await es(this.storage,this.storageKey));const m=await ce(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(i=(n=e.options)===null||n===void 0?void 0:n.redirectTo)!==null&&i!==void 0?i:void 0}),!((o=e?.options)===null||o===void 0)&&o.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:d,code_challenge_method:h}),headers:this.headers,xform:i2});return!((l=m.data)===null||l===void 0)&&l.url&&ot()&&!(!((u=e.options)===null||u===void 0)&&u.skipBrowserRedirect)&&window.location.assign(m.data.url),this._returnResult(m)}catch(d){if(await it(this.storage,`${this.storageKey}-code-verifier`),ne(d))return this._returnResult({data:null,error:d});throw d}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:n},error:i}=e;if(i)throw i;if(!n)throw new At;const{error:o}=await ce(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:o})})}catch(e){if(ne(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const n=`${this.url}/resend`;if("email"in e){const{email:i,type:o,options:l}=e,{error:u}=await ce(this.fetch,"POST",n,{headers:this.headers,body:{email:i,type:o,gotrue_meta_security:{captcha_token:l?.captchaToken}},redirectTo:l?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:u})}else if("phone"in e){const{phone:i,type:o,options:l}=e,{data:u,error:d}=await ce(this.fetch,"POST",n,{headers:this.headers,body:{phone:i,type:o,gotrue_meta_security:{captcha_token:l?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:u?.message_id},error:d})}throw new ha("You must provide either an email or phone number and a type")}catch(n){if(ne(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n))}async _acquireLock(e,n){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const i=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),o=(async()=>(await i,await n()))();return this.pendingInLock.push((async()=>{try{await o}catch{}})()),o}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const i=n();for(this.pendingInLock.push((async()=>{try{await i}catch{}})()),await i;this.pendingInLock.length;){const o=[...this.pendingInLock];await Promise.all(o),this.pendingInLock.splice(0,o.length)}return await i}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await e(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const n=await hr(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?e=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const i=e.expires_at?e.expires_at*1e3-Date.now()<mc:!1;if(this._debug("#__loadSession()",`session has${i?"":" not"} expired`,"expires_at",e.expires_at),!i){if(this.userStorage){const u=await hr(this.userStorage,this.storageKey+"-user");u?.user?e.user=u.user:e.user=vc()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const u={value:this.suppressGetSessionWarning};e.user=t2(e.user,u),u.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:o,error:l}=await this._callRefreshToken(e.refresh_token);return l?this._returnResult({data:{session:null},error:l}):this._returnResult({data:{session:o},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(e){try{return e?await ce(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Kn}):await this._useSession(async n=>{var i,o,l;const{data:u,error:d}=n;if(d)throw d;return!(!((i=u.session)===null||i===void 0)&&i.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new At}:await ce(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(l=(o=u.session)===null||o===void 0?void 0:o.access_token)!==null&&l!==void 0?l:void 0,xform:Kn})})}catch(n){if(ne(n))return Rj(n)&&(await this._removeSession(),await it(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(e,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,n))}async _updateUser(e,n={}){try{return await this._useSession(async i=>{const{data:o,error:l}=i;if(l)throw l;if(!o.session)throw new At;const u=o.session;let d=null,h=null;this.flowType==="pkce"&&e.email!=null&&([d,h]=await es(this.storage,this.storageKey));const{data:m,error:y}=await ce(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:d,code_challenge_method:h}),jwt:u.access_token,xform:Kn});if(y)throw y;return u.user=m.user,await this._saveSession(u),await this._notifyAllSubscribers("USER_UPDATED",u),this._returnResult({data:{user:u.user},error:null})})}catch(i){if(await it(this.storage,`${this.storageKey}-code-verifier`),ne(i))return this._returnResult({data:{user:null},error:i});throw i}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new At;const n=Date.now()/1e3;let i=n,o=!0,l=null;const{payload:u}=yc(e.access_token);if(u.exp&&(i=u.exp,o=i<=n),o){const{data:d,error:h}=await this._callRefreshToken(e.refresh_token);if(h)return this._returnResult({data:{user:null,session:null},error:h});if(!d)return{data:{user:null,session:null},error:null};l=d}else{const{data:d,error:h}=await this._getUser(e.access_token);if(h)throw h;l={access_token:e.access_token,refresh_token:e.refresh_token,user:d.user,token_type:"bearer",expires_in:i-n,expires_at:i},await this._saveSession(l),await this._notifyAllSubscribers("SIGNED_IN",l)}return this._returnResult({data:{user:l.user,session:l},error:null})}catch(n){if(ne(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async n=>{var i;if(!e){const{data:u,error:d}=n;if(d)throw d;e=(i=u.session)!==null&&i!==void 0?i:void 0}if(!e?.refresh_token)throw new At;const{data:o,error:l}=await this._callRefreshToken(e.refresh_token);return l?this._returnResult({data:{user:null,session:null},error:l}):o?this._returnResult({data:{user:o.user,session:o},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(ne(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(e,n){try{if(!ot())throw new fa("No browser detected.");if(e.error||e.error_description||e.error_code)throw new fa(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new Jg("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new fa("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Jg("No code detected.");const{data:P,error:N}=await this._exchangeCodeForSession(e.code);if(N)throw N;const U=new URL(window.location.href);return U.searchParams.delete("code"),window.history.replaceState(window.history.state,"",U.toString()),{data:{session:P.session,redirectType:null},error:null}}const{provider_token:i,provider_refresh_token:o,access_token:l,refresh_token:u,expires_in:d,expires_at:h,token_type:m}=e;if(!l||!d||!u||!m)throw new fa("No session defined in URL");const y=Math.round(Date.now()/1e3),v=parseInt(d);let w=y+v;h&&(w=parseInt(h));const _=w-y;_*1e3<=is&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${_}s, should have been closer to ${v}s`);const b=w-v;y-b>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",b,w,y):y-b<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",b,w,y);const{data:S,error:k}=await this._getUser(l);if(k)throw k;const E={provider_token:i,provider_refresh_token:o,access_token:l,expires_in:v,expires_at:w,refresh_token:u,token_type:m,user:S.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:E,redirectType:e.type},error:null})}catch(i){if(ne(i))return this._returnResult({data:{session:null,redirectType:null},error:i});throw i}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const n=await hr(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&n)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async n=>{var i;const{data:o,error:l}=n;if(l)return this._returnResult({error:l});const u=(i=o.session)===null||i===void 0?void 0:i.access_token;if(u){const{error:d}=await this.admin.signOut(u,e);if(d&&!(Pj(d)&&(d.status===404||d.status===401||d.status===403)))return this._returnResult({error:d})}return e!=="others"&&(await this._removeSession(),await it(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const n=Fj(),i={id:n,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,i),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:i}}}async _emitInitialSession(e){return await this._useSession(async n=>{var i,o;try{const{data:{session:l},error:u}=n;if(u)throw u;await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",l)),this._debug("INITIAL_SESSION","callback id",e,"session",l)}catch(l){await((o=this.stateChangeEmitters.get(e))===null||o===void 0?void 0:o.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",l),console.error(l)}})}async resetPasswordForEmail(e,n={}){let i=null,o=null;this.flowType==="pkce"&&([i,o]=await es(this.storage,this.storageKey,!0));try{return await ce(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:i,code_challenge_method:o,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(l){if(await it(this.storage,`${this.storageKey}-code-verifier`),ne(l))return this._returnResult({data:null,error:l});throw l}}async getUserIdentities(){var e;try{const{data:n,error:i}=await this.getUser();if(i)throw i;return this._returnResult({data:{identities:(e=n.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(n){if(ne(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var n;try{const{data:i,error:o}=await this._useSession(async l=>{var u,d,h,m,y;const{data:v,error:w}=l;if(w)throw w;const _=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(u=e.options)===null||u===void 0?void 0:u.redirectTo,scopes:(d=e.options)===null||d===void 0?void 0:d.scopes,queryParams:(h=e.options)===null||h===void 0?void 0:h.queryParams,skipBrowserRedirect:!0});return await ce(this.fetch,"GET",_,{headers:this.headers,jwt:(y=(m=v.session)===null||m===void 0?void 0:m.access_token)!==null&&y!==void 0?y:void 0})});if(o)throw o;return ot()&&!(!((n=e.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(i?.url),this._returnResult({data:{provider:e.provider,url:i?.url},error:null})}catch(i){if(ne(i))return this._returnResult({data:{provider:e.provider,url:null},error:i});throw i}}async linkIdentityIdToken(e){return await this._useSession(async n=>{var i;try{const{error:o,data:{session:l}}=n;if(o)throw o;const{options:u,provider:d,token:h,access_token:m,nonce:y}=e,v=await ce(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(i=l?.access_token)!==null&&i!==void 0?i:void 0,body:{provider:d,id_token:h,access_token:m,nonce:y,link_identity:!0,gotrue_meta_security:{captcha_token:u?.captchaToken}},xform:Yt}),{data:w,error:_}=v;return _?this._returnResult({data:{user:null,session:null},error:_}):!w||!w.session||!w.user?this._returnResult({data:{user:null,session:null},error:new Zr}):(w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("USER_UPDATED",w.session)),this._returnResult({data:w,error:_}))}catch(o){if(await it(this.storage,`${this.storageKey}-code-verifier`),ne(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}})}async unlinkIdentity(e){try{return await this._useSession(async n=>{var i,o;const{data:l,error:u}=n;if(u)throw u;return await ce(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(o=(i=l.session)===null||i===void 0?void 0:i.access_token)!==null&&o!==void 0?o:void 0})})}catch(n){if(ne(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(e){const n=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{const i=Date.now();return await Wj(async o=>(o>0&&await qj(200*Math.pow(2,o-1)),this._debug(n,"refreshing attempt",o),await ce(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Yt})),(o,l)=>{const u=200*Math.pow(2,o);return l&&gc(l)&&Date.now()+u-i<is})}catch(i){if(this._debug(n,"error",i),ne(i))return this._returnResult({data:{session:null,user:null},error:i});throw i}finally{this._debug(n,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,n){const i=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",n,"url",i),ot()&&!n.skipBrowserRedirect&&window.location.assign(i),{data:{provider:e,url:i},error:null}}async _recoverAndRefresh(){var e,n;const i="#_recoverAndRefresh()";this._debug(i,"begin");try{const o=await hr(this.storage,this.storageKey);if(o&&this.userStorage){let u=await hr(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!u&&(u={user:o.user},await os(this.userStorage,this.storageKey+"-user",u)),o.user=(e=u?.user)!==null&&e!==void 0?e:vc()}else if(o&&!o.user&&!o.user){const u=await hr(this.storage,this.storageKey+"-user");u&&u?.user?(o.user=u.user,await it(this.storage,this.storageKey+"-user"),await os(this.storage,this.storageKey,o)):o.user=vc()}if(this._debug(i,"session from storage",o),!this._isValidSession(o)){this._debug(i,"session is not valid"),o!==null&&await this._removeSession();return}const l=((n=o.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<mc;if(this._debug(i,`session has${l?"":" not"} expired with margin of ${mc}s`),l){if(this.autoRefreshToken&&o.refresh_token){const{error:u}=await this._callRefreshToken(o.refresh_token);u&&(console.error(u),gc(u)||(this._debug(i,"refresh failed with a non-retryable error, removing the session",u),await this._removeSession()))}}else if(o.user&&o.user.__isUserNotAvailableProxy===!0)try{const{data:u,error:d}=await this._getUser(o.access_token);!d&&u?.user?(o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)):this._debug(i,"could not get user data, skipping SIGNED_IN notification")}catch(u){console.error("Error getting user data:",u),this._debug(i,"error getting user data, skipping SIGNED_IN notification",u)}else await this._notifyAllSubscribers("SIGNED_IN",o)}catch(o){this._debug(i,"error",o),console.error(o);return}finally{this._debug(i,"end")}}async _callRefreshToken(e){var n,i;if(!e)throw new At;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const o=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(o,"begin");try{this.refreshingDeferred=new Ga;const{data:l,error:u}=await this._refreshAccessToken(e);if(u)throw u;if(!l.session)throw new At;await this._saveSession(l.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",l.session);const d={data:l.session,error:null};return this.refreshingDeferred.resolve(d),d}catch(l){if(this._debug(o,"error",l),ne(l)){const u={data:null,error:l};return gc(l)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(u),u}throw(i=this.refreshingDeferred)===null||i===void 0||i.reject(l),l}finally{this.refreshingDeferred=null,this._debug(o,"end")}}async _notifyAllSubscribers(e,n,i=!0){const o=`#_notifyAllSubscribers(${e})`;this._debug(o,"begin",n,`broadcast = ${i}`);try{this.broadcastChannel&&i&&this.broadcastChannel.postMessage({event:e,session:n});const l=[],u=Array.from(this.stateChangeEmitters.values()).map(async d=>{try{await d.callback(e,n)}catch(h){l.push(h)}});if(await Promise.all(u),l.length>0){for(let d=0;d<l.length;d+=1)console.error(l[d]);throw l[0]}}finally{this._debug(o,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await it(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},e),i=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!i&&n.user&&await os(this.userStorage,this.storageKey+"-user",{user:n.user});const o=Object.assign({},n);delete o.user;const l=ey(o);await os(this.storage,this.storageKey,l)}else{const o=ey(n);await os(this.storage,this.storageKey,o)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await it(this.storage,this.storageKey),await it(this.storage,this.storageKey+"-code-verifier"),await it(this.storage,this.storageKey+"-user"),this.userStorage&&await it(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&ot()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),is);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async n=>{const{data:{session:i}}=n;if(!i||!i.refresh_token||!i.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const o=Math.floor((i.expires_at*1e3-e)/is);this._debug("#_autoRefreshTokenTick()",`access token expires in ${o} ticks, a tick lasts ${is}ms, refresh threshold is ${Xc} ticks`),o<=Xc&&await this._callRefreshToken(i.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof j0)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!ot()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const n=`#_onVisibilityChanged(${e})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,n,i){const o=[`provider=${encodeURIComponent(n)}`];if(i?.redirectTo&&o.push(`redirect_to=${encodeURIComponent(i.redirectTo)}`),i?.scopes&&o.push(`scopes=${encodeURIComponent(i.scopes)}`),this.flowType==="pkce"){const[l,u]=await es(this.storage,this.storageKey),d=new URLSearchParams({code_challenge:`${encodeURIComponent(l)}`,code_challenge_method:`${encodeURIComponent(u)}`});o.push(d.toString())}if(i?.queryParams){const l=new URLSearchParams(i.queryParams);o.push(l.toString())}return i?.skipBrowserRedirect&&o.push(`skip_http_redirect=${i.skipBrowserRedirect}`),`${e}?${o.join("&")}`}async _unenroll(e){try{return await this._useSession(async n=>{var i;const{data:o,error:l}=n;return l?this._returnResult({data:null,error:l}):await ce(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(i=o?.session)===null||i===void 0?void 0:i.access_token})})}catch(n){if(ne(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(e){try{return await this._useSession(async n=>{var i,o;const{data:l,error:u}=n;if(u)return this._returnResult({data:null,error:u});const d=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:h,error:m}=await ce(this.fetch,"POST",`${this.url}/factors`,{body:d,headers:this.headers,jwt:(i=l?.session)===null||i===void 0?void 0:i.access_token});return m?this._returnResult({data:null,error:m}):(e.factorType==="totp"&&h.type==="totp"&&(!((o=h?.totp)===null||o===void 0)&&o.qr_code)&&(h.totp.qr_code=`data:image/svg+xml;utf-8,${h.totp.qr_code}`),this._returnResult({data:h,error:null}))})}catch(n){if(ne(n))return this._returnResult({data:null,error:n});throw n}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var i;const{data:o,error:l}=n;if(l)return this._returnResult({data:null,error:l});const u=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?b2(e.webauthn.credential_response):_2(e.webauthn.credential_response)})}:{code:e.code}),{data:d,error:h}=await ce(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:u,headers:this.headers,jwt:(i=o?.session)===null||i===void 0?void 0:i.access_token});return h?this._returnResult({data:null,error:h}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+d.expires_in},d)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",d),this._returnResult({data:d,error:h}))})}catch(n){if(ne(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var i;const{data:o,error:l}=n;if(l)return this._returnResult({data:null,error:l});const u=await ce(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(i=o?.session)===null||i===void 0?void 0:i.access_token});if(u.error)return u;const{data:d}=u;if(d.type!=="webauthn")return{data:d,error:null};switch(d.webauthn.type){case"create":return{data:Object.assign(Object.assign({},d),{webauthn:Object.assign(Object.assign({},d.webauthn),{credential_options:Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:w2(d.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},d),{webauthn:Object.assign(Object.assign({},d.webauthn),{credential_options:Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:x2(d.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(ne(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(e){const{data:n,error:i}=await this._challenge({factorId:e.factorId});return i?this._returnResult({data:null,error:i}):await this._verify({factorId:e.factorId,challengeId:n.id,code:e.code})}async _listFactors(){var e;const{data:{user:n},error:i}=await this.getUser();if(i)return{data:null,error:i};const o={all:[],phone:[],totp:[],webauthn:[]};for(const l of(e=n?.factors)!==null&&e!==void 0?e:[])o.all.push(l),l.status==="verified"&&o[l.factor_type].push(l);return{data:o,error:null}}async _getAuthenticatorAssuranceLevel(){var e,n;const{data:{session:i},error:o}=await this.getSession();if(o)return this._returnResult({data:null,error:o});if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=yc(i.access_token);let u=null;l.aal&&(u=l.aal);let d=u;((n=(e=i.user.factors)===null||e===void 0?void 0:e.filter(y=>y.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(d="aal2");const m=l.amr||[];return{data:{currentLevel:u,nextLevel:d,currentAuthenticationMethods:m},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async n=>{const{data:{session:i},error:o}=n;return o?this._returnResult({data:null,error:o}):i?await ce(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:i.access_token,xform:l=>({data:l,error:null})}):this._returnResult({data:null,error:new At})})}catch(n){if(ne(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(e,n){try{return await this._useSession(async i=>{const{data:{session:o},error:l}=i;if(l)return this._returnResult({data:null,error:l});if(!o)return this._returnResult({data:null,error:new At});const u=await ce(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"approve"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&ot()&&!n?.skipBrowserRedirect&&window.location.assign(u.data.redirect_url),u})}catch(i){if(ne(i))return this._returnResult({data:null,error:i});throw i}}async _denyAuthorization(e,n){try{return await this._useSession(async i=>{const{data:{session:o},error:l}=i;if(l)return this._returnResult({data:null,error:l});if(!o)return this._returnResult({data:null,error:new At});const u=await ce(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"deny"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&ot()&&!n?.skipBrowserRedirect&&window.location.assign(u.data.redirect_url),u})}catch(i){if(ne(i))return this._returnResult({data:null,error:i});throw i}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:n},error:i}=e;return i?this._returnResult({data:null,error:i}):n?await ce(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:o=>({data:o,error:null})}):this._returnResult({data:null,error:new At})})}catch(e){if(ne(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async n=>{const{data:{session:i},error:o}=n;return o?this._returnResult({data:null,error:o}):i?(await ce(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:i.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new At})})}catch(n){if(ne(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(e,n={keys:[]}){let i=n.keys.find(d=>d.kid===e);if(i)return i;const o=Date.now();if(i=this.jwks.keys.find(d=>d.kid===e),i&&this.jwks_cached_at+Nj>o)return i;const{data:l,error:u}=await ce(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(u)throw u;return!l.keys||l.keys.length===0||(this.jwks=l,this.jwks_cached_at=o,i=l.keys.find(d=>d.kid===e),!i)?null:i}async getClaims(e,n={}){try{let i=e;if(!i){const{data:_,error:b}=await this.getSession();if(b||!_.session)return this._returnResult({data:null,error:b});i=_.session.access_token}const{header:o,payload:l,signature:u,raw:{header:d,payload:h}}=yc(i);n?.allowExpired||Xj(l.exp);const m=!o.alg||o.alg.startsWith("HS")||!o.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(o.kid,n?.keys?{keys:n.keys}:n?.jwks);if(!m){const{error:_}=await this.getUser(i);if(_)throw _;return{data:{claims:l,header:o,signature:u},error:null}}const y=Zj(o.alg),v=await crypto.subtle.importKey("jwk",m,y,!0,["verify"]);if(!await crypto.subtle.verify(y,v,u,$j(`${d}.${h}`)))throw new td("Invalid JWT signature");return{data:{claims:l,header:o,signature:u},error:null}}catch(i){if(ne(i))return this._returnResult({data:null,error:i});throw i}}}Ii.nextInstanceID={};const P2=Ii,R2="2.91.0";let mi="";typeof Deno<"u"?mi="deno":typeof document<"u"?mi="web":typeof navigator<"u"&&navigator.product==="ReactNative"?mi="react-native":mi="node";const O2={"X-Client-Info":`supabase-js-${mi}/${R2}`},I2={headers:O2},D2={schema:"public"},L2={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},M2={};function Di(t){"@babel/helpers - typeof";return Di=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Di(t)}function U2(t,e){if(Di(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(Di(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $2(t){var e=U2(t,"string");return Di(e)=="symbol"?e:e+""}function V2(t,e,n){return(e=$2(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ay(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,i)}return n}function qe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ay(Object(n),!0).forEach(function(i){V2(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ay(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}const F2=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),B2=()=>Headers,z2=(t,e,n)=>{const i=F2(n),o=B2();return async(l,u)=>{var d;const h=(d=await e())!==null&&d!==void 0?d:t;let m=new o(u?.headers);return m.has("apikey")||m.set("apikey",t),m.has("Authorization")||m.set("Authorization",`Bearer ${h}`),i(l,qe(qe({},u),{},{headers:m}))}};function q2(t){return t.endsWith("/")?t:t+"/"}function W2(t,e){var n,i;const{db:o,auth:l,realtime:u,global:d}=t,{db:h,auth:m,realtime:y,global:v}=e,w={db:qe(qe({},h),o),auth:qe(qe({},m),l),realtime:qe(qe({},y),u),storage:{},global:qe(qe(qe({},v),d),{},{headers:qe(qe({},(n=v?.headers)!==null&&n!==void 0?n:{}),(i=d?.headers)!==null&&i!==void 0?i:{})}),accessToken:async()=>""};return t.accessToken?w.accessToken=t.accessToken:delete w.accessToken,w}function H2(t){const e=t?.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(q2(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var K2=class extends P2{constructor(t){super(t)}},G2=class{constructor(t,e,n){var i,o;this.supabaseUrl=t,this.supabaseKey=e;const l=H2(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",l),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",l),this.storageUrl=new URL("storage/v1",l),this.functionsUrl=new URL("functions/v1",l);const u=`sb-${l.hostname.split(".")[0]}-auth-token`,d={db:D2,realtime:M2,auth:qe(qe({},L2),{},{storageKey:u}),global:I2},h=W2(n??{},d);if(this.storageKey=(i=h.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(o=h.global.headers)!==null&&o!==void 0?o:{},h.accessToken)this.accessToken=h.accessToken,this.auth=new Proxy({},{get:(y,v)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(v)} is not possible`)}});else{var m;this.auth=this._initSupabaseAuthClient((m=h.auth)!==null&&m!==void 0?m:{},this.headers,h.global.fetch)}this.fetch=z2(e,this._getAccessToken.bind(this),h.global.fetch),this.realtime=this._initRealtimeClient(qe({headers:this.headers,accessToken:this._getAccessToken.bind(this)},h.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(y=>this.realtime.setAuth(y)).catch(y=>console.warn("Failed to set initial Realtime auth token:",y)),this.rest=new jT(new URL("rest/v1",l).href,{headers:this.headers,schema:h.db.schema,fetch:this.fetch}),this.storage=new kj(this.storageUrl.href,this.headers,this.fetch,n?.storage),h.accessToken||this._listenForAuthEvents()}get functions(){return new _T(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,n)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,n;if(t.accessToken)return await t.accessToken();const{data:i}=await t.auth.getSession();return(e=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:n,storage:i,userStorage:o,storageKey:l,flowType:u,lock:d,debug:h,throwOnError:m},y,v){const w={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new K2({url:this.authUrl.href,headers:qe(qe({},w),y),storageKey:l,autoRefreshToken:t,persistSession:e,detectSessionInUrl:n,storage:i,userStorage:o,flowType:u,lock:d,debug:h,throwOnError:m,fetch:v,hasCustomAuthorizationHeader:Object.keys(this.headers).some(_=>_.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new qT(this.realtimeUrl.href,qe(qe({},t),{},{params:qe(qe({},{apikey:this.supabaseKey}),t?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e?.access_token)})}_handleTokenChanged(t,e,n){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const J2=(t,e,n)=>new G2(t,e,n);function Y2(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const n=e.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}Y2()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const Ja="alchemy_supabase_config";function Jd(){try{const t=localStorage.getItem(Ja);if(t)return JSON.parse(t)}catch(t){console.error("Error reading Supabase config:",t)}return null}function Q2(t){try{localStorage.setItem(Ja,JSON.stringify(t))}catch(e){console.error("Error saving Supabase config:",e)}}function X2(){try{localStorage.removeItem(Ja)}catch(t){console.error("Error clearing Supabase config:",t)}}async function Z2(t,e){try{if(!t.startsWith("http://")&&!t.startsWith("https://"))return{valid:!1,error:"Invalid URL format"};const n=e.startsWith("eyJ"),i=e.startsWith("sb_publishable_");if(!n&&!i)return{valid:!1,error:"Invalid API key format"};if(i)return{valid:!0};const o=await fetch(`${t}/rest/v1/`,{method:"GET",headers:{apikey:e,Authorization:`Bearer ${e}`}});return o.ok?{valid:!0}:o.status===401||o.status===403?{valid:!1,error:"Invalid API key"}:{valid:!1,error:`Connection failed: ${o.statusText}`}}catch(n){return{valid:!1,error:n instanceof Error?n.message:"Connection failed"}}}function eC(){return localStorage.getItem(Ja)?"ui":"none"}const Yd=Jd(),tC=Yd?.url||void 0||"https://placeholder.supabase.co",nC=Yd?.anonKey||void 0||"placeholder",me=J2(tC,nC,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),ly=!!Yd?.url;function rC({length:t=6,value:e,onChange:n,onComplete:i,disabled:o=!1,error:l=!1}){const u=R.useRef([]),[d,h]=R.useState(null),m=(w,_)=>{const b=_.replace(/[^0-9]/g,"");if(b.length===0){const E=e.split("");w<E.length&&E.splice(w,1);const P=E.join("");n(P),w>0&&u.current[w-1]?.focus();return}const S=[...e];S[w]=b[0];const k=S.join("");n(k),w<t-1&&b!==""&&u.current[w+1]?.focus(),k.length===t&&i&&i(k)},y=(w,_)=>{_.key==="Backspace"&&!e[w]&&w>0||_.key==="ArrowLeft"&&w>0?u.current[w-1]?.focus():_.key==="ArrowRight"&&w<t-1&&u.current[w+1]?.focus()},v=w=>{w.preventDefault();const b=w.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,t);n(b);const S=Math.min(b.length,t-1);u.current[S]?.focus(),b.length===t&&i&&i(b)};return p.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:t}).map((w,_)=>p.jsx("input",{ref:b=>{u.current[_]=b},type:"text",inputMode:"numeric",maxLength:1,value:e[_]||"",onChange:b=>m(_,b.target.value),onKeyDown:b=>y(_,b),onPaste:v,onFocus:()=>h(_),onBlur:()=>h(null),disabled:o,className:`
64
64
  w-10 h-10 sm:w-12 sm:h-12 text-center text-lg font-black
65
65
  bg-black/20 border border-border/50 rounded-xl outline-none transition-all
66
66
  ${l?"border-error/50 shadow-[0_0_15px_rgba(239,68,68,0.1)]":"focus:border-primary/50"}
67
67
  ${d===_?"border-primary/50 bg-black/40 scale-105":""}
68
68
  disabled:opacity-50 disabled:cursor-not-allowed
69
- `,"aria-label":`Digit ${_+1}`},_))})}function sC({onAuthSuccess:t,isInitialized:e=!0}){const[n,i]=R.useState(""),[o,l]=R.useState(""),[u,d]=R.useState(""),[h,m]=R.useState(""),[y,v]=R.useState(!1),[w,_]=R.useState(!e),[b,k]=R.useState(null),[S,E]=R.useState("password"),[A,P]=R.useState("email"),[U,V]=R.useState(""),z=async B=>{B.preventDefault(),v(!0),k(null);try{if(w){const{error:Y}=await ge.auth.signUp({email:n,password:o,options:{data:{first_name:u,last_name:h,full_name:`${u} ${h}`.trim()}}});if(Y)throw Y;t()}else if(S==="password"){const{error:Y}=await ge.auth.signInWithPassword({email:n,password:o});if(Y)throw Y;t()}else if(S==="otp")if(A==="email"){const{error:Y}=await ge.auth.signInWithOtp({email:n,options:{shouldCreateUser:!1}});if(Y)throw Y;P("verify")}else await $()}catch(Y){k(Y.message)}finally{v(!1)}},$=async()=>{v(!0),k(null);try{const{data:B,error:Y}=await ge.auth.verifyOtp({email:n,token:U,type:"magiclink"});if(Y)throw Y;if(!B.session)throw new Error("Failed to create session");t()}catch(B){k(B.message||"Invalid code")}finally{v(!1)}};return p.jsx("div",{className:"flex flex-col items-center justify-center p-8 h-full bg-gradient-to-t from-bg to-bg/50",children:p.jsxs(Ne.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"w-full max-w-md glass p-8 space-y-8",children:[p.jsxs("div",{className:"text-center space-y-2",children:[p.jsx("h2",{className:"text-3xl font-black italic tracking-tighter",children:!e&&w?"INITIALIZE MASTER":w?"JOIN THE CIRCLE":S==="otp"?"MYSTIC ACCESS":"ALCHEMIST LOGIN"}),p.jsx("p",{className:"text-xs text-fg/40 font-mono tracking-widest uppercase",children:!e&&w?"Forge the prime alchemist account":S==="otp"?A==="email"?"Enter your essence email":"Transmute the sacred code":"Transmute your data into intelligence"})]}),p.jsx("form",{onSubmit:z,className:"space-y-4",children:p.jsxs(bn,{mode:"wait",children:[w&&p.jsxs(Ne.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"grid grid-cols-2 gap-4 overflow-hidden",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"First Name"}),p.jsx("input",{type:"text",value:u,onChange:B=>d(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"Zosimos",required:!0})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Last Name"}),p.jsx("input",{type:"text",value:h,onChange:B=>m(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"Panopolis",required:!0})]})]},"signup-fields"),S==="otp"&&A==="verify"?p.jsxs(Ne.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6 py-4",children:[p.jsx("div",{className:"flex justify-center",children:p.jsx(rC,{value:U,onChange:V,length:6,onComplete:B=>{V(B)},error:!!b})}),p.jsx("button",{type:"button",onClick:()=>P("email"),className:"w-full text-[10px] font-bold uppercase text-primary/40 hover:text-primary transition-colors tracking-widest",children:"Change email address"}),p.jsxs("button",{type:"button",disabled:y||U.length!==6,onClick:$,className:"w-full py-4 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center justify-center gap-2",children:[y?p.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):p.jsx(rm,{size:18}),"VERIFY CODE"]})]},"otp-verify"):p.jsxs(Ne.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"space-y-4",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Email Address"}),p.jsxs("div",{className:"relative",children:[p.jsx(l1,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg/20",size:16}),p.jsx("input",{type:"email",value:n,onChange:B=>i(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 pl-10 pr-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"alchemist@example.com",required:!0})]})]}),(w||S==="password")&&p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Complexity Key"}),p.jsxs("div",{className:"relative",children:[p.jsx(a1,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg/20",size:16}),p.jsx("input",{type:"password",value:o,onChange:B=>l(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 pl-10 pr-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"••••••••",required:!0})]})]}),p.jsxs("button",{type:"submit",disabled:y,className:"w-full py-4 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center justify-center gap-2",children:[y&&p.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),w?p.jsx(y1,{size:18}):p.jsx(rm,{size:18}),w?"INITIALIZE ACCOUNT":S==="otp"?"SEND CODE":"UNSEAL ENGINE"]})]},"base-login")]})}),b&&S==="password"&&p.jsx(Ne.p,{initial:{opacity:0},animate:{opacity:1},className:"text-xs text-error font-medium bg-error/10 p-3 rounded-lg border border-error/10",children:b}),p.jsxs("div",{className:"space-y-4",children:[!w&&p.jsx("div",{className:"flex flex-col gap-2",children:S==="password"?p.jsxs("button",{type:"button",onClick:()=>{E("otp"),P("email"),k(null)},className:"w-full flex items-center justify-center gap-2 py-3 glass hover:bg-surface text-xs font-bold uppercase tracking-widest transition-all text-fg/40 hover:text-primary",children:[p.jsx(s1,{size:16})," Sign in with Code"]}):p.jsxs("button",{type:"button",onClick:()=>{E("password"),k(null)},className:"w-full flex items-center justify-center gap-2 py-3 glass hover:bg-surface text-xs font-bold uppercase tracking-widest transition-all text-fg/40 hover:text-primary",children:[p.jsx(Hx,{size:16})," Sign in with Password"]})}),p.jsxs("p",{className:"text-center text-xs text-fg/40",children:[w?"Already an Alchemist?":"New to Alchemy?"," "," ",p.jsx("button",{onClick:()=>{_(!w),E("password"),k(null)},className:"text-primary font-bold hover:underline",children:w?"Login instead":"Create an account"})]})]})]})})}function iC(t){const e=t.trim();return e?e.startsWith("http://")||e.startsWith("https://")?e:`https://${e}.supabase.co`:""}function A0({onComplete:t,open:e=!0,canClose:n=!1}){const[i,o]=R.useState("welcome"),[l,u]=R.useState(""),[d,h]=R.useState(""),[m,y]=R.useState(null),[v,w]=R.useState(!1);if(!e)return null;const _=async()=>{y(null),w(!0),o("validating");const b=iC(l),k=d.trim(),S=await Z2(b,k);S.valid?(Q2({url:b,anonKey:k}),o("success"),setTimeout(()=>{window.location.reload()},1500)):(y(S.error||"Connection failed"),o("credentials"),w(!1))};return p.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-6 bg-bg/80 backdrop-blur-sm",children:p.jsxs(Ne.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"w-full max-w-lg glass p-8 space-y-8 relative overflow-hidden",children:[p.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-primary/10 rounded-full blur-3xl -translate-y-1/2 translate-x-1/2"}),p.jsxs(bn,{mode:"wait",children:[i==="welcome"&&p.jsxs(Ne.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("div",{className:"p-2 bg-primary/10 rounded-xl",children:p.jsx(ki,{className:"w-6 h-6 text-primary"})}),p.jsx("h2",{className:"text-2xl font-black italic tracking-tighter uppercase",children:"Assemble Your Engine"})]}),p.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Alchemy requires a Supabase essence to store signal fragments and intelligence patterns."})]}),p.jsxs("div",{className:"glass bg-white/5 border-white/10 p-4 rounded-xl space-y-3",children:[p.jsx("p",{className:"text-xs font-bold uppercase tracking-widest text-primary/70",children:"Requirements:"}),p.jsxs("ul",{className:"space-y-2",children:[p.jsxs("li",{className:"flex items-center gap-2 text-sm text-fg/60",children:[p.jsx(Si,{className:"w-4 h-4 text-emerald-500"})," Supabase Project URL"]}),p.jsxs("li",{className:"flex items-center gap-2 text-sm text-fg/60",children:[p.jsx(Si,{className:"w-4 h-4 text-emerald-500"})," Anon Public API Key"]})]})]}),p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsxs("a",{href:"https://supabase.com",target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-2 py-3 border border-border/20 rounded-xl text-xs font-bold uppercase tracking-widest hover:bg-white/5 transition-all text-fg/60",children:["Forge Project at Supabase ",p.jsx(Oa,{size:14})]}),p.jsxs("button",{onClick:()=>o("credentials"),className:"w-full py-4 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.01] active:scale-95 transition-all flex items-center justify-center gap-2",children:["BEGIN INITIALIZATION ",p.jsx(Kx,{size:18})]})]})]},"welcome"),i==="credentials"&&p.jsxs(Ne.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx("h2",{className:"text-2xl font-black italic tracking-tighter uppercase",children:"Essence Coordinates"}),p.jsx("p",{className:"text-sm text-fg/50 font-medium lowercase",children:"Link the alchemist engine to your cloud database"})]}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Project URL or ID"}),p.jsx("input",{type:"text",value:l,onChange:b=>u(b.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"https://xxx.supabase.co or project-id"})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Anon Public Key"}),p.jsx("input",{type:"password",value:d,onChange:b=>h(b.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"eyJ..."})]})]}),m&&p.jsxs("div",{className:"bg-error/10 border border-error/20 p-3 rounded-xl flex items-center gap-3",children:[p.jsx(Mi,{className:"w-5 h-5 text-error"}),p.jsx("p",{className:"text-xs text-error font-bold tracking-tight",children:m})]}),p.jsxs("div",{className:"flex gap-3",children:[p.jsx("button",{onClick:()=>o("welcome"),className:"flex-1 py-4 border border-border/20 rounded-xl text-xs font-bold uppercase tracking-widest hover:bg-white/5 transition-all text-fg/40",children:"BACK"}),p.jsxs("button",{onClick:_,disabled:!l||!d,className:"flex-[2] py-4 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.01] active:scale-95 transition-all disabled:opacity-50 disabled:grayscale flex items-center justify-center gap-2",children:["CONNECT ESSENCE ",p.jsx(Sr,{size:18})]})]})]},"credentials"),i==="validating"&&p.jsxs(Ne.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center py-12 space-y-6",children:[p.jsxs("div",{className:"relative",children:[p.jsx("div",{className:"absolute inset-0 bg-primary/20 blur-xl rounded-full"}),p.jsx(Kn,{className:"w-16 h-16 animate-spin text-primary relative z-10"})]}),p.jsxs("div",{className:"text-center space-y-2",children:[p.jsx("h3",{className:"text-xl font-bold italic uppercase tracking-tighter",children:"Validating Link"}),p.jsx("p",{className:"text-sm text-fg/40 font-mono tracking-widest uppercase animate-pulse",children:"Synchronizing Resonance..."})]})]},"validating"),i==="success"&&p.jsxs(Ne.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"flex flex-col items-center justify-center py-12 space-y-6",children:[p.jsx("div",{className:"p-4 bg-emerald-500/20 rounded-full",children:p.jsx(nd,{className:"w-16 h-16 text-emerald-500"})}),p.jsxs("div",{className:"text-center space-y-2",children:[p.jsx("h3",{className:"text-2xl font-black italic uppercase tracking-tighter",children:"Engine Aligned"}),p.jsx("p",{className:"text-sm text-fg/40 font-mono tracking-widest uppercase",children:"Restarting Alchemist Subsystems..."})]})]},"success")]})]})})}const zn={chrome:{icon:p.jsx(e1,{size:18}),name:"Google Chrome",color:"text-yellow-500"},firefox:{icon:p.jsx(Ku,{size:18}),name:"Mozilla Firefox",color:"text-orange-500"},safari:{icon:p.jsx(Ku,{size:18}),name:"Safari",color:"text-blue-500"},edge:{icon:p.jsx(Ku,{size:18}),name:"Microsoft Edge",color:"text-cyan-500"},brave:{icon:p.jsx(Sr,{size:18}),name:"Brave",color:"text-orange-400"},arc:{icon:p.jsx(Sr,{size:18}),name:"Arc",color:"text-purple-500"}};function oC({sources:t,onChange:e}){const[n,i]=R.useState(!1),[o,l]=R.useState({}),[u,d]=R.useState(""),[h,m]=R.useState("chrome"),[y,v]=R.useState(!1),w=async()=>{i(!0);try{const{data:E}=await Re.get("/api/browser-paths/detect");l(E)}catch(E){console.error("Detection failed:",E)}finally{i(!1)}},_=E=>{const A=o[E];if(!A||!A.found||!A.valid||t.find(V=>V.browser===E&&V.path===A.path))return;const U={browser:E,path:A.path,enabled:!0,label:`${zn[E].name} (Auto-detected)`};e([...t,U])},b=async()=>{if(u.trim()){v(!0);try{const{data:E}=await Re.post("/api/browser-paths/validate",{path:u});if(!E.valid){alert(`Invalid path: ${E.error||"Not a browser history database"}`),v(!1);return}const A={browser:h,path:u,enabled:!0,label:`${zn[h].name} (Custom)`};e([...t,A]),d("")}catch(E){console.error("Validation failed:",E),alert("Failed to validate path")}finally{v(!1)}}},k=E=>{const A=[...t];A[E].enabled=!A[E].enabled,e(A)},S=E=>{e(t.filter((A,P)=>P!==E))};return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[p.jsx(_c,{size:14})," Auto-Detect Browsers"]}),p.jsxs("button",{onClick:w,disabled:n,className:"px-3 py-1.5 text-xs font-bold uppercase tracking-widest bg-primary/10 hover:bg-primary/20 text-primary rounded-lg transition-all flex items-center gap-2",children:[n?p.jsx(Kn,{size:12,className:"animate-spin"}):p.jsx(_c,{size:12}),n?"Scanning...":"Scan System"]})]}),Object.keys(o).length>0&&p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Object.keys(zn).map(E=>{const A=o[E],P=zn[E],U=t.some(V=>V.browser===E&&V.path===A?.path);return p.jsxs(Ne.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:`glass p-4 rounded-xl border ${A?.found&&A?.valid?"border-success/20 bg-success/5":A?.found?"border-error/20 bg-error/5":"border-border/10"}`,children:[p.jsxs("div",{className:"flex items-start justify-between mb-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:P.color,children:P.icon}),p.jsx("span",{className:"text-sm font-bold",children:P.name})]}),A?.found&&A?.valid?p.jsx(Si,{size:16,className:"text-success"}):A?.found?p.jsx(Mi,{size:16,className:"text-error"}):p.jsx(ps,{size:16,className:"text-fg/20"})]}),A?.found?p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"text-[10px] font-mono text-fg/40 truncate mb-2",children:A.path}),A.valid?p.jsx("button",{onClick:()=>_(E),disabled:U,className:`w-full py-1.5 text-xs font-bold uppercase tracking-widest rounded-lg transition-all ${U?"bg-fg/5 text-fg/30 cursor-not-allowed":"bg-success/10 hover:bg-success/20 text-success"}`,children:U?"Already Added":"Add Source"}):p.jsx("p",{className:"text-[10px] text-error font-medium",children:A.error})]}):p.jsx("p",{className:"text-[10px] text-fg/30 italic",children:"Not found on this system"})]},E)})})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[p.jsx(n1,{size:14})," Add Custom Path"]}),p.jsxs("div",{className:"glass p-4 rounded-xl space-y-3",children:[p.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[p.jsx("select",{value:h,onChange:E=>m(E.target.value),className:"bg-black/20 border border-border/5 rounded-xl py-2 px-3 text-sm focus:border-primary/30 outline-none transition-all",children:Object.keys(zn).map(E=>p.jsx("option",{value:E,children:zn[E].name},E))}),p.jsx("input",{type:"text",value:u,onChange:E=>d(E.target.value),placeholder:"/path/to/browser/History",className:"col-span-2 bg-black/20 border border-border/5 rounded-xl py-2 px-3 text-sm focus:border-primary/30 outline-none transition-all"})]}),p.jsxs("button",{onClick:b,disabled:!u.trim()||y,className:"w-full py-2.5 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg hover:scale-[1.01] active:scale-95 transition-all flex items-center justify-center gap-2 disabled:opacity-50 disabled:grayscale",children:[y?p.jsx(Kn,{size:16,className:"animate-spin"}):p.jsx(d1,{size:16}),y?"Validating...":"Add Custom Source"]})]})]}),t.length>0&&p.jsxs("div",{className:"space-y-3",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:["Configured Sources (",t.length,")"]}),p.jsx("div",{className:"space-y-2",children:p.jsx(bn,{children:t.map((E,A)=>p.jsxs(Ne.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},className:`glass p-4 rounded-xl border border-border/10 flex items-center justify-between ${!E.enabled&&"opacity-50"}`,children:[p.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[p.jsx("div",{className:zn[E.browser].color,children:zn[E.browser].icon}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("p",{className:"text-sm font-bold",children:E.label}),p.jsx("p",{className:"text-[10px] font-mono text-fg/40 truncate",children:E.path})]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:()=>k(A),className:`px-3 py-1.5 text-xs font-bold uppercase tracking-widest rounded-lg transition-all ${E.enabled?"bg-success/10 text-success":"bg-fg/5 text-fg/40"}`,children:E.enabled?"Enabled":"Disabled"}),p.jsx("button",{onClick:()=>S(A),className:"p-2 hover:bg-error/10 text-error rounded-lg transition-all",children:p.jsx(ps,{size:16})})]})]},`${E.browser}-${E.path}`))})})]})]})}const P0=R.createContext(void 0);function aC({children:t}){const[e,n]=R.useState([]),i=R.useCallback((o,l="info")=>{const u=Math.random().toString(36).substr(2,9),d={id:u,type:l,message:o};n(h=>[...h,d]),setTimeout(()=>{n(h=>h.filter(m=>m.id!==u))},3e3)},[]);return p.jsxs(P0.Provider,{value:{showToast:i},children:[t,p.jsx(lC,{toasts:e})]})}function R0(){const t=R.useContext(P0);if(!t)throw new Error("useToast must be used within ToastProvider");return t}function lC({toasts:t}){return p.jsx("div",{className:"fixed bottom-6 right-6 z-[100] flex flex-col gap-2 pointer-events-none",children:p.jsx(bn,{children:t.map(e=>p.jsx(uC,{toast:e},e.id))})})}function uC({toast:t}){const e={success:p.jsx(Si,{size:18,className:"text-success"}),error:p.jsx(ps,{size:18,className:"text-error"}),warning:p.jsx(Mi,{size:18,className:"text-accent"}),info:p.jsx(hy,{size:18,className:"text-primary"})},n={success:"border-success/20 bg-success/10",error:"border-error/20 bg-error/10",warning:"border-accent/20 bg-accent/10",info:"border-primary/20 bg-primary/10"};return p.jsxs(Ne.div,{initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,x:100,scale:.95},className:`glass px-4 py-3 rounded-xl border ${n[t.type]} flex items-center gap-3 min-w-[300px] max-w-md pointer-events-auto shadow-lg`,children:[e[t.type],p.jsx("span",{className:"text-sm font-medium flex-1",children:t.message})]})}function cC(){const{showToast:t}=R0(),[e,n]=R.useState("http://localhost:11434"),[i,o]=R.useState("llama3"),[l,u]=R.useState(""),[d,h]=R.useState([]),[m,y]=R.useState(!1),[v,w]=R.useState(!1);R.useEffect(()=>{_()},[]);const _=async()=>{const{data:{user:S}}=await ge.auth.getUser();if(!S)return;const{data:E}=await ge.from("alchemy_settings").select("*").eq("user_id",S.id).maybeSingle();E&&(n(E.llm_base_url||E.ollama_host||"http://localhost:11434"),o(E.llm_model_name||"llama3"),u(E.llm_api_key||E.openai_api_key||E.anthropic_api_key||""),h(E.custom_browser_paths||[]))},b=async()=>{y(!0);try{const{data:{user:S}}=await ge.auth.getUser();if(!S){t("Please log in to save settings","error"),y(!1);return}console.log("[AlchemistEngine] Saving settings:",{user_id:S.id,llm_base_url:e,llm_model_name:i,custom_browser_paths:d});const{error:E}=await ge.from("alchemy_settings").upsert({user_id:S.id,llm_base_url:e,llm_model_name:i,llm_api_key:l,custom_browser_paths:d},{onConflict:"user_id"});E?(console.error("[AlchemistEngine] Save error:",E),t(`Failed to save: ${E.message}`,"error")):(console.log("[AlchemistEngine] Settings saved successfully"),t("Engine settings synchronized successfully","success"))}catch(S){console.error("[AlchemistEngine] Unexpected error:",S),t(`Unexpected error: ${S.message}`,"error")}finally{y(!1)}},k=async()=>{w(!0);try{const{data:S}=await Re.post("/api/llm/test",{baseUrl:e,modelName:i,apiKey:l});S.success?t(`Connection successful! ${S.model?`Model: ${S.model}`:""}`,"success"):t(`Connection failed: ${S.message}`,"error")}catch(S){console.error("[AlchemistEngine] Test error:",S),t(`Test failed: ${S.message}`,"error")}finally{w(!1)}};return p.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p.jsxs("header",{className:"px-8 py-6 border-b border-border/10",children:[p.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Intelligence Engine"}),p.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Fine-tune the Alchemist's cognitive parameters and provider links."})]}),p.jsx("main",{className:"flex-1 overflow-y-auto custom-scrollbar p-8",children:p.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[p.jsx("section",{className:"space-y-6",children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[p.jsx(dy,{size:14})," universal configuration"]}),p.jsxs("div",{className:"glass p-8 space-y-6",children:[p.jsx(wc,{label:"Provider URL (Base)",value:e,onChange:n,placeholder:"http://localhost:11434 or https://api.openai.com/v1"}),p.jsx(wc,{label:"Intelligence Model",value:i,onChange:o,placeholder:"llama3, gpt-4o, claude-3-5-sonnet..."}),p.jsx(wc,{label:"Secret Key (Optional)",type:"password",value:l,onChange:u,placeholder:"sk-..."}),p.jsx("div",{className:"p-4 bg-primary/5 rounded-2xl",children:p.jsx("p",{className:"text-[10px] text-primary/60 font-medium leading-relaxed",children:"The Alchemist uses a unified interface. You can point this to local Ollama instances, OpenAI-compatible APIs, or any custom LLM endpoint."})})]})]})}),p.jsx("section",{className:"space-y-6",children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[p.jsx(ki,{size:14})," Browser History Sources"]}),p.jsx("div",{className:"glass p-8 space-y-6",children:p.jsx(oC,{sources:d,onChange:h})})]})}),p.jsxs("div",{className:"flex justify-end pt-4 border-t border-border/10 gap-3",children:[p.jsxs("button",{onClick:k,disabled:v||m,className:"px-6 py-3 bg-surface hover:bg-surface/80 border border-border/10 text-fg font-bold rounded-xl shadow-sm hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[v?p.jsx(Kn,{size:18,className:"animate-spin"}):p.jsx(Sr,{size:18,className:"text-accent"}),"Test Connection"]}),p.jsxs("button",{onClick:b,disabled:m,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[m?p.jsx(Kn,{size:18,className:"animate-spin"}):p.jsx(sd,{size:18}),"Synchronize Engine"]})]})]})})]})}function wc({label:t,value:e,onChange:n,placeholder:i,type:o="text"}){return p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:t}),p.jsx("input",{type:o,value:e,onChange:l=>n(l.target.value),className:"w-full bg-black/20 border border-border/5 rounded-xl py-3 px-4 text-sm focus:border-primary/30 outline-none transition-all",placeholder:i})]})}const O0=R.createContext(null);function dC({children:t}){const[e,n]=R.useState(!1),i=()=>n(!0),o=()=>n(!1);return p.jsx(O0.Provider,{value:{isExpanded:e,setIsExpanded:n,openTerminal:i,closeTerminal:o},children:t})}function hC(){const t=R.useContext(O0);if(!t)throw new Error("useTerminal must be used within a TerminalProvider");return t}function fC({isExpanded:t,onToggle:e}={}){const[n,i]=R.useState([]),{isExpanded:o,setIsExpanded:l}=hC(),[u,d]=R.useState({}),h=t!==void 0?t:o,m=e||(()=>l(!o));R.useEffect(()=>{y();const _=ge.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},b=>{const k=b.new;k.event_type==="error"&&d(S=>({...S,[k.id]:!0})),i(S=>{const E=[k,...S];return E.length>50?E.slice(0,50):E})}).subscribe();return()=>{ge.removeChannel(_)}},[]);const y=async()=>{const{data:_}=await ge.from("processing_events").select("*").order("created_at",{ascending:!1}).limit(30);_&&i(_)},v=_=>{d(b=>({...b,[_]:!b[_]}))},w=(_,b)=>{if(b==="debug")return p.jsx(Yx,{size:14,className:"text-fg/40"});switch(_){case"analysis":return p.jsx(Jx,{size:14,className:"text-primary"});case"action":return p.jsx(Sr,{size:14,className:"text-accent"});case"error":return p.jsx(qx,{size:14,className:"text-error"});case"system":return p.jsx(rd,{size:14,className:"text-success"});default:return p.jsx(hy,{size:14,className:"text-fg/40"})}};return h?p.jsxs(Ne.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},className:"fixed bottom-6 right-6 z-50 w-[450px] max-h-[600px] glass shadow-2xl flex flex-col overflow-hidden border-primary/10",children:[p.jsxs("div",{className:"p-4 border-b border-border/10 flex items-center justify-between bg-surface/50",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Sc,{size:18,className:"text-primary"}),p.jsx("span",{className:"text-xs font-bold uppercase tracking-widest",children:"Alchemist Engine"}),p.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold bg-success/10 text-success px-2 py-0.5 rounded-full border border-success/10 animate-pulse ml-2",children:[p.jsx(zx,{size:10})," LIVE"]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:()=>i([]),className:"text-[10px] uppercase font-bold text-fg/40 hover:text-fg px-2 py-1 transition-colors",children:"Clear"}),p.jsx("button",{onClick:m,className:"text-fg/40 hover:text-fg p-1 transition-colors",children:p.jsx(u1,{size:18})})]})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 custom-scrollbar bg-black/20",children:[n.length===0&&p.jsx("div",{className:"text-center py-12 text-fg/20 italic text-xs",children:"Idle. Awaiting signal mining events..."}),n.map(_=>p.jsxs("div",{className:"relative flex items-start gap-3 group",children:[p.jsx("div",{className:"mt-1 flex-shrink-0 w-6 h-6 rounded-full bg-surface border border-white/5 flex items-center justify-center",children:w(_.event_type,_.level)}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[p.jsx("span",{className:"text-xs font-mono text-fg/60 shrink-0",children:new Date(_.created_at||Date.now()).toLocaleTimeString()}),p.jsx("span",{className:`text-xs font-bold uppercase tracking-wider ${_.level==="error"?"text-error":_.level==="warn"?"text-orange-400":_.event_type==="analysis"?"text-primary":"text-fg/90"}`,children:_.agent_state}),_.duration_ms&&p.jsxs("span",{className:"ml-auto text-[10px] font-mono bg-bg/50 px-1.5 py-0.5 rounded flex items-center gap-1 text-fg/40",children:[p.jsx(fs,{size:10}),_.duration_ms,"ms"]})]}),p.jsx("p",{className:`text-sm break-words leading-relaxed ${_.level==="debug"?"text-fg/50 font-mono text-xs":""}`,children:_.message}),(_.details||_.metadata)&&p.jsxs("div",{className:"mt-2 text-xs",children:[p.jsxs("button",{onClick:()=>v(_.id),className:"flex items-center gap-1 text-fg/40 hover:text-primary transition-colors",children:[u[_.id]?p.jsx(Zx,{size:12}):p.jsx(bc,{size:12}),u[_.id]?"Hide Details":"View Details"]}),p.jsx(bn,{children:u[_.id]&&p.jsx(Ne.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:p.jsx("pre",{className:"mt-2 p-3 bg-bg/50 rounded border border-white/5 font-mono text-[10px] overflow-x-auto text-fg/70",children:JSON.stringify({..._.details,..._.metadata},null,2)})})})]})]})]},_.id))]})]}):p.jsxs("button",{onClick:m,className:"fixed bottom-6 right-6 z-50 glass p-4 flex items-center gap-3 hover:bg-surface transition-all shadow-xl group border-primary/10",children:[p.jsxs("div",{className:"relative",children:[p.jsx(Sc,{size:20,className:"text-primary"}),n.length>0&&p.jsxs("span",{className:"absolute -top-1 -right-1 flex h-2 w-2",children:[p.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),p.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]})]}),p.jsx("span",{className:"text-xs font-bold uppercase tracking-widest hidden group-hover:block animate-in fade-in slide-in-from-right-2",children:"Live Engine Log"})]})}const I0="1.0.0",pC="20260125000004";async function mC(t){try{const{data:e,error:n}=await t.rpc("get_latest_migration_timestamp");return n?n.code==="42883"?{version:null,latestMigrationTimestamp:"0"}:{version:null,latestMigrationTimestamp:null}:{version:I0,latestMigrationTimestamp:e||null}}catch{return{version:null,latestMigrationTimestamp:null}}}async function gC(t){const e=I0,n=pC,i=await mC(t);if(i.latestMigrationTimestamp&&i.latestMigrationTimestamp.trim()!==""){const o=n,l=i.latestMigrationTimestamp;return o>l?{needsMigration:!0,appVersion:e,dbVersion:i.version,latestMigrationTimestamp:l,message:`New migrations available. Database is at ${l}, app has ${o}.`}:{needsMigration:!1,appVersion:e,dbVersion:i.version,latestMigrationTimestamp:l,message:"Database schema is up-to-date."}}return{needsMigration:!0,appVersion:e,dbVersion:null,latestMigrationTimestamp:null,message:"Database schema unknown. Migration required."}}function yC(){const[t,e]=R.useState("profile"),[n,i]=R.useState(!1);return p.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p.jsxs("header",{className:"px-8 py-6 border-b border-border/10",children:[p.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Account Configuration"}),p.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Manage your Alchemist profile and essence links."})]}),p.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[p.jsxs("aside",{className:"w-64 border-r border-border/10 p-4 space-y-1",children:[p.jsx(xc,{active:t==="profile",onClick:()=>e("profile"),icon:p.jsx(id,{size:18}),label:"Profile"}),p.jsx(xc,{active:t==="security",onClick:()=>e("security"),icon:p.jsx(fy,{size:18}),label:"Security"}),p.jsx(xc,{active:t==="supabase",onClick:()=>e("supabase"),icon:p.jsx(ki,{size:18}),label:"Supabase"})]}),p.jsxs("main",{className:"flex-1 overflow-y-auto custom-scrollbar p-8",children:[t==="profile"&&p.jsx(vC,{}),t==="security"&&p.jsx(wC,{}),t==="supabase"&&p.jsx(xC,{})]})]})]})}function vC(){const[t,e]=R.useState(""),[n,i]=R.useState(""),[o,l]=R.useState(""),[u,d]=R.useState(!1),[h,m]=R.useState(!1),[y,v]=R.useState(null),[w,_]=R.useState(!0);R.useEffect(()=>{b()},[]);const b=async()=>{const{data:{user:E}}=await ge.auth.getUser();if(!E)return;l(E.email||"");const{data:A}=await ge.from("profiles").select("*").eq("id",E.id).maybeSingle();A&&(e(A.first_name||""),i(A.last_name||""),v(A.avatar_url));const{data:P}=await ge.from("alchemy_settings").select("sound_enabled").eq("user_id",E.id).maybeSingle();P&&_(P.sound_enabled??!0)},k=async()=>{d(!0);const{data:{user:E}}=await ge.auth.getUser();E&&(await ge.from("profiles").upsert({id:E.id,first_name:t,last_name:n,full_name:t&&n?`${t} ${n}`:t||n||null}),await ge.from("alchemy_settings").update({sound_enabled:w}).eq("user_id",E.id),d(!1))},S=async E=>{const A=E.target.files?.[0];if(A){m(!0);try{const{data:{user:P}}=await ge.auth.getUser();if(!P)return;const U=A.name.split(".").pop(),V=`${P.id}/avatar-${Date.now()}.${U}`,{error:z}=await ge.storage.from("avatars").upload(V,A,{upsert:!0});if(z)throw z;const{data:{publicUrl:$}}=ge.storage.from("avatars").getPublicUrl(V);await ge.from("profiles").update({avatar_url:$}).eq("id",P.id),v($)}catch(P){console.error("Avatar upload failed:",P)}finally{m(!1)}}};return p.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[p.jsxs("section",{className:"flex items-start gap-8",children:[p.jsxs("div",{className:"relative group",children:[p.jsx("div",{className:"w-32 h-32 rounded-3xl bg-surface border border-border/20 flex items-center justify-center overflow-hidden shadow-xl",children:y?p.jsx("img",{src:y,alt:"Avatar",className:"w-full h-full object-cover"}):p.jsx(id,{size:48,className:"text-fg/20"})}),p.jsxs("label",{className:"absolute inset-0 flex items-center justify-center bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer rounded-3xl",children:[p.jsx(Xx,{size:24,className:"text-white"}),p.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:S,disabled:h})]}),h&&p.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 rounded-3xl",children:p.jsx(Kn,{size:24,className:"text-primary animate-spin"})})]}),p.jsxs("div",{className:"flex-1 space-y-4",children:[p.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[p.jsx(Ra,{label:"First Name",value:t,onChange:e,placeholder:"Zosimos"}),p.jsx(Ra,{label:"Last Name",value:n,onChange:i,placeholder:"of Panopolis"})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Email Address (Locked)"}),p.jsx("input",{type:"email",value:o,readOnly:!0,className:"w-full bg-black/10 border border-border/10 rounded-xl py-3 px-4 text-sm text-fg/40 cursor-not-allowed"})]})]})]}),p.jsxs("section",{className:"glass p-6 space-y-4",children:[p.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[w?p.jsx(im,{size:20,className:"text-primary"}):p.jsx(om,{size:20,className:"text-fg/40"}),"Sound Effects"]}),p.jsx("p",{className:"text-xs text-fg/40",children:"Enable audio feedback for sync events and signal discoveries."}),p.jsx("button",{onClick:()=>_(!w),className:`w-full p-4 rounded-xl border-2 transition-all ${w?"bg-primary/10 border-primary/30 text-primary":"bg-surface border-border/20 text-fg/40"}`,children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"font-semibold text-sm",children:w?"Enabled":"Disabled"}),w?p.jsx(im,{size:18}):p.jsx(om,{size:18})]})})]}),p.jsxs("section",{className:"glass p-6 space-y-4",children:[p.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[p.jsx(sm,{size:20,className:"text-error"}),"Sign Out"]}),p.jsx("p",{className:"text-xs text-fg/40",children:"End your current session and return to the login screen."}),p.jsx("button",{onClick:()=>ge.auth.signOut(),className:"w-full p-4 rounded-xl border-2 bg-error/10 border-error/30 text-error hover:bg-error hover:text-white transition-all",children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"font-semibold text-sm",children:"Logout"}),p.jsx(sm,{size:18})]})})]}),p.jsx("div",{className:"flex justify-end pt-4 border-t border-border/10",children:p.jsxs("button",{onClick:k,disabled:u,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[u?p.jsx(Kn,{size:18,className:"animate-spin"}):p.jsx(sd,{size:18}),"Preserve Profile"]})})]})}function wC(){const[t,e]=R.useState(""),[n,i]=R.useState(""),[o,l]=R.useState(!1),[u,d]=R.useState(null),[h,m]=R.useState(!1),y=async()=>{if(!t||t!==n){d("Complexity keys do not match.");return}if(t.length<8){d("Entropy too low. Minimum 8 characters.");return}l(!0),d(null),m(!1);const{error:v}=await ge.auth.updateUser({password:t});v?d(v.message):(m(!0),e(""),i("")),l(!1)};return p.jsx("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:p.jsxs("div",{className:"glass p-6 space-y-6",children:[p.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[p.jsx(i1,{size:20,className:"text-error"})," Update Entropy Key"]}),p.jsxs("div",{className:"space-y-4",children:[p.jsx(Ra,{label:"New Password",type:"password",value:t,onChange:e,placeholder:"••••••••"}),p.jsx(Ra,{label:"Confirm Password",type:"password",value:n,onChange:i,placeholder:"••••••••"})]}),u&&p.jsx("p",{className:"text-xs text-error font-mono bg-error/5 p-3 rounded-lg border border-error/10",children:u}),h&&p.jsx("p",{className:"text-xs text-success font-mono bg-success/5 p-3 rounded-lg border border-success/10",children:"Key rotation successful."}),p.jsx("div",{className:"flex justify-end pt-2",children:p.jsxs("button",{onClick:y,disabled:o,className:"px-6 py-3 bg-error/10 text-error hover:bg-error hover:text-white font-bold rounded-xl border border-error/20 transition-all flex items-center gap-2",children:[o?p.jsx(Kn,{size:18,className:"animate-spin"}):p.jsx(fy,{size:18}),"Rotate Key"]})})]})})}function xC(){const[t,e]=R.useState(!1),[n,i]=R.useState(null),o=Jd(),l=eC();R.useEffect(()=>{o&&gC(ge).then(i)},[]);const u=()=>{confirm("Sever connection to this essence? This will reset local resonance.")&&(X2(),window.location.reload())};return p.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[p.jsxs("section",{className:"space-y-6",children:[p.jsx("div",{className:"flex items-center justify-between",children:p.jsxs("div",{children:[p.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[p.jsx(ki,{size:20,className:"text-primary"})," Essence Resonance"]}),p.jsx("p",{className:"text-xs text-fg/40 font-medium",children:"Bring Your Own Keys (BYOK) for intelligence persistence."})]})}),p.jsx("div",{className:"glass p-8 space-y-8",children:o?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-start gap-4 p-4 glass bg-emerald-500/5 border border-emerald-500/20 rounded-2xl",children:[p.jsx(nd,{className:"w-6 h-6 text-emerald-500 mt-1"}),p.jsxs("div",{className:"flex-1 space-y-1",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("p",{className:"font-bold text-fg italic uppercase tracking-tighter",children:"Established Link"}),n?.latestMigrationTimestamp&&p.jsxs("span",{className:"text-[10px] font-mono bg-emerald-500/10 text-emerald-500 px-2 py-0.5 rounded-full border border-emerald-500/20",children:["v",n.latestMigrationTimestamp]})]}),p.jsx("p",{className:"text-xs font-mono text-fg/40 break-all",children:o.url})]})]}),l==="env"&&p.jsxs("div",{className:"flex items-center gap-3 p-3 bg-amber-500/5 border border-amber-500/10 rounded-xl",children:[p.jsx(Mi,{size:16,className:"text-amber-500"}),p.jsx("p",{className:"text-[10px] text-amber-500 font-bold uppercase tracking-widest leading-none",children:"Active from environment variables. UI override enabled."})]}),p.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[p.jsxs("button",{onClick:()=>e(!0),className:"px-4 py-3 glass hover:bg-surface text-xs font-bold uppercase tracking-widest transition-all flex items-center justify-center gap-2",children:[p.jsx(rd,{size:14})," Realign Link"]}),l==="ui"&&p.jsxs("button",{onClick:u,className:"px-4 py-3 glass border-error/10 hover:bg-error/10 text-error/60 hover:text-error text-xs font-bold uppercase tracking-widest transition-all flex items-center justify-center gap-2",children:[p.jsx(g1,{size:14})," Sever Link"]})]}),p.jsxs("div",{className:"space-y-1 pt-4 border-t border-border/10",children:[p.jsx("label",{className:"text-[9px] font-bold uppercase tracking-widest text-fg/20 ml-1",children:"Anon Secret Fragment"}),p.jsxs("div",{className:"p-3 bg-black/20 rounded-xl font-mono text-[11px] text-fg/30 break-all border border-white/5",children:[o.anonKey.substring(0,32),"..."]})]})]}):p.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-6",children:[p.jsx(ki,{size:48,className:"text-fg/10"}),p.jsxs("div",{className:"space-y-2",children:[p.jsx("p",{className:"font-bold italic uppercase tracking-tighter",children:"No Essence Resonance"}),p.jsx("p",{className:"text-xs text-fg/40 max-w-[240px]",children:"The Alchemist requires a cloud core to store intelligence fragments."})]}),p.jsx("button",{onClick:()=>e(!0),className:"px-8 py-3 bg-primary text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] transition-all uppercase tracking-widest text-xs",children:"Initiate Link"})]})})]}),p.jsx(A0,{open:t,onComplete:()=>e(!1),canClose:!0})]})}function xc({active:t,icon:e,label:n,onClick:i}){return p.jsxs("button",{onClick:i,className:`w-full flex items-center gap-3 px-4 py-3 rounded-xl transition-all ${t?"glass bg-primary/10 text-primary border-primary/20 shadow-sm":"text-fg/40 hover:bg-surface hover:text-fg"}`,children:[t?_i.cloneElement(e,{className:"text-primary"}):e,p.jsx("span",{className:"font-semibold text-sm",children:n})]})}function Ra({label:t,value:e,onChange:n,placeholder:i,type:o="text"}){return p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:t}),p.jsx("input",{type:o,value:e,onChange:l=>n(l.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:i})]})}function bC({signal:t,onClose:e}){const[n,i]=_i.useState(!1);if(!t)return null;const o=()=>{const d=`# ${t.title}
69
+ `,"aria-label":`Digit ${_+1}`},_))})}function sC({onAuthSuccess:t,isInitialized:e=!0}){const[n,i]=R.useState(""),[o,l]=R.useState(""),[u,d]=R.useState(""),[h,m]=R.useState(""),[y,v]=R.useState(!1),[w,_]=R.useState(!e),[b,S]=R.useState(null),[k,E]=R.useState("password"),[P,N]=R.useState("email"),[U,V]=R.useState(""),z=async B=>{B.preventDefault(),v(!0),S(null);try{if(w){const{error:Y}=await me.auth.signUp({email:n,password:o,options:{data:{first_name:u,last_name:h,full_name:`${u} ${h}`.trim()}}});if(Y)throw Y;t()}else if(k==="password"){const{error:Y}=await me.auth.signInWithPassword({email:n,password:o});if(Y)throw Y;t()}else if(k==="otp")if(P==="email"){const{error:Y}=await me.auth.signInWithOtp({email:n,options:{shouldCreateUser:!1}});if(Y)throw Y;N("verify")}else await $()}catch(Y){S(Y.message)}finally{v(!1)}},$=async()=>{v(!0),S(null);try{const{data:B,error:Y}=await me.auth.verifyOtp({email:n,token:U,type:"magiclink"});if(Y)throw Y;if(!B.session)throw new Error("Failed to create session");t()}catch(B){S(B.message||"Invalid code")}finally{v(!1)}};return p.jsx("div",{className:"flex flex-col items-center justify-center p-8 h-full bg-gradient-to-t from-bg to-bg/50",children:p.jsxs(Ne.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"w-full max-w-md glass p-8 space-y-8",children:[p.jsxs("div",{className:"text-center space-y-2",children:[p.jsx("h2",{className:"text-3xl font-black italic tracking-tighter",children:!e&&w?"INITIALIZE MASTER":w?"JOIN THE CIRCLE":k==="otp"?"MYSTIC ACCESS":"ALCHEMIST LOGIN"}),p.jsx("p",{className:"text-xs text-fg/40 font-mono tracking-widest uppercase",children:!e&&w?"Forge the prime alchemist account":k==="otp"?P==="email"?"Enter your essence email":"Transmute the sacred code":"Transmute your data into intelligence"})]}),p.jsx("form",{onSubmit:z,className:"space-y-4",children:p.jsxs(_n,{mode:"wait",children:[w&&p.jsxs(Ne.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"grid grid-cols-2 gap-4 overflow-hidden",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"First Name"}),p.jsx("input",{type:"text",value:u,onChange:B=>d(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"Zosimos",required:!0})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Last Name"}),p.jsx("input",{type:"text",value:h,onChange:B=>m(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"Panopolis",required:!0})]})]},"signup-fields"),k==="otp"&&P==="verify"?p.jsxs(Ne.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6 py-4",children:[p.jsx("div",{className:"flex justify-center",children:p.jsx(rC,{value:U,onChange:V,length:6,onComplete:B=>{V(B)},error:!!b})}),p.jsx("button",{type:"button",onClick:()=>N("email"),className:"w-full text-[10px] font-bold uppercase text-primary/40 hover:text-primary transition-colors tracking-widest",children:"Change email address"}),p.jsxs("button",{type:"button",disabled:y||U.length!==6,onClick:$,className:"w-full py-4 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center justify-center gap-2",children:[y?p.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):p.jsx(rm,{size:18}),"VERIFY CODE"]})]},"otp-verify"):p.jsxs(Ne.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"space-y-4",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Email Address"}),p.jsxs("div",{className:"relative",children:[p.jsx(l1,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg/20",size:16}),p.jsx("input",{type:"email",value:n,onChange:B=>i(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 pl-10 pr-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"alchemist@example.com",required:!0})]})]}),(w||k==="password")&&p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Complexity Key"}),p.jsxs("div",{className:"relative",children:[p.jsx(a1,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg/20",size:16}),p.jsx("input",{type:"password",value:o,onChange:B=>l(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 pl-10 pr-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"••••••••",required:!0})]})]}),p.jsxs("button",{type:"submit",disabled:y,className:"w-full py-4 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center justify-center gap-2",children:[y&&p.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),w?p.jsx(y1,{size:18}):p.jsx(rm,{size:18}),w?"INITIALIZE ACCOUNT":k==="otp"?"SEND CODE":"UNSEAL ENGINE"]})]},"base-login")]})}),b&&k==="password"&&p.jsx(Ne.p,{initial:{opacity:0},animate:{opacity:1},className:"text-xs text-error font-medium bg-error/10 p-3 rounded-lg border border-error/10",children:b}),p.jsxs("div",{className:"space-y-4",children:[!w&&p.jsx("div",{className:"flex flex-col gap-2",children:k==="password"?p.jsxs("button",{type:"button",onClick:()=>{E("otp"),N("email"),S(null)},className:"w-full flex items-center justify-center gap-2 py-3 glass hover:bg-surface text-xs font-bold uppercase tracking-widest transition-all text-fg/40 hover:text-primary",children:[p.jsx(s1,{size:16})," Sign in with Code"]}):p.jsxs("button",{type:"button",onClick:()=>{E("password"),S(null)},className:"w-full flex items-center justify-center gap-2 py-3 glass hover:bg-surface text-xs font-bold uppercase tracking-widest transition-all text-fg/40 hover:text-primary",children:[p.jsx(Hx,{size:16})," Sign in with Password"]})}),p.jsxs("p",{className:"text-center text-xs text-fg/40",children:[w?"Already an Alchemist?":"New to Alchemy?"," "," ",p.jsx("button",{onClick:()=>{_(!w),E("password"),S(null)},className:"text-primary font-bold hover:underline",children:w?"Login instead":"Create an account"})]})]})]})})}function iC(t){const e=t.trim();return e?e.startsWith("http://")||e.startsWith("https://")?e:`https://${e}.supabase.co`:""}function A0({onComplete:t,open:e=!0,canClose:n=!1}){const[i,o]=R.useState("welcome"),[l,u]=R.useState(""),[d,h]=R.useState(""),[m,y]=R.useState(null),[v,w]=R.useState(!1);if(!e)return null;const _=async()=>{y(null),w(!0),o("validating");const b=iC(l),S=d.trim(),k=await Z2(b,S);k.valid?(Q2({url:b,anonKey:S}),o("success"),setTimeout(()=>{window.location.reload()},1500)):(y(k.error||"Connection failed"),o("credentials"),w(!1))};return p.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-6 bg-bg/80 backdrop-blur-sm",children:p.jsxs(Ne.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"w-full max-w-lg glass p-8 space-y-8 relative overflow-hidden",children:[p.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-primary/10 rounded-full blur-3xl -translate-y-1/2 translate-x-1/2"}),p.jsxs(_n,{mode:"wait",children:[i==="welcome"&&p.jsxs(Ne.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("div",{className:"p-2 bg-primary/10 rounded-xl",children:p.jsx(ki,{className:"w-6 h-6 text-primary"})}),p.jsx("h2",{className:"text-2xl font-black italic tracking-tighter uppercase",children:"Assemble Your Engine"})]}),p.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Alchemy requires a Supabase essence to store signal fragments and intelligence patterns."})]}),p.jsxs("div",{className:"glass bg-white/5 border-white/10 p-4 rounded-xl space-y-3",children:[p.jsx("p",{className:"text-xs font-bold uppercase tracking-widest text-primary/70",children:"Requirements:"}),p.jsxs("ul",{className:"space-y-2",children:[p.jsxs("li",{className:"flex items-center gap-2 text-sm text-fg/60",children:[p.jsx(Si,{className:"w-4 h-4 text-emerald-500"})," Supabase Project URL"]}),p.jsxs("li",{className:"flex items-center gap-2 text-sm text-fg/60",children:[p.jsx(Si,{className:"w-4 h-4 text-emerald-500"})," Anon Public API Key"]})]})]}),p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsxs("a",{href:"https://supabase.com",target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-2 py-3 border border-border/20 rounded-xl text-xs font-bold uppercase tracking-widest hover:bg-white/5 transition-all text-fg/60",children:["Forge Project at Supabase ",p.jsx(Ia,{size:14})]}),p.jsxs("button",{onClick:()=>o("credentials"),className:"w-full py-4 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.01] active:scale-95 transition-all flex items-center justify-center gap-2",children:["BEGIN INITIALIZATION ",p.jsx(Kx,{size:18})]})]})]},"welcome"),i==="credentials"&&p.jsxs(Ne.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx("h2",{className:"text-2xl font-black italic tracking-tighter uppercase",children:"Essence Coordinates"}),p.jsx("p",{className:"text-sm text-fg/50 font-medium lowercase",children:"Link the alchemist engine to your cloud database"})]}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Project URL or ID"}),p.jsx("input",{type:"text",value:l,onChange:b=>u(b.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"https://xxx.supabase.co or project-id"})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Anon Public Key"}),p.jsx("input",{type:"password",value:d,onChange:b=>h(b.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"eyJ..."})]})]}),m&&p.jsxs("div",{className:"bg-error/10 border border-error/20 p-3 rounded-xl flex items-center gap-3",children:[p.jsx(Mi,{className:"w-5 h-5 text-error"}),p.jsx("p",{className:"text-xs text-error font-bold tracking-tight",children:m})]}),p.jsxs("div",{className:"flex gap-3",children:[p.jsx("button",{onClick:()=>o("welcome"),className:"flex-1 py-4 border border-border/20 rounded-xl text-xs font-bold uppercase tracking-widest hover:bg-white/5 transition-all text-fg/40",children:"BACK"}),p.jsxs("button",{onClick:_,disabled:!l||!d,className:"flex-[2] py-4 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.01] active:scale-95 transition-all disabled:opacity-50 disabled:grayscale flex items-center justify-center gap-2",children:["CONNECT ESSENCE ",p.jsx(kr,{size:18})]})]})]},"credentials"),i==="validating"&&p.jsxs(Ne.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center py-12 space-y-6",children:[p.jsxs("div",{className:"relative",children:[p.jsx("div",{className:"absolute inset-0 bg-primary/20 blur-xl rounded-full"}),p.jsx(wn,{className:"w-16 h-16 animate-spin text-primary relative z-10"})]}),p.jsxs("div",{className:"text-center space-y-2",children:[p.jsx("h3",{className:"text-xl font-bold italic uppercase tracking-tighter",children:"Validating Link"}),p.jsx("p",{className:"text-sm text-fg/40 font-mono tracking-widest uppercase animate-pulse",children:"Synchronizing Resonance..."})]})]},"validating"),i==="success"&&p.jsxs(Ne.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"flex flex-col items-center justify-center py-12 space-y-6",children:[p.jsx("div",{className:"p-4 bg-emerald-500/20 rounded-full",children:p.jsx(rd,{className:"w-16 h-16 text-emerald-500"})}),p.jsxs("div",{className:"text-center space-y-2",children:[p.jsx("h3",{className:"text-2xl font-black italic uppercase tracking-tighter",children:"Engine Aligned"}),p.jsx("p",{className:"text-sm text-fg/40 font-mono tracking-widest uppercase",children:"Restarting Alchemist Subsystems..."})]})]},"success")]})]})})}const qn={chrome:{icon:p.jsx(e1,{size:18}),name:"Google Chrome",color:"text-yellow-500"},firefox:{icon:p.jsx(Gu,{size:18}),name:"Mozilla Firefox",color:"text-orange-500"},safari:{icon:p.jsx(Gu,{size:18}),name:"Safari",color:"text-blue-500"},edge:{icon:p.jsx(Gu,{size:18}),name:"Microsoft Edge",color:"text-cyan-500"},brave:{icon:p.jsx(kr,{size:18}),name:"Brave",color:"text-orange-400"},arc:{icon:p.jsx(kr,{size:18}),name:"Arc",color:"text-purple-500"}};function oC({sources:t,onChange:e}){const[n,i]=R.useState(!1),[o,l]=R.useState({}),[u,d]=R.useState(""),[h,m]=R.useState("chrome"),[y,v]=R.useState(!1),w=async()=>{i(!0);try{const{data:E}=await Re.get("/api/browser-paths/detect");l(E)}catch(E){console.error("Detection failed:",E)}finally{i(!1)}},_=E=>{const P=o[E];if(!P||!P.found||!P.valid||t.find(V=>V.browser===E&&V.path===P.path))return;const U={browser:E,path:P.path,enabled:!0,label:`${qn[E].name} (Auto-detected)`};e([...t,U])},b=async()=>{if(u.trim()){v(!0);try{const{data:E}=await Re.post("/api/browser-paths/validate",{path:u});if(!E.valid){alert(`Invalid path: ${E.error||"Not a browser history database"}`),v(!1);return}const P={browser:h,path:u,enabled:!0,label:`${qn[h].name} (Custom)`};e([...t,P]),d("")}catch(E){console.error("Validation failed:",E),alert("Failed to validate path")}finally{v(!1)}}},S=E=>{const P=[...t];P[E].enabled=!P[E].enabled,e(P)},k=E=>{e(t.filter((P,N)=>N!==E))};return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[p.jsx(Sc,{size:14})," Auto-Detect Browsers"]}),p.jsxs("button",{onClick:w,disabled:n,className:"px-3 py-1.5 text-xs font-bold uppercase tracking-widest bg-primary/10 hover:bg-primary/20 text-primary rounded-lg transition-all flex items-center gap-2",children:[n?p.jsx(wn,{size:12,className:"animate-spin"}):p.jsx(Sc,{size:12}),n?"Scanning...":"Scan System"]})]}),Object.keys(o).length>0&&p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Object.keys(qn).map(E=>{const P=o[E],N=qn[E],U=t.some(V=>V.browser===E&&V.path===P?.path);return p.jsxs(Ne.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:`glass p-4 rounded-xl border ${P?.found&&P?.valid?"border-success/20 bg-success/5":P?.found?"border-error/20 bg-error/5":"border-border/10"}`,children:[p.jsxs("div",{className:"flex items-start justify-between mb-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:N.color,children:N.icon}),p.jsx("span",{className:"text-sm font-bold",children:N.name})]}),P?.found&&P?.valid?p.jsx(Si,{size:16,className:"text-success"}):P?.found?p.jsx(Mi,{size:16,className:"text-error"}):p.jsx(Sr,{size:16,className:"text-fg/20"})]}),P?.found?p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"text-[10px] font-mono text-fg/40 truncate mb-2",children:P.path}),P.valid?p.jsx("button",{onClick:()=>_(E),disabled:U,className:`w-full py-1.5 text-xs font-bold uppercase tracking-widest rounded-lg transition-all ${U?"bg-fg/5 text-fg/30 cursor-not-allowed":"bg-success/10 hover:bg-success/20 text-success"}`,children:U?"Already Added":"Add Source"}):p.jsx("p",{className:"text-[10px] text-error font-medium",children:P.error})]}):p.jsx("p",{className:"text-[10px] text-fg/30 italic",children:"Not found on this system"})]},E)})})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[p.jsx(n1,{size:14})," Add Custom Path"]}),p.jsxs("div",{className:"glass p-4 rounded-xl space-y-3",children:[p.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[p.jsx("select",{value:h,onChange:E=>m(E.target.value),className:"bg-black/20 border border-border/5 rounded-xl py-2 px-3 text-sm focus:border-primary/30 outline-none transition-all",children:Object.keys(qn).map(E=>p.jsx("option",{value:E,children:qn[E].name},E))}),p.jsx("input",{type:"text",value:u,onChange:E=>d(E.target.value),placeholder:"/path/to/browser/History",className:"col-span-2 bg-black/20 border border-border/5 rounded-xl py-2 px-3 text-sm focus:border-primary/30 outline-none transition-all"})]}),p.jsxs("button",{onClick:b,disabled:!u.trim()||y,className:"w-full py-2.5 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg hover:scale-[1.01] active:scale-95 transition-all flex items-center justify-center gap-2 disabled:opacity-50 disabled:grayscale",children:[y?p.jsx(wn,{size:16,className:"animate-spin"}):p.jsx(d1,{size:16}),y?"Validating...":"Add Custom Source"]})]})]}),t.length>0&&p.jsxs("div",{className:"space-y-3",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:["Configured Sources (",t.length,")"]}),p.jsx("div",{className:"space-y-2",children:p.jsx(_n,{children:t.map((E,P)=>p.jsxs(Ne.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},className:`glass p-4 rounded-xl border border-border/10 flex items-center justify-between ${!E.enabled&&"opacity-50"}`,children:[p.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[p.jsx("div",{className:qn[E.browser].color,children:qn[E.browser].icon}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("p",{className:"text-sm font-bold",children:E.label}),p.jsx("p",{className:"text-[10px] font-mono text-fg/40 truncate",children:E.path})]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:()=>S(P),className:`px-3 py-1.5 text-xs font-bold uppercase tracking-widest rounded-lg transition-all ${E.enabled?"bg-success/10 text-success":"bg-fg/5 text-fg/40"}`,children:E.enabled?"Enabled":"Disabled"}),p.jsx("button",{onClick:()=>k(P),className:"p-2 hover:bg-error/10 text-error rounded-lg transition-all",children:p.jsx(Sr,{size:16})})]})]},`${E.browser}-${E.path}`))})})]})]})}const P0=R.createContext(void 0);function aC({children:t}){const[e,n]=R.useState([]),i=R.useCallback((o,l="info")=>{const u=Math.random().toString(36).substr(2,9),d={id:u,type:l,message:o};n(h=>[...h,d]),setTimeout(()=>{n(h=>h.filter(m=>m.id!==u))},3e3)},[]);return p.jsxs(P0.Provider,{value:{showToast:i},children:[t,p.jsx(lC,{toasts:e})]})}function R0(){const t=R.useContext(P0);if(!t)throw new Error("useToast must be used within ToastProvider");return t}function lC({toasts:t}){return p.jsx("div",{className:"fixed bottom-6 right-6 z-[100] flex flex-col gap-2 pointer-events-none",children:p.jsx(_n,{children:t.map(e=>p.jsx(uC,{toast:e},e.id))})})}function uC({toast:t}){const e={success:p.jsx(Si,{size:18,className:"text-success"}),error:p.jsx(Sr,{size:18,className:"text-error"}),warning:p.jsx(Mi,{size:18,className:"text-accent"}),info:p.jsx(hy,{size:18,className:"text-primary"})},n={success:"border-success/20 bg-success/10",error:"border-error/20 bg-error/10",warning:"border-accent/20 bg-accent/10",info:"border-primary/20 bg-primary/10"};return p.jsxs(Ne.div,{initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,x:100,scale:.95},className:`glass px-4 py-3 rounded-xl border ${n[t.type]} flex items-center gap-3 min-w-[300px] max-w-md pointer-events-auto shadow-lg`,children:[e[t.type],p.jsx("span",{className:"text-sm font-medium flex-1",children:t.message})]})}function cC(){const{showToast:t}=R0(),[e,n]=R.useState("http://localhost:11434"),[i,o]=R.useState("llama3"),[l,u]=R.useState(""),[d,h]=R.useState([]),[m,y]=R.useState(!1),[v,w]=R.useState(!1),[_,b]=R.useState(!1);R.useEffect(()=>{S()},[]);const S=async()=>{const{data:{user:N}}=await me.auth.getUser();if(!N)return;const{data:U}=await me.from("alchemy_settings").select("*").eq("user_id",N.id).maybeSingle();U&&(n(U.llm_base_url||U.ollama_host||"http://localhost:11434"),o(U.llm_model_name||"llama3"),u(U.llm_api_key||U.openai_api_key||U.anthropic_api_key||""),h(U.custom_browser_paths||[]))},k=async()=>{y(!0);try{const{data:{user:N}}=await me.auth.getUser();if(!N){t("Please log in to save settings","error"),y(!1);return}const{error:U}=await me.from("alchemy_settings").upsert({user_id:N.id,llm_base_url:e,llm_model_name:i,llm_api_key:l},{onConflict:"user_id"});U?(console.error("[AlchemistEngine] Save error:",U),t(`Failed to save: ${U.message}`,"error")):t("LLM settings saved successfully","success")}catch(N){console.error("[AlchemistEngine] Unexpected error:",N),t(`Unexpected error: ${N.message}`,"error")}finally{y(!1)}},E=async()=>{w(!0);try{const{data:{user:N}}=await me.auth.getUser();if(!N){t("Please log in to save settings","error"),w(!1);return}const{error:U}=await me.from("alchemy_settings").upsert({user_id:N.id,custom_browser_paths:d},{onConflict:"user_id"});U?(console.error("[AlchemistEngine] Save browser sources error:",U),t(`Failed to save: ${U.message}`,"error")):t("Browser sources saved successfully","success")}catch(N){console.error("[AlchemistEngine] Unexpected error:",N),t(`Unexpected error: ${N.message}`,"error")}finally{w(!1)}},P=async()=>{b(!0);try{const{data:N}=await Re.post("/api/llm/test",{baseUrl:e,modelName:i,apiKey:l});N.success?t(`Connection successful! ${N.model?`Model: ${N.model}`:""}`,"success"):t(`Connection failed: ${N.message}`,"error")}catch(N){console.error("[AlchemistEngine] Test error:",N),t(`Test failed: ${N.message}`,"error")}finally{b(!1)}};return p.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p.jsxs("header",{className:"px-8 py-6 border-b border-border/10",children:[p.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Intelligence Engine"}),p.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Fine-tune the Alchemist's cognitive parameters and provider links."})]}),p.jsx("main",{className:"flex-1 overflow-y-auto custom-scrollbar p-8",children:p.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[p.jsx("section",{className:"space-y-6",children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[p.jsx(dy,{size:14})," LLM Configuration"]}),p.jsxs("div",{className:"glass p-8 space-y-6",children:[p.jsx(xc,{label:"Provider URL (Base)",value:e,onChange:n,placeholder:"http://localhost:11434 or https://api.openai.com/v1"}),p.jsx(xc,{label:"Intelligence Model",value:i,onChange:o,placeholder:"llama3, gpt-4o, claude-3-5-sonnet..."}),p.jsx(xc,{label:"Secret Key (Optional)",type:"password",value:l,onChange:u,placeholder:"sk-..."}),p.jsx("div",{className:"p-4 bg-primary/5 rounded-2xl",children:p.jsx("p",{className:"text-[10px] text-primary/60 font-medium leading-relaxed",children:"The Alchemist uses a unified interface. You can point this to local Ollama instances, OpenAI-compatible APIs, or any custom LLM endpoint."})}),p.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[p.jsxs("button",{onClick:P,disabled:_||m,className:"px-6 py-3 bg-surface hover:bg-surface/80 border border-border/10 text-fg font-bold rounded-xl shadow-sm hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[_?p.jsx(wn,{size:18,className:"animate-spin"}):p.jsx(kr,{size:18,className:"text-accent"}),"Test Connection"]}),p.jsxs("button",{onClick:k,disabled:m,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[m?p.jsx(wn,{size:18,className:"animate-spin"}):p.jsx(ba,{size:18}),"Save"]})]})]})]})}),p.jsx("section",{className:"space-y-6",children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[p.jsx(ki,{size:14})," Browser History Sources"]}),p.jsxs("div",{className:"glass p-8 space-y-6",children:[p.jsx(oC,{sources:d,onChange:h}),p.jsx("div",{className:"flex justify-end pt-2",children:p.jsxs("button",{onClick:E,disabled:v,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[v?p.jsx(wn,{size:18,className:"animate-spin"}):p.jsx(ba,{size:18}),"Save Browser Sources"]})})]})]})})]})})]})}function xc({label:t,value:e,onChange:n,placeholder:i,type:o="text"}){return p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:t}),p.jsx("input",{type:o,value:e,onChange:l=>n(l.target.value),className:"w-full bg-black/20 border border-border/5 rounded-xl py-3 px-4 text-sm focus:border-primary/30 outline-none transition-all",placeholder:i})]})}const O0=R.createContext(null);function dC({children:t}){const[e,n]=R.useState(!1),i=()=>n(!0),o=()=>n(!1);return p.jsx(O0.Provider,{value:{isExpanded:e,setIsExpanded:n,openTerminal:i,closeTerminal:o},children:t})}function hC(){const t=R.useContext(O0);if(!t)throw new Error("useTerminal must be used within a TerminalProvider");return t}function fC({isExpanded:t,onToggle:e}={}){const[n,i]=R.useState([]),{isExpanded:o,setIsExpanded:l}=hC(),[u,d]=R.useState({}),h=t!==void 0?t:o,m=e||(()=>l(!o));R.useEffect(()=>{y();const _=me.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},b=>{const S=b.new;S.event_type==="error"&&d(k=>({...k,[S.id]:!0})),i(k=>{const E=[S,...k];return E.length>50?E.slice(0,50):E})}).subscribe();return()=>{me.removeChannel(_)}},[]);const y=async()=>{const{data:_}=await me.from("processing_events").select("*").order("created_at",{ascending:!1}).limit(30);_&&i(_)},v=_=>{d(b=>({...b,[_]:!b[_]}))},w=(_,b)=>{if(b==="debug")return p.jsx(Yx,{size:14,className:"text-fg/40"});switch(_){case"analysis":return p.jsx(Jx,{size:14,className:"text-primary"});case"action":return p.jsx(kr,{size:14,className:"text-accent"});case"error":return p.jsx(qx,{size:14,className:"text-error"});case"system":return p.jsx(sd,{size:14,className:"text-success"});default:return p.jsx(hy,{size:14,className:"text-fg/40"})}};return h?p.jsxs(Ne.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},className:"fixed bottom-6 right-6 z-50 w-[450px] max-h-[600px] glass shadow-2xl flex flex-col overflow-hidden border-primary/10",children:[p.jsxs("div",{className:"p-4 border-b border-border/10 flex items-center justify-between bg-surface/50",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(kc,{size:18,className:"text-primary"}),p.jsx("span",{className:"text-xs font-bold uppercase tracking-widest",children:"Alchemist Engine"}),p.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold bg-success/10 text-success px-2 py-0.5 rounded-full border border-success/10 animate-pulse ml-2",children:[p.jsx(zx,{size:10})," LIVE"]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:()=>i([]),className:"text-[10px] uppercase font-bold text-fg/40 hover:text-fg px-2 py-1 transition-colors",children:"Clear"}),p.jsx("button",{onClick:m,className:"text-fg/40 hover:text-fg p-1 transition-colors",children:p.jsx(u1,{size:18})})]})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 custom-scrollbar bg-black/20",children:[n.length===0&&p.jsx("div",{className:"text-center py-12 text-fg/20 italic text-xs",children:"Idle. Awaiting signal mining events..."}),n.map(_=>p.jsxs("div",{className:"relative flex items-start gap-3 group",children:[p.jsx("div",{className:"mt-1 flex-shrink-0 w-6 h-6 rounded-full bg-surface border border-white/5 flex items-center justify-center",children:w(_.event_type,_.level)}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[p.jsx("span",{className:"text-xs font-mono text-fg/60 shrink-0",children:new Date(_.created_at||Date.now()).toLocaleTimeString()}),p.jsx("span",{className:`text-xs font-bold uppercase tracking-wider ${_.level==="error"?"text-error":_.level==="warn"?"text-orange-400":_.event_type==="analysis"?"text-primary":"text-fg/90"}`,children:_.agent_state}),_.duration_ms&&p.jsxs("span",{className:"ml-auto text-[10px] font-mono bg-bg/50 px-1.5 py-0.5 rounded flex items-center gap-1 text-fg/40",children:[p.jsx(ps,{size:10}),_.duration_ms,"ms"]})]}),p.jsx("p",{className:`text-sm break-words leading-relaxed ${_.level==="debug"?"text-fg/50 font-mono text-xs":""}`,children:_.message}),(_.details||_.metadata)&&p.jsxs("div",{className:"mt-2 text-xs",children:[p.jsxs("button",{onClick:()=>v(_.id),className:"flex items-center gap-1 text-fg/40 hover:text-primary transition-colors",children:[u[_.id]?p.jsx(Zx,{size:12}):p.jsx(_c,{size:12}),u[_.id]?"Hide Details":"View Details"]}),p.jsx(_n,{children:u[_.id]&&p.jsx(Ne.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:p.jsx("pre",{className:"mt-2 p-3 bg-bg/50 rounded border border-white/5 font-mono text-[10px] overflow-x-auto text-fg/70",children:JSON.stringify({..._.details,..._.metadata},null,2)})})})]})]})]},_.id))]})]}):p.jsxs("button",{onClick:m,className:"fixed bottom-6 right-6 z-50 glass p-4 flex items-center gap-3 hover:bg-surface transition-all shadow-xl group border-primary/10",children:[p.jsxs("div",{className:"relative",children:[p.jsx(kc,{size:20,className:"text-primary"}),n.length>0&&p.jsxs("span",{className:"absolute -top-1 -right-1 flex h-2 w-2",children:[p.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),p.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]})]}),p.jsx("span",{className:"text-xs font-bold uppercase tracking-widest hidden group-hover:block animate-in fade-in slide-in-from-right-2",children:"Live Engine Log"})]})}const I0="1.0.0",pC="20260125000004";async function mC(t){try{const{data:e,error:n}=await t.rpc("get_latest_migration_timestamp");return n?n.code==="42883"?{version:null,latestMigrationTimestamp:"0"}:{version:null,latestMigrationTimestamp:null}:{version:I0,latestMigrationTimestamp:e||null}}catch{return{version:null,latestMigrationTimestamp:null}}}async function gC(t){const e=I0,n=pC,i=await mC(t);if(i.latestMigrationTimestamp&&i.latestMigrationTimestamp.trim()!==""){const o=n,l=i.latestMigrationTimestamp;return o>l?{needsMigration:!0,appVersion:e,dbVersion:i.version,latestMigrationTimestamp:l,message:`New migrations available. Database is at ${l}, app has ${o}.`}:{needsMigration:!1,appVersion:e,dbVersion:i.version,latestMigrationTimestamp:l,message:"Database schema is up-to-date."}}return{needsMigration:!0,appVersion:e,dbVersion:null,latestMigrationTimestamp:null,message:"Database schema unknown. Migration required."}}function yC(){const[t,e]=R.useState("profile"),[n,i]=R.useState(!1);return p.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p.jsxs("header",{className:"px-8 py-6 border-b border-border/10",children:[p.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Account Configuration"}),p.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Manage your Alchemist profile and essence links."})]}),p.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[p.jsxs("aside",{className:"w-64 border-r border-border/10 p-4 space-y-1",children:[p.jsx(bc,{active:t==="profile",onClick:()=>e("profile"),icon:p.jsx(id,{size:18}),label:"Profile"}),p.jsx(bc,{active:t==="security",onClick:()=>e("security"),icon:p.jsx(fy,{size:18}),label:"Security"}),p.jsx(bc,{active:t==="supabase",onClick:()=>e("supabase"),icon:p.jsx(ki,{size:18}),label:"Supabase"})]}),p.jsxs("main",{className:"flex-1 overflow-y-auto custom-scrollbar p-8",children:[t==="profile"&&p.jsx(vC,{}),t==="security"&&p.jsx(wC,{}),t==="supabase"&&p.jsx(xC,{})]})]})]})}function vC(){const[t,e]=R.useState(""),[n,i]=R.useState(""),[o,l]=R.useState(""),[u,d]=R.useState(!1),[h,m]=R.useState(!1),[y,v]=R.useState(null),[w,_]=R.useState(!0);R.useEffect(()=>{b()},[]);const b=async()=>{const{data:{user:E}}=await me.auth.getUser();if(!E)return;l(E.email||"");const{data:P}=await me.from("profiles").select("*").eq("id",E.id).maybeSingle();P&&(e(P.first_name||""),i(P.last_name||""),v(P.avatar_url));const{data:N}=await me.from("alchemy_settings").select("sound_enabled").eq("user_id",E.id).maybeSingle();N&&_(N.sound_enabled??!0)},S=async()=>{d(!0);const{data:{user:E}}=await me.auth.getUser();E&&(await me.from("profiles").upsert({id:E.id,first_name:t,last_name:n,full_name:t&&n?`${t} ${n}`:t||n||null}),await me.from("alchemy_settings").update({sound_enabled:w}).eq("user_id",E.id),d(!1))},k=async E=>{const P=E.target.files?.[0];if(P){m(!0);try{const{data:{user:N}}=await me.auth.getUser();if(!N)return;const U=P.name.split(".").pop(),V=`${N.id}/avatar-${Date.now()}.${U}`,{error:z}=await me.storage.from("avatars").upload(V,P,{upsert:!0});if(z)throw z;const{data:{publicUrl:$}}=me.storage.from("avatars").getPublicUrl(V);await me.from("profiles").update({avatar_url:$}).eq("id",N.id),v($)}catch(N){console.error("Avatar upload failed:",N)}finally{m(!1)}}};return p.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[p.jsxs("section",{className:"flex items-start gap-8",children:[p.jsxs("div",{className:"relative group",children:[p.jsx("div",{className:"w-32 h-32 rounded-3xl bg-surface border border-border/20 flex items-center justify-center overflow-hidden shadow-xl",children:y?p.jsx("img",{src:y,alt:"Avatar",className:"w-full h-full object-cover"}):p.jsx(id,{size:48,className:"text-fg/20"})}),p.jsxs("label",{className:"absolute inset-0 flex items-center justify-center bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer rounded-3xl",children:[p.jsx(Xx,{size:24,className:"text-white"}),p.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:k,disabled:h})]}),h&&p.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 rounded-3xl",children:p.jsx(wn,{size:24,className:"text-primary animate-spin"})})]}),p.jsxs("div",{className:"flex-1 space-y-4",children:[p.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[p.jsx(Oa,{label:"First Name",value:t,onChange:e,placeholder:"Zosimos"}),p.jsx(Oa,{label:"Last Name",value:n,onChange:i,placeholder:"of Panopolis"})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Email Address (Locked)"}),p.jsx("input",{type:"email",value:o,readOnly:!0,className:"w-full bg-black/10 border border-border/10 rounded-xl py-3 px-4 text-sm text-fg/40 cursor-not-allowed"})]})]})]}),p.jsxs("section",{className:"glass p-6 space-y-4",children:[p.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[w?p.jsx(im,{size:20,className:"text-primary"}):p.jsx(om,{size:20,className:"text-fg/40"}),"Sound Effects"]}),p.jsx("p",{className:"text-xs text-fg/40",children:"Enable audio feedback for sync events and signal discoveries."}),p.jsx("button",{onClick:()=>_(!w),className:`w-full p-4 rounded-xl border-2 transition-all ${w?"bg-primary/10 border-primary/30 text-primary":"bg-surface border-border/20 text-fg/40"}`,children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"font-semibold text-sm",children:w?"Enabled":"Disabled"}),w?p.jsx(im,{size:18}):p.jsx(om,{size:18})]})})]}),p.jsxs("section",{className:"glass p-6 space-y-4",children:[p.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[p.jsx(sm,{size:20,className:"text-error"}),"Sign Out"]}),p.jsx("p",{className:"text-xs text-fg/40",children:"End your current session and return to the login screen."}),p.jsx("button",{onClick:()=>me.auth.signOut(),className:"w-full p-4 rounded-xl border-2 bg-error/10 border-error/30 text-error hover:bg-error hover:text-white transition-all",children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"font-semibold text-sm",children:"Logout"}),p.jsx(sm,{size:18})]})})]}),p.jsx("div",{className:"flex justify-end pt-4 border-t border-border/10",children:p.jsxs("button",{onClick:S,disabled:u,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[u?p.jsx(wn,{size:18,className:"animate-spin"}):p.jsx(ba,{size:18}),"Preserve Profile"]})})]})}function wC(){const[t,e]=R.useState(""),[n,i]=R.useState(""),[o,l]=R.useState(!1),[u,d]=R.useState(null),[h,m]=R.useState(!1),y=async()=>{if(!t||t!==n){d("Complexity keys do not match.");return}if(t.length<8){d("Entropy too low. Minimum 8 characters.");return}l(!0),d(null),m(!1);const{error:v}=await me.auth.updateUser({password:t});v?d(v.message):(m(!0),e(""),i("")),l(!1)};return p.jsx("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:p.jsxs("div",{className:"glass p-6 space-y-6",children:[p.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[p.jsx(i1,{size:20,className:"text-error"})," Update Entropy Key"]}),p.jsxs("div",{className:"space-y-4",children:[p.jsx(Oa,{label:"New Password",type:"password",value:t,onChange:e,placeholder:"••••••••"}),p.jsx(Oa,{label:"Confirm Password",type:"password",value:n,onChange:i,placeholder:"••••••••"})]}),u&&p.jsx("p",{className:"text-xs text-error font-mono bg-error/5 p-3 rounded-lg border border-error/10",children:u}),h&&p.jsx("p",{className:"text-xs text-success font-mono bg-success/5 p-3 rounded-lg border border-success/10",children:"Key rotation successful."}),p.jsx("div",{className:"flex justify-end pt-2",children:p.jsxs("button",{onClick:y,disabled:o,className:"px-6 py-3 bg-error/10 text-error hover:bg-error hover:text-white font-bold rounded-xl border border-error/20 transition-all flex items-center gap-2",children:[o?p.jsx(wn,{size:18,className:"animate-spin"}):p.jsx(fy,{size:18}),"Rotate Key"]})})]})})}function xC(){const[t,e]=R.useState(!1),[n,i]=R.useState(null),o=Jd(),l=eC();R.useEffect(()=>{o&&gC(me).then(i)},[]);const u=()=>{confirm("Sever connection to this essence? This will reset local resonance.")&&(X2(),window.location.reload())};return p.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[p.jsxs("section",{className:"space-y-6",children:[p.jsx("div",{className:"flex items-center justify-between",children:p.jsxs("div",{children:[p.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[p.jsx(ki,{size:20,className:"text-primary"})," Essence Resonance"]}),p.jsx("p",{className:"text-xs text-fg/40 font-medium",children:"Bring Your Own Keys (BYOK) for intelligence persistence."})]})}),p.jsx("div",{className:"glass p-8 space-y-8",children:o?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-start gap-4 p-4 glass bg-emerald-500/5 border border-emerald-500/20 rounded-2xl",children:[p.jsx(rd,{className:"w-6 h-6 text-emerald-500 mt-1"}),p.jsxs("div",{className:"flex-1 space-y-1",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("p",{className:"font-bold text-fg italic uppercase tracking-tighter",children:"Established Link"}),n?.latestMigrationTimestamp&&p.jsxs("span",{className:"text-[10px] font-mono bg-emerald-500/10 text-emerald-500 px-2 py-0.5 rounded-full border border-emerald-500/20",children:["v",n.latestMigrationTimestamp]})]}),p.jsx("p",{className:"text-xs font-mono text-fg/40 break-all",children:o.url})]})]}),l==="env"&&p.jsxs("div",{className:"flex items-center gap-3 p-3 bg-amber-500/5 border border-amber-500/10 rounded-xl",children:[p.jsx(Mi,{size:16,className:"text-amber-500"}),p.jsx("p",{className:"text-[10px] text-amber-500 font-bold uppercase tracking-widest leading-none",children:"Active from environment variables. UI override enabled."})]}),p.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[p.jsxs("button",{onClick:()=>e(!0),className:"px-4 py-3 glass hover:bg-surface text-xs font-bold uppercase tracking-widest transition-all flex items-center justify-center gap-2",children:[p.jsx(sd,{size:14})," Realign Link"]}),l==="ui"&&p.jsxs("button",{onClick:u,className:"px-4 py-3 glass border-error/10 hover:bg-error/10 text-error/60 hover:text-error text-xs font-bold uppercase tracking-widest transition-all flex items-center justify-center gap-2",children:[p.jsx(g1,{size:14})," Sever Link"]})]}),p.jsxs("div",{className:"space-y-1 pt-4 border-t border-border/10",children:[p.jsx("label",{className:"text-[9px] font-bold uppercase tracking-widest text-fg/20 ml-1",children:"Anon Secret Fragment"}),p.jsxs("div",{className:"p-3 bg-black/20 rounded-xl font-mono text-[11px] text-fg/30 break-all border border-white/5",children:[o.anonKey.substring(0,32),"..."]})]})]}):p.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-6",children:[p.jsx(ki,{size:48,className:"text-fg/10"}),p.jsxs("div",{className:"space-y-2",children:[p.jsx("p",{className:"font-bold italic uppercase tracking-tighter",children:"No Essence Resonance"}),p.jsx("p",{className:"text-xs text-fg/40 max-w-[240px]",children:"The Alchemist requires a cloud core to store intelligence fragments."})]}),p.jsx("button",{onClick:()=>e(!0),className:"px-8 py-3 bg-primary text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] transition-all uppercase tracking-widest text-xs",children:"Initiate Link"})]})})]}),p.jsx(A0,{open:t,onComplete:()=>e(!1),canClose:!0})]})}function bc({active:t,icon:e,label:n,onClick:i}){return p.jsxs("button",{onClick:i,className:`w-full flex items-center gap-3 px-4 py-3 rounded-xl transition-all ${t?"glass bg-primary/10 text-primary border-primary/20 shadow-sm":"text-fg/40 hover:bg-surface hover:text-fg"}`,children:[t?_i.cloneElement(e,{className:"text-primary"}):e,p.jsx("span",{className:"font-semibold text-sm",children:n})]})}function Oa({label:t,value:e,onChange:n,placeholder:i,type:o="text"}){return p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:t}),p.jsx("input",{type:o,value:e,onChange:l=>n(l.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:i})]})}function bC({signal:t,onClose:e}){const[n,i]=_i.useState(!1);if(!t)return null;const o=()=>{const d=`# ${t.title}
70
70
 
71
71
  **Category**: ${t.category||"Research"}
72
72
  **Intelligence Score**: ${t.score}/100
@@ -98,4 +98,4 @@ ${t.entities.map(v=>`- ${v}`).join(`
98
98
  `:""}
99
99
  ${t.content?`
100
100
  ## Full Content
101
- ${t.content}`:""}`,h=new Blob([d],{type:"text/markdown"}),m=URL.createObjectURL(h),y=document.createElement("a");y.href=m,y.download=`${t.title.replace(/[^a-z0-9]/gi,"_").toLowerCase()}.md`,y.click(),URL.revokeObjectURL(m)},u=()=>{const d=JSON.stringify(t,null,2),h=new Blob([d],{type:"application/json"}),m=URL.createObjectURL(h),y=document.createElement("a");y.href=m,y.download=`signal_${t.id}.json`,y.click(),URL.revokeObjectURL(m)};return p.jsx(bn,{children:p.jsx(Ne.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-bg/80 backdrop-blur-sm",onClick:e,children:p.jsxs(Ne.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},onClick:d=>d.stopPropagation(),className:"w-full max-w-4xl max-h-[90vh] glass flex flex-col overflow-hidden",children:[p.jsxs("div",{className:"p-6 border-b border-border/10 flex items-start justify-between",children:[p.jsxs("div",{className:"flex-1 min-w-0 pr-4",children:[p.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[p.jsx("span",{className:"px-2 py-0.5 bg-primary/10 text-primary text-[10px] font-bold rounded border border-primary/20 uppercase tracking-wider",children:t.category||"Research"}),p.jsx("span",{className:`text-3xl font-black ${t.score>=80?"text-accent":"text-fg/40"}`,children:t.score})]}),p.jsx("h2",{className:"text-2xl font-bold leading-tight mb-2",children:t.title}),p.jsxs("p",{className:"text-xs text-fg/40 font-mono",children:["Discovered ",new Date(t.date).toLocaleDateString([],{month:"long",day:"numeric",year:"numeric"})]})]}),p.jsx("button",{onClick:e,className:"p-2 hover:bg-surface rounded-lg text-fg/40 hover:text-fg transition-all",children:p.jsx(ps,{size:24})})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6 space-y-6",children:[t.url&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Original Source"}),p.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 glass hover:bg-surface transition-all rounded-xl text-sm font-mono text-primary hover:text-accent group",children:[p.jsx(Oa,{size:16,className:"flex-shrink-0"}),p.jsx("span",{className:"truncate",children:t.url}),p.jsx("span",{className:"ml-auto text-xs opacity-0 group-hover:opacity-100 transition-opacity",children:"Open →"})]})]}),t.entities&&t.entities.length>0&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Entities"}),p.jsx("div",{className:"flex flex-wrap gap-2",children:t.entities.map(d=>p.jsx("span",{className:"px-3 py-1.5 bg-surface/50 border border-border/20 rounded-lg text-sm font-medium",children:d},d))})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"AI Summary"}),p.jsx("div",{className:"p-4 glass rounded-xl",children:p.jsx("p",{className:"text-sm leading-relaxed text-fg/80",children:t.summary})})]}),t.content&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Full Content"}),p.jsx("div",{className:"p-4 glass rounded-xl max-h-96 overflow-y-auto custom-scrollbar",children:p.jsx("p",{className:"text-sm leading-relaxed text-fg/60 whitespace-pre-wrap",children:t.content})})]})]}),p.jsxs("div",{className:"p-6 border-t border-border/10 flex items-center gap-3",children:[p.jsxs("button",{onClick:o,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[n?p.jsx(Si,{size:16,className:"text-success"}):p.jsx(cy,{size:16}),n?"Copied!":"Copy"]}),p.jsxs("button",{onClick:l,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[p.jsx(nm,{size:16}),"Markdown"]}),p.jsxs("button",{onClick:u,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[p.jsx(nm,{size:16}),"JSON"]})]})]})})})}function _C({isOpen:t,onClose:e}){const{showToast:n}=R0(),[i,o]=R.useState(""),[l,u]=R.useState(50),[d,h]=R.useState(!1),[m,y]=R.useState(!1);R.useEffect(()=>{t&&v()},[t]);const v=async()=>{const{data:{user:b}}=await ge.auth.getUser();if(!b)return;const{data:k}=await ge.from("alchemy_settings").select("*").eq("user_id",b.id).maybeSingle();if(k)if(u(k.max_urls_per_sync||50),k.sync_start_date){const S=new Date(k.sync_start_date),E=P=>P<10?"0"+P:P,A=S.getFullYear()+"-"+E(S.getMonth()+1)+"-"+E(S.getDate())+"T"+E(S.getHours())+":"+E(S.getMinutes());o(A)}else o("")},w=async()=>{h(!0);try{const{data:{user:b}}=await ge.auth.getUser();if(!b){n("Please log in to save settings","error"),h(!1);return}const{error:k}=await ge.from("alchemy_settings").update({max_urls_per_sync:l,sync_start_date:i?new Date(i).toISOString():null}).eq("user_id",b.id);k?n(`Failed to save: ${k.message}`,"error"):(n("Sync settings saved successfully","success"),e())}catch(b){n(`Unexpected error: ${b.message}`,"error")}finally{h(!1)}},_=async()=>{y(!0);try{const{data:{user:b}}=await ge.auth.getUser();if(!b){n("Please log in to reset checkpoint","error"),y(!1);return}const{error:k}=await ge.from("alchemy_settings").update({last_sync_checkpoint:null}).eq("user_id",b.id);k?n(`Failed to reset: ${k.message}`,"error"):n("Checkpoint reset successfully","success")}catch(b){n(`Unexpected error: ${b.message}`,"error")}finally{y(!1)}};return t?p.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:p.jsxs("div",{className:"bg-surface border border-border/20 rounded-2xl shadow-2xl max-w-lg w-full max-h-[90vh] overflow-y-auto",children:[p.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border/10",children:[p.jsx("h2",{className:"text-xl font-bold",children:"Sync Settings"}),p.jsx("button",{onClick:e,className:"p-2 hover:bg-black/10 rounded-lg transition-colors",children:p.jsx(ps,{className:"w-5 h-5"})})]}),p.jsxs("div",{className:"p-6 space-y-6",children:[p.jsxs("div",{className:"space-y-3",children:[p.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[p.jsx(Qx,{className:"w-4 h-4 text-primary"}),"Sync From (Optional)"]}),p.jsx("input",{type:"datetime-local",value:i,onChange:b=>o(b.target.value),className:"w-full bg-black/20 border border-border/10 rounded-xl py-3 px-4 text-sm focus:border-primary/30 outline-none transition-all"}),p.jsx("p",{className:"text-xs text-fg/50",children:"Leave empty to sync only new URLs since last sync (incremental). Set a date to process URLs from that point forward."})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"flex justify-between items-center",children:[p.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[p.jsx(r1,{className:"w-4 h-4 text-primary"}),"URLs per Sync"]}),p.jsx("span",{className:"text-sm font-mono text-primary",children:l})]}),p.jsx("input",{type:"range",min:"5",max:"200",step:"5",value:l,onChange:b=>u(Number(b.target.value)),className:"w-full h-2 bg-black/20 rounded-lg appearance-none cursor-pointer accent-primary"}),p.jsxs("div",{className:"flex justify-between text-xs text-fg/30 font-medium",children:[p.jsx("span",{children:"Quick (5)"}),p.jsx("span",{children:"Balanced (50)"}),p.jsx("span",{children:"Thorough (200)"})]})]}),p.jsxs("div",{className:"pt-4 border-t border-border/10",children:[p.jsxs("button",{onClick:_,disabled:m,className:"w-full px-4 py-2.5 bg-warning/10 hover:bg-warning/20 border border-warning/20 text-warning font-medium rounded-xl transition-all flex items-center justify-center gap-2 text-sm disabled:opacity-50",children:[p.jsx(h1,{size:16,className:m?"animate-spin":""}),m?"Resetting...":"Reset Checkpoint"]}),p.jsx("p",{className:"text-xs text-fg/40 mt-2 text-center",children:'Clear the sync checkpoint to force a full re-sync from your "Sync From" date'})]}),p.jsx("div",{className:"p-4 bg-primary/5 rounded-xl",children:p.jsx("p",{className:"text-xs text-primary/60 leading-relaxed",children:'The Alchemist tracks your progress automatically. Use "Sync From" to backfill history or "Reset Checkpoint" to start fresh.'})})]}),p.jsxs("div",{className:"flex gap-3 p-6 border-t border-border/10",children:[p.jsx("button",{onClick:e,className:"flex-1 px-4 py-2.5 bg-surface hover:bg-black/10 border border-border/10 rounded-xl font-medium transition-all",children:"Cancel"}),p.jsxs("button",{onClick:w,disabled:d,className:"flex-1 px-4 py-2.5 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg hover:scale-[1.02] active:scale-95 transition-all flex items-center justify-center gap-2 disabled:opacity-50",children:[p.jsx(sd,{size:18,className:d?"animate-spin":""}),d?"Saving...":"Save Settings"]})]})]})}):null}function SC(){const[t,e]=R.useState([]),[n,i]=R.useState(!0),[o,l]=R.useState(null),[u,d]=R.useState(null),[h,m]=R.useState([]),[y,v]=R.useState([]),[w,_]=R.useState([]),[b,k]=R.useState(!1);R.useEffect(()=>{S()},[]);const S=async()=>{i(!0);try{const{data:{user:$}}=await ge.auth.getUser();if(!$)return;const{data:B,error:Y}=await ge.from("processing_events").select("*").eq("user_id",$.id).eq("agent_state","Completed").order("created_at",{ascending:!1}).limit(50);if(Y){console.error("Error fetching sync runs:",Y);return}const oe=(B||[]).map(Te=>{const ve=Te.metadata||{},je=ve.errors||0,xe=ve.signals_found||0,Oe=ve.skipped||0;return{id:Te.id,started_at:Te.created_at,completed_at:Te.created_at,duration_ms:Te.duration_ms||0,signals_found:xe,urls_processed:ve.total_urls||0,skipped:Oe,errors:je,status:je>0?"partial":xe>0?"success":"failed"}});e(oe)}catch($){console.error("Failed to fetch sync runs:",$)}finally{i(!1)}},E=async $=>{k(!0);try{const{data:{user:B}}=await ge.auth.getUser();if(!B)return;const Y=t.find(F=>F.id===$);if(!Y)return;const oe=new Date(new Date(Y.started_at).getTime()-Y.duration_ms),Te=new Date(Y.completed_at),{data:ve,error:je}=await ge.from("processing_events").select("*").eq("user_id",B.id).gte("created_at",oe.toISOString()).lte("created_at",Te.toISOString()).order("created_at",{ascending:!0});if(je){console.error("Error fetching run events:",je);return}m(ve||[]);const xe=[],Oe=(ve||[]).filter(F=>F.agent_state==="Mining"&&F.message.includes("Mining source:"));for(const F of Oe){const J=F.message.match(/Mining source: (.+) \((.+)\)/);if(J){const K=J[1],j=J[2],D=(ve||[]).find(fe=>fe.agent_state==="Mining"&&fe.message.includes("Found")&&fe.message.includes(K)&&fe.created_at>F.created_at),re=D?.message.match(/Found (\d+) URLs/),ue=re?parseInt(re[1]):0;xe.push({label:K,browser:j,urls_found:ue,duration_ms:D?.duration_ms||0,status:F.event_type==="error"?"error":"success"})}}v(xe);const be=[],pe=(ve||[]).filter(F=>F.agent_state==="Reading");for(const F of pe){const J=F.message.match(/Reading content from: (.+)/);if(!J)continue;const K=J[1];let j=xe.length>0?xe[0].label:"Unknown";const D=xe.filter(ie=>ie.urls_found>0);(D.length===1||D.length>1)&&(j=D[0].label),console.log(`[SystemLogs] URL ${K} assigned to source: ${j}`);const re=(ve||[]).find(ie=>ie.agent_state==="Signal"&&ie.created_at>F.created_at&&ie.message.includes("Found signal")),ue=(ve||[]).find(ie=>ie.agent_state==="Skipped"&&ie.created_at>F.created_at&&ie.message.includes("Irrelevant content")),fe=(ve||[]).find(ie=>ie.event_type==="error"&&ie.created_at>F.created_at);if(re){const ie=re.message.match(/\((\d+)%\)/),Ee=ie?parseInt(ie[1]):0;be.push({url:K,result:"signal",score:Ee,category:re.details?.category||"Unknown",duration_ms:re.duration_ms,source_label:j})}else if(ue){const ie=ue.message.match(/\((\d+)%\): (.+)/),Ee=ie?parseInt(ie[1]):0,ke=ie?ie[2]:"Irrelevant";be.push({url:K,result:"skipped",score:Ee,reason:ke,duration_ms:ue.duration_ms,source_label:j})}else fe&&be.push({url:K,result:"error",reason:fe.message,source_label:j})}_(be)}catch(B){console.error("Failed to fetch run details:",B)}finally{k(!1)}},A=$=>{o===$?(l(null),d(null),v([]),_([])):(l($),d(null),E($))},P=$=>{d(u===$?null:$)},U=$=>{if($<1e3)return`${$}ms`;const B=Math.floor($/1e3);if(B<60)return`${B}s`;const Y=Math.floor(B/60),oe=B%60;return`${Y}m ${oe}s`},V=$=>{switch($){case"success":return p.jsx(nd,{className:"w-5 h-5 text-success"});case"failed":return p.jsx(am,{className:"w-5 h-5 text-error"});case"partial":return p.jsx(Mi,{className:"w-5 h-5 text-warning"});default:return p.jsx(fs,{className:"w-5 h-5 text-fg/40"})}},z=$=>{switch($){case"signal":return p.jsx(Sr,{className:"w-4 h-4 text-primary"});case"skipped":return p.jsx(p1,{className:"w-4 h-4 text-fg/40"});case"error":return p.jsx(am,{className:"w-4 h-4 text-error"});default:return null}};return n?p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):p.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-8",children:[p.jsxs("div",{className:"mb-6",children:[p.jsx("h2",{className:"text-2xl font-bold",children:"System Logs"}),p.jsx("p",{className:"text-sm text-fg/50",children:"Detailed history of sync runs, sources, and URL processing"})]}),p.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:t.length===0?p.jsxs("div",{className:"text-center py-12 text-fg/40",children:[p.jsx(fs,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),p.jsx("p",{children:"No sync runs yet"})]}):p.jsx("div",{className:"space-y-2",children:t.map($=>p.jsxs("div",{className:"glass rounded-xl overflow-hidden",children:[p.jsxs("button",{onClick:()=>A($.id),className:"w-full p-4 flex items-center gap-4 hover:bg-surface/50 transition-colors text-left",children:[o===$.id?p.jsx(bc,{className:"w-5 h-5 text-primary shrink-0"}):p.jsx(tm,{className:"w-5 h-5 text-fg/40 shrink-0"}),V($.status),p.jsxs("div",{className:"flex-1 grid grid-cols-6 gap-4 items-center",children:[p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Timestamp"}),p.jsx("div",{className:"text-sm font-mono",children:new Date($.started_at).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Duration"}),p.jsx("div",{className:"text-sm font-mono",children:U($.duration_ms)})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Signals"}),p.jsx("div",{className:"text-sm font-semibold text-primary",children:$.signals_found})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Skipped"}),p.jsx("div",{className:"text-sm font-semibold text-fg/60",children:$.skipped})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"URLs"}),p.jsx("div",{className:"text-sm font-semibold",children:$.urls_processed})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Errors"}),p.jsx("div",{className:`text-sm font-semibold ${$.errors>0?"text-error":"text-fg/40"}`,children:$.errors})]})]})]}),p.jsx(bn,{children:o===$.id&&p.jsx(Ne.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border/10 overflow-hidden",children:p.jsx("div",{className:"p-4 bg-black/10 space-y-2",children:b?p.jsx("div",{className:"flex items-center justify-center py-8",children:p.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):y.length===0?p.jsx("div",{className:"text-center py-4 text-fg/40 text-sm",children:"No source details available"}):y.map((B,Y)=>p.jsxs("div",{className:"glass rounded-lg overflow-hidden",children:[p.jsxs("button",{onClick:()=>P(B.label),className:"w-full p-3 flex items-center gap-3 hover:bg-surface/50 transition-colors text-left",children:[u===B.label?p.jsx(bc,{className:"w-4 h-4 text-primary shrink-0"}):p.jsx(tm,{className:"w-4 h-4 text-fg/40 shrink-0"}),p.jsxs("div",{className:"flex-1 flex items-center gap-4",children:[p.jsxs("div",{className:"flex-1",children:[p.jsx("div",{className:"text-sm font-semibold",children:B.label}),p.jsx("div",{className:"text-xs text-fg/40",children:B.browser})]}),p.jsxs("div",{className:"text-right",children:[p.jsx("div",{className:"text-xs text-fg/40",children:"URLs Found"}),p.jsx("div",{className:"text-sm font-semibold",children:B.urls_found})]}),p.jsxs("div",{className:"text-right",children:[p.jsx("div",{className:"text-xs text-fg/40",children:"Duration"}),p.jsx("div",{className:"text-sm font-mono",children:U(B.duration_ms)})]})]})]}),p.jsx(bn,{children:u===B.label&&p.jsx(Ne.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border/10 overflow-hidden",children:p.jsx("div",{className:"p-3 bg-black/20 max-h-96 overflow-y-auto custom-scrollbar space-y-1",children:w.filter(oe=>oe.source_label===B.label).length===0?p.jsx("div",{className:"text-center py-4 text-fg/40 text-xs",children:"No URL details available for this source"}):w.filter(oe=>oe.source_label===B.label).map((oe,Te)=>p.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-surface/30 hover:bg-surface/50 transition-colors",children:[z(oe.result),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"text-xs font-mono truncate text-fg/80",children:oe.url}),oe.result==="signal"&&p.jsxs("div",{className:"text-[10px] text-primary",children:["Signal (",oe.score,"%) - ",oe.category]}),oe.result==="skipped"&&p.jsxs("div",{className:"text-[10px] text-fg/40",children:["Skipped (",oe.score,"%) - ",oe.reason]}),oe.result==="error"&&p.jsxs("div",{className:"text-[10px] text-error",children:["Error: ",oe.reason]})]}),p.jsx("a",{href:oe.url,target:"_blank",rel:"noopener noreferrer",className:"p-1 hover:bg-surface rounded",onClick:ve=>ve.stopPropagation(),children:p.jsx(Oa,{className:"w-3 h-3 text-fg/40"})})]},Te))})})})]},Y))})})})]},$.id))})})]})}function kC({signals:t,limit:e=10,onSignalClick:n}){const i=t.slice(0,e),o=u=>u>=80?"bg-yellow-400/20 text-yellow-400 border-yellow-400/30":u>=50?"bg-blue-400/20 text-blue-400 border-blue-400/30":"bg-gray-400/20 text-gray-400 border-gray-400/30",l=u=>{const d=new Date(u),m=new Date().getTime()-d.getTime(),y=Math.floor(m/6e4),v=Math.floor(m/36e5);return y<1?"Just now":y<60?`${y}m ago`:v<24?`${v}h ago`:d.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return i.length===0?null:p.jsxs("div",{className:"mb-6",children:[p.jsxs("div",{className:"flex items-center justify-between mb-3",children:[p.jsx("h3",{className:"text-sm font-semibold text-fg/70 uppercase tracking-wide",children:"New Signals"}),p.jsx("button",{className:"text-xs text-blue-400 hover:text-blue-300 transition-colors",children:"View All →"})]}),p.jsx("div",{className:"overflow-x-auto pb-4 -mx-4 px-4",children:p.jsx("div",{className:"flex gap-3 min-w-max",children:i.map(u=>p.jsxs(Ne.button,{onClick:()=>n(u.id),whileHover:{scale:1.05,y:-2},whileTap:{scale:.98},className:"flex-shrink-0 w-[120px] bg-surface/50 backdrop-blur-sm border border-white/10 rounded-lg p-3 hover:border-blue-400/30 transition-all duration-300 text-left group",children:[p.jsx("div",{className:`w-12 h-12 rounded-full border-2 flex items-center justify-center mx-auto mb-2 ${o(u.score)}`,children:p.jsx("span",{className:"text-xl font-bold",children:u.score})}),p.jsx("p",{className:"text-xs text-fg line-clamp-2 mb-2 group-hover:text-blue-400 transition-colors",children:u.title}),p.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-fg/40",children:[p.jsx(fs,{size:10}),p.jsx("span",{children:l(u.created_at)})]})]},u.id))})})]})}const Li=[{id:"ai",name:"AI & ML",icon:"🤖",color:"blue"},{id:"business",name:"Business",icon:"📊",color:"purple"},{id:"politics",name:"Politics",icon:"🏛️",color:"red"},{id:"technology",name:"Technology",icon:"💻",color:"cyan"},{id:"finance",name:"Finance",icon:"💰",color:"green"},{id:"crypto",name:"Crypto",icon:"₿",color:"orange"},{id:"science",name:"Science",icon:"🔬",color:"teal"},{id:"other",name:"Other",icon:"📌",color:"gray"}];function EC(t){const e={blue:"bg-blue-500/20 text-blue-400 border-blue-500/30",purple:"bg-purple-500/20 text-purple-400 border-purple-500/30",red:"bg-red-500/20 text-red-400 border-red-500/30",cyan:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",green:"bg-green-500/20 text-green-400 border-green-500/30",orange:"bg-orange-500/20 text-orange-400 border-orange-500/30",teal:"bg-teal-500/20 text-teal-400 border-teal-500/30",gray:"bg-gray-500/20 text-gray-400 border-gray-500/30"};return e[t]||e.gray}function TC(t,e){if(e){const n=Li.find(i=>i.id===e.toLowerCase());if(n)return n.id}for(const n of t){const i=n.toLowerCase(),o=Li.find(l=>i.includes(l.id)||i.includes(l.name.toLowerCase()));if(o)return o.id}return"other"}function jC({category:t,signalCount:e,latestTimestamp:n,onClick:i}){const o=l=>{const u=new Date(l),h=new Date().getTime()-u.getTime(),m=Math.floor(h/6e4),y=Math.floor(h/36e5),v=Math.floor(h/864e5);return m<60?`${m}m ago`:y<24?`${y}h ago`:v<7?`${v}d ago`:u.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return p.jsxs(Ne.button,{whileHover:{scale:1.05,y:-4},whileTap:{scale:.98},onClick:i,className:"bg-surface/50 backdrop-blur-sm border border-white/10 rounded-lg p-6 cursor-pointer hover:border-white/20 transition-all duration-300 text-left w-full",children:[p.jsx("div",{className:"text-5xl mb-4",children:t.icon}),p.jsx("h3",{className:"text-lg font-semibold mb-3 text-fg",children:t.name}),p.jsxs("div",{className:"flex items-center justify-between text-sm",children:[p.jsxs("span",{className:`px-2 py-1 rounded text-xs font-medium ${EC(t.color)}`,children:[e," ",e===1?"signal":"signals"]}),p.jsxs("span",{className:"text-fg/40 flex items-center gap-1 text-xs",children:[p.jsx(fs,{size:12}),o(n)]})]})]})}function CC({signals:t,onCategoryClick:e}){const n=R.useMemo(()=>{const o=new Map;return t.forEach(l=>{const u=l.tags||[],d=TC(u,l.category);if(d){const h=o.get(d)||{count:0,latest:l.created_at};o.set(d,{count:h.count+1,latest:l.created_at>h.latest?l.created_at:h.latest})}u.forEach(h=>{const m=h.toLowerCase();Li.forEach(y=>{if(m.includes(y.id)||m.includes(y.name.toLowerCase())){const v=o.get(y.id)||{count:0,latest:l.created_at};o.set(y.id,{count:v.count+1,latest:l.created_at>v.latest?l.created_at:v.latest})}})})}),o},[t]),i=Li.filter(o=>{const l=n.get(o.id);return l&&l.count>0});return i.length===0?p.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-fg/20",children:[p.jsx("p",{className:"font-medium italic",children:"No categories yet."}),p.jsx("p",{className:"text-sm mt-2",children:"Signals will be organized here once discovered."})]}):p.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:i.map(o=>{const l=n.get(o.id);return p.jsx(jC,{category:o,signalCount:l.count,latestTimestamp:l.latest,onClick:()=>e(o.id)},o.id)})})}function NC({signal:t,onOpen:e,onCopy:n,onArchive:i,onBookmark:o}){const[l,u]=R.useState(!1),d=v=>v>=80?"text-yellow-400 border-yellow-400/30":v>=50?"text-blue-400 border-blue-400/30":"text-gray-400 border-gray-400/30",h=v=>v>=80?"HIGH":v>=50?"MEDIUM":"LOW",m=v=>({AI:"🤖",Technology:"💻",Finance:"💰",Business:"📊",Crypto:"₿"})[v]||"📌",y=v=>{const w=new Date(v),b=new Date().getTime()-w.getTime(),k=Math.floor(b/6e4),S=Math.floor(b/36e5),E=Math.floor(b/864e5);return k<60?`${k}m ago`:S<24?`${S}h ago`:E<7?`${E}d ago`:w.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return p.jsxs(Ne.div,{whileHover:{scale:1.02,boxShadow:"0 8px 24px rgba(59, 130, 246, 0.3)"},onHoverStart:()=>u(!0),onHoverEnd:()=>u(!1),className:"bg-surface/50 backdrop-blur-sm border border-white/10 rounded-lg p-6 flex flex-col gap-4 transition-all duration-300",children:[p.jsxs("div",{className:"flex items-start justify-between",children:[p.jsx("div",{className:"flex items-center gap-3",children:p.jsxs("div",{className:`flex flex-col items-center justify-center w-16 h-16 rounded-full border-2 ${d(t.score)}`,children:[p.jsx("span",{className:"text-2xl font-bold",children:t.score}),p.jsx("span",{className:"text-[10px] font-medium opacity-70",children:h(t.score)})]})}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("span",{className:"px-2 py-1 bg-blue-500/20 text-blue-400 text-xs font-medium rounded border border-blue-500/30",children:[m(t.category)," ",t.category]}),p.jsxs("span",{className:"text-xs text-fg/50 flex items-center gap-1",children:[p.jsx(fs,{size:12}),y(t.created_at)]})]})]}),p.jsxs("div",{className:"flex-1",children:[p.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-lg font-semibold text-fg hover:text-blue-400 transition-colors line-clamp-2 mb-2 block",onClick:v=>{v.preventDefault(),e?.(t.url)},children:t.title}),p.jsx("p",{className:"text-sm text-fg/70 line-clamp-3",children:t.summary})]}),t.entities&&t.entities.length>0&&p.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.entities.slice(0,4).map((v,w)=>p.jsx("span",{className:"px-2 py-1 bg-white/5 text-fg/60 text-xs rounded border border-white/10",children:v},w)),t.entities.length>4&&p.jsxs("span",{className:"px-2 py-1 text-fg/40 text-xs",children:["+",t.entities.length-4," more"]})]}),p.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-white/5",children:[p.jsxs("button",{onClick:()=>e?.(t.url),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-white/5 hover:bg-white/10 rounded transition-colors text-sm",title:"Open URL",children:[p.jsx(Oa,{size:14}),p.jsx("span",{children:"Open"})]}),p.jsxs("button",{onClick:()=>n?.(t.summary),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-white/5 hover:bg-white/10 rounded transition-colors text-sm",title:"Copy Summary",children:[p.jsx(cy,{size:14}),p.jsx("span",{children:"Copy"})]}),p.jsxs("button",{onClick:()=>i?.(t.id),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-white/5 hover:bg-red-500/20 hover:text-red-400 rounded transition-colors text-sm",title:"Archive",children:[p.jsx(Wx,{size:14}),p.jsx("span",{children:"Archive"})]}),o&&p.jsx("button",{onClick:()=>o(t.id),className:"px-3 py-2 bg-white/5 hover:bg-yellow-500/20 hover:text-yellow-400 rounded transition-colors",title:"Bookmark",children:p.jsx(Gx,{size:14})})]})]})}function AC({isOpen:t,onClose:e,categoryId:n,signals:i,onOpenUrl:o,onCopyText:l,onArchive:u}){const d=Li.find(w=>w.id===n),h=i.filter(w=>{const _=w.tags||[],b=w.category?.toLowerCase()===n,k=_.some(S=>S.toLowerCase().includes(n));return b||k}),m=w=>{o?o(w):window.open(w,"_blank","noopener,noreferrer")},y=w=>{l?l(w):navigator.clipboard.writeText(w)},v=async w=>{u&&await u(w)};return p.jsx(bn,{children:t&&p.jsxs(p.Fragment,{children:[p.jsx(Ne.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:e,className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-40"}),p.jsx(Ne.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:30,stiffness:300},className:"fixed right-0 top-0 h-full w-full md:w-2/3 lg:w-1/2 bg-bg border-l border-white/10 z-50 overflow-y-auto custom-scrollbar",children:p.jsxs("div",{className:"p-6",children:[p.jsxs("div",{className:"flex items-center justify-between mb-6 sticky top-0 bg-bg pb-4 border-b border-white/10",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("span",{className:"text-4xl",children:d?.icon}),p.jsxs("div",{children:[p.jsx("h2",{className:"text-2xl font-bold",children:d?.name}),p.jsxs("p",{className:"text-sm text-fg/50",children:[h.length," ",h.length===1?"signal":"signals"]})]})]}),p.jsx("button",{onClick:e,className:"p-2 hover:bg-white/10 rounded transition-colors","aria-label":"Close drawer",children:p.jsx(ps,{size:24})})]}),p.jsx("div",{className:"space-y-4",children:h.length===0?p.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:p.jsx("p",{className:"italic",children:"No signals in this category yet."})}):h.map(w=>p.jsx(NC,{signal:w,onOpen:m,onCopy:y,onArchive:v},w.id))})]})})]})})}function PC({onOpenUrl:t,onCopyText:e}){const[n,i]=R.useState([]),[o,l]=R.useState(!0),[u,d]=R.useState(null),[h,m]=R.useState(""),[y,v]=R.useState(null);R.useEffect(()=>{(async()=>{l(!0);let E=ge.from("signals").select("*").order("created_at",{ascending:!1}).limit(50);y&&(E=E.ilike("category",y)),h&&(E=E.or(`title.ilike.%${h}%,summary.ilike.%${h}%,url.ilike.%${h}%`));const{data:A,error:P}=await E;P?console.error("Error fetching signals:",P):i(A||[]),l(!1)})();const S=ge.channel("signals").on("postgres_changes",{event:"INSERT",schema:"public",table:"signals"},E=>{i(A=>[E.new,...A])}).subscribe();return()=>{S.unsubscribe()}},[h,y]);const w=k=>{t?t(k):window.open(k,"_blank","noopener,noreferrer")},_=k=>{e?e(k):navigator.clipboard.writeText(k)},b=async k=>{await ge.from("signals").delete().eq("id",k),i(S=>S.filter(E=>E.id!==k))};return p.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p.jsx("div",{className:"px-4 pt-4",children:p.jsx(kC,{signals:n,limit:10,onSignalClick:k=>{const S=n.find(E=>E.id===k);S&&S.category&&d(S.category.toLowerCase())}})}),p.jsxs("div",{className:"px-4 pt-4 pb-2 space-y-3",children:[p.jsxs("div",{className:"relative",children:[p.jsx(_c,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-fg/30"}),p.jsx("input",{type:"text",placeholder:"Search signals by title, summary, or URL...",value:h,onChange:k=>m(k.target.value),className:"w-full bg-surface/50 border border-border/10 rounded-xl py-2.5 pl-10 pr-4 text-sm focus:border-primary/30 outline-none transition-all"})]}),p.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[p.jsx(t1,{className:"w-3.5 h-3.5 text-fg/30"}),p.jsx("button",{onClick:()=>v(null),className:`px-3 py-1 rounded-lg text-xs font-medium transition-all ${y===null?"bg-primary text-white":"bg-surface/50 text-fg/60 hover:bg-surface"}`,children:"All"}),["AI & ML","Business","Politics","Technology","Finance","Crypto","Science","Other"].map(k=>p.jsx("button",{onClick:()=>v(k),className:`px-3 py-1 rounded-lg text-xs font-medium transition-all ${y===k?"bg-primary text-white":"bg-surface/50 text-fg/60 hover:bg-surface"}`,children:k},k))]})]}),p.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-12 custom-scrollbar",children:o?p.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:p.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-400"})}):p.jsx(CC,{signals:n,onCategoryClick:k=>d(k)})}),p.jsx(AC,{isOpen:!!u,onClose:()=>d(null),categoryId:u||"",signals:n,onOpenUrl:w,onCopyText:_,onArchive:b})]})}class RC{audioContext=null;enabled=!0;constructor(){}getAudioContext(){return this.audioContext||(this.audioContext=new(window.AudioContext||window.webkitAudioContext)),this.audioContext}setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}playTone(e,n,i=.3){if(this.enabled)try{const o=this.getAudioContext(),l=o.createOscillator(),u=o.createGain();l.connect(u),u.connect(o.destination),l.frequency.value=e,l.type="sine",u.gain.setValueAtTime(i,o.currentTime),u.gain.exponentialRampToValueAtTime(.01,o.currentTime+n),l.start(o.currentTime),l.stop(o.currentTime+n)}catch(o){console.warn("[Sound] Failed to play tone:",o)}}playSequence(e,n=.3){if(!this.enabled)return;let i=0;e.forEach(o=>{setTimeout(()=>{this.playTone(o.freq,o.duration,n)},i),i+=o.delay})}syncStart(){this.playSequence([{freq:261.63,duration:.15,delay:0},{freq:329.63,duration:.15,delay:100},{freq:392,duration:.2,delay:100}],.2)}signalFound(){this.playSequence([{freq:392,duration:.1,delay:0},{freq:523.25,duration:.15,delay:80}],.25)}syncComplete(){this.playSequence([{freq:261.63,duration:.12,delay:0},{freq:329.63,duration:.12,delay:80},{freq:392,duration:.12,delay:80},{freq:523.25,duration:.2,delay:80}],.2)}error(){this.playSequence([{freq:329.63,duration:.15,delay:0},{freq:261.63,duration:.2,delay:100}],.3)}click(){this.playTone(440,.05,.15)}}const di=new RC;function OC(){const[t,e]=R.useState([]),[n,i]=R.useState([]),[o,l]=R.useState("discovery"),[u,d]=R.useState(!1),[h,m]=R.useState(null),[y,v]=R.useState(!0),[w,_]=R.useState(!ly),[b,k]=R.useState(!0),[S,E]=R.useState(!1),[A,P]=R.useState(null),[U,V]=R.useState(!1),[z,$]=R.useState(!1),[B,Y]=R.useState(!1),[oe,Te]=R.useState(!0),[ve,je]=R.useState(()=>localStorage.getItem("theme")||"dark"),xe=R.useRef(null);R.useMemo(()=>{const J=n.length;let K=0,j=0,D=null;for(const fe of n){K+=fe.score,fe.score>j&&(j=fe.score);const ie=new Date(fe.date);(!D||ie>new Date(D.date))&&(D=fe)}const re=J?Math.round(K/J):0,ue=D?new Date(D.date):null;return{total:J,average:re,top:j,latestTimestamp:ue,latestTitle:D?.title??D?.category??null}},[n]),R.useEffect(()=>{(async()=>{if(!ly){_(!0),v(!1);return}try{const{data:j,error:D}=await ge.from("init_state").select("is_initialized").single();D?(console.warn("[App] Init check error (might be fresh DB):",D),D.code==="42P01"&&k(!1)):k(j.is_initialized>0);const{data:{session:re}}=await ge.auth.getSession();m(re?.user??null)}catch(j){console.error("[App] Status check failed:",j)}finally{v(!1)}})();const{data:{subscription:K}}=ge.auth.onAuthStateChange((j,D)=>{m(D?.user??null)});return()=>K.unsubscribe()},[]),R.useEffect(()=>{document.documentElement.setAttribute("data-theme",ve),localStorage.setItem("theme",ve)},[ve]);const[Oe,be]=R.useState({});R.useEffect(()=>{const J=async()=>{if(!h)return;const{data:j}=await ge.from("alchemy_settings").select("sync_start_date, last_sync_checkpoint").eq("user_id",h.id).maybeSingle();j&&be(j)};J();const K=setInterval(J,2e3);return()=>clearInterval(K)},[h,U]),R.useEffect(()=>{if(!h)return;(async()=>{const{data:j}=await ge.from("alchemy_settings").select("sound_enabled").eq("user_id",h.id).maybeSingle();if(j){const D=j.sound_enabled??!0;Te(D),di.setEnabled(D)}})();const K=ge.channel("processing_events").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events",filter:`user_id=eq.${h.id}`},j=>{const D=j.new;D.agent_state==="Mining"&&!z&&($(!0),Y(!0),oe&&di.syncStart()),D.agent_state==="Signal"&&oe&&di.signalFound(),D.agent_state==="Completed"&&($(!1),oe&&(D.metadata?.errors>0?di.error():di.syncComplete()),setTimeout(()=>{Y(!1)},5e3),pe())}).subscribe();return()=>{ge.removeChannel(K)}},[h,z,oe]),R.useEffect(()=>{const J=new EventSource("/events");return J.onmessage=K=>{const j=JSON.parse(K.data);j.type==="history"?e(D=>[...j.data,...D].slice(0,100)):e(D=>[j,...D].slice(0,100))},pe(),()=>J.close()},[h]),R.useEffect(()=>{xe.current&&xe.current.scrollIntoView({behavior:"smooth"})},[t]);const pe=async()=>{try{if(h){const{data:K,error:j}=await ge.from("signals").select("*").order("created_at",{ascending:!1});if(!j&&K){i(K.map(D=>({id:D.id,title:D.title,score:D.score,summary:D.summary,date:D.created_at,category:D.category,entities:D.entities})));return}}const J=await Re.get("/api/signals");i(J.data)}catch(J){console.error("Failed to fetch signals",J)}},F=async()=>{d(!0);try{await Re.post("/api/mine"),pe()}catch(J){console.error("Mining failed:",J)}finally{d(!1)}};return y?p.jsx("div",{className:"flex items-center justify-center h-screen bg-bg",children:p.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):w?p.jsx(A0,{onComplete:()=>_(!1)}):h?p.jsx(aC,{children:p.jsx(dC,{children:p.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-bg text-fg",children:[p.jsxs(Ne.aside,{animate:{width:S?72:240},className:"glass m-4 mr-0 flex flex-col relative",children:[p.jsxs("div",{className:`px-4 py-3 pb-4 flex items-center gap-3 ${S?"justify-center":""}`,children:[p.jsx("div",{className:"w-10 h-10 min-w-[40px] bg-gradient-to-br from-primary to-accent rounded-xl flex items-center justify-center shadow-lg glow-primary",children:p.jsx(Sr,{className:"text-white fill-current",size:24})}),!S&&p.jsx(Ne.h1,{initial:{opacity:0},animate:{opacity:1},className:"text-xl font-bold tracking-tight",children:"Alchemist"})]}),p.jsxs("nav",{className:"flex-1 flex flex-col gap-1 px-3",children:[p.jsx(pa,{active:o==="discovery",onClick:()=>l("discovery"),icon:p.jsx(o1,{size:20}),label:"Discovery",collapsed:S}),p.jsx(pa,{active:o==="engine",onClick:()=>l("engine"),icon:p.jsx(dy,{size:20}),label:"Engine",collapsed:S}),p.jsx(pa,{active:o==="logs",onClick:()=>l("logs"),icon:p.jsx(Sc,{size:20}),label:"System Logs",collapsed:S}),p.jsx(pa,{active:o==="account",onClick:()=>l("account"),icon:p.jsx(id,{size:20}),label:"Account",collapsed:S})]}),p.jsx("div",{className:"px-3 pb-2",children:p.jsxs("button",{onClick:()=>je(ve==="dark"?"light":"dark"),className:`w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-fg/40 hover:text-fg hover:bg-surface/50 transition-all text-xs font-medium ${S?"justify-center":""}`,title:S?ve==="dark"?"Switch to Light Mode":"Switch to Dark Mode":"",children:[p.jsx("div",{className:"min-w-[18px] flex justify-center",children:ve==="dark"?p.jsx(m1,{size:18}):p.jsx(c1,{size:18})}),!S&&p.jsx(Ne.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"whitespace-nowrap",children:ve==="dark"?"Light Mode":"Dark Mode"})]})}),p.jsx("div",{className:"px-3 pb-3",children:p.jsx("button",{onClick:()=>E(!S),className:`w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-fg/40 hover:text-fg hover:bg-surface/50 transition-all text-xs font-medium ${S?"justify-center":""}`,children:S?p.jsx("span",{className:"text-lg",children:"»"}):p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-lg",children:"«"}),p.jsx("span",{children:"Collapse"})]})})})]}),p.jsxs("main",{className:"flex-1 flex flex-col p-4 gap-4 overflow-hidden relative",children:[o==="discovery"&&p.jsxs(p.Fragment,{children:[p.jsxs("header",{className:"flex justify-between items-center px-4 py-2",children:[p.jsxs("div",{children:[p.jsx("h2",{className:"text-2xl font-bold",children:"Discovery"}),p.jsx("p",{className:"text-sm text-fg/50",children:"Passive intelligence mining from your browser history."})]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsxs("button",{onClick:()=>V(!0),className:"px-4 py-2 glass hover:bg-surface transition-colors flex items-center gap-2 text-sm font-medium",children:[p.jsx(f1,{size:16}),p.jsxs("div",{className:"flex flex-col items-start",children:[p.jsx("span",{children:"Sync Settings"}),(Oe.sync_start_date||Oe.last_sync_checkpoint)&&p.jsx("span",{className:"text-[10px] text-fg/40 font-mono",children:Oe.sync_start_date?`From: ${new Date(Oe.sync_start_date).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:Oe.last_sync_checkpoint?`Checkpoint: ${new Date(Oe.last_sync_checkpoint).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:""})]})]}),p.jsxs("button",{onClick:F,disabled:z,className:"px-4 py-2 glass hover:bg-surface transition-colors flex items-center gap-2 text-sm font-medium disabled:opacity-50 disabled:cursor-not-allowed",children:[p.jsx(rd,{size:16,className:z?"animate-spin":""}),z?"Syncing...":"Sync History"]})]})]}),p.jsx(PC,{onOpenUrl:J=>window.open(J,"_blank","noopener,noreferrer"),onCopyText:J=>{navigator.clipboard.writeText(J)}})]}),o==="engine"&&p.jsx(cC,{}),o==="account"&&p.jsx(yC,{}),o==="logs"&&p.jsx(SC,{}),p.jsx(fC,{isExpanded:B,onToggle:()=>Y(!B)})]}),p.jsx(bC,{signal:A,onClose:()=>P(null)}),p.jsx(_C,{isOpen:U,onClose:()=>V(!1)})]})})}):p.jsx(sC,{onAuthSuccess:()=>pe(),isInitialized:b})}function pa({active:t,icon:e,label:n,onClick:i,collapsed:o}){return p.jsx("button",{onClick:i,title:o?n:"",className:`w-full flex items-center ${o?"justify-center":"gap-3"} px-4 py-3 rounded-xl transition-all ${t?"bg-primary/10 text-primary shadow-sm":"text-fg/60 hover:bg-surface hover:text-fg"}`,children:o?_i.cloneElement(e,{className:t?"text-primary":""}):p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"min-w-[20px] flex justify-center",children:_i.cloneElement(e,{className:t?"text-primary":""})}),p.jsx(Ne.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"font-semibold text-sm whitespace-nowrap",children:n})]})})}function IC(){Re.interceptors.request.use(async t=>{try{const{data:{session:e}}=await ge.auth.getSession();e?.access_token&&(t.headers.Authorization=`Bearer ${e.access_token}`);const n=Jd();n&&(t.headers["x-supabase-url"]=n.url,t.headers["x-supabase-key"]=n.anonKey)}catch(e){console.error("[Axios] Error injecting headers:",e)}return t})}IC();Vx.createRoot(document.getElementById("root")).render(p.jsx(_i.StrictMode,{children:p.jsx(OC,{})}));
101
+ ${t.content}`:""}`,h=new Blob([d],{type:"text/markdown"}),m=URL.createObjectURL(h),y=document.createElement("a");y.href=m,y.download=`${t.title.replace(/[^a-z0-9]/gi,"_").toLowerCase()}.md`,y.click(),URL.revokeObjectURL(m)},u=()=>{const d=JSON.stringify(t,null,2),h=new Blob([d],{type:"application/json"}),m=URL.createObjectURL(h),y=document.createElement("a");y.href=m,y.download=`signal_${t.id}.json`,y.click(),URL.revokeObjectURL(m)};return p.jsx(_n,{children:p.jsx(Ne.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-bg/80 backdrop-blur-sm",onClick:e,children:p.jsxs(Ne.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},onClick:d=>d.stopPropagation(),className:"w-full max-w-4xl max-h-[90vh] glass flex flex-col overflow-hidden",children:[p.jsxs("div",{className:"p-6 border-b border-border/10 flex items-start justify-between",children:[p.jsxs("div",{className:"flex-1 min-w-0 pr-4",children:[p.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[p.jsx("span",{className:"px-2 py-0.5 bg-primary/10 text-primary text-[10px] font-bold rounded border border-primary/20 uppercase tracking-wider",children:t.category||"Research"}),p.jsx("span",{className:`text-3xl font-black ${t.score>=80?"text-accent":"text-fg/40"}`,children:t.score})]}),p.jsx("h2",{className:"text-2xl font-bold leading-tight mb-2",children:t.title}),p.jsxs("p",{className:"text-xs text-fg/40 font-mono",children:["Discovered ",new Date(t.date).toLocaleDateString([],{month:"long",day:"numeric",year:"numeric"})]})]}),p.jsx("button",{onClick:e,className:"p-2 hover:bg-surface rounded-lg text-fg/40 hover:text-fg transition-all",children:p.jsx(Sr,{size:24})})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6 space-y-6",children:[t.url&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Original Source"}),p.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 glass hover:bg-surface transition-all rounded-xl text-sm font-mono text-primary hover:text-accent group",children:[p.jsx(Ia,{size:16,className:"flex-shrink-0"}),p.jsx("span",{className:"truncate",children:t.url}),p.jsx("span",{className:"ml-auto text-xs opacity-0 group-hover:opacity-100 transition-opacity",children:"Open →"})]})]}),t.entities&&t.entities.length>0&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Entities"}),p.jsx("div",{className:"flex flex-wrap gap-2",children:t.entities.map(d=>p.jsx("span",{className:"px-3 py-1.5 bg-surface/50 border border-border/20 rounded-lg text-sm font-medium",children:d},d))})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"AI Summary"}),p.jsx("div",{className:"p-4 glass rounded-xl",children:p.jsx("p",{className:"text-sm leading-relaxed text-fg/80",children:t.summary})})]}),t.content&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Full Content"}),p.jsx("div",{className:"p-4 glass rounded-xl max-h-96 overflow-y-auto custom-scrollbar",children:p.jsx("p",{className:"text-sm leading-relaxed text-fg/60 whitespace-pre-wrap",children:t.content})})]})]}),p.jsxs("div",{className:"p-6 border-t border-border/10 flex items-center gap-3",children:[p.jsxs("button",{onClick:o,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[n?p.jsx(Si,{size:16,className:"text-success"}):p.jsx(cy,{size:16}),n?"Copied!":"Copy"]}),p.jsxs("button",{onClick:l,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[p.jsx(nm,{size:16}),"Markdown"]}),p.jsxs("button",{onClick:u,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[p.jsx(nm,{size:16}),"JSON"]})]})]})})})}function _C({isOpen:t,onClose:e}){const{showToast:n}=R0(),[i,o]=R.useState(""),[l,u]=R.useState(50),[d,h]=R.useState(!1),[m,y]=R.useState(!1);R.useEffect(()=>{t&&v()},[t]);const v=async()=>{const{data:{user:b}}=await me.auth.getUser();if(!b)return;const{data:S}=await me.from("alchemy_settings").select("*").eq("user_id",b.id).maybeSingle();if(S)if(u(S.max_urls_per_sync||50),S.sync_start_date){const k=new Date(S.sync_start_date),E=N=>N<10?"0"+N:N,P=k.getFullYear()+"-"+E(k.getMonth()+1)+"-"+E(k.getDate())+"T"+E(k.getHours())+":"+E(k.getMinutes());o(P)}else o("")},w=async()=>{h(!0);try{const{data:{user:b}}=await me.auth.getUser();if(!b){n("Please log in to save settings","error"),h(!1);return}const{error:S}=await me.from("alchemy_settings").update({max_urls_per_sync:l,sync_start_date:i?new Date(i).toISOString():null}).eq("user_id",b.id);S?n(`Failed to save: ${S.message}`,"error"):(n("Sync settings saved successfully","success"),e())}catch(b){n(`Unexpected error: ${b.message}`,"error")}finally{h(!1)}},_=async()=>{y(!0);try{const{data:{user:b}}=await me.auth.getUser();if(!b){n("Please log in to reset checkpoint","error"),y(!1);return}const{error:S}=await me.from("alchemy_settings").update({last_sync_checkpoint:null}).eq("user_id",b.id);S?n(`Failed to reset: ${S.message}`,"error"):n("Checkpoint reset successfully","success")}catch(b){n(`Unexpected error: ${b.message}`,"error")}finally{y(!1)}};return t?p.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:p.jsxs("div",{className:"bg-surface border border-border/20 rounded-2xl shadow-2xl max-w-lg w-full max-h-[90vh] overflow-y-auto",children:[p.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border/10",children:[p.jsx("h2",{className:"text-xl font-bold",children:"Sync Settings"}),p.jsx("button",{onClick:e,className:"p-2 hover:bg-black/10 rounded-lg transition-colors",children:p.jsx(Sr,{className:"w-5 h-5"})})]}),p.jsxs("div",{className:"p-6 space-y-6",children:[p.jsxs("div",{className:"space-y-3",children:[p.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[p.jsx(Qx,{className:"w-4 h-4 text-primary"}),"Sync From (Optional)"]}),p.jsx("input",{type:"datetime-local",value:i,onChange:b=>o(b.target.value),className:"w-full bg-black/20 border border-border/10 rounded-xl py-3 px-4 text-sm focus:border-primary/30 outline-none transition-all"}),p.jsx("p",{className:"text-xs text-fg/50",children:"Leave empty to sync only new URLs since last sync (incremental). Set a date to process URLs from that point forward."})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"flex justify-between items-center",children:[p.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[p.jsx(r1,{className:"w-4 h-4 text-primary"}),"URLs per Sync"]}),p.jsx("span",{className:"text-sm font-mono text-primary",children:l})]}),p.jsx("input",{type:"range",min:"5",max:"200",step:"5",value:l,onChange:b=>u(Number(b.target.value)),className:"w-full h-2 bg-black/20 rounded-lg appearance-none cursor-pointer accent-primary"}),p.jsxs("div",{className:"flex justify-between text-xs text-fg/30 font-medium",children:[p.jsx("span",{children:"Quick (5)"}),p.jsx("span",{children:"Balanced (50)"}),p.jsx("span",{children:"Thorough (200)"})]})]}),p.jsxs("div",{className:"pt-4 border-t border-border/10",children:[p.jsxs("button",{onClick:_,disabled:m,className:"w-full px-4 py-2.5 bg-warning/10 hover:bg-warning/20 border border-warning/20 text-warning font-medium rounded-xl transition-all flex items-center justify-center gap-2 text-sm disabled:opacity-50",children:[p.jsx(h1,{size:16,className:m?"animate-spin":""}),m?"Resetting...":"Reset Checkpoint"]}),p.jsx("p",{className:"text-xs text-fg/40 mt-2 text-center",children:'Clear the sync checkpoint to force a full re-sync from your "Sync From" date'})]}),p.jsx("div",{className:"p-4 bg-primary/5 rounded-xl",children:p.jsx("p",{className:"text-xs text-primary/60 leading-relaxed",children:'The Alchemist tracks your progress automatically. Use "Sync From" to backfill history or "Reset Checkpoint" to start fresh.'})})]}),p.jsxs("div",{className:"flex gap-3 p-6 border-t border-border/10",children:[p.jsx("button",{onClick:e,className:"flex-1 px-4 py-2.5 bg-surface hover:bg-black/10 border border-border/10 rounded-xl font-medium transition-all",children:"Cancel"}),p.jsxs("button",{onClick:w,disabled:d,className:"flex-1 px-4 py-2.5 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg hover:scale-[1.02] active:scale-95 transition-all flex items-center justify-center gap-2 disabled:opacity-50",children:[p.jsx(ba,{size:18,className:d?"animate-spin":""}),d?"Saving...":"Save Settings"]})]})]})}):null}function SC(){const[t,e]=R.useState([]),[n,i]=R.useState(!0),[o,l]=R.useState(null),[u,d]=R.useState(null),[h,m]=R.useState([]),[y,v]=R.useState([]),[w,_]=R.useState([]),[b,S]=R.useState(!1);R.useEffect(()=>{k()},[]);const k=async()=>{i(!0);try{const{data:{user:$}}=await me.auth.getUser();if(!$)return;const{data:B,error:Y}=await me.from("processing_events").select("*").eq("user_id",$.id).eq("agent_state","Completed").order("created_at",{ascending:!1}).limit(50);if(Y){console.error("Error fetching sync runs:",Y);return}const oe=(B||[]).map(Te=>{const ve=Te.metadata||{},je=ve.errors||0,xe=ve.signals_found||0,Oe=ve.skipped||0;return{id:Te.id,started_at:Te.created_at,completed_at:Te.created_at,duration_ms:Te.duration_ms||0,signals_found:xe,urls_processed:ve.total_urls||0,skipped:Oe,errors:je,status:je>0?"partial":xe>0?"success":"failed"}});e(oe)}catch($){console.error("Failed to fetch sync runs:",$)}finally{i(!1)}},E=async $=>{S(!0);try{const{data:{user:B}}=await me.auth.getUser();if(!B)return;const Y=t.find(F=>F.id===$);if(!Y)return;const oe=new Date(new Date(Y.started_at).getTime()-Y.duration_ms),Te=new Date(Y.completed_at),{data:ve,error:je}=await me.from("processing_events").select("*").eq("user_id",B.id).gte("created_at",oe.toISOString()).lte("created_at",Te.toISOString()).order("created_at",{ascending:!0});if(je){console.error("Error fetching run events:",je);return}m(ve||[]);const xe=[],Oe=(ve||[]).filter(F=>F.agent_state==="Mining"&&F.message.includes("Mining source:"));for(const F of Oe){const J=F.message.match(/Mining source: (.+) \((.+)\)/);if(J){const K=J[1],j=J[2],D=(ve||[]).find(fe=>fe.agent_state==="Mining"&&fe.message.includes("Found")&&fe.message.includes(K)&&fe.created_at>F.created_at),re=D?.message.match(/Found (\d+) URLs/),ue=re?parseInt(re[1]):0;xe.push({label:K,browser:j,urls_found:ue,duration_ms:D?.duration_ms||0,status:F.event_type==="error"?"error":"success"})}}v(xe);const be=[],pe=(ve||[]).filter(F=>F.agent_state==="Reading");for(const F of pe){const J=F.message.match(/Reading content from: (.+)/);if(!J)continue;const K=J[1];let j=xe.length>0?xe[0].label:"Unknown";const D=xe.filter(ie=>ie.urls_found>0);(D.length===1||D.length>1)&&(j=D[0].label),console.log(`[SystemLogs] URL ${K} assigned to source: ${j}`);const re=(ve||[]).find(ie=>ie.agent_state==="Signal"&&ie.created_at>F.created_at&&ie.message.includes("Found signal")),ue=(ve||[]).find(ie=>ie.agent_state==="Skipped"&&ie.created_at>F.created_at&&ie.message.includes("Irrelevant content")),fe=(ve||[]).find(ie=>ie.event_type==="error"&&ie.created_at>F.created_at);if(re){const ie=re.message.match(/\((\d+)%\)/),Ee=ie?parseInt(ie[1]):0;be.push({url:K,result:"signal",score:Ee,category:re.details?.category||"Unknown",duration_ms:re.duration_ms,source_label:j})}else if(ue){const ie=ue.message.match(/\((\d+)%\): (.+)/),Ee=ie?parseInt(ie[1]):0,ke=ie?ie[2]:"Irrelevant";be.push({url:K,result:"skipped",score:Ee,reason:ke,duration_ms:ue.duration_ms,source_label:j})}else fe&&be.push({url:K,result:"error",reason:fe.message,source_label:j})}_(be)}catch(B){console.error("Failed to fetch run details:",B)}finally{S(!1)}},P=$=>{o===$?(l(null),d(null),v([]),_([])):(l($),d(null),E($))},N=$=>{d(u===$?null:$)},U=$=>{if($<1e3)return`${$}ms`;const B=Math.floor($/1e3);if(B<60)return`${B}s`;const Y=Math.floor(B/60),oe=B%60;return`${Y}m ${oe}s`},V=$=>{switch($){case"success":return p.jsx(rd,{className:"w-5 h-5 text-success"});case"failed":return p.jsx(am,{className:"w-5 h-5 text-error"});case"partial":return p.jsx(Mi,{className:"w-5 h-5 text-warning"});default:return p.jsx(ps,{className:"w-5 h-5 text-fg/40"})}},z=$=>{switch($){case"signal":return p.jsx(kr,{className:"w-4 h-4 text-primary"});case"skipped":return p.jsx(p1,{className:"w-4 h-4 text-fg/40"});case"error":return p.jsx(am,{className:"w-4 h-4 text-error"});default:return null}};return n?p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):p.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-8",children:[p.jsxs("div",{className:"mb-6",children:[p.jsx("h2",{className:"text-2xl font-bold",children:"System Logs"}),p.jsx("p",{className:"text-sm text-fg/50",children:"Detailed history of sync runs, sources, and URL processing"})]}),p.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:t.length===0?p.jsxs("div",{className:"text-center py-12 text-fg/40",children:[p.jsx(ps,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),p.jsx("p",{children:"No sync runs yet"})]}):p.jsx("div",{className:"space-y-2",children:t.map($=>p.jsxs("div",{className:"glass rounded-xl overflow-hidden",children:[p.jsxs("button",{onClick:()=>P($.id),className:"w-full p-4 flex items-center gap-4 hover:bg-surface/50 transition-colors text-left",children:[o===$.id?p.jsx(_c,{className:"w-5 h-5 text-primary shrink-0"}):p.jsx(tm,{className:"w-5 h-5 text-fg/40 shrink-0"}),V($.status),p.jsxs("div",{className:"flex-1 grid grid-cols-6 gap-4 items-center",children:[p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Timestamp"}),p.jsx("div",{className:"text-sm font-mono",children:new Date($.started_at).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Duration"}),p.jsx("div",{className:"text-sm font-mono",children:U($.duration_ms)})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Signals"}),p.jsx("div",{className:"text-sm font-semibold text-primary",children:$.signals_found})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Skipped"}),p.jsx("div",{className:"text-sm font-semibold text-fg/60",children:$.skipped})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"URLs"}),p.jsx("div",{className:"text-sm font-semibold",children:$.urls_processed})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Errors"}),p.jsx("div",{className:`text-sm font-semibold ${$.errors>0?"text-error":"text-fg/40"}`,children:$.errors})]})]})]}),p.jsx(_n,{children:o===$.id&&p.jsx(Ne.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border/10 overflow-hidden",children:p.jsx("div",{className:"p-4 bg-black/10 space-y-2",children:b?p.jsx("div",{className:"flex items-center justify-center py-8",children:p.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):y.length===0?p.jsx("div",{className:"text-center py-4 text-fg/40 text-sm",children:"No source details available"}):y.map((B,Y)=>p.jsxs("div",{className:"glass rounded-lg overflow-hidden",children:[p.jsxs("button",{onClick:()=>N(B.label),className:"w-full p-3 flex items-center gap-3 hover:bg-surface/50 transition-colors text-left",children:[u===B.label?p.jsx(_c,{className:"w-4 h-4 text-primary shrink-0"}):p.jsx(tm,{className:"w-4 h-4 text-fg/40 shrink-0"}),p.jsxs("div",{className:"flex-1 flex items-center gap-4",children:[p.jsxs("div",{className:"flex-1",children:[p.jsx("div",{className:"text-sm font-semibold",children:B.label}),p.jsx("div",{className:"text-xs text-fg/40",children:B.browser})]}),p.jsxs("div",{className:"text-right",children:[p.jsx("div",{className:"text-xs text-fg/40",children:"URLs Found"}),p.jsx("div",{className:"text-sm font-semibold",children:B.urls_found})]}),p.jsxs("div",{className:"text-right",children:[p.jsx("div",{className:"text-xs text-fg/40",children:"Duration"}),p.jsx("div",{className:"text-sm font-mono",children:U(B.duration_ms)})]})]})]}),p.jsx(_n,{children:u===B.label&&p.jsx(Ne.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border/10 overflow-hidden",children:p.jsx("div",{className:"p-3 bg-black/20 max-h-96 overflow-y-auto custom-scrollbar space-y-1",children:w.filter(oe=>oe.source_label===B.label).length===0?p.jsx("div",{className:"text-center py-4 text-fg/40 text-xs",children:"No URL details available for this source"}):w.filter(oe=>oe.source_label===B.label).map((oe,Te)=>p.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-surface/30 hover:bg-surface/50 transition-colors",children:[z(oe.result),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"text-xs font-mono truncate text-fg/80",children:oe.url}),oe.result==="signal"&&p.jsxs("div",{className:"text-[10px] text-primary",children:["Signal (",oe.score,"%) - ",oe.category]}),oe.result==="skipped"&&p.jsxs("div",{className:"text-[10px] text-fg/40",children:["Skipped (",oe.score,"%) - ",oe.reason]}),oe.result==="error"&&p.jsxs("div",{className:"text-[10px] text-error",children:["Error: ",oe.reason]})]}),p.jsx("a",{href:oe.url,target:"_blank",rel:"noopener noreferrer",className:"p-1 hover:bg-surface rounded",onClick:ve=>ve.stopPropagation(),children:p.jsx(Ia,{className:"w-3 h-3 text-fg/40"})})]},Te))})})})]},Y))})})})]},$.id))})})]})}function kC({signals:t,limit:e=10,onSignalClick:n}){const i=t.slice(0,e),o=u=>u>=80?"bg-yellow-400/20 text-yellow-400 border-yellow-400/30":u>=50?"bg-blue-400/20 text-blue-400 border-blue-400/30":"bg-gray-400/20 text-gray-400 border-gray-400/30",l=u=>{const d=new Date(u),m=new Date().getTime()-d.getTime(),y=Math.floor(m/6e4),v=Math.floor(m/36e5);return y<1?"Just now":y<60?`${y}m ago`:v<24?`${v}h ago`:d.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return i.length===0?null:p.jsxs("div",{className:"mb-6",children:[p.jsxs("div",{className:"flex items-center justify-between mb-3",children:[p.jsx("h3",{className:"text-sm font-semibold text-fg/70 uppercase tracking-wide",children:"New Signals"}),p.jsx("button",{className:"text-xs text-blue-400 hover:text-blue-300 transition-colors",children:"View All →"})]}),p.jsx("div",{className:"overflow-x-auto pb-4 -mx-4 px-4",children:p.jsx("div",{className:"flex gap-3 min-w-max",children:i.map(u=>p.jsxs(Ne.button,{onClick:()=>n(u.id),whileHover:{scale:1.05,y:-2},whileTap:{scale:.98},className:"flex-shrink-0 w-[120px] bg-surface/50 backdrop-blur-sm border border-white/10 rounded-lg p-3 hover:border-blue-400/30 transition-all duration-300 text-left group",children:[p.jsx("div",{className:`w-12 h-12 rounded-full border-2 flex items-center justify-center mx-auto mb-2 ${o(u.score)}`,children:p.jsx("span",{className:"text-xl font-bold",children:u.score})}),p.jsx("p",{className:"text-xs text-fg line-clamp-2 mb-2 group-hover:text-blue-400 transition-colors",children:u.title}),p.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-fg/40",children:[p.jsx(ps,{size:10}),p.jsx("span",{children:l(u.created_at)})]})]},u.id))})})]})}const Li=[{id:"ai",name:"AI & ML",icon:"🤖",color:"blue"},{id:"business",name:"Business",icon:"📊",color:"purple"},{id:"politics",name:"Politics",icon:"🏛️",color:"red"},{id:"technology",name:"Technology",icon:"💻",color:"cyan"},{id:"finance",name:"Finance",icon:"💰",color:"green"},{id:"crypto",name:"Crypto",icon:"₿",color:"orange"},{id:"science",name:"Science",icon:"🔬",color:"teal"},{id:"other",name:"Other",icon:"📌",color:"gray"}];function EC(t){const e={blue:"bg-blue-500/20 text-blue-400 border-blue-500/30",purple:"bg-purple-500/20 text-purple-400 border-purple-500/30",red:"bg-red-500/20 text-red-400 border-red-500/30",cyan:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",green:"bg-green-500/20 text-green-400 border-green-500/30",orange:"bg-orange-500/20 text-orange-400 border-orange-500/30",teal:"bg-teal-500/20 text-teal-400 border-teal-500/30",gray:"bg-gray-500/20 text-gray-400 border-gray-500/30"};return e[t]||e.gray}function TC(t,e){if(e){const n=Li.find(i=>i.id===e.toLowerCase());if(n)return n.id}for(const n of t){const i=n.toLowerCase(),o=Li.find(l=>i.includes(l.id)||i.includes(l.name.toLowerCase()));if(o)return o.id}return"other"}function jC({category:t,signalCount:e,latestTimestamp:n,onClick:i}){const o=l=>{const u=new Date(l),h=new Date().getTime()-u.getTime(),m=Math.floor(h/6e4),y=Math.floor(h/36e5),v=Math.floor(h/864e5);return m<60?`${m}m ago`:y<24?`${y}h ago`:v<7?`${v}d ago`:u.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return p.jsxs(Ne.button,{whileHover:{scale:1.05,y:-4},whileTap:{scale:.98},onClick:i,className:"bg-surface/50 backdrop-blur-sm border border-white/10 rounded-lg p-6 cursor-pointer hover:border-white/20 transition-all duration-300 text-left w-full",children:[p.jsx("div",{className:"text-5xl mb-4",children:t.icon}),p.jsx("h3",{className:"text-lg font-semibold mb-3 text-fg",children:t.name}),p.jsxs("div",{className:"flex items-center justify-between text-sm",children:[p.jsxs("span",{className:`px-2 py-1 rounded text-xs font-medium ${EC(t.color)}`,children:[e," ",e===1?"signal":"signals"]}),p.jsxs("span",{className:"text-fg/40 flex items-center gap-1 text-xs",children:[p.jsx(ps,{size:12}),o(n)]})]})]})}function CC({signals:t,onCategoryClick:e}){const n=R.useMemo(()=>{const o=new Map;return t.forEach(l=>{const u=l.tags||[],d=TC(u,l.category);if(d){const h=o.get(d)||{count:0,latest:l.created_at};o.set(d,{count:h.count+1,latest:l.created_at>h.latest?l.created_at:h.latest})}u.forEach(h=>{const m=h.toLowerCase();Li.forEach(y=>{if(m.includes(y.id)||m.includes(y.name.toLowerCase())){const v=o.get(y.id)||{count:0,latest:l.created_at};o.set(y.id,{count:v.count+1,latest:l.created_at>v.latest?l.created_at:v.latest})}})})}),o},[t]),i=Li.filter(o=>{const l=n.get(o.id);return l&&l.count>0});return i.length===0?p.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-fg/20",children:[p.jsx("p",{className:"font-medium italic",children:"No categories yet."}),p.jsx("p",{className:"text-sm mt-2",children:"Signals will be organized here once discovered."})]}):p.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:i.map(o=>{const l=n.get(o.id);return p.jsx(jC,{category:o,signalCount:l.count,latestTimestamp:l.latest,onClick:()=>e(o.id)},o.id)})})}function NC({signal:t,onOpen:e,onCopy:n,onArchive:i,onBookmark:o}){const[l,u]=R.useState(!1),d=v=>v>=80?"text-yellow-400 border-yellow-400/30":v>=50?"text-blue-400 border-blue-400/30":"text-gray-400 border-gray-400/30",h=v=>v>=80?"HIGH":v>=50?"MEDIUM":"LOW",m=v=>({AI:"🤖",Technology:"💻",Finance:"💰",Business:"📊",Crypto:"₿"})[v]||"📌",y=v=>{const w=new Date(v),b=new Date().getTime()-w.getTime(),S=Math.floor(b/6e4),k=Math.floor(b/36e5),E=Math.floor(b/864e5);return S<60?`${S}m ago`:k<24?`${k}h ago`:E<7?`${E}d ago`:w.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return p.jsxs(Ne.div,{whileHover:{scale:1.02,boxShadow:"0 8px 24px rgba(59, 130, 246, 0.3)"},onHoverStart:()=>u(!0),onHoverEnd:()=>u(!1),className:"bg-surface/50 backdrop-blur-sm border border-white/10 rounded-lg p-6 flex flex-col gap-4 transition-all duration-300",children:[p.jsxs("div",{className:"flex items-start justify-between",children:[p.jsx("div",{className:"flex items-center gap-3",children:p.jsxs("div",{className:`flex flex-col items-center justify-center w-16 h-16 rounded-full border-2 ${d(t.score)}`,children:[p.jsx("span",{className:"text-2xl font-bold",children:t.score}),p.jsx("span",{className:"text-[10px] font-medium opacity-70",children:h(t.score)})]})}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("span",{className:"px-2 py-1 bg-blue-500/20 text-blue-400 text-xs font-medium rounded border border-blue-500/30",children:[m(t.category)," ",t.category]}),p.jsxs("span",{className:"text-xs text-fg/50 flex items-center gap-1",children:[p.jsx(ps,{size:12}),y(t.created_at)]})]})]}),p.jsxs("div",{className:"flex-1",children:[p.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-lg font-semibold text-fg hover:text-blue-400 transition-colors line-clamp-2 mb-2 block",onClick:v=>{v.preventDefault(),e?.(t.url)},children:t.title}),p.jsx("p",{className:"text-sm text-fg/70 line-clamp-3",children:t.summary})]}),t.entities&&t.entities.length>0&&p.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.entities.slice(0,4).map((v,w)=>p.jsx("span",{className:"px-2 py-1 bg-white/5 text-fg/60 text-xs rounded border border-white/10",children:v},w)),t.entities.length>4&&p.jsxs("span",{className:"px-2 py-1 text-fg/40 text-xs",children:["+",t.entities.length-4," more"]})]}),p.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-white/5",children:[p.jsxs("button",{onClick:()=>e?.(t.url),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-white/5 hover:bg-white/10 rounded transition-colors text-sm",title:"Open URL",children:[p.jsx(Ia,{size:14}),p.jsx("span",{children:"Open"})]}),p.jsxs("button",{onClick:()=>n?.(t.summary),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-white/5 hover:bg-white/10 rounded transition-colors text-sm",title:"Copy Summary",children:[p.jsx(cy,{size:14}),p.jsx("span",{children:"Copy"})]}),p.jsxs("button",{onClick:()=>i?.(t.id),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-white/5 hover:bg-red-500/20 hover:text-red-400 rounded transition-colors text-sm",title:"Archive",children:[p.jsx(Wx,{size:14}),p.jsx("span",{children:"Archive"})]}),o&&p.jsx("button",{onClick:()=>o(t.id),className:"px-3 py-2 bg-white/5 hover:bg-yellow-500/20 hover:text-yellow-400 rounded transition-colors",title:"Bookmark",children:p.jsx(Gx,{size:14})})]})]})}function AC({isOpen:t,onClose:e,categoryId:n,signals:i,onOpenUrl:o,onCopyText:l,onArchive:u}){const d=Li.find(w=>w.id===n),h=i.filter(w=>{const _=w.tags||[],b=w.category?.toLowerCase()===n,S=_.some(k=>k.toLowerCase().includes(n));return b||S}),m=w=>{o?o(w):window.open(w,"_blank","noopener,noreferrer")},y=w=>{l?l(w):navigator.clipboard.writeText(w)},v=async w=>{u&&await u(w)};return p.jsx(_n,{children:t&&p.jsxs(p.Fragment,{children:[p.jsx(Ne.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:e,className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-40"}),p.jsx(Ne.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:30,stiffness:300},className:"fixed right-0 top-0 h-full w-full md:w-2/3 lg:w-1/2 bg-bg border-l border-white/10 z-50 overflow-y-auto custom-scrollbar",children:p.jsxs("div",{className:"p-6",children:[p.jsxs("div",{className:"flex items-center justify-between mb-6 sticky top-0 bg-bg pb-4 border-b border-white/10",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("span",{className:"text-4xl",children:d?.icon}),p.jsxs("div",{children:[p.jsx("h2",{className:"text-2xl font-bold",children:d?.name}),p.jsxs("p",{className:"text-sm text-fg/50",children:[h.length," ",h.length===1?"signal":"signals"]})]})]}),p.jsx("button",{onClick:e,className:"p-2 hover:bg-white/10 rounded transition-colors","aria-label":"Close drawer",children:p.jsx(Sr,{size:24})})]}),p.jsx("div",{className:"space-y-4",children:h.length===0?p.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:p.jsx("p",{className:"italic",children:"No signals in this category yet."})}):h.map(w=>p.jsx(NC,{signal:w,onOpen:m,onCopy:y,onArchive:v},w.id))})]})})]})})}function PC({onOpenUrl:t,onCopyText:e}){const[n,i]=R.useState([]),[o,l]=R.useState(!0),[u,d]=R.useState(null),[h,m]=R.useState(""),[y,v]=R.useState(null);R.useEffect(()=>{(async()=>{l(!0);let E=me.from("signals").select("*").order("created_at",{ascending:!1}).limit(50);y&&(E=E.ilike("category",y)),h&&(E=E.or(`title.ilike.%${h}%,summary.ilike.%${h}%,url.ilike.%${h}%`));const{data:P,error:N}=await E;N?console.error("Error fetching signals:",N):i(P||[]),l(!1)})();const k=me.channel("signals").on("postgres_changes",{event:"INSERT",schema:"public",table:"signals"},E=>{i(P=>[E.new,...P])}).subscribe();return()=>{k.unsubscribe()}},[h,y]);const w=S=>{t?t(S):window.open(S,"_blank","noopener,noreferrer")},_=S=>{e?e(S):navigator.clipboard.writeText(S)},b=async S=>{await me.from("signals").delete().eq("id",S),i(k=>k.filter(E=>E.id!==S))};return p.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p.jsx("div",{className:"px-4 pt-4",children:p.jsx(kC,{signals:n,limit:10,onSignalClick:S=>{const k=n.find(E=>E.id===S);k&&k.category&&d(k.category.toLowerCase())}})}),p.jsxs("div",{className:"px-4 pt-4 pb-2 space-y-3",children:[p.jsxs("div",{className:"relative",children:[p.jsx(Sc,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-fg/40"}),p.jsx("input",{type:"text",placeholder:"Search signals by title, summary, or URL...",value:h,onChange:S=>m(S.target.value),className:"w-full bg-surface border border-border/20 rounded-xl py-3 pl-10 pr-10 text-sm text-fg placeholder:text-fg/40 focus:border-primary/50 focus:ring-2 focus:ring-primary/20 outline-none transition-all"}),h&&p.jsx("button",{onClick:()=>m(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg/40 hover:text-fg transition-colors",title:"Clear search",children:p.jsx(Sr,{size:16})})]}),p.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[p.jsx(t1,{className:"w-3.5 h-3.5 text-fg/40"}),p.jsx("button",{onClick:()=>v(null),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${y===null?"bg-primary text-white shadow-sm":"bg-surface hover:bg-surface/80 text-fg/60 hover:text-fg border border-border/20"}`,children:"All"}),["AI & ML","Business","Politics","Technology","Finance","Crypto","Science","Other"].map(S=>p.jsx("button",{onClick:()=>v(S),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${y===S?"bg-primary text-white shadow-sm":"bg-surface hover:bg-surface/80 text-fg/60 hover:text-fg border border-border/20"}`,children:S},S))]})]}),p.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-12 custom-scrollbar",children:o?p.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:p.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-400"})}):p.jsx(CC,{signals:n,onCategoryClick:S=>d(S)})}),p.jsx(AC,{isOpen:!!u,onClose:()=>d(null),categoryId:u||"",signals:n,onOpenUrl:w,onCopyText:_,onArchive:b})]})}class RC{audioContext=null;enabled=!0;constructor(){}getAudioContext(){return this.audioContext||(this.audioContext=new(window.AudioContext||window.webkitAudioContext)),this.audioContext}setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}playTone(e,n,i=.3){if(this.enabled)try{const o=this.getAudioContext(),l=o.createOscillator(),u=o.createGain();l.connect(u),u.connect(o.destination),l.frequency.value=e,l.type="sine",u.gain.setValueAtTime(i,o.currentTime),u.gain.exponentialRampToValueAtTime(.01,o.currentTime+n),l.start(o.currentTime),l.stop(o.currentTime+n)}catch(o){console.warn("[Sound] Failed to play tone:",o)}}playSequence(e,n=.3){if(!this.enabled)return;let i=0;e.forEach(o=>{setTimeout(()=>{this.playTone(o.freq,o.duration,n)},i),i+=o.delay})}syncStart(){this.playSequence([{freq:261.63,duration:.15,delay:0},{freq:329.63,duration:.15,delay:100},{freq:392,duration:.2,delay:100}],.2)}signalFound(){this.playSequence([{freq:392,duration:.1,delay:0},{freq:523.25,duration:.15,delay:80}],.25)}syncComplete(){this.playSequence([{freq:261.63,duration:.12,delay:0},{freq:329.63,duration:.12,delay:80},{freq:392,duration:.12,delay:80},{freq:523.25,duration:.2,delay:80}],.2)}error(){this.playSequence([{freq:329.63,duration:.15,delay:0},{freq:261.63,duration:.2,delay:100}],.3)}click(){this.playTone(440,.05,.15)}}const di=new RC;function OC(){const[t,e]=R.useState([]),[n,i]=R.useState([]),[o,l]=R.useState("discovery"),[u,d]=R.useState(!1),[h,m]=R.useState(null),[y,v]=R.useState(!0),[w,_]=R.useState(!ly),[b,S]=R.useState(!0),[k,E]=R.useState(!1),[P,N]=R.useState(null),[U,V]=R.useState(!1),[z,$]=R.useState(!1),[B,Y]=R.useState(!1),[oe,Te]=R.useState(!0),[ve,je]=R.useState(()=>localStorage.getItem("theme")||"dark"),xe=R.useRef(null);R.useMemo(()=>{const J=n.length;let K=0,j=0,D=null;for(const fe of n){K+=fe.score,fe.score>j&&(j=fe.score);const ie=new Date(fe.date);(!D||ie>new Date(D.date))&&(D=fe)}const re=J?Math.round(K/J):0,ue=D?new Date(D.date):null;return{total:J,average:re,top:j,latestTimestamp:ue,latestTitle:D?.title??D?.category??null}},[n]),R.useEffect(()=>{(async()=>{if(!ly){_(!0),v(!1);return}try{const{data:j,error:D}=await me.from("init_state").select("is_initialized").single();D?(console.warn("[App] Init check error (might be fresh DB):",D),D.code==="42P01"&&S(!1)):S(j.is_initialized>0);const{data:{session:re}}=await me.auth.getSession();m(re?.user??null)}catch(j){console.error("[App] Status check failed:",j)}finally{v(!1)}})();const{data:{subscription:K}}=me.auth.onAuthStateChange((j,D)=>{m(D?.user??null)});return()=>K.unsubscribe()},[]),R.useEffect(()=>{document.documentElement.setAttribute("data-theme",ve),localStorage.setItem("theme",ve)},[ve]);const[Oe,be]=R.useState({});R.useEffect(()=>{const J=async()=>{if(!h)return;const{data:j}=await me.from("alchemy_settings").select("sync_start_date, last_sync_checkpoint").eq("user_id",h.id).maybeSingle();j&&be(j)};J();const K=setInterval(J,2e3);return()=>clearInterval(K)},[h,U]),R.useEffect(()=>{if(!h)return;(async()=>{const{data:j}=await me.from("alchemy_settings").select("sound_enabled").eq("user_id",h.id).maybeSingle();if(j){const D=j.sound_enabled??!0;Te(D),di.setEnabled(D)}})();const K=me.channel("processing_events").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events",filter:`user_id=eq.${h.id}`},j=>{const D=j.new;D.agent_state==="Mining"&&!z&&($(!0),Y(!0),oe&&di.syncStart()),D.agent_state==="Signal"&&oe&&di.signalFound(),D.agent_state==="Completed"&&($(!1),oe&&(D.metadata?.errors>0?di.error():di.syncComplete()),setTimeout(()=>{Y(!1)},5e3),pe())}).subscribe();return()=>{me.removeChannel(K)}},[h,z,oe]),R.useEffect(()=>{const J=new EventSource("/events");return J.onmessage=K=>{const j=JSON.parse(K.data);j.type==="history"?e(D=>[...j.data,...D].slice(0,100)):e(D=>[j,...D].slice(0,100))},pe(),()=>J.close()},[h]),R.useEffect(()=>{xe.current&&xe.current.scrollIntoView({behavior:"smooth"})},[t]);const pe=async()=>{try{if(h){const{data:K,error:j}=await me.from("signals").select("*").order("created_at",{ascending:!1});if(!j&&K){i(K.map(D=>({id:D.id,title:D.title,score:D.score,summary:D.summary,date:D.created_at,category:D.category,entities:D.entities})));return}}const J=await Re.get("/api/signals");i(J.data)}catch(J){console.error("Failed to fetch signals",J)}},F=async()=>{d(!0);try{await Re.post("/api/mine"),pe()}catch(J){console.error("Mining failed:",J)}finally{d(!1)}};return y?p.jsx("div",{className:"flex items-center justify-center h-screen bg-bg",children:p.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):w?p.jsx(A0,{onComplete:()=>_(!1)}):h?p.jsx(aC,{children:p.jsx(dC,{children:p.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-bg text-fg",children:[p.jsxs(Ne.aside,{animate:{width:k?72:240},className:"glass m-4 mr-0 flex flex-col relative",children:[p.jsxs("div",{className:`px-4 py-3 pb-4 flex items-center gap-3 ${k?"justify-center":""}`,children:[p.jsx("div",{className:"w-10 h-10 min-w-[40px] bg-gradient-to-br from-primary to-accent rounded-xl flex items-center justify-center shadow-lg glow-primary",children:p.jsx(kr,{className:"text-white fill-current",size:24})}),!k&&p.jsx(Ne.h1,{initial:{opacity:0},animate:{opacity:1},className:"text-xl font-bold tracking-tight",children:"Alchemist"})]}),p.jsxs("nav",{className:"flex-1 flex flex-col gap-1 px-3",children:[p.jsx(pa,{active:o==="discovery",onClick:()=>l("discovery"),icon:p.jsx(o1,{size:20}),label:"Discovery",collapsed:k}),p.jsx(pa,{active:o==="engine",onClick:()=>l("engine"),icon:p.jsx(dy,{size:20}),label:"Engine",collapsed:k}),p.jsx(pa,{active:o==="logs",onClick:()=>l("logs"),icon:p.jsx(kc,{size:20}),label:"System Logs",collapsed:k}),p.jsx(pa,{active:o==="account",onClick:()=>l("account"),icon:p.jsx(id,{size:20}),label:"Account",collapsed:k})]}),p.jsx("div",{className:"px-3 pb-2",children:p.jsxs("button",{onClick:()=>je(ve==="dark"?"light":"dark"),className:`w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-fg/40 hover:text-fg hover:bg-surface/50 transition-all text-xs font-medium ${k?"justify-center":""}`,title:k?ve==="dark"?"Switch to Light Mode":"Switch to Dark Mode":"",children:[p.jsx("div",{className:"min-w-[18px] flex justify-center",children:ve==="dark"?p.jsx(m1,{size:18}):p.jsx(c1,{size:18})}),!k&&p.jsx(Ne.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"whitespace-nowrap",children:ve==="dark"?"Light Mode":"Dark Mode"})]})}),p.jsx("div",{className:"px-3 pb-3",children:p.jsx("button",{onClick:()=>E(!k),className:`w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-fg/40 hover:text-fg hover:bg-surface/50 transition-all text-xs font-medium ${k?"justify-center":""}`,children:k?p.jsx("span",{className:"text-lg",children:"»"}):p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-lg",children:"«"}),p.jsx("span",{children:"Collapse"})]})})})]}),p.jsxs("main",{className:"flex-1 flex flex-col p-4 gap-4 overflow-hidden relative",children:[o==="discovery"&&p.jsxs(p.Fragment,{children:[p.jsxs("header",{className:"flex justify-between items-center px-4 py-2",children:[p.jsxs("div",{children:[p.jsx("h2",{className:"text-2xl font-bold",children:"Discovery"}),p.jsx("p",{className:"text-sm text-fg/50",children:"Passive intelligence mining from your browser history."})]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsxs("button",{onClick:()=>V(!0),className:"px-4 py-2 glass hover:bg-surface transition-colors flex items-center gap-2 text-sm font-medium",children:[p.jsx(f1,{size:16}),p.jsxs("div",{className:"flex flex-col items-start",children:[p.jsx("span",{children:"Sync Settings"}),(Oe.sync_start_date||Oe.last_sync_checkpoint)&&p.jsx("span",{className:"text-[10px] text-fg/40 font-mono",children:Oe.sync_start_date?`From: ${new Date(Oe.sync_start_date).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:Oe.last_sync_checkpoint?`Checkpoint: ${new Date(Oe.last_sync_checkpoint).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:""})]})]}),p.jsxs("button",{onClick:F,disabled:z,className:"px-4 py-2 glass hover:bg-surface transition-colors flex items-center gap-2 text-sm font-medium disabled:opacity-50 disabled:cursor-not-allowed",children:[p.jsx(sd,{size:16,className:z?"animate-spin":""}),z?"Syncing...":"Sync History"]})]})]}),p.jsx(PC,{onOpenUrl:J=>window.open(J,"_blank","noopener,noreferrer"),onCopyText:J=>{navigator.clipboard.writeText(J)}})]}),o==="engine"&&p.jsx(cC,{}),o==="account"&&p.jsx(yC,{}),o==="logs"&&p.jsx(SC,{}),p.jsx(fC,{isExpanded:B,onToggle:()=>Y(!B)})]}),p.jsx(bC,{signal:P,onClose:()=>N(null)}),p.jsx(_C,{isOpen:U,onClose:()=>V(!1)})]})})}):p.jsx(sC,{onAuthSuccess:()=>pe(),isInitialized:b})}function pa({active:t,icon:e,label:n,onClick:i,collapsed:o}){return p.jsx("button",{onClick:i,title:o?n:"",className:`w-full flex items-center ${o?"justify-center":"gap-3"} px-4 py-3 rounded-xl transition-all ${t?"bg-primary/10 text-primary shadow-sm":"text-fg/60 hover:bg-surface hover:text-fg"}`,children:o?_i.cloneElement(e,{className:t?"text-primary":""}):p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"min-w-[20px] flex justify-center",children:_i.cloneElement(e,{className:t?"text-primary":""})}),p.jsx(Ne.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"font-semibold text-sm whitespace-nowrap",children:n})]})})}function IC(){Re.interceptors.request.use(async t=>{try{const{data:{session:e}}=await me.auth.getSession();e?.access_token&&(t.headers.Authorization=`Bearer ${e.access_token}`);const n=Jd();n&&(t.headers["x-supabase-url"]=n.url,t.headers["x-supabase-key"]=n.anonKey)}catch(e){console.error("[Axios] Error injecting headers:",e)}return t})}IC();Vx.createRoot(document.getElementById("root")).render(p.jsx(_i.StrictMode,{children:p.jsx(OC,{})}));