389 lines
746 KiB
JavaScript
389 lines
746 KiB
JavaScript
function kT(e,t){for(var r=0;r<t.length;r++){const s=t[r];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in e)){const l=Object.getOwnPropertyDescriptor(s,o);l&&Object.defineProperty(e,o,l.get?l:{enumerable:!0,get:()=>s[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(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"&&s(u)}).observe(document,{childList:!0,subtree:!0});function r(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 s(o){if(o.ep)return;o.ep=!0;const l=r(o);fetch(o.href,l)}})();function Zw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $h={exports:{}},Fo={};/**
|
||
* @license React
|
||
* react-jsx-runtime.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var Zb;function jT(){if(Zb)return Fo;Zb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,o,l){var u=null;if(l!==void 0&&(u=""+l),o.key!==void 0&&(u=""+o.key),"key"in o){l={};for(var d in o)d!=="key"&&(l[d]=o[d])}else l=o;return o=l.ref,{$$typeof:e,type:s,key:u,ref:o!==void 0?o:null,props:l}}return Fo.Fragment=t,Fo.jsx=r,Fo.jsxs=r,Fo}var e0;function OT(){return e0||(e0=1,$h.exports=jT()),$h.exports}var v=OT(),Bh={exports:{}},Oe={};/**
|
||
* @license React
|
||
* react.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var t0;function MT(){if(t0)return Oe;t0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),w=Symbol.iterator;function _(k){return k===null||typeof k!="object"?null:(k=w&&k[w]||k["@@iterator"],typeof k=="function"?k:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,T={};function C(k,j,$){this.props=k,this.context=j,this.refs=T,this.updater=$||E}C.prototype.isReactComponent={},C.prototype.setState=function(k,j){if(typeof k!="object"&&typeof k!="function"&&k!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,k,j,"setState")},C.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function A(){}A.prototype=C.prototype;function N(k,j,$){this.props=k,this.context=j,this.refs=T,this.updater=$||E}var z=N.prototype=new A;z.constructor=N,S(z,C.prototype),z.isPureReactComponent=!0;var F=Array.isArray;function B(){}var P={H:null,A:null,T:null,S:null},V=Object.prototype.hasOwnProperty;function re(k,j,$){var D=$.ref;return{$$typeof:e,type:k,key:j,ref:D!==void 0?D:null,props:$}}function le(k,j){return re(k.type,j,k.props)}function ce(k){return typeof k=="object"&&k!==null&&k.$$typeof===e}function de(k){var j={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function($){return j[$]})}var ge=/\/+/g;function me(k,j){return typeof k=="object"&&k!==null&&k.key!=null?de(""+k.key):j.toString(36)}function fe(k){switch(k.status){case"fulfilled":return k.value;case"rejected":throw k.reason;default:switch(typeof k.status=="string"?k.then(B,B):(k.status="pending",k.then(function(j){k.status==="pending"&&(k.status="fulfilled",k.value=j)},function(j){k.status==="pending"&&(k.status="rejected",k.reason=j)})),k.status){case"fulfilled":return k.value;case"rejected":throw k.reason}}throw k}function M(k,j,$,D,U){var X=typeof k;(X==="undefined"||X==="boolean")&&(k=null);var J=!1;if(k===null)J=!0;else switch(X){case"bigint":case"string":case"number":J=!0;break;case"object":switch(k.$$typeof){case e:case t:J=!0;break;case b:return J=k._init,M(J(k._payload),j,$,D,U)}}if(J)return U=U(k),J=D===""?"."+me(k,0):D,F(U)?($="",J!=null&&($=J.replace(ge,"$&/")+"/"),M(U,j,$,"",function(ue){return ue})):U!=null&&(ce(U)&&(U=le(U,$+(U.key==null||k&&k.key===U.key?"":(""+U.key).replace(ge,"$&/")+"/")+J)),j.push(U)),1;J=0;var se=D===""?".":D+":";if(F(k))for(var ie=0;ie<k.length;ie++)D=k[ie],X=se+me(D,ie),J+=M(D,j,$,X,U);else if(ie=_(k),typeof ie=="function")for(k=ie.call(k),ie=0;!(D=k.next()).done;)D=D.value,X=se+me(D,ie++),J+=M(D,j,$,X,U);else if(X==="object"){if(typeof k.then=="function")return M(fe(k),j,$,D,U);throw j=String(k),Error("Objects are not valid as a React child (found: "+(j==="[object Object]"?"object with keys {"+Object.keys(k).join(", ")+"}":j)+"). If you meant to render a collection of children, use an array instead.")}return J}function K(k,j,$){if(k==null)return k;var D=[],U=0;return M(k,D,"","",function(X){return j.call($,X,U++)}),D}function Q(k){if(k._status===-1){var j=k._result;j=j(),j.then(function($){(k._status===0||k._status===-1)&&(k._status=1,k._result=$)},function($){(k._status===0||k._status===-1)&&(k._status=2,k._result=$)}),k._status===-1&&(k._status=0,k._result=j)}if(k._status===1)return k._result.default;throw k._result}var te=typeof reportError=="function"?reportError:function(k){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var j=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof k=="object"&&k!==null&&typeof k.message=="string"?String(k.message):String(k),error:k});if(!window.dispatchEvent(j))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",k);return}console.error(k)},W={map:K,forEach:function(k,j,$){K(k,function(){j.apply(this,arguments)},$)},count:function(k){var j=0;return K(k,function(){j++}),j},toArray:function(k){return K(k,function(j){return j})||[]},only:function(k){if(!ce(k))throw Error("React.Children.only expected to receive a single React element child.");return k}};return Oe.Activity=g,Oe.Children=W,Oe.Component=C,Oe.Fragment=r,Oe.Profiler=o,Oe.PureComponent=N,Oe.StrictMode=s,Oe.Suspense=h,Oe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P,Oe.__COMPILER_RUNTIME={__proto__:null,c:function(k){return P.H.useMemoCache(k)}},Oe.cache=function(k){return function(){return k.apply(null,arguments)}},Oe.cacheSignal=function(){return null},Oe.cloneElement=function(k,j,$){if(k==null)throw Error("The argument must be a React element, but you passed "+k+".");var D=S({},k.props),U=k.key;if(j!=null)for(X in j.key!==void 0&&(U=""+j.key),j)!V.call(j,X)||X==="key"||X==="__self"||X==="__source"||X==="ref"&&j.ref===void 0||(D[X]=j[X]);var X=arguments.length-2;if(X===1)D.children=$;else if(1<X){for(var J=Array(X),se=0;se<X;se++)J[se]=arguments[se+2];D.children=J}return re(k.type,U,D)},Oe.createContext=function(k){return k={$$typeof:u,_currentValue:k,_currentValue2:k,_threadCount:0,Provider:null,Consumer:null},k.Provider=k,k.Consumer={$$typeof:l,_context:k},k},Oe.createElement=function(k,j,$){var D,U={},X=null;if(j!=null)for(D in j.key!==void 0&&(X=""+j.key),j)V.call(j,D)&&D!=="key"&&D!=="__self"&&D!=="__source"&&(U[D]=j[D]);var J=arguments.length-2;if(J===1)U.children=$;else if(1<J){for(var se=Array(J),ie=0;ie<J;ie++)se[ie]=arguments[ie+2];U.children=se}if(k&&k.defaultProps)for(D in J=k.defaultProps,J)U[D]===void 0&&(U[D]=J[D]);return re(k,X,U)},Oe.createRef=function(){return{current:null}},Oe.forwardRef=function(k){return{$$typeof:d,render:k}},Oe.isValidElement=ce,Oe.lazy=function(k){return{$$typeof:b,_payload:{_status:-1,_result:k},_init:Q}},Oe.memo=function(k,j){return{$$typeof:m,type:k,compare:j===void 0?null:j}},Oe.startTransition=function(k){var j=P.T,$={};P.T=$;try{var D=k(),U=P.S;U!==null&&U($,D),typeof D=="object"&&D!==null&&typeof D.then=="function"&&D.then(B,te)}catch(X){te(X)}finally{j!==null&&$.types!==null&&(j.types=$.types),P.T=j}},Oe.unstable_useCacheRefresh=function(){return P.H.useCacheRefresh()},Oe.use=function(k){return P.H.use(k)},Oe.useActionState=function(k,j,$){return P.H.useActionState(k,j,$)},Oe.useCallback=function(k,j){return P.H.useCallback(k,j)},Oe.useContext=function(k){return P.H.useContext(k)},Oe.useDebugValue=function(){},Oe.useDeferredValue=function(k,j){return P.H.useDeferredValue(k,j)},Oe.useEffect=function(k,j){return P.H.useEffect(k,j)},Oe.useEffectEvent=function(k){return P.H.useEffectEvent(k)},Oe.useId=function(){return P.H.useId()},Oe.useImperativeHandle=function(k,j,$){return P.H.useImperativeHandle(k,j,$)},Oe.useInsertionEffect=function(k,j){return P.H.useInsertionEffect(k,j)},Oe.useLayoutEffect=function(k,j){return P.H.useLayoutEffect(k,j)},Oe.useMemo=function(k,j){return P.H.useMemo(k,j)},Oe.useOptimistic=function(k,j){return P.H.useOptimistic(k,j)},Oe.useReducer=function(k,j,$){return P.H.useReducer(k,j,$)},Oe.useRef=function(k){return P.H.useRef(k)},Oe.useState=function(k){return P.H.useState(k)},Oe.useSyncExternalStore=function(k,j,$){return P.H.useSyncExternalStore(k,j,$)},Oe.useTransition=function(){return P.H.useTransition()},Oe.version="19.2.6",Oe}var n0;function nd(){return n0||(n0=1,Bh.exports=MT()),Bh.exports}var y=nd();const oe=Zw(y),rp=kT({__proto__:null,default:oe},[y]);var Hh={exports:{}},Ko={},qh={exports:{}},Vh={};/**
|
||
* @license React
|
||
* scheduler.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var r0;function DT(){return r0||(r0=1,(function(e){function t(M,K){var Q=M.length;M.push(K);e:for(;0<Q;){var te=Q-1>>>1,W=M[te];if(0<o(W,K))M[te]=K,M[Q]=W,Q=te;else break e}}function r(M){return M.length===0?null:M[0]}function s(M){if(M.length===0)return null;var K=M[0],Q=M.pop();if(Q!==K){M[0]=Q;e:for(var te=0,W=M.length,k=W>>>1;te<k;){var j=2*(te+1)-1,$=M[j],D=j+1,U=M[D];if(0>o($,Q))D<W&&0>o(U,$)?(M[te]=U,M[D]=Q,te=D):(M[te]=$,M[j]=Q,te=j);else if(D<W&&0>o(U,Q))M[te]=U,M[D]=Q,te=D;else break e}}return K}function o(M,K){var Q=M.sortIndex-K.sortIndex;return Q!==0?Q:M.id-K.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var h=[],m=[],b=1,g=null,w=3,_=!1,E=!1,S=!1,T=!1,C=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function z(M){for(var K=r(m);K!==null;){if(K.callback===null)s(m);else if(K.startTime<=M)s(m),K.sortIndex=K.expirationTime,t(h,K);else break;K=r(m)}}function F(M){if(S=!1,z(M),!E)if(r(h)!==null)E=!0,B||(B=!0,de());else{var K=r(m);K!==null&&fe(F,K.startTime-M)}}var B=!1,P=-1,V=5,re=-1;function le(){return T?!0:!(e.unstable_now()-re<V)}function ce(){if(T=!1,B){var M=e.unstable_now();re=M;var K=!0;try{e:{E=!1,S&&(S=!1,A(P),P=-1),_=!0;var Q=w;try{t:{for(z(M),g=r(h);g!==null&&!(g.expirationTime>M&&le());){var te=g.callback;if(typeof te=="function"){g.callback=null,w=g.priorityLevel;var W=te(g.expirationTime<=M);if(M=e.unstable_now(),typeof W=="function"){g.callback=W,z(M),K=!0;break t}g===r(h)&&s(h),z(M)}else s(h);g=r(h)}if(g!==null)K=!0;else{var k=r(m);k!==null&&fe(F,k.startTime-M),K=!1}}break e}finally{g=null,w=Q,_=!1}K=void 0}}finally{K?de():B=!1}}}var de;if(typeof N=="function")de=function(){N(ce)};else if(typeof MessageChannel<"u"){var ge=new MessageChannel,me=ge.port2;ge.port1.onmessage=ce,de=function(){me.postMessage(null)}}else de=function(){C(ce,0)};function fe(M,K){P=C(function(){M(e.unstable_now())},K)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(M){M.callback=null},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return w},e.unstable_next=function(M){switch(w){case 1:case 2:case 3:var K=3;break;default:K=w}var Q=w;w=K;try{return M()}finally{w=Q}},e.unstable_requestPaint=function(){T=!0},e.unstable_runWithPriority=function(M,K){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var Q=w;w=M;try{return K()}finally{w=Q}},e.unstable_scheduleCallback=function(M,K,Q){var te=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?te+Q:te):Q=te,M){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=Q+W,M={id:b++,callback:K,priorityLevel:M,startTime:Q,expirationTime:W,sortIndex:-1},Q>te?(M.sortIndex=Q,t(m,M),r(h)===null&&M===r(m)&&(S?(A(P),P=-1):S=!0,fe(F,Q-te))):(M.sortIndex=W,t(h,M),E||_||(E=!0,B||(B=!0,de()))),M},e.unstable_shouldYield=le,e.unstable_wrapCallback=function(M){var K=w;return function(){var Q=w;w=K;try{return M.apply(this,arguments)}finally{w=Q}}}})(Vh)),Vh}var a0;function LT(){return a0||(a0=1,qh.exports=DT()),qh.exports}var Gh={exports:{}},Yt={};/**
|
||
* @license React
|
||
* react-dom.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var s0;function PT(){if(s0)return Yt;s0=1;var e=nd();function t(h){var m="https://react.dev/errors/"+h;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)m+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+h+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var s={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},o=Symbol.for("react.portal");function l(h,m,b){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:h,containerInfo:m,implementation:b}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(h,m){if(h==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Yt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Yt.createPortal=function(h,m){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(t(299));return l(h,m,null,b)},Yt.flushSync=function(h){var m=u.T,b=s.p;try{if(u.T=null,s.p=2,h)return h()}finally{u.T=m,s.p=b,s.d.f()}},Yt.preconnect=function(h,m){typeof h=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,s.d.C(h,m))},Yt.prefetchDNS=function(h){typeof h=="string"&&s.d.D(h)},Yt.preinit=function(h,m){if(typeof h=="string"&&m&&typeof m.as=="string"){var b=m.as,g=d(b,m.crossOrigin),w=typeof m.integrity=="string"?m.integrity:void 0,_=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;b==="style"?s.d.S(h,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:w,fetchPriority:_}):b==="script"&&s.d.X(h,{crossOrigin:g,integrity:w,fetchPriority:_,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Yt.preinitModule=function(h,m){if(typeof h=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var b=d(m.as,m.crossOrigin);s.d.M(h,{crossOrigin:b,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&s.d.M(h)},Yt.preload=function(h,m){if(typeof h=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var b=m.as,g=d(b,m.crossOrigin);s.d.L(h,b,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Yt.preloadModule=function(h,m){if(typeof h=="string")if(m){var b=d(m.as,m.crossOrigin);s.d.m(h,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:b,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else s.d.m(h)},Yt.requestFormReset=function(h){s.d.r(h)},Yt.unstable_batchedUpdates=function(h,m){return h(m)},Yt.useFormState=function(h,m,b){return u.H.useFormState(h,m,b)},Yt.useFormStatus=function(){return u.H.useHostTransitionStatus()},Yt.version="19.2.6",Yt}var i0;function ex(){if(i0)return Gh.exports;i0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Gh.exports=PT(),Gh.exports}/**
|
||
* @license React
|
||
* react-dom-client.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var o0;function zT(){if(o0)return Ko;o0=1;var e=LT(),t=nd(),r=ex();function s(n){var a="https://react.dev/errors/"+n;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)a+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+n+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function l(n){var a=n,i=n;if(n.alternate)for(;a.return;)a=a.return;else{n=a;do a=n,(a.flags&4098)!==0&&(i=a.return),n=a.return;while(n)}return a.tag===3?i:null}function u(n){if(n.tag===13){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function d(n){if(n.tag===31){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function h(n){if(l(n)!==n)throw Error(s(188))}function m(n){var a=n.alternate;if(!a){if(a=l(n),a===null)throw Error(s(188));return a!==n?null:n}for(var i=n,c=a;;){var f=i.return;if(f===null)break;var p=f.alternate;if(p===null){if(c=f.return,c!==null){i=c;continue}break}if(f.child===p.child){for(p=f.child;p;){if(p===i)return h(f),n;if(p===c)return h(f),a;p=p.sibling}throw Error(s(188))}if(i.return!==c.return)i=f,c=p;else{for(var x=!1,R=f.child;R;){if(R===i){x=!0,i=f,c=p;break}if(R===c){x=!0,c=f,i=p;break}R=R.sibling}if(!x){for(R=p.child;R;){if(R===i){x=!0,i=p,c=f;break}if(R===c){x=!0,c=p,i=f;break}R=R.sibling}if(!x)throw Error(s(189))}}if(i.alternate!==c)throw Error(s(190))}if(i.tag!==3)throw Error(s(188));return i.stateNode.current===i?n:a}function b(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n;for(n=n.child;n!==null;){if(a=b(n),a!==null)return a;n=n.sibling}return null}var g=Object.assign,w=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),N=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),re=Symbol.for("react.activity"),le=Symbol.for("react.memo_cache_sentinel"),ce=Symbol.iterator;function de(n){return n===null||typeof n!="object"?null:(n=ce&&n[ce]||n["@@iterator"],typeof n=="function"?n:null)}var ge=Symbol.for("react.client.reference");function me(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===ge?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case S:return"Fragment";case C:return"Profiler";case T:return"StrictMode";case F:return"Suspense";case B:return"SuspenseList";case re:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case E:return"Portal";case N:return n.displayName||"Context";case A:return(n._context.displayName||"Context")+".Consumer";case z:var a=n.render;return n=n.displayName,n||(n=a.displayName||a.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case P:return a=n.displayName||null,a!==null?a:me(n.type)||"Memo";case V:a=n._payload,n=n._init;try{return me(n(a))}catch{}}return null}var fe=Array.isArray,M=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},te=[],W=-1;function k(n){return{current:n}}function j(n){0>W||(n.current=te[W],te[W]=null,W--)}function $(n,a){W++,te[W]=n.current,n.current=a}var D=k(null),U=k(null),X=k(null),J=k(null);function se(n,a){switch($(X,a),$(U,n),$(D,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?_b(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=_b(a),n=Sb(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}j(D),$(D,n)}function ie(){j(D),j(U),j(X)}function ue(n){n.memoizedState!==null&&$(J,n);var a=D.current,i=Sb(a,n.type);a!==i&&($(U,n),$(D,i))}function Ee(n){U.current===n&&(j(D),j(U)),J.current===n&&(j(J),Ho._currentValue=Q)}var Se,et;function He(n){if(Se===void 0)try{throw Error()}catch(i){var a=i.stack.trim().match(/\n( *(at )?)/);Se=a&&a[1]||"",et=-1<i.stack.indexOf(`
|
||
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||
`+Se+n+et}var vn=!1;function Zt(n,a){if(!n||vn)return"";vn=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(a){var ne=function(){throw Error()};if(Object.defineProperty(ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ne,[])}catch(Y){var G=Y}Reflect.construct(n,[],ne)}else{try{ne.call()}catch(Y){G=Y}n.call(ne.prototype)}}else{try{throw Error()}catch(Y){G=Y}(ne=n())&&typeof ne.catch=="function"&&ne.catch(function(){})}}catch(Y){if(Y&&G&&typeof Y.stack=="string")return[Y.stack,G.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=c.DetermineComponentFrameRoot(),x=p[0],R=p[1];if(x&&R){var O=x.split(`
|
||
`),q=R.split(`
|
||
`);for(f=c=0;c<O.length&&!O[c].includes("DetermineComponentFrameRoot");)c++;for(;f<q.length&&!q[f].includes("DetermineComponentFrameRoot");)f++;if(c===O.length||f===q.length)for(c=O.length-1,f=q.length-1;1<=c&&0<=f&&O[c]!==q[f];)f--;for(;1<=c&&0<=f;c--,f--)if(O[c]!==q[f]){if(c!==1||f!==1)do if(c--,f--,0>f||O[c]!==q[f]){var Z=`
|
||
`+O[c].replace(" at new "," at ");return n.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",n.displayName)),Z}while(1<=c&&0<=f);break}}}finally{vn=!1,Error.prepareStackTrace=i}return(i=n?n.displayName||n.name:"")?He(i):""}function Gt(n,a){switch(n.tag){case 26:case 27:case 5:return He(n.type);case 16:return He("Lazy");case 13:return n.child!==a&&a!==null?He("Suspense Fallback"):He("Suspense");case 19:return He("SuspenseList");case 0:case 15:return Zt(n.type,!1);case 11:return Zt(n.type.render,!1);case 1:return Zt(n.type,!0);case 31:return He("Activity");default:return""}}function Tr(n){try{var a="",i=null;do a+=Gt(n,i),i=n,n=n.return;while(n);return a}catch(c){return`
|
||
Error generating stack: `+c.message+`
|
||
`+c.stack}}var wt=Object.prototype.hasOwnProperty,ca=e.unstable_scheduleCallback,or=e.unstable_cancelCallback,Lt=e.unstable_shouldYield,Rt=e.unstable_requestPaint,vt=e.unstable_now,eo=e.unstable_getCurrentPriorityLevel,Ar=e.unstable_ImmediatePriority,lr=e.unstable_UserBlockingPriority,cr=e.unstable_NormalPriority,Nr=e.unstable_LowPriority,Vn=e.unstable_IdlePriority,Ja=e.log,Gn=e.unstable_setDisableYieldValue,ur=null,Pt=null;function yn(n){if(typeof Ja=="function"&&Gn(n),Pt&&typeof Pt.setStrictMode=="function")try{Pt.setStrictMode(ur,n)}catch{}}var kt=Math.clz32?Math.clz32:Re,to=Math.log,ae=Math.LN2;function Re(n){return n>>>=0,n===0?32:31-(to(n)/ae|0)|0}var Be=256,Fe=262144,Ft=4194304;function en(n){var a=n&42;if(a!==0)return a;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function ke(n,a,i){var c=n.pendingLanes;if(c===0)return 0;var f=0,p=n.suspendedLanes,x=n.pingedLanes;n=n.warmLanes;var R=c&134217727;return R!==0?(c=R&~p,c!==0?f=en(c):(x&=R,x!==0?f=en(x):i||(i=R&~n,i!==0&&(f=en(i))))):(R=c&~p,R!==0?f=en(R):x!==0?f=en(x):i||(i=c&~n,i!==0&&(f=en(i)))),f===0?0:a!==0&&a!==f&&(a&p)===0&&(p=f&-f,i=a&-a,p>=i||p===32&&(i&4194048)!==0)?a:f}function ot(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function jt(n,a){switch(n){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Kt(){var n=Ft;return Ft<<=1,(Ft&62914560)===0&&(Ft=4194304),n}function ua(n){for(var a=[],i=0;31>i;i++)a.push(n);return a}function ut(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function tn(n,a,i,c,f,p){var x=n.pendingLanes;n.pendingLanes=i,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=i,n.entangledLanes&=i,n.errorRecoveryDisabledLanes&=i,n.shellSuspendCounter=0;var R=n.entanglements,O=n.expirationTimes,q=n.hiddenUpdates;for(i=x&~i;0<i;){var Z=31-kt(i),ne=1<<Z;R[Z]=0,O[Z]=-1;var G=q[Z];if(G!==null)for(q[Z]=null,Z=0;Z<G.length;Z++){var Y=G[Z];Y!==null&&(Y.lane&=-536870913)}i&=~ne}c!==0&&Qa(n,c,0),p!==0&&f===0&&n.tag!==0&&(n.suspendedLanes|=p&~(x&~a))}function Qa(n,a,i){n.pendingLanes|=a,n.suspendedLanes&=~a;var c=31-kt(a);n.entangledLanes|=a,n.entanglements[c]=n.entanglements[c]|1073741824|i&261930}function nn(n,a){var i=n.entangledLanes|=a;for(n=n.entanglements;i;){var c=31-kt(i),f=1<<c;f&a|n[c]&a&&(n[c]|=a),i&=~f}}function rn(n,a){var i=a&-a;return i=(i&42)!==0?1:Ps(i),(i&(n.suspendedLanes|a))!==0?0:i}function Ps(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Fn(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Nd(){var n=K.p;return n!==0?n:(n=window.event,n===void 0?32:Fb(n.type))}function lg(n,a){var i=K.p;try{return K.p=n,a()}finally{K.p=i}}var da=Math.random().toString(36).slice(2),zt="__reactFiber$"+da,an="__reactProps$"+da,zs="__reactContainer$"+da,kd="__reactEvents$"+da,bC="__reactListeners$"+da,wC="__reactHandles$"+da,cg="__reactResources$"+da,no="__reactMarker$"+da;function jd(n){delete n[zt],delete n[an],delete n[kd],delete n[bC],delete n[wC]}function Us(n){var a=n[zt];if(a)return a;for(var i=n.parentNode;i;){if(a=i[zs]||i[zt]){if(i=a.alternate,a.child!==null||i!==null&&i.child!==null)for(n=kb(n);n!==null;){if(i=n[zt])return i;n=kb(n)}return a}n=i,i=n.parentNode}return null}function Is(n){if(n=n[zt]||n[zs]){var a=n.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return n}return null}function ro(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n.stateNode;throw Error(s(33))}function $s(n){var a=n[cg];return a||(a=n[cg]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Ot(n){n[no]=!0}var ug=new Set,dg={};function Za(n,a){Bs(n,a),Bs(n+"Capture",a)}function Bs(n,a){for(dg[n]=a,n=0;n<a.length;n++)ug.add(a[n])}var xC=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),fg={},hg={};function _C(n){return wt.call(hg,n)?!0:wt.call(fg,n)?!1:xC.test(n)?hg[n]=!0:(fg[n]=!0,!1)}function $l(n,a,i){if(_C(a))if(i===null)n.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":n.removeAttribute(a);return;case"boolean":var c=a.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){n.removeAttribute(a);return}}n.setAttribute(a,""+i)}}function Bl(n,a,i){if(i===null)n.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttribute(a,""+i)}}function kr(n,a,i,c){if(c===null)n.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(i);return}n.setAttributeNS(a,i,""+c)}}function kn(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function mg(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function SC(n,a,i){var c=Object.getOwnPropertyDescriptor(n.constructor.prototype,a);if(!n.hasOwnProperty(a)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var f=c.get,p=c.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return f.call(this)},set:function(x){i=""+x,p.call(this,x)}}),Object.defineProperty(n,a,{enumerable:c.enumerable}),{getValue:function(){return i},setValue:function(x){i=""+x},stopTracking:function(){n._valueTracker=null,delete n[a]}}}}function Od(n){if(!n._valueTracker){var a=mg(n)?"checked":"value";n._valueTracker=SC(n,a,""+n[a])}}function pg(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var i=a.getValue(),c="";return n&&(c=mg(n)?n.checked?"true":"false":n.value),n=c,n!==i?(a.setValue(n),!0):!1}function Hl(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var EC=/[\n"\\]/g;function jn(n){return n.replace(EC,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Md(n,a,i,c,f,p,x,R){n.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?n.type=x:n.removeAttribute("type"),a!=null?x==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+kn(a)):n.value!==""+kn(a)&&(n.value=""+kn(a)):x!=="submit"&&x!=="reset"||n.removeAttribute("value"),a!=null?Dd(n,x,kn(a)):i!=null?Dd(n,x,kn(i)):c!=null&&n.removeAttribute("value"),f==null&&p!=null&&(n.defaultChecked=!!p),f!=null&&(n.checked=f&&typeof f!="function"&&typeof f!="symbol"),R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?n.name=""+kn(R):n.removeAttribute("name")}function gg(n,a,i,c,f,p,x,R){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(n.type=p),a!=null||i!=null){if(!(p!=="submit"&&p!=="reset"||a!=null)){Od(n);return}i=i!=null?""+kn(i):"",a=a!=null?""+kn(a):i,R||a===n.value||(n.value=a),n.defaultValue=a}c=c??f,c=typeof c!="function"&&typeof c!="symbol"&&!!c,n.checked=R?n.checked:!!c,n.defaultChecked=!!c,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(n.name=x),Od(n)}function Dd(n,a,i){a==="number"&&Hl(n.ownerDocument)===n||n.defaultValue===""+i||(n.defaultValue=""+i)}function Hs(n,a,i,c){if(n=n.options,a){a={};for(var f=0;f<i.length;f++)a["$"+i[f]]=!0;for(i=0;i<n.length;i++)f=a.hasOwnProperty("$"+n[i].value),n[i].selected!==f&&(n[i].selected=f),f&&c&&(n[i].defaultSelected=!0)}else{for(i=""+kn(i),a=null,f=0;f<n.length;f++){if(n[f].value===i){n[f].selected=!0,c&&(n[f].defaultSelected=!0);return}a!==null||n[f].disabled||(a=n[f])}a!==null&&(a.selected=!0)}}function vg(n,a,i){if(a!=null&&(a=""+kn(a),a!==n.value&&(n.value=a),i==null)){n.defaultValue!==a&&(n.defaultValue=a);return}n.defaultValue=i!=null?""+kn(i):""}function yg(n,a,i,c){if(a==null){if(c!=null){if(i!=null)throw Error(s(92));if(fe(c)){if(1<c.length)throw Error(s(93));c=c[0]}i=c}i==null&&(i=""),a=i}i=kn(a),n.defaultValue=i,c=n.textContent,c===i&&c!==""&&c!==null&&(n.value=c),Od(n)}function qs(n,a){if(a){var i=n.firstChild;if(i&&i===n.lastChild&&i.nodeType===3){i.nodeValue=a;return}}n.textContent=a}var CC=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function bg(n,a,i){var c=a.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?c?n.setProperty(a,""):a==="float"?n.cssFloat="":n[a]="":c?n.setProperty(a,i):typeof i!="number"||i===0||CC.has(a)?a==="float"?n.cssFloat=i:n[a]=(""+i).trim():n[a]=i+"px"}function wg(n,a,i){if(a!=null&&typeof a!="object")throw Error(s(62));if(n=n.style,i!=null){for(var c in i)!i.hasOwnProperty(c)||a!=null&&a.hasOwnProperty(c)||(c.indexOf("--")===0?n.setProperty(c,""):c==="float"?n.cssFloat="":n[c]="");for(var f in a)c=a[f],a.hasOwnProperty(f)&&i[f]!==c&&bg(n,f,c)}else for(var p in a)a.hasOwnProperty(p)&&bg(n,p,a[p])}function Ld(n){if(n.indexOf("-")===-1)return!1;switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var RC=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),TC=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function ql(n){return TC.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function jr(){}var Pd=null;function zd(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Vs=null,Gs=null;function xg(n){var a=Is(n);if(a&&(n=a.stateNode)){var i=n[an]||null;e:switch(n=a.stateNode,a.type){case"input":if(Md(n,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),a=i.name,i.type==="radio"&&a!=null){for(i=n;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+jn(""+a)+'"][type="radio"]'),a=0;a<i.length;a++){var c=i[a];if(c!==n&&c.form===n.form){var f=c[an]||null;if(!f)throw Error(s(90));Md(c,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(a=0;a<i.length;a++)c=i[a],c.form===n.form&&pg(c)}break e;case"textarea":vg(n,i.value,i.defaultValue);break e;case"select":a=i.value,a!=null&&Hs(n,!!i.multiple,a,!1)}}}var Ud=!1;function _g(n,a,i){if(Ud)return n(a,i);Ud=!0;try{var c=n(a);return c}finally{if(Ud=!1,(Vs!==null||Gs!==null)&&(kc(),Vs&&(a=Vs,n=Gs,Gs=Vs=null,xg(a),n)))for(a=0;a<n.length;a++)xg(n[a])}}function ao(n,a){var i=n.stateNode;if(i===null)return null;var c=i[an]||null;if(c===null)return null;i=c[a];e:switch(a){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)||(n=n.type,c=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!c;break e;default:n=!1}if(n)return null;if(i&&typeof i!="function")throw Error(s(231,a,typeof i));return i}var Or=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Id=!1;if(Or)try{var so={};Object.defineProperty(so,"passive",{get:function(){Id=!0}}),window.addEventListener("test",so,so),window.removeEventListener("test",so,so)}catch{Id=!1}var fa=null,$d=null,Vl=null;function Sg(){if(Vl)return Vl;var n,a=$d,i=a.length,c,f="value"in fa?fa.value:fa.textContent,p=f.length;for(n=0;n<i&&a[n]===f[n];n++);var x=i-n;for(c=1;c<=x&&a[i-c]===f[p-c];c++);return Vl=f.slice(n,1<c?1-c:void 0)}function Gl(n){var a=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&a===13&&(n=13)):n=a,n===10&&(n=13),32<=n||n===13?n:0}function Fl(){return!0}function Eg(){return!1}function sn(n){function a(i,c,f,p,x){this._reactName=i,this._targetInst=f,this.type=c,this.nativeEvent=p,this.target=x,this.currentTarget=null;for(var R in n)n.hasOwnProperty(R)&&(i=n[R],this[R]=i?i(p):p[R]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Fl:Eg,this.isPropagationStopped=Eg,this}return g(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Fl)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Fl)},persist:function(){},isPersistent:Fl}),a}var es={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Kl=sn(es),io=g({},es,{view:0,detail:0}),AC=sn(io),Bd,Hd,oo,Yl=g({},io,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Vd,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==oo&&(oo&&n.type==="mousemove"?(Bd=n.screenX-oo.screenX,Hd=n.screenY-oo.screenY):Hd=Bd=0,oo=n),Bd)},movementY:function(n){return"movementY"in n?n.movementY:Hd}}),Cg=sn(Yl),NC=g({},Yl,{dataTransfer:0}),kC=sn(NC),jC=g({},io,{relatedTarget:0}),qd=sn(jC),OC=g({},es,{animationName:0,elapsedTime:0,pseudoElement:0}),MC=sn(OC),DC=g({},es,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),LC=sn(DC),PC=g({},es,{data:0}),Rg=sn(PC),zC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},UC={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"},IC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $C(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=IC[n])?!!a[n]:!1}function Vd(){return $C}var BC=g({},io,{key:function(n){if(n.key){var a=zC[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=Gl(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?UC[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Vd,charCode:function(n){return n.type==="keypress"?Gl(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Gl(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),HC=sn(BC),qC=g({},Yl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Tg=sn(qC),VC=g({},io,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Vd}),GC=sn(VC),FC=g({},es,{propertyName:0,elapsedTime:0,pseudoElement:0}),KC=sn(FC),YC=g({},Yl,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),WC=sn(YC),XC=g({},es,{newState:0,oldState:0}),JC=sn(XC),QC=[9,13,27,32],Gd=Or&&"CompositionEvent"in window,lo=null;Or&&"documentMode"in document&&(lo=document.documentMode);var ZC=Or&&"TextEvent"in window&&!lo,Ag=Or&&(!Gd||lo&&8<lo&&11>=lo),Ng=" ",kg=!1;function jg(n,a){switch(n){case"keyup":return QC.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Og(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Fs=!1;function eR(n,a){switch(n){case"compositionend":return Og(a);case"keypress":return a.which!==32?null:(kg=!0,Ng);case"textInput":return n=a.data,n===Ng&&kg?null:n;default:return null}}function tR(n,a){if(Fs)return n==="compositionend"||!Gd&&jg(n,a)?(n=Sg(),Vl=$d=fa=null,Fs=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Ag&&a.locale!=="ko"?null:a.data;default:return null}}var nR={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 Mg(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!nR[n.type]:a==="textarea"}function Dg(n,a,i,c){Vs?Gs?Gs.push(c):Gs=[c]:Vs=c,a=zc(a,"onChange"),0<a.length&&(i=new Kl("onChange","change",null,i,c),n.push({event:i,listeners:a}))}var co=null,uo=null;function rR(n){gb(n,0)}function Wl(n){var a=ro(n);if(pg(a))return n}function Lg(n,a){if(n==="change")return a}var Pg=!1;if(Or){var Fd;if(Or){var Kd="oninput"in document;if(!Kd){var zg=document.createElement("div");zg.setAttribute("oninput","return;"),Kd=typeof zg.oninput=="function"}Fd=Kd}else Fd=!1;Pg=Fd&&(!document.documentMode||9<document.documentMode)}function Ug(){co&&(co.detachEvent("onpropertychange",Ig),uo=co=null)}function Ig(n){if(n.propertyName==="value"&&Wl(uo)){var a=[];Dg(a,uo,n,zd(n)),_g(rR,a)}}function aR(n,a,i){n==="focusin"?(Ug(),co=a,uo=i,co.attachEvent("onpropertychange",Ig)):n==="focusout"&&Ug()}function sR(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Wl(uo)}function iR(n,a){if(n==="click")return Wl(a)}function oR(n,a){if(n==="input"||n==="change")return Wl(a)}function lR(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var bn=typeof Object.is=="function"?Object.is:lR;function fo(n,a){if(bn(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var i=Object.keys(n),c=Object.keys(a);if(i.length!==c.length)return!1;for(c=0;c<i.length;c++){var f=i[c];if(!wt.call(a,f)||!bn(n[f],a[f]))return!1}return!0}function $g(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Bg(n,a){var i=$g(n);n=0;for(var c;i;){if(i.nodeType===3){if(c=n+i.textContent.length,n<=a&&c>=a)return{node:i,offset:a-n};n=c}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=$g(i)}}function Hg(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?Hg(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function qg(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=Hl(n.document);a instanceof n.HTMLIFrameElement;){try{var i=typeof a.contentWindow.location.href=="string"}catch{i=!1}if(i)n=a.contentWindow;else break;a=Hl(n.document)}return a}function Yd(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a&&(a==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||a==="textarea"||n.contentEditable==="true")}var cR=Or&&"documentMode"in document&&11>=document.documentMode,Ks=null,Wd=null,ho=null,Xd=!1;function Vg(n,a,i){var c=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Xd||Ks==null||Ks!==Hl(c)||(c=Ks,"selectionStart"in c&&Yd(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}),ho&&fo(ho,c)||(ho=c,c=zc(Wd,"onSelect"),0<c.length&&(a=new Kl("onSelect","select",null,a,i),n.push({event:a,listeners:c}),a.target=Ks)))}function ts(n,a){var i={};return i[n.toLowerCase()]=a.toLowerCase(),i["Webkit"+n]="webkit"+a,i["Moz"+n]="moz"+a,i}var Ys={animationend:ts("Animation","AnimationEnd"),animationiteration:ts("Animation","AnimationIteration"),animationstart:ts("Animation","AnimationStart"),transitionrun:ts("Transition","TransitionRun"),transitionstart:ts("Transition","TransitionStart"),transitioncancel:ts("Transition","TransitionCancel"),transitionend:ts("Transition","TransitionEnd")},Jd={},Gg={};Or&&(Gg=document.createElement("div").style,"AnimationEvent"in window||(delete Ys.animationend.animation,delete Ys.animationiteration.animation,delete Ys.animationstart.animation),"TransitionEvent"in window||delete Ys.transitionend.transition);function ns(n){if(Jd[n])return Jd[n];if(!Ys[n])return n;var a=Ys[n],i;for(i in a)if(a.hasOwnProperty(i)&&i in Gg)return Jd[n]=a[i];return n}var Fg=ns("animationend"),Kg=ns("animationiteration"),Yg=ns("animationstart"),uR=ns("transitionrun"),dR=ns("transitionstart"),fR=ns("transitioncancel"),Wg=ns("transitionend"),Xg=new Map,Qd="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Qd.push("scrollEnd");function Kn(n,a){Xg.set(n,a),Za(a,[n])}var Xl=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},On=[],Ws=0,Zd=0;function Jl(){for(var n=Ws,a=Zd=Ws=0;a<n;){var i=On[a];On[a++]=null;var c=On[a];On[a++]=null;var f=On[a];On[a++]=null;var p=On[a];if(On[a++]=null,c!==null&&f!==null){var x=c.pending;x===null?f.next=f:(f.next=x.next,x.next=f),c.pending=f}p!==0&&Jg(i,f,p)}}function Ql(n,a,i,c){On[Ws++]=n,On[Ws++]=a,On[Ws++]=i,On[Ws++]=c,Zd|=c,n.lanes|=c,n=n.alternate,n!==null&&(n.lanes|=c)}function ef(n,a,i,c){return Ql(n,a,i,c),Zl(n)}function rs(n,a){return Ql(n,null,null,a),Zl(n)}function Jg(n,a,i){n.lanes|=i;var c=n.alternate;c!==null&&(c.lanes|=i);for(var f=!1,p=n.return;p!==null;)p.childLanes|=i,c=p.alternate,c!==null&&(c.childLanes|=i),p.tag===22&&(n=p.stateNode,n===null||n._visibility&1||(f=!0)),n=p,p=p.return;return n.tag===3?(p=n.stateNode,f&&a!==null&&(f=31-kt(i),n=p.hiddenUpdates,c=n[f],c===null?n[f]=[a]:c.push(a),a.lane=i|536870912),p):null}function Zl(n){if(50<Lo)throw Lo=0,uh=null,Error(s(185));for(var a=n.return;a!==null;)n=a,a=n.return;return n.tag===3?n.stateNode:null}var Xs={};function hR(n,a,i,c){this.tag=n,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,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 wn(n,a,i,c){return new hR(n,a,i,c)}function tf(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Mr(n,a){var i=n.alternate;return i===null?(i=wn(n.tag,a,n.key,n.mode),i.elementType=n.elementType,i.type=n.type,i.stateNode=n.stateNode,i.alternate=n,n.alternate=i):(i.pendingProps=a,i.type=n.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=n.flags&65011712,i.childLanes=n.childLanes,i.lanes=n.lanes,i.child=n.child,i.memoizedProps=n.memoizedProps,i.memoizedState=n.memoizedState,i.updateQueue=n.updateQueue,a=n.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},i.sibling=n.sibling,i.index=n.index,i.ref=n.ref,i.refCleanup=n.refCleanup,i}function Qg(n,a){n.flags&=65011714;var i=n.alternate;return i===null?(n.childLanes=0,n.lanes=a,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=i.childLanes,n.lanes=i.lanes,n.child=i.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=i.memoizedProps,n.memoizedState=i.memoizedState,n.updateQueue=i.updateQueue,n.type=i.type,a=i.dependencies,n.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),n}function ec(n,a,i,c,f,p){var x=0;if(c=n,typeof n=="function")tf(n)&&(x=1);else if(typeof n=="string")x=yT(n,i,D.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case re:return n=wn(31,i,a,f),n.elementType=re,n.lanes=p,n;case S:return as(i.children,f,p,a);case T:x=8,f|=24;break;case C:return n=wn(12,i,a,f|2),n.elementType=C,n.lanes=p,n;case F:return n=wn(13,i,a,f),n.elementType=F,n.lanes=p,n;case B:return n=wn(19,i,a,f),n.elementType=B,n.lanes=p,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case N:x=10;break e;case A:x=9;break e;case z:x=11;break e;case P:x=14;break e;case V:x=16,c=null;break e}x=29,i=Error(s(130,n===null?"null":typeof n,"")),c=null}return a=wn(x,i,a,f),a.elementType=n,a.type=c,a.lanes=p,a}function as(n,a,i,c){return n=wn(7,n,c,a),n.lanes=i,n}function nf(n,a,i){return n=wn(6,n,null,a),n.lanes=i,n}function Zg(n){var a=wn(18,null,null,0);return a.stateNode=n,a}function rf(n,a,i){return a=wn(4,n.children!==null?n.children:[],n.key,a),a.lanes=i,a.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},a}var ev=new WeakMap;function Mn(n,a){if(typeof n=="object"&&n!==null){var i=ev.get(n);return i!==void 0?i:(a={value:n,source:a,stack:Tr(a)},ev.set(n,a),a)}return{value:n,source:a,stack:Tr(a)}}var Js=[],Qs=0,tc=null,mo=0,Dn=[],Ln=0,ha=null,dr=1,fr="";function Dr(n,a){Js[Qs++]=mo,Js[Qs++]=tc,tc=n,mo=a}function tv(n,a,i){Dn[Ln++]=dr,Dn[Ln++]=fr,Dn[Ln++]=ha,ha=n;var c=dr;n=fr;var f=32-kt(c)-1;c&=~(1<<f),i+=1;var p=32-kt(a)+f;if(30<p){var x=f-f%5;p=(c&(1<<x)-1).toString(32),c>>=x,f-=x,dr=1<<32-kt(a)+f|i<<f|c,fr=p+n}else dr=1<<p|i<<f|c,fr=n}function af(n){n.return!==null&&(Dr(n,1),tv(n,1,0))}function sf(n){for(;n===tc;)tc=Js[--Qs],Js[Qs]=null,mo=Js[--Qs],Js[Qs]=null;for(;n===ha;)ha=Dn[--Ln],Dn[Ln]=null,fr=Dn[--Ln],Dn[Ln]=null,dr=Dn[--Ln],Dn[Ln]=null}function nv(n,a){Dn[Ln++]=dr,Dn[Ln++]=fr,Dn[Ln++]=ha,dr=a.id,fr=a.overflow,ha=n}var Ut=null,st=null,$e=!1,ma=null,Pn=!1,of=Error(s(519));function pa(n){var a=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw po(Mn(a,n)),of}function rv(n){var a=n.stateNode,i=n.type,c=n.memoizedProps;switch(a[zt]=n,a[an]=c,i){case"dialog":ze("cancel",a),ze("close",a);break;case"iframe":case"object":case"embed":ze("load",a);break;case"video":case"audio":for(i=0;i<zo.length;i++)ze(zo[i],a);break;case"source":ze("error",a);break;case"img":case"image":case"link":ze("error",a),ze("load",a);break;case"details":ze("toggle",a);break;case"input":ze("invalid",a),gg(a,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":ze("invalid",a);break;case"textarea":ze("invalid",a),yg(a,c.value,c.defaultValue,c.children)}i=c.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||a.textContent===""+i||c.suppressHydrationWarning===!0||wb(a.textContent,i)?(c.popover!=null&&(ze("beforetoggle",a),ze("toggle",a)),c.onScroll!=null&&ze("scroll",a),c.onScrollEnd!=null&&ze("scrollend",a),c.onClick!=null&&(a.onclick=jr),a=!0):a=!1,a||pa(n,!0)}function av(n){for(Ut=n.return;Ut;)switch(Ut.tag){case 5:case 31:case 13:Pn=!1;return;case 27:case 3:Pn=!0;return;default:Ut=Ut.return}}function Zs(n){if(n!==Ut)return!1;if(!$e)return av(n),$e=!0,!1;var a=n.tag,i;if((i=a!==3&&a!==27)&&((i=a===5)&&(i=n.type,i=!(i!=="form"&&i!=="button")||Ch(n.type,n.memoizedProps)),i=!i),i&&st&&pa(n),av(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));st=Nb(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));st=Nb(n)}else a===27?(a=st,Na(n.type)?(n=kh,kh=null,st=n):st=a):st=Ut?Un(n.stateNode.nextSibling):null;return!0}function ss(){st=Ut=null,$e=!1}function lf(){var n=ma;return n!==null&&(un===null?un=n:un.push.apply(un,n),ma=null),n}function po(n){ma===null?ma=[n]:ma.push(n)}var cf=k(null),is=null,Lr=null;function ga(n,a,i){$(cf,a._currentValue),a._currentValue=i}function Pr(n){n._currentValue=cf.current,j(cf)}function uf(n,a,i){for(;n!==null;){var c=n.alternate;if((n.childLanes&a)!==a?(n.childLanes|=a,c!==null&&(c.childLanes|=a)):c!==null&&(c.childLanes&a)!==a&&(c.childLanes|=a),n===i)break;n=n.return}}function df(n,a,i,c){var f=n.child;for(f!==null&&(f.return=n);f!==null;){var p=f.dependencies;if(p!==null){var x=f.child;p=p.firstContext;e:for(;p!==null;){var R=p;p=f;for(var O=0;O<a.length;O++)if(R.context===a[O]){p.lanes|=i,R=p.alternate,R!==null&&(R.lanes|=i),uf(p.return,i,n),c||(x=null);break e}p=R.next}}else if(f.tag===18){if(x=f.return,x===null)throw Error(s(341));x.lanes|=i,p=x.alternate,p!==null&&(p.lanes|=i),uf(x,i,n),x=null}else x=f.child;if(x!==null)x.return=f;else for(x=f;x!==null;){if(x===n){x=null;break}if(f=x.sibling,f!==null){f.return=x.return,x=f;break}x=x.return}f=x}}function ei(n,a,i,c){n=null;for(var f=a,p=!1;f!==null;){if(!p){if((f.flags&524288)!==0)p=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var x=f.alternate;if(x===null)throw Error(s(387));if(x=x.memoizedProps,x!==null){var R=f.type;bn(f.pendingProps.value,x.value)||(n!==null?n.push(R):n=[R])}}else if(f===J.current){if(x=f.alternate,x===null)throw Error(s(387));x.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(n!==null?n.push(Ho):n=[Ho])}f=f.return}n!==null&&df(a,n,i,c),a.flags|=262144}function nc(n){for(n=n.firstContext;n!==null;){if(!bn(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function os(n){is=n,Lr=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function It(n){return sv(is,n)}function rc(n,a){return is===null&&os(n),sv(n,a)}function sv(n,a){var i=a._currentValue;if(a={context:a,memoizedValue:i,next:null},Lr===null){if(n===null)throw Error(s(308));Lr=a,n.dependencies={lanes:0,firstContext:a},n.flags|=524288}else Lr=Lr.next=a;return i}var mR=typeof AbortController<"u"?AbortController:function(){var n=[],a=this.signal={aborted:!1,addEventListener:function(i,c){n.push(c)}};this.abort=function(){a.aborted=!0,n.forEach(function(i){return i()})}},pR=e.unstable_scheduleCallback,gR=e.unstable_NormalPriority,xt={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ff(){return{controller:new mR,data:new Map,refCount:0}}function go(n){n.refCount--,n.refCount===0&&pR(gR,function(){n.controller.abort()})}var vo=null,hf=0,ti=0,ni=null;function vR(n,a){if(vo===null){var i=vo=[];hf=0,ti=gh(),ni={status:"pending",value:void 0,then:function(c){i.push(c)}}}return hf++,a.then(iv,iv),a}function iv(){if(--hf===0&&vo!==null){ni!==null&&(ni.status="fulfilled");var n=vo;vo=null,ti=0,ni=null;for(var a=0;a<n.length;a++)(0,n[a])()}}function yR(n,a){var i=[],c={status:"pending",value:null,reason:null,then:function(f){i.push(f)}};return n.then(function(){c.status="fulfilled",c.value=a;for(var f=0;f<i.length;f++)(0,i[f])(a)},function(f){for(c.status="rejected",c.reason=f,f=0;f<i.length;f++)(0,i[f])(void 0)}),c}var ov=M.S;M.S=function(n,a){Vy=vt(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&vR(n,a),ov!==null&&ov(n,a)};var ls=k(null);function mf(){var n=ls.current;return n!==null?n:tt.pooledCache}function ac(n,a){a===null?$(ls,ls.current):$(ls,a.pool)}function lv(){var n=mf();return n===null?null:{parent:xt._currentValue,pool:n}}var ri=Error(s(460)),pf=Error(s(474)),sc=Error(s(542)),ic={then:function(){}};function cv(n){return n=n.status,n==="fulfilled"||n==="rejected"}function uv(n,a,i){switch(i=n[i],i===void 0?n.push(a):i!==a&&(a.then(jr,jr),a=i),a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,fv(n),n;default:if(typeof a.status=="string")a.then(jr,jr);else{if(n=tt,n!==null&&100<n.shellSuspendCounter)throw Error(s(482));n=a,n.status="pending",n.then(function(c){if(a.status==="pending"){var f=a;f.status="fulfilled",f.value=c}},function(c){if(a.status==="pending"){var f=a;f.status="rejected",f.reason=c}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,fv(n),n}throw us=a,ri}}function cs(n){try{var a=n._init;return a(n._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(us=i,ri):i}}var us=null;function dv(){if(us===null)throw Error(s(459));var n=us;return us=null,n}function fv(n){if(n===ri||n===sc)throw Error(s(483))}var ai=null,yo=0;function oc(n){var a=yo;return yo+=1,ai===null&&(ai=[]),uv(ai,n,a)}function bo(n,a){a=a.props.ref,n.ref=a!==void 0?a:null}function lc(n,a){throw a.$$typeof===w?Error(s(525)):(n=Object.prototype.toString.call(a),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":n)))}function hv(n){function a(I,L){if(n){var H=I.deletions;H===null?(I.deletions=[L],I.flags|=16):H.push(L)}}function i(I,L){if(!n)return null;for(;L!==null;)a(I,L),L=L.sibling;return null}function c(I){for(var L=new Map;I!==null;)I.key!==null?L.set(I.key,I):L.set(I.index,I),I=I.sibling;return L}function f(I,L){return I=Mr(I,L),I.index=0,I.sibling=null,I}function p(I,L,H){return I.index=H,n?(H=I.alternate,H!==null?(H=H.index,H<L?(I.flags|=67108866,L):H):(I.flags|=67108866,L)):(I.flags|=1048576,L)}function x(I){return n&&I.alternate===null&&(I.flags|=67108866),I}function R(I,L,H,ee){return L===null||L.tag!==6?(L=nf(H,I.mode,ee),L.return=I,L):(L=f(L,H),L.return=I,L)}function O(I,L,H,ee){var Ce=H.type;return Ce===S?Z(I,L,H.props.children,ee,H.key):L!==null&&(L.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===V&&cs(Ce)===L.type)?(L=f(L,H.props),bo(L,H),L.return=I,L):(L=ec(H.type,H.key,H.props,null,I.mode,ee),bo(L,H),L.return=I,L)}function q(I,L,H,ee){return L===null||L.tag!==4||L.stateNode.containerInfo!==H.containerInfo||L.stateNode.implementation!==H.implementation?(L=rf(H,I.mode,ee),L.return=I,L):(L=f(L,H.children||[]),L.return=I,L)}function Z(I,L,H,ee,Ce){return L===null||L.tag!==7?(L=as(H,I.mode,ee,Ce),L.return=I,L):(L=f(L,H),L.return=I,L)}function ne(I,L,H){if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return L=nf(""+L,I.mode,H),L.return=I,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case _:return H=ec(L.type,L.key,L.props,null,I.mode,H),bo(H,L),H.return=I,H;case E:return L=rf(L,I.mode,H),L.return=I,L;case V:return L=cs(L),ne(I,L,H)}if(fe(L)||de(L))return L=as(L,I.mode,H,null),L.return=I,L;if(typeof L.then=="function")return ne(I,oc(L),H);if(L.$$typeof===N)return ne(I,rc(I,L),H);lc(I,L)}return null}function G(I,L,H,ee){var Ce=L!==null?L.key:null;if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return Ce!==null?null:R(I,L,""+H,ee);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case _:return H.key===Ce?O(I,L,H,ee):null;case E:return H.key===Ce?q(I,L,H,ee):null;case V:return H=cs(H),G(I,L,H,ee)}if(fe(H)||de(H))return Ce!==null?null:Z(I,L,H,ee,null);if(typeof H.then=="function")return G(I,L,oc(H),ee);if(H.$$typeof===N)return G(I,L,rc(I,H),ee);lc(I,H)}return null}function Y(I,L,H,ee,Ce){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return I=I.get(H)||null,R(L,I,""+ee,Ce);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case _:return I=I.get(ee.key===null?H:ee.key)||null,O(L,I,ee,Ce);case E:return I=I.get(ee.key===null?H:ee.key)||null,q(L,I,ee,Ce);case V:return ee=cs(ee),Y(I,L,H,ee,Ce)}if(fe(ee)||de(ee))return I=I.get(H)||null,Z(L,I,ee,Ce,null);if(typeof ee.then=="function")return Y(I,L,H,oc(ee),Ce);if(ee.$$typeof===N)return Y(I,L,H,rc(L,ee),Ce);lc(L,ee)}return null}function be(I,L,H,ee){for(var Ce=null,Ve=null,_e=L,De=L=0,Ie=null;_e!==null&&De<H.length;De++){_e.index>De?(Ie=_e,_e=null):Ie=_e.sibling;var Ge=G(I,_e,H[De],ee);if(Ge===null){_e===null&&(_e=Ie);break}n&&_e&&Ge.alternate===null&&a(I,_e),L=p(Ge,L,De),Ve===null?Ce=Ge:Ve.sibling=Ge,Ve=Ge,_e=Ie}if(De===H.length)return i(I,_e),$e&&Dr(I,De),Ce;if(_e===null){for(;De<H.length;De++)_e=ne(I,H[De],ee),_e!==null&&(L=p(_e,L,De),Ve===null?Ce=_e:Ve.sibling=_e,Ve=_e);return $e&&Dr(I,De),Ce}for(_e=c(_e);De<H.length;De++)Ie=Y(_e,I,De,H[De],ee),Ie!==null&&(n&&Ie.alternate!==null&&_e.delete(Ie.key===null?De:Ie.key),L=p(Ie,L,De),Ve===null?Ce=Ie:Ve.sibling=Ie,Ve=Ie);return n&&_e.forEach(function(Da){return a(I,Da)}),$e&&Dr(I,De),Ce}function Ae(I,L,H,ee){if(H==null)throw Error(s(151));for(var Ce=null,Ve=null,_e=L,De=L=0,Ie=null,Ge=H.next();_e!==null&&!Ge.done;De++,Ge=H.next()){_e.index>De?(Ie=_e,_e=null):Ie=_e.sibling;var Da=G(I,_e,Ge.value,ee);if(Da===null){_e===null&&(_e=Ie);break}n&&_e&&Da.alternate===null&&a(I,_e),L=p(Da,L,De),Ve===null?Ce=Da:Ve.sibling=Da,Ve=Da,_e=Ie}if(Ge.done)return i(I,_e),$e&&Dr(I,De),Ce;if(_e===null){for(;!Ge.done;De++,Ge=H.next())Ge=ne(I,Ge.value,ee),Ge!==null&&(L=p(Ge,L,De),Ve===null?Ce=Ge:Ve.sibling=Ge,Ve=Ge);return $e&&Dr(I,De),Ce}for(_e=c(_e);!Ge.done;De++,Ge=H.next())Ge=Y(_e,I,De,Ge.value,ee),Ge!==null&&(n&&Ge.alternate!==null&&_e.delete(Ge.key===null?De:Ge.key),L=p(Ge,L,De),Ve===null?Ce=Ge:Ve.sibling=Ge,Ve=Ge);return n&&_e.forEach(function(NT){return a(I,NT)}),$e&&Dr(I,De),Ce}function Ze(I,L,H,ee){if(typeof H=="object"&&H!==null&&H.type===S&&H.key===null&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case _:e:{for(var Ce=H.key;L!==null;){if(L.key===Ce){if(Ce=H.type,Ce===S){if(L.tag===7){i(I,L.sibling),ee=f(L,H.props.children),ee.return=I,I=ee;break e}}else if(L.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===V&&cs(Ce)===L.type){i(I,L.sibling),ee=f(L,H.props),bo(ee,H),ee.return=I,I=ee;break e}i(I,L);break}else a(I,L);L=L.sibling}H.type===S?(ee=as(H.props.children,I.mode,ee,H.key),ee.return=I,I=ee):(ee=ec(H.type,H.key,H.props,null,I.mode,ee),bo(ee,H),ee.return=I,I=ee)}return x(I);case E:e:{for(Ce=H.key;L!==null;){if(L.key===Ce)if(L.tag===4&&L.stateNode.containerInfo===H.containerInfo&&L.stateNode.implementation===H.implementation){i(I,L.sibling),ee=f(L,H.children||[]),ee.return=I,I=ee;break e}else{i(I,L);break}else a(I,L);L=L.sibling}ee=rf(H,I.mode,ee),ee.return=I,I=ee}return x(I);case V:return H=cs(H),Ze(I,L,H,ee)}if(fe(H))return be(I,L,H,ee);if(de(H)){if(Ce=de(H),typeof Ce!="function")throw Error(s(150));return H=Ce.call(H),Ae(I,L,H,ee)}if(typeof H.then=="function")return Ze(I,L,oc(H),ee);if(H.$$typeof===N)return Ze(I,L,rc(I,H),ee);lc(I,H)}return typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint"?(H=""+H,L!==null&&L.tag===6?(i(I,L.sibling),ee=f(L,H),ee.return=I,I=ee):(i(I,L),ee=nf(H,I.mode,ee),ee.return=I,I=ee),x(I)):i(I,L)}return function(I,L,H,ee){try{yo=0;var Ce=Ze(I,L,H,ee);return ai=null,Ce}catch(_e){if(_e===ri||_e===sc)throw _e;var Ve=wn(29,_e,null,I.mode);return Ve.lanes=ee,Ve.return=I,Ve}finally{}}}var ds=hv(!0),mv=hv(!1),va=!1;function gf(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function vf(n,a){n=n.updateQueue,a.updateQueue===n&&(a.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function ya(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function ba(n,a,i){var c=n.updateQueue;if(c===null)return null;if(c=c.shared,(Ke&2)!==0){var f=c.pending;return f===null?a.next=a:(a.next=f.next,f.next=a),c.pending=a,a=Zl(n),Jg(n,null,i),a}return Ql(n,c,a,i),Zl(n)}function wo(n,a,i){if(a=a.updateQueue,a!==null&&(a=a.shared,(i&4194048)!==0)){var c=a.lanes;c&=n.pendingLanes,i|=c,a.lanes=i,nn(n,i)}}function yf(n,a){var i=n.updateQueue,c=n.alternate;if(c!==null&&(c=c.updateQueue,i===c)){var f=null,p=null;if(i=i.firstBaseUpdate,i!==null){do{var x={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};p===null?f=p=x:p=p.next=x,i=i.next}while(i!==null);p===null?f=p=a:p=p.next=a}else f=p=a;i={baseState:c.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:c.shared,callbacks:c.callbacks},n.updateQueue=i;return}n=i.lastBaseUpdate,n===null?i.firstBaseUpdate=a:n.next=a,i.lastBaseUpdate=a}var bf=!1;function xo(){if(bf){var n=ni;if(n!==null)throw n}}function _o(n,a,i,c){bf=!1;var f=n.updateQueue;va=!1;var p=f.firstBaseUpdate,x=f.lastBaseUpdate,R=f.shared.pending;if(R!==null){f.shared.pending=null;var O=R,q=O.next;O.next=null,x===null?p=q:x.next=q,x=O;var Z=n.alternate;Z!==null&&(Z=Z.updateQueue,R=Z.lastBaseUpdate,R!==x&&(R===null?Z.firstBaseUpdate=q:R.next=q,Z.lastBaseUpdate=O))}if(p!==null){var ne=f.baseState;x=0,Z=q=O=null,R=p;do{var G=R.lane&-536870913,Y=G!==R.lane;if(Y?(Ue&G)===G:(c&G)===G){G!==0&&G===ti&&(bf=!0),Z!==null&&(Z=Z.next={lane:0,tag:R.tag,payload:R.payload,callback:null,next:null});e:{var be=n,Ae=R;G=a;var Ze=i;switch(Ae.tag){case 1:if(be=Ae.payload,typeof be=="function"){ne=be.call(Ze,ne,G);break e}ne=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Ae.payload,G=typeof be=="function"?be.call(Ze,ne,G):be,G==null)break e;ne=g({},ne,G);break e;case 2:va=!0}}G=R.callback,G!==null&&(n.flags|=64,Y&&(n.flags|=8192),Y=f.callbacks,Y===null?f.callbacks=[G]:Y.push(G))}else Y={lane:G,tag:R.tag,payload:R.payload,callback:R.callback,next:null},Z===null?(q=Z=Y,O=ne):Z=Z.next=Y,x|=G;if(R=R.next,R===null){if(R=f.shared.pending,R===null)break;Y=R,R=Y.next,Y.next=null,f.lastBaseUpdate=Y,f.shared.pending=null}}while(!0);Z===null&&(O=ne),f.baseState=O,f.firstBaseUpdate=q,f.lastBaseUpdate=Z,p===null&&(f.shared.lanes=0),Ea|=x,n.lanes=x,n.memoizedState=ne}}function pv(n,a){if(typeof n!="function")throw Error(s(191,n));n.call(a)}function gv(n,a){var i=n.callbacks;if(i!==null)for(n.callbacks=null,n=0;n<i.length;n++)pv(i[n],a)}var si=k(null),cc=k(0);function vv(n,a){n=Gr,$(cc,n),$(si,a),Gr=n|a.baseLanes}function wf(){$(cc,Gr),$(si,si.current)}function xf(){Gr=cc.current,j(si),j(cc)}var xn=k(null),zn=null;function wa(n){var a=n.alternate;$(yt,yt.current&1),$(xn,n),zn===null&&(a===null||si.current!==null||a.memoizedState!==null)&&(zn=n)}function _f(n){$(yt,yt.current),$(xn,n),zn===null&&(zn=n)}function yv(n){n.tag===22?($(yt,yt.current),$(xn,n),zn===null&&(zn=n)):xa()}function xa(){$(yt,yt.current),$(xn,xn.current)}function _n(n){j(xn),zn===n&&(zn=null),j(yt)}var yt=k(0);function uc(n){for(var a=n;a!==null;){if(a.tag===13){var i=a.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Ah(i)||Nh(i)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var zr=0,Me=null,Je=null,_t=null,dc=!1,ii=!1,fs=!1,fc=0,So=0,oi=null,bR=0;function ht(){throw Error(s(321))}function Sf(n,a){if(a===null)return!1;for(var i=0;i<a.length&&i<n.length;i++)if(!bn(n[i],a[i]))return!1;return!0}function Ef(n,a,i,c,f,p){return zr=p,Me=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,M.H=n===null||n.memoizedState===null?ty:If,fs=!1,p=i(c,f),fs=!1,ii&&(p=wv(a,i,c,f)),bv(n),p}function bv(n){M.H=Ro;var a=Je!==null&&Je.next!==null;if(zr=0,_t=Je=Me=null,dc=!1,So=0,oi=null,a)throw Error(s(300));n===null||St||(n=n.dependencies,n!==null&&nc(n)&&(St=!0))}function wv(n,a,i,c){Me=n;var f=0;do{if(ii&&(oi=null),So=0,ii=!1,25<=f)throw Error(s(301));if(f+=1,_t=Je=null,n.updateQueue!=null){var p=n.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}M.H=ny,p=a(i,c)}while(ii);return p}function wR(){var n=M.H,a=n.useState()[0];return a=typeof a.then=="function"?Eo(a):a,n=n.useState()[0],(Je!==null?Je.memoizedState:null)!==n&&(Me.flags|=1024),a}function Cf(){var n=fc!==0;return fc=0,n}function Rf(n,a,i){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~i}function Tf(n){if(dc){for(n=n.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}dc=!1}zr=0,_t=Je=Me=null,ii=!1,So=fc=0,oi=null}function Xt(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _t===null?Me.memoizedState=_t=n:_t=_t.next=n,_t}function bt(){if(Je===null){var n=Me.alternate;n=n!==null?n.memoizedState:null}else n=Je.next;var a=_t===null?Me.memoizedState:_t.next;if(a!==null)_t=a,Je=n;else{if(n===null)throw Me.alternate===null?Error(s(467)):Error(s(310));Je=n,n={memoizedState:Je.memoizedState,baseState:Je.baseState,baseQueue:Je.baseQueue,queue:Je.queue,next:null},_t===null?Me.memoizedState=_t=n:_t=_t.next=n}return _t}function hc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Eo(n){var a=So;return So+=1,oi===null&&(oi=[]),n=uv(oi,n,a),a=Me,(_t===null?a.memoizedState:_t.next)===null&&(a=a.alternate,M.H=a===null||a.memoizedState===null?ty:If),n}function mc(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Eo(n);if(n.$$typeof===N)return It(n)}throw Error(s(438,String(n)))}function Af(n){var a=null,i=Me.updateQueue;if(i!==null&&(a=i.memoCache),a==null){var c=Me.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(a={data:c.data.map(function(f){return f.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),i===null&&(i=hc(),Me.updateQueue=i),i.memoCache=a,i=a.data[a.index],i===void 0)for(i=a.data[a.index]=Array(n),c=0;c<n;c++)i[c]=le;return a.index++,i}function Ur(n,a){return typeof a=="function"?a(n):a}function pc(n){var a=bt();return Nf(a,Je,n)}function Nf(n,a,i){var c=n.queue;if(c===null)throw Error(s(311));c.lastRenderedReducer=i;var f=n.baseQueue,p=c.pending;if(p!==null){if(f!==null){var x=f.next;f.next=p.next,p.next=x}a.baseQueue=f=p,c.pending=null}if(p=n.baseState,f===null)n.memoizedState=p;else{a=f.next;var R=x=null,O=null,q=a,Z=!1;do{var ne=q.lane&-536870913;if(ne!==q.lane?(Ue&ne)===ne:(zr&ne)===ne){var G=q.revertLane;if(G===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null}),ne===ti&&(Z=!0);else if((zr&G)===G){q=q.next,G===ti&&(Z=!0);continue}else ne={lane:0,revertLane:q.revertLane,gesture:null,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null},O===null?(R=O=ne,x=p):O=O.next=ne,Me.lanes|=G,Ea|=G;ne=q.action,fs&&i(p,ne),p=q.hasEagerState?q.eagerState:i(p,ne)}else G={lane:ne,revertLane:q.revertLane,gesture:q.gesture,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null},O===null?(R=O=G,x=p):O=O.next=G,Me.lanes|=ne,Ea|=ne;q=q.next}while(q!==null&&q!==a);if(O===null?x=p:O.next=R,!bn(p,n.memoizedState)&&(St=!0,Z&&(i=ni,i!==null)))throw i;n.memoizedState=p,n.baseState=x,n.baseQueue=O,c.lastRenderedState=p}return f===null&&(c.lanes=0),[n.memoizedState,c.dispatch]}function kf(n){var a=bt(),i=a.queue;if(i===null)throw Error(s(311));i.lastRenderedReducer=n;var c=i.dispatch,f=i.pending,p=a.memoizedState;if(f!==null){i.pending=null;var x=f=f.next;do p=n(p,x.action),x=x.next;while(x!==f);bn(p,a.memoizedState)||(St=!0),a.memoizedState=p,a.baseQueue===null&&(a.baseState=p),i.lastRenderedState=p}return[p,c]}function xv(n,a,i){var c=Me,f=bt(),p=$e;if(p){if(i===void 0)throw Error(s(407));i=i()}else i=a();var x=!bn((Je||f).memoizedState,i);if(x&&(f.memoizedState=i,St=!0),f=f.queue,Mf(Ev.bind(null,c,f,n),[n]),f.getSnapshot!==a||x||_t!==null&&_t.memoizedState.tag&1){if(c.flags|=2048,li(9,{destroy:void 0},Sv.bind(null,c,f,i,a),null),tt===null)throw Error(s(349));p||(zr&127)!==0||_v(c,a,i)}return i}function _v(n,a,i){n.flags|=16384,n={getSnapshot:a,value:i},a=Me.updateQueue,a===null?(a=hc(),Me.updateQueue=a,a.stores=[n]):(i=a.stores,i===null?a.stores=[n]:i.push(n))}function Sv(n,a,i,c){a.value=i,a.getSnapshot=c,Cv(a)&&Rv(n)}function Ev(n,a,i){return i(function(){Cv(a)&&Rv(n)})}function Cv(n){var a=n.getSnapshot;n=n.value;try{var i=a();return!bn(n,i)}catch{return!0}}function Rv(n){var a=rs(n,2);a!==null&&dn(a,n,2)}function jf(n){var a=Xt();if(typeof n=="function"){var i=n;if(n=i(),fs){yn(!0);try{i()}finally{yn(!1)}}}return a.memoizedState=a.baseState=n,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ur,lastRenderedState:n},a}function Tv(n,a,i,c){return n.baseState=i,Nf(n,Je,typeof c=="function"?c:Ur)}function xR(n,a,i,c,f){if(yc(n))throw Error(s(485));if(n=a.action,n!==null){var p={payload:f,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){p.listeners.push(x)}};M.T!==null?i(!0):p.isTransition=!1,c(p),i=a.pending,i===null?(p.next=a.pending=p,Av(a,p)):(p.next=i.next,a.pending=i.next=p)}}function Av(n,a){var i=a.action,c=a.payload,f=n.state;if(a.isTransition){var p=M.T,x={};M.T=x;try{var R=i(f,c),O=M.S;O!==null&&O(x,R),Nv(n,a,R)}catch(q){Of(n,a,q)}finally{p!==null&&x.types!==null&&(p.types=x.types),M.T=p}}else try{p=i(f,c),Nv(n,a,p)}catch(q){Of(n,a,q)}}function Nv(n,a,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(c){kv(n,a,c)},function(c){return Of(n,a,c)}):kv(n,a,i)}function kv(n,a,i){a.status="fulfilled",a.value=i,jv(a),n.state=i,a=n.pending,a!==null&&(i=a.next,i===a?n.pending=null:(i=i.next,a.next=i,Av(n,i)))}function Of(n,a,i){var c=n.pending;if(n.pending=null,c!==null){c=c.next;do a.status="rejected",a.reason=i,jv(a),a=a.next;while(a!==c)}n.action=null}function jv(n){n=n.listeners;for(var a=0;a<n.length;a++)(0,n[a])()}function Ov(n,a){return a}function Mv(n,a){if($e){var i=tt.formState;if(i!==null){e:{var c=Me;if($e){if(st){t:{for(var f=st,p=Pn;f.nodeType!==8;){if(!p){f=null;break t}if(f=Un(f.nextSibling),f===null){f=null;break t}}p=f.data,f=p==="F!"||p==="F"?f:null}if(f){st=Un(f.nextSibling),c=f.data==="F!";break e}}pa(c)}c=!1}c&&(a=i[0])}}return i=Xt(),i.memoizedState=i.baseState=a,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ov,lastRenderedState:a},i.queue=c,i=Qv.bind(null,Me,c),c.dispatch=i,c=jf(!1),p=Uf.bind(null,Me,!1,c.queue),c=Xt(),f={state:a,dispatch:null,action:n,pending:null},c.queue=f,i=xR.bind(null,Me,f,p,i),f.dispatch=i,c.memoizedState=n,[a,i,!1]}function Dv(n){var a=bt();return Lv(a,Je,n)}function Lv(n,a,i){if(a=Nf(n,a,Ov)[0],n=pc(Ur)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var c=Eo(a)}catch(x){throw x===ri?sc:x}else c=a;a=bt();var f=a.queue,p=f.dispatch;return i!==a.memoizedState&&(Me.flags|=2048,li(9,{destroy:void 0},_R.bind(null,f,i),null)),[c,p,n]}function _R(n,a){n.action=a}function Pv(n){var a=bt(),i=Je;if(i!==null)return Lv(a,i,n);bt(),a=a.memoizedState,i=bt();var c=i.queue.dispatch;return i.memoizedState=n,[a,c,!1]}function li(n,a,i,c){return n={tag:n,create:i,deps:c,inst:a,next:null},a=Me.updateQueue,a===null&&(a=hc(),Me.updateQueue=a),i=a.lastEffect,i===null?a.lastEffect=n.next=n:(c=i.next,i.next=n,n.next=c,a.lastEffect=n),n}function zv(){return bt().memoizedState}function gc(n,a,i,c){var f=Xt();Me.flags|=n,f.memoizedState=li(1|a,{destroy:void 0},i,c===void 0?null:c)}function vc(n,a,i,c){var f=bt();c=c===void 0?null:c;var p=f.memoizedState.inst;Je!==null&&c!==null&&Sf(c,Je.memoizedState.deps)?f.memoizedState=li(a,p,i,c):(Me.flags|=n,f.memoizedState=li(1|a,p,i,c))}function Uv(n,a){gc(8390656,8,n,a)}function Mf(n,a){vc(2048,8,n,a)}function SR(n){Me.flags|=4;var a=Me.updateQueue;if(a===null)a=hc(),Me.updateQueue=a,a.events=[n];else{var i=a.events;i===null?a.events=[n]:i.push(n)}}function Iv(n){var a=bt().memoizedState;return SR({ref:a,nextImpl:n}),function(){if((Ke&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}function $v(n,a){return vc(4,2,n,a)}function Bv(n,a){return vc(4,4,n,a)}function Hv(n,a){if(typeof a=="function"){n=n();var i=a(n);return function(){typeof i=="function"?i():a(null)}}if(a!=null)return n=n(),a.current=n,function(){a.current=null}}function qv(n,a,i){i=i!=null?i.concat([n]):null,vc(4,4,Hv.bind(null,a,n),i)}function Df(){}function Vv(n,a){var i=bt();a=a===void 0?null:a;var c=i.memoizedState;return a!==null&&Sf(a,c[1])?c[0]:(i.memoizedState=[n,a],n)}function Gv(n,a){var i=bt();a=a===void 0?null:a;var c=i.memoizedState;if(a!==null&&Sf(a,c[1]))return c[0];if(c=n(),fs){yn(!0);try{n()}finally{yn(!1)}}return i.memoizedState=[c,a],c}function Lf(n,a,i){return i===void 0||(zr&1073741824)!==0&&(Ue&261930)===0?n.memoizedState=a:(n.memoizedState=i,n=Fy(),Me.lanes|=n,Ea|=n,i)}function Fv(n,a,i,c){return bn(i,a)?i:si.current!==null?(n=Lf(n,i,c),bn(n,a)||(St=!0),n):(zr&42)===0||(zr&1073741824)!==0&&(Ue&261930)===0?(St=!0,n.memoizedState=i):(n=Fy(),Me.lanes|=n,Ea|=n,a)}function Kv(n,a,i,c,f){var p=K.p;K.p=p!==0&&8>p?p:8;var x=M.T,R={};M.T=R,Uf(n,!1,a,i);try{var O=f(),q=M.S;if(q!==null&&q(R,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var Z=yR(O,c);Co(n,a,Z,Cn(n))}else Co(n,a,c,Cn(n))}catch(ne){Co(n,a,{then:function(){},status:"rejected",reason:ne},Cn())}finally{K.p=p,x!==null&&R.types!==null&&(x.types=R.types),M.T=x}}function ER(){}function Pf(n,a,i,c){if(n.tag!==5)throw Error(s(476));var f=Yv(n).queue;Kv(n,f,a,Q,i===null?ER:function(){return Wv(n),i(c)})}function Yv(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ur,lastRenderedState:Q},next:null};var i={};return a.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ur,lastRenderedState:i},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function Wv(n){var a=Yv(n);a.next===null&&(a=n.alternate.memoizedState),Co(n,a.next.queue,{},Cn())}function zf(){return It(Ho)}function Xv(){return bt().memoizedState}function Jv(){return bt().memoizedState}function CR(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var i=Cn();n=ya(i);var c=ba(a,n,i);c!==null&&(dn(c,a,i),wo(c,a,i)),a={cache:ff()},n.payload=a;return}a=a.return}}function RR(n,a,i){var c=Cn();i={lane:c,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},yc(n)?Zv(a,i):(i=ef(n,a,i,c),i!==null&&(dn(i,n,c),ey(i,a,c)))}function Qv(n,a,i){var c=Cn();Co(n,a,i,c)}function Co(n,a,i,c){var f={lane:c,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(yc(n))Zv(a,f);else{var p=n.alternate;if(n.lanes===0&&(p===null||p.lanes===0)&&(p=a.lastRenderedReducer,p!==null))try{var x=a.lastRenderedState,R=p(x,i);if(f.hasEagerState=!0,f.eagerState=R,bn(R,x))return Ql(n,a,f,0),tt===null&&Jl(),!1}catch{}finally{}if(i=ef(n,a,f,c),i!==null)return dn(i,n,c),ey(i,a,c),!0}return!1}function Uf(n,a,i,c){if(c={lane:2,revertLane:gh(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},yc(n)){if(a)throw Error(s(479))}else a=ef(n,i,c,2),a!==null&&dn(a,n,2)}function yc(n){var a=n.alternate;return n===Me||a!==null&&a===Me}function Zv(n,a){ii=dc=!0;var i=n.pending;i===null?a.next=a:(a.next=i.next,i.next=a),n.pending=a}function ey(n,a,i){if((i&4194048)!==0){var c=a.lanes;c&=n.pendingLanes,i|=c,a.lanes=i,nn(n,i)}}var Ro={readContext:It,use:mc,useCallback:ht,useContext:ht,useEffect:ht,useImperativeHandle:ht,useLayoutEffect:ht,useInsertionEffect:ht,useMemo:ht,useReducer:ht,useRef:ht,useState:ht,useDebugValue:ht,useDeferredValue:ht,useTransition:ht,useSyncExternalStore:ht,useId:ht,useHostTransitionStatus:ht,useFormState:ht,useActionState:ht,useOptimistic:ht,useMemoCache:ht,useCacheRefresh:ht};Ro.useEffectEvent=ht;var ty={readContext:It,use:mc,useCallback:function(n,a){return Xt().memoizedState=[n,a===void 0?null:a],n},useContext:It,useEffect:Uv,useImperativeHandle:function(n,a,i){i=i!=null?i.concat([n]):null,gc(4194308,4,Hv.bind(null,a,n),i)},useLayoutEffect:function(n,a){return gc(4194308,4,n,a)},useInsertionEffect:function(n,a){gc(4,2,n,a)},useMemo:function(n,a){var i=Xt();a=a===void 0?null:a;var c=n();if(fs){yn(!0);try{n()}finally{yn(!1)}}return i.memoizedState=[c,a],c},useReducer:function(n,a,i){var c=Xt();if(i!==void 0){var f=i(a);if(fs){yn(!0);try{i(a)}finally{yn(!1)}}}else f=a;return c.memoizedState=c.baseState=f,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:f},c.queue=n,n=n.dispatch=RR.bind(null,Me,n),[c.memoizedState,n]},useRef:function(n){var a=Xt();return n={current:n},a.memoizedState=n},useState:function(n){n=jf(n);var a=n.queue,i=Qv.bind(null,Me,a);return a.dispatch=i,[n.memoizedState,i]},useDebugValue:Df,useDeferredValue:function(n,a){var i=Xt();return Lf(i,n,a)},useTransition:function(){var n=jf(!1);return n=Kv.bind(null,Me,n.queue,!0,!1),Xt().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,i){var c=Me,f=Xt();if($e){if(i===void 0)throw Error(s(407));i=i()}else{if(i=a(),tt===null)throw Error(s(349));(Ue&127)!==0||_v(c,a,i)}f.memoizedState=i;var p={value:i,getSnapshot:a};return f.queue=p,Uv(Ev.bind(null,c,p,n),[n]),c.flags|=2048,li(9,{destroy:void 0},Sv.bind(null,c,p,i,a),null),i},useId:function(){var n=Xt(),a=tt.identifierPrefix;if($e){var i=fr,c=dr;i=(c&~(1<<32-kt(c)-1)).toString(32)+i,a="_"+a+"R_"+i,i=fc++,0<i&&(a+="H"+i.toString(32)),a+="_"}else i=bR++,a="_"+a+"r_"+i.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:zf,useFormState:Mv,useActionState:Mv,useOptimistic:function(n){var a=Xt();a.memoizedState=a.baseState=n;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=i,a=Uf.bind(null,Me,!0,i),i.dispatch=a,[n,a]},useMemoCache:Af,useCacheRefresh:function(){return Xt().memoizedState=CR.bind(null,Me)},useEffectEvent:function(n){var a=Xt(),i={impl:n};return a.memoizedState=i,function(){if((Ke&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}},If={readContext:It,use:mc,useCallback:Vv,useContext:It,useEffect:Mf,useImperativeHandle:qv,useInsertionEffect:$v,useLayoutEffect:Bv,useMemo:Gv,useReducer:pc,useRef:zv,useState:function(){return pc(Ur)},useDebugValue:Df,useDeferredValue:function(n,a){var i=bt();return Fv(i,Je.memoizedState,n,a)},useTransition:function(){var n=pc(Ur)[0],a=bt().memoizedState;return[typeof n=="boolean"?n:Eo(n),a]},useSyncExternalStore:xv,useId:Xv,useHostTransitionStatus:zf,useFormState:Dv,useActionState:Dv,useOptimistic:function(n,a){var i=bt();return Tv(i,Je,n,a)},useMemoCache:Af,useCacheRefresh:Jv};If.useEffectEvent=Iv;var ny={readContext:It,use:mc,useCallback:Vv,useContext:It,useEffect:Mf,useImperativeHandle:qv,useInsertionEffect:$v,useLayoutEffect:Bv,useMemo:Gv,useReducer:kf,useRef:zv,useState:function(){return kf(Ur)},useDebugValue:Df,useDeferredValue:function(n,a){var i=bt();return Je===null?Lf(i,n,a):Fv(i,Je.memoizedState,n,a)},useTransition:function(){var n=kf(Ur)[0],a=bt().memoizedState;return[typeof n=="boolean"?n:Eo(n),a]},useSyncExternalStore:xv,useId:Xv,useHostTransitionStatus:zf,useFormState:Pv,useActionState:Pv,useOptimistic:function(n,a){var i=bt();return Je!==null?Tv(i,Je,n,a):(i.baseState=n,[n,i.queue.dispatch])},useMemoCache:Af,useCacheRefresh:Jv};ny.useEffectEvent=Iv;function $f(n,a,i,c){a=n.memoizedState,i=i(c,a),i=i==null?a:g({},a,i),n.memoizedState=i,n.lanes===0&&(n.updateQueue.baseState=i)}var Bf={enqueueSetState:function(n,a,i){n=n._reactInternals;var c=Cn(),f=ya(c);f.payload=a,i!=null&&(f.callback=i),a=ba(n,f,c),a!==null&&(dn(a,n,c),wo(a,n,c))},enqueueReplaceState:function(n,a,i){n=n._reactInternals;var c=Cn(),f=ya(c);f.tag=1,f.payload=a,i!=null&&(f.callback=i),a=ba(n,f,c),a!==null&&(dn(a,n,c),wo(a,n,c))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var i=Cn(),c=ya(i);c.tag=2,a!=null&&(c.callback=a),a=ba(n,c,i),a!==null&&(dn(a,n,i),wo(a,n,i))}};function ry(n,a,i,c,f,p,x){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(c,p,x):a.prototype&&a.prototype.isPureReactComponent?!fo(i,c)||!fo(f,p):!0}function ay(n,a,i,c){n=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(i,c),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(i,c),a.state!==n&&Bf.enqueueReplaceState(a,a.state,null)}function hs(n,a){var i=a;if("ref"in a){i={};for(var c in a)c!=="ref"&&(i[c]=a[c])}if(n=n.defaultProps){i===a&&(i=g({},i));for(var f in n)i[f]===void 0&&(i[f]=n[f])}return i}function sy(n){Xl(n)}function iy(n){console.error(n)}function oy(n){Xl(n)}function bc(n,a){try{var i=n.onUncaughtError;i(a.value,{componentStack:a.stack})}catch(c){setTimeout(function(){throw c})}}function ly(n,a,i){try{var c=n.onCaughtError;c(i.value,{componentStack:i.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Hf(n,a,i){return i=ya(i),i.tag=3,i.payload={element:null},i.callback=function(){bc(n,a)},i}function cy(n){return n=ya(n),n.tag=3,n}function uy(n,a,i,c){var f=i.type.getDerivedStateFromError;if(typeof f=="function"){var p=c.value;n.payload=function(){return f(p)},n.callback=function(){ly(a,i,c)}}var x=i.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(n.callback=function(){ly(a,i,c),typeof f!="function"&&(Ca===null?Ca=new Set([this]):Ca.add(this));var R=c.stack;this.componentDidCatch(c.value,{componentStack:R!==null?R:""})})}function TR(n,a,i,c,f){if(i.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(a=i.alternate,a!==null&&ei(a,i,f,!0),i=xn.current,i!==null){switch(i.tag){case 31:case 13:return zn===null?jc():i.alternate===null&&mt===0&&(mt=3),i.flags&=-257,i.flags|=65536,i.lanes=f,c===ic?i.flags|=16384:(a=i.updateQueue,a===null?i.updateQueue=new Set([c]):a.add(c),hh(n,c,f)),!1;case 22:return i.flags|=65536,c===ic?i.flags|=16384:(a=i.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([c])},i.updateQueue=a):(i=a.retryQueue,i===null?a.retryQueue=new Set([c]):i.add(c)),hh(n,c,f)),!1}throw Error(s(435,i.tag))}return hh(n,c,f),jc(),!1}if($e)return a=xn.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=f,c!==of&&(n=Error(s(422),{cause:c}),po(Mn(n,i)))):(c!==of&&(a=Error(s(423),{cause:c}),po(Mn(a,i))),n=n.current.alternate,n.flags|=65536,f&=-f,n.lanes|=f,c=Mn(c,i),f=Hf(n.stateNode,c,f),yf(n,f),mt!==4&&(mt=2)),!1;var p=Error(s(520),{cause:c});if(p=Mn(p,i),Do===null?Do=[p]:Do.push(p),mt!==4&&(mt=2),a===null)return!0;c=Mn(c,i),i=a;do{switch(i.tag){case 3:return i.flags|=65536,n=f&-f,i.lanes|=n,n=Hf(i.stateNode,c,n),yf(i,n),!1;case 1:if(a=i.type,p=i.stateNode,(i.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Ca===null||!Ca.has(p))))return i.flags|=65536,f&=-f,i.lanes|=f,f=cy(f),uy(f,n,i,c),yf(i,f),!1}i=i.return}while(i!==null);return!1}var qf=Error(s(461)),St=!1;function $t(n,a,i,c){a.child=n===null?mv(a,null,i,c):ds(a,n.child,i,c)}function dy(n,a,i,c,f){i=i.render;var p=a.ref;if("ref"in c){var x={};for(var R in c)R!=="ref"&&(x[R]=c[R])}else x=c;return os(a),c=Ef(n,a,i,x,p,f),R=Cf(),n!==null&&!St?(Rf(n,a,f),Ir(n,a,f)):($e&&R&&af(a),a.flags|=1,$t(n,a,c,f),a.child)}function fy(n,a,i,c,f){if(n===null){var p=i.type;return typeof p=="function"&&!tf(p)&&p.defaultProps===void 0&&i.compare===null?(a.tag=15,a.type=p,hy(n,a,p,c,f)):(n=ec(i.type,null,c,a,a.mode,f),n.ref=a.ref,n.return=a,a.child=n)}if(p=n.child,!Jf(n,f)){var x=p.memoizedProps;if(i=i.compare,i=i!==null?i:fo,i(x,c)&&n.ref===a.ref)return Ir(n,a,f)}return a.flags|=1,n=Mr(p,c),n.ref=a.ref,n.return=a,a.child=n}function hy(n,a,i,c,f){if(n!==null){var p=n.memoizedProps;if(fo(p,c)&&n.ref===a.ref)if(St=!1,a.pendingProps=c=p,Jf(n,f))(n.flags&131072)!==0&&(St=!0);else return a.lanes=n.lanes,Ir(n,a,f)}return Vf(n,a,i,c,f)}function my(n,a,i,c){var f=c.children,p=n!==null?n.memoizedState:null;if(n===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((a.flags&128)!==0){if(p=p!==null?p.baseLanes|i:i,n!==null){for(c=a.child=n.child,f=0;c!==null;)f=f|c.lanes|c.childLanes,c=c.sibling;c=f&~p}else c=0,a.child=null;return py(n,a,p,i,c)}if((i&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},n!==null&&ac(a,p!==null?p.cachePool:null),p!==null?vv(a,p):wf(),yv(a);else return c=a.lanes=536870912,py(n,a,p!==null?p.baseLanes|i:i,i,c)}else p!==null?(ac(a,p.cachePool),vv(a,p),xa(),a.memoizedState=null):(n!==null&&ac(a,null),wf(),xa());return $t(n,a,f,i),a.child}function To(n,a){return n!==null&&n.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function py(n,a,i,c,f){var p=mf();return p=p===null?null:{parent:xt._currentValue,pool:p},a.memoizedState={baseLanes:i,cachePool:p},n!==null&&ac(a,null),wf(),yv(a),n!==null&&ei(n,a,c,!0),a.childLanes=f,null}function wc(n,a){return a=_c({mode:a.mode,children:a.children},n.mode),a.ref=n.ref,n.child=a,a.return=n,a}function gy(n,a,i){return ds(a,n.child,null,i),n=wc(a,a.pendingProps),n.flags|=2,_n(a),a.memoizedState=null,n}function AR(n,a,i){var c=a.pendingProps,f=(a.flags&128)!==0;if(a.flags&=-129,n===null){if($e){if(c.mode==="hidden")return n=wc(a,c),a.lanes=536870912,To(null,n);if(_f(a),(n=st)?(n=Ab(n,Pn),n=n!==null&&n.data==="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:ha!==null?{id:dr,overflow:fr}:null,retryLane:536870912,hydrationErrors:null},i=Zg(n),i.return=a,a.child=i,Ut=a,st=null)):n=null,n===null)throw pa(a);return a.lanes=536870912,null}return wc(a,c)}var p=n.memoizedState;if(p!==null){var x=p.dehydrated;if(_f(a),f)if(a.flags&256)a.flags&=-257,a=gy(n,a,i);else if(a.memoizedState!==null)a.child=n.child,a.flags|=128,a=null;else throw Error(s(558));else if(St||ei(n,a,i,!1),f=(i&n.childLanes)!==0,St||f){if(c=tt,c!==null&&(x=rn(c,i),x!==0&&x!==p.retryLane))throw p.retryLane=x,rs(n,x),dn(c,n,x),qf;jc(),a=gy(n,a,i)}else n=p.treeContext,st=Un(x.nextSibling),Ut=a,$e=!0,ma=null,Pn=!1,n!==null&&nv(a,n),a=wc(a,c),a.flags|=4096;return a}return n=Mr(n.child,{mode:c.mode,children:c.children}),n.ref=a.ref,a.child=n,n.return=a,n}function xc(n,a){var i=a.ref;if(i===null)n!==null&&n.ref!==null&&(a.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(s(284));(n===null||n.ref!==i)&&(a.flags|=4194816)}}function Vf(n,a,i,c,f){return os(a),i=Ef(n,a,i,c,void 0,f),c=Cf(),n!==null&&!St?(Rf(n,a,f),Ir(n,a,f)):($e&&c&&af(a),a.flags|=1,$t(n,a,i,f),a.child)}function vy(n,a,i,c,f,p){return os(a),a.updateQueue=null,i=wv(a,c,i,f),bv(n),c=Cf(),n!==null&&!St?(Rf(n,a,p),Ir(n,a,p)):($e&&c&&af(a),a.flags|=1,$t(n,a,i,p),a.child)}function yy(n,a,i,c,f){if(os(a),a.stateNode===null){var p=Xs,x=i.contextType;typeof x=="object"&&x!==null&&(p=It(x)),p=new i(c,p),a.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Bf,a.stateNode=p,p._reactInternals=a,p=a.stateNode,p.props=c,p.state=a.memoizedState,p.refs={},gf(a),x=i.contextType,p.context=typeof x=="object"&&x!==null?It(x):Xs,p.state=a.memoizedState,x=i.getDerivedStateFromProps,typeof x=="function"&&($f(a,i,x,c),p.state=a.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(x=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),x!==p.state&&Bf.enqueueReplaceState(p,p.state,null),_o(a,c,p,f),xo(),p.state=a.memoizedState),typeof p.componentDidMount=="function"&&(a.flags|=4194308),c=!0}else if(n===null){p=a.stateNode;var R=a.memoizedProps,O=hs(i,R);p.props=O;var q=p.context,Z=i.contextType;x=Xs,typeof Z=="object"&&Z!==null&&(x=It(Z));var ne=i.getDerivedStateFromProps;Z=typeof ne=="function"||typeof p.getSnapshotBeforeUpdate=="function",R=a.pendingProps!==R,Z||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(R||q!==x)&&ay(a,p,c,x),va=!1;var G=a.memoizedState;p.state=G,_o(a,c,p,f),xo(),q=a.memoizedState,R||G!==q||va?(typeof ne=="function"&&($f(a,i,ne,c),q=a.memoizedState),(O=va||ry(a,i,O,c,G,q,x))?(Z||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(a.flags|=4194308)):(typeof p.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=c,a.memoizedState=q),p.props=c,p.state=q,p.context=x,c=O):(typeof p.componentDidMount=="function"&&(a.flags|=4194308),c=!1)}else{p=a.stateNode,vf(n,a),x=a.memoizedProps,Z=hs(i,x),p.props=Z,ne=a.pendingProps,G=p.context,q=i.contextType,O=Xs,typeof q=="object"&&q!==null&&(O=It(q)),R=i.getDerivedStateFromProps,(q=typeof R=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(x!==ne||G!==O)&&ay(a,p,c,O),va=!1,G=a.memoizedState,p.state=G,_o(a,c,p,f),xo();var Y=a.memoizedState;x!==ne||G!==Y||va||n!==null&&n.dependencies!==null&&nc(n.dependencies)?(typeof R=="function"&&($f(a,i,R,c),Y=a.memoizedState),(Z=va||ry(a,i,Z,c,G,Y,O)||n!==null&&n.dependencies!==null&&nc(n.dependencies))?(q||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(c,Y,O),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(c,Y,O)),typeof p.componentDidUpdate=="function"&&(a.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof p.componentDidUpdate!="function"||x===n.memoizedProps&&G===n.memoizedState||(a.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&G===n.memoizedState||(a.flags|=1024),a.memoizedProps=c,a.memoizedState=Y),p.props=c,p.state=Y,p.context=O,c=Z):(typeof p.componentDidUpdate!="function"||x===n.memoizedProps&&G===n.memoizedState||(a.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&G===n.memoizedState||(a.flags|=1024),c=!1)}return p=c,xc(n,a),c=(a.flags&128)!==0,p||c?(p=a.stateNode,i=c&&typeof i.getDerivedStateFromError!="function"?null:p.render(),a.flags|=1,n!==null&&c?(a.child=ds(a,n.child,null,f),a.child=ds(a,null,i,f)):$t(n,a,i,f),a.memoizedState=p.state,n=a.child):n=Ir(n,a,f),n}function by(n,a,i,c){return ss(),a.flags|=256,$t(n,a,i,c),a.child}var Gf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ff(n){return{baseLanes:n,cachePool:lv()}}function Kf(n,a,i){return n=n!==null?n.childLanes&~i:0,a&&(n|=En),n}function wy(n,a,i){var c=a.pendingProps,f=!1,p=(a.flags&128)!==0,x;if((x=p)||(x=n!==null&&n.memoizedState===null?!1:(yt.current&2)!==0),x&&(f=!0,a.flags&=-129),x=(a.flags&32)!==0,a.flags&=-33,n===null){if($e){if(f?wa(a):xa(),(n=st)?(n=Ab(n,Pn),n=n!==null&&n.data!=="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:ha!==null?{id:dr,overflow:fr}:null,retryLane:536870912,hydrationErrors:null},i=Zg(n),i.return=a,a.child=i,Ut=a,st=null)):n=null,n===null)throw pa(a);return Nh(n)?a.lanes=32:a.lanes=536870912,null}var R=c.children;return c=c.fallback,f?(xa(),f=a.mode,R=_c({mode:"hidden",children:R},f),c=as(c,f,i,null),R.return=a,c.return=a,R.sibling=c,a.child=R,c=a.child,c.memoizedState=Ff(i),c.childLanes=Kf(n,x,i),a.memoizedState=Gf,To(null,c)):(wa(a),Yf(a,R))}var O=n.memoizedState;if(O!==null&&(R=O.dehydrated,R!==null)){if(p)a.flags&256?(wa(a),a.flags&=-257,a=Wf(n,a,i)):a.memoizedState!==null?(xa(),a.child=n.child,a.flags|=128,a=null):(xa(),R=c.fallback,f=a.mode,c=_c({mode:"visible",children:c.children},f),R=as(R,f,i,null),R.flags|=2,c.return=a,R.return=a,c.sibling=R,a.child=c,ds(a,n.child,null,i),c=a.child,c.memoizedState=Ff(i),c.childLanes=Kf(n,x,i),a.memoizedState=Gf,a=To(null,c));else if(wa(a),Nh(R)){if(x=R.nextSibling&&R.nextSibling.dataset,x)var q=x.dgst;x=q,c=Error(s(419)),c.stack="",c.digest=x,po({value:c,source:null,stack:null}),a=Wf(n,a,i)}else if(St||ei(n,a,i,!1),x=(i&n.childLanes)!==0,St||x){if(x=tt,x!==null&&(c=rn(x,i),c!==0&&c!==O.retryLane))throw O.retryLane=c,rs(n,c),dn(x,n,c),qf;Ah(R)||jc(),a=Wf(n,a,i)}else Ah(R)?(a.flags|=192,a.child=n.child,a=null):(n=O.treeContext,st=Un(R.nextSibling),Ut=a,$e=!0,ma=null,Pn=!1,n!==null&&nv(a,n),a=Yf(a,c.children),a.flags|=4096);return a}return f?(xa(),R=c.fallback,f=a.mode,O=n.child,q=O.sibling,c=Mr(O,{mode:"hidden",children:c.children}),c.subtreeFlags=O.subtreeFlags&65011712,q!==null?R=Mr(q,R):(R=as(R,f,i,null),R.flags|=2),R.return=a,c.return=a,c.sibling=R,a.child=c,To(null,c),c=a.child,R=n.child.memoizedState,R===null?R=Ff(i):(f=R.cachePool,f!==null?(O=xt._currentValue,f=f.parent!==O?{parent:O,pool:O}:f):f=lv(),R={baseLanes:R.baseLanes|i,cachePool:f}),c.memoizedState=R,c.childLanes=Kf(n,x,i),a.memoizedState=Gf,To(n.child,c)):(wa(a),i=n.child,n=i.sibling,i=Mr(i,{mode:"visible",children:c.children}),i.return=a,i.sibling=null,n!==null&&(x=a.deletions,x===null?(a.deletions=[n],a.flags|=16):x.push(n)),a.child=i,a.memoizedState=null,i)}function Yf(n,a){return a=_c({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function _c(n,a){return n=wn(22,n,null,a),n.lanes=0,n}function Wf(n,a,i){return ds(a,n.child,null,i),n=Yf(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function xy(n,a,i){n.lanes|=a;var c=n.alternate;c!==null&&(c.lanes|=a),uf(n.return,a,i)}function Xf(n,a,i,c,f,p){var x=n.memoizedState;x===null?n.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:c,tail:i,tailMode:f,treeForkCount:p}:(x.isBackwards=a,x.rendering=null,x.renderingStartTime=0,x.last=c,x.tail=i,x.tailMode=f,x.treeForkCount=p)}function _y(n,a,i){var c=a.pendingProps,f=c.revealOrder,p=c.tail;c=c.children;var x=yt.current,R=(x&2)!==0;if(R?(x=x&1|2,a.flags|=128):x&=1,$(yt,x),$t(n,a,c,i),c=$e?mo:0,!R&&n!==null&&(n.flags&128)!==0)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&xy(n,i,a);else if(n.tag===19)xy(n,i,a);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===a)break e;for(;n.sibling===null;){if(n.return===null||n.return===a)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(f){case"forwards":for(i=a.child,f=null;i!==null;)n=i.alternate,n!==null&&uc(n)===null&&(f=i),i=i.sibling;i=f,i===null?(f=a.child,a.child=null):(f=i.sibling,i.sibling=null),Xf(a,!1,f,i,p,c);break;case"backwards":case"unstable_legacy-backwards":for(i=null,f=a.child,a.child=null;f!==null;){if(n=f.alternate,n!==null&&uc(n)===null){a.child=f;break}n=f.sibling,f.sibling=i,i=f,f=n}Xf(a,!0,i,null,p,c);break;case"together":Xf(a,!1,null,null,void 0,c);break;default:a.memoizedState=null}return a.child}function Ir(n,a,i){if(n!==null&&(a.dependencies=n.dependencies),Ea|=a.lanes,(i&a.childLanes)===0)if(n!==null){if(ei(n,a,i,!1),(i&a.childLanes)===0)return null}else return null;if(n!==null&&a.child!==n.child)throw Error(s(153));if(a.child!==null){for(n=a.child,i=Mr(n,n.pendingProps),a.child=i,i.return=a;n.sibling!==null;)n=n.sibling,i=i.sibling=Mr(n,n.pendingProps),i.return=a;i.sibling=null}return a.child}function Jf(n,a){return(n.lanes&a)!==0?!0:(n=n.dependencies,!!(n!==null&&nc(n)))}function NR(n,a,i){switch(a.tag){case 3:se(a,a.stateNode.containerInfo),ga(a,xt,n.memoizedState.cache),ss();break;case 27:case 5:ue(a);break;case 4:se(a,a.stateNode.containerInfo);break;case 10:ga(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,_f(a),null;break;case 13:var c=a.memoizedState;if(c!==null)return c.dehydrated!==null?(wa(a),a.flags|=128,null):(i&a.child.childLanes)!==0?wy(n,a,i):(wa(a),n=Ir(n,a,i),n!==null?n.sibling:null);wa(a);break;case 19:var f=(n.flags&128)!==0;if(c=(i&a.childLanes)!==0,c||(ei(n,a,i,!1),c=(i&a.childLanes)!==0),f){if(c)return _y(n,a,i);a.flags|=128}if(f=a.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),$(yt,yt.current),c)break;return null;case 22:return a.lanes=0,my(n,a,i,a.pendingProps);case 24:ga(a,xt,n.memoizedState.cache)}return Ir(n,a,i)}function Sy(n,a,i){if(n!==null)if(n.memoizedProps!==a.pendingProps)St=!0;else{if(!Jf(n,i)&&(a.flags&128)===0)return St=!1,NR(n,a,i);St=(n.flags&131072)!==0}else St=!1,$e&&(a.flags&1048576)!==0&&tv(a,mo,a.index);switch(a.lanes=0,a.tag){case 16:e:{var c=a.pendingProps;if(n=cs(a.elementType),a.type=n,typeof n=="function")tf(n)?(c=hs(n,c),a.tag=1,a=yy(null,a,n,c,i)):(a.tag=0,a=Vf(null,a,n,c,i));else{if(n!=null){var f=n.$$typeof;if(f===z){a.tag=11,a=dy(null,a,n,c,i);break e}else if(f===P){a.tag=14,a=fy(null,a,n,c,i);break e}}throw a=me(n)||n,Error(s(306,a,""))}}return a;case 0:return Vf(n,a,a.type,a.pendingProps,i);case 1:return c=a.type,f=hs(c,a.pendingProps),yy(n,a,c,f,i);case 3:e:{if(se(a,a.stateNode.containerInfo),n===null)throw Error(s(387));c=a.pendingProps;var p=a.memoizedState;f=p.element,vf(n,a),_o(a,c,null,i);var x=a.memoizedState;if(c=x.cache,ga(a,xt,c),c!==p.cache&&df(a,[xt],i,!0),xo(),c=x.element,p.isDehydrated)if(p={element:c,isDehydrated:!1,cache:x.cache},a.updateQueue.baseState=p,a.memoizedState=p,a.flags&256){a=by(n,a,c,i);break e}else if(c!==f){f=Mn(Error(s(424)),a),po(f),a=by(n,a,c,i);break e}else{switch(n=a.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(st=Un(n.firstChild),Ut=a,$e=!0,ma=null,Pn=!0,i=mv(a,null,c,i),a.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(ss(),c===f){a=Ir(n,a,i);break e}$t(n,a,c,i)}a=a.child}return a;case 26:return xc(n,a),n===null?(i=Db(a.type,null,a.pendingProps,null))?a.memoizedState=i:$e||(i=a.type,n=a.pendingProps,c=Uc(X.current).createElement(i),c[zt]=a,c[an]=n,Bt(c,i,n),Ot(c),a.stateNode=c):a.memoizedState=Db(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return ue(a),n===null&&$e&&(c=a.stateNode=jb(a.type,a.pendingProps,X.current),Ut=a,Pn=!0,f=st,Na(a.type)?(kh=f,st=Un(c.firstChild)):st=f),$t(n,a,a.pendingProps.children,i),xc(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&$e&&((f=c=st)&&(c=sT(c,a.type,a.pendingProps,Pn),c!==null?(a.stateNode=c,Ut=a,st=Un(c.firstChild),Pn=!1,f=!0):f=!1),f||pa(a)),ue(a),f=a.type,p=a.pendingProps,x=n!==null?n.memoizedProps:null,c=p.children,Ch(f,p)?c=null:x!==null&&Ch(f,x)&&(a.flags|=32),a.memoizedState!==null&&(f=Ef(n,a,wR,null,null,i),Ho._currentValue=f),xc(n,a),$t(n,a,c,i),a.child;case 6:return n===null&&$e&&((n=i=st)&&(i=iT(i,a.pendingProps,Pn),i!==null?(a.stateNode=i,Ut=a,st=null,n=!0):n=!1),n||pa(a)),null;case 13:return wy(n,a,i);case 4:return se(a,a.stateNode.containerInfo),c=a.pendingProps,n===null?a.child=ds(a,null,c,i):$t(n,a,c,i),a.child;case 11:return dy(n,a,a.type,a.pendingProps,i);case 7:return $t(n,a,a.pendingProps,i),a.child;case 8:return $t(n,a,a.pendingProps.children,i),a.child;case 12:return $t(n,a,a.pendingProps.children,i),a.child;case 10:return c=a.pendingProps,ga(a,a.type,c.value),$t(n,a,c.children,i),a.child;case 9:return f=a.type._context,c=a.pendingProps.children,os(a),f=It(f),c=c(f),a.flags|=1,$t(n,a,c,i),a.child;case 14:return fy(n,a,a.type,a.pendingProps,i);case 15:return hy(n,a,a.type,a.pendingProps,i);case 19:return _y(n,a,i);case 31:return AR(n,a,i);case 22:return my(n,a,i,a.pendingProps);case 24:return os(a),c=It(xt),n===null?(f=mf(),f===null&&(f=tt,p=ff(),f.pooledCache=p,p.refCount++,p!==null&&(f.pooledCacheLanes|=i),f=p),a.memoizedState={parent:c,cache:f},gf(a),ga(a,xt,f)):((n.lanes&i)!==0&&(vf(n,a),_o(a,null,null,i),xo()),f=n.memoizedState,p=a.memoizedState,f.parent!==c?(f={parent:c,cache:c},a.memoizedState=f,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=f),ga(a,xt,c)):(c=p.cache,ga(a,xt,c),c!==f.cache&&df(a,[xt],i,!0))),$t(n,a,a.pendingProps.children,i),a.child;case 29:throw a.pendingProps}throw Error(s(156,a.tag))}function $r(n){n.flags|=4}function Qf(n,a,i,c,f){if((a=(n.mode&32)!==0)&&(a=!1),a){if(n.flags|=16777216,(f&335544128)===f)if(n.stateNode.complete)n.flags|=8192;else if(Xy())n.flags|=8192;else throw us=ic,pf}else n.flags&=-16777217}function Ey(n,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Ib(a))if(Xy())n.flags|=8192;else throw us=ic,pf}function Sc(n,a){a!==null&&(n.flags|=4),n.flags&16384&&(a=n.tag!==22?Kt():536870912,n.lanes|=a,fi|=a)}function Ao(n,a){if(!$e)switch(n.tailMode){case"hidden":a=n.tail;for(var i=null;a!==null;)a.alternate!==null&&(i=a),a=a.sibling;i===null?n.tail=null:i.sibling=null;break;case"collapsed":i=n.tail;for(var c=null;i!==null;)i.alternate!==null&&(c=i),i=i.sibling;c===null?a||n.tail===null?n.tail=null:n.tail.sibling=null:c.sibling=null}}function it(n){var a=n.alternate!==null&&n.alternate.child===n.child,i=0,c=0;if(a)for(var f=n.child;f!==null;)i|=f.lanes|f.childLanes,c|=f.subtreeFlags&65011712,c|=f.flags&65011712,f.return=n,f=f.sibling;else for(f=n.child;f!==null;)i|=f.lanes|f.childLanes,c|=f.subtreeFlags,c|=f.flags,f.return=n,f=f.sibling;return n.subtreeFlags|=c,n.childLanes=i,a}function kR(n,a,i){var c=a.pendingProps;switch(sf(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return it(a),null;case 1:return it(a),null;case 3:return i=a.stateNode,c=null,n!==null&&(c=n.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),Pr(xt),ie(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(Zs(a)?$r(a):n===null||n.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,lf())),it(a),null;case 26:var f=a.type,p=a.memoizedState;return n===null?($r(a),p!==null?(it(a),Ey(a,p)):(it(a),Qf(a,f,null,c,i))):p?p!==n.memoizedState?($r(a),it(a),Ey(a,p)):(it(a),a.flags&=-16777217):(n=n.memoizedProps,n!==c&&$r(a),it(a),Qf(a,f,n,c,i)),null;case 27:if(Ee(a),i=X.current,f=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==c&&$r(a);else{if(!c){if(a.stateNode===null)throw Error(s(166));return it(a),null}n=D.current,Zs(a)?rv(a):(n=jb(f,c,i),a.stateNode=n,$r(a))}return it(a),null;case 5:if(Ee(a),f=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==c&&$r(a);else{if(!c){if(a.stateNode===null)throw Error(s(166));return it(a),null}if(p=D.current,Zs(a))rv(a);else{var x=Uc(X.current);switch(p){case 1:p=x.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:p=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":p=x.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":p=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":p=x.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof c.is=="string"?x.createElement("select",{is:c.is}):x.createElement("select"),c.multiple?p.multiple=!0:c.size&&(p.size=c.size);break;default:p=typeof c.is=="string"?x.createElement(f,{is:c.is}):x.createElement(f)}}p[zt]=a,p[an]=c;e:for(x=a.child;x!==null;){if(x.tag===5||x.tag===6)p.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===a)break e;for(;x.sibling===null;){if(x.return===null||x.return===a)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}a.stateNode=p;e:switch(Bt(p,f,c),f){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&$r(a)}}return it(a),Qf(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,i),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==c&&$r(a);else{if(typeof c!="string"&&a.stateNode===null)throw Error(s(166));if(n=X.current,Zs(a)){if(n=a.stateNode,i=a.memoizedProps,c=null,f=Ut,f!==null)switch(f.tag){case 27:case 5:c=f.memoizedProps}n[zt]=a,n=!!(n.nodeValue===i||c!==null&&c.suppressHydrationWarning===!0||wb(n.nodeValue,i)),n||pa(a,!0)}else n=Uc(n).createTextNode(c),n[zt]=a,a.stateNode=n}return it(a),null;case 31:if(i=a.memoizedState,n===null||n.memoizedState!==null){if(c=Zs(a),i!==null){if(n===null){if(!c)throw Error(s(318));if(n=a.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(557));n[zt]=a}else ss(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;it(a),n=!1}else i=lf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=i),n=!0;if(!n)return a.flags&256?(_n(a),a):(_n(a),null);if((a.flags&128)!==0)throw Error(s(558))}return it(a),null;case 13:if(c=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(f=Zs(a),c!==null&&c.dehydrated!==null){if(n===null){if(!f)throw Error(s(318));if(f=a.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(s(317));f[zt]=a}else ss(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;it(a),f=!1}else f=lf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=f),f=!0;if(!f)return a.flags&256?(_n(a),a):(_n(a),null)}return _n(a),(a.flags&128)!==0?(a.lanes=i,a):(i=c!==null,n=n!==null&&n.memoizedState!==null,i&&(c=a.child,f=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(f=c.alternate.memoizedState.cachePool.pool),p=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(p=c.memoizedState.cachePool.pool),p!==f&&(c.flags|=2048)),i!==n&&i&&(a.child.flags|=8192),Sc(a,a.updateQueue),it(a),null);case 4:return ie(),n===null&&wh(a.stateNode.containerInfo),it(a),null;case 10:return Pr(a.type),it(a),null;case 19:if(j(yt),c=a.memoizedState,c===null)return it(a),null;if(f=(a.flags&128)!==0,p=c.rendering,p===null)if(f)Ao(c,!1);else{if(mt!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(p=uc(n),p!==null){for(a.flags|=128,Ao(c,!1),n=p.updateQueue,a.updateQueue=n,Sc(a,n),a.subtreeFlags=0,n=i,i=a.child;i!==null;)Qg(i,n),i=i.sibling;return $(yt,yt.current&1|2),$e&&Dr(a,c.treeForkCount),a.child}n=n.sibling}c.tail!==null&&vt()>Ac&&(a.flags|=128,f=!0,Ao(c,!1),a.lanes=4194304)}else{if(!f)if(n=uc(p),n!==null){if(a.flags|=128,f=!0,n=n.updateQueue,a.updateQueue=n,Sc(a,n),Ao(c,!0),c.tail===null&&c.tailMode==="hidden"&&!p.alternate&&!$e)return it(a),null}else 2*vt()-c.renderingStartTime>Ac&&i!==536870912&&(a.flags|=128,f=!0,Ao(c,!1),a.lanes=4194304);c.isBackwards?(p.sibling=a.child,a.child=p):(n=c.last,n!==null?n.sibling=p:a.child=p,c.last=p)}return c.tail!==null?(n=c.tail,c.rendering=n,c.tail=n.sibling,c.renderingStartTime=vt(),n.sibling=null,i=yt.current,$(yt,f?i&1|2:i&1),$e&&Dr(a,c.treeForkCount),n):(it(a),null);case 22:case 23:return _n(a),xf(),c=a.memoizedState!==null,n!==null?n.memoizedState!==null!==c&&(a.flags|=8192):c&&(a.flags|=8192),c?(i&536870912)!==0&&(a.flags&128)===0&&(it(a),a.subtreeFlags&6&&(a.flags|=8192)):it(a),i=a.updateQueue,i!==null&&Sc(a,i.retryQueue),i=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),c=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(c=a.memoizedState.cachePool.pool),c!==i&&(a.flags|=2048),n!==null&&j(ls),null;case 24:return i=null,n!==null&&(i=n.memoizedState.cache),a.memoizedState.cache!==i&&(a.flags|=2048),Pr(xt),it(a),null;case 25:return null;case 30:return null}throw Error(s(156,a.tag))}function jR(n,a){switch(sf(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return Pr(xt),ie(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return Ee(a),null;case 31:if(a.memoizedState!==null){if(_n(a),a.alternate===null)throw Error(s(340));ss()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(_n(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(s(340));ss()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return j(yt),null;case 4:return ie(),null;case 10:return Pr(a.type),null;case 22:case 23:return _n(a),xf(),n!==null&&j(ls),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return Pr(xt),null;case 25:return null;default:return null}}function Cy(n,a){switch(sf(a),a.tag){case 3:Pr(xt),ie();break;case 26:case 27:case 5:Ee(a);break;case 4:ie();break;case 31:a.memoizedState!==null&&_n(a);break;case 13:_n(a);break;case 19:j(yt);break;case 10:Pr(a.type);break;case 22:case 23:_n(a),xf(),n!==null&&j(ls);break;case 24:Pr(xt)}}function No(n,a){try{var i=a.updateQueue,c=i!==null?i.lastEffect:null;if(c!==null){var f=c.next;i=f;do{if((i.tag&n)===n){c=void 0;var p=i.create,x=i.inst;c=p(),x.destroy=c}i=i.next}while(i!==f)}}catch(R){Xe(a,a.return,R)}}function _a(n,a,i){try{var c=a.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var p=f.next;c=p;do{if((c.tag&n)===n){var x=c.inst,R=x.destroy;if(R!==void 0){x.destroy=void 0,f=a;var O=i,q=R;try{q()}catch(Z){Xe(f,O,Z)}}}c=c.next}while(c!==p)}}catch(Z){Xe(a,a.return,Z)}}function Ry(n){var a=n.updateQueue;if(a!==null){var i=n.stateNode;try{gv(a,i)}catch(c){Xe(n,n.return,c)}}}function Ty(n,a,i){i.props=hs(n.type,n.memoizedProps),i.state=n.memoizedState;try{i.componentWillUnmount()}catch(c){Xe(n,a,c)}}function ko(n,a){try{var i=n.ref;if(i!==null){switch(n.tag){case 26:case 27:case 5:var c=n.stateNode;break;case 30:c=n.stateNode;break;default:c=n.stateNode}typeof i=="function"?n.refCleanup=i(c):i.current=c}}catch(f){Xe(n,a,f)}}function hr(n,a){var i=n.ref,c=n.refCleanup;if(i!==null)if(typeof c=="function")try{c()}catch(f){Xe(n,a,f)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(f){Xe(n,a,f)}else i.current=null}function Ay(n){var a=n.type,i=n.memoizedProps,c=n.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":i.autoFocus&&c.focus();break e;case"img":i.src?c.src=i.src:i.srcSet&&(c.srcset=i.srcSet)}}catch(f){Xe(n,n.return,f)}}function Zf(n,a,i){try{var c=n.stateNode;ZR(c,n.type,i,a),c[an]=a}catch(f){Xe(n,n.return,f)}}function Ny(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Na(n.type)||n.tag===4}function eh(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Ny(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Na(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function th(n,a,i){var c=n.tag;if(c===5||c===6)n=n.stateNode,a?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(n,a):(a=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.appendChild(n),i=i._reactRootContainer,i!=null||a.onclick!==null||(a.onclick=jr));else if(c!==4&&(c===27&&Na(n.type)&&(i=n.stateNode,a=null),n=n.child,n!==null))for(th(n,a,i),n=n.sibling;n!==null;)th(n,a,i),n=n.sibling}function Ec(n,a,i){var c=n.tag;if(c===5||c===6)n=n.stateNode,a?i.insertBefore(n,a):i.appendChild(n);else if(c!==4&&(c===27&&Na(n.type)&&(i=n.stateNode),n=n.child,n!==null))for(Ec(n,a,i),n=n.sibling;n!==null;)Ec(n,a,i),n=n.sibling}function ky(n){var a=n.stateNode,i=n.memoizedProps;try{for(var c=n.type,f=a.attributes;f.length;)a.removeAttributeNode(f[0]);Bt(a,c,i),a[zt]=n,a[an]=i}catch(p){Xe(n,n.return,p)}}var Br=!1,Et=!1,nh=!1,jy=typeof WeakSet=="function"?WeakSet:Set,Mt=null;function OR(n,a){if(n=n.containerInfo,Sh=Gc,n=qg(n),Yd(n)){if("selectionStart"in n)var i={start:n.selectionStart,end:n.selectionEnd};else e:{i=(i=n.ownerDocument)&&i.defaultView||window;var c=i.getSelection&&i.getSelection();if(c&&c.rangeCount!==0){i=c.anchorNode;var f=c.anchorOffset,p=c.focusNode;c=c.focusOffset;try{i.nodeType,p.nodeType}catch{i=null;break e}var x=0,R=-1,O=-1,q=0,Z=0,ne=n,G=null;t:for(;;){for(var Y;ne!==i||f!==0&&ne.nodeType!==3||(R=x+f),ne!==p||c!==0&&ne.nodeType!==3||(O=x+c),ne.nodeType===3&&(x+=ne.nodeValue.length),(Y=ne.firstChild)!==null;)G=ne,ne=Y;for(;;){if(ne===n)break t;if(G===i&&++q===f&&(R=x),G===p&&++Z===c&&(O=x),(Y=ne.nextSibling)!==null)break;ne=G,G=ne.parentNode}ne=Y}i=R===-1||O===-1?null:{start:R,end:O}}else i=null}i=i||{start:0,end:0}}else i=null;for(Eh={focusedElem:n,selectionRange:i},Gc=!1,Mt=a;Mt!==null;)if(a=Mt,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,Mt=n;else for(;Mt!==null;){switch(a=Mt,p=a.alternate,n=a.flags,a.tag){case 0:if((n&4)!==0&&(n=a.updateQueue,n=n!==null?n.events:null,n!==null))for(i=0;i<n.length;i++)f=n[i],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&p!==null){n=void 0,i=a,f=p.memoizedProps,p=p.memoizedState,c=i.stateNode;try{var be=hs(i.type,f);n=c.getSnapshotBeforeUpdate(be,p),c.__reactInternalSnapshotBeforeUpdate=n}catch(Ae){Xe(i,i.return,Ae)}}break;case 3:if((n&1024)!==0){if(n=a.stateNode.containerInfo,i=n.nodeType,i===9)Th(n);else if(i===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Th(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(s(163))}if(n=a.sibling,n!==null){n.return=a.return,Mt=n;break}Mt=a.return}}function Oy(n,a,i){var c=i.flags;switch(i.tag){case 0:case 11:case 15:qr(n,i),c&4&&No(5,i);break;case 1:if(qr(n,i),c&4)if(n=i.stateNode,a===null)try{n.componentDidMount()}catch(x){Xe(i,i.return,x)}else{var f=hs(i.type,a.memoizedProps);a=a.memoizedState;try{n.componentDidUpdate(f,a,n.__reactInternalSnapshotBeforeUpdate)}catch(x){Xe(i,i.return,x)}}c&64&&Ry(i),c&512&&ko(i,i.return);break;case 3:if(qr(n,i),c&64&&(n=i.updateQueue,n!==null)){if(a=null,i.child!==null)switch(i.child.tag){case 27:case 5:a=i.child.stateNode;break;case 1:a=i.child.stateNode}try{gv(n,a)}catch(x){Xe(i,i.return,x)}}break;case 27:a===null&&c&4&&ky(i);case 26:case 5:qr(n,i),a===null&&c&4&&Ay(i),c&512&&ko(i,i.return);break;case 12:qr(n,i);break;case 31:qr(n,i),c&4&&Ly(n,i);break;case 13:qr(n,i),c&4&&Py(n,i),c&64&&(n=i.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(i=BR.bind(null,i),oT(n,i))));break;case 22:if(c=i.memoizedState!==null||Br,!c){a=a!==null&&a.memoizedState!==null||Et,f=Br;var p=Et;Br=c,(Et=a)&&!p?Vr(n,i,(i.subtreeFlags&8772)!==0):qr(n,i),Br=f,Et=p}break;case 30:break;default:qr(n,i)}}function My(n){var a=n.alternate;a!==null&&(n.alternate=null,My(a)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(a=n.stateNode,a!==null&&jd(a)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var lt=null,on=!1;function Hr(n,a,i){for(i=i.child;i!==null;)Dy(n,a,i),i=i.sibling}function Dy(n,a,i){if(Pt&&typeof Pt.onCommitFiberUnmount=="function")try{Pt.onCommitFiberUnmount(ur,i)}catch{}switch(i.tag){case 26:Et||hr(i,a),Hr(n,a,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:Et||hr(i,a);var c=lt,f=on;Na(i.type)&&(lt=i.stateNode,on=!1),Hr(n,a,i),Io(i.stateNode),lt=c,on=f;break;case 5:Et||hr(i,a);case 6:if(c=lt,f=on,lt=null,Hr(n,a,i),lt=c,on=f,lt!==null)if(on)try{(lt.nodeType===9?lt.body:lt.nodeName==="HTML"?lt.ownerDocument.body:lt).removeChild(i.stateNode)}catch(p){Xe(i,a,p)}else try{lt.removeChild(i.stateNode)}catch(p){Xe(i,a,p)}break;case 18:lt!==null&&(on?(n=lt,Rb(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,i.stateNode),wi(n)):Rb(lt,i.stateNode));break;case 4:c=lt,f=on,lt=i.stateNode.containerInfo,on=!0,Hr(n,a,i),lt=c,on=f;break;case 0:case 11:case 14:case 15:_a(2,i,a),Et||_a(4,i,a),Hr(n,a,i);break;case 1:Et||(hr(i,a),c=i.stateNode,typeof c.componentWillUnmount=="function"&&Ty(i,a,c)),Hr(n,a,i);break;case 21:Hr(n,a,i);break;case 22:Et=(c=Et)||i.memoizedState!==null,Hr(n,a,i),Et=c;break;default:Hr(n,a,i)}}function Ly(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{wi(n)}catch(i){Xe(a,a.return,i)}}}function Py(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{wi(n)}catch(i){Xe(a,a.return,i)}}function MR(n){switch(n.tag){case 31:case 13:case 19:var a=n.stateNode;return a===null&&(a=n.stateNode=new jy),a;case 22:return n=n.stateNode,a=n._retryCache,a===null&&(a=n._retryCache=new jy),a;default:throw Error(s(435,n.tag))}}function Cc(n,a){var i=MR(n);a.forEach(function(c){if(!i.has(c)){i.add(c);var f=HR.bind(null,n,c);c.then(f,f)}})}function ln(n,a){var i=a.deletions;if(i!==null)for(var c=0;c<i.length;c++){var f=i[c],p=n,x=a,R=x;e:for(;R!==null;){switch(R.tag){case 27:if(Na(R.type)){lt=R.stateNode,on=!1;break e}break;case 5:lt=R.stateNode,on=!1;break e;case 3:case 4:lt=R.stateNode.containerInfo,on=!0;break e}R=R.return}if(lt===null)throw Error(s(160));Dy(p,x,f),lt=null,on=!1,p=f.alternate,p!==null&&(p.return=null),f.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)zy(a,n),a=a.sibling}var Yn=null;function zy(n,a){var i=n.alternate,c=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:ln(a,n),cn(n),c&4&&(_a(3,n,n.return),No(3,n),_a(5,n,n.return));break;case 1:ln(a,n),cn(n),c&512&&(Et||i===null||hr(i,i.return)),c&64&&Br&&(n=n.updateQueue,n!==null&&(c=n.callbacks,c!==null&&(i=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=i===null?c:i.concat(c))));break;case 26:var f=Yn;if(ln(a,n),cn(n),c&512&&(Et||i===null||hr(i,i.return)),c&4){var p=i!==null?i.memoizedState:null;if(c=n.memoizedState,i===null)if(c===null)if(n.stateNode===null){e:{c=n.type,i=n.memoizedProps,f=f.ownerDocument||f;t:switch(c){case"title":p=f.getElementsByTagName("title")[0],(!p||p[no]||p[zt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=f.createElement(c),f.head.insertBefore(p,f.querySelector("head > title"))),Bt(p,c,i),p[zt]=n,Ot(p),c=p;break e;case"link":var x=zb("link","href",f).get(c+(i.href||""));if(x){for(var R=0;R<x.length;R++)if(p=x[R],p.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&p.getAttribute("rel")===(i.rel==null?null:i.rel)&&p.getAttribute("title")===(i.title==null?null:i.title)&&p.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){x.splice(R,1);break t}}p=f.createElement(c),Bt(p,c,i),f.head.appendChild(p);break;case"meta":if(x=zb("meta","content",f).get(c+(i.content||""))){for(R=0;R<x.length;R++)if(p=x[R],p.getAttribute("content")===(i.content==null?null:""+i.content)&&p.getAttribute("name")===(i.name==null?null:i.name)&&p.getAttribute("property")===(i.property==null?null:i.property)&&p.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&p.getAttribute("charset")===(i.charSet==null?null:i.charSet)){x.splice(R,1);break t}}p=f.createElement(c),Bt(p,c,i),f.head.appendChild(p);break;default:throw Error(s(468,c))}p[zt]=n,Ot(p),c=p}n.stateNode=c}else Ub(f,n.type,n.stateNode);else n.stateNode=Pb(f,c,n.memoizedProps);else p!==c?(p===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):p.count--,c===null?Ub(f,n.type,n.stateNode):Pb(f,c,n.memoizedProps)):c===null&&n.stateNode!==null&&Zf(n,n.memoizedProps,i.memoizedProps)}break;case 27:ln(a,n),cn(n),c&512&&(Et||i===null||hr(i,i.return)),i!==null&&c&4&&Zf(n,n.memoizedProps,i.memoizedProps);break;case 5:if(ln(a,n),cn(n),c&512&&(Et||i===null||hr(i,i.return)),n.flags&32){f=n.stateNode;try{qs(f,"")}catch(be){Xe(n,n.return,be)}}c&4&&n.stateNode!=null&&(f=n.memoizedProps,Zf(n,f,i!==null?i.memoizedProps:f)),c&1024&&(nh=!0);break;case 6:if(ln(a,n),cn(n),c&4){if(n.stateNode===null)throw Error(s(162));c=n.memoizedProps,i=n.stateNode;try{i.nodeValue=c}catch(be){Xe(n,n.return,be)}}break;case 3:if(Bc=null,f=Yn,Yn=Ic(a.containerInfo),ln(a,n),Yn=f,cn(n),c&4&&i!==null&&i.memoizedState.isDehydrated)try{wi(a.containerInfo)}catch(be){Xe(n,n.return,be)}nh&&(nh=!1,Uy(n));break;case 4:c=Yn,Yn=Ic(n.stateNode.containerInfo),ln(a,n),cn(n),Yn=c;break;case 12:ln(a,n),cn(n);break;case 31:ln(a,n),cn(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Cc(n,c)));break;case 13:ln(a,n),cn(n),n.child.flags&8192&&n.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Tc=vt()),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Cc(n,c)));break;case 22:f=n.memoizedState!==null;var O=i!==null&&i.memoizedState!==null,q=Br,Z=Et;if(Br=q||f,Et=Z||O,ln(a,n),Et=Z,Br=q,cn(n),c&8192)e:for(a=n.stateNode,a._visibility=f?a._visibility&-2:a._visibility|1,f&&(i===null||O||Br||Et||ms(n)),i=null,a=n;;){if(a.tag===5||a.tag===26){if(i===null){O=i=a;try{if(p=O.stateNode,f)x=p.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{R=O.stateNode;var ne=O.memoizedProps.style,G=ne!=null&&ne.hasOwnProperty("display")?ne.display:null;R.style.display=G==null||typeof G=="boolean"?"":(""+G).trim()}}catch(be){Xe(O,O.return,be)}}}else if(a.tag===6){if(i===null){O=a;try{O.stateNode.nodeValue=f?"":O.memoizedProps}catch(be){Xe(O,O.return,be)}}}else if(a.tag===18){if(i===null){O=a;try{var Y=O.stateNode;f?Tb(Y,!0):Tb(O.stateNode,!1)}catch(be){Xe(O,O.return,be)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===n)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break e;for(;a.sibling===null;){if(a.return===null||a.return===n)break e;i===a&&(i=null),a=a.return}i===a&&(i=null),a.sibling.return=a.return,a=a.sibling}c&4&&(c=n.updateQueue,c!==null&&(i=c.retryQueue,i!==null&&(c.retryQueue=null,Cc(n,i))));break;case 19:ln(a,n),cn(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Cc(n,c)));break;case 30:break;case 21:break;default:ln(a,n),cn(n)}}function cn(n){var a=n.flags;if(a&2){try{for(var i,c=n.return;c!==null;){if(Ny(c)){i=c;break}c=c.return}if(i==null)throw Error(s(160));switch(i.tag){case 27:var f=i.stateNode,p=eh(n);Ec(n,p,f);break;case 5:var x=i.stateNode;i.flags&32&&(qs(x,""),i.flags&=-33);var R=eh(n);Ec(n,R,x);break;case 3:case 4:var O=i.stateNode.containerInfo,q=eh(n);th(n,q,O);break;default:throw Error(s(161))}}catch(Z){Xe(n,n.return,Z)}n.flags&=-3}a&4096&&(n.flags&=-4097)}function Uy(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var a=n;Uy(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),n=n.sibling}}function qr(n,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Oy(n,a.alternate,a),a=a.sibling}function ms(n){for(n=n.child;n!==null;){var a=n;switch(a.tag){case 0:case 11:case 14:case 15:_a(4,a,a.return),ms(a);break;case 1:hr(a,a.return);var i=a.stateNode;typeof i.componentWillUnmount=="function"&&Ty(a,a.return,i),ms(a);break;case 27:Io(a.stateNode);case 26:case 5:hr(a,a.return),ms(a);break;case 22:a.memoizedState===null&&ms(a);break;case 30:ms(a);break;default:ms(a)}n=n.sibling}}function Vr(n,a,i){for(i=i&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var c=a.alternate,f=n,p=a,x=p.flags;switch(p.tag){case 0:case 11:case 15:Vr(f,p,i),No(4,p);break;case 1:if(Vr(f,p,i),c=p,f=c.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(q){Xe(c,c.return,q)}if(c=p,f=c.updateQueue,f!==null){var R=c.stateNode;try{var O=f.shared.hiddenCallbacks;if(O!==null)for(f.shared.hiddenCallbacks=null,f=0;f<O.length;f++)pv(O[f],R)}catch(q){Xe(c,c.return,q)}}i&&x&64&&Ry(p),ko(p,p.return);break;case 27:ky(p);case 26:case 5:Vr(f,p,i),i&&c===null&&x&4&&Ay(p),ko(p,p.return);break;case 12:Vr(f,p,i);break;case 31:Vr(f,p,i),i&&x&4&&Ly(f,p);break;case 13:Vr(f,p,i),i&&x&4&&Py(f,p);break;case 22:p.memoizedState===null&&Vr(f,p,i),ko(p,p.return);break;case 30:break;default:Vr(f,p,i)}a=a.sibling}}function rh(n,a){var i=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==i&&(n!=null&&n.refCount++,i!=null&&go(i))}function ah(n,a){n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&go(n))}function Wn(n,a,i,c){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Iy(n,a,i,c),a=a.sibling}function Iy(n,a,i,c){var f=a.flags;switch(a.tag){case 0:case 11:case 15:Wn(n,a,i,c),f&2048&&No(9,a);break;case 1:Wn(n,a,i,c);break;case 3:Wn(n,a,i,c),f&2048&&(n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&go(n)));break;case 12:if(f&2048){Wn(n,a,i,c),n=a.stateNode;try{var p=a.memoizedProps,x=p.id,R=p.onPostCommit;typeof R=="function"&&R(x,a.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(O){Xe(a,a.return,O)}}else Wn(n,a,i,c);break;case 31:Wn(n,a,i,c);break;case 13:Wn(n,a,i,c);break;case 23:break;case 22:p=a.stateNode,x=a.alternate,a.memoizedState!==null?p._visibility&2?Wn(n,a,i,c):jo(n,a):p._visibility&2?Wn(n,a,i,c):(p._visibility|=2,ci(n,a,i,c,(a.subtreeFlags&10256)!==0||!1)),f&2048&&rh(x,a);break;case 24:Wn(n,a,i,c),f&2048&&ah(a.alternate,a);break;default:Wn(n,a,i,c)}}function ci(n,a,i,c,f){for(f=f&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var p=n,x=a,R=i,O=c,q=x.flags;switch(x.tag){case 0:case 11:case 15:ci(p,x,R,O,f),No(8,x);break;case 23:break;case 22:var Z=x.stateNode;x.memoizedState!==null?Z._visibility&2?ci(p,x,R,O,f):jo(p,x):(Z._visibility|=2,ci(p,x,R,O,f)),f&&q&2048&&rh(x.alternate,x);break;case 24:ci(p,x,R,O,f),f&&q&2048&&ah(x.alternate,x);break;default:ci(p,x,R,O,f)}a=a.sibling}}function jo(n,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var i=n,c=a,f=c.flags;switch(c.tag){case 22:jo(i,c),f&2048&&rh(c.alternate,c);break;case 24:jo(i,c),f&2048&&ah(c.alternate,c);break;default:jo(i,c)}a=a.sibling}}var Oo=8192;function ui(n,a,i){if(n.subtreeFlags&Oo)for(n=n.child;n!==null;)$y(n,a,i),n=n.sibling}function $y(n,a,i){switch(n.tag){case 26:ui(n,a,i),n.flags&Oo&&n.memoizedState!==null&&bT(i,Yn,n.memoizedState,n.memoizedProps);break;case 5:ui(n,a,i);break;case 3:case 4:var c=Yn;Yn=Ic(n.stateNode.containerInfo),ui(n,a,i),Yn=c;break;case 22:n.memoizedState===null&&(c=n.alternate,c!==null&&c.memoizedState!==null?(c=Oo,Oo=16777216,ui(n,a,i),Oo=c):ui(n,a,i));break;default:ui(n,a,i)}}function By(n){var a=n.alternate;if(a!==null&&(n=a.child,n!==null)){a.child=null;do a=n.sibling,n.sibling=null,n=a;while(n!==null)}}function Mo(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var c=a[i];Mt=c,qy(c,n)}By(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Hy(n),n=n.sibling}function Hy(n){switch(n.tag){case 0:case 11:case 15:Mo(n),n.flags&2048&&_a(9,n,n.return);break;case 3:Mo(n);break;case 12:Mo(n);break;case 22:var a=n.stateNode;n.memoizedState!==null&&a._visibility&2&&(n.return===null||n.return.tag!==13)?(a._visibility&=-3,Rc(n)):Mo(n);break;default:Mo(n)}}function Rc(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var c=a[i];Mt=c,qy(c,n)}By(n)}for(n=n.child;n!==null;){switch(a=n,a.tag){case 0:case 11:case 15:_a(8,a,a.return),Rc(a);break;case 22:i=a.stateNode,i._visibility&2&&(i._visibility&=-3,Rc(a));break;default:Rc(a)}n=n.sibling}}function qy(n,a){for(;Mt!==null;){var i=Mt;switch(i.tag){case 0:case 11:case 15:_a(8,i,a);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var c=i.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:go(i.memoizedState.cache)}if(c=i.child,c!==null)c.return=i,Mt=c;else e:for(i=n;Mt!==null;){c=Mt;var f=c.sibling,p=c.return;if(My(c),c===i){Mt=null;break e}if(f!==null){f.return=p,Mt=f;break e}Mt=p}}}var DR={getCacheForType:function(n){var a=It(xt),i=a.data.get(n);return i===void 0&&(i=n(),a.data.set(n,i)),i},cacheSignal:function(){return It(xt).controller.signal}},LR=typeof WeakMap=="function"?WeakMap:Map,Ke=0,tt=null,Pe=null,Ue=0,We=0,Sn=null,Sa=!1,di=!1,sh=!1,Gr=0,mt=0,Ea=0,ps=0,ih=0,En=0,fi=0,Do=null,un=null,oh=!1,Tc=0,Vy=0,Ac=1/0,Nc=null,Ca=null,Tt=0,Ra=null,hi=null,Fr=0,lh=0,ch=null,Gy=null,Lo=0,uh=null;function Cn(){return(Ke&2)!==0&&Ue!==0?Ue&-Ue:M.T!==null?gh():Nd()}function Fy(){if(En===0)if((Ue&536870912)===0||$e){var n=Fe;Fe<<=1,(Fe&3932160)===0&&(Fe=262144),En=n}else En=536870912;return n=xn.current,n!==null&&(n.flags|=32),En}function dn(n,a,i){(n===tt&&(We===2||We===9)||n.cancelPendingCommit!==null)&&(mi(n,0),Ta(n,Ue,En,!1)),ut(n,i),((Ke&2)===0||n!==tt)&&(n===tt&&((Ke&2)===0&&(ps|=i),mt===4&&Ta(n,Ue,En,!1)),mr(n))}function Ky(n,a,i){if((Ke&6)!==0)throw Error(s(327));var c=!i&&(a&127)===0&&(a&n.expiredLanes)===0||ot(n,a),f=c?UR(n,a):fh(n,a,!0),p=c;do{if(f===0){di&&!c&&Ta(n,a,0,!1);break}else{if(i=n.current.alternate,p&&!PR(i)){f=fh(n,a,!1),p=!1;continue}if(f===2){if(p=a,n.errorRecoveryDisabledLanes&p)var x=0;else x=n.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){a=x;e:{var R=n;f=Do;var O=R.current.memoizedState.isDehydrated;if(O&&(mi(R,x).flags|=256),x=fh(R,x,!1),x!==2){if(sh&&!O){R.errorRecoveryDisabledLanes|=p,ps|=p,f=4;break e}p=un,un=f,p!==null&&(un===null?un=p:un.push.apply(un,p))}f=x}if(p=!1,f!==2)continue}}if(f===1){mi(n,0),Ta(n,a,0,!0);break}e:{switch(c=n,p=f,p){case 0:case 1:throw Error(s(345));case 4:if((a&4194048)!==a)break;case 6:Ta(c,a,En,!Sa);break e;case 2:un=null;break;case 3:case 5:break;default:throw Error(s(329))}if((a&62914560)===a&&(f=Tc+300-vt(),10<f)){if(Ta(c,a,En,!Sa),ke(c,0,!0)!==0)break e;Fr=a,c.timeoutHandle=Eb(Yy.bind(null,c,i,un,Nc,oh,a,En,ps,fi,Sa,p,"Throttled",-0,0),f);break e}Yy(c,i,un,Nc,oh,a,En,ps,fi,Sa,p,null,-0,0)}}break}while(!0);mr(n)}function Yy(n,a,i,c,f,p,x,R,O,q,Z,ne,G,Y){if(n.timeoutHandle=-1,ne=a.subtreeFlags,ne&8192||(ne&16785408)===16785408){ne={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:jr},$y(a,p,ne);var be=(p&62914560)===p?Tc-vt():(p&4194048)===p?Vy-vt():0;if(be=wT(ne,be),be!==null){Fr=p,n.cancelPendingCommit=be(nb.bind(null,n,a,p,i,c,f,x,R,O,Z,ne,null,G,Y)),Ta(n,p,x,!q);return}}nb(n,a,p,i,c,f,x,R,O)}function PR(n){for(var a=n;;){var i=a.tag;if((i===0||i===11||i===15)&&a.flags&16384&&(i=a.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var c=0;c<i.length;c++){var f=i[c],p=f.getSnapshot;f=f.value;try{if(!bn(p(),f))return!1}catch{return!1}}if(i=a.child,a.subtreeFlags&16384&&i!==null)i.return=a,a=i;else{if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Ta(n,a,i,c){a&=~ih,a&=~ps,n.suspendedLanes|=a,n.pingedLanes&=~a,c&&(n.warmLanes|=a),c=n.expirationTimes;for(var f=a;0<f;){var p=31-kt(f),x=1<<p;c[p]=-1,f&=~x}i!==0&&Qa(n,i,a)}function kc(){return(Ke&6)===0?(Po(0),!1):!0}function dh(){if(Pe!==null){if(We===0)var n=Pe.return;else n=Pe,Lr=is=null,Tf(n),ai=null,yo=0,n=Pe;for(;n!==null;)Cy(n.alternate,n),n=n.return;Pe=null}}function mi(n,a){var i=n.timeoutHandle;i!==-1&&(n.timeoutHandle=-1,nT(i)),i=n.cancelPendingCommit,i!==null&&(n.cancelPendingCommit=null,i()),Fr=0,dh(),tt=n,Pe=i=Mr(n.current,null),Ue=a,We=0,Sn=null,Sa=!1,di=ot(n,a),sh=!1,fi=En=ih=ps=Ea=mt=0,un=Do=null,oh=!1,(a&8)!==0&&(a|=a&32);var c=n.entangledLanes;if(c!==0)for(n=n.entanglements,c&=a;0<c;){var f=31-kt(c),p=1<<f;a|=n[f],c&=~p}return Gr=a,Jl(),i}function Wy(n,a){Me=null,M.H=Ro,a===ri||a===sc?(a=dv(),We=3):a===pf?(a=dv(),We=4):We=a===qf?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Sn=a,Pe===null&&(mt=1,bc(n,Mn(a,n.current)))}function Xy(){var n=xn.current;return n===null?!0:(Ue&4194048)===Ue?zn===null:(Ue&62914560)===Ue||(Ue&536870912)!==0?n===zn:!1}function Jy(){var n=M.H;return M.H=Ro,n===null?Ro:n}function Qy(){var n=M.A;return M.A=DR,n}function jc(){mt=4,Sa||(Ue&4194048)!==Ue&&xn.current!==null||(di=!0),(Ea&134217727)===0&&(ps&134217727)===0||tt===null||Ta(tt,Ue,En,!1)}function fh(n,a,i){var c=Ke;Ke|=2;var f=Jy(),p=Qy();(tt!==n||Ue!==a)&&(Nc=null,mi(n,a)),a=!1;var x=mt;e:do try{if(We!==0&&Pe!==null){var R=Pe,O=Sn;switch(We){case 8:dh(),x=6;break e;case 3:case 2:case 9:case 6:xn.current===null&&(a=!0);var q=We;if(We=0,Sn=null,pi(n,R,O,q),i&&di){x=0;break e}break;default:q=We,We=0,Sn=null,pi(n,R,O,q)}}zR(),x=mt;break}catch(Z){Wy(n,Z)}while(!0);return a&&n.shellSuspendCounter++,Lr=is=null,Ke=c,M.H=f,M.A=p,Pe===null&&(tt=null,Ue=0,Jl()),x}function zR(){for(;Pe!==null;)Zy(Pe)}function UR(n,a){var i=Ke;Ke|=2;var c=Jy(),f=Qy();tt!==n||Ue!==a?(Nc=null,Ac=vt()+500,mi(n,a)):di=ot(n,a);e:do try{if(We!==0&&Pe!==null){a=Pe;var p=Sn;t:switch(We){case 1:We=0,Sn=null,pi(n,a,p,1);break;case 2:case 9:if(cv(p)){We=0,Sn=null,eb(a);break}a=function(){We!==2&&We!==9||tt!==n||(We=7),mr(n)},p.then(a,a);break e;case 3:We=7;break e;case 4:We=5;break e;case 7:cv(p)?(We=0,Sn=null,eb(a)):(We=0,Sn=null,pi(n,a,p,7));break;case 5:var x=null;switch(Pe.tag){case 26:x=Pe.memoizedState;case 5:case 27:var R=Pe;if(x?Ib(x):R.stateNode.complete){We=0,Sn=null;var O=R.sibling;if(O!==null)Pe=O;else{var q=R.return;q!==null?(Pe=q,Oc(q)):Pe=null}break t}}We=0,Sn=null,pi(n,a,p,5);break;case 6:We=0,Sn=null,pi(n,a,p,6);break;case 8:dh(),mt=6;break e;default:throw Error(s(462))}}IR();break}catch(Z){Wy(n,Z)}while(!0);return Lr=is=null,M.H=c,M.A=f,Ke=i,Pe!==null?0:(tt=null,Ue=0,Jl(),mt)}function IR(){for(;Pe!==null&&!Lt();)Zy(Pe)}function Zy(n){var a=Sy(n.alternate,n,Gr);n.memoizedProps=n.pendingProps,a===null?Oc(n):Pe=a}function eb(n){var a=n,i=a.alternate;switch(a.tag){case 15:case 0:a=vy(i,a,a.pendingProps,a.type,void 0,Ue);break;case 11:a=vy(i,a,a.pendingProps,a.type.render,a.ref,Ue);break;case 5:Tf(a);default:Cy(i,a),a=Pe=Qg(a,Gr),a=Sy(i,a,Gr)}n.memoizedProps=n.pendingProps,a===null?Oc(n):Pe=a}function pi(n,a,i,c){Lr=is=null,Tf(a),ai=null,yo=0;var f=a.return;try{if(TR(n,f,a,i,Ue)){mt=1,bc(n,Mn(i,n.current)),Pe=null;return}}catch(p){if(f!==null)throw Pe=f,p;mt=1,bc(n,Mn(i,n.current)),Pe=null;return}a.flags&32768?($e||c===1?n=!0:di||(Ue&536870912)!==0?n=!1:(Sa=n=!0,(c===2||c===9||c===3||c===6)&&(c=xn.current,c!==null&&c.tag===13&&(c.flags|=16384))),tb(a,n)):Oc(a)}function Oc(n){var a=n;do{if((a.flags&32768)!==0){tb(a,Sa);return}n=a.return;var i=kR(a.alternate,a,Gr);if(i!==null){Pe=i;return}if(a=a.sibling,a!==null){Pe=a;return}Pe=a=n}while(a!==null);mt===0&&(mt=5)}function tb(n,a){do{var i=jR(n.alternate,n);if(i!==null){i.flags&=32767,Pe=i;return}if(i=n.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!a&&(n=n.sibling,n!==null)){Pe=n;return}Pe=n=i}while(n!==null);mt=6,Pe=null}function nb(n,a,i,c,f,p,x,R,O){n.cancelPendingCommit=null;do Mc();while(Tt!==0);if((Ke&6)!==0)throw Error(s(327));if(a!==null){if(a===n.current)throw Error(s(177));if(p=a.lanes|a.childLanes,p|=Zd,tn(n,i,p,x,R,O),n===tt&&(Pe=tt=null,Ue=0),hi=a,Ra=n,Fr=i,lh=p,ch=f,Gy=c,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,qR(cr,function(){return ob(),null})):(n.callbackNode=null,n.callbackPriority=0),c=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||c){c=M.T,M.T=null,f=K.p,K.p=2,x=Ke,Ke|=4;try{OR(n,a,i)}finally{Ke=x,K.p=f,M.T=c}}Tt=1,rb(),ab(),sb()}}function rb(){if(Tt===1){Tt=0;var n=Ra,a=hi,i=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||i){i=M.T,M.T=null;var c=K.p;K.p=2;var f=Ke;Ke|=4;try{zy(a,n);var p=Eh,x=qg(n.containerInfo),R=p.focusedElem,O=p.selectionRange;if(x!==R&&R&&R.ownerDocument&&Hg(R.ownerDocument.documentElement,R)){if(O!==null&&Yd(R)){var q=O.start,Z=O.end;if(Z===void 0&&(Z=q),"selectionStart"in R)R.selectionStart=q,R.selectionEnd=Math.min(Z,R.value.length);else{var ne=R.ownerDocument||document,G=ne&&ne.defaultView||window;if(G.getSelection){var Y=G.getSelection(),be=R.textContent.length,Ae=Math.min(O.start,be),Ze=O.end===void 0?Ae:Math.min(O.end,be);!Y.extend&&Ae>Ze&&(x=Ze,Ze=Ae,Ae=x);var I=Bg(R,Ae),L=Bg(R,Ze);if(I&&L&&(Y.rangeCount!==1||Y.anchorNode!==I.node||Y.anchorOffset!==I.offset||Y.focusNode!==L.node||Y.focusOffset!==L.offset)){var H=ne.createRange();H.setStart(I.node,I.offset),Y.removeAllRanges(),Ae>Ze?(Y.addRange(H),Y.extend(L.node,L.offset)):(H.setEnd(L.node,L.offset),Y.addRange(H))}}}}for(ne=[],Y=R;Y=Y.parentNode;)Y.nodeType===1&&ne.push({element:Y,left:Y.scrollLeft,top:Y.scrollTop});for(typeof R.focus=="function"&&R.focus(),R=0;R<ne.length;R++){var ee=ne[R];ee.element.scrollLeft=ee.left,ee.element.scrollTop=ee.top}}Gc=!!Sh,Eh=Sh=null}finally{Ke=f,K.p=c,M.T=i}}n.current=a,Tt=2}}function ab(){if(Tt===2){Tt=0;var n=Ra,a=hi,i=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||i){i=M.T,M.T=null;var c=K.p;K.p=2;var f=Ke;Ke|=4;try{Oy(n,a.alternate,a)}finally{Ke=f,K.p=c,M.T=i}}Tt=3}}function sb(){if(Tt===4||Tt===3){Tt=0,Rt();var n=Ra,a=hi,i=Fr,c=Gy;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Tt=5:(Tt=0,hi=Ra=null,ib(n,n.pendingLanes));var f=n.pendingLanes;if(f===0&&(Ca=null),Fn(i),a=a.stateNode,Pt&&typeof Pt.onCommitFiberRoot=="function")try{Pt.onCommitFiberRoot(ur,a,void 0,(a.current.flags&128)===128)}catch{}if(c!==null){a=M.T,f=K.p,K.p=2,M.T=null;try{for(var p=n.onRecoverableError,x=0;x<c.length;x++){var R=c[x];p(R.value,{componentStack:R.stack})}}finally{M.T=a,K.p=f}}(Fr&3)!==0&&Mc(),mr(n),f=n.pendingLanes,(i&261930)!==0&&(f&42)!==0?n===uh?Lo++:(Lo=0,uh=n):Lo=0,Po(0)}}function ib(n,a){(n.pooledCacheLanes&=a)===0&&(a=n.pooledCache,a!=null&&(n.pooledCache=null,go(a)))}function Mc(){return rb(),ab(),sb(),ob()}function ob(){if(Tt!==5)return!1;var n=Ra,a=lh;lh=0;var i=Fn(Fr),c=M.T,f=K.p;try{K.p=32>i?32:i,M.T=null,i=ch,ch=null;var p=Ra,x=Fr;if(Tt=0,hi=Ra=null,Fr=0,(Ke&6)!==0)throw Error(s(331));var R=Ke;if(Ke|=4,Hy(p.current),Iy(p,p.current,x,i),Ke=R,Po(0,!1),Pt&&typeof Pt.onPostCommitFiberRoot=="function")try{Pt.onPostCommitFiberRoot(ur,p)}catch{}return!0}finally{K.p=f,M.T=c,ib(n,a)}}function lb(n,a,i){a=Mn(i,a),a=Hf(n.stateNode,a,2),n=ba(n,a,2),n!==null&&(ut(n,2),mr(n))}function Xe(n,a,i){if(n.tag===3)lb(n,n,i);else for(;a!==null;){if(a.tag===3){lb(a,n,i);break}else if(a.tag===1){var c=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Ca===null||!Ca.has(c))){n=Mn(i,n),i=cy(2),c=ba(a,i,2),c!==null&&(uy(i,c,a,n),ut(c,2),mr(c));break}}a=a.return}}function hh(n,a,i){var c=n.pingCache;if(c===null){c=n.pingCache=new LR;var f=new Set;c.set(a,f)}else f=c.get(a),f===void 0&&(f=new Set,c.set(a,f));f.has(i)||(sh=!0,f.add(i),n=$R.bind(null,n,a,i),a.then(n,n))}function $R(n,a,i){var c=n.pingCache;c!==null&&c.delete(a),n.pingedLanes|=n.suspendedLanes&i,n.warmLanes&=~i,tt===n&&(Ue&i)===i&&(mt===4||mt===3&&(Ue&62914560)===Ue&&300>vt()-Tc?(Ke&2)===0&&mi(n,0):ih|=i,fi===Ue&&(fi=0)),mr(n)}function cb(n,a){a===0&&(a=Kt()),n=rs(n,a),n!==null&&(ut(n,a),mr(n))}function BR(n){var a=n.memoizedState,i=0;a!==null&&(i=a.retryLane),cb(n,i)}function HR(n,a){var i=0;switch(n.tag){case 31:case 13:var c=n.stateNode,f=n.memoizedState;f!==null&&(i=f.retryLane);break;case 19:c=n.stateNode;break;case 22:c=n.stateNode._retryCache;break;default:throw Error(s(314))}c!==null&&c.delete(a),cb(n,i)}function qR(n,a){return ca(n,a)}var Dc=null,gi=null,mh=!1,Lc=!1,ph=!1,Aa=0;function mr(n){n!==gi&&n.next===null&&(gi===null?Dc=gi=n:gi=gi.next=n),Lc=!0,mh||(mh=!0,GR())}function Po(n,a){if(!ph&&Lc){ph=!0;do for(var i=!1,c=Dc;c!==null;){if(n!==0){var f=c.pendingLanes;if(f===0)var p=0;else{var x=c.suspendedLanes,R=c.pingedLanes;p=(1<<31-kt(42|n)+1)-1,p&=f&~(x&~R),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(i=!0,hb(c,p))}else p=Ue,p=ke(c,c===tt?p:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(p&3)===0||ot(c,p)||(i=!0,hb(c,p));c=c.next}while(i);ph=!1}}function VR(){ub()}function ub(){Lc=mh=!1;var n=0;Aa!==0&&tT()&&(n=Aa);for(var a=vt(),i=null,c=Dc;c!==null;){var f=c.next,p=db(c,a);p===0?(c.next=null,i===null?Dc=f:i.next=f,f===null&&(gi=i)):(i=c,(n!==0||(p&3)!==0)&&(Lc=!0)),c=f}Tt!==0&&Tt!==5||Po(n),Aa!==0&&(Aa=0)}function db(n,a){for(var i=n.suspendedLanes,c=n.pingedLanes,f=n.expirationTimes,p=n.pendingLanes&-62914561;0<p;){var x=31-kt(p),R=1<<x,O=f[x];O===-1?((R&i)===0||(R&c)!==0)&&(f[x]=jt(R,a)):O<=a&&(n.expiredLanes|=R),p&=~R}if(a=tt,i=Ue,i=ke(n,n===a?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c=n.callbackNode,i===0||n===a&&(We===2||We===9)||n.cancelPendingCommit!==null)return c!==null&&c!==null&&or(c),n.callbackNode=null,n.callbackPriority=0;if((i&3)===0||ot(n,i)){if(a=i&-i,a===n.callbackPriority)return a;switch(c!==null&&or(c),Fn(i)){case 2:case 8:i=lr;break;case 32:i=cr;break;case 268435456:i=Vn;break;default:i=cr}return c=fb.bind(null,n),i=ca(i,c),n.callbackPriority=a,n.callbackNode=i,a}return c!==null&&c!==null&&or(c),n.callbackPriority=2,n.callbackNode=null,2}function fb(n,a){if(Tt!==0&&Tt!==5)return n.callbackNode=null,n.callbackPriority=0,null;var i=n.callbackNode;if(Mc()&&n.callbackNode!==i)return null;var c=Ue;return c=ke(n,n===tt?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c===0?null:(Ky(n,c,a),db(n,vt()),n.callbackNode!=null&&n.callbackNode===i?fb.bind(null,n):null)}function hb(n,a){if(Mc())return null;Ky(n,a,!0)}function GR(){rT(function(){(Ke&6)!==0?ca(Ar,VR):ub()})}function gh(){if(Aa===0){var n=ti;n===0&&(n=Be,Be<<=1,(Be&261888)===0&&(Be=256)),Aa=n}return Aa}function mb(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:ql(""+n)}function pb(n,a){var i=a.ownerDocument.createElement("input");return i.name=a.name,i.value=a.value,n.id&&i.setAttribute("form",n.id),a.parentNode.insertBefore(i,a),n=new FormData(n),i.parentNode.removeChild(i),n}function FR(n,a,i,c,f){if(a==="submit"&&i&&i.stateNode===f){var p=mb((f[an]||null).action),x=c.submitter;x&&(a=(a=x[an]||null)?mb(a.formAction):x.getAttribute("formAction"),a!==null&&(p=a,x=null));var R=new Kl("action","action",null,c,f);n.push({event:R,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(Aa!==0){var O=x?pb(f,x):new FormData(f);Pf(i,{pending:!0,data:O,method:f.method,action:p},null,O)}}else typeof p=="function"&&(R.preventDefault(),O=x?pb(f,x):new FormData(f),Pf(i,{pending:!0,data:O,method:f.method,action:p},p,O))},currentTarget:f}]})}}for(var vh=0;vh<Qd.length;vh++){var yh=Qd[vh],KR=yh.toLowerCase(),YR=yh[0].toUpperCase()+yh.slice(1);Kn(KR,"on"+YR)}Kn(Fg,"onAnimationEnd"),Kn(Kg,"onAnimationIteration"),Kn(Yg,"onAnimationStart"),Kn("dblclick","onDoubleClick"),Kn("focusin","onFocus"),Kn("focusout","onBlur"),Kn(uR,"onTransitionRun"),Kn(dR,"onTransitionStart"),Kn(fR,"onTransitionCancel"),Kn(Wg,"onTransitionEnd"),Bs("onMouseEnter",["mouseout","mouseover"]),Bs("onMouseLeave",["mouseout","mouseover"]),Bs("onPointerEnter",["pointerout","pointerover"]),Bs("onPointerLeave",["pointerout","pointerover"]),Za("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Za("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Za("onBeforeInput",["compositionend","keypress","textInput","paste"]),Za("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Za("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Za("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var zo="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(" "),WR=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(zo));function gb(n,a){a=(a&4)!==0;for(var i=0;i<n.length;i++){var c=n[i],f=c.event;c=c.listeners;e:{var p=void 0;if(a)for(var x=c.length-1;0<=x;x--){var R=c[x],O=R.instance,q=R.currentTarget;if(R=R.listener,O!==p&&f.isPropagationStopped())break e;p=R,f.currentTarget=q;try{p(f)}catch(Z){Xl(Z)}f.currentTarget=null,p=O}else for(x=0;x<c.length;x++){if(R=c[x],O=R.instance,q=R.currentTarget,R=R.listener,O!==p&&f.isPropagationStopped())break e;p=R,f.currentTarget=q;try{p(f)}catch(Z){Xl(Z)}f.currentTarget=null,p=O}}}}function ze(n,a){var i=a[kd];i===void 0&&(i=a[kd]=new Set);var c=n+"__bubble";i.has(c)||(vb(a,n,2,!1),i.add(c))}function bh(n,a,i){var c=0;a&&(c|=4),vb(i,n,c,a)}var Pc="_reactListening"+Math.random().toString(36).slice(2);function wh(n){if(!n[Pc]){n[Pc]=!0,ug.forEach(function(i){i!=="selectionchange"&&(WR.has(i)||bh(i,!1,n),bh(i,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[Pc]||(a[Pc]=!0,bh("selectionchange",!1,a))}}function vb(n,a,i,c){switch(Fb(a)){case 2:var f=ST;break;case 8:f=ET;break;default:f=Lh}i=f.bind(null,a,i,n),f=void 0,!Id||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(f=!0),c?f!==void 0?n.addEventListener(a,i,{capture:!0,passive:f}):n.addEventListener(a,i,!0):f!==void 0?n.addEventListener(a,i,{passive:f}):n.addEventListener(a,i,!1)}function xh(n,a,i,c,f){var p=c;if((a&1)===0&&(a&2)===0&&c!==null)e:for(;;){if(c===null)return;var x=c.tag;if(x===3||x===4){var R=c.stateNode.containerInfo;if(R===f)break;if(x===4)for(x=c.return;x!==null;){var O=x.tag;if((O===3||O===4)&&x.stateNode.containerInfo===f)return;x=x.return}for(;R!==null;){if(x=Us(R),x===null)return;if(O=x.tag,O===5||O===6||O===26||O===27){c=p=x;continue e}R=R.parentNode}}c=c.return}_g(function(){var q=p,Z=zd(i),ne=[];e:{var G=Xg.get(n);if(G!==void 0){var Y=Kl,be=n;switch(n){case"keypress":if(Gl(i)===0)break e;case"keydown":case"keyup":Y=HC;break;case"focusin":be="focus",Y=qd;break;case"focusout":be="blur",Y=qd;break;case"beforeblur":case"afterblur":Y=qd;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Y=Cg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Y=kC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Y=GC;break;case Fg:case Kg:case Yg:Y=MC;break;case Wg:Y=KC;break;case"scroll":case"scrollend":Y=AC;break;case"wheel":Y=WC;break;case"copy":case"cut":case"paste":Y=LC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Y=Tg;break;case"toggle":case"beforetoggle":Y=JC}var Ae=(a&4)!==0,Ze=!Ae&&(n==="scroll"||n==="scrollend"),I=Ae?G!==null?G+"Capture":null:G;Ae=[];for(var L=q,H;L!==null;){var ee=L;if(H=ee.stateNode,ee=ee.tag,ee!==5&&ee!==26&&ee!==27||H===null||I===null||(ee=ao(L,I),ee!=null&&Ae.push(Uo(L,ee,H))),Ze)break;L=L.return}0<Ae.length&&(G=new Y(G,be,null,i,Z),ne.push({event:G,listeners:Ae}))}}if((a&7)===0){e:{if(G=n==="mouseover"||n==="pointerover",Y=n==="mouseout"||n==="pointerout",G&&i!==Pd&&(be=i.relatedTarget||i.fromElement)&&(Us(be)||be[zs]))break e;if((Y||G)&&(G=Z.window===Z?Z:(G=Z.ownerDocument)?G.defaultView||G.parentWindow:window,Y?(be=i.relatedTarget||i.toElement,Y=q,be=be?Us(be):null,be!==null&&(Ze=l(be),Ae=be.tag,be!==Ze||Ae!==5&&Ae!==27&&Ae!==6)&&(be=null)):(Y=null,be=q),Y!==be)){if(Ae=Cg,ee="onMouseLeave",I="onMouseEnter",L="mouse",(n==="pointerout"||n==="pointerover")&&(Ae=Tg,ee="onPointerLeave",I="onPointerEnter",L="pointer"),Ze=Y==null?G:ro(Y),H=be==null?G:ro(be),G=new Ae(ee,L+"leave",Y,i,Z),G.target=Ze,G.relatedTarget=H,ee=null,Us(Z)===q&&(Ae=new Ae(I,L+"enter",be,i,Z),Ae.target=H,Ae.relatedTarget=Ze,ee=Ae),Ze=ee,Y&&be)t:{for(Ae=XR,I=Y,L=be,H=0,ee=I;ee;ee=Ae(ee))H++;ee=0;for(var Ce=L;Ce;Ce=Ae(Ce))ee++;for(;0<H-ee;)I=Ae(I),H--;for(;0<ee-H;)L=Ae(L),ee--;for(;H--;){if(I===L||L!==null&&I===L.alternate){Ae=I;break t}I=Ae(I),L=Ae(L)}Ae=null}else Ae=null;Y!==null&&yb(ne,G,Y,Ae,!1),be!==null&&Ze!==null&&yb(ne,Ze,be,Ae,!0)}}e:{if(G=q?ro(q):window,Y=G.nodeName&&G.nodeName.toLowerCase(),Y==="select"||Y==="input"&&G.type==="file")var Ve=Lg;else if(Mg(G))if(Pg)Ve=oR;else{Ve=sR;var _e=aR}else Y=G.nodeName,!Y||Y.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?q&&Ld(q.elementType)&&(Ve=Lg):Ve=iR;if(Ve&&(Ve=Ve(n,q))){Dg(ne,Ve,i,Z);break e}_e&&_e(n,G,q),n==="focusout"&&q&&G.type==="number"&&q.memoizedProps.value!=null&&Dd(G,"number",G.value)}switch(_e=q?ro(q):window,n){case"focusin":(Mg(_e)||_e.contentEditable==="true")&&(Ks=_e,Wd=q,ho=null);break;case"focusout":ho=Wd=Ks=null;break;case"mousedown":Xd=!0;break;case"contextmenu":case"mouseup":case"dragend":Xd=!1,Vg(ne,i,Z);break;case"selectionchange":if(cR)break;case"keydown":case"keyup":Vg(ne,i,Z)}var De;if(Gd)e:{switch(n){case"compositionstart":var Ie="onCompositionStart";break e;case"compositionend":Ie="onCompositionEnd";break e;case"compositionupdate":Ie="onCompositionUpdate";break e}Ie=void 0}else Fs?jg(n,i)&&(Ie="onCompositionEnd"):n==="keydown"&&i.keyCode===229&&(Ie="onCompositionStart");Ie&&(Ag&&i.locale!=="ko"&&(Fs||Ie!=="onCompositionStart"?Ie==="onCompositionEnd"&&Fs&&(De=Sg()):(fa=Z,$d="value"in fa?fa.value:fa.textContent,Fs=!0)),_e=zc(q,Ie),0<_e.length&&(Ie=new Rg(Ie,n,null,i,Z),ne.push({event:Ie,listeners:_e}),De?Ie.data=De:(De=Og(i),De!==null&&(Ie.data=De)))),(De=ZC?eR(n,i):tR(n,i))&&(Ie=zc(q,"onBeforeInput"),0<Ie.length&&(_e=new Rg("onBeforeInput","beforeinput",null,i,Z),ne.push({event:_e,listeners:Ie}),_e.data=De)),FR(ne,n,q,i,Z)}gb(ne,a)})}function Uo(n,a,i){return{instance:n,listener:a,currentTarget:i}}function zc(n,a){for(var i=a+"Capture",c=[];n!==null;){var f=n,p=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||p===null||(f=ao(n,i),f!=null&&c.unshift(Uo(n,f,p)),f=ao(n,a),f!=null&&c.push(Uo(n,f,p))),n.tag===3)return c;n=n.return}return[]}function XR(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function yb(n,a,i,c,f){for(var p=a._reactName,x=[];i!==null&&i!==c;){var R=i,O=R.alternate,q=R.stateNode;if(R=R.tag,O!==null&&O===c)break;R!==5&&R!==26&&R!==27||q===null||(O=q,f?(q=ao(i,p),q!=null&&x.unshift(Uo(i,q,O))):f||(q=ao(i,p),q!=null&&x.push(Uo(i,q,O)))),i=i.return}x.length!==0&&n.push({event:a,listeners:x})}var JR=/\r\n?/g,QR=/\u0000|\uFFFD/g;function bb(n){return(typeof n=="string"?n:""+n).replace(JR,`
|
||
`).replace(QR,"")}function wb(n,a){return a=bb(a),bb(n)===a}function Qe(n,a,i,c,f,p){switch(i){case"children":typeof c=="string"?a==="body"||a==="textarea"&&c===""||qs(n,c):(typeof c=="number"||typeof c=="bigint")&&a!=="body"&&qs(n,""+c);break;case"className":Bl(n,"class",c);break;case"tabIndex":Bl(n,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":Bl(n,i,c);break;case"style":wg(n,c,p);break;case"data":if(a!=="object"){Bl(n,"data",c);break}case"src":case"href":if(c===""&&(a!=="a"||i!=="href")){n.removeAttribute(i);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(i);break}c=ql(""+c),n.setAttribute(i,c);break;case"action":case"formAction":if(typeof c=="function"){n.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(i==="formAction"?(a!=="input"&&Qe(n,a,"name",f.name,f,null),Qe(n,a,"formEncType",f.formEncType,f,null),Qe(n,a,"formMethod",f.formMethod,f,null),Qe(n,a,"formTarget",f.formTarget,f,null)):(Qe(n,a,"encType",f.encType,f,null),Qe(n,a,"method",f.method,f,null),Qe(n,a,"target",f.target,f,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(i);break}c=ql(""+c),n.setAttribute(i,c);break;case"onClick":c!=null&&(n.onclick=jr);break;case"onScroll":c!=null&&ze("scroll",n);break;case"onScrollEnd":c!=null&&ze("scrollend",n);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(s(61));if(i=c.__html,i!=null){if(f.children!=null)throw Error(s(60));n.innerHTML=i}}break;case"multiple":n.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":n.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){n.removeAttribute("xlink:href");break}i=ql(""+c),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(i,""+c):n.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":c&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(i,""):n.removeAttribute(i);break;case"capture":case"download":c===!0?n.setAttribute(i,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(i,c):n.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?n.setAttribute(i,c):n.removeAttribute(i);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?n.removeAttribute(i):n.setAttribute(i,c);break;case"popover":ze("beforetoggle",n),ze("toggle",n),$l(n,"popover",c);break;case"xlinkActuate":kr(n,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":kr(n,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":kr(n,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":kr(n,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":kr(n,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":kr(n,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":kr(n,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":kr(n,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":kr(n,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":$l(n,"is",c);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=RC.get(i)||i,$l(n,i,c))}}function _h(n,a,i,c,f,p){switch(i){case"style":wg(n,c,p);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(s(61));if(i=c.__html,i!=null){if(f.children!=null)throw Error(s(60));n.innerHTML=i}}break;case"children":typeof c=="string"?qs(n,c):(typeof c=="number"||typeof c=="bigint")&&qs(n,""+c);break;case"onScroll":c!=null&&ze("scroll",n);break;case"onScrollEnd":c!=null&&ze("scrollend",n);break;case"onClick":c!=null&&(n.onclick=jr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!dg.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(f=i.endsWith("Capture"),a=i.slice(2,f?i.length-7:void 0),p=n[an]||null,p=p!=null?p[i]:null,typeof p=="function"&&n.removeEventListener(a,p,f),typeof c=="function")){typeof p!="function"&&p!==null&&(i in n?n[i]=null:n.hasAttribute(i)&&n.removeAttribute(i)),n.addEventListener(a,c,f);break e}i in n?n[i]=c:c===!0?n.setAttribute(i,""):$l(n,i,c)}}}function Bt(n,a,i){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ze("error",n),ze("load",n);var c=!1,f=!1,p;for(p in i)if(i.hasOwnProperty(p)){var x=i[p];if(x!=null)switch(p){case"src":c=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:Qe(n,a,p,x,i,null)}}f&&Qe(n,a,"srcSet",i.srcSet,i,null),c&&Qe(n,a,"src",i.src,i,null);return;case"input":ze("invalid",n);var R=p=x=f=null,O=null,q=null;for(c in i)if(i.hasOwnProperty(c)){var Z=i[c];if(Z!=null)switch(c){case"name":f=Z;break;case"type":x=Z;break;case"checked":O=Z;break;case"defaultChecked":q=Z;break;case"value":p=Z;break;case"defaultValue":R=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(s(137,a));break;default:Qe(n,a,c,Z,i,null)}}gg(n,p,R,O,q,x,f,!1);return;case"select":ze("invalid",n),c=x=p=null;for(f in i)if(i.hasOwnProperty(f)&&(R=i[f],R!=null))switch(f){case"value":p=R;break;case"defaultValue":x=R;break;case"multiple":c=R;default:Qe(n,a,f,R,i,null)}a=p,i=x,n.multiple=!!c,a!=null?Hs(n,!!c,a,!1):i!=null&&Hs(n,!!c,i,!0);return;case"textarea":ze("invalid",n),p=f=c=null;for(x in i)if(i.hasOwnProperty(x)&&(R=i[x],R!=null))switch(x){case"value":c=R;break;case"defaultValue":f=R;break;case"children":p=R;break;case"dangerouslySetInnerHTML":if(R!=null)throw Error(s(91));break;default:Qe(n,a,x,R,i,null)}yg(n,c,f,p);return;case"option":for(O in i)if(i.hasOwnProperty(O)&&(c=i[O],c!=null))switch(O){case"selected":n.selected=c&&typeof c!="function"&&typeof c!="symbol";break;default:Qe(n,a,O,c,i,null)}return;case"dialog":ze("beforetoggle",n),ze("toggle",n),ze("cancel",n),ze("close",n);break;case"iframe":case"object":ze("load",n);break;case"video":case"audio":for(c=0;c<zo.length;c++)ze(zo[c],n);break;case"image":ze("error",n),ze("load",n);break;case"details":ze("toggle",n);break;case"embed":case"source":case"link":ze("error",n),ze("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(q in i)if(i.hasOwnProperty(q)&&(c=i[q],c!=null))switch(q){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:Qe(n,a,q,c,i,null)}return;default:if(Ld(a)){for(Z in i)i.hasOwnProperty(Z)&&(c=i[Z],c!==void 0&&_h(n,a,Z,c,i,void 0));return}}for(R in i)i.hasOwnProperty(R)&&(c=i[R],c!=null&&Qe(n,a,R,c,i,null))}function ZR(n,a,i,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,p=null,x=null,R=null,O=null,q=null,Z=null;for(Y in i){var ne=i[Y];if(i.hasOwnProperty(Y)&&ne!=null)switch(Y){case"checked":break;case"value":break;case"defaultValue":O=ne;default:c.hasOwnProperty(Y)||Qe(n,a,Y,null,c,ne)}}for(var G in c){var Y=c[G];if(ne=i[G],c.hasOwnProperty(G)&&(Y!=null||ne!=null))switch(G){case"type":p=Y;break;case"name":f=Y;break;case"checked":q=Y;break;case"defaultChecked":Z=Y;break;case"value":x=Y;break;case"defaultValue":R=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(s(137,a));break;default:Y!==ne&&Qe(n,a,G,Y,c,ne)}}Md(n,x,R,O,q,Z,p,f);return;case"select":Y=x=R=G=null;for(p in i)if(O=i[p],i.hasOwnProperty(p)&&O!=null)switch(p){case"value":break;case"multiple":Y=O;default:c.hasOwnProperty(p)||Qe(n,a,p,null,c,O)}for(f in c)if(p=c[f],O=i[f],c.hasOwnProperty(f)&&(p!=null||O!=null))switch(f){case"value":G=p;break;case"defaultValue":R=p;break;case"multiple":x=p;default:p!==O&&Qe(n,a,f,p,c,O)}a=R,i=x,c=Y,G!=null?Hs(n,!!i,G,!1):!!c!=!!i&&(a!=null?Hs(n,!!i,a,!0):Hs(n,!!i,i?[]:"",!1));return;case"textarea":Y=G=null;for(R in i)if(f=i[R],i.hasOwnProperty(R)&&f!=null&&!c.hasOwnProperty(R))switch(R){case"value":break;case"children":break;default:Qe(n,a,R,null,c,f)}for(x in c)if(f=c[x],p=i[x],c.hasOwnProperty(x)&&(f!=null||p!=null))switch(x){case"value":G=f;break;case"defaultValue":Y=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(s(91));break;default:f!==p&&Qe(n,a,x,f,c,p)}vg(n,G,Y);return;case"option":for(var be in i)if(G=i[be],i.hasOwnProperty(be)&&G!=null&&!c.hasOwnProperty(be))switch(be){case"selected":n.selected=!1;break;default:Qe(n,a,be,null,c,G)}for(O in c)if(G=c[O],Y=i[O],c.hasOwnProperty(O)&&G!==Y&&(G!=null||Y!=null))switch(O){case"selected":n.selected=G&&typeof G!="function"&&typeof G!="symbol";break;default:Qe(n,a,O,G,c,Y)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ae in i)G=i[Ae],i.hasOwnProperty(Ae)&&G!=null&&!c.hasOwnProperty(Ae)&&Qe(n,a,Ae,null,c,G);for(q in c)if(G=c[q],Y=i[q],c.hasOwnProperty(q)&&G!==Y&&(G!=null||Y!=null))switch(q){case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(s(137,a));break;default:Qe(n,a,q,G,c,Y)}return;default:if(Ld(a)){for(var Ze in i)G=i[Ze],i.hasOwnProperty(Ze)&&G!==void 0&&!c.hasOwnProperty(Ze)&&_h(n,a,Ze,void 0,c,G);for(Z in c)G=c[Z],Y=i[Z],!c.hasOwnProperty(Z)||G===Y||G===void 0&&Y===void 0||_h(n,a,Z,G,c,Y);return}}for(var I in i)G=i[I],i.hasOwnProperty(I)&&G!=null&&!c.hasOwnProperty(I)&&Qe(n,a,I,null,c,G);for(ne in c)G=c[ne],Y=i[ne],!c.hasOwnProperty(ne)||G===Y||G==null&&Y==null||Qe(n,a,ne,G,c,Y)}function xb(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function eT(){if(typeof performance.getEntriesByType=="function"){for(var n=0,a=0,i=performance.getEntriesByType("resource"),c=0;c<i.length;c++){var f=i[c],p=f.transferSize,x=f.initiatorType,R=f.duration;if(p&&R&&xb(x)){for(x=0,R=f.responseEnd,c+=1;c<i.length;c++){var O=i[c],q=O.startTime;if(q>R)break;var Z=O.transferSize,ne=O.initiatorType;Z&&xb(ne)&&(O=O.responseEnd,x+=Z*(O<R?1:(R-q)/(O-q)))}if(--c,a+=8*(p+x)/(f.duration/1e3),n++,10<n)break}}if(0<n)return a/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Sh=null,Eh=null;function Uc(n){return n.nodeType===9?n:n.ownerDocument}function _b(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Sb(n,a){if(n===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&a==="foreignObject"?0:n}function Ch(n,a){return n==="textarea"||n==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Rh=null;function tT(){var n=window.event;return n&&n.type==="popstate"?n===Rh?!1:(Rh=n,!0):(Rh=null,!1)}var Eb=typeof setTimeout=="function"?setTimeout:void 0,nT=typeof clearTimeout=="function"?clearTimeout:void 0,Cb=typeof Promise=="function"?Promise:void 0,rT=typeof queueMicrotask=="function"?queueMicrotask:typeof Cb<"u"?function(n){return Cb.resolve(null).then(n).catch(aT)}:Eb;function aT(n){setTimeout(function(){throw n})}function Na(n){return n==="head"}function Rb(n,a){var i=a,c=0;do{var f=i.nextSibling;if(n.removeChild(i),f&&f.nodeType===8)if(i=f.data,i==="/$"||i==="/&"){if(c===0){n.removeChild(f),wi(a);return}c--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")c++;else if(i==="html")Io(n.ownerDocument.documentElement);else if(i==="head"){i=n.ownerDocument.head,Io(i);for(var p=i.firstChild;p;){var x=p.nextSibling,R=p.nodeName;p[no]||R==="SCRIPT"||R==="STYLE"||R==="LINK"&&p.rel.toLowerCase()==="stylesheet"||i.removeChild(p),p=x}}else i==="body"&&Io(n.ownerDocument.body);i=f}while(i);wi(a)}function Tb(n,a){var i=n;n=0;do{var c=i.nextSibling;if(i.nodeType===1?a?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(a?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),c&&c.nodeType===8)if(i=c.data,i==="/$"){if(n===0)break;n--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||n++;i=c}while(i)}function Th(n){var a=n.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var i=a;switch(a=a.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Th(i),jd(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}n.removeChild(i)}}function sT(n,a,i,c){for(;n.nodeType===1;){var f=i;if(n.nodeName.toLowerCase()!==a.toLowerCase()){if(!c&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(c){if(!n[no])switch(a){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(p=n.getAttribute("rel"),p==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(p!==f.rel||n.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||n.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||n.getAttribute("title")!==(f.title==null?null:f.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(p=n.getAttribute("src"),(p!==(f.src==null?null:f.src)||n.getAttribute("type")!==(f.type==null?null:f.type)||n.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&p&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(a==="input"&&n.type==="hidden"){var p=f.name==null?null:""+f.name;if(f.type==="hidden"&&n.getAttribute("name")===p)return n}else return n;if(n=Un(n.nextSibling),n===null)break}return null}function iT(n,a,i){if(a==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=Un(n.nextSibling),n===null))return null;return n}function Ab(n,a){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=Un(n.nextSibling),n===null))return null;return n}function Ah(n){return n.data==="$?"||n.data==="$~"}function Nh(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function oT(n,a){var i=n.ownerDocument;if(n.data==="$~")n._reactRetry=a;else if(n.data!=="$?"||i.readyState!=="loading")a();else{var c=function(){a(),i.removeEventListener("DOMContentLoaded",c)};i.addEventListener("DOMContentLoaded",c),n._reactRetry=c}}function Un(n){for(;n!=null;n=n.nextSibling){var a=n.nodeType;if(a===1||a===3)break;if(a===8){if(a=n.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return n}var kh=null;function Nb(n){n=n.nextSibling;for(var a=0;n;){if(n.nodeType===8){var i=n.data;if(i==="/$"||i==="/&"){if(a===0)return Un(n.nextSibling);a--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||a++}n=n.nextSibling}return null}function kb(n){n=n.previousSibling;for(var a=0;n;){if(n.nodeType===8){var i=n.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(a===0)return n;a--}else i!=="/$"&&i!=="/&"||a++}n=n.previousSibling}return null}function jb(n,a,i){switch(a=Uc(i),n){case"html":if(n=a.documentElement,!n)throw Error(s(452));return n;case"head":if(n=a.head,!n)throw Error(s(453));return n;case"body":if(n=a.body,!n)throw Error(s(454));return n;default:throw Error(s(451))}}function Io(n){for(var a=n.attributes;a.length;)n.removeAttributeNode(a[0]);jd(n)}var In=new Map,Ob=new Set;function Ic(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Kr=K.d;K.d={f:lT,r:cT,D:uT,C:dT,L:fT,m:hT,X:pT,S:mT,M:gT};function lT(){var n=Kr.f(),a=kc();return n||a}function cT(n){var a=Is(n);a!==null&&a.tag===5&&a.type==="form"?Wv(a):Kr.r(n)}var vi=typeof document>"u"?null:document;function Mb(n,a,i){var c=vi;if(c&&typeof a=="string"&&a){var f=jn(a);f='link[rel="'+n+'"][href="'+f+'"]',typeof i=="string"&&(f+='[crossorigin="'+i+'"]'),Ob.has(f)||(Ob.add(f),n={rel:n,crossOrigin:i,href:a},c.querySelector(f)===null&&(a=c.createElement("link"),Bt(a,"link",n),Ot(a),c.head.appendChild(a)))}}function uT(n){Kr.D(n),Mb("dns-prefetch",n,null)}function dT(n,a){Kr.C(n,a),Mb("preconnect",n,a)}function fT(n,a,i){Kr.L(n,a,i);var c=vi;if(c&&n&&a){var f='link[rel="preload"][as="'+jn(a)+'"]';a==="image"&&i&&i.imageSrcSet?(f+='[imagesrcset="'+jn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(f+='[imagesizes="'+jn(i.imageSizes)+'"]')):f+='[href="'+jn(n)+'"]';var p=f;switch(a){case"style":p=yi(n);break;case"script":p=bi(n)}In.has(p)||(n=g({rel:"preload",href:a==="image"&&i&&i.imageSrcSet?void 0:n,as:a},i),In.set(p,n),c.querySelector(f)!==null||a==="style"&&c.querySelector($o(p))||a==="script"&&c.querySelector(Bo(p))||(a=c.createElement("link"),Bt(a,"link",n),Ot(a),c.head.appendChild(a)))}}function hT(n,a){Kr.m(n,a);var i=vi;if(i&&n){var c=a&&typeof a.as=="string"?a.as:"script",f='link[rel="modulepreload"][as="'+jn(c)+'"][href="'+jn(n)+'"]',p=f;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=bi(n)}if(!In.has(p)&&(n=g({rel:"modulepreload",href:n},a),In.set(p,n),i.querySelector(f)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Bo(p)))return}c=i.createElement("link"),Bt(c,"link",n),Ot(c),i.head.appendChild(c)}}}function mT(n,a,i){Kr.S(n,a,i);var c=vi;if(c&&n){var f=$s(c).hoistableStyles,p=yi(n);a=a||"default";var x=f.get(p);if(!x){var R={loading:0,preload:null};if(x=c.querySelector($o(p)))R.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":a},i),(i=In.get(p))&&jh(n,i);var O=x=c.createElement("link");Ot(O),Bt(O,"link",n),O._p=new Promise(function(q,Z){O.onload=q,O.onerror=Z}),O.addEventListener("load",function(){R.loading|=1}),O.addEventListener("error",function(){R.loading|=2}),R.loading|=4,$c(x,a,c)}x={type:"stylesheet",instance:x,count:1,state:R},f.set(p,x)}}}function pT(n,a){Kr.X(n,a);var i=vi;if(i&&n){var c=$s(i).hoistableScripts,f=bi(n),p=c.get(f);p||(p=i.querySelector(Bo(f)),p||(n=g({src:n,async:!0},a),(a=In.get(f))&&Oh(n,a),p=i.createElement("script"),Ot(p),Bt(p,"link",n),i.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},c.set(f,p))}}function gT(n,a){Kr.M(n,a);var i=vi;if(i&&n){var c=$s(i).hoistableScripts,f=bi(n),p=c.get(f);p||(p=i.querySelector(Bo(f)),p||(n=g({src:n,async:!0,type:"module"},a),(a=In.get(f))&&Oh(n,a),p=i.createElement("script"),Ot(p),Bt(p,"link",n),i.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},c.set(f,p))}}function Db(n,a,i,c){var f=(f=X.current)?Ic(f):null;if(!f)throw Error(s(446));switch(n){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(a=yi(i.href),i=$s(f).hoistableStyles,c=i.get(a),c||(c={type:"style",instance:null,count:0,state:null},i.set(a,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){n=yi(i.href);var p=$s(f).hoistableStyles,x=p.get(n);if(x||(f=f.ownerDocument||f,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(n,x),(p=f.querySelector($o(n)))&&!p._p&&(x.instance=p,x.state.loading=5),In.has(n)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},In.set(n,i),p||vT(f,n,i,x.state))),a&&c===null)throw Error(s(528,""));return x}if(a&&c!==null)throw Error(s(529,""));return null;case"script":return a=i.async,i=i.src,typeof i=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=bi(i),i=$s(f).hoistableScripts,c=i.get(a),c||(c={type:"script",instance:null,count:0,state:null},i.set(a,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,n))}}function yi(n){return'href="'+jn(n)+'"'}function $o(n){return'link[rel="stylesheet"]['+n+"]"}function Lb(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function vT(n,a,i,c){n.querySelector('link[rel="preload"][as="style"]['+a+"]")?c.loading=1:(a=n.createElement("link"),c.preload=a,a.addEventListener("load",function(){return c.loading|=1}),a.addEventListener("error",function(){return c.loading|=2}),Bt(a,"link",i),Ot(a),n.head.appendChild(a))}function bi(n){return'[src="'+jn(n)+'"]'}function Bo(n){return"script[async]"+n}function Pb(n,a,i){if(a.count++,a.instance===null)switch(a.type){case"style":var c=n.querySelector('style[data-href~="'+jn(i.href)+'"]');if(c)return a.instance=c,Ot(c),c;var f=g({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return c=(n.ownerDocument||n).createElement("style"),Ot(c),Bt(c,"style",f),$c(c,i.precedence,n),a.instance=c;case"stylesheet":f=yi(i.href);var p=n.querySelector($o(f));if(p)return a.state.loading|=4,a.instance=p,Ot(p),p;c=Lb(i),(f=In.get(f))&&jh(c,f),p=(n.ownerDocument||n).createElement("link"),Ot(p);var x=p;return x._p=new Promise(function(R,O){x.onload=R,x.onerror=O}),Bt(p,"link",c),a.state.loading|=4,$c(p,i.precedence,n),a.instance=p;case"script":return p=bi(i.src),(f=n.querySelector(Bo(p)))?(a.instance=f,Ot(f),f):(c=i,(f=In.get(p))&&(c=g({},i),Oh(c,f)),n=n.ownerDocument||n,f=n.createElement("script"),Ot(f),Bt(f,"link",c),n.head.appendChild(f),a.instance=f);case"void":return null;default:throw Error(s(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(c=a.instance,a.state.loading|=4,$c(c,i.precedence,n));return a.instance}function $c(n,a,i){for(var c=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=c.length?c[c.length-1]:null,p=f,x=0;x<c.length;x++){var R=c[x];if(R.dataset.precedence===a)p=R;else if(p!==f)break}p?p.parentNode.insertBefore(n,p.nextSibling):(a=i.nodeType===9?i.head:i,a.insertBefore(n,a.firstChild))}function jh(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.title==null&&(n.title=a.title)}function Oh(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.integrity==null&&(n.integrity=a.integrity)}var Bc=null;function zb(n,a,i){if(Bc===null){var c=new Map,f=Bc=new Map;f.set(i,c)}else f=Bc,c=f.get(i),c||(c=new Map,f.set(i,c));if(c.has(n))return c;for(c.set(n,null),i=i.getElementsByTagName(n),f=0;f<i.length;f++){var p=i[f];if(!(p[no]||p[zt]||n==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var x=p.getAttribute(a)||"";x=n+x;var R=c.get(x);R?R.push(p):c.set(x,[p])}}return c}function Ub(n,a,i){n=n.ownerDocument||n,n.head.insertBefore(i,a==="title"?n.querySelector("head > title"):null)}function yT(n,a,i){if(i===1||a.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return n=a.disabled,typeof a.precedence=="string"&&n==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function Ib(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function bT(n,a,i,c){if(i.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var f=yi(c.href),p=a.querySelector($o(f));if(p){a=p._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=Hc.bind(n),a.then(n,n)),i.state.loading|=4,i.instance=p,Ot(p);return}p=a.ownerDocument||a,c=Lb(c),(f=In.get(f))&&jh(c,f),p=p.createElement("link"),Ot(p);var x=p;x._p=new Promise(function(R,O){x.onload=R,x.onerror=O}),Bt(p,"link",c),i.instance=p}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(i,a),(a=i.state.preload)&&(i.state.loading&3)===0&&(n.count++,i=Hc.bind(n),a.addEventListener("load",i),a.addEventListener("error",i))}}var Mh=0;function wT(n,a){return n.stylesheets&&n.count===0&&Vc(n,n.stylesheets),0<n.count||0<n.imgCount?function(i){var c=setTimeout(function(){if(n.stylesheets&&Vc(n,n.stylesheets),n.unsuspend){var p=n.unsuspend;n.unsuspend=null,p()}},6e4+a);0<n.imgBytes&&Mh===0&&(Mh=62500*eT());var f=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Vc(n,n.stylesheets),n.unsuspend)){var p=n.unsuspend;n.unsuspend=null,p()}},(n.imgBytes>Mh?50:800)+a);return n.unsuspend=i,function(){n.unsuspend=null,clearTimeout(c),clearTimeout(f)}}:null}function Hc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Vc(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var qc=null;function Vc(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,qc=new Map,a.forEach(xT,n),qc=null,Hc.call(n))}function xT(n,a){if(!(a.state.loading&4)){var i=qc.get(n);if(i)var c=i.get(null);else{i=new Map,qc.set(n,i);for(var f=n.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<f.length;p++){var x=f[p];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(i.set(x.dataset.precedence,x),c=x)}c&&i.set(null,c)}f=a.instance,x=f.getAttribute("data-precedence"),p=i.get(x)||c,p===c&&i.set(null,f),i.set(x,f),this.count++,c=Hc.bind(this),f.addEventListener("load",c),f.addEventListener("error",c),p?p.parentNode.insertBefore(f,p.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(f,n.firstChild)),a.state.loading|=4}}var Ho={$$typeof:N,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function _T(n,a,i,c,f,p,x,R,O){this.tag=1,this.containerInfo=n,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ua(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ua(0),this.hiddenUpdates=ua(null),this.identifierPrefix=c,this.onUncaughtError=f,this.onCaughtError=p,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function $b(n,a,i,c,f,p,x,R,O,q,Z,ne){return n=new _T(n,a,i,x,O,q,Z,ne,R),a=1,p===!0&&(a|=24),p=wn(3,null,null,a),n.current=p,p.stateNode=n,a=ff(),a.refCount++,n.pooledCache=a,a.refCount++,p.memoizedState={element:c,isDehydrated:i,cache:a},gf(p),n}function Bb(n){return n?(n=Xs,n):Xs}function Hb(n,a,i,c,f,p){f=Bb(f),c.context===null?c.context=f:c.pendingContext=f,c=ya(a),c.payload={element:i},p=p===void 0?null:p,p!==null&&(c.callback=p),i=ba(n,c,a),i!==null&&(dn(i,n,a),wo(i,n,a))}function qb(n,a){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var i=n.retryLane;n.retryLane=i!==0&&i<a?i:a}}function Dh(n,a){qb(n,a),(n=n.alternate)&&qb(n,a)}function Vb(n){if(n.tag===13||n.tag===31){var a=rs(n,67108864);a!==null&&dn(a,n,67108864),Dh(n,67108864)}}function Gb(n){if(n.tag===13||n.tag===31){var a=Cn();a=Ps(a);var i=rs(n,a);i!==null&&dn(i,n,a),Dh(n,a)}}var Gc=!0;function ST(n,a,i,c){var f=M.T;M.T=null;var p=K.p;try{K.p=2,Lh(n,a,i,c)}finally{K.p=p,M.T=f}}function ET(n,a,i,c){var f=M.T;M.T=null;var p=K.p;try{K.p=8,Lh(n,a,i,c)}finally{K.p=p,M.T=f}}function Lh(n,a,i,c){if(Gc){var f=Ph(c);if(f===null)xh(n,a,c,Fc,i),Kb(n,c);else if(RT(f,n,a,i,c))c.stopPropagation();else if(Kb(n,c),a&4&&-1<CT.indexOf(n)){for(;f!==null;){var p=Is(f);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var x=en(p.pendingLanes);if(x!==0){var R=p;for(R.pendingLanes|=2,R.entangledLanes|=2;x;){var O=1<<31-kt(x);R.entanglements[1]|=O,x&=~O}mr(p),(Ke&6)===0&&(Ac=vt()+500,Po(0))}}break;case 31:case 13:R=rs(p,2),R!==null&&dn(R,p,2),kc(),Dh(p,2)}if(p=Ph(c),p===null&&xh(n,a,c,Fc,i),p===f)break;f=p}f!==null&&c.stopPropagation()}else xh(n,a,c,null,i)}}function Ph(n){return n=zd(n),zh(n)}var Fc=null;function zh(n){if(Fc=null,n=Us(n),n!==null){var a=l(n);if(a===null)n=null;else{var i=a.tag;if(i===13){if(n=u(a),n!==null)return n;n=null}else if(i===31){if(n=d(a),n!==null)return n;n=null}else if(i===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;n=null}else a!==n&&(n=null)}}return Fc=n,null}function Fb(n){switch(n){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(eo()){case Ar:return 2;case lr:return 8;case cr:case Nr:return 32;case Vn:return 268435456;default:return 32}default:return 32}}var Uh=!1,ka=null,ja=null,Oa=null,qo=new Map,Vo=new Map,Ma=[],CT="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Kb(n,a){switch(n){case"focusin":case"focusout":ka=null;break;case"dragenter":case"dragleave":ja=null;break;case"mouseover":case"mouseout":Oa=null;break;case"pointerover":case"pointerout":qo.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Vo.delete(a.pointerId)}}function Go(n,a,i,c,f,p){return n===null||n.nativeEvent!==p?(n={blockedOn:a,domEventName:i,eventSystemFlags:c,nativeEvent:p,targetContainers:[f]},a!==null&&(a=Is(a),a!==null&&Vb(a)),n):(n.eventSystemFlags|=c,a=n.targetContainers,f!==null&&a.indexOf(f)===-1&&a.push(f),n)}function RT(n,a,i,c,f){switch(a){case"focusin":return ka=Go(ka,n,a,i,c,f),!0;case"dragenter":return ja=Go(ja,n,a,i,c,f),!0;case"mouseover":return Oa=Go(Oa,n,a,i,c,f),!0;case"pointerover":var p=f.pointerId;return qo.set(p,Go(qo.get(p)||null,n,a,i,c,f)),!0;case"gotpointercapture":return p=f.pointerId,Vo.set(p,Go(Vo.get(p)||null,n,a,i,c,f)),!0}return!1}function Yb(n){var a=Us(n.target);if(a!==null){var i=l(a);if(i!==null){if(a=i.tag,a===13){if(a=u(i),a!==null){n.blockedOn=a,lg(n.priority,function(){Gb(i)});return}}else if(a===31){if(a=d(i),a!==null){n.blockedOn=a,lg(n.priority,function(){Gb(i)});return}}else if(a===3&&i.stateNode.current.memoizedState.isDehydrated){n.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Kc(n){if(n.blockedOn!==null)return!1;for(var a=n.targetContainers;0<a.length;){var i=Ph(n.nativeEvent);if(i===null){i=n.nativeEvent;var c=new i.constructor(i.type,i);Pd=c,i.target.dispatchEvent(c),Pd=null}else return a=Is(i),a!==null&&Vb(a),n.blockedOn=i,!1;a.shift()}return!0}function Wb(n,a,i){Kc(n)&&i.delete(a)}function TT(){Uh=!1,ka!==null&&Kc(ka)&&(ka=null),ja!==null&&Kc(ja)&&(ja=null),Oa!==null&&Kc(Oa)&&(Oa=null),qo.forEach(Wb),Vo.forEach(Wb)}function Yc(n,a){n.blockedOn===a&&(n.blockedOn=null,Uh||(Uh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,TT)))}var Wc=null;function Xb(n){Wc!==n&&(Wc=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Wc===n&&(Wc=null);for(var a=0;a<n.length;a+=3){var i=n[a],c=n[a+1],f=n[a+2];if(typeof c!="function"){if(zh(c||i)===null)continue;break}var p=Is(i);p!==null&&(n.splice(a,3),a-=3,Pf(p,{pending:!0,data:f,method:i.method,action:c},c,f))}}))}function wi(n){function a(O){return Yc(O,n)}ka!==null&&Yc(ka,n),ja!==null&&Yc(ja,n),Oa!==null&&Yc(Oa,n),qo.forEach(a),Vo.forEach(a);for(var i=0;i<Ma.length;i++){var c=Ma[i];c.blockedOn===n&&(c.blockedOn=null)}for(;0<Ma.length&&(i=Ma[0],i.blockedOn===null);)Yb(i),i.blockedOn===null&&Ma.shift();if(i=(n.ownerDocument||n).$$reactFormReplay,i!=null)for(c=0;c<i.length;c+=3){var f=i[c],p=i[c+1],x=f[an]||null;if(typeof p=="function")x||Xb(i);else if(x){var R=null;if(p&&p.hasAttribute("formAction")){if(f=p,x=p[an]||null)R=x.formAction;else if(zh(f)!==null)continue}else R=x.action;typeof R=="function"?i[c+1]=R:(i.splice(c,3),c-=3),Xb(i)}}}function Jb(){function n(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(x){return f=x})},focusReset:"manual",scroll:"manual"})}function a(){f!==null&&(f(),f=null),c||setTimeout(i,20)}function i(){if(!c&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,f=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(i,100),function(){c=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),f!==null&&(f(),f=null)}}}function Ih(n){this._internalRoot=n}Xc.prototype.render=Ih.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(s(409));var i=a.current,c=Cn();Hb(i,c,n,a,null,null)},Xc.prototype.unmount=Ih.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;Hb(n.current,2,null,n,null,null),kc(),a[zs]=null}};function Xc(n){this._internalRoot=n}Xc.prototype.unstable_scheduleHydration=function(n){if(n){var a=Nd();n={blockedOn:null,target:n,priority:a};for(var i=0;i<Ma.length&&a!==0&&a<Ma[i].priority;i++);Ma.splice(i,0,n),i===0&&Yb(n)}};var Qb=t.version;if(Qb!=="19.2.6")throw Error(s(527,Qb,"19.2.6"));K.findDOMNode=function(n){var a=n._reactInternals;if(a===void 0)throw typeof n.render=="function"?Error(s(188)):(n=Object.keys(n).join(","),Error(s(268,n)));return n=m(a),n=n!==null?b(n):null,n=n===null?null:n.stateNode,n};var AT={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Jc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jc.isDisabled&&Jc.supportsFiber)try{ur=Jc.inject(AT),Pt=Jc}catch{}}return Ko.createRoot=function(n,a){if(!o(n))throw Error(s(299));var i=!1,c="",f=sy,p=iy,x=oy;return a!=null&&(a.unstable_strictMode===!0&&(i=!0),a.identifierPrefix!==void 0&&(c=a.identifierPrefix),a.onUncaughtError!==void 0&&(f=a.onUncaughtError),a.onCaughtError!==void 0&&(p=a.onCaughtError),a.onRecoverableError!==void 0&&(x=a.onRecoverableError)),a=$b(n,1,!1,null,null,i,c,null,f,p,x,Jb),n[zs]=a.current,wh(n),new Ih(a)},Ko.hydrateRoot=function(n,a,i){if(!o(n))throw Error(s(299));var c=!1,f="",p=sy,x=iy,R=oy,O=null;return i!=null&&(i.unstable_strictMode===!0&&(c=!0),i.identifierPrefix!==void 0&&(f=i.identifierPrefix),i.onUncaughtError!==void 0&&(p=i.onUncaughtError),i.onCaughtError!==void 0&&(x=i.onCaughtError),i.onRecoverableError!==void 0&&(R=i.onRecoverableError),i.formState!==void 0&&(O=i.formState)),a=$b(n,1,!0,a,i??null,c,f,O,p,x,R,Jb),a.context=Bb(null),i=a.current,c=Cn(),c=Ps(c),f=ya(c),f.callback=null,ba(i,f,c),i=c,a.current.lanes=i,ut(a,i),mr(a),n[zs]=a.current,wh(n),new Xc(a)},Ko.version="19.2.6",Ko}var l0;function UT(){if(l0)return Hh.exports;l0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Hh.exports=zT(),Hh.exports}var IT=UT();/**
|
||
* react-router v7.15.1
|
||
*
|
||
* Copyright (c) Remix Software Inc.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE.md file in the root directory of this source tree.
|
||
*
|
||
* @license MIT
|
||
*/var c0="popstate";function u0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function $T(e={}){function t(s,o){var m;let l=(m=o.state)==null?void 0:m.masked,{pathname:u,search:d,hash:h}=l||s.location;return xm("",{pathname:u,search:d,hash:h},o.state&&o.state.usr||null,o.state&&o.state.key||"default",l?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,o){return typeof o=="string"?o:cl(o)}return HT(t,r,null,e)}function ft(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Cr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function BT(){return Math.random().toString(36).substring(2,10)}function d0(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function xm(e,t,r=null,s,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Gi(t):t,state:r,key:t&&t.key||s||BT(),mask:o}}function cl({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Gi(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let s=e.indexOf("?");s>=0&&(t.search=e.substring(s),e=e.substring(0,s)),e&&(t.pathname=e)}return t}function HT(e,t,r,s={}){let{window:o=document.defaultView,v5Compat:l=!1}=s,u=o.history,d="POP",h=null,m=b();m==null&&(m=0,u.replaceState({...u.state,idx:m},""));function b(){return(u.state||{idx:null}).idx}function g(){d="POP";let T=b(),C=T==null?null:T-m;m=T,h&&h({action:d,location:S.location,delta:C})}function w(T,C){d="PUSH";let A=u0(T)?T:xm(S.location,T,C);m=b()+1;let N=d0(A,m),z=S.createHref(A.mask||A);try{u.pushState(N,"",z)}catch(F){if(F instanceof DOMException&&F.name==="DataCloneError")throw F;o.location.assign(z)}l&&h&&h({action:d,location:S.location,delta:1})}function _(T,C){d="REPLACE";let A=u0(T)?T:xm(S.location,T,C);m=b();let N=d0(A,m),z=S.createHref(A.mask||A);u.replaceState(N,"",z),l&&h&&h({action:d,location:S.location,delta:0})}function E(T){return qT(T)}let S={get action(){return d},get location(){return e(o,u)},listen(T){if(h)throw new Error("A history only accepts one active listener");return o.addEventListener(c0,g),h=T,()=>{o.removeEventListener(c0,g),h=null}},createHref(T){return t(o,T)},createURL:E,encodeLocation(T){let C=E(T);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:w,replace:_,go(T){return u.go(T)}};return S}function qT(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),ft(r,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:cl(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function tx(e,t,r="/"){return VT(e,t,r,!1)}function VT(e,t,r,s,o){let l=typeof t=="string"?Gi(t):t,u=ea(l.pathname||"/",r);if(u==null)return null;let d=GT(e),h=null,m=rA(u);for(let b=0;h==null&&b<d.length;++b)h=tA(d[b],m,s);return h}function GT(e){let t=nx(e);return FT(t),t}function nx(e,t=[],r=[],s="",o=!1){let l=(u,d,h=o,m)=>{let b={relativePath:m===void 0?u.path||"":m,caseSensitive:u.caseSensitive===!0,childrenIndex:d,route:u};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(s)&&h)return;ft(b.relativePath.startsWith(s),`Absolute route path "${b.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),b.relativePath=b.relativePath.slice(s.length)}let g=tr([s,b.relativePath]),w=r.concat(b);u.children&&u.children.length>0&&(ft(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),nx(u.children,t,w,g,h)),!(u.path==null&&!u.index)&&t.push({path:g,score:ZT(g,u.index),routesMeta:w})};return e.forEach((u,d)=>{var h;if(u.path===""||!((h=u.path)!=null&&h.includes("?")))l(u,d);else for(let m of rx(u.path))l(u,d,!0,m)}),t}function rx(e){let t=e.split("/");if(t.length===0)return[];let[r,...s]=t,o=r.endsWith("?"),l=r.replace(/\?$/,"");if(s.length===0)return o?[l,""]:[l];let u=rx(s.join("/")),d=[];return d.push(...u.map(h=>h===""?l:[l,h].join("/"))),o&&d.push(...u),d.map(h=>e.startsWith("/")&&h===""?"/":h)}function FT(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:eA(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var KT=/^:[\w-]+$/,YT=3,WT=2,XT=1,JT=10,QT=-2,f0=e=>e==="*";function ZT(e,t){let r=e.split("/"),s=r.length;return r.some(f0)&&(s+=QT),t&&(s+=WT),r.filter(o=>!f0(o)).reduce((o,l)=>o+(KT.test(l)?YT:l===""?XT:JT),s)}function eA(e,t){return e.length===t.length&&e.slice(0,-1).every((s,o)=>s===t[o])?e[e.length-1]-t[t.length-1]:0}function tA(e,t,r=!1){let{routesMeta:s}=e,o={},l="/",u=[];for(let d=0;d<s.length;++d){let h=s[d],m=d===s.length-1,b=l==="/"?t:t.slice(l.length)||"/",g=Ou({path:h.relativePath,caseSensitive:h.caseSensitive,end:m},b),w=h.route;if(!g&&m&&r&&!s[s.length-1].route.index&&(g=Ou({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},b)),!g)return null;Object.assign(o,g.params),u.push({params:o,pathname:tr([l,g.pathname]),pathnameBase:oA(tr([l,g.pathnameBase])),route:w}),g.pathnameBase!=="/"&&(l=tr([l,g.pathnameBase]))}return u}function Ou(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=nA(e.path,e.caseSensitive,e.end),o=t.match(r);if(!o)return null;let l=o[0],u=l.replace(/(.)\/+$/,"$1"),d=o.slice(1);return{params:s.reduce((m,{paramName:b,isOptional:g},w)=>{if(b==="*"){let E=d[w]||"";u=l.slice(0,l.length-E.length).replace(/(.)\/+$/,"$1")}const _=d[w];return g&&!_?m[b]=void 0:m[b]=(_||"").replace(/%2F/g,"/"),m},{}),pathname:l,pathnameBase:u,pattern:e}}function nA(e,t=!1,r=!0){Cr(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,h,m,b)=>{if(s.push({paramName:d,isOptional:h!=null}),h){let g=b.charAt(m+u.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),s]}function rA(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Cr(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function ea(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,s=e.charAt(r);return s&&s!=="/"?null:e.slice(r)||"/"}var aA=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function sA(e,t="/"){let{pathname:r,search:s="",hash:o=""}=typeof e=="string"?Gi(e):e,l;return r?(r=sx(r),r.startsWith("/")?l=h0(r.substring(1),"/"):l=h0(r,t)):l=t,{pathname:l,search:lA(s),hash:cA(o)}}function h0(e,t){let r=Mu(t).split("/");return e.split("/").forEach(o=>{o===".."?r.length>1&&r.pop():o!=="."&&r.push(o)}),r.length>1?r.join("/"):"/"}function Fh(e,t,r,s){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function iA(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function ax(e){let t=iA(e);return t.map((r,s)=>s===t.length-1?r.pathname:r.pathnameBase)}function ap(e,t,r,s=!1){let o;typeof e=="string"?o=Gi(e):(o={...e},ft(!o.pathname||!o.pathname.includes("?"),Fh("?","pathname","search",o)),ft(!o.pathname||!o.pathname.includes("#"),Fh("#","pathname","hash",o)),ft(!o.search||!o.search.includes("#"),Fh("#","search","hash",o)));let l=e===""||o.pathname==="",u=l?"/":o.pathname,d;if(u==null)d=r;else{let g=t.length-1;if(!s&&u.startsWith("..")){let w=u.split("/");for(;w[0]==="..";)w.shift(),g-=1;o.pathname=w.join("/")}d=g>=0?t[g]:"/"}let h=sA(o,d),m=u&&u!=="/"&&u.endsWith("/"),b=(l||u===".")&&r.endsWith("/");return!h.pathname.endsWith("/")&&(m||b)&&(h.pathname+="/"),h}var sx=e=>e.replace(/\/\/+/g,"/"),tr=e=>sx(e.join("/")),Mu=e=>e.replace(/\/+$/,""),oA=e=>Mu(e).replace(/^\/*/,"/"),lA=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,cA=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,uA=class{constructor(e,t,r,s=!1){this.status=e,this.statusText=t||"",this.internal=s,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function dA(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function fA(e){let t=e.map(r=>r.route.path).filter(Boolean);return tr(t)||"/"}var ix=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ox(e,t){let r=e;if(typeof r!="string"||!aA.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,o=!1;if(ix)try{let l=new URL(window.location.href),u=r.startsWith("//")?new URL(l.protocol+r):new URL(r),d=ea(u.pathname,t);u.origin===l.origin&&d!=null?r=d+u.search+u.hash:o=!0}catch{Cr(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:o,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var lx=["POST","PUT","PATCH","DELETE"];new Set(lx);var hA=["GET",...lx];new Set(hA);var Fi=y.createContext(null);Fi.displayName="DataRouter";var rd=y.createContext(null);rd.displayName="DataRouterState";var cx=y.createContext(!1);function mA(){return y.useContext(cx)}var ux=y.createContext({isTransitioning:!1});ux.displayName="ViewTransition";var pA=y.createContext(new Map);pA.displayName="Fetchers";var gA=y.createContext(null);gA.displayName="Await";var qn=y.createContext(null);qn.displayName="Navigation";var El=y.createContext(null);El.displayName="Location";var aa=y.createContext({outlet:null,matches:[],isDataRoute:!1});aa.displayName="Route";var sp=y.createContext(null);sp.displayName="RouteError";var dx="REACT_ROUTER_ERROR",vA="REDIRECT",yA="ROUTE_ERROR_RESPONSE";function bA(e){if(e.startsWith(`${dx}:${vA}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function wA(e){if(e.startsWith(`${dx}:${yA}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new uA(t.status,t.statusText,t.data)}catch{}}function xA(e,{relative:t}={}){ft(Cl(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=y.useContext(qn),{hash:o,pathname:l,search:u}=Rl(e,{relative:t}),d=l;return r!=="/"&&(d=l==="/"?r:tr([r,l])),s.createHref({pathname:d,search:u,hash:o})}function Cl(){return y.useContext(El)!=null}function sa(){return ft(Cl(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(El).location}var fx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function hx(e){y.useContext(qn).static||y.useLayoutEffect(e)}function _A(){let{isDataRoute:e}=y.useContext(aa);return e?LA():SA()}function SA(){ft(Cl(),"useNavigate() may be used only in the context of a <Router> component.");let e=y.useContext(Fi),{basename:t,navigator:r}=y.useContext(qn),{matches:s}=y.useContext(aa),{pathname:o}=sa(),l=JSON.stringify(ax(s)),u=y.useRef(!1);return hx(()=>{u.current=!0}),y.useCallback((h,m={})=>{if(Cr(u.current,fx),!u.current)return;if(typeof h=="number"){r.go(h);return}let b=ap(h,JSON.parse(l),o,m.relative==="path");e==null&&t!=="/"&&(b.pathname=b.pathname==="/"?t:tr([t,b.pathname])),(m.replace?r.replace:r.push)(b,m.state,m)},[t,r,l,o,e])}y.createContext(null);function Rl(e,{relative:t}={}){let{matches:r}=y.useContext(aa),{pathname:s}=sa(),o=JSON.stringify(ax(r));return y.useMemo(()=>ap(e,JSON.parse(o),s,t==="path"),[e,o,s,t])}function EA(e,t){return mx(e,t)}function mx(e,t,r){var T;ft(Cl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=y.useContext(qn),{matches:o}=y.useContext(aa),l=o[o.length-1],u=l?l.params:{},d=l?l.pathname:"/",h=l?l.pathnameBase:"/",m=l&&l.route;{let C=m&&m.path||"";gx(d,!m||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
||
|
||
Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let b=sa(),g;if(t){let C=typeof t=="string"?Gi(t):t;ft(h==="/"||((T=C.pathname)==null?void 0:T.startsWith(h)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${C.pathname}" was given in the \`location\` prop.`),g=C}else g=b;let w=g.pathname||"/",_=w;if(h!=="/"){let C=h.replace(/^\//,"").split("/");_="/"+w.replace(/^\//,"").split("/").slice(C.length).join("/")}let E=r&&r.state.matches.length?r.state.matches.map(C=>Object.assign(C,{route:r.manifest[C.route.id]||C.route})):tx(e,{pathname:_});Cr(m||E!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Cr(E==null||E[E.length-1].route.element!==void 0||E[E.length-1].route.Component!==void 0||E[E.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let S=NA(E&&E.map(C=>Object.assign({},C,{params:Object.assign({},u,C.params),pathname:tr([h,s.encodeLocation?s.encodeLocation(C.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?h:tr([h,s.encodeLocation?s.encodeLocation(C.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),o,r);return t&&S?y.createElement(El.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...g},navigationType:"POP"}},S):S}function CA(){let e=DA(),t=dA(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:s},l={padding:"2px 4px",backgroundColor:s},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:l},"ErrorBoundary")," or"," ",y.createElement("code",{style:l},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},t),r?y.createElement("pre",{style:o},r):null,u)}var RA=y.createElement(CA,null),px=class extends y.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=wA(e.digest);r&&(e=r)}let t=e!==void 0?y.createElement(aa.Provider,{value:this.props.routeContext},y.createElement(sp.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?y.createElement(TA,{error:e},t):t}};px.contextType=cx;var Kh=new WeakMap;function TA({children:e,error:t}){let{basename:r}=y.useContext(qn);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=bA(t.digest);if(s){let o=Kh.get(t);if(o)throw o;let l=ox(s.location,r);if(ix&&!Kh.get(t))if(l.isExternal||s.reloadDocument)window.location.href=l.absoluteURL||l.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:s.replace}));throw Kh.set(t,u),u}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function AA({routeContext:e,match:t,children:r}){let s=y.useContext(Fi);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),y.createElement(aa.Provider,{value:e},r)}function NA(e,t=[],r){let s=r==null?void 0:r.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let o=e,l=s==null?void 0:s.errors;if(l!=null){let b=o.findIndex(g=>g.route.id&&(l==null?void 0:l[g.route.id])!==void 0);ft(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),o=o.slice(0,Math.min(o.length,b+1))}let u=!1,d=-1;if(r&&s){u=s.renderFallback;for(let b=0;b<o.length;b++){let g=o[b];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(d=b),g.route.id){let{loaderData:w,errors:_}=s,E=g.route.loader&&!w.hasOwnProperty(g.route.id)&&(!_||_[g.route.id]===void 0);if(g.route.lazy||E){r.isStatic&&(u=!0),d>=0?o=o.slice(0,d+1):o=[o[0]];break}}}}let h=r==null?void 0:r.onError,m=s&&h?(b,g)=>{var w,_;h(b,{location:s.location,params:((_=(w=s.matches)==null?void 0:w[0])==null?void 0:_.params)??{},pattern:fA(s.matches),errorInfo:g})}:void 0;return o.reduceRight((b,g,w)=>{let _,E=!1,S=null,T=null;s&&(_=l&&g.route.id?l[g.route.id]:void 0,S=g.route.errorElement||RA,u&&(d<0&&w===0?(gx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),E=!0,T=null):d===w&&(E=!0,T=g.route.hydrateFallbackElement||null)));let C=t.concat(o.slice(0,w+1)),A=()=>{let N;return _?N=S:E?N=T:g.route.Component?N=y.createElement(g.route.Component,null):g.route.element?N=g.route.element:N=b,y.createElement(AA,{match:g,routeContext:{outlet:b,matches:C,isDataRoute:s!=null},children:N})};return s&&(g.route.ErrorBoundary||g.route.errorElement||w===0)?y.createElement(px,{location:s.location,revalidation:s.revalidation,component:S,error:_,children:A(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:m}):A()},null)}function ip(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function kA(e){let t=y.useContext(Fi);return ft(t,ip(e)),t}function jA(e){let t=y.useContext(rd);return ft(t,ip(e)),t}function OA(e){let t=y.useContext(aa);return ft(t,ip(e)),t}function op(e){let t=OA(e),r=t.matches[t.matches.length-1];return ft(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function MA(){return op("useRouteId")}function DA(){var s;let e=y.useContext(sp),t=jA("useRouteError"),r=op("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[r]}function LA(){let{router:e}=kA("useNavigate"),t=op("useNavigate"),r=y.useRef(!1);return hx(()=>{r.current=!0}),y.useCallback(async(o,l={})=>{Cr(r.current,fx),r.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...l}))},[e,t])}var m0={};function gx(e,t,r){!t&&!m0[e]&&(m0[e]=!0,Cr(!1,r))}y.memo(PA);function PA({routes:e,manifest:t,future:r,state:s,isStatic:o,onError:l}){return mx(e,void 0,{manifest:t,state:s,isStatic:o,onError:l})}function vx(e){ft(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function zA({basename:e="/",children:t=null,location:r,navigationType:s="POP",navigator:o,static:l=!1,useTransitions:u}){ft(!Cl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),h=y.useMemo(()=>({basename:d,navigator:o,static:l,useTransitions:u,future:{}}),[d,o,l,u]);typeof r=="string"&&(r=Gi(r));let{pathname:m="/",search:b="",hash:g="",state:w=null,key:_="default",mask:E}=r,S=y.useMemo(()=>{let T=ea(m,d);return T==null?null:{location:{pathname:T,search:b,hash:g,state:w,key:_,mask:E},navigationType:s}},[d,m,b,g,w,_,s,E]);return Cr(S!=null,`<Router basename="${d}"> is not able to match the URL "${m}${b}${g}" because it does not start with the basename, so the <Router> won't render anything.`),S==null?null:y.createElement(qn.Provider,{value:h},y.createElement(El.Provider,{children:t,value:S}))}function UA({children:e,location:t}){return EA(_m(e),t)}function _m(e,t=[]){let r=[];return y.Children.forEach(e,(s,o)=>{if(!y.isValidElement(s))return;let l=[...t,o];if(s.type===y.Fragment){r.push.apply(r,_m(s.props.children,l));return}ft(s.type===vx,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ft(!s.props.index||!s.props.children,"An index route cannot have child routes.");let u={id:s.props.id||l.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(u.children=_m(s.props.children,l)),r.push(u)}),r}var Eu="get",Cu="application/x-www-form-urlencoded";function ad(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function IA(e){return ad(e)&&e.tagName.toLowerCase()==="button"}function $A(e){return ad(e)&&e.tagName.toLowerCase()==="form"}function BA(e){return ad(e)&&e.tagName.toLowerCase()==="input"}function HA(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function qA(e,t){return e.button===0&&(!t||t==="_self")&&!HA(e)}var Qc=null;function VA(){if(Qc===null)try{new FormData(document.createElement("form"),0),Qc=!1}catch{Qc=!0}return Qc}var GA=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Yh(e){return e!=null&&!GA.has(e)?(Cr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Cu}"`),null):e}function FA(e,t){let r,s,o,l,u;if($A(e)){let d=e.getAttribute("action");s=d?ea(d,t):null,r=e.getAttribute("method")||Eu,o=Yh(e.getAttribute("enctype"))||Cu,l=new FormData(e)}else if(IA(e)||BA(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=e.getAttribute("formaction")||d.getAttribute("action");if(s=h?ea(h,t):null,r=e.getAttribute("formmethod")||d.getAttribute("method")||Eu,o=Yh(e.getAttribute("formenctype"))||Yh(d.getAttribute("enctype"))||Cu,l=new FormData(d,e),!VA()){let{name:m,type:b,value:g}=e;if(b==="image"){let w=m?`${m}.`:"";l.append(`${w}x`,"0"),l.append(`${w}y`,"0")}else m&&l.append(m,g)}}else{if(ad(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Eu,s=null,o=Cu,u=e}return l&&o==="text/plain"&&(u=l,l=void 0),{action:s,method:r.toLowerCase(),encType:o,formData:l,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function lp(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function yx(e,t,r,s){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${s}`:o.pathname=`${o.pathname}.${s}`:o.pathname==="/"?o.pathname=`_root.${s}`:t&&ea(o.pathname,t)==="/"?o.pathname=`${Mu(t)}/_root.${s}`:o.pathname=`${Mu(o.pathname)}.${s}`,o}async function KA(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function YA(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function WA(e,t,r){let s=await Promise.all(e.map(async o=>{let l=t.routes[o.route.id];if(l){let u=await KA(l,r);return u.links?u.links():[]}return[]}));return ZA(s.flat(1).filter(YA).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function p0(e,t,r,s,o,l){let u=(h,m)=>r[m]?h.route.id!==r[m].route.id:!0,d=(h,m)=>{var b;return r[m].pathname!==h.pathname||((b=r[m].route.path)==null?void 0:b.endsWith("*"))&&r[m].params["*"]!==h.params["*"]};return l==="assets"?t.filter((h,m)=>u(h,m)||d(h,m)):l==="data"?t.filter((h,m)=>{var g;let b=s.routes[h.route.id];if(!b||!b.hasLoader)return!1;if(u(h,m)||d(h,m))return!0;if(h.route.shouldRevalidate){let w=h.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((g=r[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof w=="boolean")return w}return!0}):[]}function XA(e,t,{includeHydrateFallback:r}={}){return JA(e.map(s=>{let o=t.routes[s.route.id];if(!o)return[];let l=[o.module];return o.clientActionModule&&(l=l.concat(o.clientActionModule)),o.clientLoaderModule&&(l=l.concat(o.clientLoaderModule)),r&&o.hydrateFallbackModule&&(l=l.concat(o.hydrateFallbackModule)),o.imports&&(l=l.concat(o.imports)),l}).flat(1))}function JA(e){return[...new Set(e)]}function QA(e){let t={},r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function ZA(e,t){let r=new Set;return new Set(t),e.reduce((s,o)=>{let l=JSON.stringify(QA(o));return r.has(l)||(r.add(l),s.push({key:l,link:o})),s},[])}function cp(){let e=y.useContext(Fi);return lp(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function eN(){let e=y.useContext(rd);return lp(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var up=y.createContext(void 0);up.displayName="FrameworkContext";function dp(){let e=y.useContext(up);return lp(e,"You must render this element inside a <HydratedRouter> element"),e}function tN(e,t){let r=y.useContext(up),[s,o]=y.useState(!1),[l,u]=y.useState(!1),{onFocus:d,onBlur:h,onMouseEnter:m,onMouseLeave:b,onTouchStart:g}=t,w=y.useRef(null);y.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let S=C=>{C.forEach(A=>{u(A.isIntersecting)})},T=new IntersectionObserver(S,{threshold:.5});return w.current&&T.observe(w.current),()=>{T.disconnect()}}},[e]),y.useEffect(()=>{if(s){let S=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(S)}}},[s]);let _=()=>{o(!0)},E=()=>{o(!1),u(!1)};return r?e!=="intent"?[l,w,{}]:[l,w,{onFocus:Yo(d,_),onBlur:Yo(h,E),onMouseEnter:Yo(m,_),onMouseLeave:Yo(b,E),onTouchStart:Yo(g,_)}]:[!1,w,{}]}function Yo(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function nN({page:e,...t}){let r=mA(),{router:s}=cp(),o=y.useMemo(()=>tx(s.routes,e,s.basename),[s.routes,e,s.basename]);return o?r?y.createElement(aN,{page:e,matches:o,...t}):y.createElement(sN,{page:e,matches:o,...t}):null}function rN(e){let{manifest:t,routeModules:r}=dp(),[s,o]=y.useState([]);return y.useEffect(()=>{let l=!1;return WA(e,t,r).then(u=>{l||o(u)}),()=>{l=!0}},[e,t,r]),s}function aN({page:e,matches:t,...r}){let s=sa(),{future:o}=dp(),{basename:l}=cp(),u=y.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let d=yx(e,l,o.unstable_trailingSlashAwareDataRequests,"rsc"),h=!1,m=[];for(let b of t)typeof b.route.shouldRevalidate=="function"?h=!0:m.push(b.route.id);return h&&m.length>0&&d.searchParams.set("_routes",m.join(",")),[d.pathname+d.search]},[l,o.unstable_trailingSlashAwareDataRequests,e,s,t]);return y.createElement(y.Fragment,null,u.map(d=>y.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...r})))}function sN({page:e,matches:t,...r}){let s=sa(),{future:o,manifest:l,routeModules:u}=dp(),{basename:d}=cp(),{loaderData:h,matches:m}=eN(),b=y.useMemo(()=>p0(e,t,m,l,s,"data"),[e,t,m,l,s]),g=y.useMemo(()=>p0(e,t,m,l,s,"assets"),[e,t,m,l,s]),w=y.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let S=new Set,T=!1;if(t.forEach(A=>{var z;let N=l.routes[A.route.id];!N||!N.hasLoader||(!b.some(F=>F.route.id===A.route.id)&&A.route.id in h&&((z=u[A.route.id])!=null&&z.shouldRevalidate)||N.hasClientLoader?T=!0:S.add(A.route.id))}),S.size===0)return[];let C=yx(e,d,o.unstable_trailingSlashAwareDataRequests,"data");return T&&S.size>0&&C.searchParams.set("_routes",t.filter(A=>S.has(A.route.id)).map(A=>A.route.id).join(",")),[C.pathname+C.search]},[d,o.unstable_trailingSlashAwareDataRequests,h,s,l,b,t,e,u]),_=y.useMemo(()=>XA(g,l),[g,l]),E=rN(g);return y.createElement(y.Fragment,null,w.map(S=>y.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...r})),_.map(S=>y.createElement("link",{key:S,rel:"modulepreload",href:S,...r})),E.map(({key:S,link:T})=>y.createElement("link",{key:S,nonce:r.nonce,...T,crossOrigin:T.crossOrigin??r.crossOrigin})))}function iN(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var oN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{oN&&(window.__reactRouterVersion="7.15.1")}catch{}function lN({basename:e,children:t,useTransitions:r,window:s}){let o=y.useRef();o.current==null&&(o.current=$T({window:s,v5Compat:!0}));let l=o.current,[u,d]=y.useState({action:l.action,location:l.location}),h=y.useCallback(m=>{r===!1?d(m):y.startTransition(()=>d(m))},[r]);return y.useLayoutEffect(()=>l.listen(h),[l,h]),y.createElement(zA,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:l,useTransitions:r})}var bx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,wx=y.forwardRef(function({onClick:t,discover:r="render",prefetch:s="none",relative:o,reloadDocument:l,replace:u,mask:d,state:h,target:m,to:b,preventScrollReset:g,viewTransition:w,defaultShouldRevalidate:_,...E},S){let{basename:T,navigator:C,useTransitions:A}=y.useContext(qn),N=typeof b=="string"&&bx.test(b),z=ox(b,T);b=z.to;let F=xA(b,{relative:o}),B=sa(),P=null;if(d){let fe=ap(d,[],B.mask?B.mask.pathname:"/",!0);T!=="/"&&(fe.pathname=fe.pathname==="/"?T:tr([T,fe.pathname])),P=C.createHref(fe)}let[V,re,le]=tN(s,E),ce=fN(b,{replace:u,mask:d,state:h,target:m,preventScrollReset:g,relative:o,viewTransition:w,defaultShouldRevalidate:_,useTransitions:A});function de(fe){t&&t(fe),fe.defaultPrevented||ce(fe)}let ge=!(z.isExternal||l),me=y.createElement("a",{...E,...le,href:(ge?P:void 0)||z.absoluteURL||F,onClick:ge?de:t,ref:iN(S,re),target:m,"data-discover":!N&&r==="render"?"true":void 0});return V&&!N?y.createElement(y.Fragment,null,me,y.createElement(nN,{page:F})):me});wx.displayName="Link";var cN=y.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:s="",end:o=!1,style:l,to:u,viewTransition:d,children:h,...m},b){let g=Rl(u,{relative:m.relative}),w=sa(),_=y.useContext(rd),{navigator:E,basename:S}=y.useContext(qn),T=_!=null&&vN(g)&&d===!0,C=E.encodeLocation?E.encodeLocation(g).pathname:g.pathname,A=w.pathname,N=_&&_.navigation&&_.navigation.location?_.navigation.location.pathname:null;r||(A=A.toLowerCase(),N=N?N.toLowerCase():null,C=C.toLowerCase()),N&&S&&(N=ea(N,S)||N);const z=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let F=A===C||!o&&A.startsWith(C)&&A.charAt(z)==="/",B=N!=null&&(N===C||!o&&N.startsWith(C)&&N.charAt(C.length)==="/"),P={isActive:F,isPending:B,isTransitioning:T},V=F?t:void 0,re;typeof s=="function"?re=s(P):re=[s,F?"active":null,B?"pending":null,T?"transitioning":null].filter(Boolean).join(" ");let le=typeof l=="function"?l(P):l;return y.createElement(wx,{...m,"aria-current":V,className:re,ref:b,style:le,to:u,viewTransition:d},typeof h=="function"?h(P):h)});cN.displayName="NavLink";var uN=y.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:s,replace:o,state:l,method:u=Eu,action:d,onSubmit:h,relative:m,preventScrollReset:b,viewTransition:g,defaultShouldRevalidate:w,..._},E)=>{let{useTransitions:S}=y.useContext(qn),T=pN(),C=gN(d,{relative:m}),A=u.toLowerCase()==="get"?"get":"post",N=typeof d=="string"&&bx.test(d),z=F=>{if(h&&h(F),F.defaultPrevented)return;F.preventDefault();let B=F.nativeEvent.submitter,P=(B==null?void 0:B.getAttribute("formmethod"))||u,V=()=>T(B||F.currentTarget,{fetcherKey:t,method:P,navigate:r,replace:o,state:l,relative:m,preventScrollReset:b,viewTransition:g,defaultShouldRevalidate:w});S&&r!==!1?y.startTransition(()=>V()):V()};return y.createElement("form",{ref:E,method:A,action:C,onSubmit:s?h:z,..._,"data-discover":!N&&e==="render"?"true":void 0})});uN.displayName="Form";function dN(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function xx(e){let t=y.useContext(Fi);return ft(t,dN(e)),t}function fN(e,{target:t,replace:r,mask:s,state:o,preventScrollReset:l,relative:u,viewTransition:d,defaultShouldRevalidate:h,useTransitions:m}={}){let b=_A(),g=sa(),w=Rl(e,{relative:u});return y.useCallback(_=>{if(qA(_,t)){_.preventDefault();let E=r!==void 0?r:cl(g)===cl(w),S=()=>b(e,{replace:E,mask:s,state:o,preventScrollReset:l,relative:u,viewTransition:d,defaultShouldRevalidate:h});m?y.startTransition(()=>S()):S()}},[g,b,w,r,s,o,t,e,l,u,d,h,m])}var hN=0,mN=()=>`__${String(++hN)}__`;function pN(){let{router:e}=xx("useSubmit"),{basename:t}=y.useContext(qn),r=MA(),s=e.fetch,o=e.navigate;return y.useCallback(async(l,u={})=>{let{action:d,method:h,encType:m,formData:b,body:g}=FA(l,t);if(u.navigate===!1){let w=u.fetcherKey||mN();await s(w,r,u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:b,body:g,formMethod:u.method||h,formEncType:u.encType||m,flushSync:u.flushSync})}else await o(u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:b,body:g,formMethod:u.method||h,formEncType:u.encType||m,replace:u.replace,state:u.state,fromRouteId:r,flushSync:u.flushSync,viewTransition:u.viewTransition})},[s,o,t,r])}function gN(e,{relative:t}={}){let{basename:r}=y.useContext(qn),s=y.useContext(aa);ft(s,"useFormAction must be used inside a RouteContext");let[o]=s.matches.slice(-1),l={...Rl(e||".",{relative:t})},u=sa();if(e==null){l.search=u.search;let d=new URLSearchParams(l.search),h=d.getAll("index");if(h.some(b=>b==="")){d.delete("index"),h.filter(g=>g).forEach(g=>d.append("index",g));let b=d.toString();l.search=b?`?${b}`:""}}return(!e||e===".")&&o.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(l.pathname=l.pathname==="/"?r:tr([r,l.pathname])),cl(l)}function vN(e,{relative:t}={}){let r=y.useContext(ux);ft(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=xx("useViewTransitionState"),o=Rl(e,{relative:t});if(!r.isTransitioning)return!1;let l=ea(r.currentLocation.pathname,s)||r.currentLocation.pathname,u=ea(r.nextLocation.pathname,s)||r.nextLocation.pathname;return Ou(o.pathname,u)!=null||Ou(o.pathname,l)!=null}var Tl=ex();const _x=Zw(Tl);var xr=function(){return xr=Object.assign||function(t){for(var r,s=1,o=arguments.length;s<o;s++){r=arguments[s];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(t[l]=r[l])}return t},xr.apply(this,arguments)};function Ki(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(r[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(e);o<s.length;o++)t.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(e,s[o])&&(r[s[o]]=e[s[o]]);return r}function yN(e,t,r,s){function o(l){return l instanceof r?l:new r(function(u){u(l)})}return new(r||(r=Promise))(function(l,u){function d(b){try{m(s.next(b))}catch(g){u(g)}}function h(b){try{m(s.throw(b))}catch(g){u(g)}}function m(b){b.done?l(b.value):o(b.value).then(d,h)}m((s=s.apply(e,t||[])).next())})}function bN(e,t,r){if(r||arguments.length===2)for(var s=0,o=t.length,l;s<o;s++)(l||!(s in t))&&(l||(l=Array.prototype.slice.call(t,0,s)),l[s]=t[s]);return e.concat(l||Array.prototype.slice.call(t))}const wN=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class fp extends Error{constructor(t,r="FunctionsError",s){super(t),this.name=r,this.context=s}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class xN extends fp{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class g0 extends fp{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class v0 extends fp{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Sm;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(Sm||(Sm={}));class _N{constructor(t,{headers:r={},customFetch:s,region:o=Sm.Any}={}){this.url=t,this.headers=r,this.region=o,this.fetch=wN(s)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return yN(this,arguments,void 0,function*(r,s={}){var o;let l,u;try{const{headers:d,method:h,body:m,signal:b,timeout:g}=s;let w={},{region:_}=s;_||(_=this.region);const E=new URL(`${this.url}/${r}`);_&&_!=="any"&&(w["x-region"]=_,E.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 T=b;g&&(u=new AbortController,l=setTimeout(()=>u.abort(),g),b?(T=u.signal,b.addEventListener("abort",()=>u.abort())):T=u.signal);const C=yield this.fetch(E.toString(),{method:h||"POST",headers:Object.assign(Object.assign(Object.assign({},w),this.headers),d),body:S,signal:T}).catch(F=>{throw new xN(F)}),A=C.headers.get("x-relay-error");if(A&&A==="true")throw new g0(C);if(!C.ok)throw new v0(C);let N=((o=C.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),z;return N==="application/json"?z=yield C.json():N==="application/octet-stream"||N==="application/pdf"?z=yield C.blob():N==="text/event-stream"?z=C:N==="multipart/form-data"?z=yield C.formData():z=yield C.text(),{data:z,error:null,response:C}}catch(d){return{data:null,error:d,response:d instanceof v0||d instanceof g0?d.context:void 0}}finally{l&&clearTimeout(l)}})}}const Sx=3,y0=e=>Math.min(1e3*2**e,3e4),SN=[520,503],Ex=["GET","HEAD","OPTIONS"];var EN=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function b0(e,t){return new Promise(r=>{if(t!=null&&t.aborted){r();return}const s=setTimeout(()=>{t==null||t.removeEventListener("abort",o),r()},e);function o(){clearTimeout(s),r()}t==null||t.addEventListener("abort",o)})}function CN(e,t,r,s){return!(!s||r>=Sx||!Ex.includes(e)||!SN.includes(t))}var RN=class{constructor(e){var t,r,s,o,l;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(r=e.isMaybeSingle)!==null&&r!==void 0?r:!1,this.shouldStripNulls=(s=e.shouldStripNulls)!==null&&s!==void 0?s:!1,this.urlLengthLimit=(o=e.urlLengthLimit)!==null&&o!==void 0?o:8e3,this.retryEnabled=(l=e.retry)!==null&&l!==void 0?l:!0,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var r=this;if(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"),this.shouldStripNulls){const u=this.headers.get("Accept");u==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!u||u==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const s=this.fetch;let l=(async()=>{let u=0;for(;;){const m=new Headers(r.headers);u>0&&m.set("X-Retry-Count",String(u));let b;try{b=await s(r.url.toString(),{method:r.method,headers:m,body:JSON.stringify(r.body,(g,w)=>typeof w=="bigint"?w.toString():w),signal:r.signal})}catch(g){if((g==null?void 0:g.name)==="AbortError"||(g==null?void 0:g.code)==="ABORT_ERR"||!Ex.includes(r.method))throw g;if(r.retryEnabled&&u<Sx){const w=y0(u);u++,await b0(w,r.signal);continue}throw g}if(CN(r.method,b.status,u,r.retryEnabled)){var d,h;const g=(d=(h=b.headers)===null||h===void 0?void 0:h.get("Retry-After"))!==null&&d!==void 0?d:null,w=g!==null?Math.max(0,parseInt(g,10)||0)*1e3:y0(u);await b.text(),u++,await b0(w,r.signal);continue}return await r.processResponse(b)}})();return this.shouldThrowOnError||(l=l.catch(u=>{var d;let h="",m="",b="";const g=u==null?void 0:u.cause;if(g){var w,_,E,S;const A=(w=g==null?void 0:g.message)!==null&&w!==void 0?w:"",N=(_=g==null?void 0:g.code)!==null&&_!==void 0?_:"";h=`${(E=u==null?void 0:u.name)!==null&&E!==void 0?E:"FetchError"}: ${u==null?void 0:u.message}`,h+=`
|
||
|
||
Caused by: ${(S=g==null?void 0:g.name)!==null&&S!==void 0?S:"Error"}: ${A}`,N&&(h+=` (${N})`),g!=null&&g.stack&&(h+=`
|
||
${g.stack}`)}else{var T;h=(T=u==null?void 0:u.stack)!==null&&T!==void 0?T:""}const C=this.url.toString().length;return(u==null?void 0:u.name)==="AbortError"||(u==null?void 0:u.code)==="ABORT_ERR"?(b="",m="Request was aborted (timeout or manual cancellation)",C>this.urlLengthLimit&&(m+=`. Note: Your request URL is ${C} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((g==null?void 0:g.name)==="HeadersOverflowError"||(g==null?void 0:g.code)==="UND_ERR_HEADERS_OVERFLOW")&&(b="",m="HTTP headers exceeded server limits (typically 16KB)",C>this.urlLengthLimit&&(m+=`. Your request URL is ${C} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(d=u==null?void 0:u.name)!==null&&d!==void 0?d:"FetchError"}: ${u==null?void 0:u.message}`,details:h,hint:m,code:b},data:null,count:null,status:0,statusText:""}})),l.then(e,t)}async processResponse(e){var t=this;let r=null,s=null,o=null,l=e.status,u=e.statusText;if(e.ok){var d,h;if(t.method!=="HEAD"){var m;const w=await e.text();w===""||(t.headers.get("Accept")==="text/csv"||t.headers.get("Accept")&&(!((m=t.headers.get("Accept"))===null||m===void 0)&&m.includes("application/vnd.pgrst.plan+text"))?s=w:s=JSON.parse(w))}const b=(d=t.headers.get("Prefer"))===null||d===void 0?void 0:d.match(/count=(exact|planned|estimated)/),g=(h=e.headers.get("content-range"))===null||h===void 0?void 0:h.split("/");b&&g&&g.length>1&&(o=parseInt(g[1])),t.isMaybeSingle&&Array.isArray(s)&&(s.length>1?(r={code:"PGRST116",details:`Results contain ${s.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},s=null,o=null,l=406,u="Not Acceptable"):s.length===1?s=s[0]:s=null)}else{const b=await e.text();try{r=JSON.parse(b),Array.isArray(r)&&e.status===404&&(s=[],r=null,l=200,u="OK")}catch{e.status===404&&b===""?(l=204,u="No Content"):r={message:b}}if(r&&t.shouldThrowOnError)throw new EN(r)}return{success:r===null,error:r,data:s,count:o,status:l,statusText:u}}returns(){return this}overrideTypes(){return this}},TN=class extends RN{select(e){let t=!1;const r=(e??"*").split("").map(s=>/\s/.test(s)&&!t?"":(s==='"'&&(t=!t),s)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:s,referencedTable:o=s}={}){const l=o?`${o}.order`:"order",u=this.url.searchParams.get(l);return this.url.searchParams.set(l,`${u?`${u},`:""}${e}.${t?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){const s=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:s=r}={}){const o=typeof s>"u"?"offset":`${s}.offset`,l=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(o,`${e}`),this.url.searchParams.set(l,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return 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:e=!1,verbose:t=!1,settings:r=!1,buffers:s=!1,wal:o=!1,format:l="text"}={}){var u;const d=[e?"analyze":null,t?"verbose":null,r?"settings":null,s?"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(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const w0=new RegExp("[,()]");var ki=class extends TN{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const r=Array.from(new Set(t)).map(s=>typeof s=="string"&&w0.test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}notIn(e,t){const r=Array.from(new Set(t)).map(s=>typeof s=="string"&&w0.test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(e,`not.in.(${r})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:s}={}){let o="";s==="plain"?o="pl":s==="phrase"?o="ph":s==="websearch"&&(o="w");const l=r===void 0?"":`(${r})`;return this.url.searchParams.append(e,`${o}fts${l}.${t}`),this}match(e){return Object.entries(e).filter(([t,r])=>r!==void 0).forEach(([t,r])=>{this.url.searchParams.append(t,`eq.${r}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){const s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},AN=class{constructor(e,{headers:t={},schema:r,fetch:s,urlLengthLimit:o=8e3,retry:l}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=s,this.urlLengthLimit=o,this.retry=l}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:r=!1,count:s}=t??{},o=r?"HEAD":"GET";let l=!1;const u=(e??"*").split("").map(m=>/\s/.test(m)&&!l?"":(m==='"'&&(l=!l),m)).join(""),{url:d,headers:h}=this.cloneRequestState();return d.searchParams.set("select",u),s&&h.append("Prefer",`count=${s}`),new ki({method:o,url:d,headers:h,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:r=!0}={}){var s;const o="POST",{url:l,headers:u}=this.cloneRequestState();if(t&&u.append("Prefer",`count=${t}`),r||u.append("Prefer","missing=default"),Array.isArray(e)){const d=e.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 ki({method:o,url:l,headers:u,schema:this.schema,body:e,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:s,defaultToNull:o=!0}={}){var l;const u="POST",{url:d,headers:h}=this.cloneRequestState();if(h.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),t!==void 0&&d.searchParams.set("on_conflict",t),s&&h.append("Prefer",`count=${s}`),o||h.append("Prefer","missing=default"),Array.isArray(e)){const m=e.reduce((b,g)=>b.concat(Object.keys(g)),[]);if(m.length>0){const b=[...new Set(m)].map(g=>`"${g}"`);d.searchParams.set("columns",b.join(","))}}return new ki({method:u,url:d,headers:h,schema:this.schema,body:e,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var r;const s="PATCH",{url:o,headers:l}=this.cloneRequestState();return t&&l.append("Prefer",`count=${t}`),new ki({method:s,url:o,headers:l,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const r="DELETE",{url:s,headers:o}=this.cloneRequestState();return e&&o.append("Prefer",`count=${e}`),new ki({method:r,url:s,headers:o,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function ul(e){"@babel/helpers - typeof";return ul=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ul(e)}function NN(e,t){if(ul(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(ul(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function kN(e){var t=NN(e,"string");return ul(t)=="symbol"?t:t+""}function jN(e,t,r){return(t=kN(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function x0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,s)}return r}function Zc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?x0(Object(r),!0).forEach(function(s){jN(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x0(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}var ON=class Cx{constructor(t,{headers:r={},schema:s,fetch:o,timeout:l,urlLengthLimit:u=8e3,retry:d}={}){this.url=t,this.headers=new Headers(r),this.schemaName=s,this.urlLengthLimit=u;const h=o??globalThis.fetch;l!==void 0&&l>0?this.fetch=(m,b)=>{const g=new AbortController,w=setTimeout(()=>g.abort(),l),_=b==null?void 0:b.signal;if(_){if(_.aborted)return clearTimeout(w),h(m,b);const E=()=>{clearTimeout(w),g.abort()};return _.addEventListener("abort",E,{once:!0}),h(m,Zc(Zc({},b),{},{signal:g.signal})).finally(()=>{clearTimeout(w),_.removeEventListener("abort",E)})}return h(m,Zc(Zc({},b),{},{signal:g.signal})).finally(()=>clearTimeout(w))}:this.fetch=h,this.retry=d}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new AN(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new Cx(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(t,r={},{head:s=!1,get:o=!1,count:l}={}){var u;let d;const h=new URL(`${this.url}/rpc/${t}`);let m;const b=_=>_!==null&&typeof _=="object"&&(!Array.isArray(_)||_.some(b)),g=s&&Object.values(r).some(b);g?(d="POST",m=r):s||o?(d=s?"HEAD":"GET",Object.entries(r).filter(([_,E])=>E!==void 0).map(([_,E])=>[_,Array.isArray(E)?`{${E.join(",")}}`:`${E}`]).forEach(([_,E])=>{h.searchParams.append(_,E)})):(d="POST",m=r);const w=new Headers(this.headers);return g?w.set("Prefer",l?`count=${l},return=minimal`:"return=minimal"):l&&w.set("Prefer",`count=${l}`),new ki({method:d,url:h,headers:w,schema:this.schemaName,body:m,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class MN{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const r=globalThis;if(typeof globalThis<"u"&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};const s=typeof global<"u"?global:void 0;if(s&&typeof s.WebSocket<"u")return{type:"native",wsConstructor:s.WebSocket};if(typeof globalThis<"u"&&typeof r.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"&&r.EdgeRuntime||typeof navigator<"u"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.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 o=globalThis.process;if(o){const l=o.versions;if(l&&l.node){const u=l.node,d=parseInt(u.replace(/^v/,"").split(".")[0]);return d>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${d} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${d} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
||
import ws from "ws"
|
||
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 t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let r=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(r+=`
|
||
|
||
Suggested solution: ${t.workaround}`),new Error(r)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const DN="2.106.2",LN=`realtime-js/${DN}`,PN="1.0.0",Rx="2.0.0",zN=Rx,UN=1e4,IN=100,Ia={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Tx={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},Em={connecting:"connecting",closing:"closing",closed:"closed"};class $N{constructor(t){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=t??[]}encode(t,r){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(t));let s=[t.join_ref,t.ref,t.topic,t.event,t.payload];return r(JSON.stringify(s))}_binaryEncodeUserBroadcastPush(t){var r;return this._isArrayBuffer((r=t.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var r,s;const o=(s=(r=t.payload)===null||r===void 0?void 0:r.payload)!==null&&s!==void 0?s:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,o)}_encodeJsonUserBroadcastPush(t){var r,s;const o=(s=(r=t.payload)===null||r===void 0?void 0:r.payload)!==null&&s!==void 0?s:{},u=new TextEncoder().encode(JSON.stringify(o)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,u)}_encodeUserBroadcastPush(t,r,s){var o,l;const u=t.topic,d=(o=t.ref)!==null&&o!==void 0?o:"",h=(l=t.join_ref)!==null&&l!==void 0?l:"",m=t.payload.event,b=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},g=Object.keys(b).length===0?"":JSON.stringify(b);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(g.length>255)throw new Error(`metadata length ${g.length} exceeds maximum of 255`);const w=this.USER_BROADCAST_PUSH_META_LENGTH+h.length+d.length+u.length+m.length+g.length,_=new ArrayBuffer(this.HEADER_LENGTH+w);let E=new DataView(_),S=0;E.setUint8(S++,this.KINDS.userBroadcastPush),E.setUint8(S++,h.length),E.setUint8(S++,d.length),E.setUint8(S++,u.length),E.setUint8(S++,m.length),E.setUint8(S++,g.length),E.setUint8(S++,r),Array.from(h,C=>E.setUint8(S++,C.charCodeAt(0))),Array.from(d,C=>E.setUint8(S++,C.charCodeAt(0))),Array.from(u,C=>E.setUint8(S++,C.charCodeAt(0))),Array.from(m,C=>E.setUint8(S++,C.charCodeAt(0))),Array.from(g,C=>E.setUint8(S++,C.charCodeAt(0)));var T=new Uint8Array(_.byteLength+s.byteLength);return T.set(new Uint8Array(_),0),T.set(new Uint8Array(s),_.byteLength),T.buffer}decode(t,r){if(this._isArrayBuffer(t)){let s=this._binaryDecode(t);return r(s)}if(typeof t=="string"){const s=JSON.parse(t),[o,l,u,d,h]=s;return r({join_ref:o,ref:l,topic:u,event:d,payload:h})}return r({})}_binaryDecode(t){const r=new DataView(t),s=r.getUint8(0),o=new TextDecoder;switch(s){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,r,o)}}_decodeUserBroadcast(t,r,s){const o=r.getUint8(1),l=r.getUint8(2),u=r.getUint8(3),d=r.getUint8(4);let h=this.HEADER_LENGTH+4;const m=s.decode(t.slice(h,h+o));h=h+o;const b=s.decode(t.slice(h,h+l));h=h+l;const g=s.decode(t.slice(h,h+u));h=h+u;const w=t.slice(h,t.byteLength),_=d===this.JSON_ENCODING?JSON.parse(s.decode(w)):w,E={type:this.BROADCAST_EVENT,event:b,payload:_};return u>0&&(E.meta=JSON.parse(g)),{join_ref:null,ref:null,topic:m,event:this.BROADCAST_EVENT,payload:E}}_isArrayBuffer(t){var r;return t instanceof ArrayBuffer||((r=t==null?void 0:t.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(t,r){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([s])=>r.includes(s)))}}var rt;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(rt||(rt={}));const _0=(e,t,r={})=>{var s;const o=(s=r.skipTypes)!==null&&s!==void 0?s:[];return t?Object.keys(t).reduce((l,u)=>(l[u]=BN(u,e,t,o),l),{}):{}},BN=(e,t,r,s)=>{const o=t.find(d=>d.name===e),l=o==null?void 0:o.type,u=r[e];return l&&!s.includes(l)?Ax(l,u):Cm(u)},Ax=(e,t)=>{if(e.charAt(0)==="_"){const r=e.slice(1,e.length);return GN(t,r)}switch(e){case rt.bool:return HN(t);case rt.float4:case rt.float8:case rt.int2:case rt.int4:case rt.int8:case rt.numeric:case rt.oid:return qN(t);case rt.json:case rt.jsonb:return VN(t);case rt.timestamp:return FN(t);case rt.abstime:case rt.date:case rt.daterange:case rt.int4range:case rt.int8range:case rt.money:case rt.reltime:case rt.text:case rt.time:case rt.timestamptz:case rt.timetz:case rt.tsrange:case rt.tstzrange:return Cm(t);default:return Cm(t)}},Cm=e=>e,HN=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},qN=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},VN=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},GN=(e,t)=>{if(typeof e!="string")return e;const r=e.length-1,s=e[r];if(e[0]==="{"&&s==="}"){let l;const u=e.slice(1,r);try{l=JSON.parse("["+u+"]")}catch{l=u?u.split(","):[]}return l.map(d=>Ax(t,d))}return e},FN=e=>typeof e=="string"?e.replace(" ","T"):e,Nx=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};var al=e=>typeof e=="function"?e:function(){return e},KN=typeof self<"u"?self:null,ji=typeof window<"u"?window:null,br=KN||ji||globalThis,YN="2.0.0",WN=1e4,XN=1e3,wr={connecting:0,open:1,closing:2,closed:3},fn={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Jr={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Rm={longpoll:"longpoll",websocket:"websocket"},JN={complete:4},Tm="base64url.bearer.phx.",eu=class{constructor(e,t,r,s){this.channel=e,this.event=t,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=s,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),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()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:r}){this.recHooks.filter(s=>s.status===e).forEach(s=>s.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},kx=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},QN=class{constructor(e,t,r){this.state=fn.closed,this.topic=e,this.params=al(t||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new eu(this,Jr.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new kx(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=fn.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this.joinPush.receive("error",s=>{this.state=fn.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=fn.closed,this.socket.remove(this)}),this.onError(s=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.isJoining()&&this.joinPush.reset(),this.state=fn.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new eu(this,Jr.leave,al({}),this.timeout).send(),this.state=fn.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Jr.reply,(s,o)=>{this.trigger(this.replyEventName(o),s)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=fn.closed,this.bindings=[]}onClose(e){this.on(Jr.close,e)}onError(e){return this.on(Jr.error,t=>e(t))}on(e,t){let r=this.bindingRef++;return this.bindings.push({event:e,ref:r,callback:t}),r}off(e,t){this.bindings=this.bindings.filter(r=>!(r.event===e&&(typeof t>"u"||t===r.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,r=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let s=new eu(this,e,function(){return t},r);return this.canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=fn.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Jr.close,"leave")},r=new eu(this,Jr.leave,al({}),e);return r.receive("ok",()=>t()).receive("timeout",()=>t()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(e,t,r){return t}filterBindings(e,t,r){return!0}isMember(e,t,r,s){return this.topic!==e?!1:s&&s!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:r,joinRef:s}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=fn.joining,this.joinPush.resend(e))}trigger(e,t,r,s){let o=this.onMessage(e,t,r,s);if(t&&!o)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let l=this.bindings.filter(u=>u.event===e&&this.filterBindings(u,t,r));for(let u=0;u<l.length;u++)l[u].callback(o,r,s||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===fn.closed}isErrored(){return this.state===fn.errored}isJoined(){return this.state===fn.joined}isJoining(){return this.state===fn.joining}isLeaving(){return this.state===fn.leaving}},Du=class{static request(e,t,r,s,o,l,u){if(br.XDomainRequest){let d=new br.XDomainRequest;return this.xdomainRequest(d,e,t,s,o,l,u)}else if(br.XMLHttpRequest){let d=new br.XMLHttpRequest;return this.xhrRequest(d,e,t,r,s,o,l,u)}else{if(br.fetch&&br.AbortController)return this.fetchRequest(e,t,r,s,o,l,u);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,r,s,o,l,u){let d={method:e,headers:r,body:s},h=null;return o&&(h=new AbortController,setTimeout(()=>h.abort(),o),d.signal=h.signal),br.fetch(t,d).then(m=>m.text()).then(m=>this.parseJSON(m)).then(m=>u&&u(m)).catch(m=>{m.name==="AbortError"&&l?l():u&&u(null)}),h}static xdomainRequest(e,t,r,s,o,l,u){return e.timeout=o,e.open(t,r),e.onload=()=>{let d=this.parseJSON(e.responseText);u&&u(d)},l&&(e.ontimeout=l),e.onprogress=()=>{},e.send(s),e}static xhrRequest(e,t,r,s,o,l,u,d){e.open(t,r,!0),e.timeout=l;for(let[h,m]of Object.entries(s))e.setRequestHeader(h,m);return e.onerror=()=>d&&d(null),e.onreadystatechange=()=>{if(e.readyState===JN.complete&&d){let h=this.parseJSON(e.responseText);d(h)}},u&&(e.ontimeout=u),e.send(o),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let r=[];for(var s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;let o=t?`${t}[${s}]`:s,l=e[s];typeof l=="object"?r.push(this.serialize(l,o)):r.push(encodeURIComponent(o)+"="+encodeURIComponent(l))}return r.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let r=e.match(/\?/)?"&":"?";return`${e}${r}${this.serialize(t)}`}},ZN=e=>{let t="",r=new Uint8Array(e),s=r.byteLength;for(let o=0;o<s;o++)t+=String.fromCharCode(r[o]);return btoa(t)},xi=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(Tm)&&(this.authToken=atob(t[1].slice(Tm.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=wr.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Rm.websocket),"$1/"+Rm.longpoll)}endpointURL(){return Du.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,r){this.close(e,t,r),this.readyState=wr.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===wr.open||this.readyState===wr.connecting}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:r,token:s,messages:o}=t;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=s}else r=0;switch(r){case 200:o.forEach(l=>{setTimeout(()=>this.onmessage({data:l}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=wr.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${r}`)}})}send(e){typeof e!="string"&&(e=ZN(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join(`
|
||
`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,r){for(let o of this.reqs)o.abort();this.readyState=wr.closed;let s=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",s)):this.onclose(s)}ajax(e,t,r,s,o){let l,u=()=>{this.reqs.delete(l),s()};l=Du.request(e,this.endpointURL(),t,r,this.timeout,u,d=>{this.reqs.delete(l),this.isActive()&&o(d)}),this.reqs.add(l)}},ek=class el{constructor(t,r={}){let s=r.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(s.state,o=>{let{onJoin:l,onLeave:u,onSync:d}=this.caller;this.joinRef=this.channel.joinRef(),this.state=el.syncState(this.state,o,l,u),this.pendingDiffs.forEach(h=>{this.state=el.syncDiff(this.state,h,l,u)}),this.pendingDiffs=[],d()}),this.channel.on(s.diff,o=>{let{onJoin:l,onLeave:u,onSync:d}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(o):(this.state=el.syncDiff(this.state,o,l,u),d())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return el.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,r,s,o){let l=this.clone(t),u={},d={};return this.map(l,(h,m)=>{r[h]||(d[h]=m)}),this.map(r,(h,m)=>{let b=l[h];if(b){let g=m.metas.map(S=>S.phx_ref),w=b.metas.map(S=>S.phx_ref),_=m.metas.filter(S=>w.indexOf(S.phx_ref)<0),E=b.metas.filter(S=>g.indexOf(S.phx_ref)<0);_.length>0&&(u[h]=m,u[h].metas=_),E.length>0&&(d[h]=this.clone(b),d[h].metas=E)}else u[h]=m}),this.syncDiff(l,{joins:u,leaves:d},s,o)}static syncDiff(t,r,s,o){let{joins:l,leaves:u}=this.clone(r);return s||(s=function(){}),o||(o=function(){}),this.map(l,(d,h)=>{let m=t[d];if(t[d]=this.clone(h),m){let b=t[d].metas.map(w=>w.phx_ref),g=m.metas.filter(w=>b.indexOf(w.phx_ref)<0);t[d].metas.unshift(...g)}s(d,m,h)}),this.map(u,(d,h)=>{let m=t[d];if(!m)return;let b=h.metas.map(g=>g.phx_ref);m.metas=m.metas.filter(g=>b.indexOf(g.phx_ref)<0),o(d,m,h),m.metas.length===0&&delete t[d]}),t}static list(t,r){return r||(r=function(s,o){return o}),this.map(t,(s,o)=>r(s,o))}static map(t,r){return Object.getOwnPropertyNames(t).map(s=>r(s,t[s]))}static clone(t){return JSON.parse(JSON.stringify(t))}},tu={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(r))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[r,s,o,l,u]=JSON.parse(e);return t({join_ref:r,ref:s,topic:o,event:l,payload:u})}},binaryEncode(e){let{join_ref:t,ref:r,event:s,topic:o,payload:l}=e,u=this.META_LENGTH+t.length+r.length+o.length+s.length,d=new ArrayBuffer(this.HEADER_LENGTH+u),h=new DataView(d),m=0;h.setUint8(m++,this.KINDS.push),h.setUint8(m++,t.length),h.setUint8(m++,r.length),h.setUint8(m++,o.length),h.setUint8(m++,s.length),Array.from(t,g=>h.setUint8(m++,g.charCodeAt(0))),Array.from(r,g=>h.setUint8(m++,g.charCodeAt(0))),Array.from(o,g=>h.setUint8(m++,g.charCodeAt(0))),Array.from(s,g=>h.setUint8(m++,g.charCodeAt(0)));var b=new Uint8Array(d.byteLength+l.byteLength);return b.set(new Uint8Array(d),0),b.set(new Uint8Array(l),d.byteLength),b.buffer},binaryDecode(e){let t=new DataView(e),r=t.getUint8(0),s=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(e,t,s);case this.KINDS.reply:return this.decodeReply(e,t,s);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,s)}},decodePush(e,t,r){let s=t.getUint8(1),o=t.getUint8(2),l=t.getUint8(3),u=this.HEADER_LENGTH+this.META_LENGTH-1,d=r.decode(e.slice(u,u+s));u=u+s;let h=r.decode(e.slice(u,u+o));u=u+o;let m=r.decode(e.slice(u,u+l));u=u+l;let b=e.slice(u,e.byteLength);return{join_ref:d,ref:null,topic:h,event:m,payload:b}},decodeReply(e,t,r){let s=t.getUint8(1),o=t.getUint8(2),l=t.getUint8(3),u=t.getUint8(4),d=this.HEADER_LENGTH+this.META_LENGTH,h=r.decode(e.slice(d,d+s));d=d+s;let m=r.decode(e.slice(d,d+o));d=d+o;let b=r.decode(e.slice(d,d+l));d=d+l;let g=r.decode(e.slice(d,d+u));d=d+u;let w=e.slice(d,e.byteLength),_={status:g,response:w};return{join_ref:h,ref:m,topic:b,event:Jr.reply,payload:_}},decodeBroadcast(e,t,r){let s=t.getUint8(1),o=t.getUint8(2),l=this.HEADER_LENGTH+2,u=r.decode(e.slice(l,l+s));l=l+s;let d=r.decode(e.slice(l,l+o));l=l+o;let h=e.slice(l,e.byteLength);return{join_ref:null,ref:null,topic:u,event:d,payload:h}}},tk=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||WN,this.transport=t.transport||br.WebSocket||xi,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=br&&br.sessionStorage}catch{}this.sessionStore=t.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=tu.encode.bind(tu),this.defaultDecoder=tu.decode.bind(tu),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==xi?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let s=null;ji&&ji.addEventListener&&(ji.addEventListener("pagehide",o=>{this.conn&&(this.disconnect(),s=this.connectClock)}),ji.addEventListener("pageshow",o=>{s===this.connectClock&&(s=null,this.connect())}),ji.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=o=>t.rejoinAfterMs?t.rejoinAfterMs(o):[1e3,2e3,5e3][o-1]||1e4,this.reconnectAfterMs=o=>t.reconnectAfterMs?t.reconnectAfterMs(o):[10,50,100,150,200,250,500,1e3,2e3][o-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(o,l,u)=>{console.log(`${o}: ${l}`,u)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=al(t.params||{}),this.endPoint=`${e}/${Rm.websocket}`,this.vsn=t.vsn||YN,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new kx(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{t.beforeReconnect&&await t.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=t.authToken}getLongPollTransport(){return xi}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=Du.appendParams(Du.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,r)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=al(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==xi?this.connectWithFallback(xi,this.longPollFallbackMs):this.transportConnect())}log(e,t,r){this.logger&&this.logger(e,t,r)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let s=this.onMessage(o=>{o.ref===t&&(this.off([s]),e(Date.now()-r))});return!0}transportName(e){switch(e){case xi:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${Tm}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let r=!1,s=!0,o,l,u=this.transportName(e),d=h=>{this.log("transport",`falling back to ${u}...`,h),this.off([o,l]),s=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${u}`))return d("memorized");this.fallbackTimer=setTimeout(d,t),l=this.onError(h=>{this.log("transport","error",h),s&&!r&&(clearTimeout(this.fallbackTimer),d(h))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!s){let h=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${h}`,"true"),this.log("transport",`established ${h} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(d,t),this.ping(h=>{this.log("transport","connected to primary after",h),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),XN,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,r){if(!this.conn)return e&&e();const s=this.conn;this.waitForBufferDone(s,()=>{t?s.close(t,r||""):s.close(),this.waitForSocketClosed(s,()=>{this.conn===s&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,r=1){if(r===5||!e.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(e,t,r+1)},150*r)}waitForSocketClosed(e,t,r=1){if(r===5||e.readyState===wr.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(e,t,r+1)},150*r)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",e,t,r),(t===this.transport||r>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(Jr.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case wr.connecting:return"connecting";case wr.open:return"open";case wr.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([r])=>e.indexOf(r)===-1)}channel(e,t={}){let r=new QN(e,t,this);return this.channels.push(r),r}push(e){if(this.hasLogger()){let{topic:t,event:r,payload:s,ref:o,join_ref:l}=e;this.log("push",`${t} ${r} (${l}, ${o})`,s)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:r,event:s,payload:o,ref:l,join_ref:u}=t;if(l&&l===this.pendingHeartbeatRef){const d=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(o.status==="ok"?"ok":"error",d)}catch(h){this.log("error","error in heartbeat callback",h)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${o.status||""} ${r} ${s} ${l&&"("+l+")"||""}`.trim(),o);for(let d=0;d<this.channels.length;d++){const h=this.channels[d];h.isMember(r,s,o,u)&&h.trigger(s,o,l,u)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([r,s])=>{try{s(...t)}catch(o){this.log("error",`error in ${e} callback`,o)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}leaveOpenTopic(e){let t=this.channels.find(r=>r.topic===e&&(r.isJoined()||r.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class sl{constructor(t,r){const s=rk(r);this.presence=new ek(t.getChannel(),s),this.presence.onJoin((o,l,u)=>{const d=sl.onJoinPayload(o,l,u);t.getChannel().trigger("presence",d)}),this.presence.onLeave((o,l,u)=>{const d=sl.onLeavePayload(o,l,u);t.getChannel().trigger("presence",d)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return sl.transformState(this.presence.state)}static transformState(t){return t=nk(t),Object.getOwnPropertyNames(t).reduce((r,s)=>{const o=t[s];return r[s]=Ru(o),r},{})}static onJoinPayload(t,r,s){const o=S0(r),l=Ru(s);return{event:"join",key:t,currentPresences:o,newPresences:l}}static onLeavePayload(t,r,s){const o=S0(r),l=Ru(s);return{event:"leave",key:t,currentPresences:o,leftPresences:l}}}function Ru(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function nk(e){return JSON.parse(JSON.stringify(e))}function rk(e){return(e==null?void 0:e.events)&&{events:e.events}}function S0(e){return e!=null&&e.metas?Ru(e):[]}var E0;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(E0||(E0={}));class ak{get state(){return this.presenceAdapter.state}constructor(t,r){this.channel=t,this.presenceAdapter=new sl(this.channel.channelAdapter,r)}}function sk(e){if(e instanceof Error)return e;if(typeof e=="string")return new Error(e);if(e&&typeof e=="object"){const t=e;if(typeof t.code=="number"){const r=typeof t.reason=="string"&&t.reason?` (${t.reason})`:"";return new Error(`socket closed: ${t.code}${r}`,{cause:e})}return new Error("channel error: transport failure",{cause:e})}return new Error("channel error: connection lost")}class ik{constructor(t,r,s){const o=ok(s);this.channel=t.getSocket().channel(r,o),this.socket=t}get state(){return this.channel.state}set state(t){this.channel.state=t}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(t,r){return this.channel.on(t,r)}off(t,r){this.channel.off(t,r)}subscribe(t){return this.channel.join(t)}unsubscribe(t){return this.channel.leave(t)}teardown(){this.channel.teardown()}onClose(t){this.channel.onClose(t)}onError(t){return this.channel.onError(t)}push(t,r,s){let o;try{o=this.channel.push(t,r,s)}catch{throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>IN){const l=this.channel.pushBuffer.shift();l.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${l.event}`,l.payload())}return o}updateJoinPayload(t){const r=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},r),t)}canPush(){return this.socket.isConnected()&&this.state===Ia.joined}isJoined(){return this.state===Ia.joined}isJoining(){return this.state===Ia.joining}isClosed(){return this.state===Ia.closed}isLeaving(){return this.state===Ia.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function ok(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}var C0;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(C0||(C0={}));var Pi;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(Pi||(Pi={}));var Qr;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Qr||(Qr={}));class il{get state(){return this.channelAdapter.state}set state(t){this.channelAdapter.state=t}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(t,r={config:{}},s){var o,l;if(this.topic=t,this.params=r,this.socket=s,this.bindings={},this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new ik(this.socket.socketAdapter,t,this.params),this.presence=new ak(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Nx(this.socket.socketAdapter.endPointURL()),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 new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(t,r=this.timeout){var s,o,l;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:u,presence:d,private:h}}=this.params,m=(o=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(_=>_.filter))!==null&&o!==void 0?o:[],b=!!this.bindings[Pi.PRESENCE]&&this.bindings[Pi.PRESENCE].length>0||((l=this.params.config.presence)===null||l===void 0?void 0:l.enabled)===!0,g={},w={broadcast:u,presence:Object.assign(Object.assign({},d),{enabled:b}),postgres_changes:m,private:h};this.socket.accessTokenValue&&(g.access_token=this.socket.accessTokenValue),this._onError(_=>{t==null||t(Qr.CHANNEL_ERROR,sk(_))}),this._onClose(()=>t==null?void 0:t(Qr.CLOSED)),this.updateJoinPayload(Object.assign({config:w},g)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:_})=>{if(this.socket._isManualToken()||this.socket.setAuth(),_===void 0){t==null||t(Qr.SUBSCRIBED);return}this._updatePostgresBindings(_,t)}).receive("error",_=>{this.state=Ia.errored;const E=Object.values(_).join(", ")||"error";t==null||t(Qr.CHANNEL_ERROR,new Error(E,{cause:_}))}).receive("timeout",()=>{t==null||t(Qr.TIMED_OUT)})}return this}_updatePostgresBindings(t,r){var s;const o=this.bindings.postgres_changes,l=(s=o==null?void 0:o.length)!==null&&s!==void 0?s:0,u=[];for(let d=0;d<l;d++){const h=o[d],{filter:{event:m,schema:b,table:g,filter:w}}=h,_=t&&t[d];if(_&&_.event===m&&il.isFilterValueEqual(_.schema,b)&&il.isFilterValueEqual(_.table,g)&&il.isFilterValueEqual(_.filter,w))u.push(Object.assign(Object.assign({},h),{id:_.id}));else{this.unsubscribe(),this.state=Ia.errored,r==null||r(Qr.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=u,this.state!=Ia.errored&&r&&r(Qr.SUBSCRIBED)}presenceState(){return this.presence.state}async track(t,r={}){return await this.send({type:"presence",event:"track",payload:t},r.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,r,s){const o=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),l=t===Pi.PRESENCE||t===Pi.POSTGRES_CHANGES;if(o&&l)throw this.socket.log("channel",`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(t,r,s)}async httpSend(t,r,s={}){var o;if(r==null)return Promise.reject(new Error("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:t,payload:r,private:this.private}]})},d=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(o=s.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(t,r={}){var s,o;if(!this.channelAdapter.canPush()&&t.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}=t,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,(s=r.timeout)!==null&&s!==void 0?s:this.timeout);return await((o=m.body)===null||o===void 0?void 0:o.cancel()),m.ok?"ok":"error"}catch(m){return m instanceof Error&&m.name==="AbortError"?"timed out":"error"}}else return new Promise(l=>{var u,d,h;const m=this.channelAdapter.push(t.type,t,r.timeout||this.timeout);t.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(t){this.channelAdapter.updateJoinPayload(t)}async unsubscribe(t=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(t).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(t,r,s){const o=new AbortController,l=setTimeout(()=>o.abort(),s),u=await this.socket.fetch(t,Object.assign(Object.assign({},r),{signal:o.signal}));return clearTimeout(l),u}_on(t,r,s){const o=t.toLocaleLowerCase(),l=this.channelAdapter.on(t,s),u={type:o,filter:r,callback:s,ref:l};return this.bindings[o]?this.bindings[o].push(u):this.bindings[o]=[u],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,r,s)=>{var o,l,u,d,h,m,b;const g=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(g,s))return!1;const w=(o=this.bindings[g])===null||o===void 0?void 0:o.find(_=>_.ref===t.ref);if(!w)return!0;if(["broadcast","presence","postgres_changes"].includes(g))if("id"in w){const _=w.id,E=(l=w.filter)===null||l===void 0?void 0:l.event;return _&&((u=r.ids)===null||u===void 0?void 0:u.includes(_))&&(E==="*"||(E==null?void 0:E.toLocaleLowerCase())===((d=r.data)===null||d===void 0?void 0:d.type.toLocaleLowerCase()))}else{const _=(m=(h=w==null?void 0:w.filter)===null||h===void 0?void 0:h.event)===null||m===void 0?void 0:m.toLocaleLowerCase();return _==="*"||_===((b=r==null?void 0:r.event)===null||b===void 0?void 0:b.toLocaleLowerCase())}else return w.type.toLocaleLowerCase()===g})}_notThisChannelEvent(t,r){const{close:s,error:o,leave:l,join:u}=Tx;return r&&[s,o,l,u].includes(t)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,r,s)=>{if(typeof r=="object"&&"ids"in r){const o=r.data,{schema:l,table:u,commit_timestamp:d,type:h,errors:m}=o;return Object.assign(Object.assign({},{schema:l,table:u,commit_timestamp:d,eventType:h,new:{},old:{},errors:m}),this._getPayloadRecords(o))}return r})}copyBindings(t){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in t.bindings)for(const s of t.bindings[r])this._on(s.type,s.filter,s.callback)}static isFilterValueEqual(t,r){return(t??void 0)===(r??void 0)}_getPayloadRecords(t){const r={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(r.new=_0(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(r.old=_0(t.columns,t.old_record)),r}}class lk{constructor(t,r){this.socket=new tk(t,r)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,r,s,o=1e4){return new Promise(l=>{setTimeout(()=>l("timeout"),o),this.socket.disconnect(()=>{t(),l("ok")},r,s)})}push(t){this.socket.push(t)}log(t,r,s){this.socket.log(t,r,s)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==Em.connecting}isDisconnecting(){return this.socket.connectionState()==Em.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const R0={HEARTBEAT_INTERVAL:25e3},ck=[1e3,2e3,5e3,1e4],uk=1e4;function dk(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem(t){return e.has(t)?e.get(t):null},key(t){var r;return(r=Array.from(e.keys())[t])!==null&&r!==void 0?r:null},removeItem(t){e.delete(t)},setItem(t,r){e.set(t,String(r))}}}function fk(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return dk()}const hk=`
|
||
addEventListener("message", (e) => {
|
||
if (e.data.event === "start") {
|
||
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
||
}
|
||
});`;class mk{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(t,r){var s;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={},this.ref=0,this.serializer=new $N,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=l=>l?(...u)=>l(...u):(...u)=>fetch(...u),!(!((s=r==null?void 0:r.params)===null||s===void 0)&&s.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey;const o=this._initializeOptions(r);this.socketAdapter=new lk(t,o),this.httpEndpoint=Nx(t),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(t){const r=t.message;throw r.includes("Node.js")?new Error(`${r}
|
||
|
||
To use Realtime in Node.js, you need to provide a WebSocket implementation:
|
||
|
||
Option 1: Use Node.js 22+ which has native WebSocket support
|
||
Option 2: Install and provide the "ws" package:
|
||
|
||
npm install ws
|
||
|
||
import ws from "ws"
|
||
const client = new RealtimeClient(url, {
|
||
...options,
|
||
transport: ws
|
||
})`):new Error(`WebSocket not available: ${r}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(t,r){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},t,r)}getChannels(){return this.channels}async removeChannel(t){const r=await t.unsubscribe();return r==="ok"&&t.teardown(),r}async removeAllChannels(){const t=this.channels.map(async s=>{const o=await s.unsubscribe();return s.teardown(),o}),r=await Promise.all(t);return await this.disconnect(),r}log(t,r,s){this.socketAdapter.log(t,r,s)}connectionState(){return this.socketAdapter.connectionState()||Em.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,r={config:{}}){const s=`realtime:${t}`,o=this.getChannels().find(l=>l.topic===s);if(o)return o;{const l=new il(`realtime:${t}`,r,this);return this._cancelPendingDisconnect(),this.channels.push(l),l}}push(t){this.socketAdapter.push(t)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(t){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(t)}_makeRef(){return this.socketAdapter.makeRef()}_remove(t){this.channels=this.channels.filter(r=>r.topic!==t.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(t=null){let r,s=!1;if(t)r=t,s=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(o){this.log("error","Error fetching access token from callback",o),r=this.accessTokenValue}else r=this.accessTokenValue;s?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(o=>{const l={access_token:r,version:LN};r&&o.updateJoinPayload(l),o.joinedOnce&&o.channelAdapter.isJoined()&&o.channelAdapter.push(Tx.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${t}`,r)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(r=>{this.log("error","error waiting for auth on connect",r)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(t=>{t.ref&&t.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(t){return(r,s)=>{r=="sent"&&this._setAuthSafely(),t&&t(r,s)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=r=>{r.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)}_workerObjectUrl(t){let r;if(t)r=t;else{const s=new Blob([hk],{type:"application/javascript"});r=URL.createObjectURL(s)}return r}_initializeOptions(t){var r,s,o,l,u,d,h,m,b,g,w,_;this.worker=(r=t==null?void 0:t.worker)!==null&&r!==void 0?r:!1,this.accessToken=(s=t==null?void 0:t.accessToken)!==null&&s!==void 0?s:null;const E={};E.timeout=(o=t==null?void 0:t.timeout)!==null&&o!==void 0?o:UN,E.heartbeatIntervalMs=(l=t==null?void 0:t.heartbeatIntervalMs)!==null&&l!==void 0?l:R0.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(u=t==null?void 0:t.disconnectOnEmptyChannelsAfterMs)!==null&&u!==void 0?u:2*((d=t==null?void 0:t.heartbeatIntervalMs)!==null&&d!==void 0?d:R0.HEARTBEAT_INTERVAL),E.transport=(h=t==null?void 0:t.transport)!==null&&h!==void 0?h:MN.getWebSocketConstructor(),E.params=t==null?void 0:t.params,E.logger=t==null?void 0:t.logger,E.heartbeatCallback=this._wrapHeartbeatCallback(t==null?void 0:t.heartbeatCallback),E.sessionStorage=(m=t==null?void 0:t.sessionStorage)!==null&&m!==void 0?m:fk(),E.reconnectAfterMs=(b=t==null?void 0:t.reconnectAfterMs)!==null&&b!==void 0?b:(A=>ck[A-1]||uk);let S,T;const C=(g=t==null?void 0:t.vsn)!==null&&g!==void 0?g:zN;switch(C){case PN:S=(A,N)=>N(JSON.stringify(A)),T=(A,N)=>N(JSON.parse(A));break;case Rx:S=this.serializer.encode.bind(this.serializer),T=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${E.vsn}`)}if(E.vsn=C,E.encode=(w=t==null?void 0:t.encode)!==null&&w!==void 0?w:S,E.decode=(_=t==null?void 0:t.decode)!==null&&_!==void 0?_:T,E.beforeReconnect=this._reconnectAuth.bind(this),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,E.params=Object.assign(Object.assign({},E.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t==null?void 0:t.workerUrl,E.autoSendHeartbeat=!this.worker}return E}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var dl=class extends Error{constructor(e,t){var r;super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&((r=t.icebergType)==null?void 0:r.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function pk(e,t,r){const s=new URL(t,e);if(r)for(const[o,l]of Object.entries(r))l!==void 0&&s.searchParams.set(o,l);return s.toString()}async function gk(e){return!e||e.type==="none"?{}:e.type==="bearer"?{Authorization:`Bearer ${e.token}`}:e.type==="header"?{[e.name]:e.value}:e.type==="custom"?await e.getHeaders():{}}function vk(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:r,path:s,query:o,body:l,headers:u}){const d=pk(e.baseUrl,s,o),h=await gk(e.auth),m=await t(d,{method:r,headers:{...l?{"Content-Type":"application/json"}:{},...h,...u},body:l?JSON.stringify(l):void 0}),b=await m.text(),g=(m.headers.get("content-type")||"").includes("application/json"),w=g&&b?JSON.parse(b):b;if(!m.ok){const _=g?w:void 0,E=_==null?void 0:_.error;throw new dl((E==null?void 0:E.message)??`Request failed with status ${m.status}`,{status:m.status,icebergType:E==null?void 0:E.type,icebergCode:E==null?void 0:E.code,details:_})}return{status:m.status,headers:m.headers,data:w}}}}function nu(e){return e.join("")}var yk=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:nu(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(s=>({namespace:s}))}async createNamespace(e,t){const r={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${nu(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${nu(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${nu(e.namespace)}`}),!0}catch(t){if(t instanceof dl&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(r){if(r instanceof dl&&r.status===409)return;throw r}}};function _i(e){return e.join("")}var bk=class{constructor(e,t="",r){this.client=e,this.prefix=t,this.accessDelegation=r}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${_i(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${_i(e.namespace)}/tables`,body:t,headers:r})).data.metadata}async updateTable(e,t){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${_i(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${_i(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String((t==null?void 0:t.purge)??!1)}})}async loadTable(e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${_i(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${_i(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(r){if(r instanceof dl&&r.status===404)return!1;throw r}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(r){if(r instanceof dl&&r.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw r}}},wk=class{constructor(e){var s;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const r=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=vk({baseUrl:r,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(s=e.accessDelegation)==null?void 0:s.join(","),this.namespaceOps=new yk(this.client,t),this.tableOps=new bk(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}};function fl(e){"@babel/helpers - typeof";return fl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fl(e)}function xk(e,t){if(fl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(fl(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _k(e){var t=xk(e,"string");return fl(t)=="symbol"?t:t+""}function Sk(e,t,r){return(t=_k(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function T0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,s)}return r}function Ne(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?T0(Object(r),!0).forEach(function(s){Sk(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T0(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}var sd=class extends Error{constructor(e,t="storage",r,s){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function id(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var Am=class extends sd{constructor(e,t,r,s="storage"){super(e,s,t,r),this.name=s==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=r}toJSON(){return Ne({},super.toJSON())}},jx=class extends sd{constructor(e,t,r="storage"){super(e,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function Lu(e,t,r){const s=Ne({},e),o=t.toLowerCase();for(const l of Object.keys(s))l.toLowerCase()===o&&delete s[l];return s[o]=r,s}function Ek(e){const t={};for(const[r,s]of Object.entries(e))t[r.toLowerCase()]=s;return t}const Ck=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Rk=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},Nm=e=>{if(Array.isArray(e))return e.map(r=>Nm(r));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([r,s])=>{const o=r.replace(/([-_][a-z])/gi,l=>l.toUpperCase().replace(/[-_]/g,""));t[o]=Nm(s)}),t},Tk=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),A0=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error;if(typeof t.error=="object"&&t.error!==null){const r=t.error;if(typeof r.message=="string")return r.message}}return JSON.stringify(e)},Ak=async(e,t,r,s)=>{if(e!==null&&typeof e=="object"&&"json"in e&&typeof e.json=="function"){const o=e;let l=parseInt(String(o.status),10);Number.isFinite(l)||(l=500),o.json().then(u=>{const d=(u==null?void 0:u.statusCode)||(u==null?void 0:u.code)||l+"";t(new Am(A0(u),l,d,s))}).catch(()=>{const u=l+"";t(new Am(o.statusText||`HTTP ${l} error`,l,u,s))})}else t(new jx(A0(e),e,s))},Nk=(e,t,r,s)=>{const o={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!s)return Ne(Ne({},o),r);if(Rk(s)){var l;const u=(t==null?void 0:t.headers)||{};let d;for(const[h,m]of Object.entries(u))h.toLowerCase()==="content-type"&&(d=m);o.headers=Lu(u,"Content-Type",(l=d)!==null&&l!==void 0?l:"application/json"),o.body=JSON.stringify(s)}else o.body=s;return t!=null&&t.duplex&&(o.duplex=t.duplex),Ne(Ne({},o),r)};async function Wo(e,t,r,s,o,l,u){return new Promise((d,h)=>{e(r,Nk(t,s,o,l)).then(m=>{if(!m.ok)throw m;if(s!=null&&s.noResolveJson)return m;if(u==="vectors"){const b=m.headers.get("content-type");if(m.headers.get("content-length")==="0"||m.status===204)return{};if(!b||!b.includes("application/json"))return{}}return m.json()}).then(m=>d(m)).catch(m=>Ak(m,h,s,u))})}function Ox(e="storage"){return{get:async(t,r,s,o)=>Wo(t,"GET",r,s,o,void 0,e),post:async(t,r,s,o,l)=>Wo(t,"POST",r,o,l,s,e),put:async(t,r,s,o,l)=>Wo(t,"PUT",r,o,l,s,e),head:async(t,r,s,o)=>Wo(t,"HEAD",r,Ne(Ne({},s),{},{noResolveJson:!0}),o,void 0,e),remove:async(t,r,s,o,l)=>Wo(t,"DELETE",r,o,l,s,e)}}const kk=Ox("storage"),{get:hl,post:Qn,put:km,head:jk,remove:hp}=kk,Tn=Ox("vectors");var Yi=class{constructor(e,t={},r,s="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=Ek(t),this.fetch=Ck(r),this.namespace=s}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Lu(this.headers,e,t),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(id(r))return{data:null,error:r};throw r}}};let Mx;Mx=Symbol.toStringTag;var Ok=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Mx]="StreamDownloadBuilder",this.promise=null}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:(await e.downloadFn()).body,error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(id(t))return{data:null,error:t};throw t}}};let Dx;Dx=Symbol.toStringTag;var Mk=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Dx]="BlobDownloadBuilder",this.promise=null}asStream(){return new Ok(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:await(await e.downloadFn()).blob(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(id(t))return{data:null,error:t};throw t}}};const Dk={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},N0={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Lk=class extends Yi{constructor(e,t={},r,s){super(e,t,s,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,s){var o=this;return o.handleOperation(async()=>{let l;const u=Ne(Ne({},N0),s);let d=Ne(Ne({},o.headers),e==="POST"&&{"x-upsert":String(u.upsert)});const h=u.metadata;if(typeof Blob<"u"&&r instanceof Blob?(l=new FormData,l.append("cacheControl",u.cacheControl),h&&l.append("metadata",o.encodeMetadata(h)),l.append("",r)):typeof FormData<"u"&&r instanceof FormData?(l=r,l.has("cacheControl")||l.append("cacheControl",u.cacheControl),h&&!l.has("metadata")&&l.append("metadata",o.encodeMetadata(h))):(l=r,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")),s!=null&&s.headers)for(const[w,_]of Object.entries(s.headers))d=Lu(d,w,_);const m=o._removeEmptyFolders(t),b=o._getFinalPath(m),g=await(e=="PUT"?km:Qn)(o.fetch,`${o.url}/object/${b}`,l,Ne({headers:d},u!=null&&u.duplex?{duplex:u.duplex}:{}));return{path:m,id:g.Id,fullPath:g.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,s){var o=this;const l=o._removeEmptyFolders(e),u=o._getFinalPath(l),d=new URL(o.url+`/object/upload/sign/${u}`);return d.searchParams.set("token",t),o.handleOperation(async()=>{let h;const m=Ne(Ne({},N0),s);let b=Ne(Ne({},o.headers),{"x-upsert":String(m.upsert)});const g=m.metadata;if(typeof Blob<"u"&&r instanceof Blob?(h=new FormData,h.append("cacheControl",m.cacheControl),g&&h.append("metadata",o.encodeMetadata(g)),h.append("",r)):typeof FormData<"u"&&r instanceof FormData?(h=r,h.has("cacheControl")||h.append("cacheControl",m.cacheControl),g&&!h.has("metadata")&&h.append("metadata",o.encodeMetadata(g))):(h=r,b["cache-control"]=`max-age=${m.cacheControl}`,b["content-type"]=m.contentType,g&&(b["x-metadata"]=o.toBase64(o.encodeMetadata(g))),(typeof ReadableStream<"u"&&h instanceof ReadableStream||h&&typeof h=="object"&&"pipe"in h&&typeof h.pipe=="function")&&!m.duplex&&(m.duplex="half")),s!=null&&s.headers)for(const[w,_]of Object.entries(s.headers))b=Lu(b,w,_);return{path:l,fullPath:(await km(o.fetch,d.toString(),h,Ne({headers:b},m!=null&&m.duplex?{duplex:m.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let s=r._getFinalPath(e);const o=Ne({},r.headers);t!=null&&t.upsert&&(o["x-upsert"]="true");const l=await Qn(r.fetch,`${r.url}/object/upload/sign/${s}`,{},{headers:o}),u=new URL(r.url+l.url),d=u.searchParams.get("token");if(!d)throw new sd("No token returned by API");return{signedUrl:u.toString(),path:e,token:d}})}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var s=this;return s.handleOperation(async()=>await Qn(s.fetch,`${s.url}/object/move`,{bucketId:s.bucketId,sourceKey:e,destinationKey:t,destinationBucket:r==null?void 0:r.destinationBucket},{headers:s.headers}))}async copy(e,t,r){var s=this;return s.handleOperation(async()=>({path:(await Qn(s.fetch,`${s.url}/object/copy`,{bucketId:s.bucketId,sourceKey:e,destinationKey:t,destinationBucket:r==null?void 0:r.destinationBucket},{headers:s.headers})).Key}))}async createSignedUrl(e,t,r){var s=this;return s.handleOperation(async()=>{let o=s._getFinalPath(e);const l=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let u=await Qn(s.fetch,`${s.url}/object/sign/${o}`,Ne({expiresIn:t},l?{transform:r.transform}:{}),{headers:s.headers});const d=new URLSearchParams;r!=null&&r.download&&d.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&d.set("cacheNonce",String(r.cacheNonce));const h=d.toString();return{signedUrl:encodeURI(`${s.url}${u.signedURL}${h?`&${h}`:""}`)}})}async createSignedUrls(e,t,r){var s=this;return s.handleOperation(async()=>{const o=await Qn(s.fetch,`${s.url}/object/sign/${s.bucketId}`,{expiresIn:t,paths:e},{headers:s.headers}),l=new URLSearchParams;r!=null&&r.download&&l.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&l.set("cacheNonce",String(r.cacheNonce));const u=l.toString();return o.map(d=>Ne(Ne({},d),{},{signedUrl:d.signedURL?encodeURI(`${s.url}${d.signedURL}${u?`&${u}`:""}`):null}))})}download(e,t,r){const s=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",o=new URLSearchParams;t!=null&&t.transform&&this.applyTransformOptsToQuery(o,t.transform),(t==null?void 0:t.cacheNonce)!=null&&o.set("cacheNonce",String(t.cacheNonce));const l=o.toString(),u=this._getFinalPath(e),d=()=>hl(this.fetch,`${this.url}/${s}/${u}${l?`?${l}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new Mk(d,this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>Nm(await hl(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await jk(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(o){if(t.shouldThrowOnError)throw o;if(id(o)){var s;const l=o instanceof Am?o.status:o instanceof jx?(s=o.originalError)===null||s===void 0?void 0:s.status:void 0;if(l!==void 0&&[400,404].includes(l))return{data:!1,error:o}}throw o}}getPublicUrl(e,t){const r=this._getFinalPath(e),s=new URLSearchParams;t!=null&&t.download&&s.set("download",t.download===!0?"":t.download),t!=null&&t.transform&&this.applyTransformOptsToQuery(s,t.transform),(t==null?void 0:t.cacheNonce)!=null&&s.set("cacheNonce",String(t.cacheNonce));const o=s.toString(),l=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${r}`)+(o?`?${o}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await hp(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,r){var s=this;return s.handleOperation(async()=>{const o=Ne(Ne(Ne({},Dk),t),{},{prefix:e||""});return await Qn(s.fetch,`${s.url}/object/list/${s.bucketId}`,o,{headers:s.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{const s=Ne({},e);return await Qn(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,s,{headers:r.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const Pk="2.106.2",Al={"X-Client-Info":`storage-js/${Pk}`};var zk=class extends Yi{constructor(e,t={},r,s){const o=new URL(e);s!=null&&s.useNewHostname&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase."));const l=o.href.replace(/\/$/,""),u=Ne(Ne({},Al),t);super(l,u,r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await hl(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await hl(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await Qn(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async updateBucket(e,t){var r=this;return r.handleOperation(async()=>await km(r.fetch,`${r.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await Qn(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await hp(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},Uk=class extends Yi{constructor(e,t={},r){const s=e.replace(/\/$/,""),o=Ne(Ne({},Al),t);super(s,o,r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await Qn(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&r.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&r.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&r.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&r.set("sortOrder",e.sortOrder),e!=null&&e.search&&r.set("search",e.search);const s=r.toString(),o=s?`${t.url}/bucket?${s}`:`${t.url}/bucket`;return await hl(t.fetch,o,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await hp(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!Tk(e))throw new sd("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 r=new wk({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),s=this.shouldThrowOnError;return new Proxy(r,{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(s)throw h;return{data:null,error:h}}}}})}},Ik=class extends Yi{constructor(e,t={},r){const s=e.replace(/\/$/,""),o=Ne(Ne({},Al),{},{"Content-Type":"application/json"},t);super(s,o,r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await Tn.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await Tn.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await Tn.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await Tn.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},$k=class extends Yi{constructor(e,t={},r){const s=e.replace(/\/$/,""),o=Ne(Ne({},Al),{},{"Content-Type":"application/json"},t);super(s,o,r,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await Tn.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await Tn.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return t.handleOperation(async()=>await Tn.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await Tn.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await Tn.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},Bk=class extends Yi{constructor(e,t={},r){const s=e.replace(/\/$/,""),o=Ne(Ne({},Al),{},{"Content-Type":"application/json"},t);super(s,o,r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await Tn.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Tn.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await Tn.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Tn.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},Hk=class extends Bk{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new qk(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,r=this;return t().call(r,e)}async getBucket(e){var t=()=>super.getBucket,r=this;return t().call(r,e)}async listBuckets(e={}){var t=()=>super.listBuckets,r=this;return t().call(r,e)}async deleteBucket(e){var t=()=>super.deleteBucket,r=this;return t().call(r,e)}},qk=class extends Ik{constructor(e,t,r,s){super(e,t,s),this.vectorBucketName=r}async createIndex(e){var t=()=>super.createIndex,r=this;return t().call(r,Ne(Ne({},e),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,r=this;return t().call(r,Ne(Ne({},e),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,r=this;return t().call(r,r.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,r=this;return t().call(r,r.vectorBucketName,e)}index(e){return new Vk(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Vk=class extends $k{constructor(e,t,r,s,o){super(e,t,o),this.vectorBucketName=r,this.indexName=s}async putVectors(e){var t=()=>super.putVectors,r=this;return t().call(r,Ne(Ne({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(e){var t=()=>super.getVectors,r=this;return t().call(r,Ne(Ne({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,r=this;return t().call(r,Ne(Ne({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,r=this;return t().call(r,Ne(Ne({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,r=this;return t().call(r,Ne(Ne({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},Gk=class extends zk{constructor(e,t={},r,s){super(e,t,r,s)}from(e){return new Lk(this.url,this.headers,e,this.fetch)}get vectors(){return new Hk(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Uk(this.url+"/iceberg",this.headers,this.fetch)}};const Lx="2.106.2",Oi=30*1e3,jm=3,Wh=jm*Oi,Fk="http://localhost:9999",Kk="supabase.auth.token",Yk={"X-Client-Info":`gotrue-js/${Lx}`},Om="X-Supabase-Api-Version",Px={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Wk=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Xk=600*1e3;class Hi extends Error{constructor(t,r,s){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=s}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function he(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class Jk extends Hi{constructor(t,r,s){super(t,r,s),this.name="AuthApiError",this.status=r,this.code=s}}function Qk(e){return he(e)&&e.name==="AuthApiError"}class Zn extends Hi{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}}class ia extends Hi{constructor(t,r,s,o){super(t,s,o),this.name=r,this.status=s}}class Dt extends ia{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function ru(e){return he(e)&&e.name==="AuthSessionMissingError"}class Si extends ia{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class au extends ia{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class su extends ia{constructor(t,r=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function Zk(e){return he(e)&&e.name==="AuthImplicitGrantRedirectError"}class k0 extends ia{constructor(t,r=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class ej extends ia{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 Mm extends ia{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}}function Xh(e){return he(e)&&e.name==="AuthRetryableFetchError"}class j0 extends ia{constructor(t,r,s){super(t,"AuthWeakPasswordError",r,"weak_password"),this.reasons=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class Dm extends ia{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Pu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),O0=`
|
||
\r=`.split(""),tj=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<O0.length;t+=1)e[O0[t].charCodeAt(0)]=-2;for(let t=0;t<Pu.length;t+=1)e[Pu[t].charCodeAt(0)]=t;return e})();function M0(e,t,r){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const s=t.queue>>t.queuedBits-6&63;r(Pu[s]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const s=t.queue>>t.queuedBits-6&63;r(Pu[s]),t.queuedBits-=6}}function zx(e,t,r){const s=tj[e];if(s>-1)for(t.queue=t.queue<<6|s,t.queuedBits+=6;t.queuedBits>=8;)r(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(s===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function D0(e){const t=[],r=u=>{t.push(String.fromCodePoint(u))},s={utf8seq:0,codepoint:0},o={queue:0,queuedBits:0},l=u=>{aj(u,s,r)};for(let u=0;u<e.length;u+=1)zx(e.charCodeAt(u),o,l);return t.join("")}function nj(e,t){if(e<=127){t(e);return}else if(e<=2047){t(192|e>>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function rj(e,t){for(let r=0;r<e.length;r+=1){let s=e.charCodeAt(r);if(s>55295&&s<=56319){const o=(s-55296)*1024&65535;s=(e.charCodeAt(r+1)-56320&65535|o)+65536,r+=1}nj(s,t)}}function aj(e,t,r){if(t.utf8seq===0){if(e<=127){r(e);return}for(let s=1;s<6;s+=1)if((e>>7-s&1)===0){t.utf8seq=s;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&r(t.codepoint)}}function Ii(e){const t=[],r={queue:0,queuedBits:0},s=o=>{t.push(o)};for(let o=0;o<e.length;o+=1)zx(e.charCodeAt(o),r,s);return new Uint8Array(t)}function sj(e){const t=[];return rj(e,r=>t.push(r)),new Uint8Array(t)}function xs(e){const t=[],r={queue:0,queuedBits:0},s=o=>{t.push(o)};return e.forEach(o=>M0(o,r,s)),M0(null,r,s),t.join("")}function ij(e){return Math.round(Date.now()/1e3)+e}function oj(){return Symbol("auth-callback")}const qt=()=>typeof window<"u"&&typeof document<"u",gs={tested:!1,writable:!1},Ux=()=>{if(!qt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(gs.tested)return gs.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),gs.tested=!0,gs.writable=!0}catch{gs.tested=!0,gs.writable=!1}return gs.writable};function lj(e){const t={},r=new URL(e);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((o,l)=>{t[l]=o})}catch{}return r.searchParams.forEach((s,o)=>{t[o]=s}),t}const Ix=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),cj=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Mi=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},vs=async(e,t)=>{const r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return null}},Ht=async(e,t)=>{await e.removeItem(t)};class od{constructor(){this.promise=new od.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}}od.promiseConstructor=Promise;function iu(e){const t=e.split(".");if(t.length!==3)throw new Dm("Invalid JWT structure");for(let s=0;s<t.length;s++)if(!Wk.test(t[s]))throw new Dm("JWT not in base64url format");return{header:JSON.parse(D0(t[0])),payload:JSON.parse(D0(t[1])),signature:Ii(t[2]),raw:{header:t[0],payload:t[1]}}}async function uj(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function dj(e,t){return new Promise((s,o)=>{(async()=>{for(let l=0;l<1/0;l++)try{const u=await e(l);if(!t(l,null,u)){s(u);return}}catch(u){if(!t(l,u)){o(u);return}}})()})}function fj(e){return("0"+e.toString(16)).substr(-2)}function hj(){const t=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=r.length;let o="";for(let l=0;l<56;l++)o+=r.charAt(Math.floor(Math.random()*s));return o}return crypto.getRandomValues(t),Array.from(t,fj).join("")}async function mj(e){const r=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",r),o=new Uint8Array(s);return Array.from(o).map(l=>String.fromCharCode(l)).join("")}async function pj(e){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."),e;const r=await mj(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Ei(e,t,r=!1){const s=hj();let o=s;r&&(o+="/recovery"),await Mi(e,`${t}-code-verifier`,o);const l=await pj(s);return[l,s===l?"plain":"s256"]}const gj=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function vj(e){const t=e.headers.get(Om);if(!t||!t.match(gj))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function yj(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function bj(e){switch(e){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 wj=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Yr(e){if(!wj.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Xn(e){if(!e.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function Jh(){const e={};return new Proxy(e,{get:(t,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const s=r.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="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 "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function xj(e,t){return new Proxy(e,{get:(r,s,o)=>{if(s==="__isInsecureUserWarningProxy")return!0;if(typeof s=="symbol"){const l=s.toString();if(l==="Symbol(Symbol.toPrimitive)"||l==="Symbol(Symbol.toStringTag)"||l==="Symbol(util.inspect.custom)"||l==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,s,o)}return!t.value&&typeof s=="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."),t.value=!0),Reflect.get(r,s,o)}})}function L0(e){return JSON.parse(JSON.stringify(e))}const ws=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error}return JSON.stringify(e)},_j=[502,503,504,520,521,522,523,524,530];async function P0(e){var t;if(!cj(e))throw new Mm(ws(e),0);if(_j.includes(e.status))throw new Mm(ws(e),e.status);let r;try{r=await e.json()}catch(l){throw new Zn(ws(l),l)}let s;const o=vj(e);if(o&&o.getTime()>=Px["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?s=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(s=r.error_code),s){if(s==="weak_password")throw new j0(ws(r),e.status,((t=r.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(s==="session_not_found")throw new Dt}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((l,u)=>l&&typeof u=="string",!0))throw new j0(ws(r),e.status,r.weak_password.reasons);throw new Jk(ws(r),e.status||500,s)}const Sj=(e,t,r,s)=>{const o={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?o:(o.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),o.body=JSON.stringify(s),Object.assign(Object.assign({},o),r))};async function we(e,t,r,s){var o;const l=Object.assign({},s==null?void 0:s.headers);l[Om]||(l[Om]=Px["2024-01-01"].name),s!=null&&s.jwt&&(l.Authorization=`Bearer ${s.jwt}`);const u=(o=s==null?void 0:s.query)!==null&&o!==void 0?o:{};s!=null&&s.redirectTo&&(u.redirect_to=s.redirectTo);const d=Object.keys(u).length?"?"+new URLSearchParams(u).toString():"",h=await Ej(e,t,r+d,{headers:l,noResolveJson:s==null?void 0:s.noResolveJson},{},s==null?void 0:s.body);return s!=null&&s.xform?s==null?void 0:s.xform(h):{data:Object.assign({},h),error:null}}async function Ej(e,t,r,s,o,l){const u=Sj(t,s,o,l);let d;try{d=await e(r,Object.assign({},u))}catch(h){throw console.error(h),new Mm(ws(h),0)}if(d.ok||await P0(d),s!=null&&s.noResolveJson)return d;try{return await d.json()}catch(h){await P0(h)}}function Bn(e){var t;let r=null;Tj(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=ij(e.expires_in)));const s=(t=e.user)!==null&&t!==void 0?t:typeof(e==null?void 0:e.id)=="string"?e:null;return{data:{session:r,user:s},error:null}}function z0(e){const t=Bn(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((r,s)=>r&&typeof s=="string",!0)&&(t.data.weak_password=e.weak_password),t}function $a(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Cj(e){return{data:e,error:null}}function Rj(e){const{action_link:t,email_otp:r,hashed_token:s,redirect_to:o,verification_type:l}=e,u=Ki(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),d={action_link:t,email_otp:r,hashed_token:s,redirect_to:o,verification_type:l},h=Object.assign({},u);return{data:{properties:d,user:h},error:null}}function U0(e){return e}function Tj(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const Qh=["global","local","others"];class Aj{_encodePathSegment(t){if(t==="."||t==="..")throw new Hi("Invalid path segment");return encodeURIComponent(t)}constructor({url:t="",headers:r={},fetch:s,experimental:o}){this.url=t,this.headers=r,this.fetch=Ix(s),this.experimental=o??{},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)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(t,r=Qh[0]){if(Qh.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Qh.join(", ")}`);try{return await we(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(s){if(he(s))return{data:null,error:s};throw s}}async inviteUserByEmail(t,r={}){try{return await we(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:$a})}catch(s){if(he(s))return{data:{user:null},error:s};throw s}}async generateLink(t){try{const{options:r}=t,s=Ki(t,["options"]),o=Object.assign(Object.assign({},s),r);return"newEmail"in s&&(o.new_email=s==null?void 0:s.newEmail,delete o.newEmail),await we(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:o,headers:this.headers,xform:Rj,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(he(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(t){try{return await we(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:$a})}catch(r){if(he(r))return{data:{user:null},error:r};throw r}}async listUsers(t){var r,s,o,l,u,d,h;try{const m={nextPage:null,lastPage:0,total:0},b=await we(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(r=t==null?void 0:t.page)===null||r===void 0?void 0:r.toString())!==null&&s!==void 0?s:"",per_page:(l=(o=t==null?void 0:t.perPage)===null||o===void 0?void 0:o.toString())!==null&&l!==void 0?l:""},xform:U0});if(b.error)throw b.error;const g=await b.json(),w=(u=b.headers.get("x-total-count"))!==null&&u!==void 0?u:0,_=(h=(d=b.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&h!==void 0?h:[];return _.length>0&&(_.forEach(E=>{const S=parseInt(E.split(";")[0].split("=")[1].substring(0,1)),T=JSON.parse(E.split(";")[1].split("=")[1]);m[`${T}Page`]=S}),m.total=parseInt(w)),{data:Object.assign(Object.assign({},g),m),error:null}}catch(m){if(he(m))return{data:{users:[]},error:m};throw m}}async getUserById(t){Yr(t);try{return await we(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:$a})}catch(r){if(he(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){Yr(t);try{return await we(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:$a})}catch(s){if(he(s))return{data:{user:null},error:s};throw s}}async deleteUser(t,r=!1){Yr(t);try{return await we(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:$a})}catch(s){if(he(s))return{data:{user:null},error:s};throw s}}async _listFactors(t){Yr(t.userId);try{const{data:r,error:s}=await we(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:o=>({data:{factors:o},error:null})});return{data:r,error:s}}catch(r){if(he(r))return{data:null,error:r};throw r}}async _deleteFactor(t){Yr(t.userId),Yr(t.id);try{return{data:await we(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(r){if(he(r))return{data:null,error:r};throw r}}async _listOAuthClients(t){var r,s,o,l,u,d,h;try{const m={nextPage:null,lastPage:0,total:0},b=await we(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(r=t==null?void 0:t.page)===null||r===void 0?void 0:r.toString())!==null&&s!==void 0?s:"",per_page:(l=(o=t==null?void 0:t.perPage)===null||o===void 0?void 0:o.toString())!==null&&l!==void 0?l:""},xform:U0});if(b.error)throw b.error;const g=await b.json(),w=(u=b.headers.get("x-total-count"))!==null&&u!==void 0?u:0,_=(h=(d=b.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&h!==void 0?h:[];return _.length>0&&(_.forEach(E=>{const S=parseInt(E.split(";")[0].split("=")[1].substring(0,1)),T=JSON.parse(E.split(";")[1].split("=")[1]);m[`${T}Page`]=S}),m.total=parseInt(w)),{data:Object.assign(Object.assign({},g),m),error:null}}catch(m){if(he(m))return{data:{clients:[]},error:m};throw m}}async _createOAuthClient(t){try{return await we(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(he(r))return{data:null,error:r};throw r}}async _getOAuthClient(t){try{const r=this._encodePathSegment(t);return await we(this.fetch,"GET",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(r){if(he(r))return{data:null,error:r};throw r}}async _updateOAuthClient(t,r){try{const s=this._encodePathSegment(t);return await we(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${s}`,{body:r,headers:this.headers,xform:o=>({data:o,error:null})})}catch(s){if(he(s))return{data:null,error:s};throw s}}async _deleteOAuthClient(t){try{const r=this._encodePathSegment(t);return await we(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(he(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(t){try{const r=this._encodePathSegment(t);return await we(this.fetch,"POST",`${this.url}/admin/oauth/clients/${r}/regenerate_secret`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(r){if(he(r))return{data:null,error:r};throw r}}async _listCustomProviders(t){try{const r={};return t!=null&&t.type&&(r.type=t.type),await we(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:s=>{var o;return{data:{providers:(o=s==null?void 0:s.providers)!==null&&o!==void 0?o:[]},error:null}}})}catch(r){if(he(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(t){try{return await we(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(he(r))return{data:null,error:r};throw r}}async _getCustomProvider(t){try{const r=this._encodePathSegment(t);return await we(this.fetch,"GET",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(r){if(he(r))return{data:null,error:r};throw r}}async _updateCustomProvider(t,r){try{const s=this._encodePathSegment(t);return await we(this.fetch,"PUT",`${this.url}/admin/custom-providers/${s}`,{body:r,headers:this.headers,xform:o=>({data:o,error:null})})}catch(s){if(he(s))return{data:null,error:s};throw s}}async _deleteCustomProvider(t){try{const r=this._encodePathSegment(t);return await we(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(he(r))return{data:null,error:r};throw r}}async _adminListPasskeys(t){Xn(this.experimental),Yr(t.userId);try{return await we(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(he(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(t){Xn(this.experimental),Yr(t.userId),Yr(t.passkeyId);try{return await we(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(he(r))return{data:null,error:r};throw r}}}function I0(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}const pr={debug:!!(globalThis&&Ux()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class $x extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class $0 extends $x{}async function Nj(e,t,r){pr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const s=new globalThis.AbortController;let o;t>0&&(o=setTimeout(()=>{s.abort(),pr.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t)),await Promise.resolve();try{return await globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:s.signal},async l=>{if(l){clearTimeout(o),pr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,l.name);try{return await r()}finally{pr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,l.name)}}else{if(t===0)throw pr.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new $0(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(pr.debug)try{const u=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(u,null," "))}catch(u){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",u)}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"),clearTimeout(o),await r()}})}catch(l){if(t>0&&clearTimeout(o),l!==null&&typeof l=="object"&&"name"in l&&l.name==="AbortError"&&t>0){if(s.signal.aborted)return pr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:"exclusive",steal:!0},async u=>{if(u){pr.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,u.name);try{return await r()}finally{pr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",e,u.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await r()}));throw pr.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new $0(`Lock "${e}" was released because another request stole it`)}throw l}}function kj(){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 Bx(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function jj(e){return parseInt(e,16)}function Oj(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,s=>s.toString(16).padStart(2,"0")).join("")}function Mj(e){var t;const{chainId:r,domain:s,expirationTime:o,issuedAt:l=new Date,nonce:u,notBefore:d,requestId:h,resources:m,scheme:b,uri:g,version:w}=e;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!s)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(!g)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(!((t=e.statement)===null||t===void 0)&&t.includes(`
|
||
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const _=Bx(e.address),E=b?`${b}://${s}`:s,S=e.statement?`${e.statement}
|
||
`:"",T=`${E} wants you to sign in with your Ethereum account:
|
||
${_}
|
||
|
||
${S}`;let C=`URI: ${g}
|
||
Version: ${w}
|
||
Chain ID: ${r}${u?`
|
||
Nonce: ${u}`:""}
|
||
Issued At: ${l.toISOString()}`;if(o&&(C+=`
|
||
Expiration Time: ${o.toISOString()}`),d&&(C+=`
|
||
Not Before: ${d.toISOString()}`),h&&(C+=`
|
||
Request ID: ${h}`),m){let A=`
|
||
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}`);A+=`
|
||
- ${N}`}C+=A}return`${T}
|
||
${C}`}class Ct extends Error{constructor({message:t,code:r,cause:s,name:o}){var l;super(t,{cause:s}),this.__isWebAuthnError=!0,this.name=(l=o??(s instanceof Error?s.name:void 0))!==null&&l!==void 0?l:"Unknown Error",this.code=r}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class zu extends Ct{constructor(t,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:t}),this.name="WebAuthnUnknownError",this.originalError=r}}function Dj({error:e,options:t}){var r,s,o;const{publicKey:l}=t;if(!l)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Ct({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((r=l.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new Ct({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((s=l.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new Ct({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((o=l.authenticatorSelection)===null||o===void 0?void 0:o.userVerification)==="required")return new Ct({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new Ct({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new Ct({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return l.pubKeyCredParams.filter(d=>d.type==="public-key").length===0?new Ct({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Ct({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const u=window.location.hostname;if(Hx(u)){if(l.rp.id!==u)return new Ct({message:`The RP ID "${l.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Ct({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(l.user.id.byteLength<1||l.user.id.byteLength>64)return new Ct({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new Ct({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Ct({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function Lj({error:e,options:t}){const{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Ct({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new Ct({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const s=window.location.hostname;if(Hx(s)){if(r.rpId!==s)return new Ct({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Ct({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new Ct({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Ct({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class Pj{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const Lm=new Pj;function B0(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:r,excludeCredentials:s}=e,o=Ki(e,["challenge","user","excludeCredentials"]),l=Ii(t).buffer,u=Object.assign(Object.assign({},r),{id:Ii(r.id).buffer}),d=Object.assign(Object.assign({},o),{challenge:l,user:u});if(s&&s.length>0){d.excludeCredentials=new Array(s.length);for(let h=0;h<s.length;h++){const m=s[h];d.excludeCredentials[h]=Object.assign(Object.assign({},m),{id:Ii(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function H0(e){if(!e)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:r}=e,s=Ki(e,["challenge","allowCredentials"]),o=Ii(t).buffer,l=Object.assign(Object.assign({},s),{challenge:o});if(r&&r.length>0){l.allowCredentials=new Array(r.length);for(let u=0;u<r.length;u++){const d=r[u];l.allowCredentials[u]=Object.assign(Object.assign({},d),{id:Ii(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return l}function q0(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const r=e;return{id:e.id,rawId:e.id,response:{attestationObject:xs(new Uint8Array(e.response.attestationObject)),clientDataJSON:xs(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function V0(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const r=e,s=e.getClientExtensionResults(),o=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:xs(new Uint8Array(o.authenticatorData)),clientDataJSON:xs(new Uint8Array(o.clientDataJSON)),signature:xs(new Uint8Array(o.signature)),userHandle:o.userHandle?xs(new Uint8Array(o.userHandle)):void 0},type:"public-key",clientExtensionResults:s,authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Hx(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Uu(){var e,t;return!!(qt()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.create)=="function"&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.get)=="function")}async function qx(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new zu("Browser returned unexpected credential type",t)}:{data:null,error:new zu("Empty credential response",t)}}catch(t){return{data:null,error:Dj({error:t,options:e})}}}async function Vx(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new zu("Browser returned unexpected credential type",t)}:{data:null,error:new zu("Empty credential response",t)}}catch(t){return{data:null,error:Lj({error:t,options:e})}}}const zj={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Uj={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Iu(...e){const t=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),r=o=>o instanceof ArrayBuffer||ArrayBuffer.isView(o),s={};for(const o of e)if(o)for(const l in o){const u=o[l];if(u!==void 0)if(Array.isArray(u))s[l]=u;else if(r(u))s[l]=u;else if(t(u)){const d=s[l];t(d)?s[l]=Iu(d,u):s[l]=Iu(u)}else s[l]=u}return s}function Ij(e,t){return Iu(zj,e,t||{})}function $j(e,t){return Iu(Uj,e,t||{})}class Bj{constructor(t){this.client=t,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(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:r,friendlyName:s,signal:o},l){var u;try{const{data:d,error:h}=await this.client.mfa.challenge({factorId:t,webauthn:r});if(!d)return{data:null,error:h};const m=o??Lm.createNewAbortSignal();if(d.webauthn.type==="create"){const{user:b}=d.webauthn.credential_options.publicKey;if(!b.name){const g=s;if(g)b.name=`${b.id}:${g}`;else{const _=(await this.client.getUser()).data.user,E=((u=_==null?void 0:_.user_metadata)===null||u===void 0?void 0:u.name)||(_==null?void 0:_.email)||(_==null?void 0:_.id)||"User";b.name=`${b.id}:${E}`}}b.displayName||(b.displayName=b.name)}switch(d.webauthn.type){case"create":{const b=Ij(d.webauthn.credential_options.publicKey,l==null?void 0:l.create),{data:g,error:w}=await qx({publicKey:b,signal:m});return g?{data:{factorId:t,challengeId:d.id,webauthn:{type:d.webauthn.type,credential_response:g}},error:null}:{data:null,error:w}}case"request":{const b=$j(d.webauthn.credential_options.publicKey,l==null?void 0:l.request),{data:g,error:w}=await Vx(Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:b,signal:m}));return g?{data:{factorId:t,challengeId:d.id,webauthn:{type:d.webauthn.type,credential_response:g}},error:null}:{data:null,error:w}}}}catch(d){return he(d)?{data:null,error:d}:{data:null,error:new Zn("Unexpected error in challenge",d)}}}async _verify({challengeId:t,factorId:r,webauthn:s}){return this.client.mfa.verify({factorId:r,challengeId:t,webauthn:s})}async _authenticate({factorId:t,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:o}={}},l){if(!r)return{data:null,error:new Hi("rpId is required for WebAuthn authentication")};try{if(!Uu())return{data:null,error:new Zn("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this.challenge({factorId:t,webauthn:{rpId:r,rpOrigins:s},signal:o},{request:l});if(!u)return{data:null,error:d};const{webauthn:h}=u;return this._verify({factorId:t,challengeId:u.challengeId,webauthn:{type:h.type,rpId:r,rpOrigins:s,credential_response:h.credential_response}})}catch(u){return he(u)?{data:null,error:u}:{data:null,error:new Zn("Unexpected error in authenticate",u)}}}async _register({friendlyName:t,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:o}={}},l){if(!r)return{data:null,error:new Hi("rpId is required for WebAuthn registration")};try{if(!Uu())return{data:null,error:new Zn("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this._enroll({friendlyName:t});if(!u)return await this.client.mfa.listFactors().then(b=>{var g;return(g=b.data)===null||g===void 0?void 0:g.all.find(w=>w.factor_type==="webauthn"&&w.friendly_name===t&&w.status!=="unverified")}).then(b=>b?this.client.mfa.unenroll({factorId:b==null?void 0:b.id}):void 0),{data:null,error:d};const{data:h,error:m}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:r,rpOrigins:s},signal:o},{create:l});return h?this._verify({factorId:u.id,challengeId:h.challengeId,webauthn:{rpId:r,rpOrigins:s,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:m}}catch(u){return he(u)?{data:null,error:u}:{data:null,error:new Zn("Unexpected error in register",u)}}}}kj();const Hj={url:Fk,storageKey:Kk,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Yk,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function G0(e,t,r){return await r()}const Ci={};class ml{get jwks(){var t,r;return(r=(t=Ci[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(t){Ci[this.storageKey]=Object.assign(Object.assign({},Ci[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,r;return(r=(t=Ci[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Ci[this.storageKey]=Object.assign(Object.assign({},Ci[this.storageKey]),{cachedAt:t})}constructor(t){var r,s,o,l;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 u=Object.assign(Object.assign({},Hj),t);if(this.storageKey=u.storageKey,this.instanceID=(r=ml.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,ml.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!u.debug,typeof u.debug=="function"&&(this.logger=u.debug),this.instanceID>0&&qt()){const d=`${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(d),this.logDebugMessages&&console.trace(d)}if(this.persistSession=u.persistSession,this.autoRefreshToken=u.autoRefreshToken,this.experimental=(s=u.experimental)!==null&&s!==void 0?s:{},this.admin=new Aj({url:u.url,headers:u.headers,fetch:u.fetch,experimental:this.experimental}),this.url=u.url,this.headers=u.headers,this.fetch=Ix(u.fetch),this.lock=u.lock||G0,this.detectSessionInUrl=u.detectSessionInUrl,this.flowType=u.flowType,this.hasCustomAuthorizationHeader=u.hasCustomAuthorizationHeader,this.throwOnError=u.throwOnError,this.lockAcquireTimeout=u.lockAcquireTimeout,u.lock?this.lock=u.lock:this.persistSession&&qt()&&(!((o=globalThis==null?void 0:globalThis.navigator)===null||o===void 0)&&o.locks)?this.lock=Nj:this.lock=G0,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 Bj(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.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(u.storage?this.storage=u.storage:Ux()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=I0(this.memoryStorage)),u.userStorage&&(this.userStorage=u.userStorage)):(this.memoryStorage={},this.storage=I0(this.memoryStorage)),qt()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(d){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",d)}(l=this.broadcastChannel)===null||l===void 0||l.addEventListener("message",async d=>{this._debug("received broadcast notification from other tab or client",d);try{await this._notifyAllSubscribers(d.data.event,d.data.session,!1)}catch(h){this._debug("#broadcastChannel","error",h)}})}u.skipAutoInitialize||this.initialize().catch(d=>{this._debug("#initialize()","error",d)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Lx}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),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 t;try{let r={},s="none";if(qt()&&(r=lj(window.location.href),this._isImplicitGrantCallback(r)?s="implicit":await this._isPKCECallback(r)&&(s="pkce")),qt()&&this.detectSessionInUrl&&s!=="none"){const{data:o,error:l}=await this._getSessionFromURL(r,s);if(l){if(this._debug("#_initialize()","error detecting session from URL",l),Zk(l)){const h=(t=l.details)===null||t===void 0?void 0:t.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(r){return he(r)?this._returnResult({error:r}):this._returnResult({error:new Zn("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var r,s,o;try{const l=await we(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(s=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:(o=t==null?void 0:t.options)===null||o===void 0?void 0:o.captchaToken}},xform:Bn}),{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(he(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signUp(t){var r,s,o;try{let l;if("email"in t){const{email:b,password:g,options:w}=t;let _=null,E=null;this.flowType==="pkce"&&([_,E]=await Ei(this.storage,this.storageKey)),l=await we(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:w==null?void 0:w.emailRedirectTo,body:{email:b,password:g,data:(r=w==null?void 0:w.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:w==null?void 0:w.captchaToken},code_challenge:_,code_challenge_method:E},xform:Bn})}else if("phone"in t){const{phone:b,password:g,options:w}=t;l=await we(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:b,password:g,data:(s=w==null?void 0:w.data)!==null&&s!==void 0?s:{},channel:(o=w==null?void 0:w.channel)!==null&&o!==void 0?o:"sms",gotrue_meta_security:{captcha_token:w==null?void 0:w.captchaToken}},xform:Bn})}else throw new au("You must provide either an email or phone number and a password");const{data:u,error:d}=l;if(d||!u)return await Ht(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 Ht(this.storage,`${this.storageKey}-code-verifier`),he(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signInWithPassword(t){try{let r;if("email"in t){const{email:l,password:u,options:d}=t;r=await we(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:l,password:u,gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:z0})}else if("phone"in t){const{phone:l,password:u,options:d}=t;r=await we(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:l,password:u,gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:z0})}else throw new au("You must provide either an email or phone number and a password");const{data:s,error:o}=r;if(o)return this._returnResult({data:{user:null,session:null},error:o});if(!s||!s.session||!s.user){const l=new Si;return this._returnResult({data:{user:null,session:null},error:l})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:o})}catch(r){if(he(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(t){var r,s,o,l;return await this._handleProviderSignIn(t.provider,{redirectTo:(r=t.options)===null||r===void 0?void 0:r.redirectTo,scopes:(s=t.options)===null||s===void 0?void 0:s.scopes,queryParams:(o=t.options)===null||o===void 0?void 0:o.queryParams,skipBrowserRedirect:(l=t.options)===null||l===void 0?void 0:l.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:r}=t;switch(r){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(t){var r,s,o,l,u,d,h,m,b,g,w;let _,E;if("message"in t)_=t.message,E=t.signature;else{const{chain:S,wallet:T,statement:C,options:A}=t;let N;if(qt())if(typeof T=="object")N=T;else{const re=window;if("ethereum"in re&&typeof re.ethereum=="object"&&"request"in re.ethereum&&typeof re.ethereum.request=="function")N=re.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 T!="object"||!(A!=null&&A.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");N=T}const z=new URL((r=A==null?void 0:A.url)!==null&&r!==void 0?r:window.location.href),F=await N.request({method:"eth_requestAccounts"}).then(re=>re).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!F||F.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const B=Bx(F[0]);let P=(s=A==null?void 0:A.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!P){const re=await N.request({method:"eth_chainId"});P=jj(re)}const V={domain:z.host,address:B,statement:C,uri:z.href,version:"1",chainId:P,nonce:(o=A==null?void 0:A.signInWithEthereum)===null||o===void 0?void 0:o.nonce,issuedAt:(u=(l=A==null?void 0:A.signInWithEthereum)===null||l===void 0?void 0:l.issuedAt)!==null&&u!==void 0?u:new Date,expirationTime:(d=A==null?void 0:A.signInWithEthereum)===null||d===void 0?void 0:d.expirationTime,notBefore:(h=A==null?void 0:A.signInWithEthereum)===null||h===void 0?void 0:h.notBefore,requestId:(m=A==null?void 0:A.signInWithEthereum)===null||m===void 0?void 0:m.requestId,resources:(b=A==null?void 0:A.signInWithEthereum)===null||b===void 0?void 0:b.resources};_=Mj(V),E=await N.request({method:"personal_sign",params:[Oj(_),B]})}try{const{data:S,error:T}=await we(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:_,signature:E},!((g=t.options)===null||g===void 0)&&g.captchaToken?{gotrue_meta_security:{captcha_token:(w=t.options)===null||w===void 0?void 0:w.captchaToken}}:null),xform:Bn});if(T)throw T;if(!S||!S.session||!S.user){const C=new Si;return this._returnResult({data:{user:null,session:null},error:C})}return S.session&&(await this._saveSession(S.session),await this._notifyAllSubscribers("SIGNED_IN",S.session)),this._returnResult({data:Object.assign({},S),error:T})}catch(S){if(he(S))return this._returnResult({data:{user:null,session:null},error:S});throw S}}async signInWithSolana(t){var r,s,o,l,u,d,h,m,b,g,w,_;let E,S;if("message"in t)E=t.message,S=t.signature;else{const{chain:T,wallet:C,statement:A,options:N}=t;let z;if(qt())if(typeof C=="object")z=C;else{const B=window;if("solana"in B&&typeof B.solana=="object"&&("signIn"in B.solana&&typeof B.solana.signIn=="function"||"signMessage"in B.solana&&typeof B.solana.signMessage=="function"))z=B.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 C!="object"||!(N!=null&&N.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");z=C}const F=new URL((r=N==null?void 0:N.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in z&&z.signIn){const B=await z.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},N==null?void 0:N.signInWithSolana),{version:"1",domain:F.host,uri:F.href}),A?{statement:A}:null));let P;if(Array.isArray(B)&&B[0]&&typeof B[0]=="object")P=B[0];else if(B&&typeof B=="object"&&"signedMessage"in B&&"signature"in B)P=B;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in P&&"signature"in P&&(typeof P.signedMessage=="string"||P.signedMessage instanceof Uint8Array)&&P.signature instanceof Uint8Array)E=typeof P.signedMessage=="string"?P.signedMessage:new TextDecoder().decode(P.signedMessage),S=P.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in z)||typeof z.signMessage!="function"||!("publicKey"in z)||typeof z!="object"||!z.publicKey||!("toBase58"in z.publicKey)||typeof z.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");E=[`${F.host} wants you to sign in with your Solana account:`,z.publicKey.toBase58(),...A?["",A,""]:[""],"Version: 1",`URI: ${F.href}`,`Issued At: ${(o=(s=N==null?void 0:N.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&o!==void 0?o:new Date().toISOString()}`,...!((l=N==null?void 0:N.signInWithSolana)===null||l===void 0)&&l.notBefore?[`Not Before: ${N.signInWithSolana.notBefore}`]:[],...!((u=N==null?void 0:N.signInWithSolana)===null||u===void 0)&&u.expirationTime?[`Expiration Time: ${N.signInWithSolana.expirationTime}`]:[],...!((d=N==null?void 0:N.signInWithSolana)===null||d===void 0)&&d.chainId?[`Chain ID: ${N.signInWithSolana.chainId}`]:[],...!((h=N==null?void 0:N.signInWithSolana)===null||h===void 0)&&h.nonce?[`Nonce: ${N.signInWithSolana.nonce}`]:[],...!((m=N==null?void 0:N.signInWithSolana)===null||m===void 0)&&m.requestId?[`Request ID: ${N.signInWithSolana.requestId}`]:[],...!((g=(b=N==null?void 0:N.signInWithSolana)===null||b===void 0?void 0:b.resources)===null||g===void 0)&&g.length?["Resources",...N.signInWithSolana.resources.map(P=>`- ${P}`)]:[]].join(`
|
||
`);const B=await z.signMessage(new TextEncoder().encode(E),"utf8");if(!B||!(B instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");S=B}}try{const{data:T,error:C}=await we(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:E,signature:xs(S)},!((w=t.options)===null||w===void 0)&&w.captchaToken?{gotrue_meta_security:{captcha_token:(_=t.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:Bn});if(C)throw C;if(!T||!T.session||!T.user){const A=new Si;return this._returnResult({data:{user:null,session:null},error:A})}return T.session&&(await this._saveSession(T.session),await this._notifyAllSubscribers("SIGNED_IN",T.session)),this._returnResult({data:Object.assign({},T),error:C})}catch(T){if(he(T))return this._returnResult({data:{user:null,session:null},error:T});throw T}}async _exchangeCodeForSession(t){const r=await vs(this.storage,`${this.storageKey}-code-verifier`),[s,o]=(r??"").split("/");try{if(!s&&this.flowType==="pkce")throw new ej;const{data:l,error:u}=await we(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:s},xform:Bn});if(await Ht(this.storage,`${this.storageKey}-code-verifier`),u)throw u;if(!l||!l.session||!l.user){const d=new Si;return this._returnResult({data:{user:null,session:null,redirectType:null},error:d})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers(o==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l.session)),this._returnResult({data:Object.assign(Object.assign({},l),{redirectType:o??null}),error:u})}catch(l){if(await Ht(this.storage,`${this.storageKey}-code-verifier`),he(l))return this._returnResult({data:{user:null,session:null,redirectType:null},error:l});throw l}}async signInWithIdToken(t){try{const{options:r,provider:s,token:o,access_token:l,nonce:u}=t,d=await we(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:o,access_token:l,nonce:u,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:Bn}),{data:h,error:m}=d;if(m)return this._returnResult({data:{user:null,session:null},error:m});if(!h||!h.session||!h.user){const b=new Si;return this._returnResult({data:{user:null,session:null},error:b})}return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",h.session)),this._returnResult({data:h,error:m})}catch(r){if(he(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(t){var r,s,o,l,u;try{if("email"in t){const{email:d,options:h}=t;let m=null,b=null;this.flowType==="pkce"&&([m,b]=await Ei(this.storage,this.storageKey));const{error:g}=await we(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:d,data:(r=h==null?void 0:h.data)!==null&&r!==void 0?r:{},create_user:(s=h==null?void 0:h.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},code_challenge:m,code_challenge_method:b},redirectTo:h==null?void 0:h.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:g})}if("phone"in t){const{phone:d,options:h}=t,{data:m,error:b}=await we(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:d,data:(o=h==null?void 0:h.data)!==null&&o!==void 0?o:{},create_user:(l=h==null?void 0:h.shouldCreateUser)!==null&&l!==void 0?l:!0,gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},channel:(u=h==null?void 0:h.channel)!==null&&u!==void 0?u:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:m==null?void 0:m.message_id},error:b})}throw new au("You must provide either an email or phone number.")}catch(d){if(await Ht(this.storage,`${this.storageKey}-code-verifier`),he(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async verifyOtp(t){var r,s;try{let o,l;"options"in t&&(o=(r=t.options)===null||r===void 0?void 0:r.redirectTo,l=(s=t.options)===null||s===void 0?void 0:s.captchaToken);const{data:u,error:d}=await we(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:l}}),redirectTo:o,xform:Bn});if(d)throw d;if(!u)throw new Error("An error occurred on token verification.");const h=u.session,m=u.user;return h!=null&&h.access_token&&(await this._saveSession(h),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",h)),this._returnResult({data:{user:m,session:h},error:null})}catch(o){if(he(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signInWithSSO(t){var r,s,o,l,u;try{let d=null,h=null;this.flowType==="pkce"&&([d,h]=await Ei(this.storage,this.storageKey));const m=await we(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(s=(r=t.options)===null||r===void 0?void 0:r.redirectTo)!==null&&s!==void 0?s:void 0}),!((o=t==null?void 0:t.options)===null||o===void 0)&&o.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:d,code_challenge_method:h}),headers:this.headers,xform:Cj});return!((l=m.data)===null||l===void 0)&&l.url&&qt()&&!(!((u=t.options)===null||u===void 0)&&u.skipBrowserRedirect)&&window.location.assign(m.data.url),this._returnResult(m)}catch(d){if(await Ht(this.storage,`${this.storageKey}-code-verifier`),he(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 t=>{const{data:{session:r},error:s}=t;if(s)throw s;if(!r)throw new Dt;const{error:o}=await we(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:o})})}catch(t){if(he(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const r=`${this.url}/resend`;if("email"in t){const{email:s,type:o,options:l}=t,{error:u}=await we(this.fetch,"POST",r,{headers:this.headers,body:{email:s,type:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:u})}else if("phone"in t){const{phone:s,type:o,options:l}=t,{data:u,error:d}=await we(this.fetch,"POST",r,{headers:this.headers,body:{phone:s,type:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:d})}throw new au("You must provide either an email or phone number and a type")}catch(r){if(he(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async r=>r))}async _acquireLock(t,r){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const s=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),o=(async()=>(await s,await r()))();return this.pendingInLock.push((async()=>{try{await o}catch{}})()),o}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const s=r();for(this.pendingInLock.push((async()=>{try{await s}catch{}})()),await s;this.pendingInLock.length;){const o=[...this.pendingInLock];await Promise.all(o),this.pendingInLock.splice(0,o.length)}return await s}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await t(r)}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 t=null;const r=await vs(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?t=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const s=t.expires_at?t.expires_at*1e3-Date.now()<Wh:!1;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",t.expires_at),!s){if(this.userStorage){const u=await vs(this.userStorage,this.storageKey+"-user");u!=null&&u.user?t.user=u.user:t.user=Jh()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const u={value:this.suppressGetSessionWarning};t.user=xj(t.user,u),u.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:o,error:l}=await this._callRefreshToken(t.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(t){if(t)return await this._getUser(t);await this.initializePromise;const r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(t){try{return t?await we(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:$a}):await this._useSession(async r=>{var s,o,l;const{data:u,error:d}=r;if(d)throw d;return!(!((s=u.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Dt}:await we(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:$a})})}catch(r){if(he(r))return ru(r)&&(await this._removeSession(),await Ht(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(t,r={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,r))}async _updateUser(t,r={}){try{return await this._useSession(async s=>{const{data:o,error:l}=s;if(l)throw l;if(!o.session)throw new Dt;const u=o.session;let d=null,h=null;this.flowType==="pkce"&&t.email!=null&&([d,h]=await Ei(this.storage,this.storageKey));const{data:m,error:b}=await we(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:d,code_challenge_method:h}),jwt:u.access_token,xform:$a});if(b)throw b;return u.user=m.user,await this._saveSession(u),await this._notifyAllSubscribers("USER_UPDATED",u),this._returnResult({data:{user:u.user},error:null})})}catch(s){if(await Ht(this.storage,`${this.storageKey}-code-verifier`),he(s))return this._returnResult({data:{user:null},error:s});throw s}}async setSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new Dt;const r=Date.now()/1e3;let s=r,o=!0,l=null;const{payload:u}=iu(t.access_token);if(u.exp&&(s=u.exp,o=s<=r),o){const{data:d,error:h}=await this._callRefreshToken(t.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(t.access_token);if(h)return this._returnResult({data:{user:null,session:null},error:h});l={access_token:t.access_token,refresh_token:t.refresh_token,user:d.user,token_type:"bearer",expires_in:s-r,expires_at:s},await this._saveSession(l),await this._notifyAllSubscribers("SIGNED_IN",l)}return this._returnResult({data:{user:l.user,session:l},error:null})}catch(r){if(he(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async r=>{var s;if(!t){const{data:u,error:d}=r;if(d)throw d;t=(s=u.session)!==null&&s!==void 0?s:void 0}if(!(t!=null&&t.refresh_token))throw new Dt;const{data:o,error:l}=await this._callRefreshToken(t.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(r){if(he(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(t,r){var s;try{if(!qt())throw new su("No browser detected.");if(t.error||t.error_description||t.error_code)throw new su(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new k0("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new su("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new k0("No code detected.");const{data:N,error:z}=await this._exchangeCodeForSession(t.code);if(z)throw z;const F=new URL(window.location.href);return F.searchParams.delete("code"),window.history.replaceState(window.history.state,"",F.toString()),{data:{session:N.session,redirectType:(s=N.redirectType)!==null&&s!==void 0?s:null},error:null}}const{provider_token:o,provider_refresh_token:l,access_token:u,refresh_token:d,expires_in:h,expires_at:m,token_type:b}=t;if(!u||!h||!d||!b)throw new su("No session defined in URL");const g=Math.round(Date.now()/1e3),w=parseInt(h);let _=g+w;m&&(_=parseInt(m));const E=_-g;E*1e3<=Oi&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${E}s, should have been closer to ${w}s`);const S=_-w;g-S>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",S,_,g):g-S<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",S,_,g);const{data:T,error:C}=await this._getUser(u);if(C)throw C;const A={provider_token:o,provider_refresh_token:l,access_token:u,expires_in:w,expires_at:_,refresh_token:d,token_type:b,user:T.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:A,redirectType:t.type},error:null})}catch(o){if(he(o))return this._returnResult({data:{session:null,redirectType:null},error:o});throw o}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error_description)}async _isPKCECallback(t){const r=await vs(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&r)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async r=>{var s;const{data:o,error:l}=r;if(l&&!ru(l))return this._returnResult({error:l});const u=(s=o.session)===null||s===void 0?void 0:s.access_token;if(u){const{error:d}=await this.admin.signOut(u,t);if(d&&!(Qk(d)&&(d.status===404||d.status===401||d.status===403)||ru(d)))return this._returnResult({error:d})}return t!=="others"&&(await this._removeSession(),await Ht(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const r=oj(),s={id:r,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,s),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:s}}}async _emitInitialSession(t){return await this._useSession(async r=>{var s,o;try{const{data:{session:l},error:u}=r;if(u)throw u;await((s=this.stateChangeEmitters.get(t))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",l)),this._debug("INITIAL_SESSION","callback id",t,"session",l)}catch(l){await((o=this.stateChangeEmitters.get(t))===null||o===void 0?void 0:o.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",l),ru(l)?console.warn(l):console.error(l)}})}async resetPasswordForEmail(t,r={}){let s=null,o=null;this.flowType==="pkce"&&([s,o]=await Ei(this.storage,this.storageKey,!0));try{return await we(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:s,code_challenge_method:o,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(l){if(await Ht(this.storage,`${this.storageKey}-code-verifier`),he(l))return this._returnResult({data:null,error:l});throw l}}async getUserIdentities(){var t;try{const{data:r,error:s}=await this.getUser();if(s)throw s;return this._returnResult({data:{identities:(t=r.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(r){if(he(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var r;try{const{data:s,error:o}=await this._useSession(async l=>{var u,d,h,m,b;const{data:g,error:w}=l;if(w)throw w;const _=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(u=t.options)===null||u===void 0?void 0:u.redirectTo,scopes:(d=t.options)===null||d===void 0?void 0:d.scopes,queryParams:(h=t.options)===null||h===void 0?void 0:h.queryParams,skipBrowserRedirect:!0});return await we(this.fetch,"GET",_,{headers:this.headers,jwt:(b=(m=g.session)===null||m===void 0?void 0:m.access_token)!==null&&b!==void 0?b:void 0})});if(o)throw o;return qt()&&!(!((r=t.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(s==null?void 0:s.url),this._returnResult({data:{provider:t.provider,url:s==null?void 0:s.url},error:null})}catch(s){if(he(s))return this._returnResult({data:{provider:t.provider,url:null},error:s});throw s}}async linkIdentityIdToken(t){return await this._useSession(async r=>{var s;try{const{error:o,data:{session:l}}=r;if(o)throw o;const{options:u,provider:d,token:h,access_token:m,nonce:b}=t,g=await we(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(s=l==null?void 0:l.access_token)!==null&&s!==void 0?s:void 0,body:{provider:d,id_token:h,access_token:m,nonce:b,link_identity:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken}},xform:Bn}),{data:w,error:_}=g;return _?this._returnResult({data:{user:null,session:null},error:_}):!w||!w.session||!w.user?this._returnResult({data:{user:null,session:null},error:new Si}):(w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("USER_UPDATED",w.session)),this._returnResult({data:w,error:_}))}catch(o){if(await Ht(this.storage,`${this.storageKey}-code-verifier`),he(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}})}async unlinkIdentity(t){try{return await this._useSession(async r=>{var s,o;const{data:l,error:u}=r;if(u)throw u;return await we(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(o=(s=l.session)===null||s===void 0?void 0:s.access_token)!==null&&o!==void 0?o:void 0})})}catch(r){if(he(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(t){const r=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(r,"begin");try{const s=Date.now();return await dj(async o=>(o>0&&await uj(200*Math.pow(2,o-1)),this._debug(r,"refreshing attempt",o),await we(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:Bn})),(o,l)=>{const u=200*Math.pow(2,o);return l&&Xh(l)&&Date.now()+u-s<Oi})}catch(s){if(this._debug(r,"error",s),he(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}finally{this._debug(r,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,r){const s=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",r,"url",s),qt()&&!r.skipBrowserRedirect&&window.location.assign(s),{data:{provider:t,url:s},error:null}}async _recoverAndRefresh(){var t,r;const s="#_recoverAndRefresh()";this._debug(s,"begin");try{const o=await vs(this.storage,this.storageKey);if(o&&this.userStorage){let u=await vs(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!u&&(u={user:o.user},await Mi(this.userStorage,this.storageKey+"-user",u)),o.user=(t=u==null?void 0:u.user)!==null&&t!==void 0?t:Jh()}else if(o&&!o.user&&!o.user){const u=await vs(this.storage,this.storageKey+"-user");u&&(u!=null&&u.user)?(o.user=u.user,await Ht(this.storage,this.storageKey+"-user"),await Mi(this.storage,this.storageKey,o)):o.user=Jh()}if(this._debug(s,"session from storage",o),!this._isValidSession(o)){this._debug(s,"session is not valid"),o!==null&&await this._removeSession();return}const l=((r=o.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<Wh;if(this._debug(s,`session has${l?"":" not"} expired with margin of ${Wh}s`),l){if(this.autoRefreshToken&&o.refresh_token){const{error:u}=await this._callRefreshToken(o.refresh_token);u&&(console.error(u),Xh(u)||(this._debug(s,"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!=null&&u.user)?(o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)):this._debug(s,"could not get user data, skipping SIGNED_IN notification")}catch(u){console.error("Error getting user data:",u),this._debug(s,"error getting user data, skipping SIGNED_IN notification",u)}else await this._notifyAllSubscribers("SIGNED_IN",o)}catch(o){this._debug(s,"error",o),console.error(o);return}finally{this._debug(s,"end")}}async _callRefreshToken(t){var r,s;if(!t)throw new Dt;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const o=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(o,"begin");try{this.refreshingDeferred=new od;const{data:l,error:u}=await this._refreshAccessToken(t);if(u)throw u;if(!l.session)throw new Dt;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),he(l)){const u={data:null,error:l};return Xh(l)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(u),u}throw(s=this.refreshingDeferred)===null||s===void 0||s.reject(l),l}finally{this.refreshingDeferred=null,this._debug(o,"end")}}async _notifyAllSubscribers(t,r,s=!0){const o=`#_notifyAllSubscribers(${t})`;this._debug(o,"begin",r,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:t,session:r});const l=[],u=Array.from(this.stateChangeEmitters.values()).map(async d=>{try{await d.callback(t,r)}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(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await Ht(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},t),s=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!s&&r.user&&await Mi(this.userStorage,this.storageKey+"-user",{user:r.user});const o=Object.assign({},r);delete o.user;const l=L0(o);await Mi(this.storage,this.storageKey,l)}else{const o=L0(r);await Mi(this.storage,this.storageKey,o)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Ht(this.storage,this.storageKey),await Ht(this.storage,this.storageKey+"-code-verifier"),await Ht(this.storage,this.storageKey+"-user"),this.userStorage&&await Ht(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&qt()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),Oi);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}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 t=Date.now();try{return await this._useSession(async r=>{const{data:{session:s}}=r;if(!s||!s.refresh_token||!s.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const o=Math.floor((s.expires_at*1e3-t)/Oi);this._debug("#_autoRefreshTokenTick()",`access token expires in ${o} ticks, a tick lasts ${Oi}ms, refresh threshold is ${jm} ticks`),o<=jm&&await this._callRefreshToken(s.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t instanceof $x)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!qt()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(t){this._debug("#visibilityChangedCallback","error",t)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const r=`#_onVisibilityChanged(${t})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"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(t,r,s){const o=[`provider=${encodeURIComponent(r)}`];if(s!=null&&s.redirectTo&&o.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s!=null&&s.scopes&&o.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[l,u]=await Ei(this.storage,this.storageKey),d=new URLSearchParams({code_challenge:`${encodeURIComponent(l)}`,code_challenge_method:`${encodeURIComponent(u)}`});o.push(d.toString())}if(s!=null&&s.queryParams){const l=new URLSearchParams(s.queryParams);o.push(l.toString())}return s!=null&&s.skipBrowserRedirect&&o.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${t}?${o.join("&")}`}async _unenroll(t){try{return await this._useSession(async r=>{var s;const{data:o,error:l}=r;return l?this._returnResult({data:null,error:l}):await we(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(s=o==null?void 0:o.session)===null||s===void 0?void 0:s.access_token})})}catch(r){if(he(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(t){try{return await this._useSession(async r=>{var s,o;const{data:l,error:u}=r;if(u)return this._returnResult({data:null,error:u});const d=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:h,error:m}=await we(this.fetch,"POST",`${this.url}/factors`,{body:d,headers:this.headers,jwt:(s=l==null?void 0:l.session)===null||s===void 0?void 0:s.access_token});return m?this._returnResult({data:null,error:m}):(t.factorType==="totp"&&h.type==="totp"&&(!((o=h==null?void 0: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(r){if(he(r))return this._returnResult({data:null,error:r});throw r}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var s;const{data:o,error:l}=r;if(l)return this._returnResult({data:null,error:l});const u=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?q0(t.webauthn.credential_response):V0(t.webauthn.credential_response)})}:{code:t.code}),{data:d,error:h}=await we(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:u,headers:this.headers,jwt:(s=o==null?void 0:o.session)===null||s===void 0?void 0:s.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(r){if(he(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var s;const{data:o,error:l}=r;if(l)return this._returnResult({data:null,error:l});const u=await we(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(s=o==null?void 0:o.session)===null||s===void 0?void 0:s.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:B0(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:H0(d.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(he(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(t){const{data:r,error:s}=await this._challenge({factorId:t.factorId});return s?this._returnResult({data:null,error:s}):await this._verify({factorId:t.factorId,challengeId:r.id,code:t.code})}async _listFactors(){var t;const{data:{user:r},error:s}=await this.getUser();if(s)return{data:null,error:s};const o={all:[],phone:[],totp:[],webauthn:[]};for(const l of(t=r==null?void 0:r.factors)!==null&&t!==void 0?t:[])o.all.push(l),l.status==="verified"&&o[l.factor_type].push(l);return{data:o,error:null}}async _getAuthenticatorAssuranceLevel(t){var r,s,o,l;if(t)try{const{payload:_}=iu(t);let E=null;_.aal&&(E=_.aal);let S=E;const{data:{user:T},error:C}=await this.getUser(t);if(C)return this._returnResult({data:null,error:C});((s=(r=T==null?void 0:T.factors)===null||r===void 0?void 0:r.filter(z=>z.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(S="aal2");const N=_.amr||[];return{data:{currentLevel:E,nextLevel:S,currentAuthenticationMethods:N},error:null}}catch(_){if(he(_))return this._returnResult({data:null,error:_});throw _}const{data:{session:u},error:d}=await this.getSession();if(d)return this._returnResult({data:null,error:d});if(!u)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:h}=iu(u.access_token);let m=null;h.aal&&(m=h.aal);let b=m;((l=(o=u.user.factors)===null||o===void 0?void 0:o.filter(_=>_.status==="verified"))!==null&&l!==void 0?l:[]).length>0&&(b="aal2");const w=h.amr||[];return{data:{currentLevel:m,nextLevel:b,currentAuthenticationMethods:w},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async r=>{const{data:{session:s},error:o}=r;return o?this._returnResult({data:null,error:o}):s?await we(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:s.access_token,xform:l=>({data:l,error:null})}):this._returnResult({data:null,error:new Dt})})}catch(r){if(he(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(t,r){try{return await this._useSession(async s=>{const{data:{session:o},error:l}=s;if(l)return this._returnResult({data:null,error:l});if(!o)return this._returnResult({data:null,error:new Dt});const u=await we(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"approve"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&qt()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(u.data.redirect_url),u})}catch(s){if(he(s))return this._returnResult({data:null,error:s});throw s}}async _denyAuthorization(t,r){try{return await this._useSession(async s=>{const{data:{session:o},error:l}=s;if(l)return this._returnResult({data:null,error:l});if(!o)return this._returnResult({data:null,error:new Dt});const u=await we(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"deny"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&qt()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(u.data.redirect_url),u})}catch(s){if(he(s))return this._returnResult({data:null,error:s});throw s}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:r},error:s}=t;return s?this._returnResult({data:null,error:s}):r?await we(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:o=>({data:o,error:null})}):this._returnResult({data:null,error:new Dt})})}catch(t){if(he(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async r=>{const{data:{session:s},error:o}=r;return o?this._returnResult({data:null,error:o}):s?(await we(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Dt})})}catch(r){if(he(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(t,r={keys:[]}){let s=r.keys.find(d=>d.kid===t);if(s)return s;const o=Date.now();if(s=this.jwks.keys.find(d=>d.kid===t),s&&this.jwks_cached_at+Xk>o)return s;const{data:l,error:u}=await we(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,s=l.keys.find(d=>d.kid===t),!s)?null:s}async getClaims(t,r={}){try{let s=t;if(!s){const{data:_,error:E}=await this.getSession();if(E||!_.session)return this._returnResult({data:null,error:E});s=_.session.access_token}const{header:o,payload:l,signature:u,raw:{header:d,payload:h}}=iu(s);r!=null&&r.allowExpired||yj(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,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!m){const{error:_}=await this.getUser(s);if(_)throw _;return{data:{claims:l,header:o,signature:u},error:null}}const b=bj(o.alg),g=await crypto.subtle.importKey("jwk",m,b,!0,["verify"]);if(!await crypto.subtle.verify(b,g,u,sj(`${d}.${h}`)))throw new Dm("Invalid JWT signature");return{data:{claims:l,header:o,signature:u},error:null}}catch(s){if(he(s))return this._returnResult({data:null,error:s});throw s}}async signInWithPasskey(t){var r,s,o;Xn(this.experimental);try{if(!Uu())return this._returnResult({data:null,error:new Zn("Browser does not support WebAuthn",null)});const{data:l,error:u}=await this._startPasskeyAuthentication({options:{captchaToken:(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.captchaToken}});if(u||!l)return this._returnResult({data:null,error:u});const d=H0(l.options),h=(o=(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.signal)!==null&&o!==void 0?o:Lm.createNewAbortSignal(),{data:m,error:b}=await Vx({publicKey:d,signal:h});if(b||!m)return this._returnResult({data:null,error:b??new Zn("WebAuthn ceremony failed",null)});const g=V0(m);return this._verifyPasskeyAuthentication({challengeId:l.challenge_id,credential:g})}catch(l){if(he(l))return this._returnResult({data:null,error:l});throw l}}async registerPasskey(t){var r,s;Xn(this.experimental);try{if(!Uu())return this._returnResult({data:null,error:new Zn("Browser does not support WebAuthn",null)});const{data:o,error:l}=await this._startPasskeyRegistration();if(l||!o)return this._returnResult({data:null,error:l});const u=B0(o.options),d=(s=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.signal)!==null&&s!==void 0?s:Lm.createNewAbortSignal(),{data:h,error:m}=await qx({publicKey:u,signal:d});if(m||!h)return this._returnResult({data:null,error:m??new Zn("WebAuthn ceremony failed",null)});const b=q0(h);return this._verifyPasskeyRegistration({challengeId:o.challenge_id,credential:b})}catch(o){if(he(o))return this._returnResult({data:null,error:o});throw o}}async _startPasskeyRegistration(){Xn(this.experimental);try{return await this._useSession(async t=>{const{data:{session:r},error:s}=t;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new Dt});const{data:o,error:l}=await we(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:r.access_token,body:{}});return l?this._returnResult({data:null,error:l}):this._returnResult({data:o,error:null})})}catch(t){if(he(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){Xn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:s},error:o}=r;if(o)return this._returnResult({data:null,error:o});if(!s)return this._returnResult({data:null,error:new Dt});const{data:l,error:u}=await we(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:s.access_token,body:{challenge_id:t.challengeId,credential:t.credential}});return u?this._returnResult({data:null,error:u}):this._returnResult({data:l,error:null})})}catch(r){if(he(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(t){var r;Xn(this.experimental);try{const{data:s,error:o}=await we(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.captchaToken}}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:s,error:null})}catch(s){if(he(s))return this._returnResult({data:null,error:s});throw s}}async _verifyPasskeyAuthentication(t){Xn(this.experimental);try{const{data:r,error:s}=await we(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:t.challengeId,credential:t.credential},xform:Bn});return s?this._returnResult({data:null,error:s}):(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:r,error:null}))}catch(r){if(he(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){Xn(this.experimental);try{return await this._useSession(async t=>{const{data:{session:r},error:s}=t;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new Dt});const{data:o,error:l}=await we(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:r.access_token,xform:u=>({data:u,error:null})});return l?this._returnResult({data:null,error:l}):this._returnResult({data:o,error:null})})}catch(t){if(he(t))return this._returnResult({data:null,error:t});throw t}}async _updatePasskey(t){Xn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:s},error:o}=r;if(o)return this._returnResult({data:null,error:o});if(!s)return this._returnResult({data:null,error:new Dt});const{data:l,error:u}=await we(this.fetch,"PATCH",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:s.access_token,body:{friendly_name:t.friendlyName}});return u?this._returnResult({data:null,error:u}):this._returnResult({data:l,error:null})})}catch(r){if(he(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(t){Xn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:s},error:o}=r;if(o)return this._returnResult({data:null,error:o});if(!s)return this._returnResult({data:null,error:new Dt});const{error:l}=await we(this.fetch,"DELETE",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:s.access_token,noResolveJson:!0});return l?this._returnResult({data:null,error:l}):this._returnResult({data:null,error:null})})}catch(r){if(he(r))return this._returnResult({data:null,error:r});throw r}}}ml.nextInstanceID={};const qj=ml,Vj="2.106.2";let tl="";typeof Deno<"u"?tl="deno":typeof document<"u"?tl="web":typeof navigator<"u"&&navigator.product==="ReactNative"?tl="react-native":tl="node";const Gj={"X-Client-Info":`supabase-js-${tl}/${Vj}`},Fj={headers:Gj},Kj={schema:"public"},Yj={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Wj={},Xj={enabled:!1,respectSamplingDecision:!0};function Jj(e,t,r,s){function o(l){return l instanceof r?l:new r(function(u){u(l)})}return new(r||(r=Promise))(function(l,u){function d(b){try{m(s.next(b))}catch(g){u(g)}}function h(b){try{m(s.throw(b))}catch(g){u(g)}}function m(b){b.done?l(b.value):o(b.value).then(d,h)}m((s=s.apply(e,[])).next())})}let Zh=null;const Qj="@opentelemetry/api";function Zj(){return Zh===null&&(Zh=import(Qj).catch(()=>null)),Zh}function eO(){return Jj(this,void 0,void 0,function*(){try{const e=yield Zj();if(!e||!e.propagation||!e.context)return null;const t={};e.propagation.inject(e.context.active(),t);const r=t.traceparent;return r?{traceparent:r,tracestate:t.tracestate,baggage:t.baggage}:null}catch{return null}})}function tO(e){if(!e||typeof e!="string")return null;const t=e.split("-");if(t.length!==4)return null;const[r,s,o,l]=t;if(r.length!==2||s.length!==32||o.length!==16||l.length!==2)return null;const u=/^[0-9a-f]+$/i;return!u.test(r)||!u.test(s)||!u.test(o)||!u.test(l)||s==="00000000000000000000000000000000"||o==="0000000000000000"?null:{version:r,traceId:s,parentId:o,traceFlags:l,isSampled:(parseInt(l,16)&1)===1}}function nO(e,t){if(!e||!t||t.length===0)return!1;let r;if(e instanceof URL)r=e;else try{r=new URL(e)}catch{return!1}for(const s of t)try{if(typeof s=="string"){if(rO(r.hostname,s))return!0}else if(s instanceof RegExp){if(s.test(r.hostname))return!0}else if(typeof s=="function"&&s(r))return!0}catch{continue}return!1}function rO(e,t){if(t===e)return!0;if(t.startsWith("*.")){const r=t.slice(2);if(e.endsWith(r)&&(e===r||e.endsWith("."+r)))return!0}return!1}function aO(e){const t=[];try{const r=new URL(e);t.push(r.hostname)}catch{}return t.push("*.supabase.co","*.supabase.in"),t.push("localhost","127.0.0.1","[::1]"),t}function pl(e){"@babel/helpers - typeof";return pl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pl(e)}function sO(e,t){if(pl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(pl(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function iO(e){var t=sO(e,"string");return pl(t)=="symbol"?t:t+""}function oO(e,t,r){return(t=iO(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function F0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,s)}return r}function pt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?F0(Object(r),!0).forEach(function(s){oO(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):F0(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}const lO=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),cO=()=>Headers,uO=(e,t,r,s,o)=>{const l=lO(s),u=cO(),d=(o==null?void 0:o.enabled)===!0,h=(o==null?void 0:o.respectSamplingDecision)!==!1,m=d?aO(t):null;return async(b,g)=>{var w;const _=(w=await r())!==null&&w!==void 0?w:e;let E=new u(g==null?void 0:g.headers);if(E.has("apikey")||E.set("apikey",e),E.has("Authorization")||E.set("Authorization",`Bearer ${_}`),m){const S=await dO(b,m,h);S&&(S.traceparent&&!E.has("traceparent")&&E.set("traceparent",S.traceparent),S.tracestate&&!E.has("tracestate")&&E.set("tracestate",S.tracestate),S.baggage&&!E.has("baggage")&&E.set("baggage",S.baggage))}return l(b,pt(pt({},g),{},{headers:E}))}};async function dO(e,t,r){if(!nO(typeof e=="string"||e instanceof URL?e:e.url,t))return null;const s=await eO();if(!s||!s.traceparent)return null;if(r){const o=tO(s.traceparent);if(o&&!o.isSampled)return null}return s}function K0(e){return typeof e=="boolean"?{enabled:e}:e}function fO(e){return e.endsWith("/")?e:e+"/"}function hO(e,t){var r,s,o,l,u,d;const{db:h,auth:m,realtime:b,global:g}=e,{db:w,auth:_,realtime:E,global:S}=t,T=K0(e.tracePropagation),C=K0(t.tracePropagation),A={db:pt(pt({},w),h),auth:pt(pt({},_),m),realtime:pt(pt({},E),b),storage:{},global:pt(pt(pt({},S),g),{},{headers:pt(pt({},(r=S==null?void 0:S.headers)!==null&&r!==void 0?r:{}),(s=g==null?void 0:g.headers)!==null&&s!==void 0?s:{})}),tracePropagation:{enabled:(o=(l=T==null?void 0:T.enabled)!==null&&l!==void 0?l:C==null?void 0:C.enabled)!==null&&o!==void 0?o:!1,respectSamplingDecision:(u=(d=T==null?void 0:T.respectSamplingDecision)!==null&&d!==void 0?d:C==null?void 0:C.respectSamplingDecision)!==null&&u!==void 0?u:!0},accessToken:async()=>""};return e.accessToken?A.accessToken=e.accessToken:delete A.accessToken,A}function mO(e){const t=e==null?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(fO(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var pO=class extends qj{constructor(e){super(e)}},gO=class{constructor(e,t,r){var s,o;this.supabaseUrl=e,this.supabaseKey=t;const l=mO(e);if(!t)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:Kj,realtime:Wj,auth:pt(pt({},Yj),{},{storageKey:u}),global:Fj,tracePropagation:Xj},h=hO(r??{},d);if(this.settings=h,this.storageKey=(s=h.auth.storageKey)!==null&&s!==void 0?s:"",this.headers=(o=h.global.headers)!==null&&o!==void 0?o:{},h.accessToken)this.accessToken=h.accessToken,this.auth=new Proxy({},{get:(b,g)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(g)} 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=uO(t,e,this._getAccessToken.bind(this),h.global.fetch,h.tracePropagation),this.realtime=this._initRealtimeClient(pt({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},h.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(b=>this.realtime.setAuth(b)).catch(b=>console.warn("Failed to set initial Realtime auth token:",b)),this.rest=new ON(new URL("rest/v1",l).href,{headers:this.headers,schema:h.db.schema,fetch:this.fetch,timeout:h.db.timeout,urlLengthLimit:h.db.urlLengthLimit}),this.storage=new Gk(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),h.accessToken||this._listenForAuthEvents()}get functions(){return new _N(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,r)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,r;if(e.accessToken)return await e.accessToken();const{data:s}=await e.auth.getSession();return(t=(r=s.session)===null||r===void 0?void 0:r.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:s,userStorage:o,storageKey:l,flowType:u,lock:d,debug:h,throwOnError:m,experimental:b,lockAcquireTimeout:g,skipAutoInitialize:w},_,E){const S={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new pO({url:this.authUrl.href,headers:pt(pt({},S),_),storageKey:l,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:s,userStorage:o,flowType:u,lock:d,debug:h,throwOnError:m,experimental:b,fetch:E,lockAcquireTimeout:g,skipAutoInitialize:w,hasCustomAuthorizationHeader:Object.keys(this.headers).some(T=>T.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new mk(this.realtimeUrl.href,pt(pt({},e),{},{params:pt(pt({},{apikey:this.supabaseKey}),e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t==null?void 0:t.access_token)})}_handleTokenChanged(e,t,r){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const vO=(e,t,r)=>new gO(e,t,r);function yO(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const r=t.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}yO()&&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 bO={BASE_URL:"/tablero-cdc/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},wO=["VITE_SUPABASE_URL","VITE_SUPABASE_ANON_KEY"],Y0=wO.filter(e=>!bO[e]);if(Y0.length>0)throw new Error(`Faltan variables de entorno de Supabase. Revisa tu archivo .env.
|
||
Variables faltantes: ${Y0.join(", ")}`);const nt=vO(void 0,void 0,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),Gx="gomezleemarketing.com",mp="gmarrero@gomezleemarketing.com",xO=[mp,"areyes@gomezleemarketing.com","iaracena@gomezleemarketing.com"],_O=[mp,"areyes@gomezleemarketing.com","iaracena@gomezleemarketing.com"];function SO(e){return e?e.toLowerCase().endsWith(`@${Gx}`):!1}function EO(){return typeof window>"u"?"/tablero-cdc/":new URL("/tablero-cdc/",window.location.origin).toString()}function CO(e){var o;const t=e.user_metadata||{},r=t.full_name||t.name||t.display_name||((o=e.email)==null?void 0:o.split("@")[0])||null,s=t.avatar_url||t.picture||null;return{id:e.id,uid:e.id,email:e.email??null,displayName:r,photoURL:s,raw:e}}const Fx=y.createContext(null);function RO({children:e}){var E;const[t,r]=y.useState(null),[s,o]=y.useState(!0),[l,u]=y.useState(null),d=y.useCallback(async S=>{if(!S){r(null);return}if(!SO(S.email)){await nt.auth.signOut(),r(null),u("Solo se permite acceso con correos corporativos de GomezLee Marketing.");return}r(CO(S)),u(null)},[]);y.useEffect(()=>{let S=!0;nt.auth.getSession().then(async({data:C,error:A})=>{var N;if(S){if(A){console.error("Error al recuperar sesión de Supabase:",A),r(null),u("No se pudo recuperar la sesión. Intenta iniciar sesión de nuevo.");return}await d(((N=C.session)==null?void 0:N.user)??null)}}).catch(C=>{S&&(console.error("Error inesperado al recuperar sesión:",C),r(null),u("No se pudo recuperar la sesión. Intenta iniciar sesión de nuevo."))}).finally(()=>{S&&o(!1)});const{data:T}=nt.auth.onAuthStateChange((C,A)=>{d((A==null?void 0:A.user)??null),o(!1)});return()=>{S=!1,T.subscription.unsubscribe()}},[d]);const h=y.useCallback(async()=>{u(null);const{error:S}=await nt.auth.signInWithOAuth({provider:"google",options:{redirectTo:EO(),queryParams:{prompt:"select_account",hd:Gx}}});S&&(console.error("Error al iniciar sesión con Google:",S),u("No se pudo iniciar sesión. Intenta de nuevo."))},[]),m=y.useCallback(async()=>{const{error:S}=await nt.auth.signOut();if(S){console.error("Error al cerrar sesión:",S),u("No se pudo cerrar sesión. Intenta de nuevo.");return}r(null),u(null)},[]),b=((E=t==null?void 0:t.email)==null?void 0:E.toLowerCase())||"",g=y.useMemo(()=>b===mp,[b]),w=y.useMemo(()=>xO.includes(b),[b]),_=y.useMemo(()=>_O.includes(b),[b]);return v.jsx(Fx.Provider,{value:{user:t,loading:s,error:l,isGerardo:g,canDeleteProjects:_,canManageInternalPricing:w,loginWithGoogle:h,logout:m},children:e})}function Nl(){const e=y.useContext(Fx);if(!e)throw new Error("useAuth debe usarse dentro de <AuthProvider>");return e}/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Kx=(...e)=>e.filter((t,r,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===r).join(" ").trim();/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const TO=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const AO=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,s)=>s?s.toUpperCase():r.toLowerCase());/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const W0=e=>{const t=AO(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/var NO={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const kO=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const jO=y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:o="",children:l,iconNode:u,...d},h)=>y.createElement("svg",{ref:h,...NO,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:Kx("lucide",o),...!l&&!kO(d)&&{"aria-hidden":"true"},...d},[...u.map(([m,b])=>y.createElement(m,b)),...Array.isArray(l)?l:[l]]));/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const qe=(e,t)=>{const r=y.forwardRef(({className:s,...o},l)=>y.createElement(jO,{ref:l,iconNode:t,className:Kx(`lucide-${TO(W0(e))}`,`lucide-${e}`,s),...o}));return r.displayName=W0(e),r};/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const OO=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]],MO=qe("calculator",OO);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const DO=[["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"}]],LO=qe("calendar",DO);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const PO=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Rs=qe("check",PO);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const zO=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],pp=qe("chevron-down",zO);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const UO=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],IO=qe("chevron-left",UO);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const $O=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Yx=qe("chevron-right",$O);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const BO=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],HO=qe("chevron-up",BO);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const qO=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],Wx=qe("chevrons-up-down",qO);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const VO=[["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"}]],$u=qe("circle-alert",VO);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const GO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],FO=qe("circle-check",GO);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const KO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],YO=qe("circle",KO);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const WO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],XO=qe("clock-3",WO);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const JO=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],Xx=qe("dollar-sign",JO);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const QO=[["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"}]],ZO=qe("external-link",QO);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const e2=[["path",{d:"M10.5 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v6",key:"g5mvt7"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m14 20 2 2 4-4",key:"15kota"}]],t2=qe("file-check-corner",e2);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const n2=[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],r2=qe("history",n2);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const a2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],s2=qe("info",a2);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const i2=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],gp=qe("layout-grid",i2);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const o2=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],l2=qe("link-2",o2);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const c2=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],u2=qe("link",c2);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const d2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ba=qe("loader-circle",d2);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const f2=[["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"}]],h2=qe("lock",f2);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const m2=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],p2=qe("log-out",m2);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const g2=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],v2=qe("map-pin",g2);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const y2=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],b2=qe("message-square-plus",y2);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const w2=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],gl=qe("plus",w2);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const x2=[["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"}]],_2=qe("refresh-cw",x2);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const S2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Bu=qe("search",S2);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const E2=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],C2=qe("sliders-horizontal",E2);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const R2=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],X0=qe("tag",R2);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const T2=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Jx=qe("trash-2",T2);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const A2=[["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"}]],N2=qe("user",A2);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const k2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],vl=qe("x",k2);function J0(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Jt(...e){return t=>{let r=!1;const s=e.map(o=>{const l=J0(o,t);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let o=0;o<s.length;o++){const l=s[o];typeof l=="function"?l():J0(e[o],null)}}}}function Ye(...e){return y.useCallback(Jt(...e),e)}var j2=Symbol.for("react.lazy"),Hu=rp[" use ".trim().toString()];function O2(e){return typeof e=="object"&&e!==null&&"then"in e}function Qx(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===j2&&"_payload"in e&&O2(e._payload)}function ld(e){const t=D2(e),r=y.forwardRef((s,o)=>{let{children:l,...u}=s;Qx(l)&&typeof Hu=="function"&&(l=Hu(l._payload));const d=y.Children.toArray(l),h=d.find(P2);if(h){const m=h.props.children,b=d.map(g=>g===h?y.Children.count(m)>1?y.Children.only(null):y.isValidElement(m)?m.props.children:null:g);return v.jsx(t,{...u,ref:o,children:y.isValidElement(m)?y.cloneElement(m,void 0,b):null})}return v.jsx(t,{...u,ref:o,children:l})});return r.displayName=`${e}.Slot`,r}var M2=ld("Slot");function D2(e){const t=y.forwardRef((r,s)=>{let{children:o,...l}=r;if(Qx(o)&&typeof Hu=="function"&&(o=Hu(o._payload)),y.isValidElement(o)){const u=U2(o),d=z2(l,o.props);return o.type!==y.Fragment&&(d.ref=s?Jt(s,u):u),y.cloneElement(o,d)}return y.Children.count(o)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var L2=Symbol("radix.slottable");function P2(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===L2}function z2(e,t){const r={...t};for(const s in t){const o=e[s],l=t[s];/^on[A-Z]/.test(s)?o&&l?r[s]=(...d)=>{const h=l(...d);return o(...d),h}:o&&(r[s]=o):s==="style"?r[s]={...o,...l}:s==="className"&&(r[s]=[o,l].filter(Boolean).join(" "))}return{...e,...r}}function U2(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Zx(e){var t,r,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=Zx(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function e_(){for(var e,t,r=0,s="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=Zx(e))&&(s&&(s+=" "),s+=t);return s}const Q0=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Z0=e_,vp=(e,t)=>r=>{var s;if((t==null?void 0:t.variants)==null)return Z0(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:o,defaultVariants:l}=t,u=Object.keys(o).map(m=>{const b=r==null?void 0:r[m],g=l==null?void 0:l[m];if(b===null)return null;const w=Q0(b)||Q0(g);return o[m][w]}),d=r&&Object.entries(r).reduce((m,b)=>{let[g,w]=b;return w===void 0||(m[g]=w),m},{}),h=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((m,b)=>{let{class:g,className:w,..._}=b;return Object.entries(_).every(E=>{let[S,T]=E;return Array.isArray(T)?T.includes({...l,...d}[S]):{...l,...d}[S]===T})?[...m,g,w]:m},[]);return Z0(e,u,h,r==null?void 0:r.class,r==null?void 0:r.className)},I2=(e,t)=>{const r=new Array(e.length+t.length);for(let s=0;s<e.length;s++)r[s]=e[s];for(let s=0;s<t.length;s++)r[e.length+s]=t[s];return r},$2=(e,t)=>({classGroupId:e,validator:t}),t_=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),qu="-",ew=[],B2="arbitrary..",H2=e=>{const t=V2(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return q2(u);const d=u.split(qu),h=d[0]===""&&d.length>1?1:0;return n_(d,h,t)},getConflictingClassGroupIds:(u,d)=>{if(d){const h=s[u],m=r[u];return h?m?I2(m,h):h:m||ew}return r[u]||ew}}},n_=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const o=e[t],l=r.nextPart.get(o);if(l){const m=n_(e,t+1,l);if(m)return m}const u=r.validators;if(u===null)return;const d=t===0?e.join(qu):e.slice(t).join(qu),h=u.length;for(let m=0;m<h;m++){const b=u[m];if(b.validator(d))return b.classGroupId}},q2=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),s=t.slice(0,r);return s?B2+s:void 0})(),V2=e=>{const{theme:t,classGroups:r}=e;return G2(r,t)},G2=(e,t)=>{const r=t_();for(const s in e){const o=e[s];yp(o,r,s,t)}return r},yp=(e,t,r,s)=>{const o=e.length;for(let l=0;l<o;l++){const u=e[l];F2(u,t,r,s)}},F2=(e,t,r,s)=>{if(typeof e=="string"){K2(e,t,r);return}if(typeof e=="function"){Y2(e,t,r,s);return}W2(e,t,r,s)},K2=(e,t,r)=>{const s=e===""?t:r_(t,e);s.classGroupId=r},Y2=(e,t,r,s)=>{if(X2(e)){yp(e(s),t,r,s);return}t.validators===null&&(t.validators=[]),t.validators.push($2(r,e))},W2=(e,t,r,s)=>{const o=Object.entries(e),l=o.length;for(let u=0;u<l;u++){const[d,h]=o[u];yp(h,r_(t,d),r,s)}},r_=(e,t)=>{let r=e;const s=t.split(qu),o=s.length;for(let l=0;l<o;l++){const u=s[l];let d=r.nextPart.get(u);d||(d=t_(),r.nextPart.set(u,d)),r=d}return r},X2=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,J2=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),s=Object.create(null);const o=(l,u)=>{r[l]=u,t++,t>e&&(t=0,s=r,r=Object.create(null))};return{get(l){let u=r[l];if(u!==void 0)return u;if((u=s[l])!==void 0)return o(l,u),u},set(l,u){l in r?r[l]=u:o(l,u)}}},Pm="!",tw=":",Q2=[],nw=(e,t,r,s,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:s,isExternal:o}),Z2=e=>{const{prefix:t,experimentalParseClassName:r}=e;let s=o=>{const l=[];let u=0,d=0,h=0,m;const b=o.length;for(let S=0;S<b;S++){const T=o[S];if(u===0&&d===0){if(T===tw){l.push(o.slice(h,S)),h=S+1;continue}if(T==="/"){m=S;continue}}T==="["?u++:T==="]"?u--:T==="("?d++:T===")"&&d--}const g=l.length===0?o:o.slice(h);let w=g,_=!1;g.endsWith(Pm)?(w=g.slice(0,-1),_=!0):g.startsWith(Pm)&&(w=g.slice(1),_=!0);const E=m&&m>h?m-h:void 0;return nw(l,_,w,E)};if(t){const o=t+tw,l=s;s=u=>u.startsWith(o)?l(u.slice(o.length)):nw(Q2,!1,u,void 0,!0)}if(r){const o=s;s=l=>r({className:l,parseClassName:o})}return s},eM=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,s)=>{t.set(r,1e6+s)}),r=>{const s=[];let o=[];for(let l=0;l<r.length;l++){const u=r[l],d=u[0]==="[",h=t.has(u);d||h?(o.length>0&&(o.sort(),s.push(...o),o=[]),s.push(u)):o.push(u)}return o.length>0&&(o.sort(),s.push(...o)),s}},tM=e=>({cache:J2(e.cacheSize),parseClassName:Z2(e),sortModifiers:eM(e),postfixLookupClassGroupIds:nM(e),...H2(e)}),nM=e=>{const t=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let s=0;s<r.length;s++)t[r[s]]=!0;return t},rM=/\s+/,aM=(e,t)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:o,sortModifiers:l,postfixLookupClassGroupIds:u}=t,d=[],h=e.trim().split(rM);let m="";for(let b=h.length-1;b>=0;b-=1){const g=h[b],{isExternal:w,modifiers:_,hasImportantModifier:E,baseClassName:S,maybePostfixModifierPosition:T}=r(g);if(w){m=g+(m.length>0?" "+m:m);continue}let C=!!T,A;if(C){const P=S.substring(0,T);A=s(P);const V=A&&u[A]?s(S):void 0;V&&V!==A&&(A=V,C=!1)}else A=s(S);if(!A){if(!C){m=g+(m.length>0?" "+m:m);continue}if(A=s(S),!A){m=g+(m.length>0?" "+m:m);continue}C=!1}const N=_.length===0?"":_.length===1?_[0]:l(_).join(":"),z=E?N+Pm:N,F=z+A;if(d.indexOf(F)>-1)continue;d.push(F);const B=o(A,C);for(let P=0;P<B.length;++P){const V=B[P];d.push(z+V)}m=g+(m.length>0?" "+m:m)}return m},sM=(...e)=>{let t=0,r,s,o="";for(;t<e.length;)(r=e[t++])&&(s=a_(r))&&(o&&(o+=" "),o+=s);return o},a_=e=>{if(typeof e=="string")return e;let t,r="";for(let s=0;s<e.length;s++)e[s]&&(t=a_(e[s]))&&(r&&(r+=" "),r+=t);return r},iM=(e,...t)=>{let r,s,o,l;const u=h=>{const m=t.reduce((b,g)=>g(b),e());return r=tM(m),s=r.cache.get,o=r.cache.set,l=d,d(h)},d=h=>{const m=s(h);if(m)return m;const b=aM(h,r);return o(h,b),b};return l=u,(...h)=>l(sM(...h))},oM=[],At=e=>{const t=r=>r[e]||oM;return t.isThemeGetter=!0,t},s_=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,i_=/^\((?:(\w[\w-]*):)?(.+)\)$/i,lM=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,cM=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,uM=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,dM=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,fM=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hM=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,La=e=>lM.test(e),Le=e=>!!e&&!Number.isNaN(Number(e)),gr=e=>!!e&&Number.isInteger(Number(e)),em=e=>e.endsWith("%")&&Le(e.slice(0,-1)),Wr=e=>cM.test(e),o_=()=>!0,mM=e=>uM.test(e)&&!dM.test(e),bp=()=>!1,pM=e=>fM.test(e),gM=e=>hM.test(e),vM=e=>!ve(e)&&!ye(e),yM=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),bM=e=>Ka(e,u_,bp),ve=e=>s_.test(e),ys=e=>Ka(e,d_,mM),rw=e=>Ka(e,TM,Le),wM=e=>Ka(e,h_,o_),xM=e=>Ka(e,f_,bp),aw=e=>Ka(e,l_,bp),_M=e=>Ka(e,c_,gM),ou=e=>Ka(e,m_,pM),ye=e=>i_.test(e),Xo=e=>Ms(e,d_),SM=e=>Ms(e,f_),sw=e=>Ms(e,l_),EM=e=>Ms(e,u_),CM=e=>Ms(e,c_),lu=e=>Ms(e,m_,!0),RM=e=>Ms(e,h_,!0),Ka=(e,t,r)=>{const s=s_.exec(e);return s?s[1]?t(s[1]):r(s[2]):!1},Ms=(e,t,r=!1)=>{const s=i_.exec(e);return s?s[1]?t(s[1]):r:!1},l_=e=>e==="position"||e==="percentage",c_=e=>e==="image"||e==="url",u_=e=>e==="length"||e==="size"||e==="bg-size",d_=e=>e==="length",TM=e=>e==="number",f_=e=>e==="family-name",h_=e=>e==="number"||e==="weight",m_=e=>e==="shadow",AM=()=>{const e=At("color"),t=At("font"),r=At("text"),s=At("font-weight"),o=At("tracking"),l=At("leading"),u=At("breakpoint"),d=At("container"),h=At("spacing"),m=At("radius"),b=At("shadow"),g=At("inset-shadow"),w=At("text-shadow"),_=At("drop-shadow"),E=At("blur"),S=At("perspective"),T=At("aspect"),C=At("ease"),A=At("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],z=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],F=()=>[...z(),ye,ve],B=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],V=()=>[ye,ve,h],re=()=>[La,"full","auto",...V()],le=()=>[gr,"none","subgrid",ye,ve],ce=()=>["auto",{span:["full",gr,ye,ve]},gr,ye,ve],de=()=>[gr,"auto",ye,ve],ge=()=>["auto","min","max","fr",ye,ve],me=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],fe=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...V()],K=()=>[La,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...V()],Q=()=>[La,"screen","full","dvw","lvw","svw","min","max","fit",...V()],te=()=>[La,"screen","full","lh","dvh","lvh","svh","min","max","fit",...V()],W=()=>[e,ye,ve],k=()=>[...z(),sw,aw,{position:[ye,ve]}],j=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",EM,bM,{size:[ye,ve]}],D=()=>[em,Xo,ys],U=()=>["","none","full",m,ye,ve],X=()=>["",Le,Xo,ys],J=()=>["solid","dashed","dotted","double"],se=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ie=()=>[Le,em,sw,aw],ue=()=>["","none",E,ye,ve],Ee=()=>["none",Le,ye,ve],Se=()=>["none",Le,ye,ve],et=()=>[Le,ye,ve],He=()=>[La,"full",...V()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Wr],breakpoint:[Wr],color:[o_],container:[Wr],"drop-shadow":[Wr],ease:["in","out","in-out"],font:[vM],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Wr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Wr],shadow:[Wr],spacing:["px",Le],text:[Wr],"text-shadow":[Wr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",La,ve,ye,T]}],container:["container"],"container-type":[{"@container":["","normal","size",ye,ve]}],"container-named":[yM],columns:[{columns:[Le,ve,ye,d]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:F()}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:re()}],"inset-x":[{"inset-x":re()}],"inset-y":[{"inset-y":re()}],start:[{"inset-s":re(),start:re()}],end:[{"inset-e":re(),end:re()}],"inset-bs":[{"inset-bs":re()}],"inset-be":[{"inset-be":re()}],top:[{top:re()}],right:[{right:re()}],bottom:[{bottom:re()}],left:[{left:re()}],visibility:["visible","invisible","collapse"],z:[{z:[gr,"auto",ye,ve]}],basis:[{basis:[La,"full","auto",d,...V()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Le,La,"auto","initial","none",ve]}],grow:[{grow:["",Le,ye,ve]}],shrink:[{shrink:["",Le,ye,ve]}],order:[{order:[gr,"first","last","none",ye,ve]}],"grid-cols":[{"grid-cols":le()}],"col-start-end":[{col:ce()}],"col-start":[{"col-start":de()}],"col-end":[{"col-end":de()}],"grid-rows":[{"grid-rows":le()}],"row-start-end":[{row:ce()}],"row-start":[{"row-start":de()}],"row-end":[{"row-end":de()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ge()}],"auto-rows":[{"auto-rows":ge()}],gap:[{gap:V()}],"gap-x":[{"gap-x":V()}],"gap-y":[{"gap-y":V()}],"justify-content":[{justify:[...me(),"normal"]}],"justify-items":[{"justify-items":[...fe(),"normal"]}],"justify-self":[{"justify-self":["auto",...fe()]}],"align-content":[{content:["normal",...me()]}],"align-items":[{items:[...fe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...fe(),{baseline:["","last"]}]}],"place-content":[{"place-content":me()}],"place-items":[{"place-items":[...fe(),"baseline"]}],"place-self":[{"place-self":["auto",...fe()]}],p:[{p:V()}],px:[{px:V()}],py:[{py:V()}],ps:[{ps:V()}],pe:[{pe:V()}],pbs:[{pbs:V()}],pbe:[{pbe:V()}],pt:[{pt:V()}],pr:[{pr:V()}],pb:[{pb:V()}],pl:[{pl:V()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":V()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":V()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],"inline-size":[{inline:["auto",...Q()]}],"min-inline-size":[{"min-inline":["auto",...Q()]}],"max-inline-size":[{"max-inline":["none",...Q()]}],"block-size":[{block:["auto",...te()]}],"min-block-size":[{"min-block":["auto",...te()]}],"max-block-size":[{"max-block":["none",...te()]}],w:[{w:[d,"screen",...K()]}],"min-w":[{"min-w":[d,"screen","none",...K()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",r,Xo,ys]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,RM,wM]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",em,ve]}],"font-family":[{font:[SM,xM,t]}],"font-features":[{"font-features":[ve]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ye,ve]}],"line-clamp":[{"line-clamp":[Le,"none",ye,rw]}],leading:[{leading:[l,...V()]}],"list-image":[{"list-image":["none",ye,ve]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ye,ve]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...J(),"wavy"]}],"text-decoration-thickness":[{decoration:[Le,"from-font","auto",ye,ys]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[Le,"auto",ye,ve]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:V()}],"tab-size":[{tab:[gr,ye,ve]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ye,ve]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ye,ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:k()}],"bg-repeat":[{bg:j()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gr,ye,ve],radial:["",ye,ve],conic:[gr,ye,ve]},CM,_M]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:D()}],"gradient-via-pos":[{via:D()}],"gradient-to-pos":[{to:D()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:X()}],"border-w-x":[{"border-x":X()}],"border-w-y":[{"border-y":X()}],"border-w-s":[{"border-s":X()}],"border-w-e":[{"border-e":X()}],"border-w-bs":[{"border-bs":X()}],"border-w-be":[{"border-be":X()}],"border-w-t":[{"border-t":X()}],"border-w-r":[{"border-r":X()}],"border-w-b":[{"border-b":X()}],"border-w-l":[{"border-l":X()}],"divide-x":[{"divide-x":X()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":X()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...J(),"hidden","none"]}],"divide-style":[{divide:[...J(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-bs":[{"border-bs":W()}],"border-color-be":[{"border-be":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...J(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Le,ye,ve]}],"outline-w":[{outline:["",Le,Xo,ys]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",b,lu,ou]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",g,lu,ou]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[Le,ys]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":X()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",w,lu,ou]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[Le,ye,ve]}],"mix-blend":[{"mix-blend":[...se(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":se()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Le]}],"mask-image-linear-from-pos":[{"mask-linear-from":ie()}],"mask-image-linear-to-pos":[{"mask-linear-to":ie()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":ie()}],"mask-image-t-to-pos":[{"mask-t-to":ie()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":ie()}],"mask-image-r-to-pos":[{"mask-r-to":ie()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":ie()}],"mask-image-b-to-pos":[{"mask-b-to":ie()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":ie()}],"mask-image-l-to-pos":[{"mask-l-to":ie()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":ie()}],"mask-image-x-to-pos":[{"mask-x-to":ie()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":ie()}],"mask-image-y-to-pos":[{"mask-y-to":ie()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[ye,ve]}],"mask-image-radial-from-pos":[{"mask-radial-from":ie()}],"mask-image-radial-to-pos":[{"mask-radial-to":ie()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":z()}],"mask-image-conic-pos":[{"mask-conic":[Le]}],"mask-image-conic-from-pos":[{"mask-conic-from":ie()}],"mask-image-conic-to-pos":[{"mask-conic-to":ie()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:k()}],"mask-repeat":[{mask:j()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ye,ve]}],filter:[{filter:["","none",ye,ve]}],blur:[{blur:ue()}],brightness:[{brightness:[Le,ye,ve]}],contrast:[{contrast:[Le,ye,ve]}],"drop-shadow":[{"drop-shadow":["","none",_,lu,ou]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",Le,ye,ve]}],"hue-rotate":[{"hue-rotate":[Le,ye,ve]}],invert:[{invert:["",Le,ye,ve]}],saturate:[{saturate:[Le,ye,ve]}],sepia:[{sepia:["",Le,ye,ve]}],"backdrop-filter":[{"backdrop-filter":["","none",ye,ve]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[Le,ye,ve]}],"backdrop-contrast":[{"backdrop-contrast":[Le,ye,ve]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Le,ye,ve]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Le,ye,ve]}],"backdrop-invert":[{"backdrop-invert":["",Le,ye,ve]}],"backdrop-opacity":[{"backdrop-opacity":[Le,ye,ve]}],"backdrop-saturate":[{"backdrop-saturate":[Le,ye,ve]}],"backdrop-sepia":[{"backdrop-sepia":["",Le,ye,ve]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":V()}],"border-spacing-x":[{"border-spacing-x":V()}],"border-spacing-y":[{"border-spacing-y":V()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ye,ve]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Le,"initial",ye,ve]}],ease:[{ease:["linear","initial",C,ye,ve]}],delay:[{delay:[Le,ye,ve]}],animate:[{animate:["none",A,ye,ve]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,ye,ve]}],"perspective-origin":[{"perspective-origin":F()}],rotate:[{rotate:Ee()}],"rotate-x":[{"rotate-x":Ee()}],"rotate-y":[{"rotate-y":Ee()}],"rotate-z":[{"rotate-z":Ee()}],scale:[{scale:Se()}],"scale-x":[{"scale-x":Se()}],"scale-y":[{"scale-y":Se()}],"scale-z":[{"scale-z":Se()}],"scale-3d":["scale-3d"],skew:[{skew:et()}],"skew-x":[{"skew-x":et()}],"skew-y":[{"skew-y":et()}],transform:[{transform:[ye,ve,"","none","gpu","cpu"]}],"transform-origin":[{origin:F()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:He()}],"translate-x":[{"translate-x":He()}],"translate-y":[{"translate-y":He()}],"translate-z":[{"translate-z":He()}],"translate-none":["translate-none"],zoom:[{zoom:[gr,ye,ve]}],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ye,ve]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":W()}],"scrollbar-track-color":[{"scrollbar-track":W()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mbs":[{"scroll-mbs":V()}],"scroll-mbe":[{"scroll-mbe":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pbs":[{"scroll-pbs":V()}],"scroll-pbe":[{"scroll-pbe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ye,ve]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[Le,Xo,ys,rw]}],stroke:[{stroke:["none",...W()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},NM=iM(AM);function Te(...e){return NM(e_(e))}const kM=vp("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ct=y.forwardRef(({className:e,variant:t,size:r,asChild:s=!1,...o},l)=>{const u=s?M2:"button";return v.jsx(u,{className:Te(kM({variant:t,size:r,className:e})),ref:l,...o})});ct.displayName="Button";function jM(){const{loginWithGoogle:e,error:t,loading:r}=Nl();return v.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:v.jsxs("div",{className:"w-full max-w-sm",children:[v.jsxs("div",{className:"flex flex-col items-center mb-8 gap-3",children:[v.jsx("div",{className:"w-14 h-14 rounded-2xl bg-primary flex items-center justify-center shadow-lg",children:v.jsx(gp,{className:"w-7 h-7 text-primary-foreground"})}),v.jsx("div",{className:"text-center leading-tight",children:v.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Tablero CDC"})})]}),v.jsxs("div",{className:"bg-card border border-border rounded-2xl p-8 shadow-sm",children:[v.jsxs(ct,{onClick:e,disabled:r,className:"w-full gap-2.5 h-10 rounded-full font-medium",children:[v.jsxs("svg",{"aria-hidden":"true",className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[v.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),v.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),v.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),v.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),"Entrar con Google"]}),t&&v.jsx("div",{className:"mt-4 rounded-lg bg-destructive/10 border border-destructive/20 px-4 py-3",children:v.jsx("p",{className:"text-sm text-destructive text-center leading-snug",children:t})})]}),v.jsxs("p",{className:"text-center text-xs text-muted-foreground mt-6",children:["Solo acceso para usuarios ",v.jsx("span",{className:"font-medium",children:"@gomezleemarketing.com"})]})]})})}const An=y.forwardRef(({className:e,type:t,...r},s)=>v.jsx("input",{type:t,className:Te("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...r}));An.displayName="Input";function xe(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e==null||e(o),r===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function OM(e,t){const r=y.createContext(t),s=l=>{const{children:u,...d}=l,h=y.useMemo(()=>d,Object.values(d));return v.jsx(r.Provider,{value:h,children:u})};s.displayName=e+"Provider";function o(l){const u=y.useContext(r);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[s,o]}function oa(e,t=[]){let r=[];function s(l,u){const d=y.createContext(u),h=r.length;r=[...r,u];const m=g=>{var C;const{scope:w,children:_,...E}=g,S=((C=w==null?void 0:w[e])==null?void 0:C[h])||d,T=y.useMemo(()=>E,Object.values(E));return v.jsx(S.Provider,{value:T,children:_})};m.displayName=l+"Provider";function b(g,w){var S;const _=((S=w==null?void 0:w[e])==null?void 0:S[h])||d,E=y.useContext(_);if(E)return E;if(u!==void 0)return u;throw new Error(`\`${g}\` must be used within \`${l}\``)}return[m,b]}const o=()=>{const l=r.map(u=>y.createContext(u));return function(d){const h=(d==null?void 0:d[e])||l;return y.useMemo(()=>({[`__scope${e}`]:{...d,[e]:h}}),[d,h])}};return o.scopeName=e,[s,MM(o,...t)]}function MM(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(l){const u=s.reduce((d,{useScope:h,scopeName:m})=>{const g=h(l)[`__scope${m}`];return{...d,...g}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}var Nt=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{},DM=rp[" useInsertionEffect ".trim().toString()]||Nt;function Ts({prop:e,defaultProp:t,onChange:r=()=>{},caller:s}){const[o,l,u]=LM({defaultProp:t,onChange:r}),d=e!==void 0,h=d?e:o;{const b=y.useRef(e!==void 0);y.useEffect(()=>{const g=b.current;g!==d&&console.warn(`${s} is changing from ${g?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),b.current=d},[d,s])}const m=y.useCallback(b=>{var g;if(d){const w=PM(b)?b(e):b;w!==e&&((g=u.current)==null||g.call(u,w))}else l(b)},[d,e,l,u]);return[h,m]}function LM({defaultProp:e,onChange:t}){const[r,s]=y.useState(e),o=y.useRef(r),l=y.useRef(t);return DM(()=>{l.current=t},[t]),y.useEffect(()=>{var u;o.current!==r&&((u=l.current)==null||u.call(l,r),o.current=r)},[r,o]),[r,s,l]}function PM(e){return typeof e=="function"}function zM(e){const t=UM(e),r=y.forwardRef((s,o)=>{const{children:l,...u}=s,d=y.Children.toArray(l),h=d.find($M);if(h){const m=h.props.children,b=d.map(g=>g===h?y.Children.count(m)>1?y.Children.only(null):y.isValidElement(m)?m.props.children:null:g);return v.jsx(t,{...u,ref:o,children:y.isValidElement(m)?y.cloneElement(m,void 0,b):null})}return v.jsx(t,{...u,ref:o,children:l})});return r.displayName=`${e}.Slot`,r}function UM(e){const t=y.forwardRef((r,s)=>{const{children:o,...l}=r;if(y.isValidElement(o)){const u=HM(o),d=BM(l,o.props);return o.type!==y.Fragment&&(d.ref=s?Jt(s,u):u),y.cloneElement(o,d)}return y.Children.count(o)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var IM=Symbol("radix.slottable");function $M(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===IM}function BM(e,t){const r={...t};for(const s in t){const o=e[s],l=t[s];/^on[A-Z]/.test(s)?o&&l?r[s]=(...d)=>{const h=l(...d);return o(...d),h}:o&&(r[s]=o):s==="style"?r[s]={...o,...l}:s==="className"&&(r[s]=[o,l].filter(Boolean).join(" "))}return{...e,...r}}function HM(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var qM=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],je=qM.reduce((e,t)=>{const r=zM(`Primitive.${t}`),s=y.forwardRef((o,l)=>{const{asChild:u,...d}=o,h=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(h,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function p_(e,t){e&&Tl.flushSync(()=>e.dispatchEvent(t))}function iw(e){const t=VM(e),r=y.forwardRef((s,o)=>{const{children:l,...u}=s,d=y.Children.toArray(l),h=d.find(FM);if(h){const m=h.props.children,b=d.map(g=>g===h?y.Children.count(m)>1?y.Children.only(null):y.isValidElement(m)?m.props.children:null:g);return v.jsx(t,{...u,ref:o,children:y.isValidElement(m)?y.cloneElement(m,void 0,b):null})}return v.jsx(t,{...u,ref:o,children:l})});return r.displayName=`${e}.Slot`,r}function VM(e){const t=y.forwardRef((r,s)=>{const{children:o,...l}=r;if(y.isValidElement(o)){const u=YM(o),d=KM(l,o.props);return o.type!==y.Fragment&&(d.ref=s?Jt(s,u):u),y.cloneElement(o,d)}return y.Children.count(o)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var GM=Symbol("radix.slottable");function FM(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===GM}function KM(e,t){const r={...t};for(const s in t){const o=e[s],l=t[s];/^on[A-Z]/.test(s)?o&&l?r[s]=(...d)=>{const h=l(...d);return o(...d),h}:o&&(r[s]=o):s==="style"?r[s]={...o,...l}:s==="className"&&(r[s]=[o,l].filter(Boolean).join(" "))}return{...e,...r}}function YM(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function wp(e){const t=e+"CollectionProvider",[r,s]=oa(t),[o,l]=r(t,{collectionRef:{current:null},itemMap:new Map}),u=S=>{const{scope:T,children:C}=S,A=oe.useRef(null),N=oe.useRef(new Map).current;return v.jsx(o,{scope:T,itemMap:N,collectionRef:A,children:C})};u.displayName=t;const d=e+"CollectionSlot",h=iw(d),m=oe.forwardRef((S,T)=>{const{scope:C,children:A}=S,N=l(d,C),z=Ye(T,N.collectionRef);return v.jsx(h,{ref:z,children:A})});m.displayName=d;const b=e+"CollectionItemSlot",g="data-radix-collection-item",w=iw(b),_=oe.forwardRef((S,T)=>{const{scope:C,children:A,...N}=S,z=oe.useRef(null),F=Ye(T,z),B=l(b,C);return oe.useEffect(()=>(B.itemMap.set(z,{ref:z,...N}),()=>void B.itemMap.delete(z))),v.jsx(w,{[g]:"",ref:F,children:A})});_.displayName=b;function E(S){const T=l(e+"CollectionConsumer",S);return oe.useCallback(()=>{const A=T.collectionRef.current;if(!A)return[];const N=Array.from(A.querySelectorAll(`[${g}]`));return Array.from(T.itemMap.values()).sort((B,P)=>N.indexOf(B.ref.current)-N.indexOf(P.ref.current))},[T.collectionRef,T.itemMap])}return[{Provider:u,Slot:m,ItemSlot:_},E,s]}var WM=y.createContext(void 0);function xp(e){const t=y.useContext(WM);return e||t||"ltr"}function nr(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e}),y.useMemo(()=>(...r)=>{var s;return(s=t.current)==null?void 0:s.call(t,...r)},[])}function XM(e,t=globalThis==null?void 0:globalThis.document){const r=nr(e);y.useEffect(()=>{const s=o=>{o.key==="Escape"&&r(o)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[r,t])}var JM="DismissableLayer",zm="dismissableLayer.update",QM="dismissableLayer.pointerDownOutside",ZM="dismissableLayer.focusOutside",ow,g_=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),kl=y.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:l,onInteractOutside:u,onDismiss:d,...h}=e,m=y.useContext(g_),[b,g]=y.useState(null),w=(b==null?void 0:b.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,_]=y.useState({}),E=Ye(t,P=>g(P)),S=Array.from(m.layers),[T]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),C=S.indexOf(T),A=b?S.indexOf(b):-1,N=m.layersWithOutsidePointerEventsDisabled.size>0,z=A>=C,F=nD(P=>{const V=P.target,re=[...m.branches].some(le=>le.contains(V));!z||re||(o==null||o(P),u==null||u(P),P.defaultPrevented||d==null||d())},w),B=rD(P=>{const V=P.target;[...m.branches].some(le=>le.contains(V))||(l==null||l(P),u==null||u(P),P.defaultPrevented||d==null||d())},w);return XM(P=>{A===m.layers.size-1&&(s==null||s(P),!P.defaultPrevented&&d&&(P.preventDefault(),d()))},w),y.useEffect(()=>{if(b)return r&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(ow=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(b)),m.layers.add(b),lw(),()=>{r&&m.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=ow)}},[b,w,r,m]),y.useEffect(()=>()=>{b&&(m.layers.delete(b),m.layersWithOutsidePointerEventsDisabled.delete(b),lw())},[b,m]),y.useEffect(()=>{const P=()=>_({});return document.addEventListener(zm,P),()=>document.removeEventListener(zm,P)},[]),v.jsx(je.div,{...h,ref:E,style:{pointerEvents:N?z?"auto":"none":void 0,...e.style},onFocusCapture:xe(e.onFocusCapture,B.onFocusCapture),onBlurCapture:xe(e.onBlurCapture,B.onBlurCapture),onPointerDownCapture:xe(e.onPointerDownCapture,F.onPointerDownCapture)})});kl.displayName=JM;var eD="DismissableLayerBranch",tD=y.forwardRef((e,t)=>{const r=y.useContext(g_),s=y.useRef(null),o=Ye(t,s);return y.useEffect(()=>{const l=s.current;if(l)return r.branches.add(l),()=>{r.branches.delete(l)}},[r.branches]),v.jsx(je.div,{...e,ref:o})});tD.displayName=eD;function nD(e,t=globalThis==null?void 0:globalThis.document){const r=nr(e),s=y.useRef(!1),o=y.useRef(()=>{});return y.useEffect(()=>{const l=d=>{if(d.target&&!s.current){let h=function(){v_(QM,r,m,{discrete:!0})};const m={originalEvent:d};d.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=h,t.addEventListener("click",o.current,{once:!0})):h()}else t.removeEventListener("click",o.current);s.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",l),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>s.current=!0}}function rD(e,t=globalThis==null?void 0:globalThis.document){const r=nr(e),s=y.useRef(!1);return y.useEffect(()=>{const o=l=>{l.target&&!s.current&&v_(ZM,r,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function lw(){const e=new CustomEvent(zm);document.dispatchEvent(e)}function v_(e,t,r,{discrete:s}){const o=r.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),s?p_(o,l):o.dispatchEvent(l)}var tm=0;function cd(){y.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??cw()),document.body.insertAdjacentElement("beforeend",e[1]??cw()),tm++,()=>{tm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),tm--}},[])}function cw(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var nm="focusScope.autoFocusOnMount",rm="focusScope.autoFocusOnUnmount",uw={bubbles:!1,cancelable:!0},aD="FocusScope",jl=y.forwardRef((e,t)=>{const{loop:r=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:l,...u}=e,[d,h]=y.useState(null),m=nr(o),b=nr(l),g=y.useRef(null),w=Ye(t,S=>h(S)),_=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(s){let S=function(N){if(_.paused||!d)return;const z=N.target;d.contains(z)?g.current=z:Ua(g.current,{select:!0})},T=function(N){if(_.paused||!d)return;const z=N.relatedTarget;z!==null&&(d.contains(z)||Ua(g.current,{select:!0}))},C=function(N){if(document.activeElement===document.body)for(const F of N)F.removedNodes.length>0&&Ua(d)};document.addEventListener("focusin",S),document.addEventListener("focusout",T);const A=new MutationObserver(C);return d&&A.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",T),A.disconnect()}}},[s,d,_.paused]),y.useEffect(()=>{if(d){fw.add(_);const S=document.activeElement;if(!d.contains(S)){const C=new CustomEvent(nm,uw);d.addEventListener(nm,m),d.dispatchEvent(C),C.defaultPrevented||(sD(uD(y_(d)),{select:!0}),document.activeElement===S&&Ua(d))}return()=>{d.removeEventListener(nm,m),setTimeout(()=>{const C=new CustomEvent(rm,uw);d.addEventListener(rm,b),d.dispatchEvent(C),C.defaultPrevented||Ua(S??document.body,{select:!0}),d.removeEventListener(rm,b),fw.remove(_)},0)}}},[d,m,b,_]);const E=y.useCallback(S=>{if(!r&&!s||_.paused)return;const T=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,C=document.activeElement;if(T&&C){const A=S.currentTarget,[N,z]=iD(A);N&&z?!S.shiftKey&&C===z?(S.preventDefault(),r&&Ua(N,{select:!0})):S.shiftKey&&C===N&&(S.preventDefault(),r&&Ua(z,{select:!0})):C===A&&S.preventDefault()}},[r,s,_.paused]);return v.jsx(je.div,{tabIndex:-1,...u,ref:w,onKeyDown:E})});jl.displayName=aD;function sD(e,{select:t=!1}={}){const r=document.activeElement;for(const s of e)if(Ua(s,{select:t}),document.activeElement!==r)return}function iD(e){const t=y_(e),r=dw(t,e),s=dw(t.reverse(),e);return[r,s]}function y_(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const o=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||o?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function dw(e,t){for(const r of e)if(!oD(r,{upTo:t}))return r}function oD(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function lD(e){return e instanceof HTMLInputElement&&"select"in e}function Ua(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&lD(e)&&t&&e.select()}}var fw=cD();function cD(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=hw(e,t),e.unshift(t)},remove(t){var r;e=hw(e,t),(r=e[0])==null||r.resume()}}}function hw(e,t){const r=[...e],s=r.indexOf(t);return s!==-1&&r.splice(s,1),r}function uD(e){return e.filter(t=>t.tagName!=="A")}var dD=rp[" useId ".trim().toString()]||(()=>{}),fD=0;function Wt(e){const[t,r]=y.useState(dD());return Nt(()=>{r(s=>s??String(fD++))},[e]),t?`radix-${t}`:""}const hD=["top","right","bottom","left"],Va=Math.min,Rn=Math.max,Vu=Math.round,cu=Math.floor,Sr=e=>({x:e,y:e}),mD={left:"right",right:"left",bottom:"top",top:"bottom"};function Um(e,t,r){return Rn(e,Va(t,r))}function ta(e,t){return typeof e=="function"?e(t):e}function na(e){return e.split("-")[0]}function Wi(e){return e.split("-")[1]}function _p(e){return e==="x"?"y":"x"}function Sp(e){return e==="y"?"height":"width"}function _r(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Ep(e){return _p(_r(e))}function pD(e,t,r){r===void 0&&(r=!1);const s=Wi(e),o=Ep(e),l=Sp(o);let u=o==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(u=Gu(u)),[u,Gu(u)]}function gD(e){const t=Gu(e);return[Im(e),t,Im(t)]}function Im(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const mw=["left","right"],pw=["right","left"],vD=["top","bottom"],yD=["bottom","top"];function bD(e,t,r){switch(e){case"top":case"bottom":return r?t?pw:mw:t?mw:pw;case"left":case"right":return t?vD:yD;default:return[]}}function wD(e,t,r,s){const o=Wi(e);let l=bD(na(e),r==="start",s);return o&&(l=l.map(u=>u+"-"+o),t&&(l=l.concat(l.map(Im)))),l}function Gu(e){const t=na(e);return mD[t]+e.slice(t.length)}function xD(e){return{top:0,right:0,bottom:0,left:0,...e}}function b_(e){return typeof e!="number"?xD(e):{top:e,right:e,bottom:e,left:e}}function Fu(e){const{x:t,y:r,width:s,height:o}=e;return{width:s,height:o,top:r,left:t,right:t+s,bottom:r+o,x:t,y:r}}function gw(e,t,r){let{reference:s,floating:o}=e;const l=_r(t),u=Ep(t),d=Sp(u),h=na(t),m=l==="y",b=s.x+s.width/2-o.width/2,g=s.y+s.height/2-o.height/2,w=s[d]/2-o[d]/2;let _;switch(h){case"top":_={x:b,y:s.y-o.height};break;case"bottom":_={x:b,y:s.y+s.height};break;case"right":_={x:s.x+s.width,y:g};break;case"left":_={x:s.x-o.width,y:g};break;default:_={x:s.x,y:s.y}}switch(Wi(t)){case"start":_[u]-=w*(r&&m?-1:1);break;case"end":_[u]+=w*(r&&m?-1:1);break}return _}async function _D(e,t){var r;t===void 0&&(t={});const{x:s,y:o,platform:l,rects:u,elements:d,strategy:h}=e,{boundary:m="clippingAncestors",rootBoundary:b="viewport",elementContext:g="floating",altBoundary:w=!1,padding:_=0}=ta(t,e),E=b_(_),T=d[w?g==="floating"?"reference":"floating":g],C=Fu(await l.getClippingRect({element:(r=await(l.isElement==null?void 0:l.isElement(T)))==null||r?T:T.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(d.floating)),boundary:m,rootBoundary:b,strategy:h})),A=g==="floating"?{x:s,y:o,width:u.floating.width,height:u.floating.height}:u.reference,N=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),z=await(l.isElement==null?void 0:l.isElement(N))?await(l.getScale==null?void 0:l.getScale(N))||{x:1,y:1}:{x:1,y:1},F=Fu(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:A,offsetParent:N,strategy:h}):A);return{top:(C.top-F.top+E.top)/z.y,bottom:(F.bottom-C.bottom+E.bottom)/z.y,left:(C.left-F.left+E.left)/z.x,right:(F.right-C.right+E.right)/z.x}}const SD=50,ED=async(e,t,r)=>{const{placement:s="bottom",strategy:o="absolute",middleware:l=[],platform:u}=r,d=u.detectOverflow?u:{...u,detectOverflow:_D},h=await(u.isRTL==null?void 0:u.isRTL(t));let m=await u.getElementRects({reference:e,floating:t,strategy:o}),{x:b,y:g}=gw(m,s,h),w=s,_=0;const E={};for(let S=0;S<l.length;S++){const T=l[S];if(!T)continue;const{name:C,fn:A}=T,{x:N,y:z,data:F,reset:B}=await A({x:b,y:g,initialPlacement:s,placement:w,strategy:o,middlewareData:E,rects:m,platform:d,elements:{reference:e,floating:t}});b=N??b,g=z??g,E[C]={...E[C],...F},B&&_<SD&&(_++,typeof B=="object"&&(B.placement&&(w=B.placement),B.rects&&(m=B.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:o}):B.rects),{x:b,y:g}=gw(m,w,h)),S=-1)}return{x:b,y:g,placement:w,strategy:o,middlewareData:E}},CD=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:s,placement:o,rects:l,platform:u,elements:d,middlewareData:h}=t,{element:m,padding:b=0}=ta(e,t)||{};if(m==null)return{};const g=b_(b),w={x:r,y:s},_=Ep(o),E=Sp(_),S=await u.getDimensions(m),T=_==="y",C=T?"top":"left",A=T?"bottom":"right",N=T?"clientHeight":"clientWidth",z=l.reference[E]+l.reference[_]-w[_]-l.floating[E],F=w[_]-l.reference[_],B=await(u.getOffsetParent==null?void 0:u.getOffsetParent(m));let P=B?B[N]:0;(!P||!await(u.isElement==null?void 0:u.isElement(B)))&&(P=d.floating[N]||l.floating[E]);const V=z/2-F/2,re=P/2-S[E]/2-1,le=Va(g[C],re),ce=Va(g[A],re),de=le,ge=P-S[E]-ce,me=P/2-S[E]/2+V,fe=Um(de,me,ge),M=!h.arrow&&Wi(o)!=null&&me!==fe&&l.reference[E]/2-(me<de?le:ce)-S[E]/2<0,K=M?me<de?me-de:me-ge:0;return{[_]:w[_]+K,data:{[_]:fe,centerOffset:me-fe-K,...M&&{alignmentOffset:K}},reset:M}}}),RD=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,s;const{placement:o,middlewareData:l,rects:u,initialPlacement:d,platform:h,elements:m}=t,{mainAxis:b=!0,crossAxis:g=!0,fallbackPlacements:w,fallbackStrategy:_="bestFit",fallbackAxisSideDirection:E="none",flipAlignment:S=!0,...T}=ta(e,t);if((r=l.arrow)!=null&&r.alignmentOffset)return{};const C=na(o),A=_r(d),N=na(d)===d,z=await(h.isRTL==null?void 0:h.isRTL(m.floating)),F=w||(N||!S?[Gu(d)]:gD(d)),B=E!=="none";!w&&B&&F.push(...wD(d,S,E,z));const P=[d,...F],V=await h.detectOverflow(t,T),re=[];let le=((s=l.flip)==null?void 0:s.overflows)||[];if(b&&re.push(V[C]),g){const me=pD(o,u,z);re.push(V[me[0]],V[me[1]])}if(le=[...le,{placement:o,overflows:re}],!re.every(me=>me<=0)){var ce,de;const me=(((ce=l.flip)==null?void 0:ce.index)||0)+1,fe=P[me];if(fe&&(!(g==="alignment"?A!==_r(fe):!1)||le.every(Q=>_r(Q.placement)===A?Q.overflows[0]>0:!0)))return{data:{index:me,overflows:le},reset:{placement:fe}};let M=(de=le.filter(K=>K.overflows[0]<=0).sort((K,Q)=>K.overflows[1]-Q.overflows[1])[0])==null?void 0:de.placement;if(!M)switch(_){case"bestFit":{var ge;const K=(ge=le.filter(Q=>{if(B){const te=_r(Q.placement);return te===A||te==="y"}return!0}).map(Q=>[Q.placement,Q.overflows.filter(te=>te>0).reduce((te,W)=>te+W,0)]).sort((Q,te)=>Q[1]-te[1])[0])==null?void 0:ge[0];K&&(M=K);break}case"initialPlacement":M=d;break}if(o!==M)return{reset:{placement:M}}}return{}}}};function vw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function yw(e){return hD.some(t=>e[t]>=0)}const TD=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:s}=t,{strategy:o="referenceHidden",...l}=ta(e,t);switch(o){case"referenceHidden":{const u=await s.detectOverflow(t,{...l,elementContext:"reference"}),d=vw(u,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:yw(d)}}}case"escaped":{const u=await s.detectOverflow(t,{...l,altBoundary:!0}),d=vw(u,r.floating);return{data:{escapedOffsets:d,escaped:yw(d)}}}default:return{}}}}},w_=new Set(["left","top"]);async function AD(e,t){const{placement:r,platform:s,elements:o}=e,l=await(s.isRTL==null?void 0:s.isRTL(o.floating)),u=na(r),d=Wi(r),h=_r(r)==="y",m=w_.has(u)?-1:1,b=l&&h?-1:1,g=ta(t,e);let{mainAxis:w,crossAxis:_,alignmentAxis:E}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return d&&typeof E=="number"&&(_=d==="end"?E*-1:E),h?{x:_*b,y:w*m}:{x:w*m,y:_*b}}const ND=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,s;const{x:o,y:l,placement:u,middlewareData:d}=t,h=await AD(t,e);return u===((r=d.offset)==null?void 0:r.placement)&&(s=d.arrow)!=null&&s.alignmentOffset?{}:{x:o+h.x,y:l+h.y,data:{...h,placement:u}}}}},kD=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:s,placement:o,platform:l}=t,{mainAxis:u=!0,crossAxis:d=!1,limiter:h={fn:C=>{let{x:A,y:N}=C;return{x:A,y:N}}},...m}=ta(e,t),b={x:r,y:s},g=await l.detectOverflow(t,m),w=_r(na(o)),_=_p(w);let E=b[_],S=b[w];if(u){const C=_==="y"?"top":"left",A=_==="y"?"bottom":"right",N=E+g[C],z=E-g[A];E=Um(N,E,z)}if(d){const C=w==="y"?"top":"left",A=w==="y"?"bottom":"right",N=S+g[C],z=S-g[A];S=Um(N,S,z)}const T=h.fn({...t,[_]:E,[w]:S});return{...T,data:{x:T.x-r,y:T.y-s,enabled:{[_]:u,[w]:d}}}}}},jD=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:s,placement:o,rects:l,middlewareData:u}=t,{offset:d=0,mainAxis:h=!0,crossAxis:m=!0}=ta(e,t),b={x:r,y:s},g=_r(o),w=_p(g);let _=b[w],E=b[g];const S=ta(d,t),T=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(h){const N=w==="y"?"height":"width",z=l.reference[w]-l.floating[N]+T.mainAxis,F=l.reference[w]+l.reference[N]-T.mainAxis;_<z?_=z:_>F&&(_=F)}if(m){var C,A;const N=w==="y"?"width":"height",z=w_.has(na(o)),F=l.reference[g]-l.floating[N]+(z&&((C=u.offset)==null?void 0:C[g])||0)+(z?0:T.crossAxis),B=l.reference[g]+l.reference[N]+(z?0:((A=u.offset)==null?void 0:A[g])||0)-(z?T.crossAxis:0);E<F?E=F:E>B&&(E=B)}return{[w]:_,[g]:E}}}},OD=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,s;const{placement:o,rects:l,platform:u,elements:d}=t,{apply:h=()=>{},...m}=ta(e,t),b=await u.detectOverflow(t,m),g=na(o),w=Wi(o),_=_r(o)==="y",{width:E,height:S}=l.floating;let T,C;g==="top"||g==="bottom"?(T=g,C=w===(await(u.isRTL==null?void 0:u.isRTL(d.floating))?"start":"end")?"left":"right"):(C=g,T=w==="end"?"top":"bottom");const A=S-b.top-b.bottom,N=E-b.left-b.right,z=Va(S-b[T],A),F=Va(E-b[C],N),B=!t.middlewareData.shift;let P=z,V=F;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(V=N),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(P=A),B&&!w){const le=Rn(b.left,0),ce=Rn(b.right,0),de=Rn(b.top,0),ge=Rn(b.bottom,0);_?V=E-2*(le!==0||ce!==0?le+ce:Rn(b.left,b.right)):P=S-2*(de!==0||ge!==0?de+ge:Rn(b.top,b.bottom))}await h({...t,availableWidth:V,availableHeight:P});const re=await u.getDimensions(d.floating);return E!==re.width||S!==re.height?{reset:{rects:!0}}:{}}}};function ud(){return typeof window<"u"}function Xi(e){return x_(e)?(e.nodeName||"").toLowerCase():"#document"}function Nn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rr(e){var t;return(t=(x_(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function x_(e){return ud()?e instanceof Node||e instanceof Nn(e).Node:!1}function rr(e){return ud()?e instanceof Element||e instanceof Nn(e).Element:!1}function la(e){return ud()?e instanceof HTMLElement||e instanceof Nn(e).HTMLElement:!1}function bw(e){return!ud()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Nn(e).ShadowRoot}function Ol(e){const{overflow:t,overflowX:r,overflowY:s,display:o}=ar(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+r)&&o!=="inline"&&o!=="contents"}function MD(e){return/^(table|td|th)$/.test(Xi(e))}function dd(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const DD=/transform|translate|scale|rotate|perspective|filter/,LD=/paint|layout|strict|content/,bs=e=>!!e&&e!=="none";let am;function Cp(e){const t=rr(e)?ar(e):e;return bs(t.transform)||bs(t.translate)||bs(t.scale)||bs(t.rotate)||bs(t.perspective)||!Rp()&&(bs(t.backdropFilter)||bs(t.filter))||DD.test(t.willChange||"")||LD.test(t.contain||"")}function PD(e){let t=Ga(e);for(;la(t)&&!qi(t);){if(Cp(t))return t;if(dd(t))return null;t=Ga(t)}return null}function Rp(){return am==null&&(am=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),am}function qi(e){return/^(html|body|#document)$/.test(Xi(e))}function ar(e){return Nn(e).getComputedStyle(e)}function fd(e){return rr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ga(e){if(Xi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||bw(e)&&e.host||Rr(e);return bw(t)?t.host:t}function __(e){const t=Ga(e);return qi(t)?e.ownerDocument?e.ownerDocument.body:e.body:la(t)&&Ol(t)?t:__(t)}function yl(e,t,r){var s;t===void 0&&(t=[]),r===void 0&&(r=!0);const o=__(e),l=o===((s=e.ownerDocument)==null?void 0:s.body),u=Nn(o);if(l){const d=$m(u);return t.concat(u,u.visualViewport||[],Ol(o)?o:[],d&&r?yl(d):[])}else return t.concat(o,yl(o,[],r))}function $m(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function S_(e){const t=ar(e);let r=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const o=la(e),l=o?e.offsetWidth:r,u=o?e.offsetHeight:s,d=Vu(r)!==l||Vu(s)!==u;return d&&(r=l,s=u),{width:r,height:s,$:d}}function Tp(e){return rr(e)?e:e.contextElement}function $i(e){const t=Tp(e);if(!la(t))return Sr(1);const r=t.getBoundingClientRect(),{width:s,height:o,$:l}=S_(t);let u=(l?Vu(r.width):r.width)/s,d=(l?Vu(r.height):r.height)/o;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const zD=Sr(0);function E_(e){const t=Nn(e);return!Rp()||!t.visualViewport?zD:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function UD(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Nn(e)?!1:t}function As(e,t,r,s){t===void 0&&(t=!1),r===void 0&&(r=!1);const o=e.getBoundingClientRect(),l=Tp(e);let u=Sr(1);t&&(s?rr(s)&&(u=$i(s)):u=$i(e));const d=UD(l,r,s)?E_(l):Sr(0);let h=(o.left+d.x)/u.x,m=(o.top+d.y)/u.y,b=o.width/u.x,g=o.height/u.y;if(l){const w=Nn(l),_=s&&rr(s)?Nn(s):s;let E=w,S=$m(E);for(;S&&s&&_!==E;){const T=$i(S),C=S.getBoundingClientRect(),A=ar(S),N=C.left+(S.clientLeft+parseFloat(A.paddingLeft))*T.x,z=C.top+(S.clientTop+parseFloat(A.paddingTop))*T.y;h*=T.x,m*=T.y,b*=T.x,g*=T.y,h+=N,m+=z,E=Nn(S),S=$m(E)}}return Fu({width:b,height:g,x:h,y:m})}function hd(e,t){const r=fd(e).scrollLeft;return t?t.left+r:As(Rr(e)).left+r}function C_(e,t){const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-hd(e,r),o=r.top+t.scrollTop;return{x:s,y:o}}function ID(e){let{elements:t,rect:r,offsetParent:s,strategy:o}=e;const l=o==="fixed",u=Rr(s),d=t?dd(t.floating):!1;if(s===u||d&&l)return r;let h={scrollLeft:0,scrollTop:0},m=Sr(1);const b=Sr(0),g=la(s);if((g||!g&&!l)&&((Xi(s)!=="body"||Ol(u))&&(h=fd(s)),g)){const _=As(s);m=$i(s),b.x=_.x+s.clientLeft,b.y=_.y+s.clientTop}const w=u&&!g&&!l?C_(u,h):Sr(0);return{width:r.width*m.x,height:r.height*m.y,x:r.x*m.x-h.scrollLeft*m.x+b.x+w.x,y:r.y*m.y-h.scrollTop*m.y+b.y+w.y}}function $D(e){return Array.from(e.getClientRects())}function BD(e){const t=Rr(e),r=fd(e),s=e.ownerDocument.body,o=Rn(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=Rn(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let u=-r.scrollLeft+hd(e);const d=-r.scrollTop;return ar(s).direction==="rtl"&&(u+=Rn(t.clientWidth,s.clientWidth)-o),{width:o,height:l,x:u,y:d}}const ww=25;function HD(e,t){const r=Nn(e),s=Rr(e),o=r.visualViewport;let l=s.clientWidth,u=s.clientHeight,d=0,h=0;if(o){l=o.width,u=o.height;const b=Rp();(!b||b&&t==="fixed")&&(d=o.offsetLeft,h=o.offsetTop)}const m=hd(s);if(m<=0){const b=s.ownerDocument,g=b.body,w=getComputedStyle(g),_=b.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,E=Math.abs(s.clientWidth-g.clientWidth-_);E<=ww&&(l-=E)}else m<=ww&&(l+=m);return{width:l,height:u,x:d,y:h}}function qD(e,t){const r=As(e,!0,t==="fixed"),s=r.top+e.clientTop,o=r.left+e.clientLeft,l=la(e)?$i(e):Sr(1),u=e.clientWidth*l.x,d=e.clientHeight*l.y,h=o*l.x,m=s*l.y;return{width:u,height:d,x:h,y:m}}function xw(e,t,r){let s;if(t==="viewport")s=HD(e,r);else if(t==="document")s=BD(Rr(e));else if(rr(t))s=qD(t,r);else{const o=E_(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Fu(s)}function R_(e,t){const r=Ga(e);return r===t||!rr(r)||qi(r)?!1:ar(r).position==="fixed"||R_(r,t)}function VD(e,t){const r=t.get(e);if(r)return r;let s=yl(e,[],!1).filter(d=>rr(d)&&Xi(d)!=="body"),o=null;const l=ar(e).position==="fixed";let u=l?Ga(e):e;for(;rr(u)&&!qi(u);){const d=ar(u),h=Cp(u);!h&&d.position==="fixed"&&(o=null),(l?!h&&!o:!h&&d.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Ol(u)&&!h&&R_(e,u))?s=s.filter(b=>b!==u):o=d,u=Ga(u)}return t.set(e,s),s}function GD(e){let{element:t,boundary:r,rootBoundary:s,strategy:o}=e;const u=[...r==="clippingAncestors"?dd(t)?[]:VD(t,this._c):[].concat(r),s],d=xw(t,u[0],o);let h=d.top,m=d.right,b=d.bottom,g=d.left;for(let w=1;w<u.length;w++){const _=xw(t,u[w],o);h=Rn(_.top,h),m=Va(_.right,m),b=Va(_.bottom,b),g=Rn(_.left,g)}return{width:m-g,height:b-h,x:g,y:h}}function FD(e){const{width:t,height:r}=S_(e);return{width:t,height:r}}function KD(e,t,r){const s=la(t),o=Rr(t),l=r==="fixed",u=As(e,!0,l,t);let d={scrollLeft:0,scrollTop:0};const h=Sr(0);function m(){h.x=hd(o)}if(s||!s&&!l)if((Xi(t)!=="body"||Ol(o))&&(d=fd(t)),s){const _=As(t,!0,l,t);h.x=_.x+t.clientLeft,h.y=_.y+t.clientTop}else o&&m();l&&!s&&o&&m();const b=o&&!s&&!l?C_(o,d):Sr(0),g=u.left+d.scrollLeft-h.x-b.x,w=u.top+d.scrollTop-h.y-b.y;return{x:g,y:w,width:u.width,height:u.height}}function sm(e){return ar(e).position==="static"}function _w(e,t){if(!la(e)||ar(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Rr(e)===r&&(r=r.ownerDocument.body),r}function T_(e,t){const r=Nn(e);if(dd(e))return r;if(!la(e)){let o=Ga(e);for(;o&&!qi(o);){if(rr(o)&&!sm(o))return o;o=Ga(o)}return r}let s=_w(e,t);for(;s&&MD(s)&&sm(s);)s=_w(s,t);return s&&qi(s)&&sm(s)&&!Cp(s)?r:s||PD(e)||r}const YD=async function(e){const t=this.getOffsetParent||T_,r=this.getDimensions,s=await r(e.floating);return{reference:KD(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function WD(e){return ar(e).direction==="rtl"}const XD={convertOffsetParentRelativeRectToViewportRelativeRect:ID,getDocumentElement:Rr,getClippingRect:GD,getOffsetParent:T_,getElementRects:YD,getClientRects:$D,getDimensions:FD,getScale:$i,isElement:rr,isRTL:WD};function A_(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function JD(e,t){let r=null,s;const o=Rr(e);function l(){var d;clearTimeout(s),(d=r)==null||d.disconnect(),r=null}function u(d,h){d===void 0&&(d=!1),h===void 0&&(h=1),l();const m=e.getBoundingClientRect(),{left:b,top:g,width:w,height:_}=m;if(d||t(),!w||!_)return;const E=cu(g),S=cu(o.clientWidth-(b+w)),T=cu(o.clientHeight-(g+_)),C=cu(b),N={rootMargin:-E+"px "+-S+"px "+-T+"px "+-C+"px",threshold:Rn(0,Va(1,h))||1};let z=!0;function F(B){const P=B[0].intersectionRatio;if(P!==h){if(!z)return u();P?u(!1,P):s=setTimeout(()=>{u(!1,1e-7)},1e3)}P===1&&!A_(m,e.getBoundingClientRect())&&u(),z=!1}try{r=new IntersectionObserver(F,{...N,root:o.ownerDocument})}catch{r=new IntersectionObserver(F,N)}r.observe(e)}return u(!0),l}function QD(e,t,r,s){s===void 0&&(s={});const{ancestorScroll:o=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:h=!1}=s,m=Tp(e),b=o||l?[...m?yl(m):[],...t?yl(t):[]]:[];b.forEach(C=>{o&&C.addEventListener("scroll",r,{passive:!0}),l&&C.addEventListener("resize",r)});const g=m&&d?JD(m,r):null;let w=-1,_=null;u&&(_=new ResizeObserver(C=>{let[A]=C;A&&A.target===m&&_&&t&&(_.unobserve(t),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var N;(N=_)==null||N.observe(t)})),r()}),m&&!h&&_.observe(m),t&&_.observe(t));let E,S=h?As(e):null;h&&T();function T(){const C=As(e);S&&!A_(S,C)&&r(),S=C,E=requestAnimationFrame(T)}return r(),()=>{var C;b.forEach(A=>{o&&A.removeEventListener("scroll",r),l&&A.removeEventListener("resize",r)}),g==null||g(),(C=_)==null||C.disconnect(),_=null,h&&cancelAnimationFrame(E)}}const ZD=ND,eL=kD,tL=RD,nL=OD,rL=TD,Sw=CD,aL=jD,sL=(e,t,r)=>{const s=new Map,o={platform:XD,...r},l={...o.platform,_c:s};return ED(e,t,{...o,platform:l})};var iL=typeof document<"u",oL=function(){},Tu=iL?y.useLayoutEffect:oL;function Ku(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,s,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(s=r;s--!==0;)if(!Ku(e[s],t[s]))return!1;return!0}if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(s=r;s--!==0;)if(!{}.hasOwnProperty.call(t,o[s]))return!1;for(s=r;s--!==0;){const l=o[s];if(!(l==="_owner"&&e.$$typeof)&&!Ku(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function N_(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ew(e,t){const r=N_(e);return Math.round(t*r)/r}function im(e){const t=y.useRef(e);return Tu(()=>{t.current=e}),t}function lL(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:s=[],platform:o,elements:{reference:l,floating:u}={},transform:d=!0,whileElementsMounted:h,open:m}=e,[b,g]=y.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[w,_]=y.useState(s);Ku(w,s)||_(s);const[E,S]=y.useState(null),[T,C]=y.useState(null),A=y.useCallback(Q=>{Q!==B.current&&(B.current=Q,S(Q))},[]),N=y.useCallback(Q=>{Q!==P.current&&(P.current=Q,C(Q))},[]),z=l||E,F=u||T,B=y.useRef(null),P=y.useRef(null),V=y.useRef(b),re=h!=null,le=im(h),ce=im(o),de=im(m),ge=y.useCallback(()=>{if(!B.current||!P.current)return;const Q={placement:t,strategy:r,middleware:w};ce.current&&(Q.platform=ce.current),sL(B.current,P.current,Q).then(te=>{const W={...te,isPositioned:de.current!==!1};me.current&&!Ku(V.current,W)&&(V.current=W,Tl.flushSync(()=>{g(W)}))})},[w,t,r,ce,de]);Tu(()=>{m===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,g(Q=>({...Q,isPositioned:!1})))},[m]);const me=y.useRef(!1);Tu(()=>(me.current=!0,()=>{me.current=!1}),[]),Tu(()=>{if(z&&(B.current=z),F&&(P.current=F),z&&F){if(le.current)return le.current(z,F,ge);ge()}},[z,F,ge,le,re]);const fe=y.useMemo(()=>({reference:B,floating:P,setReference:A,setFloating:N}),[A,N]),M=y.useMemo(()=>({reference:z,floating:F}),[z,F]),K=y.useMemo(()=>{const Q={position:r,left:0,top:0};if(!M.floating)return Q;const te=Ew(M.floating,b.x),W=Ew(M.floating,b.y);return d?{...Q,transform:"translate("+te+"px, "+W+"px)",...N_(M.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:te,top:W}},[r,d,M.floating,b.x,b.y]);return y.useMemo(()=>({...b,update:ge,refs:fe,elements:M,floatingStyles:K}),[b,ge,fe,M,K])}const cL=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:s,padding:o}=typeof e=="function"?e(r):e;return s&&t(s)?s.current!=null?Sw({element:s.current,padding:o}).fn(r):{}:s?Sw({element:s,padding:o}).fn(r):{}}}},uL=(e,t)=>{const r=ZD(e);return{name:r.name,fn:r.fn,options:[e,t]}},dL=(e,t)=>{const r=eL(e);return{name:r.name,fn:r.fn,options:[e,t]}},fL=(e,t)=>({fn:aL(e).fn,options:[e,t]}),hL=(e,t)=>{const r=tL(e);return{name:r.name,fn:r.fn,options:[e,t]}},mL=(e,t)=>{const r=nL(e);return{name:r.name,fn:r.fn,options:[e,t]}},pL=(e,t)=>{const r=rL(e);return{name:r.name,fn:r.fn,options:[e,t]}},gL=(e,t)=>{const r=cL(e);return{name:r.name,fn:r.fn,options:[e,t]}};var vL="Arrow",k_=y.forwardRef((e,t)=>{const{children:r,width:s=10,height:o=5,...l}=e;return v.jsx(je.svg,{...l,ref:t,width:s,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:v.jsx("polygon",{points:"0,0 30,0 15,10"})})});k_.displayName=vL;var yL=k_;function j_(e){const[t,r]=y.useState(void 0);return Nt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const l=o[0];let u,d;if("borderBoxSize"in l){const h=l.borderBoxSize,m=Array.isArray(h)?h[0]:h;u=m.inlineSize,d=m.blockSize}else u=e.offsetWidth,d=e.offsetHeight;r({width:u,height:d})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else r(void 0)},[e]),t}var Ap="Popper",[O_,Ji]=oa(Ap),[bL,M_]=O_(Ap),D_=e=>{const{__scopePopper:t,children:r}=e,[s,o]=y.useState(null);return v.jsx(bL,{scope:t,anchor:s,onAnchorChange:o,children:r})};D_.displayName=Ap;var L_="PopperAnchor",P_=y.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:s,...o}=e,l=M_(L_,r),u=y.useRef(null),d=Ye(t,u),h=y.useRef(null);return y.useEffect(()=>{const m=h.current;h.current=(s==null?void 0:s.current)||u.current,m!==h.current&&l.onAnchorChange(h.current)}),s?null:v.jsx(je.div,{...o,ref:d})});P_.displayName=L_;var Np="PopperContent",[wL,xL]=O_(Np),z_=y.forwardRef((e,t)=>{var J,se,ie,ue,Ee,Se;const{__scopePopper:r,side:s="bottom",sideOffset:o=0,align:l="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:h=!0,collisionBoundary:m=[],collisionPadding:b=0,sticky:g="partial",hideWhenDetached:w=!1,updatePositionStrategy:_="optimized",onPlaced:E,...S}=e,T=M_(Np,r),[C,A]=y.useState(null),N=Ye(t,et=>A(et)),[z,F]=y.useState(null),B=j_(z),P=(B==null?void 0:B.width)??0,V=(B==null?void 0:B.height)??0,re=s+(l!=="center"?"-"+l:""),le=typeof b=="number"?b:{top:0,right:0,bottom:0,left:0,...b},ce=Array.isArray(m)?m:[m],de=ce.length>0,ge={padding:le,boundary:ce.filter(SL),altBoundary:de},{refs:me,floatingStyles:fe,placement:M,isPositioned:K,middlewareData:Q}=lL({strategy:"fixed",placement:re,whileElementsMounted:(...et)=>QD(...et,{animationFrame:_==="always"}),elements:{reference:T.anchor},middleware:[uL({mainAxis:o+V,alignmentAxis:u}),h&&dL({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?fL():void 0,...ge}),h&&hL({...ge}),mL({...ge,apply:({elements:et,rects:He,availableWidth:vn,availableHeight:Zt})=>{const{width:Gt,height:Tr}=He.reference,wt=et.floating.style;wt.setProperty("--radix-popper-available-width",`${vn}px`),wt.setProperty("--radix-popper-available-height",`${Zt}px`),wt.setProperty("--radix-popper-anchor-width",`${Gt}px`),wt.setProperty("--radix-popper-anchor-height",`${Tr}px`)}}),z&&gL({element:z,padding:d}),EL({arrowWidth:P,arrowHeight:V}),w&&pL({strategy:"referenceHidden",...ge})]}),[te,W]=$_(M),k=nr(E);Nt(()=>{K&&(k==null||k())},[K,k]);const j=(J=Q.arrow)==null?void 0:J.x,$=(se=Q.arrow)==null?void 0:se.y,D=((ie=Q.arrow)==null?void 0:ie.centerOffset)!==0,[U,X]=y.useState();return Nt(()=>{C&&X(window.getComputedStyle(C).zIndex)},[C]),v.jsx("div",{ref:me.setFloating,"data-radix-popper-content-wrapper":"",style:{...fe,transform:K?fe.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[(ue=Q.transformOrigin)==null?void 0:ue.x,(Ee=Q.transformOrigin)==null?void 0:Ee.y].join(" "),...((Se=Q.hide)==null?void 0:Se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:v.jsx(wL,{scope:r,placedSide:te,onArrowChange:F,arrowX:j,arrowY:$,shouldHideArrow:D,children:v.jsx(je.div,{"data-side":te,"data-align":W,...S,ref:N,style:{...S.style,animation:K?void 0:"none"}})})})});z_.displayName=Np;var U_="PopperArrow",_L={top:"bottom",right:"left",bottom:"top",left:"right"},I_=y.forwardRef(function(t,r){const{__scopePopper:s,...o}=t,l=xL(U_,s),u=_L[l.placedSide];return v.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:v.jsx(yL,{...o,ref:r,style:{...o.style,display:"block"}})})});I_.displayName=U_;function SL(e){return e!==null}var EL=e=>({name:"transformOrigin",options:e,fn(t){var T,C,A;const{placement:r,rects:s,middlewareData:o}=t,u=((T=o.arrow)==null?void 0:T.centerOffset)!==0,d=u?0:e.arrowWidth,h=u?0:e.arrowHeight,[m,b]=$_(r),g={start:"0%",center:"50%",end:"100%"}[b],w=(((C=o.arrow)==null?void 0:C.x)??0)+d/2,_=(((A=o.arrow)==null?void 0:A.y)??0)+h/2;let E="",S="";return m==="bottom"?(E=u?g:`${w}px`,S=`${-h}px`):m==="top"?(E=u?g:`${w}px`,S=`${s.floating.height+h}px`):m==="right"?(E=`${-h}px`,S=u?g:`${_}px`):m==="left"&&(E=`${s.floating.width+h}px`,S=u?g:`${_}px`),{data:{x:E,y:S}}}});function $_(e){const[t,r="center"]=e.split("-");return[t,r]}var kp=D_,md=P_,jp=z_,Op=I_,CL="Portal",Ml=y.forwardRef((e,t)=>{var d;const{container:r,...s}=e,[o,l]=y.useState(!1);Nt(()=>l(!0),[]);const u=r||o&&((d=globalThis==null?void 0:globalThis.document)==null?void 0:d.body);return u?_x.createPortal(v.jsx(je.div,{...s,ref:t}),u):null});Ml.displayName=CL;function RL(e,t){return y.useReducer((r,s)=>t[r][s]??r,e)}var sr=e=>{const{present:t,children:r}=e,s=TL(t),o=typeof r=="function"?r({present:s.isPresent}):y.Children.only(r),l=Ye(s.ref,AL(o));return typeof r=="function"||s.isPresent?y.cloneElement(o,{ref:l}):null};sr.displayName="Presence";function TL(e){const[t,r]=y.useState(),s=y.useRef(null),o=y.useRef(e),l=y.useRef("none"),u=e?"mounted":"unmounted",[d,h]=RL(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const m=uu(s.current);l.current=d==="mounted"?m:"none"},[d]),Nt(()=>{const m=s.current,b=o.current;if(b!==e){const w=l.current,_=uu(m);e?h("MOUNT"):_==="none"||(m==null?void 0:m.display)==="none"?h("UNMOUNT"):h(b&&w!==_?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,h]),Nt(()=>{if(t){let m;const b=t.ownerDocument.defaultView??window,g=_=>{const S=uu(s.current).includes(CSS.escape(_.animationName));if(_.target===t&&S&&(h("ANIMATION_END"),!o.current)){const T=t.style.animationFillMode;t.style.animationFillMode="forwards",m=b.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=T)})}},w=_=>{_.target===t&&(l.current=uu(s.current))};return t.addEventListener("animationstart",w),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{b.clearTimeout(m),t.removeEventListener("animationstart",w),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:y.useCallback(m=>{s.current=m?getComputedStyle(m):null,r(m)},[])}}function uu(e){return(e==null?void 0:e.animationName)||"none"}function AL(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var om="rovingFocusGroup.onEntryFocus",NL={bubbles:!1,cancelable:!0},Dl="RovingFocusGroup",[Bm,B_,kL]=wp(Dl),[jL,H_]=oa(Dl,[kL]),[OL,ML]=jL(Dl),q_=y.forwardRef((e,t)=>v.jsx(Bm.Provider,{scope:e.__scopeRovingFocusGroup,children:v.jsx(Bm.Slot,{scope:e.__scopeRovingFocusGroup,children:v.jsx(DL,{...e,ref:t})})}));q_.displayName=Dl;var DL=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:s,loop:o=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:h,onEntryFocus:m,preventScrollOnEntryFocus:b=!1,...g}=e,w=y.useRef(null),_=Ye(t,w),E=xp(l),[S,T]=Ts({prop:u,defaultProp:d??null,onChange:h,caller:Dl}),[C,A]=y.useState(!1),N=nr(m),z=B_(r),F=y.useRef(!1),[B,P]=y.useState(0);return y.useEffect(()=>{const V=w.current;if(V)return V.addEventListener(om,N),()=>V.removeEventListener(om,N)},[N]),v.jsx(OL,{scope:r,orientation:s,dir:E,loop:o,currentTabStopId:S,onItemFocus:y.useCallback(V=>T(V),[T]),onItemShiftTab:y.useCallback(()=>A(!0),[]),onFocusableItemAdd:y.useCallback(()=>P(V=>V+1),[]),onFocusableItemRemove:y.useCallback(()=>P(V=>V-1),[]),children:v.jsx(je.div,{tabIndex:C||B===0?-1:0,"data-orientation":s,...g,ref:_,style:{outline:"none",...e.style},onMouseDown:xe(e.onMouseDown,()=>{F.current=!0}),onFocus:xe(e.onFocus,V=>{const re=!F.current;if(V.target===V.currentTarget&&re&&!C){const le=new CustomEvent(om,NL);if(V.currentTarget.dispatchEvent(le),!le.defaultPrevented){const ce=z().filter(M=>M.focusable),de=ce.find(M=>M.active),ge=ce.find(M=>M.id===S),fe=[de,ge,...ce].filter(Boolean).map(M=>M.ref.current);F_(fe,b)}}F.current=!1}),onBlur:xe(e.onBlur,()=>A(!1))})})}),V_="RovingFocusGroupItem",G_=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:s=!0,active:o=!1,tabStopId:l,children:u,...d}=e,h=Wt(),m=l||h,b=ML(V_,r),g=b.currentTabStopId===m,w=B_(r),{onFocusableItemAdd:_,onFocusableItemRemove:E,currentTabStopId:S}=b;return y.useEffect(()=>{if(s)return _(),()=>E()},[s,_,E]),v.jsx(Bm.ItemSlot,{scope:r,id:m,focusable:s,active:o,children:v.jsx(je.span,{tabIndex:g?0:-1,"data-orientation":b.orientation,...d,ref:t,onMouseDown:xe(e.onMouseDown,T=>{s?b.onItemFocus(m):T.preventDefault()}),onFocus:xe(e.onFocus,()=>b.onItemFocus(m)),onKeyDown:xe(e.onKeyDown,T=>{if(T.key==="Tab"&&T.shiftKey){b.onItemShiftTab();return}if(T.target!==T.currentTarget)return;const C=zL(T,b.orientation,b.dir);if(C!==void 0){if(T.metaKey||T.ctrlKey||T.altKey||T.shiftKey)return;T.preventDefault();let N=w().filter(z=>z.focusable).map(z=>z.ref.current);if(C==="last")N.reverse();else if(C==="prev"||C==="next"){C==="prev"&&N.reverse();const z=N.indexOf(T.currentTarget);N=b.loop?UL(N,z+1):N.slice(z+1)}setTimeout(()=>F_(N))}}),children:typeof u=="function"?u({isCurrentTabStop:g,hasTabStop:S!=null}):u})})});G_.displayName=V_;var LL={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function PL(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function zL(e,t,r){const s=PL(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return LL[s]}function F_(e,t=!1){const r=document.activeElement;for(const s of e)if(s===r||(s.focus({preventScroll:t}),document.activeElement!==r))return}function UL(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var IL=q_,$L=G_;function BL(e){const t=HL(e),r=y.forwardRef((s,o)=>{const{children:l,...u}=s,d=y.Children.toArray(l),h=d.find(VL);if(h){const m=h.props.children,b=d.map(g=>g===h?y.Children.count(m)>1?y.Children.only(null):y.isValidElement(m)?m.props.children:null:g);return v.jsx(t,{...u,ref:o,children:y.isValidElement(m)?y.cloneElement(m,void 0,b):null})}return v.jsx(t,{...u,ref:o,children:l})});return r.displayName=`${e}.Slot`,r}function HL(e){const t=y.forwardRef((r,s)=>{const{children:o,...l}=r;if(y.isValidElement(o)){const u=FL(o),d=GL(l,o.props);return o.type!==y.Fragment&&(d.ref=s?Jt(s,u):u),y.cloneElement(o,d)}return y.Children.count(o)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var qL=Symbol("radix.slottable");function VL(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===qL}function GL(e,t){const r={...t};for(const s in t){const o=e[s],l=t[s];/^on[A-Z]/.test(s)?o&&l?r[s]=(...d)=>{const h=l(...d);return o(...d),h}:o&&(r[s]=o):s==="style"?r[s]={...o,...l}:s==="className"&&(r[s]=[o,l].filter(Boolean).join(" "))}return{...e,...r}}function FL(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var KL=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ri=new WeakMap,du=new WeakMap,fu={},lm=0,K_=function(e){return e&&(e.host||K_(e.parentNode))},YL=function(e,t){return t.map(function(r){if(e.contains(r))return r;var s=K_(r);return s&&e.contains(s)?s:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},WL=function(e,t,r,s){var o=YL(t,Array.isArray(e)?e:[e]);fu[r]||(fu[r]=new WeakMap);var l=fu[r],u=[],d=new Set,h=new Set(o),m=function(g){!g||d.has(g)||(d.add(g),m(g.parentNode))};o.forEach(m);var b=function(g){!g||h.has(g)||Array.prototype.forEach.call(g.children,function(w){if(d.has(w))b(w);else try{var _=w.getAttribute(s),E=_!==null&&_!=="false",S=(Ri.get(w)||0)+1,T=(l.get(w)||0)+1;Ri.set(w,S),l.set(w,T),u.push(w),S===1&&E&&du.set(w,!0),T===1&&w.setAttribute(r,"true"),E||w.setAttribute(s,"true")}catch(C){console.error("aria-hidden: cannot operate on ",w,C)}})};return b(t),d.clear(),lm++,function(){u.forEach(function(g){var w=Ri.get(g)-1,_=l.get(g)-1;Ri.set(g,w),l.set(g,_),w||(du.has(g)||g.removeAttribute(s),du.delete(g)),_||g.removeAttribute(r)}),lm--,lm||(Ri=new WeakMap,Ri=new WeakMap,du=new WeakMap,fu={})}},pd=function(e,t,r){r===void 0&&(r="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),o=KL(e);return o?(s.push.apply(s,Array.from(o.querySelectorAll("[aria-live], script"))),WL(s,o,r,"aria-hidden")):function(){return null}},Au="right-scroll-bar-position",Nu="width-before-scroll-bar",XL="with-scroll-bars-hidden",JL="--removed-body-scroll-bar-size";function cm(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function QL(e,t){var r=y.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(s){var o=r.value;o!==s&&(r.value=s,r.callback(s,o))}}}})[0];return r.callback=t,r.facade}var ZL=typeof window<"u"?y.useLayoutEffect:y.useEffect,Cw=new WeakMap;function e5(e,t){var r=QL(null,function(s){return e.forEach(function(o){return cm(o,s)})});return ZL(function(){var s=Cw.get(r);if(s){var o=new Set(s),l=new Set(e),u=r.current;o.forEach(function(d){l.has(d)||cm(d,null)}),l.forEach(function(d){o.has(d)||cm(d,u)})}Cw.set(r,e)},[e]),r}function t5(e){return e}function n5(e,t){t===void 0&&(t=t5);var r=[],s=!1,o={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(l){var u=t(l,s);return r.push(u),function(){r=r.filter(function(d){return d!==u})}},assignSyncMedium:function(l){for(s=!0;r.length;){var u=r;r=[],u.forEach(l)}r={push:function(d){return l(d)},filter:function(){return r}}},assignMedium:function(l){s=!0;var u=[];if(r.length){var d=r;r=[],d.forEach(l),u=r}var h=function(){var b=u;u=[],b.forEach(l)},m=function(){return Promise.resolve().then(h)};m(),r={push:function(b){u.push(b),m()},filter:function(b){return u=u.filter(b),r}}}};return o}function r5(e){e===void 0&&(e={});var t=n5(null);return t.options=xr({async:!0,ssr:!1},e),t}var Y_=function(e){var t=e.sideCar,r=Ki(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return y.createElement(s,xr({},r))};Y_.isSideCarExport=!0;function a5(e,t){return e.useMedium(t),Y_}var W_=r5(),um=function(){},gd=y.forwardRef(function(e,t){var r=y.useRef(null),s=y.useState({onScrollCapture:um,onWheelCapture:um,onTouchMoveCapture:um}),o=s[0],l=s[1],u=e.forwardProps,d=e.children,h=e.className,m=e.removeScrollBar,b=e.enabled,g=e.shards,w=e.sideCar,_=e.noRelative,E=e.noIsolation,S=e.inert,T=e.allowPinchZoom,C=e.as,A=C===void 0?"div":C,N=e.gapMode,z=Ki(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=w,B=e5([r,t]),P=xr(xr({},z),o);return y.createElement(y.Fragment,null,b&&y.createElement(F,{sideCar:W_,removeScrollBar:m,shards:g,noRelative:_,noIsolation:E,inert:S,setCallbacks:l,allowPinchZoom:!!T,lockRef:r,gapMode:N}),u?y.cloneElement(y.Children.only(d),xr(xr({},P),{ref:B})):y.createElement(A,xr({},P,{className:h,ref:B}),d))});gd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};gd.classNames={fullWidth:Nu,zeroRight:Au};var s5=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function i5(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=s5();return t&&e.setAttribute("nonce",t),e}function o5(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function l5(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var c5=function(){var e=0,t=null;return{add:function(r){e==0&&(t=i5())&&(o5(t,r),l5(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},u5=function(){var e=c5();return function(t,r){y.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},X_=function(){var e=u5(),t=function(r){var s=r.styles,o=r.dynamic;return e(s,o),null};return t},d5={left:0,top:0,right:0,gap:0},dm=function(e){return parseInt(e||"",10)||0},f5=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[dm(r),dm(s),dm(o)]},h5=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return d5;var t=f5(e),r=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-r+t[2]-t[0])}},m5=X_(),Bi="data-scroll-locked",p5=function(e,t,r,s){var o=e.left,l=e.top,u=e.right,d=e.gap;return r===void 0&&(r="margin"),`
|
||
.`.concat(XL,` {
|
||
overflow: hidden `).concat(s,`;
|
||
padding-right: `).concat(d,"px ").concat(s,`;
|
||
}
|
||
body[`).concat(Bi,`] {
|
||
overflow: hidden `).concat(s,`;
|
||
overscroll-behavior: contain;
|
||
`).concat([t&&"position: relative ".concat(s,";"),r==="margin"&&`
|
||
padding-left: `.concat(o,`px;
|
||
padding-top: `).concat(l,`px;
|
||
padding-right: `).concat(u,`px;
|
||
margin-left:0;
|
||
margin-top:0;
|
||
margin-right: `).concat(d,"px ").concat(s,`;
|
||
`),r==="padding"&&"padding-right: ".concat(d,"px ").concat(s,";")].filter(Boolean).join(""),`
|
||
}
|
||
|
||
.`).concat(Au,` {
|
||
right: `).concat(d,"px ").concat(s,`;
|
||
}
|
||
|
||
.`).concat(Nu,` {
|
||
margin-right: `).concat(d,"px ").concat(s,`;
|
||
}
|
||
|
||
.`).concat(Au," .").concat(Au,` {
|
||
right: 0 `).concat(s,`;
|
||
}
|
||
|
||
.`).concat(Nu," .").concat(Nu,` {
|
||
margin-right: 0 `).concat(s,`;
|
||
}
|
||
|
||
body[`).concat(Bi,`] {
|
||
`).concat(JL,": ").concat(d,`px;
|
||
}
|
||
`)},Rw=function(){var e=parseInt(document.body.getAttribute(Bi)||"0",10);return isFinite(e)?e:0},g5=function(){y.useEffect(function(){return document.body.setAttribute(Bi,(Rw()+1).toString()),function(){var e=Rw()-1;e<=0?document.body.removeAttribute(Bi):document.body.setAttribute(Bi,e.toString())}},[])},v5=function(e){var t=e.noRelative,r=e.noImportant,s=e.gapMode,o=s===void 0?"margin":s;g5();var l=y.useMemo(function(){return h5(o)},[o]);return y.createElement(m5,{styles:p5(l,!t,o,r?"":"!important")})},Hm=!1;if(typeof window<"u")try{var hu=Object.defineProperty({},"passive",{get:function(){return Hm=!0,!0}});window.addEventListener("test",hu,hu),window.removeEventListener("test",hu,hu)}catch{Hm=!1}var Ti=Hm?{passive:!1}:!1,y5=function(e){return e.tagName==="TEXTAREA"},J_=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!y5(e)&&r[t]==="visible")},b5=function(e){return J_(e,"overflowY")},w5=function(e){return J_(e,"overflowX")},Tw=function(e,t){var r=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var o=Q_(e,s);if(o){var l=Z_(e,s),u=l[1],d=l[2];if(u>d)return!0}s=s.parentNode}while(s&&s!==r.body);return!1},x5=function(e){var t=e.scrollTop,r=e.scrollHeight,s=e.clientHeight;return[t,r,s]},_5=function(e){var t=e.scrollLeft,r=e.scrollWidth,s=e.clientWidth;return[t,r,s]},Q_=function(e,t){return e==="v"?b5(t):w5(t)},Z_=function(e,t){return e==="v"?x5(t):_5(t)},S5=function(e,t){return e==="h"&&t==="rtl"?-1:1},E5=function(e,t,r,s,o){var l=S5(e,window.getComputedStyle(t).direction),u=l*s,d=r.target,h=t.contains(d),m=!1,b=u>0,g=0,w=0;do{if(!d)break;var _=Z_(e,d),E=_[0],S=_[1],T=_[2],C=S-T-l*E;(E||C)&&Q_(e,d)&&(g+=C,w+=E);var A=d.parentNode;d=A&&A.nodeType===Node.DOCUMENT_FRAGMENT_NODE?A.host:A}while(!h&&d!==document.body||h&&(t.contains(d)||t===d));return(b&&Math.abs(g)<1||!b&&Math.abs(w)<1)&&(m=!0),m},mu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Aw=function(e){return[e.deltaX,e.deltaY]},Nw=function(e){return e&&"current"in e?e.current:e},C5=function(e,t){return e[0]===t[0]&&e[1]===t[1]},R5=function(e){return`
|
||
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
||
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
||
`)},T5=0,Ai=[];function A5(e){var t=y.useRef([]),r=y.useRef([0,0]),s=y.useRef(),o=y.useState(T5++)[0],l=y.useState(X_)[0],u=y.useRef(e);y.useEffect(function(){u.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var S=bN([e.lockRef.current],(e.shards||[]).map(Nw),!0).filter(Boolean);return S.forEach(function(T){return T.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),S.forEach(function(T){return T.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var d=y.useCallback(function(S,T){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!u.current.allowPinchZoom;var C=mu(S),A=r.current,N="deltaX"in S?S.deltaX:A[0]-C[0],z="deltaY"in S?S.deltaY:A[1]-C[1],F,B=S.target,P=Math.abs(N)>Math.abs(z)?"h":"v";if("touches"in S&&P==="h"&&B.type==="range")return!1;var V=window.getSelection(),re=V&&V.anchorNode,le=re?re===B||re.contains(B):!1;if(le)return!1;var ce=Tw(P,B);if(!ce)return!0;if(ce?F=P:(F=P==="v"?"h":"v",ce=Tw(P,B)),!ce)return!1;if(!s.current&&"changedTouches"in S&&(N||z)&&(s.current=F),!F)return!0;var de=s.current||F;return E5(de,T,S,de==="h"?N:z)},[]),h=y.useCallback(function(S){var T=S;if(!(!Ai.length||Ai[Ai.length-1]!==l)){var C="deltaY"in T?Aw(T):mu(T),A=t.current.filter(function(F){return F.name===T.type&&(F.target===T.target||T.target===F.shadowParent)&&C5(F.delta,C)})[0];if(A&&A.should){T.cancelable&&T.preventDefault();return}if(!A){var N=(u.current.shards||[]).map(Nw).filter(Boolean).filter(function(F){return F.contains(T.target)}),z=N.length>0?d(T,N[0]):!u.current.noIsolation;z&&T.cancelable&&T.preventDefault()}}},[]),m=y.useCallback(function(S,T,C,A){var N={name:S,delta:T,target:C,should:A,shadowParent:N5(C)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(z){return z!==N})},1)},[]),b=y.useCallback(function(S){r.current=mu(S),s.current=void 0},[]),g=y.useCallback(function(S){m(S.type,Aw(S),S.target,d(S,e.lockRef.current))},[]),w=y.useCallback(function(S){m(S.type,mu(S),S.target,d(S,e.lockRef.current))},[]);y.useEffect(function(){return Ai.push(l),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:w}),document.addEventListener("wheel",h,Ti),document.addEventListener("touchmove",h,Ti),document.addEventListener("touchstart",b,Ti),function(){Ai=Ai.filter(function(S){return S!==l}),document.removeEventListener("wheel",h,Ti),document.removeEventListener("touchmove",h,Ti),document.removeEventListener("touchstart",b,Ti)}},[]);var _=e.removeScrollBar,E=e.inert;return y.createElement(y.Fragment,null,E?y.createElement(l,{styles:R5(o)}):null,_?y.createElement(v5,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function N5(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const k5=a5(W_,A5);var Ll=y.forwardRef(function(e,t){return y.createElement(gd,xr({},e,{ref:t,sideCar:k5}))});Ll.classNames=gd.classNames;var qm=["Enter"," "],j5=["ArrowDown","PageUp","Home"],eS=["ArrowUp","PageDown","End"],O5=[...j5,...eS],M5={ltr:[...qm,"ArrowRight"],rtl:[...qm,"ArrowLeft"]},D5={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Pl="Menu",[bl,L5,P5]=wp(Pl),[Ds,tS]=oa(Pl,[P5,Ji,H_]),vd=Ji(),nS=H_(),[z5,Ls]=Ds(Pl),[U5,zl]=Ds(Pl),rS=e=>{const{__scopeMenu:t,open:r=!1,children:s,dir:o,onOpenChange:l,modal:u=!0}=e,d=vd(t),[h,m]=y.useState(null),b=y.useRef(!1),g=nr(l),w=xp(o);return y.useEffect(()=>{const _=()=>{b.current=!0,document.addEventListener("pointerdown",E,{capture:!0,once:!0}),document.addEventListener("pointermove",E,{capture:!0,once:!0})},E=()=>b.current=!1;return document.addEventListener("keydown",_,{capture:!0}),()=>{document.removeEventListener("keydown",_,{capture:!0}),document.removeEventListener("pointerdown",E,{capture:!0}),document.removeEventListener("pointermove",E,{capture:!0})}},[]),v.jsx(kp,{...d,children:v.jsx(z5,{scope:t,open:r,onOpenChange:g,content:h,onContentChange:m,children:v.jsx(U5,{scope:t,onClose:y.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:b,dir:w,modal:u,children:s})})})};rS.displayName=Pl;var I5="MenuAnchor",Mp=y.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,o=vd(r);return v.jsx(md,{...o,...s,ref:t})});Mp.displayName=I5;var Dp="MenuPortal",[$5,aS]=Ds(Dp,{forceMount:void 0}),sS=e=>{const{__scopeMenu:t,forceMount:r,children:s,container:o}=e,l=Ls(Dp,t);return v.jsx($5,{scope:t,forceMount:r,children:v.jsx(sr,{present:r||l.open,children:v.jsx(Ml,{asChild:!0,container:o,children:s})})})};sS.displayName=Dp;var Hn="MenuContent",[B5,Lp]=Ds(Hn),iS=y.forwardRef((e,t)=>{const r=aS(Hn,e.__scopeMenu),{forceMount:s=r.forceMount,...o}=e,l=Ls(Hn,e.__scopeMenu),u=zl(Hn,e.__scopeMenu);return v.jsx(bl.Provider,{scope:e.__scopeMenu,children:v.jsx(sr,{present:s||l.open,children:v.jsx(bl.Slot,{scope:e.__scopeMenu,children:u.modal?v.jsx(H5,{...o,ref:t}):v.jsx(q5,{...o,ref:t})})})})}),H5=y.forwardRef((e,t)=>{const r=Ls(Hn,e.__scopeMenu),s=y.useRef(null),o=Ye(t,s);return y.useEffect(()=>{const l=s.current;if(l)return pd(l)},[]),v.jsx(Pp,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:xe(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),q5=y.forwardRef((e,t)=>{const r=Ls(Hn,e.__scopeMenu);return v.jsx(Pp,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),V5=BL("MenuContent.ScrollLock"),Pp=y.forwardRef((e,t)=>{const{__scopeMenu:r,loop:s=!1,trapFocus:o,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:h,onEscapeKeyDown:m,onPointerDownOutside:b,onFocusOutside:g,onInteractOutside:w,onDismiss:_,disableOutsideScroll:E,...S}=e,T=Ls(Hn,r),C=zl(Hn,r),A=vd(r),N=nS(r),z=L5(r),[F,B]=y.useState(null),P=y.useRef(null),V=Ye(t,P,T.onContentChange),re=y.useRef(0),le=y.useRef(""),ce=y.useRef(0),de=y.useRef(null),ge=y.useRef("right"),me=y.useRef(0),fe=E?Ll:y.Fragment,M=E?{as:V5,allowPinchZoom:!0}:void 0,K=te=>{var J,se;const W=le.current+te,k=z().filter(ie=>!ie.disabled),j=document.activeElement,$=(J=k.find(ie=>ie.ref.current===j))==null?void 0:J.textValue,D=k.map(ie=>ie.textValue),U=n3(D,W,$),X=(se=k.find(ie=>ie.textValue===U))==null?void 0:se.ref.current;(function ie(ue){le.current=ue,window.clearTimeout(re.current),ue!==""&&(re.current=window.setTimeout(()=>ie(""),1e3))})(W),X&&setTimeout(()=>X.focus())};y.useEffect(()=>()=>window.clearTimeout(re.current),[]),cd();const Q=y.useCallback(te=>{var k,j;return ge.current===((k=de.current)==null?void 0:k.side)&&a3(te,(j=de.current)==null?void 0:j.area)},[]);return v.jsx(B5,{scope:r,searchRef:le,onItemEnter:y.useCallback(te=>{Q(te)&&te.preventDefault()},[Q]),onItemLeave:y.useCallback(te=>{var W;Q(te)||((W=P.current)==null||W.focus(),B(null))},[Q]),onTriggerLeave:y.useCallback(te=>{Q(te)&&te.preventDefault()},[Q]),pointerGraceTimerRef:ce,onPointerGraceIntentChange:y.useCallback(te=>{de.current=te},[]),children:v.jsx(fe,{...M,children:v.jsx(jl,{asChild:!0,trapped:o,onMountAutoFocus:xe(l,te=>{var W;te.preventDefault(),(W=P.current)==null||W.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:v.jsx(kl,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:m,onPointerDownOutside:b,onFocusOutside:g,onInteractOutside:w,onDismiss:_,children:v.jsx(IL,{asChild:!0,...N,dir:C.dir,orientation:"vertical",loop:s,currentTabStopId:F,onCurrentTabStopIdChange:B,onEntryFocus:xe(h,te=>{C.isUsingKeyboardRef.current||te.preventDefault()}),preventScrollOnEntryFocus:!0,children:v.jsx(jp,{role:"menu","aria-orientation":"vertical","data-state":_S(T.open),"data-radix-menu-content":"",dir:C.dir,...A,...S,ref:V,style:{outline:"none",...S.style},onKeyDown:xe(S.onKeyDown,te=>{const k=te.target.closest("[data-radix-menu-content]")===te.currentTarget,j=te.ctrlKey||te.altKey||te.metaKey,$=te.key.length===1;k&&(te.key==="Tab"&&te.preventDefault(),!j&&$&&K(te.key));const D=P.current;if(te.target!==D||!O5.includes(te.key))return;te.preventDefault();const X=z().filter(J=>!J.disabled).map(J=>J.ref.current);eS.includes(te.key)&&X.reverse(),e3(X)}),onBlur:xe(e.onBlur,te=>{te.currentTarget.contains(te.target)||(window.clearTimeout(re.current),le.current="")}),onPointerMove:xe(e.onPointerMove,wl(te=>{const W=te.target,k=me.current!==te.clientX;if(te.currentTarget.contains(W)&&k){const j=te.clientX>me.current?"right":"left";ge.current=j,me.current=te.clientX}}))})})})})})})});iS.displayName=Hn;var G5="MenuGroup",zp=y.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return v.jsx(je.div,{role:"group",...s,ref:t})});zp.displayName=G5;var F5="MenuLabel",oS=y.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return v.jsx(je.div,{...s,ref:t})});oS.displayName=F5;var Yu="MenuItem",kw="menu.itemSelect",yd=y.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:s,...o}=e,l=y.useRef(null),u=zl(Yu,e.__scopeMenu),d=Lp(Yu,e.__scopeMenu),h=Ye(t,l),m=y.useRef(!1),b=()=>{const g=l.current;if(!r&&g){const w=new CustomEvent(kw,{bubbles:!0,cancelable:!0});g.addEventListener(kw,_=>s==null?void 0:s(_),{once:!0}),p_(g,w),w.defaultPrevented?m.current=!1:u.onClose()}};return v.jsx(lS,{...o,ref:h,disabled:r,onClick:xe(e.onClick,b),onPointerDown:g=>{var w;(w=e.onPointerDown)==null||w.call(e,g),m.current=!0},onPointerUp:xe(e.onPointerUp,g=>{var w;m.current||(w=g.currentTarget)==null||w.click()}),onKeyDown:xe(e.onKeyDown,g=>{const w=d.searchRef.current!=="";r||w&&g.key===" "||qm.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});yd.displayName=Yu;var lS=y.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:s=!1,textValue:o,...l}=e,u=Lp(Yu,r),d=nS(r),h=y.useRef(null),m=Ye(t,h),[b,g]=y.useState(!1),[w,_]=y.useState("");return y.useEffect(()=>{const E=h.current;E&&_((E.textContent??"").trim())},[l.children]),v.jsx(bl.ItemSlot,{scope:r,disabled:s,textValue:o??w,children:v.jsx($L,{asChild:!0,...d,focusable:!s,children:v.jsx(je.div,{role:"menuitem","data-highlighted":b?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...l,ref:m,onPointerMove:xe(e.onPointerMove,wl(E=>{s?u.onItemLeave(E):(u.onItemEnter(E),E.defaultPrevented||E.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:xe(e.onPointerLeave,wl(E=>u.onItemLeave(E))),onFocus:xe(e.onFocus,()=>g(!0)),onBlur:xe(e.onBlur,()=>g(!1))})})})}),K5="MenuCheckboxItem",cS=y.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:s,...o}=e;return v.jsx(mS,{scope:e.__scopeMenu,checked:r,children:v.jsx(yd,{role:"menuitemcheckbox","aria-checked":Wu(r)?"mixed":r,...o,ref:t,"data-state":Ip(r),onSelect:xe(o.onSelect,()=>s==null?void 0:s(Wu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});cS.displayName=K5;var uS="MenuRadioGroup",[Y5,W5]=Ds(uS,{value:void 0,onValueChange:()=>{}}),dS=y.forwardRef((e,t)=>{const{value:r,onValueChange:s,...o}=e,l=nr(s);return v.jsx(Y5,{scope:e.__scopeMenu,value:r,onValueChange:l,children:v.jsx(zp,{...o,ref:t})})});dS.displayName=uS;var fS="MenuRadioItem",hS=y.forwardRef((e,t)=>{const{value:r,...s}=e,o=W5(fS,e.__scopeMenu),l=r===o.value;return v.jsx(mS,{scope:e.__scopeMenu,checked:l,children:v.jsx(yd,{role:"menuitemradio","aria-checked":l,...s,ref:t,"data-state":Ip(l),onSelect:xe(s.onSelect,()=>{var u;return(u=o.onValueChange)==null?void 0:u.call(o,r)},{checkForDefaultPrevented:!1})})})});hS.displayName=fS;var Up="MenuItemIndicator",[mS,X5]=Ds(Up,{checked:!1}),pS=y.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:s,...o}=e,l=X5(Up,r);return v.jsx(sr,{present:s||Wu(l.checked)||l.checked===!0,children:v.jsx(je.span,{...o,ref:t,"data-state":Ip(l.checked)})})});pS.displayName=Up;var J5="MenuSeparator",gS=y.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return v.jsx(je.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});gS.displayName=J5;var Q5="MenuArrow",vS=y.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,o=vd(r);return v.jsx(Op,{...o,...s,ref:t})});vS.displayName=Q5;var Z5="MenuSub",[iI,yS]=Ds(Z5),nl="MenuSubTrigger",bS=y.forwardRef((e,t)=>{const r=Ls(nl,e.__scopeMenu),s=zl(nl,e.__scopeMenu),o=yS(nl,e.__scopeMenu),l=Lp(nl,e.__scopeMenu),u=y.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:h}=l,m={__scopeMenu:e.__scopeMenu},b=y.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return y.useEffect(()=>b,[b]),y.useEffect(()=>{const g=d.current;return()=>{window.clearTimeout(g),h(null)}},[d,h]),v.jsx(Mp,{asChild:!0,...m,children:v.jsx(lS,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":o.contentId,"data-state":_S(r.open),...e,ref:Jt(t,o.onTriggerChange),onClick:g=>{var w;(w=e.onClick)==null||w.call(e,g),!(e.disabled||g.defaultPrevented)&&(g.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:xe(e.onPointerMove,wl(g=>{l.onItemEnter(g),!g.defaultPrevented&&!e.disabled&&!r.open&&!u.current&&(l.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),b()},100))})),onPointerLeave:xe(e.onPointerLeave,wl(g=>{var _,E;b();const w=(_=r.content)==null?void 0:_.getBoundingClientRect();if(w){const S=(E=r.content)==null?void 0:E.dataset.side,T=S==="right",C=T?-5:5,A=w[T?"left":"right"],N=w[T?"right":"left"];l.onPointerGraceIntentChange({area:[{x:g.clientX+C,y:g.clientY},{x:A,y:w.top},{x:N,y:w.top},{x:N,y:w.bottom},{x:A,y:w.bottom}],side:S}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(g),g.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:xe(e.onKeyDown,g=>{var _;const w=l.searchRef.current!=="";e.disabled||w&&g.key===" "||M5[s.dir].includes(g.key)&&(r.onOpenChange(!0),(_=r.content)==null||_.focus(),g.preventDefault())})})})});bS.displayName=nl;var wS="MenuSubContent",xS=y.forwardRef((e,t)=>{const r=aS(Hn,e.__scopeMenu),{forceMount:s=r.forceMount,...o}=e,l=Ls(Hn,e.__scopeMenu),u=zl(Hn,e.__scopeMenu),d=yS(wS,e.__scopeMenu),h=y.useRef(null),m=Ye(t,h);return v.jsx(bl.Provider,{scope:e.__scopeMenu,children:v.jsx(sr,{present:s||l.open,children:v.jsx(bl.Slot,{scope:e.__scopeMenu,children:v.jsx(Pp,{id:d.contentId,"aria-labelledby":d.triggerId,...o,ref:m,align:"start",side:u.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:b=>{var g;u.isUsingKeyboardRef.current&&((g=h.current)==null||g.focus()),b.preventDefault()},onCloseAutoFocus:b=>b.preventDefault(),onFocusOutside:xe(e.onFocusOutside,b=>{b.target!==d.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:xe(e.onEscapeKeyDown,b=>{u.onClose(),b.preventDefault()}),onKeyDown:xe(e.onKeyDown,b=>{var _;const g=b.currentTarget.contains(b.target),w=D5[u.dir].includes(b.key);g&&w&&(l.onOpenChange(!1),(_=d.trigger)==null||_.focus(),b.preventDefault())})})})})})});xS.displayName=wS;function _S(e){return e?"open":"closed"}function Wu(e){return e==="indeterminate"}function Ip(e){return Wu(e)?"indeterminate":e?"checked":"unchecked"}function e3(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function t3(e,t){return e.map((r,s)=>e[(t+s)%e.length])}function n3(e,t,r){const o=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,l=r?e.indexOf(r):-1;let u=t3(e,Math.max(l,0));o.length===1&&(u=u.filter(m=>m!==r));const h=u.find(m=>m.toLowerCase().startsWith(o.toLowerCase()));return h!==r?h:void 0}function r3(e,t){const{x:r,y:s}=e;let o=!1;for(let l=0,u=t.length-1;l<t.length;u=l++){const d=t[l],h=t[u],m=d.x,b=d.y,g=h.x,w=h.y;b>s!=w>s&&r<(g-m)*(s-b)/(w-b)+m&&(o=!o)}return o}function a3(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return r3(r,t)}function wl(e){return t=>t.pointerType==="mouse"?e(t):void 0}var s3=rS,i3=Mp,o3=sS,l3=iS,c3=zp,u3=oS,d3=yd,f3=cS,h3=dS,m3=hS,p3=pS,g3=gS,v3=vS,y3=bS,b3=xS,bd="DropdownMenu",[w3]=oa(bd,[tS]),Qt=tS(),[x3,SS]=w3(bd),ES=e=>{const{__scopeDropdownMenu:t,children:r,dir:s,open:o,defaultOpen:l,onOpenChange:u,modal:d=!0}=e,h=Qt(t),m=y.useRef(null),[b,g]=Ts({prop:o,defaultProp:l??!1,onChange:u,caller:bd});return v.jsx(x3,{scope:t,triggerId:Wt(),triggerRef:m,contentId:Wt(),open:b,onOpenChange:g,onOpenToggle:y.useCallback(()=>g(w=>!w),[g]),modal:d,children:v.jsx(s3,{...h,open:b,onOpenChange:g,dir:s,modal:d,children:r})})};ES.displayName=bd;var CS="DropdownMenuTrigger",RS=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:s=!1,...o}=e,l=SS(CS,r),u=Qt(r);return v.jsx(i3,{asChild:!0,...u,children:v.jsx(je.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...o,ref:Jt(t,l.triggerRef),onPointerDown:xe(e.onPointerDown,d=>{!s&&d.button===0&&d.ctrlKey===!1&&(l.onOpenToggle(),l.open||d.preventDefault())}),onKeyDown:xe(e.onKeyDown,d=>{s||(["Enter"," "].includes(d.key)&&l.onOpenToggle(),d.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})});RS.displayName=CS;var _3="DropdownMenuPortal",TS=e=>{const{__scopeDropdownMenu:t,...r}=e,s=Qt(t);return v.jsx(o3,{...s,...r})};TS.displayName=_3;var AS="DropdownMenuContent",NS=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=SS(AS,r),l=Qt(r),u=y.useRef(!1);return v.jsx(l3,{id:o.contentId,"aria-labelledby":o.triggerId,...l,...s,ref:t,onCloseAutoFocus:xe(e.onCloseAutoFocus,d=>{var h;u.current||(h=o.triggerRef.current)==null||h.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:xe(e.onInteractOutside,d=>{const h=d.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0,b=h.button===2||m;(!o.modal||b)&&(u.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});NS.displayName=AS;var S3="DropdownMenuGroup",E3=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=Qt(r);return v.jsx(c3,{...o,...s,ref:t})});E3.displayName=S3;var C3="DropdownMenuLabel",kS=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=Qt(r);return v.jsx(u3,{...o,...s,ref:t})});kS.displayName=C3;var R3="DropdownMenuItem",jS=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=Qt(r);return v.jsx(d3,{...o,...s,ref:t})});jS.displayName=R3;var T3="DropdownMenuCheckboxItem",OS=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=Qt(r);return v.jsx(f3,{...o,...s,ref:t})});OS.displayName=T3;var A3="DropdownMenuRadioGroup",N3=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=Qt(r);return v.jsx(h3,{...o,...s,ref:t})});N3.displayName=A3;var k3="DropdownMenuRadioItem",MS=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=Qt(r);return v.jsx(m3,{...o,...s,ref:t})});MS.displayName=k3;var j3="DropdownMenuItemIndicator",DS=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=Qt(r);return v.jsx(p3,{...o,...s,ref:t})});DS.displayName=j3;var O3="DropdownMenuSeparator",LS=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=Qt(r);return v.jsx(g3,{...o,...s,ref:t})});LS.displayName=O3;var M3="DropdownMenuArrow",D3=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=Qt(r);return v.jsx(v3,{...o,...s,ref:t})});D3.displayName=M3;var L3="DropdownMenuSubTrigger",PS=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=Qt(r);return v.jsx(y3,{...o,...s,ref:t})});PS.displayName=L3;var P3="DropdownMenuSubContent",zS=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=Qt(r);return v.jsx(b3,{...o,...s,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});zS.displayName=P3;var z3=ES,U3=RS,I3=TS,US=NS,IS=kS,$S=jS,BS=OS,HS=MS,qS=DS,VS=LS,GS=PS,FS=zS;const $3=z3,B3=U3,H3=y.forwardRef(({className:e,inset:t,children:r,...s},o)=>v.jsxs(GS,{ref:o,className:Te("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...s,children:[r,v.jsx(Yx,{className:"ml-auto"})]}));H3.displayName=GS.displayName;const q3=y.forwardRef(({className:e,...t},r)=>v.jsx(FS,{ref:r,className:Te("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-dropdown-menu-content-transform-origin)",e),...t}));q3.displayName=FS.displayName;const KS=y.forwardRef(({className:e,sideOffset:t=4,...r},s)=>v.jsx(I3,{children:v.jsx(US,{ref:s,sideOffset:t,className:Te("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-dropdown-menu-content-transform-origin)",e),...r})}));KS.displayName=US.displayName;const YS=y.forwardRef(({className:e,inset:t,...r},s)=>v.jsx($S,{ref:s,className:Te("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...r}));YS.displayName=$S.displayName;const V3=y.forwardRef(({className:e,children:t,checked:r,...s},o)=>v.jsxs(BS,{ref:o,className:Te("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...s,children:[v.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:v.jsx(qS,{children:v.jsx(Rs,{className:"h-4 w-4"})})}),t]}));V3.displayName=BS.displayName;const G3=y.forwardRef(({className:e,children:t,...r},s)=>v.jsxs(HS,{ref:s,className:Te("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[v.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:v.jsx(qS,{children:v.jsx(YO,{className:"h-2 w-2 fill-current"})})}),t]}));G3.displayName=HS.displayName;const F3=y.forwardRef(({className:e,inset:t,...r},s)=>v.jsx(IS,{ref:s,className:Te("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));F3.displayName=IS.displayName;const WS=y.forwardRef(({className:e,...t},r)=>v.jsx(VS,{ref:r,className:Te("-mx-1 my-1 h-px bg-muted",e),...t}));WS.displayName=VS.displayName;function K3(e,t=[]){let r=[];function s(l,u){const d=y.createContext(u);d.displayName=l+"Context";const h=r.length;r=[...r,u];const m=g=>{var C;const{scope:w,children:_,...E}=g,S=((C=w==null?void 0:w[e])==null?void 0:C[h])||d,T=y.useMemo(()=>E,Object.values(E));return v.jsx(S.Provider,{value:T,children:_})};m.displayName=l+"Provider";function b(g,w){var S;const _=((S=w==null?void 0:w[e])==null?void 0:S[h])||d,E=y.useContext(_);if(E)return E;if(u!==void 0)return u;throw new Error(`\`${g}\` must be used within \`${l}\``)}return[m,b]}const o=()=>{const l=r.map(u=>y.createContext(u));return function(d){const h=(d==null?void 0:d[e])||l;return y.useMemo(()=>({[`__scope${e}`]:{...d,[e]:h}}),[d,h])}};return o.scopeName=e,[s,Y3(o,...t)]}function Y3(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(l){const u=s.reduce((d,{useScope:h,scopeName:m})=>{const g=h(l)[`__scope${m}`];return{...d,...g}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}var W3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$p=W3.reduce((e,t)=>{const r=ld(`Primitive.${t}`),s=y.forwardRef((o,l)=>{const{asChild:u,...d}=o,h=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(h,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),fm={exports:{}},hm={};/**
|
||
* @license React
|
||
* use-sync-external-store-shim.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var jw;function X3(){if(jw)return hm;jw=1;var e=nd();function t(g,w){return g===w&&(g!==0||1/g===1/w)||g!==g&&w!==w}var r=typeof Object.is=="function"?Object.is:t,s=e.useState,o=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function d(g,w){var _=w(),E=s({inst:{value:_,getSnapshot:w}}),S=E[0].inst,T=E[1];return l(function(){S.value=_,S.getSnapshot=w,h(S)&&T({inst:S})},[g,_,w]),o(function(){return h(S)&&T({inst:S}),g(function(){h(S)&&T({inst:S})})},[g]),u(_),_}function h(g){var w=g.getSnapshot;g=g.value;try{var _=w();return!r(g,_)}catch{return!0}}function m(g,w){return w()}var b=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:d;return hm.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:b,hm}var Ow;function J3(){return Ow||(Ow=1,fm.exports=X3()),fm.exports}var Q3=J3();function Z3(){return Q3.useSyncExternalStore(eP,()=>!0,()=>!1)}function eP(){return()=>{}}var Bp="Avatar",[tP]=K3(Bp),[nP,XS]=tP(Bp),JS=y.forwardRef((e,t)=>{const{__scopeAvatar:r,...s}=e,[o,l]=y.useState("idle");return v.jsx(nP,{scope:r,imageLoadingStatus:o,onImageLoadingStatusChange:l,children:v.jsx($p.span,{...s,ref:t})})});JS.displayName=Bp;var QS="AvatarImage",ZS=y.forwardRef((e,t)=>{const{__scopeAvatar:r,src:s,onLoadingStatusChange:o=()=>{},...l}=e,u=XS(QS,r),d=rP(s,l),h=nr(m=>{o(m),u.onImageLoadingStatusChange(m)});return Nt(()=>{d!=="idle"&&h(d)},[d,h]),d==="loaded"?v.jsx($p.img,{...l,ref:t,src:s}):null});ZS.displayName=QS;var eE="AvatarFallback",tE=y.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:s,...o}=e,l=XS(eE,r),[u,d]=y.useState(s===void 0);return y.useEffect(()=>{if(s!==void 0){const h=window.setTimeout(()=>d(!0),s);return()=>window.clearTimeout(h)}},[s]),u&&l.imageLoadingStatus!=="loaded"?v.jsx($p.span,{...o,ref:t}):null});tE.displayName=eE;function Mw(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function rP(e,{referrerPolicy:t,crossOrigin:r}){const s=Z3(),o=y.useRef(null),l=s?(o.current||(o.current=new window.Image),o.current):null,[u,d]=y.useState(()=>Mw(l,e));return Nt(()=>{d(Mw(l,e))},[l,e]),Nt(()=>{const h=g=>()=>{d(g)};if(!l)return;const m=h("loaded"),b=h("error");return l.addEventListener("load",m),l.addEventListener("error",b),t&&(l.referrerPolicy=t),typeof r=="string"&&(l.crossOrigin=r),()=>{l.removeEventListener("load",m),l.removeEventListener("error",b)}},[l,r,t]),u}var nE=JS,rE=ZS,aE=tE;const sE=y.forwardRef(({className:e,...t},r)=>v.jsx(nE,{ref:r,className:Te("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));sE.displayName=nE.displayName;const iE=y.forwardRef(({className:e,...t},r)=>v.jsx(rE,{ref:r,className:Te("aspect-square h-full w-full",e),...t}));iE.displayName=rE.displayName;const oE=y.forwardRef(({className:e,...t},r)=>v.jsx(aE,{ref:r,className:Te("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));oE.displayName=aE.displayName;const aP=vp("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Es({className:e,variant:t,...r}){return v.jsx("div",{className:Te(aP({variant:t}),e),...r})}const sP=["Ascenda","Bacardí","Bayer","Benedicto Wong","Big Cola","BMI","Casio","CDC","Colgate","Cordiflex","Diageo","Estelar","Estrella Azul","GLM","In Drive","Mars","Microsoft","Molino Criollo","Naicom","Nestlé","P&G","Pepsico","RRHH","Taco Bell","Us Meat","Vozez","Whirlpool","Little Caesars","Intcomex","Cemix","Súper Xtra","Grupo AJE","Varios","KitchenAid","Maytag","Across","Claro","Bruni","Volt","InDrive","TrueShore","Coca Cola","Más Móvil","US Rice","Café Indio","Café Maya","Jack Daniels","GLM Digital","Compass","Starbucks","Skechers","Ron Bermudez","Nature´s Heart","Larimart","Motorola","Bajaj - Pulsar","Xelet Media","Philip Morris","Malher","Carnation","La Lechera"].sort(),Hp={CDC:"Marrero",Colombia:"J. Fernando","Costa Rica":"Poul","El Salvador":"Christian",Estelar:"Pablo",Guatemala:"Gerardo",Honduras:"Lucy",Jamaica:"Liz",Latam:"JL",Mexico:"Poul",Nicaragua:"Poul",OCI:"Liz",Panama:"Gabriel","Puerto Rico":"Liz","Republica Dominicana":"Liz",RRHH:"Maximo",Trinidad:"Liz",Venezuela:"Jose Fer",Vozez:"Nathalia","GLM Digital":"Lil",IQM:"Lil"},iP=Object.keys(Hp).sort(),oP=["Carnation","GLM RRHH","La Lechera","Malher","US Meat","Coffee Mate y Nescafé","Nestum y Nido","Whirlpool","Motorola","Philip Morris","US Meat Guatemala","KitKat, Crunch, Choco Trío","Colgate","Kit Kat","UMA","Purina","Maggi e Ideal","Nestlé","Jimador","Multimarcas","Maggi","Covo","El Machetazo","Grupo Bocel","Supply Chain","Carnation y La Lechera","GLM Administración","Nestlé Bice","GLM","Nescafé","Idea, Qué Rico y Maggi","EY","Nesquik","Maggi, Ketchup, Qué Rico","Ideal","Claro Empresas","Nido","Presto","Nestlé RD","GLM Colombia","Motorola RD","GLM Caribe","Mandino","Coffee Mate","GLM Latam","RRHH RD","Philip Morris TT","GLM RD","Smirnoff","Kaspersky","US Pork","Qué Rico y Maggi","Claro y Motorola","Sedal","Maytag","Qué Rico, Maggi y Ketchup","Multimarca","Aviva y Princesa","KitchenAid","Enredé","Ascenda","Lipton Té","Heiniken","Oral B","Aafresh","IQOS","Natures Heart"],lP=["Aprobado","No aprobado","Stand by","Aprobado /no ejecutado","Pre aprobado","On going","Sin respuesta"],Vm=[{id:"blue",name:"Azul",hex:"#4285F4"},{id:"red",name:"Rojo",hex:"#EA4335"},{id:"yellow",name:"Amarillo",hex:"#FBBC04"},{id:"green",name:"Verde",hex:"#34A853"},{id:"purple",name:"Morado",hex:"#A142F4"},{id:"teal",name:"Turquesa",hex:"#00ACC1"},{id:"orange",name:"Naranja",hex:"#FB8C00"},{id:"pink",name:"Rosa",hex:"#E91E63"},{id:"indigo",name:"Índigo",hex:"#3F51B5"},{id:"gray",name:"Gris",hex:"#5F6368"}],cP=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"];function lE(e){var t;return((t=Vm.find(r=>r.id===e))==null?void 0:t.hex)??Vm[0].hex}function uP({project:e,onClick:t}){const r=!!e.status,{isGerardo:s}=Nl(),o=l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t())};return v.jsxs("div",{role:"button",tabIndex:0,onClick:t,onKeyDown:o,className:Te("group block text-left w-full rounded-2xl bg-card overflow-hidden p-0 ring-1 ring-border cursor-pointer","transition-all duration-200 hover:-translate-y-0.5","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",r&&"opacity-65 hover:opacity-90"),style:{boxShadow:r?"0 1px 2px oklch(0.5 0.02 280 / 0.04)":"var(--shadow-soft)"},onMouseEnter:l=>{r||(l.currentTarget.style.boxShadow="var(--shadow-hover)")},onMouseLeave:l=>{l.currentTarget.style.boxShadow=r?"0 1px 2px oklch(0.5 0.02 280 / 0.04)":"var(--shadow-soft)"},children:[v.jsx("div",{className:"min-h-14 rounded-t-2xl px-4 py-3",style:{backgroundColor:r?"#9AA0A6":lE(e.color)},children:v.jsx("h3",{className:"text-white font-semibold text-sm leading-snug line-clamp-2 drop-shadow-sm",children:e.nombre||"Sin título"})}),v.jsxs("div",{className:"p-4 space-y-2.5",children:[v.jsx(pu,{icon:v.jsx(X0,{className:"w-3.5 h-3.5"}),label:"Cliente",value:e.cliente}),v.jsx(pu,{icon:v.jsx(X0,{className:"w-3.5 h-3.5"}),label:"Marca",value:e.marca}),v.jsx(pu,{icon:v.jsx(v2,{className:"w-3.5 h-3.5"}),label:"País",value:e.bu}),v.jsx(pu,{icon:v.jsx(N2,{className:"w-3.5 h-3.5"}),label:"Solicita",value:e.solicitante}),v.jsxs("div",{className:"flex items-center justify-between pt-2 mt-2 border-t border-border/70",children:[v.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-muted-foreground",children:[e.propuestaLinks.length>0&&v.jsxs("span",{className:"flex items-center gap-1",title:"Propuestas",children:[v.jsx(l2,{className:"w-3 h-3"})," ",e.propuestaLinks.length]}),e.afLinks.length>0&&v.jsxs("span",{className:"flex items-center gap-1",title:"Artes finales",children:[v.jsx(t2,{className:"w-3 h-3"})," AF·",e.afLinks.length]})]}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[s&&e.monto!=null&&v.jsxs("span",{className:"text-[11px] font-medium text-foreground/70",children:["$",e.monto.toLocaleString()]}),e.status&&v.jsxs(Es,{variant:"secondary",className:Te("text-[10px] px-1.5 py-0 h-5 font-medium",e.status==="Aprobado"&&"bg-emerald-100 text-emerald-800 hover:bg-emerald-100",e.status==="No aprobado"&&"bg-red-100 text-red-800 hover:bg-red-100"),children:[e.status==="Aprobado"&&v.jsx(FO,{className:"w-2.5 h-2.5 mr-0.5"}),e.status]})]})]})]})]})}function pu({icon:e,label:t,value:r}){return v.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[v.jsx("span",{className:"text-muted-foreground mt-0.5 flex-shrink-0",children:e}),v.jsx("span",{className:"text-muted-foreground w-14 flex-shrink-0",children:t}),v.jsx("span",{className:"text-foreground font-medium truncate",children:r||"—"})]})}function dP(e){const t=fP(e),r=y.forwardRef((s,o)=>{const{children:l,...u}=s,d=y.Children.toArray(l),h=d.find(mP);if(h){const m=h.props.children,b=d.map(g=>g===h?y.Children.count(m)>1?y.Children.only(null):y.isValidElement(m)?m.props.children:null:g);return v.jsx(t,{...u,ref:o,children:y.isValidElement(m)?y.cloneElement(m,void 0,b):null})}return v.jsx(t,{...u,ref:o,children:l})});return r.displayName=`${e}.Slot`,r}function fP(e){const t=y.forwardRef((r,s)=>{const{children:o,...l}=r;if(y.isValidElement(o)){const u=gP(o),d=pP(l,o.props);return o.type!==y.Fragment&&(d.ref=s?Jt(s,u):u),y.cloneElement(o,d)}return y.Children.count(o)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var hP=Symbol("radix.slottable");function mP(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hP}function pP(e,t){const r={...t};for(const s in t){const o=e[s],l=t[s];/^on[A-Z]/.test(s)?o&&l?r[s]=(...d)=>{const h=l(...d);return o(...d),h}:o&&(r[s]=o):s==="style"?r[s]={...o,...l}:s==="className"&&(r[s]=[o,l].filter(Boolean).join(" "))}return{...e,...r}}function gP(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var wd="Dialog",[cE]=oa(wd),[vP,ir]=cE(wd),uE=e=>{const{__scopeDialog:t,children:r,open:s,defaultOpen:o,onOpenChange:l,modal:u=!0}=e,d=y.useRef(null),h=y.useRef(null),[m,b]=Ts({prop:s,defaultProp:o??!1,onChange:l,caller:wd});return v.jsx(vP,{scope:t,triggerRef:d,contentRef:h,contentId:Wt(),titleId:Wt(),descriptionId:Wt(),open:m,onOpenChange:b,onOpenToggle:y.useCallback(()=>b(g=>!g),[b]),modal:u,children:r})};uE.displayName=wd;var dE="DialogTrigger",yP=y.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=ir(dE,r),l=Ye(t,o.triggerRef);return v.jsx(je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Gp(o.open),...s,ref:l,onClick:xe(e.onClick,o.onOpenToggle)})});yP.displayName=dE;var qp="DialogPortal",[bP,fE]=cE(qp,{forceMount:void 0}),hE=e=>{const{__scopeDialog:t,forceMount:r,children:s,container:o}=e,l=ir(qp,t);return v.jsx(bP,{scope:t,forceMount:r,children:y.Children.map(s,u=>v.jsx(sr,{present:r||l.open,children:v.jsx(Ml,{asChild:!0,container:o,children:u})}))})};hE.displayName=qp;var Xu="DialogOverlay",mE=y.forwardRef((e,t)=>{const r=fE(Xu,e.__scopeDialog),{forceMount:s=r.forceMount,...o}=e,l=ir(Xu,e.__scopeDialog);return l.modal?v.jsx(sr,{present:s||l.open,children:v.jsx(xP,{...o,ref:t})}):null});mE.displayName=Xu;var wP=dP("DialogOverlay.RemoveScroll"),xP=y.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=ir(Xu,r);return v.jsx(Ll,{as:wP,allowPinchZoom:!0,shards:[o.contentRef],children:v.jsx(je.div,{"data-state":Gp(o.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),Ns="DialogContent",pE=y.forwardRef((e,t)=>{const r=fE(Ns,e.__scopeDialog),{forceMount:s=r.forceMount,...o}=e,l=ir(Ns,e.__scopeDialog);return v.jsx(sr,{present:s||l.open,children:l.modal?v.jsx(_P,{...o,ref:t}):v.jsx(SP,{...o,ref:t})})});pE.displayName=Ns;var _P=y.forwardRef((e,t)=>{const r=ir(Ns,e.__scopeDialog),s=y.useRef(null),o=Ye(t,r.contentRef,s);return y.useEffect(()=>{const l=s.current;if(l)return pd(l)},[]),v.jsx(gE,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:xe(e.onCloseAutoFocus,l=>{var u;l.preventDefault(),(u=r.triggerRef.current)==null||u.focus()}),onPointerDownOutside:xe(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&l.preventDefault()}),onFocusOutside:xe(e.onFocusOutside,l=>l.preventDefault())})}),SP=y.forwardRef((e,t)=>{const r=ir(Ns,e.__scopeDialog),s=y.useRef(!1),o=y.useRef(!1);return v.jsx(gE,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var u,d;(u=e.onCloseAutoFocus)==null||u.call(e,l),l.defaultPrevented||(s.current||(d=r.triggerRef.current)==null||d.focus(),l.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:l=>{var h,m;(h=e.onInteractOutside)==null||h.call(e,l),l.defaultPrevented||(s.current=!0,l.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const u=l.target;((m=r.triggerRef.current)==null?void 0:m.contains(u))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&o.current&&l.preventDefault()}})}),gE=y.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:l,...u}=e,d=ir(Ns,r),h=y.useRef(null),m=Ye(t,h);return cd(),v.jsxs(v.Fragment,{children:[v.jsx(jl,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:l,children:v.jsx(kl,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":Gp(d.open),...u,ref:m,onDismiss:()=>d.onOpenChange(!1)})}),v.jsxs(v.Fragment,{children:[v.jsx(EP,{titleId:d.titleId}),v.jsx(RP,{contentRef:h,descriptionId:d.descriptionId})]})]})}),Vp="DialogTitle",vE=y.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=ir(Vp,r);return v.jsx(je.h2,{id:o.titleId,...s,ref:t})});vE.displayName=Vp;var yE="DialogDescription",bE=y.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=ir(yE,r);return v.jsx(je.p,{id:o.descriptionId,...s,ref:t})});bE.displayName=yE;var wE="DialogClose",xE=y.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=ir(wE,r);return v.jsx(je.button,{type:"button",...s,ref:t,onClick:xe(e.onClick,()=>o.onOpenChange(!1))})});xE.displayName=wE;function Gp(e){return e?"open":"closed"}var _E="DialogTitleWarning",[oI,SE]=OM(_E,{contentName:Ns,titleName:Vp,docsSlug:"dialog"}),EP=({titleId:e})=>{const t=SE(_E),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
||
|
||
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
||
|
||
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return y.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},CP="DialogDescriptionWarning",RP=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${SE(CP).contentName}}.`;return y.useEffect(()=>{var l;const o=(l=e.current)==null?void 0:l.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},EE=uE,CE=hE,Fp=mE,Kp=pE,RE=vE,TE=bE,TP=xE;const AP=EE,NP=CE,AE=y.forwardRef(({className:e,...t},r)=>v.jsx(Fp,{ref:r,className:Te("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));AE.displayName=Fp.displayName;const NE=y.forwardRef(({className:e,children:t,...r},s)=>v.jsxs(NP,{children:[v.jsx(AE,{}),v.jsxs(Kp,{ref:s,className:Te("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg",e),...r,children:[t,v.jsxs(TP,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background cursor-pointer transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[v.jsx(vl,{className:"h-4 w-4"}),v.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));NE.displayName=Kp.displayName;const kE=({className:e,...t})=>v.jsx("div",{className:Te("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});kE.displayName="DialogHeader";const jE=({className:e,...t})=>v.jsx("div",{className:Te("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});jE.displayName="DialogFooter";const OE=y.forwardRef(({className:e,...t},r)=>v.jsx(RE,{ref:r,className:Te("text-lg font-semibold leading-none tracking-tight",e),...t}));OE.displayName=RE.displayName;const ME=y.forwardRef(({className:e,...t},r)=>v.jsx(TE,{ref:r,className:Te("text-sm text-muted-foreground",e),...t}));ME.displayName=TE.displayName;var kP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],jP=kP.reduce((e,t)=>{const r=ld(`Primitive.${t}`),s=y.forwardRef((o,l)=>{const{asChild:u,...d}=o,h=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(h,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),OP="Label",DE=y.forwardRef((e,t)=>v.jsx(jP.label,{...e,ref:t,onMouseDown:r=>{var o;r.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));DE.displayName=OP;var LE=DE;const MP=vp("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),gt=y.forwardRef(({className:e,...t},r)=>v.jsx(LE,{ref:r,className:Te(MP(),e),...t}));gt.displayName=LE.displayName;const Ju=y.forwardRef(({className:e,...t},r)=>v.jsx("textarea",{className:Te("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...t}));Ju.displayName="Textarea";function PE(e){const t=y.useRef({value:e,previous:e});return y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var xd="Checkbox",[DP]=oa(xd),[LP,Yp]=DP(xd);function PP(e){const{__scopeCheckbox:t,checked:r,children:s,defaultChecked:o,disabled:l,form:u,name:d,onCheckedChange:h,required:m,value:b="on",internal_do_not_use_render:g}=e,[w,_]=Ts({prop:r,defaultProp:o??!1,onChange:h,caller:xd}),[E,S]=y.useState(null),[T,C]=y.useState(null),A=y.useRef(!1),N=E?!!u||!!E.closest("form"):!0,z={checked:w,disabled:l,setChecked:_,control:E,setControl:S,name:d,form:u,value:b,hasConsumerStoppedPropagationRef:A,required:m,defaultChecked:qa(o)?!1:o,isFormControl:N,bubbleInput:T,setBubbleInput:C};return v.jsx(LP,{scope:t,...z,children:zP(g)?g(z):s})}var zE="CheckboxTrigger",UE=y.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...s},o)=>{const{control:l,value:u,disabled:d,checked:h,required:m,setControl:b,setChecked:g,hasConsumerStoppedPropagationRef:w,isFormControl:_,bubbleInput:E}=Yp(zE,e),S=Ye(o,b),T=y.useRef(h);return y.useEffect(()=>{const C=l==null?void 0:l.form;if(C){const A=()=>g(T.current);return C.addEventListener("reset",A),()=>C.removeEventListener("reset",A)}},[l,g]),v.jsx(je.button,{type:"button",role:"checkbox","aria-checked":qa(h)?"mixed":h,"aria-required":m,"data-state":qE(h),"data-disabled":d?"":void 0,disabled:d,value:u,...s,ref:S,onKeyDown:xe(t,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:xe(r,C=>{g(A=>qa(A)?!0:!A),E&&_&&(w.current=C.isPropagationStopped(),w.current||C.stopPropagation())})})});UE.displayName=zE;var Wp=y.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:s,checked:o,defaultChecked:l,required:u,disabled:d,value:h,onCheckedChange:m,form:b,...g}=e;return v.jsx(PP,{__scopeCheckbox:r,checked:o,defaultChecked:l,disabled:d,required:u,onCheckedChange:m,name:s,form:b,value:h,internal_do_not_use_render:({isFormControl:w})=>v.jsxs(v.Fragment,{children:[v.jsx(UE,{...g,ref:t,__scopeCheckbox:r}),w&&v.jsx(HE,{__scopeCheckbox:r})]})})});Wp.displayName=xd;var IE="CheckboxIndicator",$E=y.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:s,...o}=e,l=Yp(IE,r);return v.jsx(sr,{present:s||qa(l.checked)||l.checked===!0,children:v.jsx(je.span,{"data-state":qE(l.checked),"data-disabled":l.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});$E.displayName=IE;var BE="CheckboxBubbleInput",HE=y.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:s,hasConsumerStoppedPropagationRef:o,checked:l,defaultChecked:u,required:d,disabled:h,name:m,value:b,form:g,bubbleInput:w,setBubbleInput:_}=Yp(BE,e),E=Ye(r,_),S=PE(l),T=j_(s);y.useEffect(()=>{const A=w;if(!A)return;const N=window.HTMLInputElement.prototype,F=Object.getOwnPropertyDescriptor(N,"checked").set,B=!o.current;if(S!==l&&F){const P=new Event("click",{bubbles:B});A.indeterminate=qa(l),F.call(A,qa(l)?!1:l),A.dispatchEvent(P)}},[w,S,l,o]);const C=y.useRef(qa(l)?!1:l);return v.jsx(je.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??C.current,required:d,disabled:h,name:m,value:b,form:g,...t,tabIndex:-1,ref:E,style:{...t.style,...T,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});HE.displayName=BE;function zP(e){return typeof e=="function"}function qa(e){return e==="indeterminate"}function qE(e){return qa(e)?"indeterminate":e?"checked":"unchecked"}const VE=y.forwardRef(({className:e,...t},r)=>v.jsx(Wp,{ref:r,className:Te("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow cursor-pointer focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:v.jsx($E,{className:Te("grid place-content-center text-current"),children:v.jsx(Rs,{className:"h-4 w-4"})})}));VE.displayName=Wp.displayName;function Dw(e,[t,r]){return Math.min(r,Math.max(t,e))}function UP(e){const t=IP(e),r=y.forwardRef((s,o)=>{const{children:l,...u}=s,d=y.Children.toArray(l),h=d.find(BP);if(h){const m=h.props.children,b=d.map(g=>g===h?y.Children.count(m)>1?y.Children.only(null):y.isValidElement(m)?m.props.children:null:g);return v.jsx(t,{...u,ref:o,children:y.isValidElement(m)?y.cloneElement(m,void 0,b):null})}return v.jsx(t,{...u,ref:o,children:l})});return r.displayName=`${e}.Slot`,r}function IP(e){const t=y.forwardRef((r,s)=>{const{children:o,...l}=r;if(y.isValidElement(o)){const u=qP(o),d=HP(l,o.props);return o.type!==y.Fragment&&(d.ref=s?Jt(s,u):u),y.cloneElement(o,d)}return y.Children.count(o)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $P=Symbol("radix.slottable");function BP(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$P}function HP(e,t){const r={...t};for(const s in t){const o=e[s],l=t[s];/^on[A-Z]/.test(s)?o&&l?r[s]=(...d)=>{const h=l(...d);return o(...d),h}:o&&(r[s]=o):s==="style"?r[s]={...o,...l}:s==="className"&&(r[s]=[o,l].filter(Boolean).join(" "))}return{...e,...r}}function qP(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var GE=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),VP="VisuallyHidden",GP=y.forwardRef((e,t)=>v.jsx(je.span,{...e,ref:t,style:{...GE,...e.style}}));GP.displayName=VP;var FP=[" ","Enter","ArrowUp","ArrowDown"],KP=[" ","Enter"],ks="Select",[_d,Sd,YP]=wp(ks),[Qi]=oa(ks,[YP,Ji]),Ed=Ji(),[WP,Ya]=Qi(ks),[XP,JP]=Qi(ks),FE=e=>{const{__scopeSelect:t,children:r,open:s,defaultOpen:o,onOpenChange:l,value:u,defaultValue:d,onValueChange:h,dir:m,name:b,autoComplete:g,disabled:w,required:_,form:E}=e,S=Ed(t),[T,C]=y.useState(null),[A,N]=y.useState(null),[z,F]=y.useState(!1),B=xp(m),[P,V]=Ts({prop:s,defaultProp:o??!1,onChange:l,caller:ks}),[re,le]=Ts({prop:u,defaultProp:d,onChange:h,caller:ks}),ce=y.useRef(null),de=T?E||!!T.closest("form"):!0,[ge,me]=y.useState(new Set),fe=Array.from(ge).map(M=>M.props.value).join(";");return v.jsx(kp,{...S,children:v.jsxs(WP,{required:_,scope:t,trigger:T,onTriggerChange:C,valueNode:A,onValueNodeChange:N,valueNodeHasChildren:z,onValueNodeHasChildrenChange:F,contentId:Wt(),value:re,onValueChange:le,open:P,onOpenChange:V,dir:B,triggerPointerDownPosRef:ce,disabled:w,children:[v.jsx(_d.Provider,{scope:t,children:v.jsx(XP,{scope:e.__scopeSelect,onNativeOptionAdd:y.useCallback(M=>{me(K=>new Set(K).add(M))},[]),onNativeOptionRemove:y.useCallback(M=>{me(K=>{const Q=new Set(K);return Q.delete(M),Q})},[]),children:r})}),de?v.jsxs(g1,{"aria-hidden":!0,required:_,tabIndex:-1,name:b,autoComplete:g,value:re,onChange:M=>le(M.target.value),disabled:w,form:E,children:[re===void 0?v.jsx("option",{value:""}):null,Array.from(ge)]},fe):null]})})};FE.displayName=ks;var KE="SelectTrigger",YE=y.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:s=!1,...o}=e,l=Ed(r),u=Ya(KE,r),d=u.disabled||s,h=Ye(t,u.onTriggerChange),m=Sd(r),b=y.useRef("touch"),[g,w,_]=y1(S=>{const T=m().filter(N=>!N.disabled),C=T.find(N=>N.value===u.value),A=b1(T,S,C);A!==void 0&&u.onValueChange(A.value)}),E=S=>{d||(u.onOpenChange(!0),_()),S&&(u.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return v.jsx(md,{asChild:!0,...l,children:v.jsx(je.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":v1(u.value)?"":void 0,...o,ref:h,onClick:xe(o.onClick,S=>{S.currentTarget.focus(),b.current!=="mouse"&&E(S)}),onPointerDown:xe(o.onPointerDown,S=>{b.current=S.pointerType;const T=S.target;T.hasPointerCapture(S.pointerId)&&T.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(E(S),S.preventDefault())}),onKeyDown:xe(o.onKeyDown,S=>{const T=g.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&w(S.key),!(T&&S.key===" ")&&FP.includes(S.key)&&(E(),S.preventDefault())})})})});YE.displayName=KE;var WE="SelectValue",XE=y.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:o,children:l,placeholder:u="",...d}=e,h=Ya(WE,r),{onValueNodeHasChildrenChange:m}=h,b=l!==void 0,g=Ye(t,h.onValueNodeChange);return Nt(()=>{m(b)},[m,b]),v.jsx(je.span,{...d,ref:g,style:{pointerEvents:"none"},children:v1(h.value)?v.jsx(v.Fragment,{children:u}):l})});XE.displayName=WE;var QP="SelectIcon",JE=y.forwardRef((e,t)=>{const{__scopeSelect:r,children:s,...o}=e;return v.jsx(je.span,{"aria-hidden":!0,...o,ref:t,children:s||"▼"})});JE.displayName=QP;var ZP="SelectPortal",QE=e=>v.jsx(Ml,{asChild:!0,...e});QE.displayName=ZP;var js="SelectContent",ZE=y.forwardRef((e,t)=>{const r=Ya(js,e.__scopeSelect),[s,o]=y.useState();if(Nt(()=>{o(new DocumentFragment)},[]),!r.open){const l=s;return l?Tl.createPortal(v.jsx(e1,{scope:e.__scopeSelect,children:v.jsx(_d.Slot,{scope:e.__scopeSelect,children:v.jsx("div",{children:e.children})})}),l):null}return v.jsx(t1,{...e,ref:t})});ZE.displayName=js;var Jn=10,[e1,Wa]=Qi(js),e4="SelectContentImpl",t4=UP("SelectContent.RemoveScroll"),t1=y.forwardRef((e,t)=>{const{__scopeSelect:r,position:s="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:l,onPointerDownOutside:u,side:d,sideOffset:h,align:m,alignOffset:b,arrowPadding:g,collisionBoundary:w,collisionPadding:_,sticky:E,hideWhenDetached:S,avoidCollisions:T,...C}=e,A=Ya(js,r),[N,z]=y.useState(null),[F,B]=y.useState(null),P=Ye(t,J=>z(J)),[V,re]=y.useState(null),[le,ce]=y.useState(null),de=Sd(r),[ge,me]=y.useState(!1),fe=y.useRef(!1);y.useEffect(()=>{if(N)return pd(N)},[N]),cd();const M=y.useCallback(J=>{const[se,...ie]=de().map(Se=>Se.ref.current),[ue]=ie.slice(-1),Ee=document.activeElement;for(const Se of J)if(Se===Ee||(Se==null||Se.scrollIntoView({block:"nearest"}),Se===se&&F&&(F.scrollTop=0),Se===ue&&F&&(F.scrollTop=F.scrollHeight),Se==null||Se.focus(),document.activeElement!==Ee))return},[de,F]),K=y.useCallback(()=>M([V,N]),[M,V,N]);y.useEffect(()=>{ge&&K()},[ge,K]);const{onOpenChange:Q,triggerPointerDownPosRef:te}=A;y.useEffect(()=>{if(N){let J={x:0,y:0};const se=ue=>{var Ee,Se;J={x:Math.abs(Math.round(ue.pageX)-(((Ee=te.current)==null?void 0:Ee.x)??0)),y:Math.abs(Math.round(ue.pageY)-(((Se=te.current)==null?void 0:Se.y)??0))}},ie=ue=>{J.x<=10&&J.y<=10?ue.preventDefault():N.contains(ue.target)||Q(!1),document.removeEventListener("pointermove",se),te.current=null};return te.current!==null&&(document.addEventListener("pointermove",se),document.addEventListener("pointerup",ie,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",se),document.removeEventListener("pointerup",ie,{capture:!0})}}},[N,Q,te]),y.useEffect(()=>{const J=()=>Q(!1);return window.addEventListener("blur",J),window.addEventListener("resize",J),()=>{window.removeEventListener("blur",J),window.removeEventListener("resize",J)}},[Q]);const[W,k]=y1(J=>{const se=de().filter(Ee=>!Ee.disabled),ie=se.find(Ee=>Ee.ref.current===document.activeElement),ue=b1(se,J,ie);ue&&setTimeout(()=>ue.ref.current.focus())}),j=y.useCallback((J,se,ie)=>{const ue=!fe.current&&!ie;(A.value!==void 0&&A.value===se||ue)&&(re(J),ue&&(fe.current=!0))},[A.value]),$=y.useCallback(()=>N==null?void 0:N.focus(),[N]),D=y.useCallback((J,se,ie)=>{const ue=!fe.current&&!ie;(A.value!==void 0&&A.value===se||ue)&&ce(J)},[A.value]),U=s==="popper"?Gm:n1,X=U===Gm?{side:d,sideOffset:h,align:m,alignOffset:b,arrowPadding:g,collisionBoundary:w,collisionPadding:_,sticky:E,hideWhenDetached:S,avoidCollisions:T}:{};return v.jsx(e1,{scope:r,content:N,viewport:F,onViewportChange:B,itemRefCallback:j,selectedItem:V,onItemLeave:$,itemTextRefCallback:D,focusSelectedItem:K,selectedItemText:le,position:s,isPositioned:ge,searchRef:W,children:v.jsx(Ll,{as:t4,allowPinchZoom:!0,children:v.jsx(jl,{asChild:!0,trapped:A.open,onMountAutoFocus:J=>{J.preventDefault()},onUnmountAutoFocus:xe(o,J=>{var se;(se=A.trigger)==null||se.focus({preventScroll:!0}),J.preventDefault()}),children:v.jsx(kl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:J=>J.preventDefault(),onDismiss:()=>A.onOpenChange(!1),children:v.jsx(U,{role:"listbox",id:A.contentId,"data-state":A.open?"open":"closed",dir:A.dir,onContextMenu:J=>J.preventDefault(),...C,...X,onPlaced:()=>me(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:xe(C.onKeyDown,J=>{const se=J.ctrlKey||J.altKey||J.metaKey;if(J.key==="Tab"&&J.preventDefault(),!se&&J.key.length===1&&k(J.key),["ArrowUp","ArrowDown","Home","End"].includes(J.key)){let ue=de().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);if(["ArrowUp","End"].includes(J.key)&&(ue=ue.slice().reverse()),["ArrowUp","ArrowDown"].includes(J.key)){const Ee=J.target,Se=ue.indexOf(Ee);ue=ue.slice(Se+1)}setTimeout(()=>M(ue)),J.preventDefault()}})})})})})})});t1.displayName=e4;var n4="SelectItemAlignedPosition",n1=y.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:s,...o}=e,l=Ya(js,r),u=Wa(js,r),[d,h]=y.useState(null),[m,b]=y.useState(null),g=Ye(t,P=>b(P)),w=Sd(r),_=y.useRef(!1),E=y.useRef(!0),{viewport:S,selectedItem:T,selectedItemText:C,focusSelectedItem:A}=u,N=y.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&m&&S&&T&&C){const P=l.trigger.getBoundingClientRect(),V=m.getBoundingClientRect(),re=l.valueNode.getBoundingClientRect(),le=C.getBoundingClientRect();if(l.dir!=="rtl"){const Ee=le.left-V.left,Se=re.left-Ee,et=P.left-Se,He=P.width+et,vn=Math.max(He,V.width),Zt=window.innerWidth-Jn,Gt=Dw(Se,[Jn,Math.max(Jn,Zt-vn)]);d.style.minWidth=He+"px",d.style.left=Gt+"px"}else{const Ee=V.right-le.right,Se=window.innerWidth-re.right-Ee,et=window.innerWidth-P.right-Se,He=P.width+et,vn=Math.max(He,V.width),Zt=window.innerWidth-Jn,Gt=Dw(Se,[Jn,Math.max(Jn,Zt-vn)]);d.style.minWidth=He+"px",d.style.right=Gt+"px"}const ce=w(),de=window.innerHeight-Jn*2,ge=S.scrollHeight,me=window.getComputedStyle(m),fe=parseInt(me.borderTopWidth,10),M=parseInt(me.paddingTop,10),K=parseInt(me.borderBottomWidth,10),Q=parseInt(me.paddingBottom,10),te=fe+M+ge+Q+K,W=Math.min(T.offsetHeight*5,te),k=window.getComputedStyle(S),j=parseInt(k.paddingTop,10),$=parseInt(k.paddingBottom,10),D=P.top+P.height/2-Jn,U=de-D,X=T.offsetHeight/2,J=T.offsetTop+X,se=fe+M+J,ie=te-se;if(se<=D){const Ee=ce.length>0&&T===ce[ce.length-1].ref.current;d.style.bottom="0px";const Se=m.clientHeight-S.offsetTop-S.offsetHeight,et=Math.max(U,X+(Ee?$:0)+Se+K),He=se+et;d.style.height=He+"px"}else{const Ee=ce.length>0&&T===ce[0].ref.current;d.style.top="0px";const et=Math.max(D,fe+S.offsetTop+(Ee?j:0)+X)+ie;d.style.height=et+"px",S.scrollTop=se-D+S.offsetTop}d.style.margin=`${Jn}px 0`,d.style.minHeight=W+"px",d.style.maxHeight=de+"px",s==null||s(),requestAnimationFrame(()=>_.current=!0)}},[w,l.trigger,l.valueNode,d,m,S,T,C,l.dir,s]);Nt(()=>N(),[N]);const[z,F]=y.useState();Nt(()=>{m&&F(window.getComputedStyle(m).zIndex)},[m]);const B=y.useCallback(P=>{P&&E.current===!0&&(N(),A==null||A(),E.current=!1)},[N,A]);return v.jsx(a4,{scope:r,contentWrapper:d,shouldExpandOnScrollRef:_,onScrollButtonChange:B,children:v.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:z},children:v.jsx(je.div,{...o,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});n1.displayName=n4;var r4="SelectPopperPosition",Gm=y.forwardRef((e,t)=>{const{__scopeSelect:r,align:s="start",collisionPadding:o=Jn,...l}=e,u=Ed(r);return v.jsx(jp,{...u,...l,ref:t,align:s,collisionPadding:o,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Gm.displayName=r4;var[a4,Xp]=Qi(js,{}),Fm="SelectViewport",r1=y.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:s,...o}=e,l=Wa(Fm,r),u=Xp(Fm,r),d=Ye(t,l.onViewportChange),h=y.useRef(0);return v.jsxs(v.Fragment,{children:[v.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),v.jsx(_d.Slot,{scope:r,children:v.jsx(je.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:xe(o.onScroll,m=>{const b=m.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:w}=u;if(w!=null&&w.current&&g){const _=Math.abs(h.current-b.scrollTop);if(_>0){const E=window.innerHeight-Jn*2,S=parseFloat(g.style.minHeight),T=parseFloat(g.style.height),C=Math.max(S,T);if(C<E){const A=C+_,N=Math.min(E,A),z=A-N;g.style.height=N+"px",g.style.bottom==="0px"&&(b.scrollTop=z>0?z:0,g.style.justifyContent="flex-end")}}}h.current=b.scrollTop})})})]})});r1.displayName=Fm;var a1="SelectGroup",[s4,i4]=Qi(a1),o4=y.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,o=Wt();return v.jsx(s4,{scope:r,id:o,children:v.jsx(je.div,{role:"group","aria-labelledby":o,...s,ref:t})})});o4.displayName=a1;var s1="SelectLabel",i1=y.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,o=i4(s1,r);return v.jsx(je.div,{id:o.id,...s,ref:t})});i1.displayName=s1;var Qu="SelectItem",[l4,o1]=Qi(Qu),l1=y.forwardRef((e,t)=>{const{__scopeSelect:r,value:s,disabled:o=!1,textValue:l,...u}=e,d=Ya(Qu,r),h=Wa(Qu,r),m=d.value===s,[b,g]=y.useState(l??""),[w,_]=y.useState(!1),E=Ye(t,A=>{var N;return(N=h.itemRefCallback)==null?void 0:N.call(h,A,s,o)}),S=Wt(),T=y.useRef("touch"),C=()=>{o||(d.onValueChange(s),d.onOpenChange(!1))};if(s==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return v.jsx(l4,{scope:r,value:s,disabled:o,textId:S,isSelected:m,onItemTextChange:y.useCallback(A=>{g(N=>N||((A==null?void 0:A.textContent)??"").trim())},[]),children:v.jsx(_d.ItemSlot,{scope:r,value:s,disabled:o,textValue:b,children:v.jsx(je.div,{role:"option","aria-labelledby":S,"data-highlighted":w?"":void 0,"aria-selected":m&&w,"data-state":m?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...u,ref:E,onFocus:xe(u.onFocus,()=>_(!0)),onBlur:xe(u.onBlur,()=>_(!1)),onClick:xe(u.onClick,()=>{T.current!=="mouse"&&C()}),onPointerUp:xe(u.onPointerUp,()=>{T.current==="mouse"&&C()}),onPointerDown:xe(u.onPointerDown,A=>{T.current=A.pointerType}),onPointerMove:xe(u.onPointerMove,A=>{var N;T.current=A.pointerType,o?(N=h.onItemLeave)==null||N.call(h):T.current==="mouse"&&A.currentTarget.focus({preventScroll:!0})}),onPointerLeave:xe(u.onPointerLeave,A=>{var N;A.currentTarget===document.activeElement&&((N=h.onItemLeave)==null||N.call(h))}),onKeyDown:xe(u.onKeyDown,A=>{var z;((z=h.searchRef)==null?void 0:z.current)!==""&&A.key===" "||(KP.includes(A.key)&&C(),A.key===" "&&A.preventDefault())})})})})});l1.displayName=Qu;var rl="SelectItemText",c1=y.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:o,...l}=e,u=Ya(rl,r),d=Wa(rl,r),h=o1(rl,r),m=JP(rl,r),[b,g]=y.useState(null),w=Ye(t,C=>g(C),h.onItemTextChange,C=>{var A;return(A=d.itemTextRefCallback)==null?void 0:A.call(d,C,h.value,h.disabled)}),_=b==null?void 0:b.textContent,E=y.useMemo(()=>v.jsx("option",{value:h.value,disabled:h.disabled,children:_},h.value),[h.disabled,h.value,_]),{onNativeOptionAdd:S,onNativeOptionRemove:T}=m;return Nt(()=>(S(E),()=>T(E)),[S,T,E]),v.jsxs(v.Fragment,{children:[v.jsx(je.span,{id:h.textId,...l,ref:w}),h.isSelected&&u.valueNode&&!u.valueNodeHasChildren?Tl.createPortal(l.children,u.valueNode):null]})});c1.displayName=rl;var u1="SelectItemIndicator",d1=y.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return o1(u1,r).isSelected?v.jsx(je.span,{"aria-hidden":!0,...s,ref:t}):null});d1.displayName=u1;var Km="SelectScrollUpButton",f1=y.forwardRef((e,t)=>{const r=Wa(Km,e.__scopeSelect),s=Xp(Km,e.__scopeSelect),[o,l]=y.useState(!1),u=Ye(t,s.onScrollButtonChange);return Nt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const m=h.scrollTop>0;l(m)};const h=r.viewport;return d(),h.addEventListener("scroll",d),()=>h.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),o?v.jsx(m1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=r;d&&h&&(d.scrollTop=d.scrollTop-h.offsetHeight)}}):null});f1.displayName=Km;var Ym="SelectScrollDownButton",h1=y.forwardRef((e,t)=>{const r=Wa(Ym,e.__scopeSelect),s=Xp(Ym,e.__scopeSelect),[o,l]=y.useState(!1),u=Ye(t,s.onScrollButtonChange);return Nt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const m=h.scrollHeight-h.clientHeight,b=Math.ceil(h.scrollTop)<m;l(b)};const h=r.viewport;return d(),h.addEventListener("scroll",d),()=>h.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),o?v.jsx(m1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=r;d&&h&&(d.scrollTop=d.scrollTop+h.offsetHeight)}}):null});h1.displayName=Ym;var m1=y.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:s,...o}=e,l=Wa("SelectScrollButton",r),u=y.useRef(null),d=Sd(r),h=y.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return y.useEffect(()=>()=>h(),[h]),Nt(()=>{var b;const m=d().find(g=>g.ref.current===document.activeElement);(b=m==null?void 0:m.ref.current)==null||b.scrollIntoView({block:"nearest"})},[d]),v.jsx(je.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:xe(o.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(s,50))}),onPointerMove:xe(o.onPointerMove,()=>{var m;(m=l.onItemLeave)==null||m.call(l),u.current===null&&(u.current=window.setInterval(s,50))}),onPointerLeave:xe(o.onPointerLeave,()=>{h()})})}),c4="SelectSeparator",p1=y.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return v.jsx(je.div,{"aria-hidden":!0,...s,ref:t})});p1.displayName=c4;var Wm="SelectArrow",u4=y.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,o=Ed(r),l=Ya(Wm,r),u=Wa(Wm,r);return l.open&&u.position==="popper"?v.jsx(Op,{...o,...s,ref:t}):null});u4.displayName=Wm;var d4="SelectBubbleInput",g1=y.forwardRef(({__scopeSelect:e,value:t,...r},s)=>{const o=y.useRef(null),l=Ye(s,o),u=PE(t);return y.useEffect(()=>{const d=o.current;if(!d)return;const h=window.HTMLSelectElement.prototype,b=Object.getOwnPropertyDescriptor(h,"value").set;if(u!==t&&b){const g=new Event("change",{bubbles:!0});b.call(d,t),d.dispatchEvent(g)}},[u,t]),v.jsx(je.select,{...r,style:{...GE,...r.style},ref:l,defaultValue:t})});g1.displayName=d4;function v1(e){return e===""||e===void 0}function y1(e){const t=nr(e),r=y.useRef(""),s=y.useRef(0),o=y.useCallback(u=>{const d=r.current+u;t(d),(function h(m){r.current=m,window.clearTimeout(s.current),m!==""&&(s.current=window.setTimeout(()=>h(""),1e3))})(d)},[t]),l=y.useCallback(()=>{r.current="",window.clearTimeout(s.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(s.current),[]),[r,o,l]}function b1(e,t,r){const o=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,l=r?e.indexOf(r):-1;let u=f4(e,Math.max(l,0));o.length===1&&(u=u.filter(m=>m!==r));const h=u.find(m=>m.textValue.toLowerCase().startsWith(o.toLowerCase()));return h!==r?h:void 0}function f4(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var h4=FE,w1=YE,m4=XE,p4=JE,g4=QE,x1=ZE,v4=r1,_1=i1,S1=l1,y4=c1,b4=d1,E1=f1,C1=h1,R1=p1;const w4=h4,x4=m4,T1=y.forwardRef(({className:e,children:t,...r},s)=>v.jsxs(w1,{ref:s,className:Te("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background cursor-pointer data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,v.jsx(p4,{asChild:!0,children:v.jsx(pp,{className:"h-4 w-4 opacity-50"})})]}));T1.displayName=w1.displayName;const A1=y.forwardRef(({className:e,...t},r)=>v.jsx(E1,{ref:r,className:Te("flex cursor-default items-center justify-center py-1",e),...t,children:v.jsx(HO,{className:"h-4 w-4"})}));A1.displayName=E1.displayName;const N1=y.forwardRef(({className:e,...t},r)=>v.jsx(C1,{ref:r,className:Te("flex cursor-default items-center justify-center py-1",e),...t,children:v.jsx(pp,{className:"h-4 w-4"})}));N1.displayName=C1.displayName;const k1=y.forwardRef(({className:e,children:t,position:r="popper",...s},o)=>v.jsx(g4,{children:v.jsxs(x1,{ref:o,className:Te("relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-select-content-transform-origin)",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...s,children:[v.jsx(A1,{}),v.jsx(v4,{className:Te("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),v.jsx(N1,{})]})}));k1.displayName=x1.displayName;const _4=y.forwardRef(({className:e,...t},r)=>v.jsx(_1,{ref:r,className:Te("px-2 py-1.5 text-sm font-semibold",e),...t}));_4.displayName=_1.displayName;const Xm=y.forwardRef(({className:e,children:t,...r},s)=>v.jsxs(S1,{ref:s,className:Te("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[v.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:v.jsx(b4,{children:v.jsx(Rs,{className:"h-4 w-4"})})}),v.jsx(y4,{children:t})]}));Xm.displayName=S1.displayName;const S4=y.forwardRef(({className:e,...t},r)=>v.jsx(R1,{ref:r,className:Te("-mx-1 my-1 h-px bg-muted",e),...t}));S4.displayName=R1.displayName;var E4=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],C4=E4.reduce((e,t)=>{const r=ld(`Primitive.${t}`),s=y.forwardRef((o,l)=>{const{asChild:u,...d}=o,h=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(h,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),R4="Separator",Lw="horizontal",T4=["horizontal","vertical"],j1=y.forwardRef((e,t)=>{const{decorative:r,orientation:s=Lw,...o}=e,l=A4(s)?s:Lw,d=r?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return v.jsx(C4.div,{"data-orientation":l,...d,...o,ref:t})});j1.displayName=R4;function A4(e){return T4.includes(e)}var O1=j1;const zi=y.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...s},o)=>v.jsx(O1,{ref:o,decorative:r,orientation:t,className:Te("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...s}));zi.displayName=O1.displayName;function N4({value:e,onChange:t}){return v.jsx("div",{className:"flex flex-wrap gap-2",children:Vm.map(r=>v.jsx("button",{type:"button",onClick:()=>t(r.id),title:r.name,className:Te("w-9 h-9 rounded-full flex items-center justify-center transition-all ring-offset-2 ring-offset-background hover:scale-110",e===r.id&&"ring-2 ring-foreground/40 scale-110"),style:{backgroundColor:r.hex},children:e===r.id&&v.jsx(Rs,{className:"w-4 h-4 text-white drop-shadow"})},r.id))})}function Pw({label:e,prefix:t,links:r,onChange:s,readOnly:o,emptyText:l}){const[u,d]=y.useState(""),h=()=>{const g=u.trim();g&&(s([...r,g]),d(""))},m=(g,w)=>s(r.map((_,E)=>E===g?w:_)),b=g=>s(r.filter((w,_)=>_!==g));return v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("span",{className:"text-sm font-medium text-foreground",children:[e," ",t&&v.jsxs("span",{className:"text-xs text-muted-foreground font-normal",children:["(",t,")"]})]}),v.jsx("span",{className:"text-xs text-muted-foreground",children:r.length})]}),r.length===0&&v.jsx("p",{className:"text-xs text-muted-foreground italic px-1",children:l??"Sin links aún"}),v.jsx("div",{className:"space-y-1.5",children:r.map((g,w)=>v.jsxs("div",{className:"group flex items-center gap-1.5",children:[v.jsxs("div",{className:"flex-shrink-0 w-7 h-7 rounded-md bg-accent flex items-center justify-center text-[10px] font-semibold text-accent-foreground",children:[t??"·",w+1]}),o?v.jsxs("a",{href:g,target:"_blank",rel:"noreferrer",className:"flex-1 text-sm text-primary hover:underline truncate flex items-center gap-1.5 py-1.5 px-2 rounded-md hover:bg-accent/60 transition-colors",children:[v.jsx(u2,{className:"w-3.5 h-3.5 flex-shrink-0"}),v.jsx("span",{className:"truncate",children:g}),v.jsx(ZO,{className:"w-3 h-3 flex-shrink-0 opacity-60"})]}):v.jsxs(v.Fragment,{children:[v.jsx(An,{value:g,onChange:_=>m(w,_.target.value),placeholder:"https://…",className:"h-9 text-sm"}),v.jsx(ct,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>b(w),children:v.jsx(vl,{className:"w-4 h-4"})})]})]},w))}),!o&&v.jsxs("div",{className:"flex gap-1.5 pt-1",children:[v.jsx(An,{value:u,onChange:g=>d(g.target.value),onKeyDown:g=>g.key==="Enter"&&(g.preventDefault(),h()),placeholder:"Pegar link y Enter",className:"h-9 text-sm"}),v.jsxs(ct,{type:"button",variant:"outline",size:"sm",onClick:h,className:"h-9",children:[v.jsx(gl,{className:"w-4 h-4 mr-1"})," Añadir"]})]})]})}var zw=1,k4=.9,j4=.8,O4=.17,mm=.1,pm=.999,M4=.9999,D4=.99,L4=/[\\\/_+.#"@\[\(\{&]/,P4=/[\\\/_+.#"@\[\(\{&]/g,z4=/[\s-]/,M1=/[\s-]/g;function Jm(e,t,r,s,o,l,u){if(l===t.length)return o===e.length?zw:D4;var d=`${o},${l}`;if(u[d]!==void 0)return u[d];for(var h=s.charAt(l),m=r.indexOf(h,o),b=0,g,w,_,E;m>=0;)g=Jm(e,t,r,s,m+1,l+1,u),g>b&&(m===o?g*=zw:L4.test(e.charAt(m-1))?(g*=j4,_=e.slice(o,m-1).match(P4),_&&o>0&&(g*=Math.pow(pm,_.length))):z4.test(e.charAt(m-1))?(g*=k4,E=e.slice(o,m-1).match(M1),E&&o>0&&(g*=Math.pow(pm,E.length))):(g*=O4,o>0&&(g*=Math.pow(pm,m-o))),e.charAt(m)!==t.charAt(l)&&(g*=M4)),(g<mm&&r.charAt(m-1)===s.charAt(l+1)||s.charAt(l+1)===s.charAt(l)&&r.charAt(m-1)!==s.charAt(l))&&(w=Jm(e,t,r,s,m+1,l+2,u),w*mm>g&&(g=w*mm)),g>b&&(b=g),m=r.indexOf(h,m+1);return u[d]=b,b}function Uw(e){return e.toLowerCase().replace(M1," ")}function U4(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,Jm(e,t,Uw(e),Uw(t),0,0,{})}var Jo='[cmdk-group=""]',gm='[cmdk-group-items=""]',I4='[cmdk-group-heading=""]',D1='[cmdk-item=""]',Iw=`${D1}:not([aria-disabled="true"])`,Qm="cmdk-item-select",Di="data-value",$4=(e,t,r)=>U4(e,t,r),L1=y.createContext(void 0),Ul=()=>y.useContext(L1),P1=y.createContext(void 0),Jp=()=>y.useContext(P1),z1=y.createContext(void 0),U1=y.forwardRef((e,t)=>{let r=Li(()=>{var j,$;return{search:"",value:($=(j=e.value)!=null?j:e.defaultValue)!=null?$:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=Li(()=>new Set),o=Li(()=>new Map),l=Li(()=>new Map),u=Li(()=>new Set),d=I1(e),{label:h,children:m,value:b,onValueChange:g,filter:w,shouldFilter:_,loop:E,disablePointerSelection:S=!1,vimBindings:T=!0,...C}=e,A=Wt(),N=Wt(),z=Wt(),F=y.useRef(null),B=J4();Os(()=>{if(b!==void 0){let j=b.trim();r.current.value=j,P.emit()}},[b]),Os(()=>{B(6,ge)},[]);let P=y.useMemo(()=>({subscribe:j=>(u.current.add(j),()=>u.current.delete(j)),snapshot:()=>r.current,setState:(j,$,D)=>{var U,X,J,se;if(!Object.is(r.current[j],$)){if(r.current[j]=$,j==="search")de(),le(),B(1,ce);else if(j==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ie=document.getElementById(z);ie?ie.focus():(U=document.getElementById(A))==null||U.focus()}if(B(7,()=>{var ie;r.current.selectedItemId=(ie=me())==null?void 0:ie.id,P.emit()}),D||B(5,ge),((X=d.current)==null?void 0:X.value)!==void 0){let ie=$??"";(se=(J=d.current).onValueChange)==null||se.call(J,ie);return}}P.emit()}},emit:()=>{u.current.forEach(j=>j())}}),[]),V=y.useMemo(()=>({value:(j,$,D)=>{var U;$!==((U=l.current.get(j))==null?void 0:U.value)&&(l.current.set(j,{value:$,keywords:D}),r.current.filtered.items.set(j,re($,D)),B(2,()=>{le(),P.emit()}))},item:(j,$)=>(s.current.add(j),$&&(o.current.has($)?o.current.get($).add(j):o.current.set($,new Set([j]))),B(3,()=>{de(),le(),r.current.value||ce(),P.emit()}),()=>{l.current.delete(j),s.current.delete(j),r.current.filtered.items.delete(j);let D=me();B(4,()=>{de(),(D==null?void 0:D.getAttribute("id"))===j&&ce(),P.emit()})}),group:j=>(o.current.has(j)||o.current.set(j,new Set),()=>{l.current.delete(j),o.current.delete(j)}),filter:()=>d.current.shouldFilter,label:h||e["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:A,inputId:z,labelId:N,listInnerRef:F}),[]);function re(j,$){var D,U;let X=(U=(D=d.current)==null?void 0:D.filter)!=null?U:$4;return j?X(j,r.current.search,$):0}function le(){if(!r.current.search||d.current.shouldFilter===!1)return;let j=r.current.filtered.items,$=[];r.current.filtered.groups.forEach(U=>{let X=o.current.get(U),J=0;X.forEach(se=>{let ie=j.get(se);J=Math.max(ie,J)}),$.push([U,J])});let D=F.current;fe().sort((U,X)=>{var J,se;let ie=U.getAttribute("id"),ue=X.getAttribute("id");return((J=j.get(ue))!=null?J:0)-((se=j.get(ie))!=null?se:0)}).forEach(U=>{let X=U.closest(gm);X?X.appendChild(U.parentElement===X?U:U.closest(`${gm} > *`)):D.appendChild(U.parentElement===D?U:U.closest(`${gm} > *`))}),$.sort((U,X)=>X[1]-U[1]).forEach(U=>{var X;let J=(X=F.current)==null?void 0:X.querySelector(`${Jo}[${Di}="${encodeURIComponent(U[0])}"]`);J==null||J.parentElement.appendChild(J)})}function ce(){let j=fe().find(D=>D.getAttribute("aria-disabled")!=="true"),$=j==null?void 0:j.getAttribute(Di);P.setState("value",$||void 0)}function de(){var j,$,D,U;if(!r.current.search||d.current.shouldFilter===!1){r.current.filtered.count=s.current.size;return}r.current.filtered.groups=new Set;let X=0;for(let J of s.current){let se=($=(j=l.current.get(J))==null?void 0:j.value)!=null?$:"",ie=(U=(D=l.current.get(J))==null?void 0:D.keywords)!=null?U:[],ue=re(se,ie);r.current.filtered.items.set(J,ue),ue>0&&X++}for(let[J,se]of o.current)for(let ie of se)if(r.current.filtered.items.get(ie)>0){r.current.filtered.groups.add(J);break}r.current.filtered.count=X}function ge(){var j,$,D;let U=me();U&&(((j=U.parentElement)==null?void 0:j.firstChild)===U&&((D=($=U.closest(Jo))==null?void 0:$.querySelector(I4))==null||D.scrollIntoView({block:"nearest"})),U.scrollIntoView({block:"nearest"}))}function me(){var j;return(j=F.current)==null?void 0:j.querySelector(`${D1}[aria-selected="true"]`)}function fe(){var j;return Array.from(((j=F.current)==null?void 0:j.querySelectorAll(Iw))||[])}function M(j){let $=fe()[j];$&&P.setState("value",$.getAttribute(Di))}function K(j){var $;let D=me(),U=fe(),X=U.findIndex(se=>se===D),J=U[X+j];($=d.current)!=null&&$.loop&&(J=X+j<0?U[U.length-1]:X+j===U.length?U[0]:U[X+j]),J&&P.setState("value",J.getAttribute(Di))}function Q(j){let $=me(),D=$==null?void 0:$.closest(Jo),U;for(;D&&!U;)D=j>0?W4(D,Jo):X4(D,Jo),U=D==null?void 0:D.querySelector(Iw);U?P.setState("value",U.getAttribute(Di)):K(j)}let te=()=>M(fe().length-1),W=j=>{j.preventDefault(),j.metaKey?te():j.altKey?Q(1):K(1)},k=j=>{j.preventDefault(),j.metaKey?M(0):j.altKey?Q(-1):K(-1)};return y.createElement(je.div,{ref:t,tabIndex:-1,...C,"cmdk-root":"",onKeyDown:j=>{var $;($=C.onKeyDown)==null||$.call(C,j);let D=j.nativeEvent.isComposing||j.keyCode===229;if(!(j.defaultPrevented||D))switch(j.key){case"n":case"j":{T&&j.ctrlKey&&W(j);break}case"ArrowDown":{W(j);break}case"p":case"k":{T&&j.ctrlKey&&k(j);break}case"ArrowUp":{k(j);break}case"Home":{j.preventDefault(),M(0);break}case"End":{j.preventDefault(),te();break}case"Enter":{j.preventDefault();let U=me();if(U){let X=new Event(Qm);U.dispatchEvent(X)}}}}},y.createElement("label",{"cmdk-label":"",htmlFor:V.inputId,id:V.labelId,style:Z4},h),Cd(e,j=>y.createElement(P1.Provider,{value:P},y.createElement(L1.Provider,{value:V},j))))}),B4=y.forwardRef((e,t)=>{var r,s;let o=Wt(),l=y.useRef(null),u=y.useContext(z1),d=Ul(),h=I1(e),m=(s=(r=h.current)==null?void 0:r.forceMount)!=null?s:u==null?void 0:u.forceMount;Os(()=>{if(!m)return d.item(o,u==null?void 0:u.id)},[m]);let b=$1(o,l,[e.value,e.children,l],e.keywords),g=Jp(),w=Fa(B=>B.value&&B.value===b.current),_=Fa(B=>m||d.filter()===!1?!0:B.search?B.filtered.items.get(o)>0:!0);y.useEffect(()=>{let B=l.current;if(!(!B||e.disabled))return B.addEventListener(Qm,E),()=>B.removeEventListener(Qm,E)},[_,e.onSelect,e.disabled]);function E(){var B,P;S(),(P=(B=h.current).onSelect)==null||P.call(B,b.current)}function S(){g.setState("value",b.current,!0)}if(!_)return null;let{disabled:T,value:C,onSelect:A,forceMount:N,keywords:z,...F}=e;return y.createElement(je.div,{ref:Jt(l,t),...F,id:o,"cmdk-item":"",role:"option","aria-disabled":!!T,"aria-selected":!!w,"data-disabled":!!T,"data-selected":!!w,onPointerMove:T||d.getDisablePointerSelection()?void 0:S,onClick:T?void 0:E},e.children)}),H4=y.forwardRef((e,t)=>{let{heading:r,children:s,forceMount:o,...l}=e,u=Wt(),d=y.useRef(null),h=y.useRef(null),m=Wt(),b=Ul(),g=Fa(_=>o||b.filter()===!1?!0:_.search?_.filtered.groups.has(u):!0);Os(()=>b.group(u),[]),$1(u,d,[e.value,e.heading,h]);let w=y.useMemo(()=>({id:u,forceMount:o}),[o]);return y.createElement(je.div,{ref:Jt(d,t),...l,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},r&&y.createElement("div",{ref:h,"cmdk-group-heading":"","aria-hidden":!0,id:m},r),Cd(e,_=>y.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?m:void 0},y.createElement(z1.Provider,{value:w},_))))}),q4=y.forwardRef((e,t)=>{let{alwaysRender:r,...s}=e,o=y.useRef(null),l=Fa(u=>!u.search);return!r&&!l?null:y.createElement(je.div,{ref:Jt(o,t),...s,"cmdk-separator":"",role:"separator"})}),V4=y.forwardRef((e,t)=>{let{onValueChange:r,...s}=e,o=e.value!=null,l=Jp(),u=Fa(m=>m.search),d=Fa(m=>m.selectedItemId),h=Ul();return y.useEffect(()=>{e.value!=null&&l.setState("search",e.value)},[e.value]),y.createElement(je.input,{ref:t,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":h.listId,"aria-labelledby":h.labelId,"aria-activedescendant":d,id:h.inputId,type:"text",value:o?e.value:u,onChange:m=>{o||l.setState("search",m.target.value),r==null||r(m.target.value)}})}),G4=y.forwardRef((e,t)=>{let{children:r,label:s="Suggestions",...o}=e,l=y.useRef(null),u=y.useRef(null),d=Fa(m=>m.selectedItemId),h=Ul();return y.useEffect(()=>{if(u.current&&l.current){let m=u.current,b=l.current,g,w=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let _=m.offsetHeight;b.style.setProperty("--cmdk-list-height",_.toFixed(1)+"px")})});return w.observe(m),()=>{cancelAnimationFrame(g),w.unobserve(m)}}},[]),y.createElement(je.div,{ref:Jt(l,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":s,id:h.listId},Cd(e,m=>y.createElement("div",{ref:Jt(u,h.listInnerRef),"cmdk-list-sizer":""},m)))}),F4=y.forwardRef((e,t)=>{let{open:r,onOpenChange:s,overlayClassName:o,contentClassName:l,container:u,...d}=e;return y.createElement(EE,{open:r,onOpenChange:s},y.createElement(CE,{container:u},y.createElement(Fp,{"cmdk-overlay":"",className:o}),y.createElement(Kp,{"aria-label":e.label,"cmdk-dialog":"",className:l},y.createElement(U1,{ref:t,...d}))))}),K4=y.forwardRef((e,t)=>Fa(r=>r.filtered.count===0)?y.createElement(je.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Y4=y.forwardRef((e,t)=>{let{progress:r,children:s,label:o="Loading...",...l}=e;return y.createElement(je.div,{ref:t,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},Cd(e,u=>y.createElement("div",{"aria-hidden":!0},u)))}),gn=Object.assign(U1,{List:G4,Item:B4,Input:V4,Group:H4,Separator:q4,Dialog:F4,Empty:K4,Loading:Y4});function W4(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function X4(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function I1(e){let t=y.useRef(e);return Os(()=>{t.current=e}),t}var Os=typeof window>"u"?y.useEffect:y.useLayoutEffect;function Li(e){let t=y.useRef();return t.current===void 0&&(t.current=e()),t}function Fa(e){let t=Jp(),r=()=>e(t.snapshot());return y.useSyncExternalStore(t.subscribe,r,r)}function $1(e,t,r,s=[]){let o=y.useRef(),l=Ul();return Os(()=>{var u;let d=(()=>{var m;for(let b of r){if(typeof b=="string")return b.trim();if(typeof b=="object"&&"current"in b)return b.current?(m=b.current.textContent)==null?void 0:m.trim():o.current}})(),h=s.map(m=>m.trim());l.value(e,d,h),(u=t.current)==null||u.setAttribute(Di,d),o.current=d}),o}var J4=()=>{let[e,t]=y.useState(),r=Li(()=>new Map);return Os(()=>{r.current.forEach(s=>s()),r.current=new Map},[e]),(s,o)=>{r.current.set(s,o),t({})}};function Q4(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Cd({asChild:e,children:t},r){return e&&y.isValidElement(t)?y.cloneElement(Q4(t),{ref:t.ref},r(t.props.children)):r(t)}var Z4={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Qp=y.forwardRef(({className:e,...t},r)=>v.jsx(gn,{ref:r,className:Te("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Qp.displayName=gn.displayName;const Zp=y.forwardRef(({className:e,...t},r)=>v.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[v.jsx(Bu,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),v.jsx(gn.Input,{ref:r,className:Te("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));Zp.displayName=gn.Input.displayName;const eg=y.forwardRef(({className:e,...t},r)=>v.jsx(gn.List,{ref:r,className:Te("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));eg.displayName=gn.List.displayName;const tg=y.forwardRef((e,t)=>v.jsx(gn.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));tg.displayName=gn.Empty.displayName;const ng=y.forwardRef(({className:e,...t},r)=>v.jsx(gn.Group,{ref:r,className:Te("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));ng.displayName=gn.Group.displayName;const B1=y.forwardRef(({className:e,...t},r)=>v.jsx(gn.Separator,{ref:r,className:Te("-mx-1 h-px bg-border",e),...t}));B1.displayName=gn.Separator.displayName;const Zu=y.forwardRef(({className:e,...t},r)=>v.jsx(gn.Item,{ref:r,className:Te("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));Zu.displayName=gn.Item.displayName;function ez(e){const t=tz(e),r=y.forwardRef((s,o)=>{const{children:l,...u}=s,d=y.Children.toArray(l),h=d.find(rz);if(h){const m=h.props.children,b=d.map(g=>g===h?y.Children.count(m)>1?y.Children.only(null):y.isValidElement(m)?m.props.children:null:g);return v.jsx(t,{...u,ref:o,children:y.isValidElement(m)?y.cloneElement(m,void 0,b):null})}return v.jsx(t,{...u,ref:o,children:l})});return r.displayName=`${e}.Slot`,r}function tz(e){const t=y.forwardRef((r,s)=>{const{children:o,...l}=r;if(y.isValidElement(o)){const u=sz(o),d=az(l,o.props);return o.type!==y.Fragment&&(d.ref=s?Jt(s,u):u),y.cloneElement(o,d)}return y.Children.count(o)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var nz=Symbol("radix.slottable");function rz(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===nz}function az(e,t){const r={...t};for(const s in t){const o=e[s],l=t[s];/^on[A-Z]/.test(s)?o&&l?r[s]=(...d)=>{const h=l(...d);return o(...d),h}:o&&(r[s]=o):s==="style"?r[s]={...o,...l}:s==="className"&&(r[s]=[o,l].filter(Boolean).join(" "))}return{...e,...r}}function sz(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Rd="Popover",[H1]=oa(Rd,[Ji]),Il=Ji(),[iz,Xa]=H1(Rd),q1=e=>{const{__scopePopover:t,children:r,open:s,defaultOpen:o,onOpenChange:l,modal:u=!1}=e,d=Il(t),h=y.useRef(null),[m,b]=y.useState(!1),[g,w]=Ts({prop:s,defaultProp:o??!1,onChange:l,caller:Rd});return v.jsx(kp,{...d,children:v.jsx(iz,{scope:t,contentId:Wt(),triggerRef:h,open:g,onOpenChange:w,onOpenToggle:y.useCallback(()=>w(_=>!_),[w]),hasCustomAnchor:m,onCustomAnchorAdd:y.useCallback(()=>b(!0),[]),onCustomAnchorRemove:y.useCallback(()=>b(!1),[]),modal:u,children:r})})};q1.displayName=Rd;var V1="PopoverAnchor",oz=y.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,o=Xa(V1,r),l=Il(r),{onCustomAnchorAdd:u,onCustomAnchorRemove:d}=o;return y.useEffect(()=>(u(),()=>d()),[u,d]),v.jsx(md,{...l,...s,ref:t})});oz.displayName=V1;var G1="PopoverTrigger",F1=y.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,o=Xa(G1,r),l=Il(r),u=Ye(t,o.triggerRef),d=v.jsx(je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":J1(o.open),...s,ref:u,onClick:xe(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?d:v.jsx(md,{asChild:!0,...l,children:d})});F1.displayName=G1;var rg="PopoverPortal",[lz,cz]=H1(rg,{forceMount:void 0}),K1=e=>{const{__scopePopover:t,forceMount:r,children:s,container:o}=e,l=Xa(rg,t);return v.jsx(lz,{scope:t,forceMount:r,children:v.jsx(sr,{present:r||l.open,children:v.jsx(Ml,{asChild:!0,container:o,children:s})})})};K1.displayName=rg;var Vi="PopoverContent",Y1=y.forwardRef((e,t)=>{const r=cz(Vi,e.__scopePopover),{forceMount:s=r.forceMount,...o}=e,l=Xa(Vi,e.__scopePopover);return v.jsx(sr,{present:s||l.open,children:l.modal?v.jsx(dz,{...o,ref:t}):v.jsx(fz,{...o,ref:t})})});Y1.displayName=Vi;var uz=ez("PopoverContent.RemoveScroll"),dz=y.forwardRef((e,t)=>{const r=Xa(Vi,e.__scopePopover),s=y.useRef(null),o=Ye(t,s),l=y.useRef(!1);return y.useEffect(()=>{const u=s.current;if(u)return pd(u)},[]),v.jsx(Ll,{as:uz,allowPinchZoom:!0,children:v.jsx(W1,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:xe(e.onCloseAutoFocus,u=>{var d;u.preventDefault(),l.current||(d=r.triggerRef.current)==null||d.focus()}),onPointerDownOutside:xe(e.onPointerDownOutside,u=>{const d=u.detail.originalEvent,h=d.button===0&&d.ctrlKey===!0,m=d.button===2||h;l.current=m},{checkForDefaultPrevented:!1}),onFocusOutside:xe(e.onFocusOutside,u=>u.preventDefault(),{checkForDefaultPrevented:!1})})})}),fz=y.forwardRef((e,t)=>{const r=Xa(Vi,e.__scopePopover),s=y.useRef(!1),o=y.useRef(!1);return v.jsx(W1,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var u,d;(u=e.onCloseAutoFocus)==null||u.call(e,l),l.defaultPrevented||(s.current||(d=r.triggerRef.current)==null||d.focus(),l.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:l=>{var h,m;(h=e.onInteractOutside)==null||h.call(e,l),l.defaultPrevented||(s.current=!0,l.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const u=l.target;((m=r.triggerRef.current)==null?void 0:m.contains(u))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&o.current&&l.preventDefault()}})}),W1=y.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:b,...g}=e,w=Xa(Vi,r),_=Il(r);return cd(),v.jsx(jl,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:l,children:v.jsx(kl,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:b,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:m,onDismiss:()=>w.onOpenChange(!1),children:v.jsx(jp,{"data-state":J1(w.open),role:"dialog",id:w.contentId,..._,...g,ref:t,style:{...g.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),X1="PopoverClose",hz=y.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,o=Xa(X1,r);return v.jsx(je.button,{type:"button",...s,ref:t,onClick:xe(e.onClick,()=>o.onOpenChange(!1))})});hz.displayName=X1;var mz="PopoverArrow",pz=y.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,o=Il(r);return v.jsx(Op,{...o,...s,ref:t})});pz.displayName=mz;function J1(e){return e?"open":"closed"}var gz=q1,vz=F1,yz=K1,Q1=Y1;const Z1=gz,eC=vz,ag=y.forwardRef(({className:e,align:t="center",sideOffset:r=4,...s},o)=>v.jsx(yz,{children:v.jsx(Q1,{ref:o,align:t,sideOffset:r,className:Te("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-popover-content-transform-origin)",e),...s})}));ag.displayName=Q1.displayName;function bz(e){e.preventDefault(),e.stopPropagation(),e.currentTarget.scrollTop+=e.deltaY}function Zr({value:e,options:t,onValueChange:r,placeholder:s="Seleccionar…",searchPlaceholder:o="Buscar…",emptyText:l="No hay resultados.",disabled:u=!1,clearLabel:d}){const[h,m]=y.useState(!1),b=y.useMemo(()=>t.find(g=>g===e)??e,[t,e]);return v.jsxs(Z1,{open:h,onOpenChange:m,children:[v.jsx(eC,{asChild:!0,children:v.jsxs(ct,{type:"button",variant:"outline",role:"combobox","aria-expanded":h,disabled:u,className:Te("h-10 w-full justify-between rounded-md border-border bg-background px-3 font-normal hover:bg-background",!b&&"text-muted-foreground"),children:[v.jsx("span",{className:"truncate",children:b||s}),v.jsx(Wx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),v.jsx(ag,{align:"start",className:"w-[min(92vw,560px)] min-w-[var(--radix-popover-trigger-width)] p-0",children:v.jsxs(Qp,{children:[v.jsx(Zp,{placeholder:o}),v.jsxs(eg,{className:"overscroll-contain",onWheel:bz,children:[v.jsx(tg,{children:l}),v.jsxs(ng,{children:[d&&v.jsxs(v.Fragment,{children:[v.jsxs(Zu,{value:`__clear_${d}`,onSelect:()=>{r(""),m(!1)},children:[v.jsx(Rs,{className:Te("mr-2 h-4 w-4",e?"opacity-0":"opacity-100")}),v.jsx("span",{className:"whitespace-normal break-words font-medium",children:d})]},"__clear__"),t.length>0&&v.jsx(B1,{className:"my-1"})]}),t.map(g=>v.jsxs(Zu,{value:g,onSelect:()=>{r(g),m(!1)},children:[v.jsx(Rs,{className:Te("mr-2 h-4 w-4",e===g?"opacity-100":"opacity-0")}),v.jsx("span",{className:"whitespace-normal break-words leading-snug",children:g})]},g))]})]})]})})]})}const wz=new RegExp("[\\u0000-\\u001F\\u007F-\\u009F\\u200B-\\u200D\\uFEFF]","g");function tC(e){return String(e||"").replace(wz,"").replace(/\s+/g," ").trim()}function at(e){return tC(e).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function Vt(e){const t=tC(e);return at(t)==="republica dominicana"?"Republica Dominicana":t}function dt(e){const t=new Map;for(const r of e){const s=Vt(r);if(!s)continue;const o=at(s);o&&(t.has(o)||t.set(o,s))}return Array.from(t.values())}function $w(e,t){const r=dt(e),s=Vt(t);if(!s)return r;const o=at(s);return r.some(u=>at(u)===o)?r:[s,...r]}function xz(e){e.preventDefault(),e.stopPropagation(),e.currentTarget.scrollTop+=e.deltaY}function Bw(e){return dt(e.map(t=>Vt(t)).filter(Boolean))}function Hw({values:e,options:t,onValuesChange:r,placeholder:s="Seleccionar…",searchPlaceholder:o="Buscar…",emptyText:l="No hay resultados.",disabled:u=!1,summaryLabel:d="opciones seleccionadas"}){const[h,m]=y.useState(!1),b=y.useMemo(()=>Bw(e),[e]),g=y.useMemo(()=>new Set(b.map(C=>at(C))),[b]),w=y.useMemo(()=>dt([...t,...b].map(C=>Vt(C))),[t,b]),_=y.useMemo(()=>b.length===0?"":b.length<=2?b.join(", "):`${b.length} ${d}`,[b,d]),E=C=>{r(Bw(C))},S=C=>{const A=Vt(C),N=at(A);if(g.has(N)){E(b.filter(z=>at(z)!==N));return}E([...b,A])},T=C=>{const A=at(C);E(b.filter(N=>at(N)!==A))};return v.jsxs("div",{className:"space-y-2",children:[v.jsxs(Z1,{open:h,onOpenChange:m,children:[v.jsx(eC,{asChild:!0,children:v.jsxs(ct,{type:"button",variant:"outline",role:"combobox","aria-expanded":h,disabled:u,className:Te("min-h-10 w-full justify-between rounded-md border-border bg-background px-3 font-normal hover:bg-background",!_&&"text-muted-foreground"),children:[v.jsx("span",{className:"truncate text-left",children:_||s}),v.jsx(Wx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),v.jsx(ag,{align:"start",className:"w-[var(--radix-popover-trigger-width)] p-0",children:v.jsxs(Qp,{children:[v.jsx(Zp,{placeholder:o}),v.jsxs(eg,{className:"overscroll-contain",onWheel:xz,children:[v.jsx(tg,{children:l}),v.jsx(ng,{children:w.map(C=>{const A=g.has(at(C));return v.jsxs(Zu,{value:C,onSelect:()=>S(C),children:[v.jsx(Rs,{className:Te("mr-2 h-4 w-4",A?"opacity-100":"opacity-0")}),v.jsx("span",{className:"truncate",children:C})]},C)})})]})]})})]}),b.length>0&&v.jsx("div",{className:"flex flex-wrap gap-1.5",children:b.map(C=>v.jsxs(Es,{variant:"secondary",className:"gap-1 rounded-full px-2 py-0.5",children:[v.jsx("span",{className:"max-w-[190px] truncate",children:C}),v.jsx("button",{type:"button",onClick:()=>T(C),className:"rounded-full text-muted-foreground transition-colors hover:text-foreground","aria-label":`Quitar ${C}`,children:v.jsx(vl,{className:"h-3 w-3"})})]},C))})]})}const vm=[{id:"grafico",label:"Tarifario Gráfico CDC"},{id:"estrategia",label:"Estrategia y Creatividad"}],_z="design_final_art",Sz="adaptation_final_art",$n="reference";function pe(e,t,r,s,o,l){return{id:e,label:t,reference:r,min:s,max:o,hint:l}}function hn({designHour:e="35 - 50",adaptationHour:t="30",design:r,adaptation:s}){const o=[{id:_z,label:"Diseño + Entregable Arte Final",shortLabel:"Diseño + AF",hourReference:e,levels:r}];return s!=null&&s.length&&o.push({id:Sz,label:"Adaptación Arte Final",shortLabel:"Adaptación AF",hourReference:t,levels:s}),o}const ym=[{id:"pdv-materiales-basicos",section:"grafico",category:"Materiales de PDV estándar",service:"Cenefas, habladores, danglers, rompetráficos, afiches, backings, rollups, uniformes, piezas WhatsApp/web",notes:"Incluye diseño en alta resolución, troqueles y 3 rondas de cambios. Cambios adicionales pueden agregarse como Otros.",workTypes:hn({design:[pe("basic","Básico","50 - 80",50,80),pe("intermediate","Intermedio","100 - 150",100,150),pe("advanced","Avanzado","150 - 300",150,300)],adaptation:[pe("basic","Básico","30 - 50",30,50),pe("intermediate","Intermedio","60 - 80",60,80),pe("advanced","Avanzado","100 - 150",100,150)]})},{id:"pdv-promocion-pack",section:"grafico",category:"Promoción en PDV",service:"Quick counter + roll up + mecánica de canje + uniforme (pack 3 a 5 piezas o más)",notes:"Montos por paquete de 3 a 5 piezas. Piezas o solicitudes extra deben agregarse como Otros.",workTypes:hn({design:[pe("basic","Básico","320 - 500",320,500),pe("intermediate","Intermedio","500 - 700",500,700),pe("advanced","Avanzado","800 - 1000",800,1e3)],adaptation:[pe("basic","Básico","200 - 350",200,350),pe("intermediate","Intermedio","350 - 550",350,550),pe("advanced","Avanzado","600 - 800+",600,800,"Puede superar el rango si el caso lo requiere.")]})},{id:"ooh-gigantografias",section:"grafico",category:"OOH y gigantografías",service:"Vallas, mupies y gigantografías",notes:"Los niveles están asociados a tamaño aproximado: 6m², más de 10m² y más de 20m².",workTypes:hn({design:[pe("basic","6m² aprox","250 - 350",250,350),pe("intermediate","Más 10m²","400 - 650",400,650),pe("advanced","Más de 20m²","700 - 1100",700,1100)],adaptation:[pe("basic","6m² aprox","100 - 150",100,150),pe("intermediate","Más 10m²","200 - 300",200,300),pe("advanced","Más de 20m²","400 - 600",400,600)]})},{id:"stands-muebles-exhibidores",section:"grafico",category:"Stands, muebles y exhibidores",service:"One Way, cabeceras de góndola, revestimiento de islas y displays básicos",notes:"Incluye diseño en alta resolución, troqueles y 3 rondas de cambios.",workTypes:hn({design:[pe("basic","Básico","300 - 400",300,400),pe("intermediate","Intermedio","450 - 650",450,650),pe("advanced","Avanzado","700 - 1000",700,1e3)],adaptation:[pe("basic","Básico","200 - 300",200,300),pe("intermediate","Intermedio","300 - 400",300,400),pe("advanced","Avanzado","450 - 600",450,600)]})},{id:"proyectos-especiales-muebles",section:"grafico",category:"Proyectos especiales",service:"Diseño de muebles u otros proyectos especiales con planos estructurales y troqueles desde cero",notes:"Precio por proyecto. Incluye diseño gráfico/estructural, planos, troqueles, conceptualización y 4 rondas de cambios.",workTypes:hn({design:[pe("project","Precio único","1000 - 1500",1e3,1500)],adaptation:[pe("project","Precio único","600 - 850",600,850)]})},{id:"stands-creativos-eventos",section:"grafico",category:"Proyectos especiales",service:"Stands creativos para ferias/eventos, montaje de eventos especiales y diseños de espacios especiales",notes:"Precio por proyecto. Incluye stand creativo, planos estructurales, visualizaciones 3D y 4 rondas de cambios.",workTypes:hn({design:[pe("project","Precio único","1500 - 3000",1500,3e3)],adaptation:[pe("project","Precio único","800 - 1200",800,1200)]})},{id:"empaque-simple",section:"grafico",category:"Diseño de empaques",service:"Empaque simple",notes:"Diseño gráfico original para empaques simples sin troqueles complejos.",workTypes:hn({design:[pe("project","Precio único","700 - 1000",700,1e3)],adaptation:[pe("project","Adaptación / SKU","100 - 300",100,300)]})},{id:"empaque-complejo",section:"grafico",category:"Diseño de empaques",service:"Empaque complejo",notes:"Diseño gráfico y estructural para empaques con troqueles personalizados o formas no convencionales.",workTypes:hn({design:[pe("project","Precio único","1000 - 1500",1e3,1500)],adaptation:[pe("project","Adaptación / SKU","100 - 300",100,300)]})},{id:"brochures",section:"grafico",category:"Catálogos, brochures y folletos",service:"Brochures",notes:"Incluye diseño y 3 rondas de cambios.",workTypes:hn({design:[pe("basic","Básico","200 - 400",200,400),pe("intermediate","Intermedio","400 - 600",400,600),pe("advanced","Avanzado","600 - 800",600,800)],adaptation:[pe("basic","Básico","50 - 100",50,100),pe("intermediate","Intermedio","100 - 150",100,150),pe("advanced","Avanzado","150 - 350",150,350)]})},{id:"catalogos-folletos-pagina",section:"grafico",category:"Catálogos, brochures y folletos",service:"Catálogos y folletos (costo por página)",notes:"Costo por página. Incluye diseño y 3 rondas de cambios.",workTypes:hn({design:[pe("basic","Básico","30 - 60",30,60),pe("intermediate","Intermedio","60 - 90",60,90),pe("advanced","Avanzado","90 - 120",90,120)],adaptation:[pe("basic","Básico","15 - 30",15,30),pe("intermediate","Intermedio","30 - 60",30,60),pe("advanced","Avanzado","60 - 100",60,100)]})},{id:"web-landing",section:"grafico",category:"Páginas web",service:"Landing page o sitio simple hasta 5 páginas",notes:"Sitio web básico con diseño estático, contenido del cliente y hasta 2 rondas de cambios.",workTypes:[{id:$n,label:"Diseño web",shortLabel:"Web",hourReference:"35 - 50",levels:[pe("project","Precio único","800 - 1500",800,1500)]}]},{id:"web-intermedio",section:"grafico",category:"Páginas web",service:"Sitio corporativo intermedio de 6 a 15 páginas",notes:"Sitio mediano con páginas adicionales y diseño más personalizado. Hasta 3 rondas de cambios.",workTypes:[{id:$n,label:"Diseño web",shortLabel:"Web",hourReference:"35 - 50",levels:[pe("project","Precio único","2000 - 5000",2e3,5e3)]}]},{id:"web-avanzado",section:"grafico",category:"Páginas web",service:"Sitio avanzado: más de 15 páginas, interactividad o integraciones complejas",notes:"Incluye desarrollo a medida y hasta 5 rondas de cambios.",workTypes:[{id:$n,label:"Diseño web",shortLabel:"Web",hourReference:"36 - 50",levels:[pe("project","Precio único","4000 - 8000",4e3,8e3)]}]},{id:"retoques-fotograficos",section:"grafico",category:"Otros servicios",service:"Retoques fotográficos",notes:"Incluye 2 rondas de ajustes.",workTypes:hn({design:[pe("basic","Básico","20 - 40",20,40),pe("intermediate","Intermedio","50 - 100",50,100),pe("advanced","Avanzado","150 - 300",150,300)],adaptation:void 0})},{id:"videos",section:"grafico",category:"Otros servicios",service:"Videos",notes:"Referencia por complejidad del video.",workTypes:hn({designHour:"35 - 50",design:[pe("basic","Básico","100 - 250",100,250),pe("intermediate","Intermedio","250 - 500",250,500),pe("advanced","Avanzado","500 - 1200",500,1200)]})},{id:"copy-puntual",section:"grafico",category:"Otros servicios",service:"Copy puntual para ADS, tarjetas o comunicaciones sueltas",notes:"Solo copy puntual. Si requiere concepto, presupuestar según proyecto/hora hombre.",workTypes:hn({designHour:"1 - 25",design:[pe("basic","Básico","100",100,100),pe("intermediate","Intermedio","100 - 200",100,200),pe("advanced","Avanzado","200 - 500",200,500)]})},{id:"render-sencillo",section:"grafico",category:"Otros servicios",service:"Render sencillo de 1 solo plano por unidad",notes:"No aplica para eventos donde hay que conceptualizar el ambiente total.",workTypes:hn({designHour:"1 - 50",design:[pe("basic","Básico","100",100,100),pe("intermediate","Intermedio","100 - 150",100,150),pe("advanced","Avanzado","150 - 300",150,300)]})},{id:"carnets",section:"grafico",category:"Otros servicios",service:"Carnets",notes:"Referencia especial: diseño base + réplicas. El Director Creativo calcula y escribe el monto final manualmente.",workTypes:[{id:$n,label:"Referencia manual",shortLabel:"Manual",levels:[pe("base","Diseño base","20 base",20,20),pe("replica","Réplicas","5 por réplica",5,5)]}]},{id:"identidad-basica",section:"estrategia",category:"Desarrollo de Identidad Gráfica para Marca",service:"Desarrollo básico para pequeñas marcas o emprendimientos",notes:"Incluye logo, paleta, tipografía, identidad visual básica, hasta 2 conceptos y 3 rondas de cambios.",workTypes:[{id:$n,label:"Tarifa fija",shortLabel:"Fija",levels:[pe("project","Básico","2000 - 4000",2e3,4e3)]}]},{id:"identidad-intermedia",section:"estrategia",category:"Desarrollo de Identidad Gráfica para Marca",service:"Desarrollo intermedio para marcas medianas",notes:"Incluye nombre si aplica, logotipo, paleta, tipografía, key visuals y manual de marca detallado.",workTypes:[{id:$n,label:"Tarifa fija",shortLabel:"Fija",levels:[pe("project","Intermedio","4000 - 8000",4e3,8e3)]}]},{id:"identidad-avanzada",section:"estrategia",category:"Desarrollo de Identidad Gráfica para Marca",service:"Desarrollo avanzado para grandes marcas o redes",notes:"Identidad visual robusta con aplicaciones de marca, investigación, key visuals y manual exhaustivo.",workTypes:[{id:$n,label:"Tarifa fija",shortLabel:"Fija",levels:[pe("project","Avanzado","8000 - 15000 o más",8e3,15e3)]}]},{id:"campana-key-visual-basica",section:"estrategia",category:"Desarrollo de Campaña Creativa",service:"Concepto y Key Visual básico para campañas pequeñas",notes:"Concepto creativo básico, key visual, línea gráfica y eslogan con aplicaciones limitadas.",workTypes:[{id:$n,label:"Tarifa fija",shortLabel:"Fija",levels:[pe("project","Básico","2000 - 3000",2e3,3e3)]}]},{id:"campana-creativa-intermedia",section:"estrategia",category:"Desarrollo de Campaña Creativa",service:"Campaña creativa intermedia para lanzamientos medianos",notes:"Concepto creativo completo, key visuals, eslogan y piezas para distintos medios.",workTypes:[{id:$n,label:"Tarifa fija",shortLabel:"Fija",levels:[pe("project","Intermedio","3000 - 5000",3e3,5e3)]}]},{id:"campana-creativa-avanzada",section:"estrategia",category:"Desarrollo de Campaña Creativa",service:"Campaña creativa avanzada para lanzamientos grandes",notes:"Desarrollo estratégico y creativo de campaña grande con insights, key visuals y múltiples piezas.",workTypes:[{id:$n,label:"Tarifa fija",shortLabel:"Fija",levels:[pe("project","Avanzado","5000 - 8000 o más",5e3,8e3)]}]},{id:"consultoria-estrategica",section:"estrategia",category:"Desarrollo Estratégico y Conceptual",service:"Consultoría estratégica y desarrollo de concepto",notes:"Investigación de mercado, análisis de competencia, concepto estratégico y alineación con objetivos del cliente.",workTypes:[{id:$n,label:"Tarifa fija o por hora",shortLabel:"Referencia",levels:[pe("project","Por proyecto","1500 - 3000",1500,3e3),pe("hour","Por hora","100 - 200 por hora",100,200)]}]},{id:"rondas-adicionales-estrategia",section:"estrategia",category:"Adicionales estratégicos",service:"Rondas adicionales de cambios",notes:"Referencia para trabajo adicional en estrategia o creatividad.",workTypes:[{id:$n,label:"Por hora",shortLabel:"Hora",levels:[pe("hour","Por hora","50 - 150 por hora",50,150)]}]}];function qw(e){return e?e.reference:""}function gu(e){return e&&typeof e.min=="number"&&typeof e.max=="number"?String((e.min===e.max,e.min)):""}function vu(e){const t=Number(e.replace(/,/g,"").trim());return Number.isFinite(t)?t:0}function bm(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(e||0)}function Ez(e){return(e==null?void 0:e.workTypes[0])||null}function Vw(e){return(e==null?void 0:e.levels[0])||null}function wm(e){return e.trim()}function Cz({items:e,onChange:t,loading:r,error:s}){var $;const[o,l]=y.useState("grafico"),[u,d]=y.useState(""),[h,m]=y.useState(""),[b,g]=y.useState(""),[w,_]=y.useState(""),[E,S]=y.useState(""),[T,C]=y.useState(""),[A,N]=y.useState(""),[z,F]=y.useState(""),B=vm.map(D=>D.label),P=(($=vm.find(D=>D.id===o))==null?void 0:$.label)||"",V=y.useMemo(()=>ym.filter(D=>D.section===o).map(D=>`${D.category} · ${D.service}`),[o]),re=y.useMemo(()=>{const D=u;return ym.find(U=>U.section===o&&`${U.category} · ${U.service}`===D)||null},[o,u]),le=y.useMemo(()=>re&&re.workTypes.find(D=>D.id===h)||null,[re,h]),ce=y.useMemo(()=>le&&le.levels.find(D=>D.id===b)||null,[le,b]),de=e.reduce((D,U)=>D+Number(U.amount||0),0),ge=()=>{d(""),m(""),g(""),_(""),S("")},me=D=>{const U=vm.find(X=>X.label===D);l((U==null?void 0:U.id)||"grafico"),ge()},fe=D=>{d(D);const U=ym.find(se=>se.section===o&&`${se.category} · ${se.service}`===D),X=Ez(U),J=Vw(X);m((X==null?void 0:X.id)||""),g((J==null?void 0:J.id)||""),_(gu(J)),S("")},M=D=>{if(!re)return;const U=re.workTypes.find(J=>J.label===D),X=Vw(U);m((U==null?void 0:U.id)||""),g((X==null?void 0:X.id)||""),_(gu(X))},K=D=>{if(!le)return;const U=le.levels.find(X=>X.label===D);g((U==null?void 0:U.id)||""),_(gu(U))},Q=()=>{if(!re||!le||!ce)return;const D=vu(w);D<=0||(t([...e,{source:"tariff",category:re.category,serviceName:re.service,workType:le.label,complexityLevel:ce.label,referenceLabel:qw(ce),referenceMin:ce.min??null,referenceMax:ce.max??null,amount:D,description:wm(E)}]),S(""),_(gu(ce)))},te=()=>{const D=vu(z),U=wm(T)||"Otros / costo manual";D<=0||(t([...e,{source:"manual",category:"Otros",serviceName:U,workType:"Manual",complexityLevel:"",referenceLabel:"Monto manual",referenceMin:null,referenceMax:null,amount:D,description:wm(A)}]),C(""),N(""),F(""))},W=D=>{t(e.filter((U,X)=>X!==D))},k=(le==null?void 0:le.label)||"",j=(ce==null?void 0:ce.label)||"";return v.jsxs("div",{className:"md:col-span-2 rounded-2xl border border-border bg-muted/20 p-4",children:[v.jsxs("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[v.jsxs("div",{className:"flex items-start gap-2.5",children:[v.jsx("span",{className:"mt-0.5 flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 text-primary",children:v.jsx(MO,{className:"h-4 w-4"})}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-sm font-semibold",children:"Tarifario / Estimación interna"}),v.jsx("p",{className:"text-xs text-muted-foreground",children:"Agrega costos del tarifario o montos manuales. El total se guarda como Interno Cargado."})]})]}),v.jsxs("div",{className:"rounded-full border border-primary/20 bg-primary/10 px-3 py-1 text-sm font-semibold text-primary",children:["Total: ",bm(de)]})]}),s&&v.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-xl border border-amber-300/50 bg-amber-50 px-3 py-2 text-xs text-amber-900",children:[v.jsx(s2,{className:"mt-0.5 h-3.5 w-3.5 flex-shrink-0"}),v.jsx("span",{children:s})]}),r&&v.jsx("div",{className:"mb-3 rounded-xl border border-border bg-card px-3 py-2 text-xs text-muted-foreground",children:"Cargando costos guardados…"}),v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"space-y-4 rounded-xl border border-border bg-card p-4",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("div",{children:[v.jsx("p",{className:"text-sm font-medium",children:"Agregar desde tarifario"}),v.jsx("p",{className:"text-xs text-muted-foreground",children:"Referencia flexible. El Director Creativo decide el monto final."})]}),v.jsx(Es,{variant:"secondary",children:"Tarifario"})]}),v.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(gt,{children:"Sección"}),v.jsx(Zr,{value:P,options:B,onValueChange:me,placeholder:"Seleccionar sección…",searchPlaceholder:"Buscar sección…"})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(gt,{children:"Ítem a cobrar"}),v.jsx(Zr,{value:u,options:V,onValueChange:fe,placeholder:"Seleccionar ítem…",searchPlaceholder:"Buscar ítem…",emptyText:"No se encontró ese ítem."})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(gt,{children:"Tipo de trabajo"}),v.jsx(Zr,{value:k,options:(re==null?void 0:re.workTypes.map(D=>D.label))||[],onValueChange:M,placeholder:"Seleccionar tipo…",searchPlaceholder:"Buscar tipo…",disabled:!re})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(gt,{children:"Nivel / referencia"}),v.jsx(Zr,{value:j,options:(le==null?void 0:le.levels.map(D=>D.label))||[],onValueChange:K,placeholder:"Seleccionar nivel…",searchPlaceholder:"Buscar nivel…",disabled:!le})]})]}),re&&le&&ce&&v.jsxs("div",{className:"rounded-xl border border-dashed border-border bg-muted/40 px-3 py-2 text-xs text-muted-foreground",children:[v.jsxs("p",{children:[v.jsx("span",{className:"font-medium text-foreground",children:"Referencia:"})," ",qw(ce)," USD",le.hourReference?` · Hora hombre ref.: ${le.hourReference}`:""]}),re.notes&&v.jsx("p",{className:"mt-1",children:re.notes}),ce.hint&&v.jsx("p",{className:"mt-1",children:ce.hint})]}),v.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-[220px_minmax(0,1fr)]",children:[v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(gt,{children:"Monto final"}),v.jsx(An,{type:"number",min:"0",step:"0.01",value:w,onChange:D=>_(D.target.value),placeholder:"0.00",disabled:!ce})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(gt,{children:"Observación"}),v.jsx(Ju,{value:E,onChange:D=>S(D.target.value),placeholder:"Ej: más rondas de cambios, piezas adicionales, complejidad especial…",disabled:!ce,rows:5,className:"min-h-[132px] resize-y"})]})]}),v.jsx("div",{className:"flex justify-end",children:v.jsxs(ct,{type:"button",onClick:Q,disabled:!re||!le||!ce||vu(w)<=0,className:"gap-1.5 rounded-full",children:[v.jsx(gl,{className:"h-4 w-4"}),"Agregar tarifa"]})})]}),v.jsxs("div",{className:"space-y-4 rounded-xl border border-border bg-card p-4",children:[v.jsxs("div",{children:[v.jsx("p",{className:"text-sm font-medium",children:"Agregar costo manual"}),v.jsx("p",{className:"text-xs text-muted-foreground",children:"Para otros, adicionales o casos fuera del tarifario."})]}),v.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-[minmax(0,1fr)_220px]",children:[v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(gt,{children:"Nombre"}),v.jsx(An,{value:T,onChange:D=>C(D.target.value),placeholder:"Ej: Piezas adicionales"})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(gt,{children:"Monto"}),v.jsx(An,{type:"number",min:"0",step:"0.01",value:z,onChange:D=>F(D.target.value),placeholder:"0.00"})]})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(gt,{children:"Descripción"}),v.jsx(Ju,{value:A,onChange:D=>N(D.target.value),placeholder:"Ej: Cliente pidió 8 piezas adicionales fuera del paquete.",rows:4,className:"min-h-[110px] resize-y"})]}),v.jsx("div",{className:"flex justify-end",children:v.jsxs(ct,{type:"button",variant:"outline",onClick:te,disabled:vu(z)<=0,className:"w-full gap-1.5 rounded-full sm:w-auto sm:min-w-[240px]",children:[v.jsx(gl,{className:"h-4 w-4"}),"Agregar costo manual"]})})]})]}),v.jsx(zi,{className:"my-4"}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsx("p",{className:"text-sm font-medium",children:"Costos agregados"}),v.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.length," línea(s)"]})]}),e.length===0?v.jsx("div",{className:"rounded-xl border border-dashed border-border bg-card/70 px-3 py-3 text-sm text-muted-foreground",children:"Aún no hay costos agregados. Puedes usar el tarifario, agregar otros manuales o ambos."}):v.jsxs("div",{className:"space-y-2",children:[e.map((D,U)=>v.jsxs("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card px-3 py-3 sm:flex-row sm:items-start sm:justify-between",children:[v.jsxs("div",{className:"min-w-0 flex-1",children:[v.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[v.jsx(Es,{variant:D.source==="manual"?"outline":"secondary",children:D.source==="manual"?"Manual":"Tarifario"}),v.jsx("p",{className:"text-sm font-medium",children:D.serviceName})]}),v.jsxs("div",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[D.category&&v.jsx("span",{children:D.category}),D.workType&&v.jsx("span",{children:D.workType}),D.complexityLevel&&v.jsx("span",{children:D.complexityLevel}),D.referenceLabel&&v.jsxs("span",{children:["Ref.: ",D.referenceLabel]})]}),D.description&&v.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:D.description})]}),v.jsxs("div",{className:"flex items-center justify-between gap-3 sm:flex-col sm:items-end",children:[v.jsx("p",{className:"text-sm font-semibold text-foreground",children:bm(Number(D.amount||0))}),v.jsxs(ct,{type:"button",variant:"ghost",size:"sm",onClick:()=>W(U),className:Te("h-8 rounded-full px-2 text-muted-foreground hover:text-destructive"),children:[v.jsx(Jx,{className:"mr-1 h-3.5 w-3.5"}),"Quitar"]})]})]},`${D.source}-${D.serviceName}-${U}`)),v.jsxs("div",{className:"flex items-center justify-end gap-2 rounded-xl bg-primary/10 px-3 py-2 text-primary",children:[v.jsx(Xx,{className:"h-4 w-4"}),v.jsxs("span",{className:"text-sm font-semibold",children:["Total interno estimado: ",bm(de)]})]})]})]})]})}const Ui={clientes:sP,marcas:oP,bus:iP,buCm:Hp,status:[...lP]};let ku=[],Zm=Ui,xl=!1,nC=!1,sg=null,ol=null,_s=null,yu=0;function ep(){ku.forEach(e=>e())}function Pa(e){return dt(e)}function Rz(e){return String(e||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim()}function Tz(e){const t=Rz(e);return["client","clients","cliente","clientes"].includes(t)?"client":["brand","brands","marca","marcas"].includes(t)?"brand":["country","countries","pais","paises","bu","business_unit","business unit"].includes(t)?"country":["status","estatus","estado","estados"].includes(t)?"status":["country_manager","country manager","cm","bu_cm","bu cm","manager","managers"].includes(t)?"country_manager":t}function Az(e){return Vt(String(e.label||e.value||""))}function Nz(e){const t=[],r=[],s=[],o=[],l={...Hp};for(const u of e){if(u.is_active===!1)continue;const d=Tz(u.category),h=Az(u),m=Vt(String(u.value||""));if(!(!h&&!m)&&(d==="client"&&t.push(h||m),d==="brand"&&r.push(h||m),d==="country"&&s.push(h||m),d==="status"&&o.push(h||m),d==="country_manager"&&m)){const b=h||m;b&&b!==m&&(l[m]=b)}}return{clientes:t.length?Pa(t):Pa(Ui.clientes),marcas:r.length?Pa(r):Pa(Ui.marcas),bus:s.length?Pa(s):Pa(Ui.bus),buCm:l,status:o.length?Pa(o):Pa(Ui.status)}}function kz(e){sg=e,ep()}async function tp(){xl=!0,kz(null),ep();try{const{data:e,error:t}=await nt.from("tablero_cdc_app_lists").select("category, value, label, sort_order, is_active").eq("is_active",!0).order("category",{ascending:!0}).order("sort_order",{ascending:!0}).order("label",{ascending:!0});if(t)throw t;Zm=Nz(e||[]),nC=!0}catch(e){console.error("Error cargando listas desde Supabase:",e),sg=e instanceof Error?e.message:"No se pudieron cargar los desplegables desde Supabase.",Zm=Ui}finally{xl=!1,ep()}}function jz(){_s&&clearTimeout(_s),_s=setTimeout(()=>{_s=null,xl||tp()},350)}function Oz(){ol||(ol=nt.channel("tablero-cdc-app-lists").on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_app_lists"},()=>jz()).subscribe(e=>{(e==="CHANNEL_ERROR"||e==="TIMED_OUT")&&console.warn("Supabase Realtime no pudo suscribirse a tablero_cdc_app_lists:",e)}))}function Mz(){_s&&(clearTimeout(_s),_s=null),ol&&(nt.removeChannel(ol),ol=null)}function rC(){const[,e]=y.useState(0);return y.useEffect(()=>{const t=()=>e(r=>r+1);return ku.push(t),yu+=1,Oz(),!nC&&!xl&&tp(),()=>{ku=ku.filter(r=>r!==t),yu=Math.max(0,yu-1),yu===0&&Mz()}},[]),{lists:Zm,loading:xl,error:sg,refresh:tp}}const aC="blue",Td="Activo",ig="gmarrero@gomezleemarketing.com",Dz=[ig,"areyes@gomezleemarketing.com","iaracena@gomezleemarketing.com"],Lz=[ig,"areyes@gomezleemarketing.com","iaracena@gomezleemarketing.com"],Xr={tab:"todos",search:"",page:1,pageSize:24,country:"",brand:"",client:"",cm:""};let ju=[],ra=[],ed=0,sC={countries:[],brands:[],clients:[],cms:[]},_l=!1,iC=!1,og=null,ll=null,Ss=null,bu=0,pn={...Xr},Er=0,wu=0;function Sl(){ju.forEach(e=>e())}function td(e,t=""){return typeof e=="string"?e:t}function Pz(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function zz(e,t){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const r=Number(e.trim());if(Number.isFinite(r))return r}return t}function Uz(e,t){return td(e.legacy_month,"")||td(e.mes,"")||t.toLocaleString("es-DO",{month:"long"})}function Iz(e,t){return zz(e.legacy_year,Pz(e.anio,t.getFullYear()))}function $z(e){return!e||e===Td?"":e}function Bz(e){return e&&e.trim()?e:Td}function Hz(e){return{tab:(e==null?void 0:e.tab)??pn.tab??Xr.tab,search:String((e==null?void 0:e.search)??pn.search??Xr.search).trim(),page:Math.max(1,Math.floor(Number((e==null?void 0:e.page)??pn.page??Xr.page))),pageSize:Math.max(1,Math.min(100,Math.floor(Number((e==null?void 0:e.pageSize)??pn.pageSize??Xr.pageSize)))),country:String((e==null?void 0:e.country)??pn.country??Xr.country).trim(),brand:String((e==null?void 0:e.brand)??pn.brand??Xr.brand).trim(),client:String((e==null?void 0:e.client)??pn.client??Xr.client).trim(),cm:String((e==null?void 0:e.cm)??pn.cm??Xr.cm).trim()}}function oC(e){const t=e.extra_data||{},r=e.project_links||[],s=r.filter(d=>d.link_type==="proposal").map(d=>d.url||"").filter(Boolean),o=r.filter(d=>d.link_type==="final_art").map(d=>d.url||"").filter(Boolean),l=e.created_at?new Date(e.created_at).getTime():Date.now(),u=Number.isFinite(l)?new Date(l):new Date;return{id:e.id,nombre:e.title||"",color:td(t.color,aC),cliente:e.client||"",bu:e.country||"",cm:e.country_manager||"",marca:e.brand||"",solicitante:e.requested_by||"",comentarios:e.description||"",briefLink:e.brief_link||"",propuestaLinks:s,afLinks:o,status:$z(e.status),monto:e.internal_amount==null?null:Number(e.internal_amount),mes:Uz(t,u),anio:Iz(t,u),createdAt:Number.isFinite(l)?l:Date.now(),extraData:t}}function qz(e){const t=e.created_at?new Date(e.created_at).getTime():Date.now();return{id:e.id,projectId:e.project_id,type:e.activity_type||"note",title:e.title||"Actividad registrada",description:e.description||"",actorName:e.actor_name||e.actor_email||"Usuario CDC",actorEmail:e.actor_email||"",createdAt:Number.isFinite(t)?t:Date.now()}}function Vz(e){const t=e.created_at?new Date(e.created_at).getTime():Date.now(),r=Number(e.amount??0),s=e.reference_min==null?null:Number(e.reference_min),o=e.reference_max==null?null:Number(e.reference_max);return{id:e.id,projectId:e.project_id,source:e.source==="manual"?"manual":"tariff",category:e.category||"",serviceName:e.service_name||"",workType:e.work_type||"",complexityLevel:e.complexity_level||"",referenceLabel:e.reference_label||"",referenceMin:Number.isFinite(s)?s:null,referenceMax:Number.isFinite(o)?o:null,amount:Number.isFinite(r)?r:0,description:e.description||"",createdAt:Number.isFinite(t)?t:Date.now()}}function lC(e){var r;const t=e.user_metadata||{};return t.full_name||t.name||t.display_name||((r=e.email)==null?void 0:r.split("@")[0])||"Usuario CDC"}function Gw(e){return e&&e.trim()?e:Td}function xu(e,t,r){return`${e} ${e===1?t:r}`}function Fw(e){return Array.isArray(e)?e.map(t=>String(t||"").trim()).filter(Boolean).join(" | "):String(e??"").trim()}function za(e,t,r,s,o){const l=Fw(r),u=Fw(s);if(l!==u){if(o!=null&&o.privateValue){e.push(`${t} actualizado.`);return}e.push(`${t}: ${l||"—"} → ${u||"—"}`)}}function Gz(e,t,r){const s=[];return za(s,"Nombre",e.nombre,t.nombre),za(s,"Cliente",e.cliente,t.cliente),za(s,"Marca",e.marca,t.marca),za(s,"País/BU",e.bu,t.bu),za(s,"CM",e.cm,t.cm),za(s,"Solicitado por",e.solicitante,t.solicitante),za(s,"Estatus",Gw(e.status),Gw(t.status)),e.color!==t.color&&s.push("Etiqueta de color actualizada."),(e.comentarios||"").trim()!==(t.comentarios||"").trim()&&s.push("Comentarios actualizados."),(e.briefLink||"").trim()!==(t.briefLink||"").trim()&&s.push("Link del brief actualizado."),e.propuestaLinks.join("|")!==t.propuestaLinks.join("|")&&s.push(`Links de propuestas: ${xu(e.propuestaLinks.length,"link","links")} → ${xu(t.propuestaLinks.length,"link","links")}.`),e.afLinks.join("|")!==t.afLinks.join("|")&&s.push(`Links de artes finales: ${xu(e.afLinks.length,"link","links")} → ${xu(t.afLinks.length,"link","links")}.`),r&&Number(e.monto??0)!==Number(t.monto??0)&&za(s,"Monto interno",e.monto,t.monto,{privateValue:!0}),s}async function Zi(){const{data:e,error:t}=await nt.auth.getUser();if(t||!e.user)throw new Error("No hay una sesión activa de Supabase.");return e.user}async function cC(){return(await Zi()).id}async function uC(){var t;return((t=(await Zi()).email)==null?void 0:t.toLowerCase())===ig}async function Fz(){var t;const e=await Zi();return Dz.includes(((t=e.email)==null?void 0:t.toLowerCase())||"")}async function Kz(){var t;const e=await Zi();return Lz.includes(((t=e.email)==null?void 0:t.toLowerCase())||"")}function dC(e){const t=e.extraData&&typeof e.extraData=="object"&&!Array.isArray(e.extraData)?e.extraData:{};return{title:e.nombre,client:e.cliente,brand:e.marca,country:e.bu,requested_by:e.solicitante,country_manager:e.cm,description:e.comentarios,status:Bz(e.status),internal_amount:e.monto??null,brief_link:e.briefLink,extra_data:{...t,color:e.color??td(t.color,aC),mes:e.mes,anio:e.anio}}}function Yz(e,t){const r=t.propuestaLinks.map(o=>o.trim()).filter(Boolean).map((o,l)=>({project_id:e,link_type:"proposal",url:o,label:`Propuesta ${l+1}`})),s=t.afLinks.map(o=>o.trim()).filter(Boolean).map((o,l)=>({project_id:e,link_type:"final_art",url:o,label:`AF ${l+1}`}));return[...r,...s]}function fC(e){ra=e,Sl()}function Ha(e){return Array.isArray(e)?Array.from(new Set(e.map(t=>String(t??"").trim()).filter(Boolean))).sort((t,r)=>t.localeCompare(r,"es",{sensitivity:"base"})):[]}function Wz(e){return{countries:Ha(e.map(t=>t.bu)),brands:Ha(e.map(t=>t.marca)),clients:Ha(e.map(t=>t.cliente)),cms:Ha(e.map(t=>t.cm))}}function er(e){og=e,Sl()}function hC(e){ra.some(r=>r.id===e.id)&&fC(ra.map(r=>r.id===e.id?e:r))}function Xz(e){ra.some(t=>t.id===e)&&(fC(ra.filter(t=>t.id!==e)),ed=Math.max(0,ed-1),Sl())}async function Ad(e,t){return console.info("No se configuró VITE_WEBHOOK_URL; se omite sincronización con Google Sheet."),{sheetSyncStatus:"skipped",sheetSyncMessage:t==="delete"?"No hay webhook configurado para eliminar el proyecto del Google Sheet.":"Proyecto guardado. No hay webhook configurado para sincronizar el Sheet."}}function Kw(){Ss&&clearTimeout(Ss),Ss=setTimeout(()=>{Ss=null,!_l&&Er===0&&Cs(pn)},350)}function Jz(){ll||(ll=nt.channel("tablero-cdc-projects").on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_projects"},()=>Kw()).on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_project_links"},()=>Kw()).subscribe(e=>{(e==="CHANNEL_ERROR"||e==="TIMED_OUT")&&console.warn("Supabase Realtime no pudo suscribirse a proyectos:",e)}))}function Qz(){Ss&&(clearTimeout(Ss),Ss=null),ll&&(nt.removeChannel(ll),ll=null)}async function mC(e,t){const{error:r}=await nt.from("tablero_cdc_project_links").delete().eq("project_id",e);if(r)throw r;const s=Yz(e,t);if(s.length===0)return;const{error:o}=await nt.from("tablero_cdc_project_links").insert(s);if(o)throw o}async function pC(e,t){if(!Array.isArray(t))return;const{error:r}=await nt.from("tablero_cdc_project_pricing_items").delete().eq("project_id",e);if(r)throw r;const s=t.map((l,u)=>({item:l,index:u})).filter(({item:l})=>Number.isFinite(Number(l.amount))&&Number(l.amount)>0).map(({item:l,index:u})=>({project_id:e,source:l.source,category:l.category||"",service_name:l.serviceName||"Costo manual",work_type:l.workType||"",complexity_level:l.complexityLevel||"",reference_label:l.referenceLabel||"",reference_min:l.referenceMin??null,reference_max:l.referenceMax??null,amount:Number(l.amount),description:l.description||"",sort_order:u}));if(s.length===0)return;const{error:o}=await nt.from("tablero_cdc_project_pricing_items").insert(s);if(o)throw o}async function Zz(e){const{data:t,error:r}=await nt.from("tablero_cdc_project_pricing_items").select("id, project_id, source, category, service_name, work_type, complexity_level, reference_label, reference_min, reference_max, amount, description, created_at").eq("project_id",e).order("sort_order",{ascending:!0}).order("created_at",{ascending:!0});if(r)throw r;return(t||[]).map(Vz)}async function Yw(e,t=20,r=0){const s=Math.max(1,Math.min(50,Math.floor(t))),o=Math.max(0,Math.floor(r)),{data:l,error:u}=await nt.from("tablero_cdc_project_activity").select("id, project_id, activity_type, title, description, actor_name, actor_email, created_at").eq("project_id",e).order("created_at",{ascending:!1}).range(o,o+s-1);if(u)throw u;return(l||[]).map(qz)}function eU(e,t,r,s){const o=new Intl.DateTimeFormat("es-DO",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(s),l=r?`${t} (${r})`:t;return`[${o}] ${l}:
|
||
${e}`}async function tU(e,t,r,s,o,l){const{data:u,error:d}=await nt.from("tablero_cdc_projects").select("description").eq("id",e).single();if(d)throw d;const h=String((u==null?void 0:u.description)||"").trim(),m=eU(t,r,s,l),b=h?`${h}
|
||
|
||
${m}`:m,{error:g}=await nt.from("tablero_cdc_projects").update({description:b,updated_by:o}).eq("id",e);if(g)throw g;const w=ra.find(_=>_.id===e);return w&&hC({...w,comentarios:b}),b}async function nU(e,t){const r=t.trim();if(!r)throw new Error("Escribe una nota antes de agregarla al historial.");const s=await Zi(),o=lC(s),l=s.email||"",u=new Date,{error:d}=await nt.from("tablero_cdc_project_activity").insert({project_id:e,activity_type:"note",title:"Comentario agregado",description:r,actor_id:s.id,actor_email:l||null,actor_name:o});if(d)throw d;const h=await tU(e,r,o,l,s.id,u),m=await Ad(e,"update");return{comments:h,...m}}async function gC(e,t,r,s="",o=!1){try{const l=await Zi(),u=lC(l),{error:d}=await nt.from("tablero_cdc_project_activity").insert({project_id:e,activity_type:t,title:r,description:s,actor_id:l.id,actor_email:l.email||null,actor_name:u});if(d)throw d}catch(l){if(console.warn("No se pudo registrar la actividad del proyecto:",l),o)throw l instanceof Error?l:new Error("No se pudo registrar la actividad del proyecto.")}}function rU(e){return`
|
||
id,
|
||
title,
|
||
client,
|
||
brand,
|
||
country,
|
||
requested_by,
|
||
country_manager,
|
||
description,
|
||
status,
|
||
${e?"internal_amount,":""}
|
||
brief_link,
|
||
created_at,
|
||
extra_data,
|
||
project_links:tablero_cdc_project_links (
|
||
id,
|
||
link_type,
|
||
url,
|
||
label
|
||
)
|
||
`}function aU(e){const t=e instanceof Error?e.message:String(e||"");return t.includes("tablero_cdc_get_projects_paginated")||t.includes("Could not find the function")}function Qo(e){return e.replace(/[%_]/g,"\\$&").replace(/,/g," ")}function sU(e,t){let r=e;t.tab==="abiertos"&&(r=r.or("status.is.null,status.eq.,status.eq.Activo")),t.tab==="cerrados"&&(r=r.not("status","is",null).neq("status","").neq("status",Td));const s=t.search.trim();if(s){const l=`%${Qo(s)}%`;r=r.or(`title.ilike.${l},client.ilike.${l},brand.ilike.${l},country.ilike.${l},requested_by.ilike.${l},country_manager.ilike.${l},description.ilike.${l}`)}if(t.country){const o=`%${Qo(t.country)}%`;r=r.or(`country.ilike.${o}`)}if(t.brand){const o=`%${Qo(t.brand)}%`;r=r.or(`brand.ilike.${o}`)}if(t.client){const o=`%${Qo(t.client)}%`;r=r.or(`client.ilike.${o}`)}if(t.cm){const o=`%${Qo(t.cm)}%`;r=r.or(`country_manager.ilike.${o}`)}return r}async function iU(e,t){const r=(e.page-1)*e.pageSize,s=r+e.pageSize-1;let o=nt.from("tablero_cdc_projects").select(rU(t),{count:"exact"}).order("created_at",{ascending:!1});o=sU(o,e);const{data:l,error:u,count:d}=await o.range(r,s);if(u)throw u;const h=(l||[]).map(m=>oC(m));return{projects:h,totalProjects:d??0,filterOptions:Wz(h)}}async function oU(e){var l,u,d,h;const{data:t,error:r}=await nt.rpc("tablero_cdc_get_projects_paginated",{p_tab:e.tab,p_search:e.search,p_page:e.page,p_page_size:e.pageSize,p_country:e.country||"",p_brand:e.brand||"",p_client:e.client||"",p_cm:e.cm||""});if(r)throw r;const s=t||{},o=Array.isArray(s.projects)?s.projects:[];return{totalProjects:Number(s.total_count||0),projects:o.map(m=>oC(m)),filterOptions:{countries:Ha((l=s.filter_options)==null?void 0:l.countries),brands:Ha((u=s.filter_options)==null?void 0:u.brands),clients:Ha((d=s.filter_options)==null?void 0:d.clients),cms:Ha((h=s.filter_options)==null?void 0:h.cms)}}}async function Cs(e){const t=Hz(e),r=wu+=1;pn=t,_l=!0,er(null),Sl();try{const s=await uC();let o;try{o=await oU(t)}catch(l){if(!aU(l))throw l;console.warn("RPC tablero_cdc_get_projects_paginated no existe todavía. Usando consulta directa como respaldo temporal.",l),o=await iU(t,s)}if(r!==wu)return;ed=o.totalProjects,ra=o.projects,sC=o.filterOptions,iC=!0}catch(s){if(r!==wu)return;console.error("Error cargando proyectos desde Supabase:",s),og=s instanceof Error?s.message:"No se pudieron cargar los proyectos desde Supabase."}finally{r===wu&&(_l=!1,Sl())}}async function lU(e){er(null),Er+=1;try{const t=await cC(),r={...dC(e),created_by:t,updated_by:t},{data:s,error:o}=await nt.from("tablero_cdc_projects").insert(r).select("id").single();if(o)throw er(o.message),o;await mC(s.id,e),await pC(s.id,e.pricingItems),await gC(s.id,"created","Proyecto creado",`${e.nombre||"Proyecto sin título"} quedó registrado en el tablero.`);const l=await Ad(s.id,"create");return await Cs(pn),{projectId:s.id,...l}}finally{Er=Math.max(0,Er-1)}}async function cU(e,t){er(null),Er+=1;try{const r=await cC(),s=await uC(),o=await Fz(),l=ra.find(w=>w.id===e);if(!l){const w="No se encontró el proyecto en la página actual. Recarga el tablero antes de guardar para evitar sobrescribir datos.";throw er(w),new Error(w)}const u={...l,...t},d=dC(u),h=s?{...d,updated_by:r}:o?{title:d.title,client:d.client,brand:d.brand,country:d.country,requested_by:d.requested_by,country_manager:d.country_manager,description:d.description,status:l.status,internal_amount:d.internal_amount,brief_link:d.brief_link,extra_data:d.extra_data,updated_by:r}:{title:d.title,client:d.client,brand:d.brand,country:d.country,requested_by:d.requested_by,country_manager:d.country_manager,description:d.description,status:d.status,brief_link:d.brief_link,extra_data:d.extra_data,updated_by:r},{error:m}=await nt.from("tablero_cdc_projects").update(h).eq("id",e);if(m)throw er(m.message),m;hC(u),await mC(e,u),o&&await pC(e,t.pricingItems);const b=Gz(l,u,o);b.length>0&&await gC(e,"updated","Proyecto actualizado",b.slice(0,8).join(`
|
||
`));const g=await Ad(e,"update");return await Cs(pn),{projectId:e,...g}}finally{Er=Math.max(0,Er-1)}}async function uU(e){er(null),Er+=1;try{if(!await Kz()){const l="No tienes permiso para eliminar proyectos.";throw er(l),new Error(l)}const r=await Ad(e,"delete");if(r.sheetSyncStatus!=="synced"){const l=r.sheetSyncMessage||"No se pudo eliminar el proyecto del Google Sheet.";throw er(l),new Error(l)}const{error:s}=await nt.from("tablero_cdc_project_links").delete().eq("project_id",e);if(s)throw er(s.message),s;const{error:o}=await nt.from("tablero_cdc_projects").delete().eq("id",e);if(o)throw er(o.message),o;Xz(e),await Cs(pn)}finally{Er=Math.max(0,Er-1)}}function vC(e){const[,t]=y.useState(0),r=e==null?void 0:e.tab,s=e==null?void 0:e.search,o=e==null?void 0:e.page,l=e==null?void 0:e.pageSize,u=e==null?void 0:e.country,d=e==null?void 0:e.brand,h=e==null?void 0:e.client,m=e==null?void 0:e.cm;return y.useEffect(()=>{const b=()=>t(g=>g+1);return ju.push(b),bu+=1,Jz(),()=>{ju=ju.filter(g=>g!==b),bu=Math.max(0,bu-1),bu===0&&Qz()}},[]),y.useEffect(()=>{if(r&&o&&l){Cs({tab:r,search:s??"",page:o,pageSize:l,country:u??"",brand:d??"",client:h??"",cm:m??""});return}!iC&&!_l&&Cs()},[r,s,o,l,u,d,h,m]),{projects:ra,totalProjects:ed,filterOptions:sC,loading:_l,error:og,refresh:()=>Cs(e??pn),add:lU,update:cU,remove:uU}}function dU(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const fU=e=>{switch(e){case"success":return pU;case"info":return vU;case"warning":return gU;case"error":return yU;default:return null}},hU=Array(12).fill(0),mU=({visible:e,className:t})=>oe.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},oe.createElement("div",{className:"sonner-spinner"},hU.map((r,s)=>oe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),pU=oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},oe.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),gU=oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},oe.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),vU=oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},oe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),yU=oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},oe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),bU=oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},oe.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),oe.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),wU=()=>{const[e,t]=oe.useState(document.hidden);return oe.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let np=1;class xU{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:s,...o}=t,l=typeof(t==null?void 0:t.id)=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:np++,u=this.toasts.find(h=>h.id===l),d=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),u?this.toasts=this.toasts.map(h=>h.id===l?(this.publish({...h,...t,id:l,title:s}),{...h,...t,id:l,dismissible:d,title:s}):h):this.addToast({title:s,...o,dismissible:d,id:l}),l},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(s=>s({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let s;r.loading!==void 0&&(s=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const o=Promise.resolve(t instanceof Function?t():t);let l=s!==void 0,u;const d=o.then(async m=>{if(u=["resolve",m],oe.isValidElement(m))l=!1,this.create({id:s,type:"default",message:m});else if(SU(m)&&!m.ok){l=!1;const g=typeof r.error=="function"?await r.error(`HTTP error! status: ${m.status}`):r.error,w=typeof r.description=="function"?await r.description(`HTTP error! status: ${m.status}`):r.description,E=typeof g=="object"&&!oe.isValidElement(g)?g:{message:g};this.create({id:s,type:"error",description:w,...E})}else if(m instanceof Error){l=!1;const g=typeof r.error=="function"?await r.error(m):r.error,w=typeof r.description=="function"?await r.description(m):r.description,E=typeof g=="object"&&!oe.isValidElement(g)?g:{message:g};this.create({id:s,type:"error",description:w,...E})}else if(r.success!==void 0){l=!1;const g=typeof r.success=="function"?await r.success(m):r.success,w=typeof r.description=="function"?await r.description(m):r.description,E=typeof g=="object"&&!oe.isValidElement(g)?g:{message:g};this.create({id:s,type:"success",description:w,...E})}}).catch(async m=>{if(u=["reject",m],r.error!==void 0){l=!1;const b=typeof r.error=="function"?await r.error(m):r.error,g=typeof r.description=="function"?await r.description(m):r.description,_=typeof b=="object"&&!oe.isValidElement(b)?b:{message:b};this.create({id:s,type:"error",description:g,..._})}}).finally(()=>{l&&(this.dismiss(s),s=void 0),r.finally==null||r.finally.call(r)}),h=()=>new Promise((m,b)=>d.then(()=>u[0]==="reject"?b(u[1]):m(u[1])).catch(b));return typeof s!="string"&&typeof s!="number"?{unwrap:h}:Object.assign(s,{unwrap:h})},this.custom=(t,r)=>{const s=(r==null?void 0:r.id)||np++;return this.create({jsx:t(s),id:s,...r}),s},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const mn=new xU,_U=(e,t)=>{const r=(t==null?void 0:t.id)||np++;return mn.addToast({title:e,...t,id:r}),r},SU=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",EU=_U,CU=()=>mn.toasts,RU=()=>mn.getActiveToasts(),vr=Object.assign(EU,{success:mn.success,info:mn.info,warning:mn.warning,error:mn.error,custom:mn.custom,message:mn.message,promise:mn.promise,dismiss:mn.dismiss,loading:mn.loading},{getHistory:CU,getToasts:RU});dU("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function _u(e){return e.label!==void 0}const TU=3,AU="24px",NU="16px",Ww=4e3,kU=356,jU=14,OU=45,MU=200;function yr(...e){return e.filter(Boolean).join(" ")}function DU(e){const[t,r]=e.split("-"),s=[];return t&&s.push(t),r&&s.push(r),s}const LU=e=>{var t,r,s,o,l,u,d,h,m;const{invert:b,toast:g,unstyled:w,interacting:_,setHeights:E,visibleToasts:S,heights:T,index:C,toasts:A,expanded:N,removeToast:z,defaultRichColors:F,closeButton:B,style:P,cancelButtonStyle:V,actionButtonStyle:re,className:le="",descriptionClassName:ce="",duration:de,position:ge,gap:me,expandByDefault:fe,classNames:M,icons:K,closeButtonAriaLabel:Q="Close toast"}=e,[te,W]=oe.useState(null),[k,j]=oe.useState(null),[$,D]=oe.useState(!1),[U,X]=oe.useState(!1),[J,se]=oe.useState(!1),[ie,ue]=oe.useState(!1),[Ee,Se]=oe.useState(!1),[et,He]=oe.useState(0),[vn,Zt]=oe.useState(0),Gt=oe.useRef(g.duration||de||Ww),Tr=oe.useRef(null),wt=oe.useRef(null),ca=C===0,or=C+1<=S,Lt=g.type,Rt=g.dismissible!==!1,vt=g.className||"",eo=g.descriptionClassName||"",Ar=oe.useMemo(()=>T.findIndex(ke=>ke.toastId===g.id)||0,[T,g.id]),lr=oe.useMemo(()=>{var ke;return(ke=g.closeButton)!=null?ke:B},[g.closeButton,B]),cr=oe.useMemo(()=>g.duration||de||Ww,[g.duration,de]),Nr=oe.useRef(0),Vn=oe.useRef(0),Ja=oe.useRef(0),Gn=oe.useRef(null),[ur,Pt]=ge.split("-"),yn=oe.useMemo(()=>T.reduce((ke,ot,jt)=>jt>=Ar?ke:ke+ot.height,0),[T,Ar]),kt=wU(),to=g.invert||b,ae=Lt==="loading";Vn.current=oe.useMemo(()=>Ar*me+yn,[Ar,yn]),oe.useEffect(()=>{Gt.current=cr},[cr]),oe.useEffect(()=>{D(!0)},[]),oe.useEffect(()=>{const ke=wt.current;if(ke){const ot=ke.getBoundingClientRect().height;return Zt(ot),E(jt=>[{toastId:g.id,height:ot,position:g.position},...jt]),()=>E(jt=>jt.filter(Kt=>Kt.toastId!==g.id))}},[E,g.id]),oe.useLayoutEffect(()=>{if(!$)return;const ke=wt.current,ot=ke.style.height;ke.style.height="auto";const jt=ke.getBoundingClientRect().height;ke.style.height=ot,Zt(jt),E(Kt=>Kt.find(ut=>ut.toastId===g.id)?Kt.map(ut=>ut.toastId===g.id?{...ut,height:jt}:ut):[{toastId:g.id,height:jt,position:g.position},...Kt])},[$,g.title,g.description,E,g.id,g.jsx,g.action,g.cancel]);const Re=oe.useCallback(()=>{X(!0),He(Vn.current),E(ke=>ke.filter(ot=>ot.toastId!==g.id)),setTimeout(()=>{z(g)},MU)},[g,z,E,Vn]);oe.useEffect(()=>{if(g.promise&&Lt==="loading"||g.duration===1/0||g.type==="loading")return;let ke;return N||_||kt?(()=>{if(Ja.current<Nr.current){const Kt=new Date().getTime()-Nr.current;Gt.current=Gt.current-Kt}Ja.current=new Date().getTime()})():(()=>{Gt.current!==1/0&&(Nr.current=new Date().getTime(),ke=setTimeout(()=>{g.onAutoClose==null||g.onAutoClose.call(g,g),Re()},Gt.current))})(),()=>clearTimeout(ke)},[N,_,g,Lt,kt,Re]),oe.useEffect(()=>{g.delete&&(Re(),g.onDismiss==null||g.onDismiss.call(g,g))},[Re,g.delete]);function Be(){var ke;if(K!=null&&K.loading){var ot;return oe.createElement("div",{className:yr(M==null?void 0:M.loader,g==null||(ot=g.classNames)==null?void 0:ot.loader,"sonner-loader"),"data-visible":Lt==="loading"},K.loading)}return oe.createElement(mU,{className:yr(M==null?void 0:M.loader,g==null||(ke=g.classNames)==null?void 0:ke.loader),visible:Lt==="loading"})}const Fe=g.icon||(K==null?void 0:K[Lt])||fU(Lt);var Ft,en;return oe.createElement("li",{tabIndex:0,ref:wt,className:yr(le,vt,M==null?void 0:M.toast,g==null||(t=g.classNames)==null?void 0:t.toast,M==null?void 0:M.default,M==null?void 0:M[Lt],g==null||(r=g.classNames)==null?void 0:r[Lt]),"data-sonner-toast":"","data-rich-colors":(Ft=g.richColors)!=null?Ft:F,"data-styled":!(g.jsx||g.unstyled||w),"data-mounted":$,"data-promise":!!g.promise,"data-swiped":Ee,"data-removed":U,"data-visible":or,"data-y-position":ur,"data-x-position":Pt,"data-index":C,"data-front":ca,"data-swiping":J,"data-dismissible":Rt,"data-type":Lt,"data-invert":to,"data-swipe-out":ie,"data-swipe-direction":k,"data-expanded":!!(N||fe&&$),"data-testid":g.testId,style:{"--index":C,"--toasts-before":C,"--z-index":A.length-C,"--offset":`${U?et:Vn.current}px`,"--initial-height":fe?"auto":`${vn}px`,...P,...g.style},onDragEnd:()=>{se(!1),W(null),Gn.current=null},onPointerDown:ke=>{ke.button!==2&&(ae||!Rt||(Tr.current=new Date,He(Vn.current),ke.target.setPointerCapture(ke.pointerId),ke.target.tagName!=="BUTTON"&&(se(!0),Gn.current={x:ke.clientX,y:ke.clientY})))},onPointerUp:()=>{var ke,ot,jt;if(ie||!Rt)return;Gn.current=null;const Kt=Number(((ke=wt.current)==null?void 0:ke.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ua=Number(((ot=wt.current)==null?void 0:ot.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ut=new Date().getTime()-((jt=Tr.current)==null?void 0:jt.getTime()),tn=te==="x"?Kt:ua,Qa=Math.abs(tn)/ut;if(Math.abs(tn)>=OU||Qa>.11){He(Vn.current),g.onDismiss==null||g.onDismiss.call(g,g),j(te==="x"?Kt>0?"right":"left":ua>0?"down":"up"),Re(),ue(!0);return}else{var nn,rn;(nn=wt.current)==null||nn.style.setProperty("--swipe-amount-x","0px"),(rn=wt.current)==null||rn.style.setProperty("--swipe-amount-y","0px")}Se(!1),se(!1),W(null)},onPointerMove:ke=>{var ot,jt,Kt;if(!Gn.current||!Rt||((ot=window.getSelection())==null?void 0:ot.toString().length)>0)return;const ut=ke.clientY-Gn.current.y,tn=ke.clientX-Gn.current.x;var Qa;const nn=(Qa=e.swipeDirections)!=null?Qa:DU(ge);!te&&(Math.abs(tn)>1||Math.abs(ut)>1)&&W(Math.abs(tn)>Math.abs(ut)?"x":"y");let rn={x:0,y:0};const Ps=Fn=>1/(1.5+Math.abs(Fn)/20);if(te==="y"){if(nn.includes("top")||nn.includes("bottom"))if(nn.includes("top")&&ut<0||nn.includes("bottom")&&ut>0)rn.y=ut;else{const Fn=ut*Ps(ut);rn.y=Math.abs(Fn)<Math.abs(ut)?Fn:ut}}else if(te==="x"&&(nn.includes("left")||nn.includes("right")))if(nn.includes("left")&&tn<0||nn.includes("right")&&tn>0)rn.x=tn;else{const Fn=tn*Ps(tn);rn.x=Math.abs(Fn)<Math.abs(tn)?Fn:tn}(Math.abs(rn.x)>0||Math.abs(rn.y)>0)&&Se(!0),(jt=wt.current)==null||jt.style.setProperty("--swipe-amount-x",`${rn.x}px`),(Kt=wt.current)==null||Kt.style.setProperty("--swipe-amount-y",`${rn.y}px`)}},lr&&!g.jsx&&Lt!=="loading"?oe.createElement("button",{"aria-label":Q,"data-disabled":ae,"data-close-button":!0,onClick:ae||!Rt?()=>{}:()=>{Re(),g.onDismiss==null||g.onDismiss.call(g,g)},className:yr(M==null?void 0:M.closeButton,g==null||(s=g.classNames)==null?void 0:s.closeButton)},(en=K==null?void 0:K.close)!=null?en:bU):null,(Lt||g.icon||g.promise)&&g.icon!==null&&((K==null?void 0:K[Lt])!==null||g.icon)?oe.createElement("div",{"data-icon":"",className:yr(M==null?void 0:M.icon,g==null||(o=g.classNames)==null?void 0:o.icon)},g.promise||g.type==="loading"&&!g.icon?g.icon||Be():null,g.type!=="loading"?Fe:null):null,oe.createElement("div",{"data-content":"",className:yr(M==null?void 0:M.content,g==null||(l=g.classNames)==null?void 0:l.content)},oe.createElement("div",{"data-title":"",className:yr(M==null?void 0:M.title,g==null||(u=g.classNames)==null?void 0:u.title)},g.jsx?g.jsx:typeof g.title=="function"?g.title():g.title),g.description?oe.createElement("div",{"data-description":"",className:yr(ce,eo,M==null?void 0:M.description,g==null||(d=g.classNames)==null?void 0:d.description)},typeof g.description=="function"?g.description():g.description):null),oe.isValidElement(g.cancel)?g.cancel:g.cancel&&_u(g.cancel)?oe.createElement("button",{"data-button":!0,"data-cancel":!0,style:g.cancelButtonStyle||V,onClick:ke=>{_u(g.cancel)&&Rt&&(g.cancel.onClick==null||g.cancel.onClick.call(g.cancel,ke),Re())},className:yr(M==null?void 0:M.cancelButton,g==null||(h=g.classNames)==null?void 0:h.cancelButton)},g.cancel.label):null,oe.isValidElement(g.action)?g.action:g.action&&_u(g.action)?oe.createElement("button",{"data-button":!0,"data-action":!0,style:g.actionButtonStyle||re,onClick:ke=>{_u(g.action)&&(g.action.onClick==null||g.action.onClick.call(g.action,ke),!ke.defaultPrevented&&Re())},className:yr(M==null?void 0:M.actionButton,g==null||(m=g.classNames)==null?void 0:m.actionButton)},g.action.label):null)};function Xw(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function PU(e,t){const r={};return[e,t].forEach((s,o)=>{const l=o===1,u=l?"--mobile-offset":"--offset",d=l?NU:AU;function h(m){["top","right","bottom","left"].forEach(b=>{r[`${u}-${b}`]=typeof m=="number"?`${m}px`:m})}typeof s=="number"||typeof s=="string"?h(s):typeof s=="object"?["top","right","bottom","left"].forEach(m=>{s[m]===void 0?r[`${u}-${m}`]=d:r[`${u}-${m}`]=typeof s[m]=="number"?`${s[m]}px`:s[m]}):h(d)}),r}const zU=oe.forwardRef(function(t,r){const{id:s,invert:o,position:l="bottom-right",hotkey:u=["altKey","KeyT"],expand:d,closeButton:h,className:m,offset:b,mobileOffset:g,theme:w="light",richColors:_,duration:E,style:S,visibleToasts:T=TU,toastOptions:C,dir:A=Xw(),gap:N=jU,icons:z,containerAriaLabel:F="Notifications"}=t,[B,P]=oe.useState([]),V=oe.useMemo(()=>s?B.filter($=>$.toasterId===s):B.filter($=>!$.toasterId),[B,s]),re=oe.useMemo(()=>Array.from(new Set([l].concat(V.filter($=>$.position).map($=>$.position)))),[V,l]),[le,ce]=oe.useState([]),[de,ge]=oe.useState(!1),[me,fe]=oe.useState(!1),[M,K]=oe.useState(w!=="system"?w:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Q=oe.useRef(null),te=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),W=oe.useRef(null),k=oe.useRef(!1),j=oe.useCallback($=>{P(D=>{var U;return(U=D.find(X=>X.id===$.id))!=null&&U.delete||mn.dismiss($.id),D.filter(({id:X})=>X!==$.id)})},[]);return oe.useEffect(()=>mn.subscribe($=>{if($.dismiss){requestAnimationFrame(()=>{P(D=>D.map(U=>U.id===$.id?{...U,delete:!0}:U))});return}setTimeout(()=>{_x.flushSync(()=>{P(D=>{const U=D.findIndex(X=>X.id===$.id);return U!==-1?[...D.slice(0,U),{...D[U],...$},...D.slice(U+1)]:[$,...D]})})})}),[B]),oe.useEffect(()=>{if(w!=="system"){K(w);return}if(w==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?K("dark"):K("light")),typeof window>"u")return;const $=window.matchMedia("(prefers-color-scheme: dark)");try{$.addEventListener("change",({matches:D})=>{K(D?"dark":"light")})}catch{$.addListener(({matches:U})=>{try{K(U?"dark":"light")}catch(X){console.error(X)}})}},[w]),oe.useEffect(()=>{B.length<=1&&ge(!1)},[B]),oe.useEffect(()=>{const $=D=>{var U;if(u.every(se=>D[se]||D.code===se)){var J;ge(!0),(J=Q.current)==null||J.focus()}D.code==="Escape"&&(document.activeElement===Q.current||(U=Q.current)!=null&&U.contains(document.activeElement))&&ge(!1)};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[u]),oe.useEffect(()=>{if(Q.current)return()=>{W.current&&(W.current.focus({preventScroll:!0}),W.current=null,k.current=!1)}},[Q.current]),oe.createElement("section",{ref:r,"aria-label":`${F} ${te}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},re.map(($,D)=>{var U;const[X,J]=$.split("-");return V.length?oe.createElement("ol",{key:$,dir:A==="auto"?Xw():A,tabIndex:-1,ref:Q,className:m,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":X,"data-x-position":J,style:{"--front-toast-height":`${((U=le[0])==null?void 0:U.height)||0}px`,"--width":`${kU}px`,"--gap":`${N}px`,...S,...PU(b,g)},onBlur:se=>{k.current&&!se.currentTarget.contains(se.relatedTarget)&&(k.current=!1,W.current&&(W.current.focus({preventScroll:!0}),W.current=null))},onFocus:se=>{se.target instanceof HTMLElement&&se.target.dataset.dismissible==="false"||k.current||(k.current=!0,W.current=se.relatedTarget)},onMouseEnter:()=>ge(!0),onMouseMove:()=>ge(!0),onMouseLeave:()=>{me||ge(!1)},onDragEnd:()=>ge(!1),onPointerDown:se=>{se.target instanceof HTMLElement&&se.target.dataset.dismissible==="false"||fe(!0)},onPointerUp:()=>fe(!1)},V.filter(se=>!se.position&&D===0||se.position===$).map((se,ie)=>{var ue,Ee;return oe.createElement(LU,{key:se.id,icons:z,index:ie,toast:se,defaultRichColors:_,duration:(ue=C==null?void 0:C.duration)!=null?ue:E,className:C==null?void 0:C.className,descriptionClassName:C==null?void 0:C.descriptionClassName,invert:o,visibleToasts:T,closeButton:(Ee=C==null?void 0:C.closeButton)!=null?Ee:h,interacting:me,position:$,style:C==null?void 0:C.style,unstyled:C==null?void 0:C.unstyled,classNames:C==null?void 0:C.classNames,cancelButtonStyle:C==null?void 0:C.cancelButtonStyle,actionButtonStyle:C==null?void 0:C.actionButtonStyle,closeButtonAriaLabel:C==null?void 0:C.closeButtonAriaLabel,removeToast:j,toasts:V.filter(Se=>Se.position==se.position),heights:le.filter(Se=>Se.position==se.position),setHeights:ce,expandByDefault:d,gap:N,expanded:de,swipeDirections:t.swipeDirections})})):null}))}),UU="Walmart Connect WMC",Ni=15;function IU(e){return new Intl.DateTimeFormat("es-DO",{day:"2-digit",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(e))}function $U(e){return e.split(`
|
||
`).map(t=>t.trim()).filter(Boolean)}function yC(e){return e.reduce((t,r)=>t+Number(r.amount||0),0)}function BU(e){return e.map(t=>({id:t.id,source:t.source,category:t.category,serviceName:t.serviceName,workType:t.workType,complexityLevel:t.complexityLevel,referenceLabel:t.referenceLabel,referenceMin:t.referenceMin,referenceMax:t.referenceMax,amount:t.amount,description:t.description}))}function HU(e,t){if(!t.length||e==null)return!1;const r=Number(e);if(!Number.isFinite(r)||r<=0)return!1;const s=yC(t);return Math.abs(r-s)>.01}function qU(e,t=[]){const r=Vt(e);if(!r)return[];const s=new Map(dt(t).map(h=>[at(h),h])),o=s.get(at(r));if(o)return[o];const l=r.split(/[,;]/).map(h=>Vt(h)).filter(Boolean);if(l.length<=1)return dt([o||r]);const u=[];let d=0;for(;d<l.length;){let h="",m=d+1;for(let b=l.length;b>d;b-=1){const g=l.slice(d,b).join(", "),w=s.get(at(g));if(w){h=w,m=b;break}}u.push(h||l[d]),d=m}return dt(u)}function VU(e){return dt(e.map(t=>Vt(t)).filter(Boolean)).join(", ")}function GU(e,t=[]){const r=Vt(e);if(!r)return[];const s=new Map(dt(t).map(u=>[at(u),u])),o=s.get(at(r));if(o)return[o];const l=r.split(/[,;]/).map(u=>Vt(u)).filter(Boolean);return l.length<=1?dt([o||r]):dt(l.map(u=>s.get(at(u))||u))}function FU(e){return dt(e.map(t=>Vt(t)).filter(Boolean)).join(", ")}function Su(e){return at(e)===at(UU)}const Jw=()=>{const e=new Date;return{nombre:"",color:"blue",cliente:"",bu:"",cm:"",marca:"",solicitante:"",comentarios:"",briefLink:"",propuestaLinks:[],afLinks:[],status:"",monto:null,mes:cP[e.getMonth()],anio:e.getFullYear()}};function KU({open:e,onOpenChange:t,project:r,onDelete:s,deleting:o=!1}){const{add:l,update:u}=vC(),{lists:d,loading:h,error:m,refresh:b}=rC(),{isGerardo:g,canDeleteProjects:w,canManageInternalPricing:_}=Nl(),E=!!r,[S,T]=y.useState(Jw()),[C,A]=y.useState([]),[N,z]=y.useState(!1),[F,B]=y.useState(""),[P,V]=y.useState(null),[re,le]=y.useState(null),[ce,de]=y.useState([]),[ge,me]=y.useState(!1),[fe,M]=y.useState(null),[K,Q]=y.useState(""),[te,W]=y.useState(!1),[k,j]=y.useState(!1),[$,D]=y.useState(!1),[U,X]=y.useState([]),[J,se]=y.useState(!1),[ie,ue]=y.useState(null),[Ee,Se]=y.useState(!1),et=qU(S.marca,d.marcas),He=GU(S.bu,d.bus),vn=dt($w(d.clientes,S.cliente)),Zt=dt([...d.marcas,...et]),Gt=dt([...d.bus,...He]),Tr=dt($w(d.status,S.status)),wt=Gt.filter(ae=>at(ae).includes(at(F))),ca=yC(U);y.useEffect(()=>{if(le(null),V(null),r){const{id:ae,createdAt:Re,...Be}=r,Fe=Vt(Be.bu);T({...Be,bu:Fe}),A(Fe?[Fe]:[]),B(""),de([]),W(!1),M(null),Q(""),X([]),ue(null),Se(!1)}else e&&(T(Jw()),A([]),B(""),de([]),W(!1),M(null),Q(""),X([]),ue(null),Se(!1))},[r,e]);const or=y.useCallback(async()=>{if(r!=null&&r.id)try{me(!0),M(null);const ae=await Yw(r.id,Ni+1);de(ae.slice(0,Ni)),W(ae.length>Ni)}catch(ae){console.warn("No se pudo cargar el historial del proyecto:",ae),M("No se pudo cargar el historial. Revisa que el SQL de actividad esté ejecutado en Supabase."),de([]),W(!1)}finally{me(!1)}},[r==null?void 0:r.id]),Lt=y.useCallback(async()=>{if(!(!(r!=null&&r.id)||k||!te))try{j(!0),M(null);const ae=await Yw(r.id,Ni+1,ce.length);de(Re=>[...Re,...ae.slice(0,Ni)]),W(ae.length>Ni)}catch(ae){console.warn("No se pudo cargar más historial del proyecto:",ae),M("No se pudo cargar más actividad. Inténtalo nuevamente.")}finally{j(!1)}},[te,ce.length,k,r==null?void 0:r.id]);y.useEffect(()=>{!e||!(r!=null&&r.id)||or()},[e,r==null?void 0:r.id,or]),y.useEffect(()=>{if(!e||!(r!=null&&r.id)||!_)return;let ae=!1;return(async()=>{try{se(!0),ue(null);const Be=await Zz(r.id),Fe=BU(Be);ae||(Se(HU(r.monto,Fe)),X(Fe))}catch(Be){console.warn("No se pudo cargar el tarifario del proyecto:",Be),ae||(X([]),ue("No se pudieron cargar los costos guardados. Revisa que el SQL del tarifario esté ejecutado en Supabase."))}finally{ae||se(!1)}})(),()=>{ae=!0}},[_,e,r==null?void 0:r.id,r==null?void 0:r.monto]);const Rt=(ae,Re)=>T(Be=>({...Be,[ae]:Re}));y.useEffect(()=>{if(!_||!U.length||Ee)return;const ae=Number(ca.toFixed(2));T(Re=>Re.monto===ae?Re:{...Re,monto:ae})},[_,Ee,U.length,ca]);const vt=ae=>{const Re=d.buCm[ae];if(Re)return Re;const Be=at(ae),Fe=Object.entries(d.buCm).find(([Ft])=>at(Ft)===Be);return(Fe==null?void 0:Fe[1])??""},eo=ae=>{const Re=dt(ae.map(Fe=>Vt(Fe)).filter(Boolean)),Be=dt(Re.map(vt).filter(Boolean));T(Fe=>({...Fe,bu:FU(Re),cm:Be.join(", ")}))},Ar=ae=>{const Re=Vt(ae);T(Be=>({...Be,cliente:Re,...Su(Re)&&!E?{bu:"",cm:""}:Be.cliente&&Su(Be.cliente)?{bu:"",cm:""}:{}})),Su(Re)||(A([]),B(""))},lr=!E&&Su(S.cliente),cr=lr?C:He,Nr=!E&&cr.length>1,Vn=(ae,Re)=>{const Be=Vt(ae);A(Fe=>Re?dt([...Fe,Be]):Fe.filter(Ft=>at(Ft)!==at(Be)))},Ja=C.map(ae=>({country:ae,manager:vt(ae)})),Gn=He.map(ae=>({country:ae,manager:vt(ae)})),ur=S.nombre.trim()&&S.cliente&&S.marca&&S.solicitante.trim()&&(lr?C.length>0:He.length>0),Pt=ae=>{if(ae.sheetSyncStatus==="synced"){vr.success(E?"Proyecto actualizado":"Proyecto creado",{description:"Se guardó y se sincronizó con el Google Sheet."});return}if(ae.sheetSyncStatus==="skipped"){vr.success(E?"Proyecto actualizado":"Proyecto creado",{description:"Se guardó. La sincronización con Google Sheet no está configurada."});return}vr.warning("Proyecto guardado con aviso",{description:ae.sheetSyncMessage})},yn=async()=>{if(!(!(r!=null&&r.id)||!K.trim()||$))try{D(!0);const ae=await nU(r.id,K);Rt("comentarios",ae.comments),Q(""),await or(),ae.sheetSyncStatus==="synced"?vr.success("Comentario agregado al historial",{description:"También se actualizó la columna Comentarios del Google Sheet."}):ae.sheetSyncStatus==="skipped"?vr.success("Comentario agregado al historial",{description:"Se guardó como comentario interno. La sincronización con Sheet no está configurada."}):vr.warning("Comentario agregado con aviso",{description:ae.sheetSyncMessage})}catch(ae){console.error("Error agregando comentario al historial:",ae);const Re=ae instanceof Error?ae.message:"No se pudo agregar el comentario al historial.";vr.error("No se pudo agregar el comentario",{description:Re})}finally{D(!1)}},kt=async()=>{if(!ur||N)return;const ae=g?S:_?{...S,status:(r==null?void 0:r.status)??""}:{...S,status:(r==null?void 0:r.status)??"",monto:(r==null?void 0:r.monto)??null};try{if(z(!0),le(null),V("Guardando y sincronizando con Google Sheet…"),Nr){const Re=cr,Be=[];for(const[Ft,en]of Re.entries()){V(`Guardando país ${Ft+1} de ${Re.length}: ${en}…`);const ke={...ae,bu:en,cm:vt(en),id:crypto.randomUUID(),createdAt:Date.now()+Ft};Be.push(await l({...ke,pricingItems:_?U:void 0}))}const Fe=Be.filter(Ft=>Ft.sheetSyncStatus!=="synced");Fe.length===0?vr.success("Proyectos multipaís creados",{description:`Se crearon ${Re.length} proyectos y ${Re.length} filas en Google Sheet. El Interno Cargado se aplicó por país.`}):vr.warning("Proyectos multipaís creados con aviso",{description:`${Fe.length} de ${Re.length} sincronizaciones con Google Sheet requieren revisión.`})}else{const Re=E&&r?await u(r.id,{...ae,pricingItems:_?U:void 0}):await l({...ae,id:crypto.randomUUID(),createdAt:Date.now(),pricingItems:_?U:void 0});Pt(Re)}t(!1)}catch(Re){console.error("Error guardando proyecto:",Re);const Be=Re instanceof Error?Re.message:"No se pudo guardar el proyecto. Revisa los permisos o intenta de nuevo.";le(Be),vr.error("No se pudo guardar el proyecto",{description:Be})}finally{z(!1),V(null)}},to=!!S.status;return v.jsx(AP,{open:e,onOpenChange:t,children:v.jsxs(NE,{className:"max-w-3xl max-h-[92vh] overflow-y-auto p-0 gap-0",children:[v.jsx("div",{className:"h-2.5 w-full rounded-t-lg",style:{backgroundColor:lE(S.color)}}),v.jsxs("div",{className:"px-7 pt-6 pb-7",children:[v.jsx(kE,{className:"space-y-3",children:v.jsx("div",{className:"flex items-start justify-between gap-4",children:v.jsxs("div",{className:"flex-1",children:[v.jsx(OE,{className:"text-2xl tracking-tight",children:E?S.nombre||"Sin título":"Nuevo proyecto"}),v.jsxs(ME,{className:"mt-1 flex items-center gap-2 text-xs",children:[v.jsx(LO,{className:"w-3.5 h-3.5"}),S.mes," · ",S.anio,to&&v.jsx(Es,{variant:"secondary",className:"ml-2",children:"Cerrado"})]})]})})}),v.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5 mt-6",children:[v.jsxs("div",{className:"md:col-span-2 space-y-1.5",children:[v.jsxs(gt,{children:["Nombre del proyecto ",v.jsx("span",{className:"text-destructive",children:"*"})]}),v.jsx(An,{value:S.nombre,onChange:ae=>Rt("nombre",ae.target.value),placeholder:"Ej: Promoción Día de las Madres",className:"h-10"})]}),v.jsxs("div",{className:"md:col-span-2 space-y-2",children:[v.jsx(gt,{children:"Etiqueta de color"}),v.jsx(N4,{value:S.color,onChange:ae=>Rt("color",ae)})]}),v.jsx(zi,{className:"md:col-span-2 my-1"}),(h||m)&&v.jsxs("div",{className:Te("md:col-span-2 flex items-center justify-between gap-3 rounded-xl border px-3 py-2 text-xs",m?"border-amber-300/50 bg-amber-50 text-amber-900":"border-border bg-muted/30 text-muted-foreground"),children:[v.jsx("span",{className:"flex items-center gap-2",children:h?v.jsxs(v.Fragment,{children:[v.jsx(Ba,{className:"h-3.5 w-3.5 animate-spin"}),"Cargando listas…"]}):v.jsxs(v.Fragment,{children:[v.jsx($u,{className:"h-3.5 w-3.5"}),"No se pudieron cargar las listas. Se usaron opciones locales."]})}),m&&v.jsx("button",{type:"button",onClick:()=>void b(),className:"font-medium text-amber-950 underline-offset-4 hover:underline",children:"Reintentar"})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs(gt,{children:["Cliente ",v.jsx("span",{className:"text-destructive",children:"*"})]}),v.jsx(Zr,{value:S.cliente,options:vn,onValueChange:Ar,placeholder:"Seleccionar…",searchPlaceholder:"Buscar cliente…",emptyText:"No se encontró ese cliente."})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs(gt,{children:["Marca ",v.jsx("span",{className:"text-destructive",children:"*"})]}),v.jsx(Hw,{values:et,options:Zt,onValuesChange:ae=>Rt("marca",VU(ae)),placeholder:"Seleccionar una o varias marcas…",searchPlaceholder:"Buscar marca…",emptyText:"No se encontró esa marca.",summaryLabel:"marcas seleccionadas"})]}),lr?v.jsxs("div",{className:"md:col-span-2 space-y-2 rounded-xl border border-primary/20 bg-primary/5 p-3",children:[v.jsxs("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between",children:[v.jsxs(gt,{children:["BU Solicita (Países) ",v.jsx("span",{className:"text-destructive",children:"*"})]}),v.jsxs("span",{className:"text-xs font-medium text-primary",children:[C.length," seleccionado(s)"]})]}),v.jsx("p",{className:"text-xs text-muted-foreground",children:"Para Walmart Connect WMC puedes seleccionar varios países. La app creará un proyecto y una fila del Sheet por cada país, como hasta ahora."}),v.jsxs("div",{className:"relative",children:[v.jsx(Bu,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),v.jsx(An,{value:F,onChange:ae=>B(ae.target.value),placeholder:"Buscar país…",className:"h-9 pl-9 bg-card"})]}),v.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:wt.map(ae=>{const Re=C.some(Fe=>at(Fe)===at(ae)),Be=vt(ae);return v.jsxs("label",{className:Te("flex cursor-pointer items-start gap-2 rounded-lg border bg-card px-3 py-2 text-sm transition-colors",Re?"border-primary/50 bg-primary/10":"border-border hover:bg-muted/40"),children:[v.jsx(VE,{checked:Re,onCheckedChange:Fe=>Vn(ae,Fe===!0),className:"mt-0.5"}),v.jsxs("span",{className:"leading-tight",children:[v.jsx("span",{className:"block font-medium",children:ae}),v.jsxs("span",{className:"text-xs text-muted-foreground",children:["CM: ",Be||"—"]})]})]},ae)})})]}):v.jsxs("div",{className:"md:col-span-2 space-y-1.5",children:[v.jsxs(gt,{children:["BU Solicita (Países) ",v.jsx("span",{className:"text-destructive",children:"*"})]}),v.jsx(Hw,{values:He,options:Gt,onValuesChange:eo,placeholder:"Seleccionar uno o varios países…",searchPlaceholder:"Buscar país…",emptyText:"No se encontró ese país.",summaryLabel:"países seleccionados"}),v.jsx("p",{className:"text-xs text-muted-foreground",children:"Si seleccionas varios países al crear, la app creará un proyecto y una fila del Sheet por cada país."})]}),v.jsxs("div",{className:Te("space-y-1.5",lr&&"md:col-span-2"),children:[v.jsxs(gt,{className:"flex items-center gap-1.5",children:["Country Manager ",v.jsx("span",{className:"text-xs text-muted-foreground",children:"(automático)"})]}),lr?v.jsx("div",{className:"min-h-10 rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:Ja.length===0?v.jsx("span",{className:"text-muted-foreground",children:"Selecciona uno o más países."}):v.jsx("div",{className:"flex flex-wrap gap-1.5",children:Ja.map(({country:ae,manager:Re})=>v.jsxs(Es,{variant:"secondary",className:"font-normal",children:[ae,": ",Re||"—"]},ae))})}):v.jsx("div",{className:"min-h-10 rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:Gn.length===0?v.jsx("span",{className:"text-muted-foreground",children:"Selecciona uno o más países."}):v.jsx("div",{className:"flex flex-wrap gap-1.5",children:Gn.map(({country:ae,manager:Re})=>v.jsxs(Es,{variant:"secondary",className:"font-normal",children:[ae,": ",Re||"—"]},ae))})})]}),Nr&&_&&v.jsx("div",{className:"md:col-span-2 rounded-xl border border-amber-300/50 bg-amber-50 px-3 py-2 text-xs text-amber-900",children:"Si seleccionas varios países, el Interno Cargado se aplicará por cada país. La app no divide el monto automáticamente."}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs(gt,{children:["Solicitado por ",v.jsx("span",{className:"text-destructive",children:"*"})]}),v.jsx(An,{value:S.solicitante,onChange:ae=>Rt("solicitante",ae.target.value),placeholder:"Nombre de quien solicita",className:"h-10"})]}),v.jsx(YU,{isEdit:E,items:ce,loading:ge,error:fe,note:K,hasMore:te,loadingMore:k,addingNote:$,onNoteChange:Q,onAddNote:yn,onRefresh:or,onLoadMore:Lt}),v.jsx(zi,{className:"md:col-span-2 my-1"}),v.jsxs("div",{className:"md:col-span-2 space-y-1.5",children:[v.jsxs(gt,{children:["Link del Brief"," ",v.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"(carpeta de Fulgencio)"})]}),v.jsx(An,{value:S.briefLink,onChange:ae=>Rt("briefLink",ae.target.value),placeholder:"https://drive.google.com/…",className:"h-10"})]}),v.jsx("div",{className:"md:col-span-2",children:v.jsx(Pw,{label:"Links de Propuestas",links:S.propuestaLinks,onChange:ae=>Rt("propuestaLinks",ae),emptyText:"Aún no hay propuestas. Pega tantos links como necesites."})}),v.jsx("div",{className:"md:col-span-2",children:v.jsx(Pw,{label:"Links de Artes Finales",prefix:"AF",links:S.afLinks,onChange:ae=>Rt("afLinks",ae),emptyText:"Aún no hay artes finales."})}),v.jsx(zi,{className:"md:col-span-2 my-1"}),_&&v.jsx(Cz,{items:U,onChange:X,loading:J,error:ie}),v.jsx(zi,{className:"md:col-span-2 my-1"}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs(gt,{className:"flex items-center gap-1.5 pl-1",children:["Estatus",!g&&v.jsx(h2,{className:"w-3 h-3 text-muted-foreground"})]}),g?v.jsxs(w4,{value:S.status||"_none",onValueChange:ae=>Rt("status",ae==="_none"?"":ae),children:[v.jsx(T1,{className:"h-10",children:v.jsx(x4,{placeholder:"Sin estatus"})}),v.jsxs(k1,{children:[v.jsx(Xm,{value:"_none",children:"Sin estatus"}),Tr.map(ae=>v.jsx(Xm,{value:ae,children:ae},ae))]})]}):v.jsx("div",{className:"h-10 px-3 flex items-center rounded-md border border-border bg-muted/30 text-sm text-foreground",children:S.status||"Sin estatus"}),!g&&v.jsx("p",{className:"pl-1 text-[11px] text-muted-foreground",children:"Solo el Director Creativo puede cambiar el estatus."})]}),_&&v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs(gt,{className:"flex items-center gap-1.5 pl-1",children:["Interno Cargado ",v.jsx(Xx,{className:"w-3.5 h-3.5 text-muted-foreground"})]}),v.jsx(An,{type:"number",value:S.monto??"",onChange:ae=>{Se(!0),Rt("monto",ae.target.value===""?null:Number(ae.target.value))},placeholder:"0.00",className:"h-10"}),v.jsxs("p",{className:"pl-1 text-[11px] text-muted-foreground",children:["Privado · solo usuarios internos autorizados.",Ee&&U.length>0?" Monto ajustado manualmente; se respetará al guardar.":U.length>0?" El total del tarifario se refleja aquí y puedes ajustarlo.":""]})]})]}),(re||P)&&v.jsxs("div",{className:Te("mt-5 flex items-start gap-2 rounded-xl border px-3 py-2 text-sm",re?"border-destructive/30 bg-destructive/5 text-destructive":"border-primary/20 bg-primary/5 text-primary"),children:[re?v.jsx($u,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}):v.jsx(Ba,{className:"mt-0.5 h-4 w-4 flex-shrink-0 animate-spin"}),v.jsx("span",{children:re||P})]})]}),v.jsx(jE,{className:"px-7 py-4 border-t bg-muted/30 rounded-b-lg sm:justify-between",children:v.jsxs("div",{className:"flex w-full flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[v.jsx("div",{children:E&&r&&w&&s&&v.jsxs(ct,{type:"button",variant:"destructive",onClick:()=>s(r),disabled:N||o,className:"gap-1.5 rounded-full",children:[o?v.jsx(Ba,{className:"h-4 w-4 animate-spin"}):v.jsx(Jx,{className:"h-4 w-4"}),o?"Eliminando…":"Eliminar proyecto"]})}),v.jsxs("div",{className:"flex justify-end gap-2",children:[v.jsx(ct,{variant:"ghost",onClick:()=>t(!1),disabled:N||o,children:"Cancelar"}),v.jsxs(ct,{onClick:kt,disabled:!ur||N||o,children:[N&&v.jsx(Ba,{className:"mr-1.5 h-4 w-4 animate-spin"}),N?"Guardando…":E?"Guardar cambios":Nr?"Crear proyectos":"Crear proyecto"]})]})]})})]})})}function YU({isEdit:e,items:t,loading:r,error:s,note:o,hasMore:l,loadingMore:u,addingNote:d,onNoteChange:h,onAddNote:m,onRefresh:b,onLoadMore:g}){return v.jsxs("div",{className:"md:col-span-2 rounded-2xl border border-border bg-muted/20 p-4",children:[v.jsxs("div",{className:"mb-3 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[v.jsxs("div",{className:"flex items-start gap-2.5",children:[v.jsx("span",{className:"mt-0.5 flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 text-primary",children:v.jsx(r2,{className:"h-4 w-4"})}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-sm font-semibold",children:"Actividad del proyecto"}),v.jsx("p",{className:"text-xs text-muted-foreground",children:"Comentarios y movimientos recientes con fecha."})]})]}),e&&v.jsxs(ct,{type:"button",variant:"ghost",size:"sm",onClick:()=>void b(),disabled:r,className:"h-8 rounded-full px-2.5 text-xs text-muted-foreground hover:text-foreground",children:[r?v.jsx(Ba,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):null,"Actualizar"]})]}),e?v.jsxs("div",{className:"space-y-3",children:[v.jsxs("div",{className:"rounded-xl border border-border bg-card p-3",children:[v.jsx(gt,{className:"text-xs font-medium",children:"Agregar comentario o solicitud adicional"}),v.jsxs("div",{className:"mt-2 flex flex-col gap-2 sm:flex-row",children:[v.jsx(Ju,{value:o,onChange:w=>h(w.target.value),placeholder:"Ej: CM pidió ajustar artes, agregar una marca o cambiar una fecha…",rows:2,className:"min-h-[64px] flex-1 resize-none"}),v.jsxs(ct,{type:"button",onClick:()=>void m(),disabled:!o.trim()||d,className:"gap-1.5 rounded-full sm:self-end",children:[d?v.jsx(Ba,{className:"h-4 w-4 animate-spin"}):v.jsx(b2,{className:"h-4 w-4"}),"Agregar"]})]})]}),s&&v.jsxs("div",{className:"flex items-start gap-2 rounded-xl border border-amber-300/50 bg-amber-50 px-3 py-2 text-xs text-amber-900",children:[v.jsx($u,{className:"mt-0.5 h-3.5 w-3.5 flex-shrink-0"}),v.jsx("span",{children:s})]}),r&&t.length===0?v.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-border bg-card px-3 py-3 text-sm text-muted-foreground",children:[v.jsx(Ba,{className:"h-4 w-4 animate-spin"}),"Cargando actividad…"]}):t.length===0?v.jsx("div",{className:"rounded-xl border border-border bg-card px-3 py-3 text-sm text-muted-foreground",children:"Aún no hay actividad registrada. Los próximos comentarios o cambios quedarán aquí."}):v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"flex items-center justify-between gap-3 px-0.5 text-[11px] text-muted-foreground",children:[v.jsx("span",{children:"Mostrando los movimientos más recientes."}),v.jsxs("span",{children:[t.length," visibles"]})]}),v.jsx("div",{className:"max-h-[440px] space-y-2 overflow-y-auto pr-1",children:t.map(w=>{const _=$U(w.description);return v.jsxs("div",{className:"rounded-xl border border-border bg-card px-3 py-3 shadow-sm",children:[v.jsxs("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-start sm:justify-between",children:[v.jsxs("div",{children:[v.jsx("p",{className:"text-sm font-medium",children:w.title}),v.jsxs("p",{className:"text-xs text-muted-foreground",children:[w.actorName,w.actorEmail?` · ${w.actorEmail}`:""]})]}),v.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[v.jsx(XO,{className:"h-3.5 w-3.5"}),IU(w.createdAt)]})]}),_.length>0&&v.jsx("div",{className:"mt-2 space-y-1 text-sm text-muted-foreground",children:_.map(E=>v.jsx("p",{children:E},E))})]},w.id)})}),l&&v.jsx("div",{className:"flex justify-center pt-1",children:v.jsxs(ct,{type:"button",variant:"outline",size:"sm",onClick:()=>void g(),disabled:u,className:"rounded-full",children:[u?v.jsx(Ba,{className:"mr-1.5 h-4 w-4 animate-spin"}):null,u?"Cargando…":"Cargar más"]})})]})]}):v.jsx("div",{className:"rounded-xl border border-dashed border-border bg-card/70 px-3 py-3 text-sm text-muted-foreground",children:"El historial se activará cuando el proyecto sea creado."})]})}const Zo=24,Qw={country:"",brand:"",client:"",cm:""};function WU(e,t){if(e){const r=e.trim().split(/\s+/);return r.length>=2?(r[0][0]+r[1][0]).toUpperCase():e.slice(0,2).toUpperCase()}return t?t.slice(0,2).toUpperCase():"?"}function XU(){const[e,t]=y.useState(!1),[r,s]=y.useState(null),[o,l]=y.useState(""),[u,d]=y.useState("todos"),[h,m]=y.useState(Qw),[b,g]=y.useState({todos:1,abiertos:1,cerrados:1}),[w,_]=y.useState(null),E=b[u],{lists:S}=rC(),{projects:T,totalProjects:C,filterOptions:A,loading:N,error:z,refresh:F,remove:B}=vC({tab:u,search:o,page:E,pageSize:Zo,country:h.country,brand:h.brand,client:h.client,cm:h.cm}),{user:P,isGerardo:V,logout:re}=Nl(),le=Object.values(S.buCm),ce=dt([...S.bus,...A.countries,h.country]),de=dt([...S.marcas,...A.brands,h.brand]),ge=dt([...S.clientes,...A.clients,h.client]),me=dt([...le,...A.cms,h.cm]),fe=Object.values(h).filter(Boolean).length,M=Math.max(1,Math.ceil(C/Zo)),K=Math.min(E,M),Q=(K-1)*Zo,te=C===0?0:Q+1,W=Math.min(Q+Zo,C);y.useEffect(()=>{g(ue=>({...ue,[u]:1}))},[o,u,h.country,h.brand,h.client,h.cm]),y.useEffect(()=>{E>M&&g(ue=>({...ue,[u]:M}))},[E,u,M]);const k=ue=>{const Ee=Math.min(Math.max(ue,1),M);Ee!==E&&(g(Se=>({...Se,[u]:Ee})),window.scrollTo({top:0,behavior:"smooth"}))},j=(ue,Ee)=>{m(Se=>({...Se,[ue]:Ee}))},$=()=>{m(Qw)},D=()=>{s(null),t(!0)},U=ue=>{s(ue),t(!0)},X=async ue=>{if(window.confirm(`¿Seguro que deseas eliminar el proyecto "${ue.nombre||"Sin título"}"?
|
||
|
||
Esta acción eliminará el proyecto del tablero y del Google Sheet.`)){_(ue.id);try{await B(ue.id),(r==null?void 0:r.id)===ue.id&&(t(!1),s(null))}catch(Se){console.error("Error eliminando proyecto:",Se);const et=Se instanceof Error?Se.message:"No se pudo eliminar el proyecto. Revisa n8n, Supabase o permisos.";window.alert(et)}finally{_(null)}}},J=(P==null?void 0:P.displayName)??(P==null?void 0:P.email)??"Usuario",se=V?"Jefe CDC":"Usuario CDC",ie=WU(P==null?void 0:P.displayName,P==null?void 0:P.email);return v.jsxs("div",{className:"min-h-screen bg-background",children:[v.jsx("header",{className:"sticky top-0 z-30 bg-background/85 backdrop-blur-md border-b border-border",children:v.jsxs("div",{className:"max-w-[1400px] mx-auto px-6 py-3.5 flex items-center gap-4",children:[v.jsxs("div",{className:"flex items-center gap-2.5",children:[v.jsx("div",{className:"w-9 h-9 rounded-xl bg-primary flex items-center justify-center",children:v.jsx(gp,{className:"w-4 h-4 text-primary-foreground"})}),v.jsxs("div",{className:"leading-tight",children:[v.jsx("h1",{className:"text-[15px] font-semibold tracking-tight",children:"Tablero CDC"}),v.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Flujo de Proyectos"})]})]}),v.jsxs("div",{className:"flex-1 max-w-md ml-4 relative hidden md:block",children:[v.jsx(Bu,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),v.jsx(An,{value:o,onChange:ue=>l(ue.target.value),placeholder:"Buscar proyecto, cliente, marca…",className:"pl-9 h-9 bg-muted/40 border-transparent focus-visible:bg-card focus-visible:border-border"})]}),v.jsx("div",{className:"flex-1 md:flex-none"}),v.jsxs($3,{children:[v.jsx(B3,{asChild:!0,children:v.jsxs(ct,{variant:"ghost",size:"sm",className:"gap-2 h-9 px-2.5",children:[v.jsxs(sE,{className:"w-7 h-7",children:[(P==null?void 0:P.photoURL)&&v.jsx(iE,{src:P.photoURL,alt:J,referrerPolicy:"no-referrer"}),v.jsx(oE,{className:V?"bg-primary text-primary-foreground text-xs":"bg-accent text-accent-foreground text-xs",children:ie})]}),v.jsxs("div",{className:"text-left leading-tight hidden sm:block",children:[v.jsx("div",{className:"text-xs font-medium",children:J}),v.jsx("div",{className:"text-[10px] text-muted-foreground",children:se})]}),v.jsx(pp,{className:"w-3.5 h-3.5 text-muted-foreground"})]})}),v.jsxs(KS,{align:"end",className:"w-52",children:[v.jsxs("div",{className:"px-3 py-2",children:[v.jsx("p",{className:"text-xs font-medium truncate",children:J}),v.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:P==null?void 0:P.email})]}),v.jsx(WS,{}),v.jsxs(YS,{onClick:re,className:"gap-2 text-destructive focus:text-destructive focus:bg-destructive/10 cursor-pointer",children:[v.jsx(p2,{className:"w-3.5 h-3.5"}),"Cerrar sesión"]})]})]}),v.jsxs(ct,{onClick:D,className:"gap-1.5 h-9 rounded-full px-4 shadow-sm",children:[v.jsx(gl,{className:"w-4 h-4"})," Nuevo"]})]})}),v.jsxs("div",{className:"max-w-[1400px] mx-auto px-6 pt-6 pb-3 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[v.jsx("div",{children:v.jsx("h2",{className:"pl-3 text-2xl font-semibold tracking-tight",children:"Proyectos"})}),v.jsx("div",{className:"flex items-center gap-2",children:v.jsx("div",{className:"inline-flex bg-muted/60 rounded-full p-1 text-xs",children:[["todos","Todos"],["abiertos","Activos"],["cerrados","Cerrados"]].map(([ue,Ee])=>v.jsx("button",{onClick:()=>d(ue),className:`px-3.5 py-1.5 rounded-full transition-colors font-medium ${u===ue?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:Ee},ue))})})]}),v.jsxs("div",{className:"relative md:hidden",children:[v.jsx(Bu,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),v.jsx(An,{value:o,onChange:ue=>l(ue.target.value),placeholder:"Buscar proyecto, cliente, marca…",className:"pl-9 h-9 bg-muted/40 border-transparent focus-visible:bg-card focus-visible:border-border"})]}),v.jsx(JU,{filters:h,activeCount:fe,countryOptions:ce,brandOptions:de,clientOptions:ge,cmOptions:me,onFilterChange:j,onClear:$})]}),v.jsxs("main",{className:"max-w-[1400px] mx-auto px-6 pb-16",children:[z&&v.jsxs("div",{className:"mb-4 flex flex-col gap-3 rounded-2xl border border-destructive/30 bg-destructive/5 px-4 py-3 text-sm text-destructive sm:flex-row sm:items-center sm:justify-between",children:[v.jsxs("span",{className:"flex items-start gap-2",children:[v.jsx($u,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),v.jsxs("span",{children:[v.jsx("span",{className:"font-medium",children:"No se pudieron cargar los proyectos."})," ",z]})]}),v.jsxs(ct,{variant:"outline",size:"sm",onClick:()=>void F(),className:"gap-1.5",children:[v.jsx(_2,{className:"h-3.5 w-3.5"})," Reintentar"]})]}),N&&T.length===0?v.jsx(eI,{}):T.length===0?v.jsx(tI,{onNew:D,hasProjects:C>0||u!=="todos"||o.trim().length>0||fe>0,filter:u,query:o,activeAdvancedFilterCount:fe}):v.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:T.map(ue=>v.jsx(uP,{project:ue,onClick:()=>U(ue)},ue.id))}),C>Zo&&v.jsx(QU,{currentPage:K,totalPages:M,visibleStart:te,visibleEnd:W,totalItems:C,onPageChange:k})]}),v.jsx(KU,{open:e,onOpenChange:t,project:r,onDelete:X,deleting:!!r&&w===r.id})]})}function JU({filters:e,activeCount:t,countryOptions:r,brandOptions:s,clientOptions:o,cmOptions:l,onFilterChange:u,onClear:d}){return v.jsx("div",{className:"rounded-2xl border border-border bg-card/70 px-3.5 py-3 shadow-sm",children:v.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center",children:[v.jsxs("div",{className:"flex items-center justify-between gap-3 lg:w-auto lg:min-w-[120px] lg:justify-start",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[v.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 text-primary",children:v.jsx(C2,{className:"h-4 w-4"})}),v.jsx("span",{children:"Filtros"}),t>0&&v.jsx("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-semibold text-primary",children:t})]}),t>0&&v.jsxs(ct,{type:"button",variant:"ghost",size:"sm",onClick:d,className:"h-8 rounded-full px-2.5 text-xs text-muted-foreground hover:text-foreground lg:hidden",children:[v.jsx(vl,{className:"mr-1 h-3.5 w-3.5"}),"Limpiar"]})]}),v.jsxs("div",{className:"grid flex-1 grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-4",children:[v.jsx(Zr,{value:e.country,options:r,onValueChange:h=>u("country",h),placeholder:"País: Todos",searchPlaceholder:"Buscar país…",emptyText:"No se encontró ese país.",clearLabel:"Todos"}),v.jsx(Zr,{value:e.brand,options:s,onValueChange:h=>u("brand",h),placeholder:"Marca: Todas",searchPlaceholder:"Buscar marca…",emptyText:"No se encontró esa marca.",clearLabel:"Todas"}),v.jsx(Zr,{value:e.client,options:o,onValueChange:h=>u("client",h),placeholder:"Cliente: Todos",searchPlaceholder:"Buscar cliente…",emptyText:"No se encontró ese cliente.",clearLabel:"Todos"}),v.jsx(Zr,{value:e.cm,options:l,onValueChange:h=>u("cm",h),placeholder:"CM: Todos",searchPlaceholder:"Buscar CM…",emptyText:"No se encontró ese CM.",clearLabel:"Todos"})]}),v.jsxs(ct,{type:"button",variant:"ghost",size:"sm",onClick:d,disabled:t===0,className:"hidden h-9 rounded-full px-3 text-xs text-muted-foreground hover:text-foreground lg:inline-flex",children:[v.jsx(vl,{className:"mr-1 h-3.5 w-3.5"}),"Limpiar"]})]})})}function QU({currentPage:e,totalPages:t,visibleStart:r,visibleEnd:s,totalItems:o,onPageChange:l}){const u=ZU(e,t);return v.jsxs("div",{className:"mt-6 flex flex-col sm:flex-row items-center justify-between gap-3 rounded-2xl border border-border bg-card/70 px-4 py-3",children:[v.jsxs("p",{className:"text-xs text-muted-foreground",children:[v.jsxs("span",{className:"font-medium text-foreground",children:[r,"-",s]})," ","de ",v.jsx("span",{className:"font-medium text-foreground",children:o})," proyectos"]}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsxs(ct,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1 rounded-full px-2.5",onClick:()=>l(e-1),disabled:e===1,children:[v.jsx(IO,{className:"h-4 w-4"}),v.jsx("span",{className:"hidden sm:inline",children:"Anterior"})]}),v.jsx("div",{className:"flex items-center gap-1",children:u.map((d,h)=>d==="ellipsis"?v.jsx("span",{className:"flex h-8 w-8 items-center justify-center text-xs text-muted-foreground",children:"…"},`ellipsis-${h}`):v.jsx(ct,{type:"button",variant:d===e?"default":"ghost",size:"sm",className:"h-8 w-8 rounded-full p-0 text-xs",onClick:()=>l(d),"aria-current":d===e?"page":void 0,children:d},d))}),v.jsxs(ct,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1 rounded-full px-2.5",onClick:()=>l(e+1),disabled:e===t,children:[v.jsx("span",{className:"hidden sm:inline",children:"Siguiente"}),v.jsx(Yx,{className:"h-4 w-4"})]})]})]})}function ZU(e,t){if(t<=7)return Array.from({length:t},(o,l)=>l+1);const r=new Set([1,t,e]);return e>1&&r.add(e-1),e<t&&r.add(e+1),e<=3&&(r.add(2),r.add(3),r.add(4)),e>=t-2&&(r.add(t-3),r.add(t-2),r.add(t-1)),Array.from(r).filter(o=>o>=1&&o<=t).sort((o,l)=>o-l).reduce((o,l)=>{const u=o[o.length-1];return typeof u=="number"&&l-u>1&&o.push("ellipsis"),o.push(l),o},[])}function eI(){return v.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Array.from({length:8}).map((e,t)=>v.jsxs("div",{className:"min-h-[230px] overflow-hidden rounded-2xl border border-border bg-card",children:[v.jsx("div",{className:"h-14 bg-muted animate-pulse"}),v.jsxs("div",{className:"space-y-3 p-4",children:[v.jsx("div",{className:"h-3 w-3/4 rounded-full bg-muted animate-pulse"}),v.jsx("div",{className:"h-3 w-2/3 rounded-full bg-muted animate-pulse"}),v.jsx("div",{className:"h-3 w-1/2 rounded-full bg-muted animate-pulse"}),v.jsx("div",{className:"mt-6 h-8 rounded-full bg-muted animate-pulse"})]})]},t))})}function tI({onNew:e,hasProjects:t,filter:r,query:s,activeAdvancedFilterCount:o}){const l=s.trim().length>0,u=o>0;let d="Tu tablero está vacío",h="Crea tu primer proyecto para que el equipo pueda darle seguimiento.";return t&&l&&u?(d="Nada coincide con la búsqueda y filtros",h="Intenta cambiar la búsqueda, limpiar filtros o seleccionar otras opciones."):t&&l?(d="Nada coincide con la búsqueda",h="Intenta cambiar la búsqueda o borrar el texto escrito."):t&&u?(d="Nada coincide con los filtros",h="Intenta limpiar filtros o seleccionar otras opciones."):t&&r==="abiertos"?(d="No hay proyectos activos",h="Cuando se cree un proyecto nuevo, aparecerá en esta pestaña."):t&&r==="cerrados"?(d="No hay proyectos cerrados",h="Cuando el Director Creativo asigne un estatus a un proyecto, aparecerá aquí."):t&&(d="Nada coincide con el filtro",h="Intenta quitar el filtro o cambiar la búsqueda."),v.jsxs("div",{className:"text-center py-24 rounded-2xl border border-dashed border-border bg-card/40",children:[v.jsx("div",{className:"w-14 h-14 rounded-2xl bg-primary/10 mx-auto flex items-center justify-center mb-4",children:v.jsx(gp,{className:"w-6 h-6 text-primary"})}),v.jsx("h3",{className:"text-lg font-semibold",children:d}),v.jsx("p",{className:"text-sm text-muted-foreground mt-1 max-w-sm mx-auto",children:h}),!t&&v.jsxs(ct,{onClick:e,className:"mt-5 gap-1.5 rounded-full",children:[v.jsx(gl,{className:"w-4 h-4"})," Crear proyecto"]})]})}const nI=({...e})=>v.jsx(zU,{className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e});class rI extends y.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,r){console.error("Uncaught error:",t,r)}render(){return this.state.hasError?v.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background px-4",children:v.jsxs("div",{className:"max-w-md text-center",children:[v.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground",children:"Ocurrió un error al cargar el tablero."}),v.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Intenta recargar la página."}),v.jsx("div",{className:"mt-6",children:v.jsx("button",{onClick:()=>window.location.reload(),className:"inline-flex items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90",children:"Recargar"})})]})}):this.props.children}}function aI(){const{user:e,loading:t}=Nl();return t?v.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:v.jsxs("div",{className:"flex flex-col items-center gap-3",children:[v.jsx("div",{className:"w-9 h-9 rounded-xl bg-primary flex items-center justify-center animate-pulse",children:v.jsxs("svg",{className:"w-4 h-4 text-primary-foreground",fill:"none",viewBox:"0 0 24 24",children:[v.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1",fill:"currentColor"}),v.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1",fill:"currentColor",opacity:"0.5"}),v.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",fill:"currentColor",opacity:"0.5"}),v.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1",fill:"currentColor"})]})}),v.jsx("p",{className:"text-sm text-muted-foreground",children:"Cargando tablero…"})]})}):e?v.jsx(UA,{children:v.jsx(vx,{path:"/*",element:v.jsx(XU,{})})}):v.jsx(jM,{})}function sI(){return v.jsx(rI,{children:v.jsx(RO,{children:v.jsxs(lN,{basename:"/tablero-cdc/",children:[v.jsx(aI,{}),v.jsx(nI,{richColors:!0,position:"top-right"})]})})})}IT.createRoot(document.getElementById("root")).render(v.jsx(y.StrictMode,{children:v.jsx(sI,{})}));
|